text: /* eslint-disable */
  /* pytesNET/tail.select @ 0.5.5 © SamBrishes | pytesNET */
  !function(e){"function"==typeof define&&define.amd?define(function(){return e(window)}):(void 0===window.tail&&(window.tail={}),window.tail.select=e(window),"undefined"!=typeof jQuery&&(jQuery.fn.tailselect=function(e){var t,i=[];return this.each(function(){!1!==(t=tail.select(this,e))&&i.push(t)}),1===i.length?i[0]:0!==i.length&&i}),"undefined"!=typeof MooTools&&Element.implement({tailselect:function(e){return new tail.select(this,e)}}))}(function(e){"use strict";var r=e,d=e.document;function b(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className||"")}function a(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className||t)||(e.className+=" "+t),e}function c(e,t,i){return(i=new RegExp("(?:^|\\s+)("+t+")(?:\\s+|$)"))&&i.test(e.className||"")&&(e.className=e.className.replace(i,"")),e}function s(e,t,i){if(CustomEvent&&CustomEvent.name)var n=new CustomEvent(t,i);else(n=d.createEvent("CustomEvent")).initCustomEvent(t,!!i.bubbles,!!i.cancelable,i.detail);return e.dispatchEvent(n)}function h(e,t){if(Object.assign)return Object.assign({},e,t||{});var i=new Object;for(var n in e)i[n]=n in t?t[n]:e[n];return i}function g(e,t){var i=d.createElement(e);return i.className=t&&t.join?t.join(" "):t||"",i}var u,p=function(e,t){if((e="string"==typeof e?d.querySelectorAll(e):e)instanceof NodeList||e instanceof HTMLCollection||e instanceof Array){for(var i=[],n=e.length,s=0;s<n;s++)i.push(new p(e[s],h(t,{})));return 1===i.length?i[0]:0!==i.length&&i}if(!(e instanceof Element&&this instanceof p))return e instanceof Element&&new p(e,t);if(p.inst[e.getAttribute("data-tail-select")])return p.inst[e.getAttribute("data-tail-select")];if(e.getAttribute("data-select")){var l=JSON.parse(e.getAttribute("data-select").replace(/\'/g,'"'));l instanceof Object&&(t=h(t,l))}var o=e.getAttribute("placeholder")||e.getAttribute("data-placeholder"),r="bindSourceSelect",a="sourceHide";return(t="object"==typeof t?t:{}).multiple="multiple"in t?t.multiple:e.multiple,t.disabled="disabled"in t?t.disabled:e.disabled,t.placeholder=o||t.placeholder||null,t.width="auto"===t.width?e.offsetWidth+50:t.width,t.sourceBind=r in t?t[r]:t.sourceBind||!1,t.sourceHide=a in t?t[a]:t.sourceHide||!0,t.multiLimit=0<=t.multiLimit?t.multiLimit:1/0,this.e=e,this.id=++p.count,this.con=h(p.defaults,t),this.events={},(p.inst["tail-"+this.id]=this).init().bind()};return p.version="0.5.5",p.status="beta",p.count=0,p.inst={},p.defaults={animate:!0,classNames:null,csvOutput:!1,csvSeparator:",",descriptions:!1,deselect:!1,disabled:!1,height:350,hideDisabled:!1,hideSelected:!1,items:{},locale:"en",multiple:!1,multiLimit:1/0,multiPinSelected:!1,multiContainer:!1,multiShowCount:!0,multiShowLimit:!1,multiSelectAll:!1,multiSelectGroup:!0,openAbove:null,placeholder:null,search:!1,searchFocus:!0,searchMarked:!0,searchDisabled:!0,sortItems:!1,sortGroups:!1,sourceBind:!1,sourceHide:!0,startOpen:!1,stayOpen:!1,width:null,cbComplete:void 0,cbEmpty:void 0,cbLoopItem:void 0,cbLoopGroup:void 0},p.strings={en:{all:"All",none:"None",actionAll:"Select All",actionNone:"Unselect All",empty:"No Options available",emptySearch:"No Options found",limit:"You can't select more Options",placeholder:"Select an Option...",placeholderMulti:"Select up to :limit Options...",search:"Type in to search...",disabled:"This Field is disabled"},modify:function(e,t,i){if(!(e in this))return!1;if(t instanceof Object)for(var n in t)this.modify(e,n,t[n]);else this[e][t]="string"==typeof i?i:this[e][t];return!0},register:function(e,t){return"string"==typeof e&&t instanceof Object&&(this[e]=t,!0)}},p.prototype={init:function(){var t=this,e=["tail-select"],i=this.con,n=!0===i.classNames?this.e.className:i.classNames;e.push(n&&n.push?n.join(" "):n&&n.split?n:"no-classes"),i.hideSelected&&e.push("hide-selected"),i.hideDisabled&&e.push("hide-disabled"),0==i.multiLimit&&e.push("disabled"),i.multiple&&e.push("multiple"),i.deselect&&e.push("deselect"),i.disabled&&e.push("disabled"),this.__=p.strings[i.locale]||p.strings.en,this._init=!0,this._query=!1,this.select=g("DIV",e),this.label=g("DIV","select-label"),this.dropdown=g("DIV","select-dropdown"),this.search=g("DIV","dropdown-search"),this.csvInput=g("INPUT","select-search"),i.width&&/^[0-9.]+(?:cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|\%)$/i.test(i.width)?this.select.style.width=i.width:i.width&&!isNaN(parseFloat(i.width,10))&&(this.select.style.width=i.width+"px"),this.label.addEventListener("click",function(e){t.toggle.call(t,t.con.animate)}),this.select.appendChild(this.label),isNaN(parseInt(i.height,10))||(this.dropdown.style.maxHeight=parseInt(i.height,10)+"px"),i.search&&(this.search.innerHTML='<input type="text" class="search-input" />',this.search.children[0].placeholder=this.__.search,this.search.children[0].addEventListener("input",function(e){t.query.call(t,2<this.value.length?this.value:void 0)}),this.dropdown.appendChild(this.search)),this.select.appendChild(this.dropdown),this.csvInput.type="hidden",i.csvOutput&&(this.csvInput.name=this.e.name,this.e.removeAttribute("name"),this.select.appendChild(this.csvInput)),i.multiple&&i.multiContainer&&(d.querySelector(i.multiContainer)?(this.container=d.querySelector(i.multiContainer),this.container.className+=" tail-select-container"):!0===i.multiContainer&&(this.container=this.label,this.container.className+=" tail-select-container")),this.options=new u(this.e,this);for(var s=this.e.options.length,l=0;l<s;l++)this.options.set(this.e.options[l],!1);for(var o in i.items)"string"==typeof i.items[o]&&(i.items[o]={value:i.items[o]}),this.options.add(i.items[o].key||o,i.items[o].value,i.items[o].group,i.items[o].selected,i.items[o].disabled,i.items[o].description);return this.query(),this.e.nextElementSibling?this.e.parentElement.insertBefore(this.select,this.e.nextElementSibling):this.e.parentElement.appendChild(this.select),i.sourceHide&&("none"==this.e.style.display?(this.select.style.display="none",this.e.setAttribute("data-select-hidden","display")):"hidden"==this.e.style.visibility?(this.select.style.visibiltiy="hidden",this.e.setAttribute("data-select-hidden","visibility")):(this.e.style.display="none",this.e.setAttribute("data-select-hidden","0"))),this.e.setAttribute("data-tail-select","tail-"+this.id),t.con.startOpen&&this.open(i.animate),(i.cbComplete||function(){}).call(this,this.select),this._init=!1,this},bind:function(){var r=this;return d.addEventListener("keydown",function(e){var t,i,n,s,l=e.keyCode||e.which;if(!b(r.select,"active")||[13,27,38,40].indexOf(l)<0)return!1;if(e.preventDefault(),e.stopPropagation(),13==l&&(t=r.dropdown.querySelector(".dropdown-option.hover:not(.disabled)"))&&r.options.select.call(r.options,t),27==l||13==l)return r.close(r.con.animate);if(t=r.dropdown.querySelector(".dropdown-option.hover:not(.disabled)"))for(c(t,"hover"),n=[(40==l?"next":"previous")+"ElementSibling"];(t=null!==(s=t[n])&&"LI"==t.tagName?s:null!==(s=t.parentElement[n])&&0<s.children.length&&"UL"==s.tagName&&s.children[40==l?0:s.children.length-1])&&(!b(t,"dropdown-option")||b(t,"disabled")););if(t||40!=l?t||38!=l||(t=r.dropdown.querySelector("ul:last-child li:not(.disabled):last-child")):t=r.dropdown.querySelector(".dropdown-option:not(.disabled)"),t&&(i=r.dropdown.querySelector(".dropdown-inner"))){var o=function(e){for(var t={top:e.offsetTop,height:e.offsetHeight};(e=e.parentElement)!=i;)t.top+=e.offsetTop;return t}(t);a(t,"hover"),o.top+2*o.height>i.offsetHeight+i.scrollTop?i.scrollBy(0,o.top+2*o.height-(i.offsetHeight+i.scrollTop)):o.top-o.height<i.scrollTop&&i.scrollBy(0,-Math.abs(i.scrollTop-o.top+o.height))}return!0}),d.addEventListener("click",function(e){if(!b(r.select,"active")||b(r.select,"idle"))return!1;if(!0===r.con.stayOpen)return!1;for(var t=[r.e,r.select,r.container],i=t.length,n=0;n<i;n++){if(t[n]&&(t[n].contains(e.target)||t[n]==e.target))return!1;if(!e.target.parentElement)return!1}return r.close.call(r,r.con.animate)}),this.con.sourceBind&&this.e.addEventListener("change",function(e){if(null!=e.detail)return!1;if(e.preventDefault(),e.stopPropagation(),!this.multiple&&this.selectedIndex)r.options.select.call(r.options,this.options[this.selectedIndex]);else{var t=[].concat(r.options.selected),i=[].filter.call(this.querySelectorAll("option:checked"),function(e){return!(0<=t.indexOf(e))||(t.splice(t.indexOf(e),1),!1)});r.options.walk.call(r.options,"unselect",t),r.options.walk.call(r.options,"select",i)}}),!0},callback:function(e,t,i){var n="[data-key='"+e.key+"'][data-group='"+e.group+"']";if("rebuild"==t)return this.query();var s=this.dropdown.querySelector(n);return s&&0<=["select","disable"].indexOf(t)?a(s,"select"==t?"selected":"disabled"):s&&0<=["unselect","enable"].indexOf(t)&&c(s,"unselect"==t?"selected":"disabled"),this.update(e),!0===i||this.trigger("change",e,t)},trigger:function(e){if(this._init)return!1;var t={bubbles:!1,cancelable:!0,detail:{args:arguments,self:this}};"change"==e&&arguments[2]&&0<=arguments[2].indexOf("select")&&(s(this.e,"input",t),s(this.e,"change",t)),s(this.select,"tail::"+e,t);var i,n=[];return Array.prototype.map.call(arguments,function(e,t){0<t&&n.push(e)}),(this.events[e]||[]).forEach(function(e){(i=[].concat(n)).push(e.args||null),(e.cb||function(){}).apply(t.detail.self,i)}),!0},calc:function(){var e=this.dropdown.cloneNode(!0),t=this.con.height,i=0,n=this.dropdown.querySelector(".dropdown-inner");(e=this.dropdown.cloneNode(!0)).style.cssText="height:auto;min-height:auto;max-height:none;opacity:0;display:block;visibility:hidden;",e.style.maxHeight=this.con.height+"px",e.className+=" cloned",this.dropdown.parentElement.appendChild(e),t=t>e.clientHeight?e.clientHeight:t,this.con.search&&(i=e.querySelector(".dropdown-search").clientHeight),this.dropdown.parentElement.removeChild(e);var s=this.select.getBoundingClientRect(),l=r.innerHeight-(s.top+s.height),o=l<t+i&&s.top>l;return!0===this.con.openAbove||!1!==this.con.openAbove&&o?(o=!0,t=Math.min(t,s.top-10),a(this.select,"open-top")):(o=!1,t=Math.min(t,l-10),c(this.select,"open-top")),n&&(this.dropdown.style.maxHeight=t+"px",n.style.maxHeight=t-i+"px"),this},query:function(e,t){var i,n,s,l,o,r,a=g("DIV","dropdown-inner"),c=this,h=e?"finder":"walker",d=this.con,u="getAttribute",p=e?[e,t]:[d.sortItems,d.sortGroups];for(this._query="string"==typeof e&&e;i=this.options[h].apply(this.options,p);){if(!s||s&&s[u]("data-group")!==i.group){if(!((n=(d.cbLoopGroup||this.cbGroup).call(this,i.group,e,a))instanceof Element))break;(s=n).setAttribute("data-group",i.group),a.appendChild(s)}if(null!==(l=(d.cbLoopItem||this.cbItem).call(this,i,s,e,a))){if(!1===l)break;l.setAttribute("data-key",i.key),l.setAttribute("data-group",i.group),l.addEventListener("click",function(e){if(!this.hasAttribute("data-key"))return!1;var t=this[u]("data-key"),i=this[u]("data-group")||"#";c.options.toggle.call(c.options,t,i)&&(!1!==c.con.stayOpen||c.con.multiple||c.close.call(c,c.con.animate))}),s.appendChild(l)}}var f=a.querySelectorAll("*[data-key]").length;0==f&&(this.con.cbEmpty||function(e){var t=g("SPAN","dropdown-empty");t.innerText=this.__.empty,e.appendChild(t)}).call(this,a,e),0<f&&d.multiple&&d.multiLimit==1/0&&d.multiSelectAll&&(o=g("BUTTON","tail-all"),r=g("BUTTON","tail-none"),o.innerText=this.__.actionAll,o.addEventListener("click",function(e){e.preventDefault();var t=c.dropdown.querySelectorAll(".dropdown-inner .dropdown-option");c.options.walk.call(c.options,"select",t)}),r.innerText=this.__.actionNone,r.addEventListener("click",function(e){e.preventDefault();var t=c.dropdown.querySelectorAll(".dropdown-inner .dropdown-option");c.options.walk.call(c.options,"unselect",t)}),(l=g("SPAN","dropdown-action")).appendChild(o),l.appendChild(r),a.insertBefore(l,a.children[0]));var m=this.dropdown.querySelector(".dropdown-inner");return this.dropdown[(m?"replace":"append")+"Child"](a,m),b(this.select,"active")&&this.calc(),this.updateCSV().updateLabel()},cbGroup:function(e,t){var i,n,s=g("UL","dropdown-optgroup"),l=this;return"#"==e||(s.innerHTML='<li class="optgroup-title"><b>'+e+"</b></li>",this.con.multiple&&this.con.multiLimit==1/0&&this.con.multiSelectAll&&(i=g("BUTTON","tail-none"),n=g("BUTTON","tail-all"),i.innerText=this.__.none,i.addEventListener("click",function(e){e.preventDefault();var t=this.parentElement.parentElement.getAttribute("data-group");l.options.all.call(l.options,"unselect",t)}),n.innerText=this.__.all,n.addEventListener("click",function(e){e.preventDefault();var t=this.parentElement.parentElement.getAttribute("data-group");l.options.all.call(l.options,"select",t)}),s.children[0].appendChild(i),s.children[0].appendChild(n))),s},cbItem:function(e,t,i){var n=g("LI","dropdown-option"+(e.selected?" selected":"")+(e.disabled?" disabled":""));return i&&0<i.length&&this.con.searchMarked?n.innerHTML=e.value.replace(new RegExp("("+i+")","i"),"<mark>$1</mark>"):n.innerText=e.value,this.con.descriptions&&e.description&&(n.innerHTML+='<span class="option-description">'+e.description+"</span>"),n},update:function(e){return this.updateLabel().updateContainer(e).updatePin(e).updateCSV(e)},updateLabel:function(e){if(this.container==this.label&&0<this.options.selected.length)return this.label.querySelector(".label-inner")&&this.label.removeChild(this.label.querySelector(".label-inner")),this.label.querySelector(".label-count")&&this.label.removeChild(this.label.querySelector(".label-count")),this;var t,i=this.con,n=this.options.selected.length;return"string"!=typeof e&&(e=i.disabled?"disabled":0==this.dropdown.querySelectorAll("*[data-key]").length?"empty"+(b(this.select,"in-search")?"Search":""):i.multiLimit<=n?"limit":!i.multiple&&0<this.options.selected.length?this.options.selected[0].innerText:"string"==typeof i.placeholder?i.placeholder:"placeholder"+(i.multiple&&i.multiLimit<1/0?"Multi":"")),e='<span class="label-inner">'+(e=(this.__[e]||e).replace(":limit",i.multiLimit))+"</span>",t=i.multiShowLimit&&i.multiLimit<1/0,i.multiple&&i.multiShowCount&&(e=(e='<span class="label-count">:c</span>'+e).replace(":c",n+(t?" / "+i.multiLimit:""))),this.label.innerHTML=e,this},updateContainer:function(e){if(!this.container||!this.con.multiContainer)return this;var t="[data-group='"+e.group+"'][data-key='"+e.key+"']";if(this.container.querySelector(t))return e.selected||this.container.removeChild(this.container.querySelector(t)),this;if(e.selected){var n=this,i=g("DIV","select-handle");i.innerText=e.value,i.setAttribute("data-key",e.key),i.setAttribute("data-group",e.group),i.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=this.getAttribute("data-key"),i=this.getAttribute("data-group");n.options.unselect.call(n.options,t,i)}),this.container.appendChild(i)}return this},updatePin:function(e){var t=this.dropdown.querySelector(".dropdown-inner ul"),i="li[data-key='"+e.key+"'][data-group='"+e.group+"']";if(!this.con.multiPinSelected||!t||!1!==this._query)return this;if(i=this.dropdown.querySelector(i),e.selected)t.insertBefore(i,t.children[0]);else{for(var n=this.dropdown.querySelector("ul[data-group='"+e.group+"']"),s=this.options[e.index-1],l=!1;s&&s.group==e.group&&!(l=n.querySelector("li[data-key='"+s.key+"']"));)s=this.options[s.index-1];l&&l.nextElementSibling?n.insertBefore(i,l.nextElementSibling):n.appendChild(i)}return this},updateCSV:function(e){if(!this.csvInput||!this.con.csvOutput)return this;for(var t=[],i=this.options.selected.length,n=0;n<i;n++)t.push(this.options.selected[n].value);return this.csvInput.value=t.join(this.con.csvSeparator||","),this},open:function(e){if(b(this.select,"active")||b(this.select,"idle")||this.con.disabled)return!1;this.calc();var n=function(){a(c(s.select,"idle"),"active"),this.dropdown.style.height="auto",this.dropdown.style.overflow="visible",this.label.removeAttribute("style"),this.con.search&&this.con.searchFocus&&this.dropdown.querySelector("input").focus(),this.trigger.call(this,"open")},s=this,l=this.dropdown.style;return!1!==e?(this.label.style.zIndex=25,this.dropdown.style.cssText+="height:0;display:block;overflow:hidden;",a(s.select,"idle"),function e(){var t=parseInt(l.height,10),i=parseInt(l.maxHeight,10);if(i<=t)return n.call(s);l.height=(i<t+50?i:t+50)+"px",setTimeout(e,20)}()):(l.cssText="height:"+l.maxHeight+";display:block;overflow:hidden;",n.call(this)),this},close:function(e){if(!b(this.select,"active")||b(this.select,"idle"))return!1;var t=function(){c(c(this.select,"idle"),"active"),this.dropdown.removeAttribute("style"),this.dropdown.querySelector(".dropdown-inner").removeAttribute("style"),this.trigger.call(this,"close")},i=this,n=this.dropdown;return!1!==e?(a(this.select,"idle"),this.dropdown.style.overflow="hidden",function e(){if(parseInt(n.offsetHeight,10)-50<=0)return t.call(i);n.style.height=parseInt(n.offsetHeight,10)-50+"px",setTimeout(e,20)}()):t.call(this),this},toggle:function(e){return b(this.select,"active")?this.close(e):b(this.select,"idle")?this:this.open(e)},remove:function(){if(this.e.removeAttribute("data-tail-select"),this.e.hasAttribute("data-select-hidden")&&("0"==this.e.getAttribute("data-select-hidden")&&this.e.style.removeProperty("display"),this.e.removeAttribute("data-select-hidden")),Array.prototype.map.call(this.e.querySelectorAll("[data-select-option='add']"),function(e){e.parentElement.removeChild(e)}),Array.prototype.map.call(this.e.querySelectorAll("[data-select-optgroup='add']"),function(e){e.parentElement.removeChild(e)}),this.e.name=this.csvInput.hasAttribute("name")?this.csvInput.name:this.e.name,this.select.parentElement&&this.select.parentElement.removeChild(this.select),this.container)for(var e=this.container.querySelectorAll(".select-handle"),t=e.length,i=0;i<t;i++)this.container.removeChild(e[i]);return this},reload:function(){return this.remove().init()},config:function(e,t,i){if(e instanceof Object){for(var n in e)this.config(n,e[n],!1);return this.reload(),this.con}return void 0===e?this.con:e in this.con&&(void 0===t?this.con[e]:(this.con[e]=t,!1!==this.rebuild&&this.reload(),this))},enable:function(e){return c(this.select,"disabled"),this.e.disabled=!1,(this.con.disabled=!1)===e?this:this.reload()},disable:function(e){return a(this.select,"disabled"),this.e.disabled=!0,!(this.con.disabled=!0)===e?this:this.reload()},on:function(e,t,i){return!(["open","close","change"].indexOf(e)<0||"function"!=typeof t)&&(e in this.events||(this.events[e]=[]),this.events[e].push({cb:t,args:i instanceof Array?i:[]}),this)}},(u=p.options=function(e,t){return this instanceof u?(this.self=t,this.element=e,this.length=0,this.selected=[],this.disabled=[],this.items={"#":{}},this.groups={},this):new u(e,t)}).prototype={_r:function(e){return e.replace("disabled","disable").replace("enabled","enable").replace("selected","select").replace("unselected","unselect")},get:function(e,t){var i="getAttribute";if("object"==typeof e&&e.key&&e.group)t=e.group||t,e=e.key;else if(e instanceof Element)"OPTION"==e.tagName?(t=e.parentElement.label||"#",e=e.value||e.innerText):e.hasAttribute("data-key")&&(t=e[i]("data-group")||e.parentElement[i]("data-group")||"#",e=e[i]("data-key"));else{if("number"==typeof e)return this.get(this[e]);if("string"!=typeof e)return!1}return t in this.items&&this.items[t][e]},set:function(e,t){var i=e.value||e.innerText,n=e.parentElement.label||"#";if(n in this.items||(this.items[n]={},this.groups[n]=e.parentElement),i in this.items[n])return!1;var s=this.self.con;if((!s.multiple&&0<this.selected.length||s.multiple&&this.selected.length>=s.multiLimit)&&(e.selected=!1),!e.selected||!s.deselect||e.hasAttribute("selected")&&0!=s.multiLimit||(e.selected=!1,e.parentElement.selectedIndex=-1),e.hasAttribute("data-description")){var l=g("SPAN");l.innerHTML=e.getAttribute("data-description"),e.setAttribute("data-description",l.innerHTML)}return this[this.length++]=this.items[n][i]={key:i,value:e.text,index:this.length-1,description:e.getAttribute("data-description")||null,group:n,option:e,optgroup:"#"!=n?this.groups[n]:void 0,selected:e.selected,disabled:e.disabled},e.selected&&this.select(this.items[n][i]),e.disabled&&this.disable(this.items[n][i]),!t||this.self.callback(this[this.length-1],"rebuild")},add:function(e,t,i,n,s,l,o){if(e instanceof Object){for(var r in e)this.add(e[r].key||r,e[r].value,e[r].group,e[r].selected,e[r].disabled,e[r].description,!1);return this.self.query()}if(this.get(e,i))return!1;if("#"!==(i="string"==typeof i?i:"#")&&!(i in this.groups)){var a=g("OPTGROUP");a.label=i,a.setAttribute("data-select-optgroup","add"),this.element.appendChild(a),this.items[i]={},this.groups[i]=a}var c=this.self.con;(!c.multiple&&0<this.selected.length||c.multiple&&this.selected.length>=c.multiLimit)&&(n=!1),s=!!s;var h=d.createElement("OPTION");return h.value=e,h.selected=n,h.disabled=s,h.innerText=t,h.setAttribute("data-select-option","add"),l&&0<l.length&&h.setAttribute("data-description",l),("#"==i?this.element:this.groups[i]).appendChild(h),this.set(h,o)},move:function(e,t,i,n){if(!(e=this.get(e,t)))return!1;if("#"!==i&&!(i in this.groups)){var s=g("OPTGROUP");s.label=i,this.element.appendChild(s),this.items[i]={},this.groups[i]=s,this.groups[i].appendChild(e.option)}return delete this.items[e.group][e.key],e.group=i,e.optgroup=this.groups[i]||void 0,this.items[i][e.key]=e,!n||this.self.query()},remove:function(e,t,i){return!!(e=this.get(e,t))&&(e.selected&&this.unselect(e),e.disabled&&this.enable(e),e.option.parentElement.removeChild(e.option),Array.prototype.splice.call(this,e.index,1),delete this.items[e.group][e.key],0===Object.keys(this.items[e.group]).length&&(delete this.items[e.group],delete this.groups[e.group]),!i||this.self.query())},is:function(e,t,i){e=this._r(e);var n=this.get(t,i);return!n||["select","unselect","disable","enable"].indexOf(e)<0?null:"disable"==e||"enable"==e?"disable"==e?n.disabled:!n.disabled:("select"==e||"unselect"==e)&&("select"==e?n.selected:!n.selected)},handle:function(e,t,i,n){var s=this.get(t,i);e=this._r(e);if(!s||["select","unselect","disable","enable"].indexOf(e)<0)return null;if("disable"==e||"enable"==e)return s.option in this.disabled||"disable"!=e?s.option in this.disabled&&"enable"==e&&this.disabled.splice(this.disabled.indexOf(s.option),1):this.disabled.push(s.option),s.disabled="disable"==e,s.option.disabled="disable"==e,this.self.callback.call(this.self,s,e);var l=b(this.self.select,"disabled")||s.disabled||s.option.disabled,o=this.self.con.multiple&&this.self.con.multiLimit<=this.selected.length,r=!this.self.con.multiple&&0<this.selected.indexOf(s.option),a=0==this.self.con.multiLimit&&1==this.self.con.deselect,c=!this.self.con.multiple&&!this.self.con.deselect&&!0!==n;if("select"==e){if(l||o||a||r)return!1;if(!this.self.con.multiple)for(var h in this.selected)this.unselect(this.selected[h],void 0,!0);this.selected.indexOf(s.option)<0&&this.selected.push(s.option)}else if("unselect"==e){if(l||c)return!1;this.selected.splice(this.selected.indexOf(s.option),1)}return s.selected="select"==e,s.option.selected="select"==e,s.option[(6<e.length?"remove":"set")+"Attribute"]("selected","selected"),this.self.callback.call(this.self,s,e,n)},enable:function(e,t){return this.handle("enable",e,t,!1)},disable:function(e,t){return this.handle("disable",e,t,!1)},select:function(e,t){return this.handle("select",e,t,!1)},unselect:function(e,t,i){return this.handle("unselect",e,t,i)},toggle:function(e,t){return!!(e=this.get(e,t))&&this.handle(e.selected?"unselect":"select",e,t,!1)},invert:function(t){if(t=this._replaceType(t),0<=["enable","disable"].indexOf(t))var i=this.disabled,n="enable"==t?"disable":"enable";else if(0<=["select","unselect"].indexOf(t))i=this.selected,n="select"==t?"unselect":"select";var e=Array.prototype.filter.call(this,function(e){return!(e in i)}),s=this;return[].concat(i).forEach(function(e){s.handle.call(s,n,e)}),[].concat(e).forEach(function(e){s.handle.call(s,t,e)}),!0},all:function(t,i){var n=this,e=this;return i in this.items?e=Object.keys(this.items[i]):0<=["unselect","enable"].indexOf(t)&&(e=[].concat("unselect"==t?this.selected:this.disabled)),Array.prototype.forEach.call(e,function(e){n.handle.call(n,t,e,i,!1)}),!0},walk:function(t,e,i){if(e instanceof Array||e.length)for(var n=e.length,s=0;s<n;s++)this.handle.apply(this,[t,e[s],null].concat(i));else if(e instanceof Object){var l=this;if(e.forEach)e.forEach(function(e){l.handle.apply(l,[t,e,null].concat(i))});else for(var o in e)("string"==typeof e[o]||"number"==typeof e[o]||e[o]instanceof Element)&&this.handle.apply(this,[t,e[o],o in this.items?o:null]).concat(i)}return this},find:function(e,i){var n=new RegExp(e,"im"),s=[],l=this,o=function(e){return n.test(e.text||e.value)};return Array.apply(null,this.self.e.options).map(function(e){return!!("any"==i?(t=e,n.test(t.text)||n.test(t.value)||0<Array.apply(null,t.attributes).filter(o).length):o(e))&&(!(0<=l.disabled.indexOf(e)&&!l.self.con.searchDisabled)&&void s.push(l.get(e)));var t}),s},finder:function(e,t){var i;for(void 0===this._finderLoop&&(this._finderLoop=this.find(e,t));void 0!==(i=this._finderLoop.shift());)return i;return delete this._finderLoop,!1},walker:function(e,t){if(void 0!==this._inLoop&&this._inLoop){if(0<this._inItems.length){var i=this._inItems.shift();return this.items[this._inGroup][i]}if(0<this._inGroups.length){for(;0<this._inGroups.length;){var n=this._inGroups.shift(),s=Object.keys(this.items[n]);if(0<s.length)break}return"ASC"==e?s.sort():"DESC"==e?s.sort().reverse():"function"==typeof e&&(s=e.call(this,s)),this._inItems=s,this._inGroup=n,this.walker(null,null)}return delete this._inLoop,delete this._inItems,delete this._inGroup,delete this._inGroups,!1}var l=Object.keys(this.groups);return"ASC"==t?l.sort():"DESC"==t?l.sort().reverse():"function"==typeof t&&(l=t.call(this,l)),l.unshift("#"),this._inLoop=!0,this._inItems=[],this._inGroups=l,this.walker(e,null)}},p});
  