text: /*! Selectric ϟ v1.8.4 (2014-09-23) - git.io/tjl9sQ - Copyright (c) 2014 Leonardo Santos - Dual licensed: MIT/GPL */
  !function(e){"use strict";var t="selectric",s="Input Items Open Disabled TempShow HideSelect Wrapper Hover Responsive Above Scroll",i=".sl",o={onChange:function(t){e(t).change()},maxHeight:300,keySearchTimeout:500,arrowButtonMarkup:'<b class="button">&#x25be;</b>',disableOnMobile:!0,openOnHover:!1,expandToItemText:!1,responsive:!1,preventWindowScroll:!0,inheritOriginalWidth:!1,customClass:{prefix:t,postfixes:s,camelCase:!0},optionsItemBuilder:"{text}"},n={add:function(e,t,s){this[e]||(this[e]={}),this[e][t]=s},remove:function(e,t){delete this[e][t]}},a={replaceDiacritics:function(e){for(var t="40-46 50-53 54-57 62-70 71-74 61 47 77".replace(/\d+/g,"\\3$&").split(" "),s=t.length;s--;)e=e.toLowerCase().replace(RegExp("["+t[s]+"]","g"),"aeiouncy".charAt(s));return e},format:function(e){var t=arguments;return(""+e).replace(/{(\d+|(\w+))}/g,function(e,s,i){return i&&t[1]?t[1][i]:t[s]})},nextEnabledItem:function(e,t){for(;e[t=(t+1)%e.length].disabled;);return t},previousEnabledItem:function(e,t){for(;e[t=(t>0?t:e.length)-1].disabled;);return t},toDash:function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},triggerCallback:function(s,i){var o=i.element,l=i.options["on"+s];e.isFunction(l)&&l.call(o,o,i),n[s]&&e.each(n[s],function(){this.call(o,o,i)}),e(o).trigger(t+"-"+a.toDash(s),i)}},l=e(document),r=e(window),c=function(n,c){function d(t){if($.options=e.extend(!0,{},o,$.options,t),$.classes={},$.element=n,a.triggerCallback("BeforeInit",$),$.options.disableOnMobile&&L)return void($.disableOnMobile=!0);C(!0);var i=$.options.customClass,l=i.postfixes.split(" "),r=R.width();e.each(s.split(" "),function(e,t){var s=i.prefix+l[e];$.classes[t.toLowerCase()]=i.camelCase?s:a.toDash(s)}),x=e("<input/>",{"class":$.classes.input,readonly:L}),k=e("<div/>",{"class":$.classes.items,tabindex:-1}),T=e("<div/>",{"class":$.classes.scroll}),D=e("<div/>",{"class":i.prefix,html:$.options.arrowButtonMarkup}),y=e('<p class="label"/>'),I=R.wrap("<div>").parent().append(D.prepend(y),k,x),A={open:v,close:m,destroy:C,refresh:u,init:d},R.on(A).wrap('<div class="'+$.classes.hideselect+'">'),e.extend($,A),$.options.inheritOriginalWidth&&r>0&&I.width(r),p()}function p(){$.items=[];var s=R.children(),o="<ul>",n=s.filter(":selected").index();H=S=~n?n:0,(E=s.length)&&(s.each(function(t){var s=e(this),i=s.html(),n=s.prop("disabled"),l=$.options.optionsItemBuilder;$.items[t]={value:s.val(),text:i,slug:a.replaceDiacritics(i),disabled:n},o+=a.format('<li class="{1}">{2}</li>',e.trim([t==H?"selected":"",t==E-1?"last":"",n?"disabled":""].join(" ")),e.isFunction(l)?l($.items[t],s,t):a.format(l,$.items[t]))}),k.append(T.html(o+"</ul>")),y.html($.items[H].text)),D.add(R).add(I).add(x).off(i),I.prop("class",[$.classes.wrapper,R.prop("class").replace(/\S+/g,t+"-$&"),$.options.responsive?$.classes.responsive:""].join(" ")),R.prop("disabled")?(I.addClass($.classes.disabled),x.prop("disabled",!0)):(j=!0,I.removeClass($.classes.disabled).on("mouseenter"+i+" mouseleave"+i,function(t){e(this).toggleClass($.classes.hover),$.options.openOnHover&&(clearTimeout($.closeTimer),"mouseleave"==t.type?$.closeTimer=setTimeout(m,500):v())}),D.on("click"+i,function(e){Y?m():v(e)}),x.prop({tabindex:q,disabled:!1}).on("keypress"+i,h).on("keydown"+i,function(e){h(e),clearTimeout($.resetStr),$.resetStr=setTimeout(function(){x.val("")},$.options.keySearchTimeout);var t=e.keyCode||e.which;t>36&&41>t&&b(a[(39>t?"previous":"next")+"EnabledItem"]($.items,S))}).on("focusin"+i,function(e){x.one("blur",function(){x.blur()}),Y||v(e)}).on("oninput"in x[0]?"input":"keyup",function(){x.val().length&&e.each($.items,function(e,t){return RegExp("^"+x.val(),"i").test(t.slug)&&!t.disabled?(b(e),!1):void 0})}),R.prop("tabindex",!1),O=e("li",k.removeAttr("style")).click(function(){return b(e(this).index(),!0),!1})),a.triggerCallback("Init",$)}function u(){a.triggerCallback("Refresh",$),p()}function h(e){var t=e.keyCode||e.which;13==t&&e.preventDefault(),/^(9|13|27)$/.test(t)&&(e.stopPropagation(),b(S,!0))}function f(){var e=k.closest(":visible").children(":hidden"),t=$.options.maxHeight;e.addClass($.classes.tempshow);var s=k.outerWidth(),i=D.outerWidth()-(s-k.width());!$.options.expandToItemText||i>s?W=i:(k.css("overflow","scroll"),I.width(9e4),W=k.width(),k.css("overflow",""),I.width("")),k.width(W).height()>t&&k.height(t),e.removeClass($.classes.tempshow)}function v(s){a.triggerCallback("BeforeOpen",$),s&&(s.preventDefault(),s.stopPropagation()),j&&(f(),e("."+$.classes.hideselect,"."+$.classes.open).children()[t]("close"),Y=!0,B=k.outerHeight(),M=k.height(),x.val("").is(":focus")||x.focus(),l.on("click"+i,m).on("scroll"+i,g),g(),$.options.preventWindowScroll&&l.on("mousewheel"+i+" DOMMouseScroll"+i,"."+$.classes.scroll,function(t){var s=t.originalEvent,i=e(this).scrollTop(),o=0;"detail"in s&&(o=-1*s.detail),"wheelDelta"in s&&(o=s.wheelDelta),"wheelDeltaY"in s&&(o=s.wheelDeltaY),"deltaY"in s&&(o=-1*s.deltaY),(i==this.scrollHeight-M&&0>o||0==i&&o>0)&&t.preventDefault()}),I.addClass($.classes.open),w(S),a.triggerCallback("Open",$))}function g(){f(),I.toggleClass($.classes.above,I.offset().top+I.outerHeight()+B>r.scrollTop()+r.height())}function m(){if(a.triggerCallback("BeforeClose",$),H!=S){a.triggerCallback("BeforeChange",$);var e=$.items[S].text;R.prop("selectedIndex",H=S).data("value",e),y.html(e),a.triggerCallback("Change",$)}l.off(i),I.removeClass($.classes.open),Y=!1,a.triggerCallback("Close",$)}function b(e,t){$.items[S=e].disabled||(O.removeClass("selected").eq(e).addClass("selected"),w(e),t&&m())}function w(e){var t=O.eq(e).outerHeight(),s=O[e].offsetTop,i=T.scrollTop(),o=s+2*t;T.scrollTop(o>i+B?o-B:i>s-t?s-t:i)}function C(e){j&&(k.add(D).add(x).remove(),!e&&R.removeData(t).removeData("value"),R.prop("tabindex",q).off(i).off(A).unwrap().unwrap(),j=!1)}var x,k,T,D,y,I,O,S,H,B,M,W,E,A,$=this,R=e(n),Y=!1,j=!1,L=/android|ip(hone|od|ad)/i.test(navigator.userAgent),q=R.prop("tabindex");d(c)};e.fn[t]=function(s){return this.each(function(){var i=e.data(this,t);i&&!i.disableOnMobile?""+s===s&&i[s]?i[s]():i.init(s):e.data(this,t,new c(this,s))})},e.fn[t].hooks=n}(jQuery);