text: /* jQuery Form Styler v1.7 | (c) Dimox | https://github.com/Dimox/jQueryFormStyler */
  (function(c){"function"===typeof define&&define.amd?define(["jquery"],c):"object"===typeof exports?module.exports=c(require("jquery")):c(jQuery)})(function(c){function y(b,a){this.element=b;this.options=c.extend({},L,a);this.init()}function G(b){if(!c(b.target).parents().hasClass("jq-selectbox")&&"OPTION"!=b.target.nodeName&&c("div.jq-selectbox.opened").length){b=c("div.jq-selectbox.opened");var a=c("div.jq-selectbox__search input",b),g=c("div.jq-selectbox__dropdown",b);b.find("select").data("_"+
  l).options.onSelectClosed.call(b);a.length&&a.val("").keyup();g.hide().find("li.sel").addClass("selected");b.removeClass("focused opened dropup dropdown")}}var l="styler",L={wrapper:"form",idSuffix:"-styler",filePlaceholder:"\u0424\u0430\u0439\u043b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d",fileBrowse:"\u041e\u0431\u0437\u043e\u0440...",selectPlaceholder:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435...",selectSearch:!1,selectSearchLimit:10,selectSearchNotFound:"\u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e",
  selectSearchPlaceholder:"\u041f\u043e\u0438\u0441\u043a...",selectVisibleOptions:0,singleSelectzIndex:"100",selectSmartPositioning:!0,onSelectOpened:function(){},onSelectClosed:function(){},onFormStyled:function(){}};y.prototype={init:function(){function b(){var c="",d="",b="",e="";void 0!==a.attr("id")&&""!==a.attr("id")&&(c=' id="'+a.attr("id")+g.idSuffix+'"');void 0!==a.attr("title")&&""!==a.attr("title")&&(d=' title="'+a.attr("title")+'"');void 0!==a.attr("class")&&""!==a.attr("class")&&(b=" "+
  a.attr("class"));var k=a.data(),w;for(w in k)""!==k[w]&&(e+=" data-"+w+'="'+k[w]+'"');this.id=c+e;this.title=d;this.classes=b}var a=c(this.element),g=this.options,z=navigator.userAgent.match(/(iPad|iPhone|iPod)/i)&&!navigator.userAgent.match(/(Windows\sPhone)/i)?!0:!1,l=navigator.userAgent.match(/Android/i)&&!navigator.userAgent.match(/(Windows\sPhone)/i)?!0:!1;if(a.is(":checkbox")){var y=function(){var g=new b,d=c("<div"+g.id+' class="jq-checkbox'+g.classes+'"'+g.title+'><div class="jq-checkbox__div"></div></div>');
  a.css({position:"absolute",zIndex:"-1",opacity:0,margin:0,padding:0}).after(d).prependTo(d);d.attr("unselectable","on").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none",display:"inline-block",position:"relative",overflow:"hidden"});a.is(":checked")&&d.addClass("checked");a.is(":disabled")&&d.addClass("disabled");d.on("click.styler",function(){d.is(".disabled")||(a.is(":checked")?(a.prop("checked",!1),d.removeClass("checked")):
  (a.prop("checked",!0),d.addClass("checked")),a.change());return!1});a.closest("label").add('label[for="'+a.attr("id")+'"]').on("click.styler",function(a){c(a.target).is("a")||(d.click(),a.preventDefault())});a.on("change.styler",function(){a.is(":checked")?d.addClass("checked"):d.removeClass("checked")}).on("keydown.styler",function(a){32==a.which&&d.click()}).on("focus.styler",function(){d.is(".disabled")||d.addClass("focused")}).on("blur.styler",function(){d.removeClass("focused")})};y();a.on("refresh",
  function(){a.off(".styler").parent().before(a).remove();y()})}else if(a.is(":radio")){var B=function(){var u=new b,d=c("<div"+u.id+' class="jq-radio'+u.classes+'"'+u.title+'><div class="jq-radio__div"></div></div>');a.css({position:"absolute",zIndex:"-1",opacity:0,margin:0,padding:0}).after(d).prependTo(d);d.attr("unselectable","on").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none",display:"inline-block",position:"relative"});
  a.is(":checked")&&d.addClass("checked");a.is(":disabled")&&d.addClass("disabled");d.on("click.styler",function(){d.is(".disabled")||(d.closest(g.wrapper).find('input[name="'+a.attr("name")+'"]').prop("checked",!1).parent().removeClass("checked"),a.prop("checked",!0).parent().addClass("checked"),a.change());return!1});a.closest("label").add('label[for="'+a.attr("id")+'"]').on("click.styler",function(a){c(a.target).is("a")||(d.click(),a.preventDefault())});a.on("change.styler",function(){a.parent().addClass("checked")}).on("focus.styler",
  function(){d.is(".disabled")||d.addClass("focused")}).on("blur.styler",function(){d.removeClass("focused")})};B();a.on("refresh",function(){a.off(".styler").parent().before(a).remove();B()})}else if(a.is(":file")){a.css({position:"absolute",top:0,right:0,width:"100%",height:"100%",opacity:0,margin:0,padding:0});var C=function(){var u=new b,d=a.data("placeholder");void 0===d&&(d=g.filePlaceholder);var l=a.data("browse");if(void 0===l||""===l)l=g.fileBrowse;var e=c("<div"+u.id+' class="jq-file'+u.classes+
  '"'+u.title+' style="display: inline-block; position: relative; overflow: hidden"></div>'),k=c('<div class="jq-file__name">'+d+"</div>").appendTo(e);c('<div class="jq-file__browse">'+l+"</div>").appendTo(e);a.after(e);e.append(a);a.is(":disabled")&&e.addClass("disabled");a.on("change.styler",function(){var c=a.val();if(a.is("[multiple]"))for(var c="",b=a[0].files,h=0;h<b.length;h++)c+=(0<h?", ":"")+b[h].name;k.text(c.replace(/.+[\\\/]/,""));""===c?(k.text(d),e.removeClass("changed")):e.addClass("changed")}).on("focus.styler",
  function(){e.addClass("focused")}).on("blur.styler",function(){e.removeClass("focused")}).on("click.styler",function(){e.removeClass("focused")})};C();a.on("refresh",function(){a.off(".styler").parent().before(a).remove();C()})}else if(a.is("select")){var F=function(){function u(a){a.off("mousewheel DOMMouseScroll").on("mousewheel DOMMouseScroll",function(a){var b=null;"mousewheel"==a.type?b=-1*a.originalEvent.wheelDelta:"DOMMouseScroll"==a.type&&(b=40*a.originalEvent.detail);b&&(a.stopPropagation(),
  a.preventDefault(),c(this).scrollTop(b+c(this).scrollTop()))})}function d(){for(var a=0,c=k.length;a<c;a++){var b="",d="",g=b="",e="",r="",v="";k.eq(a).prop("selected")&&(d="selected sel");k.eq(a).is(":disabled")&&(d="disabled");k.eq(a).is(":selected:disabled")&&(d="selected sel disabled");void 0!==k.eq(a).attr("class")&&(e=" "+k.eq(a).attr("class"),v=' data-jqfs-class="'+k.eq(a).attr("class")+'"');var s=k.eq(a).data(),f;for(f in s)""!==s[f]&&(g+=" data-"+f+'="'+s[f]+'"');""!==d+e&&(b=' class="'+
  d+e+'"');b="<li"+v+g+b+">"+k.eq(a).html()+"</li>";k.eq(a).parent().is("optgroup")&&(void 0!==k.eq(a).parent().attr("class")&&(r=" "+k.eq(a).parent().attr("class")),b="<li"+v+g+' class="'+d+e+" option"+r+'">'+k.eq(a).html()+"</li>",k.eq(a).is(":first-child")&&(b='<li class="optgroup'+r+'">'+k.eq(a).parent().attr("label")+"</li>"+b));w+=b}}function y(){var e=new b,h="",A=a.data("placeholder"),n=a.data("search"),l=a.data("search-limit"),x=a.data("search-not-found"),r=a.data("search-placeholder"),v=a.data("z-index"),
  s=a.data("smart-positioning");void 0===A&&(A=g.selectPlaceholder);if(void 0===n||""===n)n=g.selectSearch;if(void 0===l||""===l)l=g.selectSearchLimit;if(void 0===x||""===x)x=g.selectSearchNotFound;void 0===r&&(r=g.selectSearchPlaceholder);if(void 0===v||""===v)v=g.singleSelectzIndex;if(void 0===s||""===s)s=g.selectSmartPositioning;var f=c("<div"+e.id+' class="jq-selectbox jqselect'+e.classes+'" style="display: inline-block; position: relative; z-index:'+v+'"><div class="jq-selectbox__select"'+e.title+
  ' style="position: relative"><div class="jq-selectbox__select-text"></div><div class="jq-selectbox__trigger"><div class="jq-selectbox__trigger-arrow"></div></div></div></div>');a.css({margin:0,padding:0}).after(f).prependTo(f);var K=c("div.jq-selectbox__select",f),t=c("div.jq-selectbox__select-text",f),e=k.filter(":selected");d();n&&(h='<div class="jq-selectbox__search"><input type="search" autocomplete="off" placeholder="'+r+'"></div><div class="jq-selectbox__not-found">'+x+"</div>");var m=c('<div class="jq-selectbox__dropdown" style="position: absolute">'+
  h+'<ul style="position: relative; list-style: none; overflow: auto; overflow-x: hidden">'+w+"</ul></div>");f.append(m);var q=c("ul",m),p=c("li",m),D=c("input",m),J=c("div.jq-selectbox__not-found",m).hide();p.length<l&&D.parent().hide();""===a.val()?t.text(A).addClass("placeholder"):t.text(e.text());var E=0,B=0;p.each(function(){var a=c(this);a.css({display:"inline-block"});a.innerWidth()>E&&(E=a.innerWidth(),B=a.width());a.css({display:""})});t.is(".placeholder")&&t.width()>E?t.width(t.width()):(h=
  f.clone().appendTo("body").width("auto"),n=h.outerWidth(),h.remove(),n==f.outerWidth()&&t.width(B));E>f.width()&&m.width(E);""===k.first().text()&&""!==a.data("placeholder")&&p.first().hide();a.css({position:"absolute",left:0,top:0,width:"100%",height:"100%",opacity:0});var C=f.outerHeight(),H=D.outerHeight(),I=q.css("max-height"),h=p.filter(".selected");1>h.length&&p.first().addClass("selected sel");void 0===p.data("li-height")&&p.data("li-height",p.outerHeight());var F=m.css("top");"auto"==m.css("left")&&
  m.css({left:0});"auto"==m.css("top")&&m.css({top:C});m.hide();h.length&&(k.first().text()!=e.text()&&f.addClass("changed"),f.data("jqfs-class",h.data("jqfs-class")),f.addClass(h.data("jqfs-class")));if(a.is(":disabled"))return f.addClass("disabled"),!1;K.click(function(){c("div.jq-selectbox").filter(".opened").length&&g.onSelectClosed.call(c("div.jq-selectbox").filter(".opened"));a.focus();if(!z){var b=c(window),d=p.data("li-height"),r=f.offset().top,e=b.height()-C-(r-b.scrollTop()),h=a.data("visible-options");
  if(void 0===h||""===h)h=g.selectVisibleOptions;var l=5*d,n=d*h;0<h&&6>h&&(l=n);0===h&&(n="auto");var h=function(){m.height("auto").css({bottom:"auto",top:F});var a=function(){q.css("max-height",Math.floor((e-20-H)/d)*d)};a();q.css("max-height",n);"none"!=I&&q.css("max-height",I);e<m.outerHeight()+20&&a()},A=function(){m.height("auto").css({top:"auto",bottom:F});var a=function(){q.css("max-height",Math.floor((r-b.scrollTop()-20-H)/d)*d)};a();q.css("max-height",n);"none"!=I&&q.css("max-height",I);r-
  b.scrollTop()-20<m.outerHeight()+20&&a()};!0===s||1===s?e>l+H+20?(h(),f.removeClass("dropup").addClass("dropdown")):(A(),f.removeClass("dropdown").addClass("dropup")):(!1===s||0===s)&&e>l+H+20&&(h(),f.removeClass("dropup").addClass("dropdown"));f.offset().left+m.outerWidth()>b.width()&&m.css({left:"auto",right:0});c("div.jqselect").css({zIndex:v-1}).removeClass("opened");f.css({zIndex:v});m.is(":hidden")?(c("div.jq-selectbox__dropdown:visible").hide(),m.show(),f.addClass("opened focused"),g.onSelectOpened.call(f)):
  (m.hide(),f.removeClass("opened dropup dropdown"),c("div.jq-selectbox").filter(".opened").length&&g.onSelectClosed.call(f));D.length&&(D.val("").keyup(),J.hide(),D.keyup(function(){var b=c(this).val();p.each(function(){c(this).html().match(RegExp(".*?"+b+".*?","i"))?c(this).show():c(this).hide()});""===k.first().text()&&""!==a.data("placeholder")&&p.first().hide();1>p.filter(":visible").length?J.show():J.hide()}));p.filter(".selected").length&&(""===a.val()?q.scrollTop(0):(0!==q.innerHeight()/d%2&&
  (d/=2),q.scrollTop(q.scrollTop()+p.filter(".selected").position().top-q.innerHeight()/2+d)));u(q);return!1}});p.hover(function(){c(this).siblings().removeClass("selected")});p.filter(".selected").text();p.filter(":not(.disabled):not(.optgroup)").click(function(){a.focus();var b=c(this),d=b.text();if(!b.is(".selected")){var h=b.index(),h=h-b.prevAll(".optgroup").length;b.addClass("selected sel").siblings().removeClass("selected sel");k.prop("selected",!1).eq(h).prop("selected",!0);t.text(d);f.data("jqfs-class")&&
  f.removeClass(f.data("jqfs-class"));f.data("jqfs-class",b.data("jqfs-class"));f.addClass(b.data("jqfs-class"));a.change()}m.hide();f.removeClass("opened dropup dropdown");g.onSelectClosed.call(f)});m.mouseout(function(){c("li.sel",m).addClass("selected")});a.on("change.styler",function(){t.text(k.filter(":selected").text()).removeClass("placeholder");p.removeClass("selected sel").not(".optgroup").eq(a[0].selectedIndex).addClass("selected sel");k.first().text()!=p.filter(".selected").text()?f.addClass("changed"):
  f.removeClass("changed")}).on("focus.styler",function(){f.addClass("focused");c("div.jqselect").not(".focused").removeClass("opened dropup dropdown").find("div.jq-selectbox__dropdown").hide()}).on("blur.styler",function(){f.removeClass("focused")}).on("keydown.styler keyup.styler",function(c){var b=p.data("li-height");""===a.val()?t.text(A).addClass("placeholder"):t.text(k.filter(":selected").text());p.removeClass("selected sel").not(".optgroup").eq(a[0].selectedIndex).addClass("selected sel");if(38==
  c.which||37==c.which||33==c.which||36==c.which)""===a.val()?q.scrollTop(0):q.scrollTop(q.scrollTop()+p.filter(".selected").position().top);40!=c.which&&39!=c.which&&34!=c.which&&35!=c.which||q.scrollTop(q.scrollTop()+p.filter(".selected").position().top-q.innerHeight()+b);13==c.which&&(c.preventDefault(),m.hide(),f.removeClass("opened dropup dropdown"),g.onSelectClosed.call(f))}).on("keydown.styler",function(a){32==a.which&&(a.preventDefault(),K.click())});G.registered||(c(document).on("click",G),
  G.registered=!0)}function e(){var g=new b,h=c("<div"+g.id+' class="jq-select-multiple jqselect'+g.classes+'"'+g.title+' style="display: inline-block; position: relative"></div>');a.css({margin:0,padding:0}).after(h);d();h.append("<ul>"+w+"</ul>");var e=c("ul",h).css({position:"relative","overflow-x":"hidden","-webkit-overflow-scrolling":"touch"}),n=c("li",h).attr("unselectable","on"),g=a.attr("size"),l=e.outerHeight(),x=n.outerHeight();void 0!==g&&0<g?e.css({height:x*g}):e.css({height:4*x});l>h.height()&&
  (e.css("overflowY","scroll"),u(e),n.filter(".selected").length&&e.scrollTop(e.scrollTop()+n.filter(".selected").position().top));a.prependTo(h).css({position:"absolute",left:0,top:0,width:"100%",height:"100%",opacity:0});if(a.is(":disabled"))h.addClass("disabled"),k.each(function(){c(this).is(":selected")&&n.eq(c(this).index()).addClass("selected")});else if(n.filter(":not(.disabled):not(.optgroup)").click(function(b){a.focus();var d=c(this);b.ctrlKey||b.metaKey||d.addClass("selected");b.shiftKey||
  d.addClass("first");b.ctrlKey||(b.metaKey||b.shiftKey)||d.siblings().removeClass("selected first");if(b.ctrlKey||b.metaKey)d.is(".selected")?d.removeClass("selected first"):d.addClass("selected first"),d.siblings().removeClass("first");if(b.shiftKey){var e=!1,f=!1;d.siblings().removeClass("selected").siblings(".first").addClass("selected");d.prevAll().each(function(){c(this).is(".first")&&(e=!0)});d.nextAll().each(function(){c(this).is(".first")&&(f=!0)});e&&d.prevAll().each(function(){if(c(this).is(".selected"))return!1;
  c(this).not(".disabled, .optgroup").addClass("selected")});f&&d.nextAll().each(function(){if(c(this).is(".selected"))return!1;c(this).not(".disabled, .optgroup").addClass("selected")});1==n.filter(".selected").length&&d.addClass("first")}k.prop("selected",!1);n.filter(".selected").each(function(){var a=c(this),b=a.index();a.is(".option")&&(b-=a.prevAll(".optgroup").length);k.eq(b).prop("selected",!0)});a.change()}),k.each(function(a){c(this).data("optionIndex",a)}),a.on("change.styler",function(){n.removeClass("selected");
  var a=[];k.filter(":selected").each(function(){a.push(c(this).data("optionIndex"))});n.not(".optgroup").filter(function(b){return-1<c.inArray(b,a)}).addClass("selected")}).on("focus.styler",function(){h.addClass("focused")}).on("blur.styler",function(){h.removeClass("focused")}),l>h.height())a.on("keydown.styler",function(a){38!=a.which&&37!=a.which&&33!=a.which||e.scrollTop(e.scrollTop()+n.filter(".selected").position().top-x);40!=a.which&&39!=a.which&&34!=a.which||e.scrollTop(e.scrollTop()+n.filter(".selected:last").position().top-
  e.innerHeight()+2*x)})}var k=c("option",a),w="";a.is("[multiple]")?l||z||e():y()};F();a.on("refresh",function(){a.off(".styler").parent().before(a).remove();F()})}else if(a.is(":reset"))a.on("click",function(){setTimeout(function(){a.closest(g.wrapper).find("input, select").trigger("refresh")},1)})},destroy:function(){var b=c(this.element);b.is(":checkbox")||b.is(":radio")?(b.removeData().off(".styler").removeAttr("style").parent().before(b).remove(),b.closest("label").add('label[for="'+b.attr("id")+
  '"]').off(".styler")):(b.is(":file")||b.is("select"))&&b.removeData().off(".styler").removeAttr("style").parent().before(b).remove()}};c.fn[l]=function(b){var a=arguments;if(void 0===b||"object"===typeof b)return this.each(function(){c.data(this,"_"+l)||c.data(this,"_"+l,new y(this,b))}).promise().done(function(){c(this[0]).data("_"+l).options.onFormStyled.call()});if("string"===typeof b&&"_"!==b[0]&&"init"!==b){var g;this.each(function(){var z=c.data(this,"_"+l);z instanceof y&&"function"===typeof z[b]&&
  (g=z[b].apply(z,Array.prototype.slice.call(a,1)))});return void 0!==g?g:this}};G.registered=!1});