!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.enquire=e()}}(function(){return function e(t,i,n){function o(s,a){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=i[s]={exports:{}};t[s][0].call(p.exports,function(e){var i=t[s][1][e];return o(i||e)},p,p.exports,e,t,i,n)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;sO&&(O=-50),f(this),d.each(function(){var r=e(this);o(r);var s=this,a=s.id,d=-O+"%",f=100+2*O+"%",v=(f={position:"absolute",top:d,left:d,display:"block",width:f,height:f,margin:0,padding:0,background:"#fff",border:0,opacity:0},d=_mobile?{position:"absolute",visibility:"hidden"}:O?f:{position:"absolute",opacity:0},"checkbox"==s[_type]?g.checkboxClass||"icheckbox":g.radioClass||"i"+p),_=e(_label+'[for="'+a+'"]').add(r.closest(_label)),S=!!g.aria,$=l+"-"+Math.random().toString(36).substr(2,6),T='
")[_callback]("ifCreated").parent().append(g.insert),f=e('').css(f).appendTo(T),r.data(l,{o:g,s:r.attr("style")}).css(d),g.inheritClass&&T[_add](s.className||""),g.inheritID&&a&&T.attr("id",l+"-"+a),"static"==T.css("position")&&T.css("position","relative"),t(r,!0,_update),_.length&&_.on(_click+".i mouseover.i mouseout.i "+_touch,function(i){var n=i[_type],o=e(this);if(!s[h]){if(n==_click){if(e(i.target).is("a"))return;t(r,!1,!0)}else b&&(/ut|nd/.test(n)?(T[_remove](m),o[_remove](C)):(T[_add](m),o[_add](C)));if(!_mobile)return!1;i.stopPropagation()}}),r.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(e){var t=e[_type];return e=e.keyCode,t!=_click&&("keydown"==t&&32==e?(s[_type]==p&&s[u]||(s[u]?n(r,u):i(r,u)),!1):void("keyup"==t&&s[_type]==p?!s[u]&&i(r,u):/us|ur/.test(t)&&T["blur"==t?_remove:_add](y)))}),f.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(e){var i=e[_type],n=/wn|up/.test(i)?w:m;if(!s[h]){if(i==_click?t(r,!1,!0):(/wn|er|in/.test(i)?T[_add](n):T[_remove](n+" "+w),_.length&&b&&n==m&&_[/ut|nd/.test(i)?_remove:_add](C)),!_mobile)return!1;e.stopPropagation()}})})}}(window.jQuery||window.Zepto),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";var e=function(){function e(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.options=n.extend(i,o),this.sidebar="string"==typeof e?document.querySelector(e):e,void 0===this.sidebar)throw new Error("There is no specific sidebar element.");this.sidebarInner=!1,this.container=this.sidebar.parentElement,this.affixedType="STATIC",this.direction="down",this.support={transform:!1,transform3d:!1},this._initialized=!1,this._reStyle=!1,this._breakpoint=!1,this._resizeListeners=[],this.dimensions={translateY:0,topSpacing:0,lastTopSpacing:0,bottomSpacing:0,lastBottomSpacing:0,sidebarHeight:0,sidebarWidth:0,containerTop:0,containerHeight:0,viewportHeight:0,viewportTop:0,lastViewportTop:0},["handleEvent"].forEach(function(e){t[e]=t[e].bind(t)}),this.initialize()}return e(n,[{key:"initialize",value:function(){var e=this;if(this._setSupportFeatures(),this.options.innerWrapperSelector&&(this.sidebarInner=this.sidebar.querySelector(this.options.innerWrapperSelector),null===this.sidebarInner&&(this.sidebarInner=!1)),!this.sidebarInner){var t=document.createElement("div");for(t.setAttribute("class","inner-wrapper-sticky"),this.sidebar.appendChild(t);this.sidebar.firstChild!=t;)t.appendChild(this.sidebar.firstChild);this.sidebarInner=this.sidebar.querySelector(".inner-wrapper-sticky")}if(this.options.containerSelector){var i=document.querySelectorAll(this.options.containerSelector);if((i=Array.prototype.slice.call(i)).forEach(function(t,i){t.contains(e.sidebar)&&(e.container=t)}),!i.length)throw new Error("The container does not contains on the sidebar.")}"function"!=typeof this.options.topSpacing&&(this.options.topSpacing=parseInt(this.options.topSpacing)||0),"function"!=typeof this.options.bottomSpacing&&(this.options.bottomSpacing=parseInt(this.options.bottomSpacing)||0),this._widthBreakpoint(),this.calcDimensions(),this.stickyPosition(),this.bindEvents(),this._initialized=!0}},{key:"bindEvents",value:function(){window.addEventListener("resize",this,{passive:!0,capture:!1}),window.addEventListener("scroll",this,{passive:!0,capture:!1}),this.sidebar.addEventListener("update"+t,this),this.options.resizeSensor&&"undefined"!=typeof ResizeSensor&&(new ResizeSensor(this.sidebarInner,this.handleEvent),new ResizeSensor(this.container,this.handleEvent))}},{key:"handleEvent",value:function(e){this.updateSticky(e)}},{key:"calcDimensions",value:function(){if(!this._breakpoint){var e=this.dimensions;e.containerTop=n.offsetRelative(this.container).top,e.containerHeight=this.container.clientHeight,e.containerBottom=e.containerTop+e.containerHeight,e.sidebarHeight=this.sidebarInner.offsetHeight,e.sidebarWidth=this.sidebarInner.offsetWidth,e.viewportHeight=window.innerHeight,this._calcDimensionsWithScroll()}}},{key:"_calcDimensionsWithScroll",value:function(){var e=this.dimensions;e.sidebarLeft=n.offsetRelative(this.sidebar).left,e.viewportTop=document.documentElement.scrollTop||document.body.scrollTop,e.viewportBottom=e.viewportTop+e.viewportHeight,e.viewportLeft=document.documentElement.scrollLeft||document.body.scrollLeft,e.topSpacing=this.options.topSpacing,e.bottomSpacing=this.options.bottomSpacing,"function"==typeof e.topSpacing&&(e.topSpacing=parseInt(e.topSpacing(this.sidebar))||0),"function"==typeof e.bottomSpacing&&(e.bottomSpacing=parseInt(e.bottomSpacing(this.sidebar))||0),"VIEWPORT-TOP"===this.affixedType?e.topSpacing=e.containerBottom?(e.translateY=e.containerBottom-i,t="CONTAINER-BOTTOM"):n>=e.containerTop&&(e.translateY=n-e.containerTop,t="VIEWPORT-TOP"):e.containerBottom<=o?(e.translateY=e.containerBottom-i,t="CONTAINER-BOTTOM"):i+e.translateY<=o?(e.translateY=o-i,t="VIEWPORT-BOTTOM"):e.containerTop+e.translateY<=n&&(t="VIEWPORT-UNBOTTOM"),e.translateY=Math.max(0,e.translateY),e.translateY=Math.min(e.containerHeight,e.translateY),e.lastViewportTop=e.viewportTop,t}},{key:"_getStyle",value:function(e){if(void 0!==e){var t={inner:{},outer:{}},i=this.dimensions;switch(e){case"VIEWPORT-TOP":t.inner={position:"fixed",top:i.topSpacing,left:i.sidebarLeft-i.viewportLeft,width:i.sidebarWidth};break;case"VIEWPORT-BOTTOM":t.inner={position:"fixed",top:"auto",left:i.sidebarLeft,bottom:i.bottomSpacing,width:i.sidebarWidth};break;case"CONTAINER-BOTTOM":case"VIEWPORT-UNBOTTOM":var o=this._getTranslate(0,i.translateY+"px");t.inner=o?{transform:o}:{position:"absolute",top:i.translateY,width:i.sidebarWidth}}switch(e){case"VIEWPORT-TOP":case"VIEWPORT-BOTTOM":case"VIEWPORT-UNBOTTOM":case"CONTAINER-BOTTOM":t.outer={height:i.sidebarHeight,position:"relative"}}return t.outer=n.extend({height:"",position:""},t.outer),t.inner=n.extend({position:"relative",top:"",left:"",bottom:"",width:"",transform:this._getTranslate()},t.inner),t}}},{key:"stickyPosition",value:function(e){if(!this._breakpoint){e=this._reStyle||e||!1;var i=this.getAffixType(),o=this._getStyle(i);if((this.affixedType!=i||e)&&i){var r="affix."+i.toLowerCase().replace("viewport-","")+t;for(var s in n.eventTrigger(this.sidebar,r),"STATIC"===i?n.removeClass(this.sidebar,this.options.stickyClass):n.addClass(this.sidebar,this.options.stickyClass),o.outer)this.sidebar.style[s]=o.outer[s];for(var a in o.inner){var l="number"==typeof o.inner[a]?"px":"";this.sidebarInner.style[a]=o.inner[a]+l}var c="affixed."+i.toLowerCase().replace("viewport-","")+t;n.eventTrigger(this.sidebar,c)}else this._initialized&&(this.sidebarInner.style.left=o.inner.left);this.affixedType=i}}},{key:"_widthBreakpoint",value:function(){window.innerWidth<=this.options.minWidth?(this._breakpoint=!0,this.affixedType="STATIC",this.sidebar.removeAttribute("style"),n.removeClass(this.sidebar,this.options.stickyClass),this.sidebarInner.removeAttribute("style")):this._breakpoint=!1}},{key:"updateSticky",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._running||(this._running=!0,function(t){requestAnimationFrame(function(){switch(t){case"scroll":e._calcDimensionsWithScroll(),e.observeScrollDir(),e.stickyPosition();break;case"resize":default:e._widthBreakpoint(),e.calcDimensions(),e.stickyPosition(!0)}e._running=!1})}(t.type))}},{key:"_setSupportFeatures",value:function(){var e=this.support;e.transform=n.supportTransform(),e.transform3d=n.supportTransform(!0)}},{key:"_getTranslate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.support.transform3d?"translate3d("+e+", "+t+", "+i+")":!!this.support.translate&&"translate("+e+", "+t+")"}},{key:"destroy",value:function(){window.removeEventListener("resize",this,{caption:!1}),window.removeEventListener("scroll",this,{caption:!1}),this.sidebar.classList.remove(this.options.stickyClass),this.sidebar.style.minHeight="",this.sidebar.removeEventListener("update"+t,this);var e={inner:{},outer:{}};for(var i in e.inner={position:"",top:"",left:"",bottom:"",width:"",transform:""},e.outer={height:"",position:""},e.outer)this.sidebar.style[i]=e.outer[i];for(var n in e.inner)this.sidebarInner.style[n]=e.inner[n];this.options.resizeSensor&&"undefined"!=typeof ResizeSensor&&(ResizeSensor.detach(this.sidebarInner,this.handleEvent),ResizeSensor.detach(this.container,this.handleEvent))}}],[{key:"supportTransform",value:function(e){var t=!1,i=e?"perspective":"transform",n=i.charAt(0).toUpperCase()+i.slice(1),o=document.createElement("support").style;return(i+" "+["Webkit","Moz","O","ms"].join(n+" ")+n).split(" ").forEach(function(e,i){if(void 0!==o[e])return t=e,!1}),t}},{key:"eventTrigger",value:function(e,t,i){try{n=new CustomEvent(t,{detail:i})}catch(e){var n;(n=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,i)}e.dispatchEvent(n)}},{key:"extend",value:function(e,t){var i={};for(var n in e)void 0!==t[n]?i[n]=t[n]:i[n]=e[n];return i}},{key:"offsetRelative",value:function(e){var t={left:0,top:0};do{var i=e.offsetTop,n=e.offsetLeft;isNaN(i)||(t.top+=i),isNaN(n)||(t.left+=n),e="BODY"===e.tagName?e.parentElement:e.offsetParent}while(e);return t}},{key:"addClass",value:function(e,t){n.hasClass(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)}},{key:"removeClass",value:function(e,t){n.hasClass(e,t)&&(e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," "))}},{key:"hasClass",value:function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)}}]),n}()}();window.StickySidebar=t,function(){if("undefined"!=typeof window){var e=window.$||window.jQuery||window.Zepto,i="stickySidebar";if(e){e.fn.stickySidebar=function(n){return this.each(function(){var o=e(this),r=e(this).data(i);if(r||(r=new t(this,"object"==typeof n&&n),o.data(i,r)),"string"==typeof n){if(void 0===r[n]&&-1===["destroy","updateSticky"].indexOf(n))throw new Error('No method named "'+n+'"');r[n]()}})},e.fn.stickySidebar.Constructor=t;var n=e.fn.stickySidebar;e.fn.stickySidebar.noConflict=function(){return e.fn.stickySidebar=n,this}}}}()}),function(e,t){"function"==typeof define&&define.amd?define("sifter",t):"object"==typeof exports?module.exports=t():e.Sifter=t()}(this,function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(e=o(String(e||"").toLowerCase()),!e||!e.length)return[];var t,i,n,s,l=[],c=e.split(/ +/);for(t=0,i=c.length;t0)&&n.items.push({score:i,id:o})}):s.iterator(s.items,function(e,t){n.items.push({score:1,id:t})}),o=s.getSortFunction(n,t),o&&n.items.sort(o),n.total=n.items.length,"number"==typeof t.limit&&(n.items=n.items.slice(0,t.limit)),n};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:et?1:t>e?-1:0)},i=function(e,t){var i,n,o,r;for(i=1,n=arguments.length;i=0&&e.data.length>0){var r=e.data.match(i),s=document.createElement("span");s.className="highlight";var a=e.splitText(o),l=(a.splitText(r[0].length),a.cloneNode(!0));s.appendChild(l),a.parentNode.replaceChild(s,a),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName))for(var c=0;c/g,">").replace(/"/g,""")},I={before:function(e,t,i){var n=e[t];e[t]=function(){return i.apply(e,arguments),n.apply(e,arguments)}},after:function(e,t,i){var n=e[t];e[t]=function(){var t=n.apply(e,arguments);return i.apply(e,arguments),t}}},k=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},x=function(e,t){var i;return function(){var n=this,o=arguments;window.clearTimeout(i),i=window.setTimeout(function(){e.apply(n,o)},t)}},P=function(e,t,i){var n,o=e.trigger,r={};for(n in e.trigger=function(){var i=arguments[0];return-1===t.indexOf(i)?o.apply(e,arguments):void(r[i]=arguments)},i.apply(e,[]),e.trigger=o,r)r.hasOwnProperty(n)&&o.apply(e,r[n])},A=function(e,t,i,n){e.on(t,i,function(t){for(var i=t.target;i&&i.parentNode!==e[0];)i=i.parentNode;return t.currentTarget=i,n.apply(this,[t])})},D=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var i=document.selection.createRange(),n=document.selection.createRange().text.length;i.moveStart("character",-e.value.length),t.start=i.text.length-n,t.length=n}return t},F=function(e,t,i){var n,o,r={};if(i)for(n=0,o=i.length;n").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(t).appendTo("body");F(i,n,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var o=n.width();return n.remove(),o},z=function(e){var t=null,i=function(i,n){var o,r,s,a,l,c,p,u;i=i||window.event||{},n=n||{},i.metaKey||i.altKey||(n.force||!1!==e.data("grow"))&&(o=e.val(),i.type&&"keydown"===i.type.toLowerCase()&&(r=i.keyCode,s=r>=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||32===r,r===v||r===g?(u=D(e[0]),u.length?o=o.substring(0,u.start)+o.substring(u.start+u.length):r===g&&u.start?o=o.substring(0,u.start-1)+o.substring(u.start+1):r===v&&void 0!==u.start&&(o=o.substring(0,u.start)+o.substring(u.start+1))):s&&(c=i.shiftKey,p=String.fromCharCode(i.keyCode),p=c?p.toUpperCase():p.toLowerCase(),o+=p)),a=e.attr("placeholder"),!o&&a&&(o=a),l=E(o,e)+4,l!==t&&(t=l,e.width(l),e.triggerHandler("resize")))};e.on("keydown keyup update blur",i),i()},q=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},H=function(e,t){t||(t={});var i="Selectize";console.error(i+": "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},N=function(i,n){var o,r,s,a,l=this;a=i[0],a.selectize=l;var c=window.getComputedStyle&&window.getComputedStyle(a,null);if(s=c?c.getPropertyValue("direction"):a.currentStyle&&a.currentStyle.direction,s=s||i.parents("[dir]:first").attr("dir")||"",e.extend(l,{order:0,settings:n,$input:i,tabIndex:i.attr("tabindex")||"",tagType:"select"===a.tagName.toLowerCase()?C:O,rtl:/rtl/i.test(s),eventNS:".selectize"+ ++N.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:i.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===n.loadThrottle?l.onSearchChange:x(l.onSearchChange,n.loadThrottle)}),l.sifter=new t(this.options,{diacritics:n.diacritics}),l.settings.options){for(o=0,r=l.settings.options.length;o").addClass(h.wrapperClass).addClass(c).addClass(l),i=e("
").addClass(h.inputClass).addClass("items").appendTo(t),n=e('').appendTo(i).attr("tabindex",b.is(":disabled")?"-1":d.tabIndex),a=e(h.dropdownParent||t),o=e("
").addClass(h.dropdownClass).addClass(l).hide().appendTo(a),s=e("
").addClass(h.dropdownContentClass).appendTo(o),(u=b.attr("id"))&&(n.attr("id",u+"-selectized"),e("label[for='"+u+"']").attr("for",u+"-selectized")),d.settings.copyClassesToDropdown&&o.addClass(c),t.css({width:b[0].style.width}),d.plugins.names.length&&(p="plugin-"+d.plugins.names.join(" plugin-"),t.addClass(p),o.addClass(p)),(null===h.maxItems||h.maxItems>1)&&d.tagType===C&&b.attr("multiple","multiple"),d.settings.placeholder&&n.attr("placeholder",h.placeholder),!d.settings.splitOn&&d.settings.delimiter){var O=d.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");d.settings.splitOn=new RegExp("\\s*"+O+"+\\s*")}b.attr("autocorrect")&&n.attr("autocorrect",b.attr("autocorrect")), b.attr("autocapitalize")&&n.attr("autocapitalize",b.attr("autocapitalize")),d.$wrapper=t,d.$control=i,d.$control_input=n,d.$dropdown=o,d.$dropdown_content=s,o.on("mouseenter","[data-selectable]",function(){return d.onOptionHover.apply(d,arguments)}),o.on("mousedown click","[data-selectable]",function(){return d.onOptionSelect.apply(d,arguments)}),A(i,"mousedown","*:not(input)",function(){return d.onItemSelect.apply(d,arguments)}),z(n),i.on({mousedown:function(){return d.onMouseDown.apply(d,arguments)},click:function(){return d.onClick.apply(d,arguments)}}),n.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return d.onKeyDown.apply(d,arguments)},keyup:function(){return d.onKeyUp.apply(d,arguments)},keypress:function(){return d.onKeyPress.apply(d,arguments)},resize:function(){d.positionDropdown.apply(d,[])},blur:function(){return d.onBlur.apply(d,arguments)},focus:function(){return d.ignoreBlur=!1,d.onFocus.apply(d,arguments)},paste:function(){return d.onPaste.apply(d,arguments)}}),v.on("keydown"+f,function(e){d.isCmdDown=e[r?"metaKey":"ctrlKey"],d.isCtrlDown=e[r?"altKey":"ctrlKey"],d.isShiftDown=e.shiftKey}),v.on("keyup"+f,function(e){e.keyCode===w&&(d.isCtrlDown=!1),e.keyCode===m&&(d.isShiftDown=!1),e.keyCode===y&&(d.isCmdDown=!1)}),v.on("mousedown"+f,function(e){if(d.isFocused){if(e.target===d.$dropdown[0]||e.target.parentNode===d.$dropdown[0])return!1;d.$control.has(e.target).length||e.target===d.$control[0]||d.blur(e.target)}}),g.on(["scroll"+f,"resize"+f].join(" "),function(){d.isOpen&&d.positionDropdown.apply(d,arguments)}),g.on("mousemove"+f,function(){d.ignoreHover=!1}),this.revertSettings={$children:b.children().detach(),tabindex:b.attr("tabindex")},b.attr("tabindex",-1).hide().after(d.$wrapper),e.isArray(h.items)&&(d.setValue(h.items),delete h.items),_&&b.on("invalid"+f,function(e){e.preventDefault(),d.isInvalid=!0,d.refreshState()}),d.updateOriginalInput(),d.refreshItems(),d.refreshState(),d.updatePlaceholder(),d.isSetup=!0,b.is(":disabled")&&d.disable(),d.on("change",this.onChange),b.data("selectize",d),b.addClass("selectized"),d.trigger("initialize"),!0===h.preload&&d.onSearchChange("")},setupTemplates:function(){var t=this,i=t.settings.labelField,n=t.settings.optgroupLabelField,o={optgroup:function(e){return'
'+e.html+"
"},optgroup_header:function(e,t){return'
'+t(e[n])+"
"},option:function(e,t){return'
'+t(e[i])+"
"},item:function(e,t){return'
'+t(e[i])+"
"},option_create:function(e,t){return'
Add '+t(e.input)+"
"}};t.settings.render=e.extend({},o,t.settings.render)},setupCallbacks:function(){var e,t,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in i)i.hasOwnProperty(e)&&(t=this.settings[i[e]],t&&this.on(e,t))},onClick:function(e){var t=this;t.isFocused||(t.focus(),e.preventDefault())},onMouseDown:function(t){var i=this,n=t.isDefaultPrevented();if(e(t.target),i.isFocused){if(t.target!==i.$control_input[0])return"single"===i.settings.mode?i.isOpen?i.close():i.open():n||i.setActiveItem(null),!1}else n||window.setTimeout(function(){i.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(t){var i=this;return i.isFull()||i.isInputHidden||i.isLocked?void t.preventDefault():void(i.settings.splitOn&&setTimeout(function(){var t=i.$control_input.val();if(t.match(i.settings.splitOn))for(var n=e.trim(t).split(i.settings.splitOn),o=0,r=n.length;oa&&(c=s,s=a,a=c),o=s;o<=a;o++)l=u.$control[0].childNodes[o],-1===u.$activeItems.indexOf(l)&&(e(l).addClass("active"),u.$activeItems.push(l));i.preventDefault()}else"mousedown"===n&&u.isCtrlDown||"keydown"===n&&this.isShiftDown?t.hasClass("active")?(r=u.$activeItems.indexOf(t[0]),u.$activeItems.splice(r,1),t.removeClass("active")):u.$activeItems.push(t.addClass("active")[0]):(e(u.$activeItems).removeClass("active"),u.$activeItems=[t.addClass("active")[0]]);u.hideInput(),this.isFocused||u.focus()}},setActiveOption:function(t,i,n){var o,r,s,a,l,c=this;c.$activeOption&&c.$activeOption.removeClass("active"),c.$activeOption=null,t=e(t),t.length&&(c.$activeOption=t.addClass("active"),!i&&S(i)||(o=c.$dropdown_content.height(),r=c.$activeOption.outerHeight(!0),i=c.$dropdown_content.scrollTop()||0,s=c.$activeOption.offset().top-c.$dropdown_content.offset().top+i,a=s,l=s-o+r,s+r>o+i?c.$dropdown_content.stop().animate({scrollTop:l},n?c.settings.scrollDuration:0):s=0;i--)-1!==r.items.indexOf($(n.items[i].id))&&n.items.splice(i,1);return n},refreshOptions:function(t){var i,o,r,s,a,l,c,p,u,d,h,f,g,v,m,y;void 0===t&&(t=!0);var w=this,b=e.trim(w.$control_input.val()),C=w.search(b),O=w.$dropdown_content,_=w.$activeOption&&$(w.$activeOption.attr("data-value"));for(s=C.items.length,"number"==typeof w.settings.maxOptions&&(s=Math.min(s,w.settings.maxOptions)),a={},l=[],i=0;i0||g,w.hasOptions?(C.items.length>0?(m=_&&w.getOption(_),m&&m.length?v=m:"single"===w.settings.mode&&w.items.length&&(v=w.getOption(w.items[0])),v&&v.length||(v=y&&!w.settings.addPrecedence?w.getAdjacentOption(y,1):O.find("[data-selectable]:first"))):v=y,w.setActiveOption(v),t&&!w.isOpen&&w.open()):(w.setActiveOption(null),t&&w.isOpen&&w.close())},addOption:function(t){var i,n,o,r=this;if(e.isArray(t))for(i=0,n=t.length;i=0&&o0),t.$control_input.data("grow",!i&&!n)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,i,n,o,r=this;if(e=e||{},r.tagType===C){for(n=[],t=0,i=r.items.length;t'+T(o)+"");n.length||this.$input.attr("multiple")||n.push(''),r.$input.html(n.join(""))}else r.$input.val(r.getValue()),r.$input.attr("value",r.$input.val());r.isSetup&&(e.silent||r.trigger("change",r.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e.outerWidth(),top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(t){var i=Math.min(this.caretPos,this.items.length);0===i?this.$control.prepend(t):e(this.$control[0].childNodes[i]).before(t),this.setCaret(i+1)},deleteSelection:function(t){var i,n,o,r,s,a,l,c,p,u=this;if(o=t&&t.keyCode===g?-1:1,r=D(u.$control_input[0]),u.$activeOption&&!u.settings.hideSelected&&(l=u.getAdjacentOption(u.$activeOption,-1).attr("data-value")),s=[],u.$activeItems.length){for(p=u.$control.children(".active:"+(o>0?"last":"first")),a=u.$control.children(":not(input)").index(p),o>0&&a++,i=0,n=u.$activeItems.length;i0&&r.start===u.$control_input.val().length&&s.push(u.items[u.caretPos]));if(!s.length||"function"==typeof u.settings.onDelete&&!1===u.settings.onDelete.apply(u,[s]))return!1;for(void 0!==a&&u.setCaret(a);s.length;)u.removeItem(s.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),l&&(c=u.getOption(l),c.length&&u.setActiveOption(c)),!0},advanceSelection:function(e,t){var i,n,o,r,s,a,l=this;0!==e&&(l.rtl&&(e*=-1),i=e>0?"last":"first",n=D(l.$control_input[0]),l.isFocused&&!l.isInputHidden?(r=l.$control_input.val().length,s=e<0?0===n.start&&0===n.length:n.start===r,s&&!r&&l.advanceCaret(e,t)):(a=l.$control.children(".active:"+i),a.length&&(o=l.$control.children(":not(input)").index(a),l.setActiveItem(null),l.setCaret(e>0?o+1:o))))},advanceCaret:function(e,t){var i,n,o=this;0!==e&&(i=e>0?"next":"prev",o.isShiftDown?(n=o.$control_input[i](),n.length&&(o.hideInput(),o.setActiveItem(n),t&&t.preventDefault())):o.setCaret(o.caretPos+e))},setCaret:function(t){var i,n,o,r,s=this;if(t="single"===s.settings.mode?s.items.length:Math.max(0,Math.min(s.items.length,t)),!s.isPending)for(o=s.$control.children(":not(input)"),i=0,n=o.length;i
'+e.title+'×
'}},t),n.setup=(i=n.setup,function(){i.apply(n,arguments),n.$dropdown_header=e(t.html(t)),n.$dropdown.prepend(n.$dropdown_header)})}),N.define("optgroup_columns",function(t){var i=this;t=e.extend({equalizeWidth:!0,equalizeHeight:!0},t),this.getAdjacentOption=function(t,i){var n=t.closest("[data-group]").find("[data-selectable]"),o=n.index(t)+i;return o>=0&&o
',e=e.firstChild,i.body.appendChild(e),t=n.width=e.offsetWidth-e.clientWidth,i.body.removeChild(e)),t},o=function(){var o,r,s,a,l,c,p;if(p=e("[data-group]",i.$dropdown_content),r=p.length,r&&i.$dropdown_content.width()){if(t.equalizeHeight){for(s=0,o=0;o1&&(l=c-a*(r-1),p.eq(r-1).css({width:l})))}};(t.equalizeHeight||t.equalizeWidth)&&(I.after(this,"positionDropdown",o),I.after(this,"refreshOptions",o))}),N.define("remove_button",function(t){t=e.extend({label:"×",title:"Remove",className:"remove",append:!0},t);var i=function(t,i){i.className="remove-single";var n,o=t,r=''+i.label+"",s=function(e,t){return e+t};t.setup=(n=o.setup,function(){if(i.append){var a=e(o.$input.context).attr("id"),l=(e("#"+a),o.settings.render.item);o.settings.render.item=function(e){return s(l.apply(t,arguments),r)}}n.apply(t,arguments),t.$control.on("click","."+i.className,function(e){e.preventDefault(),o.isLocked||o.clear()})})},n=function(t,i){var n,o=t,r=''+i.label+"",s=function(e,t){var i=e.search(/(<\/[^>]+>\s*)$/);return e.substring(0,i)+t+e.substring(i)};t.setup=(n=o.setup,function(){if(i.append){var a=o.settings.render.item;o.settings.render.item=function(e){return s(a.apply(t,arguments),r)}}n.apply(t,arguments),t.$control.on("click","."+i.className,function(t){if(t.preventDefault(),!o.isLocked){var i=e(t.currentTarget).parent();o.setActiveItem(i),o.deleteSelection()&&o.setCaret(o.items.length)}})})};return"single"===this.settings.mode?void i(this,t):void n(this,t)}),N.define("restore_on_backspace",function(e){var t,i=this;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(t=i.onKeyDown,function(i){var n,o;return i.keyCode===g&&""===this.$control_input.val()&&!this.$activeItems.length&&(n=this.caretPos-1,n>=0&&n-1,this.superfish("hide"),this.parents("."+t.hoverClass).length||(t.onIdle.call(u(this)),t.$path.length&&e.proxy(h,t.$path)())},g=function(){var t=e(this),i=d(t);o?e.proxy(f,t,i)():(clearTimeout(i.sfTimer),i.sfTimer=setTimeout(e.proxy(f,t,i),i.delay))},v=function(t){var i=e(this),n=d(i),o=i.siblings(t.data.popUpSelector);if(!1===n.onHandleTouch.call(o))return this;o.length>0&&o.is(":hidden")&&(i.one("click.superfish",!1),"MSPointerDown"===t.type||"pointerdown"===t.type?i.trigger("focus"):e.proxy(h,i.parent("li"))())},m=function(t,i){var n="li:has("+i.popUpSelector+")";e.fn.hoverIntent&&!i.disableHI?t.hoverIntent(h,g,n):t.on("mouseenter.superfish",n,h).on("mouseleave.superfish",n,g);var a="MSPointerDown.superfish";s&&(a="pointerdown.superfish"),o||(a+=" touchend.superfish"),r&&(a+=" mousedown.superfish"),t.on("focusin.superfish","li",h).on("focusout.superfish","li",g).on(a,"a",i,v)},{hide:function(t){if(this.length){var i=this,n=d(i);if(!n)return this;var o=!0===n.retainPath?n.$path:"",r=i.find("li."+n.hoverClass).add(this).not(o).removeClass(n.hoverClass).children(n.popUpSelector),s=n.speedOut;if(t&&(r.show(),s=0),n.retainPath=!1,!1===n.onBeforeHide.call(r))return this;r.stop(!0,!0).animate(n.animationOut,s,function(){var t=e(this);n.onHide.call(t)})}return this},show:function(){var e=d(this);if(!e)return this;var t=this.addClass(e.hoverClass),i=t.children(e.popUpSelector);return!1===e.onBeforeShow.call(i)?this:(i.stop(!0,!0).animate(e.animation,e.speed,function(){e.onShow.call(i)}),this)},destroy:function(){return this.each(function(){var t,i=e(this),o=i.data("sfOptions");if(!o)return!1;t=i.find(o.popUpSelector).parent("li"),clearTimeout(o.sfTimer),a(i,o),c(t),p(i),i.off(".superfish").off(".hoverIntent"),t.children(o.popUpSelector).attr("style",function(e,t){if(void 0!==t)return t.replace(/display[^;]+;?/g,"")}),o.$path.removeClass(o.hoverClass+" "+n.bcClass).addClass(o.pathClass),i.find("."+o.hoverClass).removeClass(o.hoverClass),o.onDestroy.call(i),i.removeData("sfOptions")})},init:function(t){return this.each(function(){var i=e(this);if(i.data("sfOptions"))return!1;var o=e.extend({},e.fn.superfish.defaults,t),r=i.find(o.popUpSelector).parent("li");o.$path=l(i,o),i.data("sfOptions",o),a(i,o,!0),c(r,!0),p(i),m(i,o),r.not("."+n.bcClass).superfish("hide",!0),o.onInit.call(this)})}});e.fn.superfish=function(t,i){return y[t]?y[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?e.error("Method "+t+" does not exist on jQuery.fn.superfish"):y.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop,onHandleTouch:e.noop}}(jQuery,window);