Socket
Socket
Sign inDemoInstall

tail.select

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.8 to 0.5.9

langs/tail.select-es.js

10

CHANGELOG.md
CHANGELOG
===========
Version 0.5.9 - Beta
--------------------
- Add: The new Russian Translation. Many Thanks to [elPesecillo](https://github.com/elPesecillo)
([#41](https://github.com/pytesNET/tail.select/issues/41))!
- Add: The new experimental `linguisticRules` options, which allows to regex letters, which are
(used) similiar. Thanks to ([#42](https://github.com/pytesNET/tail.select/issues/42)).
- Update: [ES6] Changed the last `var` variables into `let`.
Version 0.5.8 - Beta
--------------------
- Add: The new Brazilian Portuguese Translation. Many Thanks to [Roman Yepanchenko](https://github.com/tizis)
- Add: The new Russian Translation. Many Thanks to [Roman Yepanchenko](https://github.com/tizis)
([#38](https://github.com/pytesNET/tail.select/issues/38))!

@@ -8,0 +16,0 @@ - Add: Allow callback functions as strings to allow a deeper translation.

41

js/tail.select-es6.js

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -78,3 +78,3 @@ | @website https://github.com/pytesNET/tail.select

}, tailOptions;
tailSelect.version = "0.5.8";
tailSelect.version = "0.5.9";
tailSelect.status = "dev";

@@ -100,2 +100,5 @@ tailSelect.count = 0;

locale: "en",
linguisticRules: {
"ё": "е"
},
multiple: false,

@@ -193,4 +196,4 @@ multiLimit: Infinity,

placeholderMulti: function(args){
var strings = ["варианта", "вариантов", "вариантов"], cases = [2, 0, 1, 1, 1, 2], num = args[":limit"];
var string = strings[(num%100 > 4 && num%100 < 20)? 2: cases[(num%10 < 5)? num%10: 5]];
let strings = ["варианта", "вариантов", "вариантов"], cases = [2, 0, 1, 1, 1, 2], num = args[":limit"];
let string = strings[(num%100 > 4 && num%100 < 20)? 2: cases[(num%10 < 5)? num%10: 5]];
return "Выбор до :limit " + string + " ...";

@@ -206,3 +209,3 @@ },

if((id instanceof Object)){
for(var key in id){
for(let key in id){
this.modify(locale, key, id[key]);

@@ -237,3 +240,3 @@ }

var string = this.__[string];
string = this.__[string];
if(typeof(string) === "function"){

@@ -243,3 +246,3 @@ string = string.call(this, replace);

if(typeof(replace) === "object"){
for(var key in replace){
for(let key in replace){
string = string.replace(key, replace[key]);

@@ -444,4 +447,4 @@ }

} else {
var u = [].concat(self.options.selected);
var s = Array.from(this.e[queA]("option:checked")).filter((item) => {
let u = [].concat(self.options.selected);
let s = Array.from(this.e[queA]("option:checked")).filter((item) => {
if(u.indexOf(item) >= 0){

@@ -543,9 +546,17 @@ u.splice(u.indexOf(item), 1);

| API :: QUERY OPTIONS
| @version 0.5.8 [0.5.0]
| @version 0.5.9 [0.5.0]
*/
query(search, conf){
let root = create("DIV", "dropdown-inner"), tp, ul, a1, a2,
func = search? "finder": "walker", con = this.con,
args = search? [search, conf]: [con.sortItems, con.sortGroups];
func = search? "finder": "walker", con = this.con, re;
// Format Search
if(typeof(search) === "string" && search.length > 0){
for(let key in con.linguisticRules){
re = new RegExp(`(${key}|${con.linguisticRules[key]})`, "ig");
search = search.replace(re, `(${key}|${con.linguisticRules[key]})`);
}
}
let args = search? [search, conf]: [con.sortItems, con.sortGroups];
// Option Walker

@@ -653,3 +664,3 @@ this._query = (typeof(search) == "string")? search: false;

if(search && search.length > 0 && this.con.searchMarked){
li.innerHTML = v.replace(new RegExp("(" + search + ")", "i"), "<mark>$1</mark>");
li.innerHTML = v.replace(new RegExp(`(${search})`, "i"), "<mark>$1</mark>");
} else {

@@ -1294,3 +1305,3 @@ li.innerText = v;

if(items instanceof Array || items.length){
for(var l = items.length, i = 0; i < l; i++){
for(let l = items.length, i = 0; i < l; i++){
this.handle.apply(this, [state, items[i], null].concat(args));

@@ -1302,3 +1313,3 @@ }

} else {
for(var key in items){
for(let key in items){
if(typeof(items[key]) != "string" && typeof(items[key]) != "number" && !(items[key] instanceof Element)){

@@ -1305,0 +1316,0 @@ continue;

@@ -1,2 +0,2 @@

/* pytesNET/tail.select v.0.5.8 | ES6 Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
var{select,options}=function(a){function b(a,b){let d=c.createElement(a);return d.className=b&&b.join?b.join(" "):b||"",d}let c=a.document;const d="querySelector",e="querySelectorAll",f="parentElement",g="hasAttribute",h="getAttribute",i="setAttribute",j="removeAttribute";let k,l=function(a,b){if(a="string"==typeof a?c[e](a):a,a instanceof NodeList||a instanceof HTMLCollection||a instanceof Array){let c=Array.prototype.map.call(a,a=>new l(a,Object.assign({},b)));return 1===c.length?c[0]:0!==c.length&&c}if(!(a instanceof Element)||!(this instanceof l))return!!(a instanceof Element)&&new l(a,b);if(l.inst[a[h]("data-tail-select")])return l.inst[a[h]("data-tail-select")];if(a[h]("data-select")){let c=JSON.parse(a[h]("data-select").replace(/\'/g,"\""));b=c instanceof Object?Object.assign(b,c):b}let d=a[h]("placeholder")||a[h]("data-placeholder");return b="object"==typeof b?b:{},b.multiple="multiple"in b?b.multiple:a.multiple,b.disabled="disabled"in b?b.disabled:a.disabled,b.placeholder=d||b.placeholder||null,b.width="auto"===b.width?a.offsetWidth+50:b.width,b.sourceBind="bindSourceSelect"in b?b.bindSourceSelect:b.sourceBind||!1,b.sourceHide="sourceHide"in b?b.sourceHide:b.sourceHide||!0,b.multiLimit=0<=b.multiLimit?b.multiLimit:1/0,this.e=a,this.id=++l.count,this.con=Object.assign({},l.defaults,b),this.events={},l.inst["tail-"+this.id]=this,this.init().bind()};return l.version="0.5.8",l.status="dev",l.count=0,l.inst={},l.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,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},l.strings={de:{all:"Alle",none:"Keine",actionAll:"Alle ausw\xE4hlen",actionNone:"Alle abw\xE4hlen",empty:"Keine Optionen verf\xFCgbar",emptySearch:"Keine Optionen gefunden",limit:"Keine weiteren Optionen w\xE4hlbar",placeholder:"W\xE4hle eine Option...",placeholderMulti:"W\xE4hle bis zu :limit Optionen...",search:"Tippen zum suchen",disabled:"Dieses Feld ist deaktiviert"},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"},fr:{all:"Tous",none:"Aucun",actionAll:"S\xE9lectionner tout",actionNone:"S\xE9lectionner aucun",empty:"Aucune option disponible",emptySearch:"Aucune option trouv\xE9e",limit:"Aucune autre option s\xE9lectionnable",placeholder:"Choisissez une option ...",placeholderMulti:"Choisissez jusqu'\xE0 :limit option(s) ...",search:"Rechercher ...",disabled:"Ce champs est d\xE9sactiv\xE9"},pt_BR:{all:"Todas",none:"Nenhuma",actionAll:"Selecionar todas",actionNone:"Desmarcar todas",empty:"Nenhuma op\xE7\xE3o dispon\xEDvel",emptySearch:"Nenhuma op\xE7\xE3o encontrada",limit:"N\xE3o \xE9 poss\xEDvel selecionar outra op\xE7\xE3o",placeholder:"Escolha uma op\xE7\xE3o ...",placeholderMulti:"Escolha at\xE9: :limit op\xE7\xE3o(\xF5es) ...",search:"Buscar ...",disabled:"Campo desativado"},ru:{all:"\u0412\u0441\u0435",none:"\u041D\u0438\u0447\u0435\u0433\u043E",actionAll:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435",actionNone:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0432\u0441\u0435",empty:"\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432",emptySearch:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",limit:"\u0412\u044B \u043D\u0435 \u043C\u043E\u0436\u0435\u0442\u0435 \u0432\u044B\u0431\u0440\u0430\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432",placeholder:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442...",placeholderMulti:function(a){var b=a[":limit"],c=["\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430","\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432","\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432"][4<b%100&&20>b%100?2:[2,0,1,1,1,2][5>b%10?b%10:5]];return"\u0412\u044B\u0431\u043E\u0440 \u0434\u043E :limit "+c+" ..."},search:"\u041D\u0430\u0447\u043D\u0438\u0442\u0435 \u043D\u0430\u0431\u0438\u0440\u0430\u0442\u044C \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430 ...",disabled:"\u041F\u043E\u043B\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E"},modify(a,b,c){if(!(a in this))return!1;if(b instanceof Object)for(var d in b)this.modify(a,d,b[d]);else this[a][b]="string"==typeof c?c:this[a][b];return!0},register(a,b){return!!("string"==typeof a&&b instanceof Object)&&(this[a]=b,!0)}},l.prototype={_e(a,b,c){if(!(a in this.__))return c?c:a;var a=this.__[a];if("function"==typeof a&&(a=a.call(this,b)),"object"==typeof b)for(var d in b)a=a.replace(d,b[d]);return a},init(){let a=["tail-select"],g=this.con,h=/^[0-9.]+(?:cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|\%)$/i;return this.__=Object.assign({},l.strings.en,l.strings[g.locale]||{}),this._init=!0,this._query=!1,a=a.concat(!0===g.classNames?this.e.className:g.classNames),g.hideSelected&&a.push("hide-selected"),g.hideDisabled&&a.push("hide-disabled"),0==g.multiLimit&&a.push("disabled"),g.multiple&&a.push("multiple"),g.deselect&&a.push("deselect"),g.disabled&&a.push("disabled"),this.select=b("DIV",a),g.width&&h.test(g.width)?this.select.style.width=g.width:g.width&&!isNaN(parseFloat(g.width,10))&&(this.select.style.width=g.width+"px"),this.label=b("DIV","select-label"),this.label.addEventListener("click",()=>{this.toggle()}),this.select.appendChild(this.label),this.dropdown=b("DIV","select-dropdown"),isNaN(parseInt(g.height,10))||(this.dropdown.style.maxHeight=parseInt(g.height,10)+"px"),g.search&&(this.search=b("DIV","dropdown-search"),this.search.innerHTML=`<input type="text" class="search-input" placeholder="${this._e("search")}" />`,this.search.children[0].addEventListener("input",a=>{this.query(2<a.target.value.length?a.target.value:void 0)}),this.dropdown.appendChild(this.search)),this.select.appendChild(this.dropdown),this.csvInput=b("INPUT","select-search"),this.csvInput.type="hidden",g.csvOutput&&(this.csvInput.name=this.e.name,this.e[j]("name"),this.select.appendChild(this.csvInput)),g.multiple&&g.multiContainer&&(c[d](g.multiContainer)?(this.container=c[d](g.multiContainer),this.container.classList.add("tail-select-container")):!0===g.multiContainer&&(this.container=this.label,this.container.classList.add("tail-select-container"))),this.options=new k(this.e,this),Array.prototype.map.call(this.e.options,a=>{this.options.set(a,!1)}),Object.keys(g.items).forEach(f=>{let h=g.items[f].join?g.items[f]:{value:g.items[f]},{value:i,group:a,selected:b,disabled:c,description:d}=h;this.options.add(g.items[f].key||f,i,a,b,c,d)}),this.query(),this.e.nextElementSibling?this.e[f].insertBefore(this.select,this.e.nextElementSibling):this.e[f].appendChild(this.select),g.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._init=!1,this.e[i]("data-tail-select","tail-"+this.id),(g.cbComplete||function(){}).call(this,this.select),g.startOpen?this.open(this.con.animate):this},bind(){return(c.addEventListener("keydown",a=>{let b,c,g,h,i=a.keyCode||a.which;if(!this.select.classList.contains("active")||0>[13,27,38,40].indexOf(i))return!1;if(a.preventDefault(),a.stopPropagation(),13==i&&(b=this.dropdown[d](".dropdown-option.hover:not(.disabled)"))&&this.options.select(b),27==i||13==i)return this.close(this.con.animate);if(b=this.dropdown[d](".dropdown-option.hover:not(.disabled)")){b.classList.remove("hover"),g=[(40==i?"next":"previous")+"ElementSibling"];do{if(b=null!==(h=b[g])&&"LI"==b.tagName?h:!!(null!==(h=b[f][g])&&0<h.children.length&&"UL"==h.tagName)&&h.children[40==i?0:h.children.length-1],b&&(!/dropdown-option/.test(b.className)||/disabled/.test(b.className)))continue;break}while(!0)}if(b||40!=i?!b&&38==i&&(b=this.dropdown[d]("ul:last-child li:not(.disabled):last-child")):b=this.dropdown[d](".dropdown-option:not(.disabled)"),b&&(c=this.dropdown[d](".dropdown-inner"))){let a=function(a){let b={top:a.offsetTop,height:a.offsetHeight};for(;(a=a[f])!=c;)b.top+=a.offsetTop;return b}(b);b.classList.add("hover"),a.top+2*a.height>c.offsetHeight+c.scrollTop?c.scrollBy(0,a.top+2*a.height-(c.offsetHeight+c.scrollTop)):a.top-a.height<c.scrollTop&&c.scrollBy(0,-Math.abs(c.scrollTop-a.top+a.height))}return!0}),c.addEventListener("click",a=>{let b=!this.select.classList.contains("active")||this.select.classList.contains("idle");if(b||this.con.stayOpen)return!1;let c=[this.e,this.select,this.container].filter(b=>b&&(b.contains(a.target)||b==a.target));return 0==c.length&&this.close(this.con.animate)}),!!!this.con.sourceBind)||(this.e.addEventListener("change",()=>{if(null!=event.detail)return!1;if(event.preventDefault(),event.stopPropagation(),!this.multiple&&this.selectedIndex)this.options.select(this.e.options[this.selectedIndex]);else{var a=[].concat(self.options.selected),b=Array.from(this.e[e]("option:checked")).filter(b=>!(0<=a.indexOf(b))||(a.splice(a.indexOf(b),1),!1));this.options.walk("unselect",a),this.options.walk("select",b)}}),!0)},callback(a,b,c){let e=this,f=`[data-key='${a.key}'][data-group='${a.group}']`;if("rebuild"==b)return this.query();let g=this.dropdown[d](f);return g&&0<=["select","disable"].indexOf(b)?g.classList.add("select"==b?"selected":"disabled"):g&&0<=["unselect","enable"].indexOf(b)&&g.classList.remove("unselect"==b?"selected":"disabled"),this.update(a),!!c||this.trigger("change",a,b)},trigger(a){if(this._init)return!1;let b={bubbles:!1,cancelable:!0,detail:{args:arguments,self:this}};"change"==a&&arguments[2]&&0<=arguments[2].indexOf("select")&&(this.e.dispatchEvent(new CustomEvent("input",b)),this.e.dispatchEvent(new CustomEvent("change",b))),this.select.dispatchEvent(new CustomEvent("tail::"+a,b));let c,d=[...arguments];return d.shift(),(this.events[a]||[]).forEach(a=>{c=[].concat(d),c.push(a.args||null),(a.cb||function(){}).apply(this,c)}),!0},calc(){let b=this.dropdown.cloneNode(!0),c=this.con.height,e=0,g=this.dropdown[d](".dropdown-inner");b=this.dropdown.cloneNode(!0),b.style.cssText="height:auto;min-height:auto;max-height:none;opacity:0;display:block;visibility:hidden;",b.style.maxHeight=this.con.height+"px",b.className+=" cloned",this.dropdown[f].appendChild(b),c=c>b.clientHeight?b.clientHeight:c,this.con.search&&(e=b[d](".dropdown-search").clientHeight),this.dropdown[f].removeChild(b);let h=this.select.getBoundingClientRect(),i=a.innerHeight-(h.top+h.height),j=!!(c+e>i)&&h.top>i;return!0===this.con.openAbove||!1!==this.con.openAbove&&j?(j=!0,c=Math.min(c,h.top-10),this.select.classList.add("open-top")):(j=!1,c=Math.min(c,i-10),this.select.classList.remove("open-top")),g&&(this.dropdown.style.maxHeight=c+"px",g.style.maxHeight=c-e+"px"),this},query(a,c){let f,g,j,k,l=b("DIV","dropdown-inner"),m=a?"finder":"walker",n=this.con,o=a?[a,c]:[n.sortItems,n.sortGroups];this._query="string"==typeof a&&a;for(let b of this.options[m].apply(this.options,o)){if(!g||g&&g[h]("data-group")!==b.group)if(f=(n.cbLoopGroup||this.cbGroup).call(this,b.group,a,l),f instanceof Element)g=f,g[i]("data-group",b.group),l.appendChild(g);else break;let c=(n.cbLoopItem||this.cbItem).call(this,b,g,a,l);if(null!==c){if(!1===c)break;c[i]("data-key",b.key),c[i]("data-group",b.group),c.addEventListener("click",()=>!!c[h]("data-key")&&void(this.options.toggle(c[h]("data-key"),c[h]("data-group"))&&!n.stayOpen&&!n.multiple&&this.close(this.con.animate))),g.appendChild(c)}}let p=l[e]("*[data-key]").length;if(0==p&&(this.con.cbEmpty||function(a){let c=b("SPAN","dropdown-empty");c.innerText=this._e("empty"),a.appendChild(c)}).call(this,l,a),0<p&&n.multiple&&n.multiLimit==1/0&&n.multiSelectAll){j=b("BUTTON","tail-all"),k=b("BUTTON","tail-none"),j.innerText=this._e("actionAll"),j.addEventListener("click",a=>{a.preventDefault(),this.options.walk("select",this.dropdown.querySelectorAll(".dropdown-inner .dropdown-option"))}),k.innerText=this._e("actionNone"),k.addEventListener("click",a=>{a.preventDefault(),this.options.walk("unselect",this.dropdown.querySelectorAll(".dropdown-inner .dropdown-option"))});let a=b("SPAN","dropdown-action");a.appendChild(j),a.appendChild(k),l.insertBefore(a,l.children[0])}let q=this.dropdown[d](".dropdown-inner");return this.dropdown[(q?"replace":"append")+"Child"](l,q),this.select.classList.contains("active")&&this.calc(),this.updateCSV().updateLabel()},cbGroup(a){let c,d,e=b("UL","dropdown-optgroup"),g=this;return"#"==a?e:(e.innerHTML=`<li class="optgroup-title"><b>${a}</b></li>`,this.con.multiple&&this.con.multiLimit==1/0&&this.con.multiSelectAll&&(c=b("BUTTON","tail-none"),d=b("BUTTON","tail-all"),c.innerText=this._e("none"),c.addEventListener("click",a=>{a.preventDefault(),this.options.all("unselect",a.target[f][f][h]("data-group"))}),d.innerText=this._e("all"),d.addEventListener("click",a=>{a.preventDefault(),this.options.all("select",a.target[f][f][h]("data-group"))}),e.children[0].appendChild(c),e.children[0].appendChild(d)),e)},cbItem(a,c,e){let{value:f,selected:g,disabled:h}=a,d=b("LI","dropdown-option"+(g?" selected":"")+(h?" disabled":""));return e&&0<e.length&&this.con.searchMarked?d.innerHTML=f.replace(new RegExp("("+e+")","i"),"<mark>$1</mark>"):d.innerText=f,this.con.descriptions&&a.description&&(d.innerHTML+=`<span class="option-description">${a.description}</span>`),d},update(a){return this.updateLabel().updateContainer(a).updatePin(a).updateCSV(a)},updateLabel(a){if(this.container==this.label&&0<this.options.selected.length)return this.label[d](".label-inner")&&this.label.removeChild(this.label[d](".label-inner")),this.label[d](".label-count")&&this.label.removeChild(this.label[d](".label-count")),this;let b,f=this.con,c=this.options.selected.length;return"string"!=typeof a&&(f.disabled?a="disabled":0==this.dropdown[e]("*[data-key]").length?a="empty"+(this.select.classList.contains("in-search")?"Search":""):f.multiLimit<=c?a="limit":!f.multiple&&0<this.options.selected.length?a=this.options.selected[0].innerText:"string"==typeof f.placeholder?a=f.placeholder:a="placeholder"+(f.multiple&&f.multiLimit<1/0?"Multi":"")),a=this._e(a,{":limit":f.multiLimit},a),a=`<span class="label-inner">${a}</span>`,b=f.multiShowLimit&&f.multiLimit<1/0,f.multiple&&f.multiShowCount&&(a=`<span class="label-count">:c</span>\n${a}`,a=a.replace(":c",c+(b?" / "+f.multiLimit:""))),this.label.innerHTML=a,this},updateContainer(a){if(!this.container||!this.con.multiContainer)return this;let c=`[data-group='${a.group}'][data-key='${a.key}']`;if(this.container[d](c))return a.selected||this.container.removeChild(this.container[d](c)),this;if(a.selected){let c=b("DIV","select-handle");c.innerText=a.value,c[i]("data-key",a.key),c[i]("data-group",a.group),c.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.options.unselect(a.target[h]("data-key"),a.target[h]("data-group"))}),this.container.appendChild(c)}return this},updatePin(a){let b=this.dropdown[d](".dropdown-inner ul");if(!this.con.multiPinSelected||!b||!1!==this._query)return this;if(option=this.dropdown[d](`li[data-key='${a.key}'][data-group='${a.group}']`),a.selected)b.insertBefore(option,b.children[0]);else{let b=this.dropdown[d](`ul[data-group='${a.group}']`),c=this.options[a.index-1],e=!1;for(;c&&c.group==a.group&&!(e=b[d](`li[data-key='${c.key}']`));)c=this.options[c.index-1];e&&e.nextElementSibling?b.insertBefore(option,e.nextElementSibling):b.appendChild(option)}return this},updateCSV(){if(!this.csvInput||!this.con.csvOutput)return this;let a=this.options.selected.map(a=>a.value);return this.csvInput.value=a.join(this.con.csvSeparator||","),this},open(a){if(/active|idle/.test(this.select.className)||this.con.disabled)return!1;this.calc();let b=function(){this.select.classList.add("active"),this.select.classList.remove("idle"),this.dropdown.style.height="auto",this.dropdown.style.overflow="visible",this.label[j]("style"),this.con.search&&this.con.searchFocus&&this.dropdown[d]("input").focus(),this.trigger.call(this,"open")},c=this,f=this.dropdown.style;if(this.con.animate&&!1!==a){this.label.style.zIndex=25,this.dropdown.style.cssText+="height:0;display:block;overflow:hidden;",this.select.classList.add("idle");let a=()=>{let d=parseInt(f.height,10),e=parseInt(f.maxHeight,10);return d>=e?b.call(c):void(f.height=(d+50>e?e:d+50)+"px",setTimeout(a,20))};a()}else f.cssText=`height:${f.maxHeight};display:block;overflow:hidden;`,b.call(this);return this},close(a){if(!this.select.classList.contains("active")||this.select.classList.contains("idle"))return!1;let b=function(){this.select.classList.remove("idle","active"),this.dropdown[j]("style"),this.dropdown[d](".dropdown-inner")[j]("style"),this.trigger.call(this,"close")},c=this,f=this.dropdown;if(this.con.animate&&!1!==a){this.select.classList.add("idle"),this.dropdown.style.overflow="hidden";let a=()=>0>=parseInt(f.offsetHeight,10)-50?b.call(c):void(f.style.height=parseInt(f.offsetHeight,10)-50+"px",setTimeout(a,20));a()}else b.call(this);return this},toggle(a){return this.select.classList.contains("active")?this.close(a):this.select.classList.contains("idle")?this:this.open(a)},remove(){return this.e[j]("data-tail-select"),this.e[g]("data-select-hidden")&&("0"==this.e[h]("data-select-hidden")&&this.e.style.removeProperty("display"),this.e[j]("data-select-hidden")),Array.from(this.e[e]("[data-select-option='add']"),a=>{a.parentElement.removeChild(a)}),Array.from(this.e[e]("[data-select-optgroup='add']"),a=>{a.parentElement.removeChild(a)}),this.e.name=this.csvInput.hasAttribute("name")?this.csvInput.name:this.e.name,this.select[f].removeChild(this.select),this.container&&Array.from(this.container[e](".select-handle"),a=>{a.parentElement.removeChild(a)}),this},reload(){return this.remove().init()},config(a,b){if(a instanceof Object){for(let b in a)this.config(b,a[b],!1);return this.reload()?this.con:this.con}return"undefined"==typeof a?this.con:!!(a in this.con)&&("undefined"==typeof b?this.con[a]:(this.con[a]=b,!1!==this.rebuild&&this.reload(),this))},enable(a){return this.select.classList.remove("disabled"),this.e.disabled=!1,this.con.disabled=!1,!1===a?this:this.reload()},disable(a){return this.select.classList.add("disabled"),this.e.disabled=!0,this.con.disabled=!0,!1===a?this:this.reload()},on(a,b,c){return!(0>["open","close","change"].indexOf(a)||"function"!=typeof b)&&(a in this.events||(this.events[a]=[]),this.events[a].push({cb:b,args:c instanceof Array?c:[]}),this)}},k=l.options=function(a,b){return this instanceof k?(this.self=b,this.element=a,this.length=0,this.selected=[],this.disabled=[],this.items={"#":{}},this.groups={},this):new k(a,b)},k.prototype={_r(a){return a.replace("disabled","disable").replace("enabled","enable").replace("selected","select").replace("unselected","unselect")},get(a,b){if("object"==typeof a&&a.key&&a.group)b=a.group||b,a=a.key;else if(a instanceof Element)"OPTION"==a.tagName?(b=a[f].label||"#",a=a.value||a.innerText):a[g]("data-key")&&(b=a[h]("data-group")||a[f][h]("data-group")||"#",a=a[h]("data-key"));else if("string"!=typeof a)return!1;return a=/^[0-9]+$/.test(a)?"_"+a:a,!!(b in this.items)&&this.items[b][a]},set(a,c){let d=a.value||a.innerText,e=a[f].label||"#";if(e in this.items||(this.items[e]={},this.groups[e]=a[f]),d in this.items[e])return!1;let j=/^[0-9]+$/.test(d)?"_"+d:d,k=this.self.con,l=!k.multiple&&0<this.selected.length;if((l||k.multiple&&this.selected.length>=k.multiLimit)&&(a.selected=!1),a.selected&&k.deselect&&(!a[g]("selected")||0==k.multiLimit)&&(a.selected=!1,a.parentElement.selectedIndex=-1),a[g]("data-description")){let c=b("SPAN");c.innerHTML=a[h]("data-description"),a[i]("data-description",c.innerHTML)}return this.items[e][j]={key:d,value:a.text,description:a[h]("data-description")||null,group:e,option:a,optgroup:"#"==e?void 0:this.groups[e],selected:a.selected,disabled:a.disabled},this.length++,a.selected&&this.select(this.items[e][j]),a.disabled&&this.disable(this.items[e][j]),!c||this.self.callback(this[this.length-1],"rebuild")},add(f,g,h,j,k,l,m){if(f instanceof Object){for(let g in f){let{value:h,group:a,selected:b,disabled:c,description:d}=f[g];this.add(f[g].key||g,h,a,b,c,d,!1)}return this.self.query()}if(this.get(f,h))return!1;if(h="string"==typeof h?h:"#","#"!==h&&!(h in this.groups)){let a=b("OPTGROUP");a.label=h,a[i]("data-select-optgroup","add"),this.element.appendChild(a),this.items[h]={},this.groups[h]=a}let n=this.self.con,o=!n.multiple&&0<this.selected.length;(o||n.multiple&&this.selected.length>=n.multiLimit)&&(j=!1),k=!!k;let a=c.createElement("OPTION");return a.value=f,a.selected=j,a.disabled=k,a.innerText=g,a[i]("data-select-option","add"),l&&0<l.length&&a[i]("data-description",l),("#"==h?this.element:this.groups[h]).appendChild(a),this.set(a,m)},move(a,c,d,e){if(!(a=this.get(a,c)))return!1;if("#"!==d&&!(d in this.groups)){let c=b("OPTGROUP");c.label=d,this.element.appendChild(c),this.items[d]={},this.groups[d]=c,this.groups[d].appendChild(a.option)}return delete this.items[a.group][a.key],a.group=d,a.optgroup=this.groups[d]||void 0,this.items[d][a.key]=a,!e||this.self.query()},remove(a,b,c){if(!(a=this.get(a,b)))return!1;a.selected&&this.unselect(a),a.disabled&&this.enable(a),a.option[f].removeChild(a.option);let d=/^[0-9]+$/.test(a.key)?"_"+a.key:a.key;return delete this.items[a.group][d],this.length--,0===Object.keys(this.items[a.group]).length&&(delete this.items[a.group],delete this.groups[a.group]),!c||this.self.query()},is(a,b,c){return(a=this._r(a),b=this.get(b,c),!b||0>["select","unselect","disable","enable"].indexOf(a))?null:"disable"==a||"enable"==a?"disable"==a?b.disabled:!b.disabled:("select"==a||"unselect"==a)&&("select"==a?b.selected:!b.selected)},handle(a,b,c,d){if(a=this._r(a),b=this.get(b,c),!b||0>["select","unselect","disable","enable"].indexOf(a))return null;if("disable"==a||"enable"==a)return b.option in this.disabled||"disable"!=a?b.option in this.disabled&&"enable"==a&&this.disabled.splice(this.disabled.indexOf(b.option),1):this.disabled.push(b.option),b.disabled="disable"==a,b.option.disabled="disable"==a,this.self.callback.call(this.self,b,a);let e=this.self.select.classList.contains("disabled")||b.disabled||b.option.disabled,f=this.self.con.multiple&&this.self.con.multiLimit<=this.selected.length,g=!this.self.con.multiple&&0<this.selected.indexOf(b.option),h=0==this.self.con.multiLimit&&!0==this.self.con.deselect,i=!this.self.con.multiple&&!this.self.con.deselect&&!0!==d;if("select"==a){if(e||f||h||g)return!1;if(!this.self.con.multiple)for(let a in this.selected)this.unselect(this.selected[a],void 0,!0);0>this.selected.indexOf(b.option)&&this.selected.push(b.option)}else if("unselect"==a){if(e||i)return!1;this.selected.splice(this.selected.indexOf(b.option),1)}return b.selected="select"==a,b.option.selected="select"==a,b.option[(6<a.length?"remove":"set")+"Attribute"]("selected","selected"),this.self.callback.call(this.self,b,a)},enable(a,b){return this.handle("enable",a,b)},disable(a,b){return this.handle("disable",a,b)},select(a,b){return this.handle("select",a,b)},unselect(a,b,c){return this.handle("unselect",a,b,c)},toggle(a,b){return!!(a=this.get(a,b))&&this.handle(a.selected?"unselect":"select",a,b)},invert(a){if(a=this._replaceType(a),0<=["enable","disable"].indexOf(a)){let b=this.disabled,c="enable"==a?"disable":"enable"}else if(0<=["select","unselect"].indexOf(a)){let b=this.selected,c="select"==a?"unselect":"select"}let b=Array.from(this).filter(a=>{!(a in invert)});return[].concat(invert).forEach(a=>{this.handle(action,a)}),[].concat(b).forEach(b=>{this.handle(a,b)}),!0},all(a,b){let c=this;return b in this.items?c=Object.keys(this.items[b]):0<=["unselect","enable"].indexOf(a)&&(c="unselect"==a?this.selected:this.disabled),[].concat(Array.from(c)).forEach(c=>{this.handle(a,c,b)}),!0},walk(a,b,c){if(b instanceof Array||b.length)for(var d=b.length,e=0;e<d;e++)this.handle.apply(this,[a,b[e],null].concat(c));else if(b instanceof Object)if(b.forEach)b.forEach(()=>{this.handle.apply(this,[a,value,null].concat(c))});else for(var f in b)("string"==typeof b[f]||"number"==typeof b[f]||b[f]instanceof Element)&&this.handle.apply(this,[a,b[f],f in this.items?f:null]).concat(c);return this},find(a,b){let c=new RegExp(a,"im"),d=[],e=a=>c.test(a.text||a.value),f=a=>c.test(a.text)||c.test(a.value)||0<Array.apply(null,a.attributes).filter(e.length);return Array.apply(null,this.self.e.options).map(a=>("any"==b?!!f(a):!!e(a))&&(!(0<=this.disabled.indexOf(a))||this.self.con.searchDisabled)&&void d.push(this.get(a))),d},*finder(a,b){for(let c,d=this.find(a,b);void 0!==(c=d.shift());)yield c},*walker(a,b){let c=Object.keys(this.groups);"ASC"==b?c.sort():"DESC"==b?c.sort().reverse():"function"==typeof b&&(c=b.call(this,c)),c.unshift("#");for(let d,e,f=c.length,g=0;g<f&&(d=c[g],!!(d in this.items));g++){e=Object.keys(this.items[d]),"ASC"==a?e.sort():"DESC"==a?e.sort().reverse():"function"==typeof a&&(e=a.call(this,e));for(let a=e.length,b=0;b<a;b++)yield this.items[d][e[b]]}}},{select:l,options:k}}(window||this);export{select,options};
/* pytesNET/tail.select v.0.5.9 | ES6 Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
var{select,options}=function(a){function b(a,b){let d=c.createElement(a);return d.className=b&&b.join?b.join(" "):b||"",d}let c=a.document;const d="querySelector",e="querySelectorAll",f="parentElement",g="hasAttribute",h="getAttribute",i="setAttribute",j="removeAttribute";let k,l=function(a,b){if(a="string"==typeof a?c[e](a):a,a instanceof NodeList||a instanceof HTMLCollection||a instanceof Array){let c=Array.prototype.map.call(a,a=>new l(a,Object.assign({},b)));return 1===c.length?c[0]:0!==c.length&&c}if(!(a instanceof Element)||!(this instanceof l))return!!(a instanceof Element)&&new l(a,b);if(l.inst[a[h]("data-tail-select")])return l.inst[a[h]("data-tail-select")];if(a[h]("data-select")){let c=JSON.parse(a[h]("data-select").replace(/\'/g,"\""));b=c instanceof Object?Object.assign(b,c):b}let d=a[h]("placeholder")||a[h]("data-placeholder");return b="object"==typeof b?b:{},b.multiple="multiple"in b?b.multiple:a.multiple,b.disabled="disabled"in b?b.disabled:a.disabled,b.placeholder=d||b.placeholder||null,b.width="auto"===b.width?a.offsetWidth+50:b.width,b.sourceBind="bindSourceSelect"in b?b.bindSourceSelect:b.sourceBind||!1,b.sourceHide="sourceHide"in b?b.sourceHide:b.sourceHide||!0,b.multiLimit=0<=b.multiLimit?b.multiLimit:1/0,this.e=a,this.id=++l.count,this.con=Object.assign({},l.defaults,b),this.events={},l.inst["tail-"+this.id]=this,this.init().bind()};return l.version="0.5.9",l.status="dev",l.count=0,l.inst={},l.defaults={animate:!0,classNames:null,csvOutput:!1,csvSeparator:",",descriptions:!1,deselect:!1,disabled:!1,height:350,hideDisabled:!1,hideSelected:!1,items:{},locale:"en",linguisticRules:{ё:"\u0435"},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,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},l.strings={de:{all:"Alle",none:"Keine",actionAll:"Alle ausw\xE4hlen",actionNone:"Alle abw\xE4hlen",empty:"Keine Optionen verf\xFCgbar",emptySearch:"Keine Optionen gefunden",limit:"Keine weiteren Optionen w\xE4hlbar",placeholder:"W\xE4hle eine Option...",placeholderMulti:"W\xE4hle bis zu :limit Optionen...",search:"Tippen zum suchen",disabled:"Dieses Feld ist deaktiviert"},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"},fr:{all:"Tous",none:"Aucun",actionAll:"S\xE9lectionner tout",actionNone:"S\xE9lectionner aucun",empty:"Aucune option disponible",emptySearch:"Aucune option trouv\xE9e",limit:"Aucune autre option s\xE9lectionnable",placeholder:"Choisissez une option ...",placeholderMulti:"Choisissez jusqu'\xE0 :limit option(s) ...",search:"Rechercher ...",disabled:"Ce champs est d\xE9sactiv\xE9"},pt_BR:{all:"Todas",none:"Nenhuma",actionAll:"Selecionar todas",actionNone:"Desmarcar todas",empty:"Nenhuma op\xE7\xE3o dispon\xEDvel",emptySearch:"Nenhuma op\xE7\xE3o encontrada",limit:"N\xE3o \xE9 poss\xEDvel selecionar outra op\xE7\xE3o",placeholder:"Escolha uma op\xE7\xE3o ...",placeholderMulti:"Escolha at\xE9: :limit op\xE7\xE3o(\xF5es) ...",search:"Buscar ...",disabled:"Campo desativado"},ru:{all:"\u0412\u0441\u0435",none:"\u041D\u0438\u0447\u0435\u0433\u043E",actionAll:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435",actionNone:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0432\u0441\u0435",empty:"\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432",emptySearch:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",limit:"\u0412\u044B \u043D\u0435 \u043C\u043E\u0436\u0435\u0442\u0435 \u0432\u044B\u0431\u0440\u0430\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432",placeholder:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442...",placeholderMulti:function(a){let b=a[":limit"],c=["\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430","\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432","\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432"][4<b%100&&20>b%100?2:[2,0,1,1,1,2][5>b%10?b%10:5]];return"\u0412\u044B\u0431\u043E\u0440 \u0434\u043E :limit "+c+" ..."},search:"\u041D\u0430\u0447\u043D\u0438\u0442\u0435 \u043D\u0430\u0431\u0438\u0440\u0430\u0442\u044C \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430 ...",disabled:"\u041F\u043E\u043B\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E"},modify(a,b,c){if(!(a in this))return!1;if(b instanceof Object)for(let c in b)this.modify(a,c,b[c]);else this[a][b]="string"==typeof c?c:this[a][b];return!0},register(a,b){return!!("string"==typeof a&&b instanceof Object)&&(this[a]=b,!0)}},l.prototype={_e(a,b,c){if(!(a in this.__))return c?c:a;if(a=this.__[a],"function"==typeof a&&(a=a.call(this,b)),"object"==typeof b)for(let c in b)a=a.replace(c,b[c]);return a},init(){let a=["tail-select"],g=this.con,h=/^[0-9.]+(?:cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|\%)$/i;return this.__=Object.assign({},l.strings.en,l.strings[g.locale]||{}),this._init=!0,this._query=!1,a=a.concat(!0===g.classNames?this.e.className:g.classNames),g.hideSelected&&a.push("hide-selected"),g.hideDisabled&&a.push("hide-disabled"),0==g.multiLimit&&a.push("disabled"),g.multiple&&a.push("multiple"),g.deselect&&a.push("deselect"),g.disabled&&a.push("disabled"),this.select=b("DIV",a),g.width&&h.test(g.width)?this.select.style.width=g.width:g.width&&!isNaN(parseFloat(g.width,10))&&(this.select.style.width=g.width+"px"),this.label=b("DIV","select-label"),this.label.addEventListener("click",()=>{this.toggle()}),this.select.appendChild(this.label),this.dropdown=b("DIV","select-dropdown"),isNaN(parseInt(g.height,10))||(this.dropdown.style.maxHeight=parseInt(g.height,10)+"px"),g.search&&(this.search=b("DIV","dropdown-search"),this.search.innerHTML=`<input type="text" class="search-input" placeholder="${this._e("search")}" />`,this.search.children[0].addEventListener("input",a=>{this.query(2<a.target.value.length?a.target.value:void 0)}),this.dropdown.appendChild(this.search)),this.select.appendChild(this.dropdown),this.csvInput=b("INPUT","select-search"),this.csvInput.type="hidden",g.csvOutput&&(this.csvInput.name=this.e.name,this.e[j]("name"),this.select.appendChild(this.csvInput)),g.multiple&&g.multiContainer&&(c[d](g.multiContainer)?(this.container=c[d](g.multiContainer),this.container.classList.add("tail-select-container")):!0===g.multiContainer&&(this.container=this.label,this.container.classList.add("tail-select-container"))),this.options=new k(this.e,this),Array.prototype.map.call(this.e.options,a=>{this.options.set(a,!1)}),Object.keys(g.items).forEach(f=>{let h=g.items[f].join?g.items[f]:{value:g.items[f]},{value:i,group:a,selected:b,disabled:c,description:d}=h;this.options.add(g.items[f].key||f,i,a,b,c,d)}),this.query(),this.e.nextElementSibling?this.e[f].insertBefore(this.select,this.e.nextElementSibling):this.e[f].appendChild(this.select),g.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._init=!1,this.e[i]("data-tail-select","tail-"+this.id),(g.cbComplete||function(){}).call(this,this.select),g.startOpen?this.open(this.con.animate):this},bind(){return(c.addEventListener("keydown",a=>{let b,c,g,h,i=a.keyCode||a.which;if(!this.select.classList.contains("active")||0>[13,27,38,40].indexOf(i))return!1;if(a.preventDefault(),a.stopPropagation(),13==i&&(b=this.dropdown[d](".dropdown-option.hover:not(.disabled)"))&&this.options.select(b),27==i||13==i)return this.close(this.con.animate);if(b=this.dropdown[d](".dropdown-option.hover:not(.disabled)")){b.classList.remove("hover"),g=[(40==i?"next":"previous")+"ElementSibling"];do{if(b=null!==(h=b[g])&&"LI"==b.tagName?h:!!(null!==(h=b[f][g])&&0<h.children.length&&"UL"==h.tagName)&&h.children[40==i?0:h.children.length-1],b&&(!/dropdown-option/.test(b.className)||/disabled/.test(b.className)))continue;break}while(!0)}if(b||40!=i?!b&&38==i&&(b=this.dropdown[d]("ul:last-child li:not(.disabled):last-child")):b=this.dropdown[d](".dropdown-option:not(.disabled)"),b&&(c=this.dropdown[d](".dropdown-inner"))){let a=function(a){let b={top:a.offsetTop,height:a.offsetHeight};for(;(a=a[f])!=c;)b.top+=a.offsetTop;return b}(b);b.classList.add("hover"),a.top+2*a.height>c.offsetHeight+c.scrollTop?c.scrollBy(0,a.top+2*a.height-(c.offsetHeight+c.scrollTop)):a.top-a.height<c.scrollTop&&c.scrollBy(0,-Math.abs(c.scrollTop-a.top+a.height))}return!0}),c.addEventListener("click",a=>{let b=!this.select.classList.contains("active")||this.select.classList.contains("idle");if(b||this.con.stayOpen)return!1;let c=[this.e,this.select,this.container].filter(b=>b&&(b.contains(a.target)||b==a.target));return 0==c.length&&this.close(this.con.animate)}),!!!this.con.sourceBind)||(this.e.addEventListener("change",()=>{if(null!=event.detail)return!1;if(event.preventDefault(),event.stopPropagation(),!this.multiple&&this.selectedIndex)this.options.select(this.e.options[this.selectedIndex]);else{let a=[].concat(self.options.selected),b=Array.from(this.e[e]("option:checked")).filter(b=>!(0<=a.indexOf(b))||(a.splice(a.indexOf(b),1),!1));this.options.walk("unselect",a),this.options.walk("select",b)}}),!0)},callback(a,b,c){let e=this,f=`[data-key='${a.key}'][data-group='${a.group}']`;if("rebuild"==b)return this.query();let g=this.dropdown[d](f);return g&&0<=["select","disable"].indexOf(b)?g.classList.add("select"==b?"selected":"disabled"):g&&0<=["unselect","enable"].indexOf(b)&&g.classList.remove("unselect"==b?"selected":"disabled"),this.update(a),!!c||this.trigger("change",a,b)},trigger(a){if(this._init)return!1;let b={bubbles:!1,cancelable:!0,detail:{args:arguments,self:this}};"change"==a&&arguments[2]&&0<=arguments[2].indexOf("select")&&(this.e.dispatchEvent(new CustomEvent("input",b)),this.e.dispatchEvent(new CustomEvent("change",b))),this.select.dispatchEvent(new CustomEvent("tail::"+a,b));let c,d=[...arguments];return d.shift(),(this.events[a]||[]).forEach(a=>{c=[].concat(d),c.push(a.args||null),(a.cb||function(){}).apply(this,c)}),!0},calc(){let b=this.dropdown.cloneNode(!0),c=this.con.height,e=0,g=this.dropdown[d](".dropdown-inner");b=this.dropdown.cloneNode(!0),b.style.cssText="height:auto;min-height:auto;max-height:none;opacity:0;display:block;visibility:hidden;",b.style.maxHeight=this.con.height+"px",b.className+=" cloned",this.dropdown[f].appendChild(b),c=c>b.clientHeight?b.clientHeight:c,this.con.search&&(e=b[d](".dropdown-search").clientHeight),this.dropdown[f].removeChild(b);let h=this.select.getBoundingClientRect(),i=a.innerHeight-(h.top+h.height),j=!!(c+e>i)&&h.top>i;return!0===this.con.openAbove||!1!==this.con.openAbove&&j?(j=!0,c=Math.min(c,h.top-10),this.select.classList.add("open-top")):(j=!1,c=Math.min(c,i-10),this.select.classList.remove("open-top")),g&&(this.dropdown.style.maxHeight=c+"px",g.style.maxHeight=c-e+"px"),this},query(a,c){let f,g,j,k,l,m=b("DIV","dropdown-inner"),n=a?"finder":"walker",o=this.con;if("string"==typeof a&&0<a.length)for(let b in o.linguisticRules)l=new RegExp(`(${b}|${o.linguisticRules[b]})`,"ig"),a=a.replace(l,`(${b}|${o.linguisticRules[b]})`);let p=a?[a,c]:[o.sortItems,o.sortGroups];this._query="string"==typeof a&&a;for(let b of this.options[n].apply(this.options,p)){if(!g||g&&g[h]("data-group")!==b.group)if(f=(o.cbLoopGroup||this.cbGroup).call(this,b.group,a,m),f instanceof Element)g=f,g[i]("data-group",b.group),m.appendChild(g);else break;let c=(o.cbLoopItem||this.cbItem).call(this,b,g,a,m);if(null!==c){if(!1===c)break;c[i]("data-key",b.key),c[i]("data-group",b.group),c.addEventListener("click",()=>!!c[h]("data-key")&&void(this.options.toggle(c[h]("data-key"),c[h]("data-group"))&&!o.stayOpen&&!o.multiple&&this.close(this.con.animate))),g.appendChild(c)}}let q=m[e]("*[data-key]").length;if(0==q&&(this.con.cbEmpty||function(a){let c=b("SPAN","dropdown-empty");c.innerText=this._e("empty"),a.appendChild(c)}).call(this,m,a),0<q&&o.multiple&&o.multiLimit==1/0&&o.multiSelectAll){j=b("BUTTON","tail-all"),k=b("BUTTON","tail-none"),j.innerText=this._e("actionAll"),j.addEventListener("click",a=>{a.preventDefault(),this.options.walk("select",this.dropdown.querySelectorAll(".dropdown-inner .dropdown-option"))}),k.innerText=this._e("actionNone"),k.addEventListener("click",a=>{a.preventDefault(),this.options.walk("unselect",this.dropdown.querySelectorAll(".dropdown-inner .dropdown-option"))});let a=b("SPAN","dropdown-action");a.appendChild(j),a.appendChild(k),m.insertBefore(a,m.children[0])}let r=this.dropdown[d](".dropdown-inner");return this.dropdown[(r?"replace":"append")+"Child"](m,r),this.select.classList.contains("active")&&this.calc(),this.updateCSV().updateLabel()},cbGroup(a){let c,d,e=b("UL","dropdown-optgroup"),g=this;return"#"==a?e:(e.innerHTML=`<li class="optgroup-title"><b>${a}</b></li>`,this.con.multiple&&this.con.multiLimit==1/0&&this.con.multiSelectAll&&(c=b("BUTTON","tail-none"),d=b("BUTTON","tail-all"),c.innerText=this._e("none"),c.addEventListener("click",a=>{a.preventDefault(),this.options.all("unselect",a.target[f][f][h]("data-group"))}),d.innerText=this._e("all"),d.addEventListener("click",a=>{a.preventDefault(),this.options.all("select",a.target[f][f][h]("data-group"))}),e.children[0].appendChild(c),e.children[0].appendChild(d)),e)},cbItem(a,c,e){let{value:f,selected:g,disabled:h}=a,d=b("LI","dropdown-option"+(g?" selected":"")+(h?" disabled":""));return e&&0<e.length&&this.con.searchMarked?d.innerHTML=f.replace(new RegExp(`(${e})`,"i"),"<mark>$1</mark>"):d.innerText=f,this.con.descriptions&&a.description&&(d.innerHTML+=`<span class="option-description">${a.description}</span>`),d},update(a){return this.updateLabel().updateContainer(a).updatePin(a).updateCSV(a)},updateLabel(a){if(this.container==this.label&&0<this.options.selected.length)return this.label[d](".label-inner")&&this.label.removeChild(this.label[d](".label-inner")),this.label[d](".label-count")&&this.label.removeChild(this.label[d](".label-count")),this;let b,f=this.con,c=this.options.selected.length;return"string"!=typeof a&&(f.disabled?a="disabled":0==this.dropdown[e]("*[data-key]").length?a="empty"+(this.select.classList.contains("in-search")?"Search":""):f.multiLimit<=c?a="limit":!f.multiple&&0<this.options.selected.length?a=this.options.selected[0].innerText:"string"==typeof f.placeholder?a=f.placeholder:a="placeholder"+(f.multiple&&f.multiLimit<1/0?"Multi":"")),a=this._e(a,{":limit":f.multiLimit},a),a=`<span class="label-inner">${a}</span>`,b=f.multiShowLimit&&f.multiLimit<1/0,f.multiple&&f.multiShowCount&&(a=`<span class="label-count">:c</span>\n${a}`,a=a.replace(":c",c+(b?" / "+f.multiLimit:""))),this.label.innerHTML=a,this},updateContainer(a){if(!this.container||!this.con.multiContainer)return this;let c=`[data-group='${a.group}'][data-key='${a.key}']`;if(this.container[d](c))return a.selected||this.container.removeChild(this.container[d](c)),this;if(a.selected){let c=b("DIV","select-handle");c.innerText=a.value,c[i]("data-key",a.key),c[i]("data-group",a.group),c.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.options.unselect(a.target[h]("data-key"),a.target[h]("data-group"))}),this.container.appendChild(c)}return this},updatePin(a){let b=this.dropdown[d](".dropdown-inner ul");if(!this.con.multiPinSelected||!b||!1!==this._query)return this;if(option=this.dropdown[d](`li[data-key='${a.key}'][data-group='${a.group}']`),a.selected)b.insertBefore(option,b.children[0]);else{let b=this.dropdown[d](`ul[data-group='${a.group}']`),c=this.options[a.index-1],e=!1;for(;c&&c.group==a.group&&!(e=b[d](`li[data-key='${c.key}']`));)c=this.options[c.index-1];e&&e.nextElementSibling?b.insertBefore(option,e.nextElementSibling):b.appendChild(option)}return this},updateCSV(){if(!this.csvInput||!this.con.csvOutput)return this;let a=this.options.selected.map(a=>a.value);return this.csvInput.value=a.join(this.con.csvSeparator||","),this},open(a){if(/active|idle/.test(this.select.className)||this.con.disabled)return!1;this.calc();let b=function(){this.select.classList.add("active"),this.select.classList.remove("idle"),this.dropdown.style.height="auto",this.dropdown.style.overflow="visible",this.label[j]("style"),this.con.search&&this.con.searchFocus&&this.dropdown[d]("input").focus(),this.trigger.call(this,"open")},c=this,f=this.dropdown.style;if(this.con.animate&&!1!==a){this.label.style.zIndex=25,this.dropdown.style.cssText+="height:0;display:block;overflow:hidden;",this.select.classList.add("idle");let a=()=>{let d=parseInt(f.height,10),e=parseInt(f.maxHeight,10);return d>=e?b.call(c):void(f.height=(d+50>e?e:d+50)+"px",setTimeout(a,20))};a()}else f.cssText=`height:${f.maxHeight};display:block;overflow:hidden;`,b.call(this);return this},close(a){if(!this.select.classList.contains("active")||this.select.classList.contains("idle"))return!1;let b=function(){this.select.classList.remove("idle","active"),this.dropdown[j]("style"),this.dropdown[d](".dropdown-inner")[j]("style"),this.trigger.call(this,"close")},c=this,f=this.dropdown;if(this.con.animate&&!1!==a){this.select.classList.add("idle"),this.dropdown.style.overflow="hidden";let a=()=>0>=parseInt(f.offsetHeight,10)-50?b.call(c):void(f.style.height=parseInt(f.offsetHeight,10)-50+"px",setTimeout(a,20));a()}else b.call(this);return this},toggle(a){return this.select.classList.contains("active")?this.close(a):this.select.classList.contains("idle")?this:this.open(a)},remove(){return this.e[j]("data-tail-select"),this.e[g]("data-select-hidden")&&("0"==this.e[h]("data-select-hidden")&&this.e.style.removeProperty("display"),this.e[j]("data-select-hidden")),Array.from(this.e[e]("[data-select-option='add']"),a=>{a.parentElement.removeChild(a)}),Array.from(this.e[e]("[data-select-optgroup='add']"),a=>{a.parentElement.removeChild(a)}),this.e.name=this.csvInput.hasAttribute("name")?this.csvInput.name:this.e.name,this.select[f].removeChild(this.select),this.container&&Array.from(this.container[e](".select-handle"),a=>{a.parentElement.removeChild(a)}),this},reload(){return this.remove().init()},config(a,b){if(a instanceof Object){for(let b in a)this.config(b,a[b],!1);return this.reload()?this.con:this.con}return"undefined"==typeof a?this.con:!!(a in this.con)&&("undefined"==typeof b?this.con[a]:(this.con[a]=b,!1!==this.rebuild&&this.reload(),this))},enable(a){return this.select.classList.remove("disabled"),this.e.disabled=!1,this.con.disabled=!1,!1===a?this:this.reload()},disable(a){return this.select.classList.add("disabled"),this.e.disabled=!0,this.con.disabled=!0,!1===a?this:this.reload()},on(a,b,c){return!(0>["open","close","change"].indexOf(a)||"function"!=typeof b)&&(a in this.events||(this.events[a]=[]),this.events[a].push({cb:b,args:c instanceof Array?c:[]}),this)}},k=l.options=function(a,b){return this instanceof k?(this.self=b,this.element=a,this.length=0,this.selected=[],this.disabled=[],this.items={"#":{}},this.groups={},this):new k(a,b)},k.prototype={_r(a){return a.replace("disabled","disable").replace("enabled","enable").replace("selected","select").replace("unselected","unselect")},get(a,b){if("object"==typeof a&&a.key&&a.group)b=a.group||b,a=a.key;else if(a instanceof Element)"OPTION"==a.tagName?(b=a[f].label||"#",a=a.value||a.innerText):a[g]("data-key")&&(b=a[h]("data-group")||a[f][h]("data-group")||"#",a=a[h]("data-key"));else if("string"!=typeof a)return!1;return a=/^[0-9]+$/.test(a)?"_"+a:a,!!(b in this.items)&&this.items[b][a]},set(a,c){let d=a.value||a.innerText,e=a[f].label||"#";if(e in this.items||(this.items[e]={},this.groups[e]=a[f]),d in this.items[e])return!1;let j=/^[0-9]+$/.test(d)?"_"+d:d,k=this.self.con,l=!k.multiple&&0<this.selected.length;if((l||k.multiple&&this.selected.length>=k.multiLimit)&&(a.selected=!1),a.selected&&k.deselect&&(!a[g]("selected")||0==k.multiLimit)&&(a.selected=!1,a.parentElement.selectedIndex=-1),a[g]("data-description")){let c=b("SPAN");c.innerHTML=a[h]("data-description"),a[i]("data-description",c.innerHTML)}return this.items[e][j]={key:d,value:a.text,description:a[h]("data-description")||null,group:e,option:a,optgroup:"#"==e?void 0:this.groups[e],selected:a.selected,disabled:a.disabled},this.length++,a.selected&&this.select(this.items[e][j]),a.disabled&&this.disable(this.items[e][j]),!c||this.self.callback(this[this.length-1],"rebuild")},add(f,g,h,j,k,l,m){if(f instanceof Object){for(let g in f){let{value:h,group:a,selected:b,disabled:c,description:d}=f[g];this.add(f[g].key||g,h,a,b,c,d,!1)}return this.self.query()}if(this.get(f,h))return!1;if(h="string"==typeof h?h:"#","#"!==h&&!(h in this.groups)){let a=b("OPTGROUP");a.label=h,a[i]("data-select-optgroup","add"),this.element.appendChild(a),this.items[h]={},this.groups[h]=a}let n=this.self.con,o=!n.multiple&&0<this.selected.length;(o||n.multiple&&this.selected.length>=n.multiLimit)&&(j=!1),k=!!k;let a=c.createElement("OPTION");return a.value=f,a.selected=j,a.disabled=k,a.innerText=g,a[i]("data-select-option","add"),l&&0<l.length&&a[i]("data-description",l),("#"==h?this.element:this.groups[h]).appendChild(a),this.set(a,m)},move(a,c,d,e){if(!(a=this.get(a,c)))return!1;if("#"!==d&&!(d in this.groups)){let c=b("OPTGROUP");c.label=d,this.element.appendChild(c),this.items[d]={},this.groups[d]=c,this.groups[d].appendChild(a.option)}return delete this.items[a.group][a.key],a.group=d,a.optgroup=this.groups[d]||void 0,this.items[d][a.key]=a,!e||this.self.query()},remove(a,b,c){if(!(a=this.get(a,b)))return!1;a.selected&&this.unselect(a),a.disabled&&this.enable(a),a.option[f].removeChild(a.option);let d=/^[0-9]+$/.test(a.key)?"_"+a.key:a.key;return delete this.items[a.group][d],this.length--,0===Object.keys(this.items[a.group]).length&&(delete this.items[a.group],delete this.groups[a.group]),!c||this.self.query()},is(a,b,c){return(a=this._r(a),b=this.get(b,c),!b||0>["select","unselect","disable","enable"].indexOf(a))?null:"disable"==a||"enable"==a?"disable"==a?b.disabled:!b.disabled:("select"==a||"unselect"==a)&&("select"==a?b.selected:!b.selected)},handle(a,b,c,d){if(a=this._r(a),b=this.get(b,c),!b||0>["select","unselect","disable","enable"].indexOf(a))return null;if("disable"==a||"enable"==a)return b.option in this.disabled||"disable"!=a?b.option in this.disabled&&"enable"==a&&this.disabled.splice(this.disabled.indexOf(b.option),1):this.disabled.push(b.option),b.disabled="disable"==a,b.option.disabled="disable"==a,this.self.callback.call(this.self,b,a);let e=this.self.select.classList.contains("disabled")||b.disabled||b.option.disabled,f=this.self.con.multiple&&this.self.con.multiLimit<=this.selected.length,g=!this.self.con.multiple&&0<this.selected.indexOf(b.option),h=0==this.self.con.multiLimit&&!0==this.self.con.deselect,i=!this.self.con.multiple&&!this.self.con.deselect&&!0!==d;if("select"==a){if(e||f||h||g)return!1;if(!this.self.con.multiple)for(let a in this.selected)this.unselect(this.selected[a],void 0,!0);0>this.selected.indexOf(b.option)&&this.selected.push(b.option)}else if("unselect"==a){if(e||i)return!1;this.selected.splice(this.selected.indexOf(b.option),1)}return b.selected="select"==a,b.option.selected="select"==a,b.option[(6<a.length?"remove":"set")+"Attribute"]("selected","selected"),this.self.callback.call(this.self,b,a)},enable(a,b){return this.handle("enable",a,b)},disable(a,b){return this.handle("disable",a,b)},select(a,b){return this.handle("select",a,b)},unselect(a,b,c){return this.handle("unselect",a,b,c)},toggle(a,b){return!!(a=this.get(a,b))&&this.handle(a.selected?"unselect":"select",a,b)},invert(a){if(a=this._replaceType(a),0<=["enable","disable"].indexOf(a)){let b=this.disabled,c="enable"==a?"disable":"enable"}else if(0<=["select","unselect"].indexOf(a)){let b=this.selected,c="select"==a?"unselect":"select"}let b=Array.from(this).filter(a=>{!(a in invert)});return[].concat(invert).forEach(a=>{this.handle(action,a)}),[].concat(b).forEach(b=>{this.handle(a,b)}),!0},all(a,b){let c=this;return b in this.items?c=Object.keys(this.items[b]):0<=["unselect","enable"].indexOf(a)&&(c="unselect"==a?this.selected:this.disabled),[].concat(Array.from(c)).forEach(c=>{this.handle(a,c,b)}),!0},walk(a,b,c){if(b instanceof Array||b.length)for(let d=b.length,e=0;e<d;e++)this.handle.apply(this,[a,b[e],null].concat(c));else if(b instanceof Object)if(b.forEach)b.forEach(()=>{this.handle.apply(this,[a,value,null].concat(c))});else for(let d in b)("string"==typeof b[d]||"number"==typeof b[d]||b[d]instanceof Element)&&this.handle.apply(this,[a,b[d],d in this.items?d:null]).concat(c);return this},find(a,b){let c=new RegExp(a,"im"),d=[],e=a=>c.test(a.text||a.value),f=a=>c.test(a.text)||c.test(a.value)||0<Array.apply(null,a.attributes).filter(e.length);return Array.apply(null,this.self.e.options).map(a=>("any"==b?!!f(a):!!e(a))&&(!(0<=this.disabled.indexOf(a))||this.self.con.searchDisabled)&&void d.push(this.get(a))),d},*finder(a,b){for(let c,d=this.find(a,b);void 0!==(c=d.shift());)yield c},*walker(a,b){let c=Object.keys(this.groups);"ASC"==b?c.sort():"DESC"==b?c.sort().reverse():"function"==typeof b&&(c=b.call(this,c)),c.unshift("#");for(let d,e,f=c.length,g=0;g<f&&(d=c[g],!!(d in this.items));g++){e=Object.keys(this.items[d]),"ASC"==a?e.sort():"DESC"==a?e.sort().reverse():"function"==typeof a&&(e=a.call(this,e));for(let a=e.length,b=0;b<a;b++)yield this.items[d][e[b]]}}},{select:l,options:k}}(window||this);export{select,options};

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -124,3 +124,3 @@ | @website https://github.com/pytesNET/tail.select

}, tailOptions;
tailSelect.version = "0.5.8";
tailSelect.version = "0.5.9";
tailSelect.status = "beta";

@@ -146,2 +146,5 @@ tailSelect.count = 0;

locale: "en",
linguisticRules: {
"ё": "е"
},
multiple: false,

@@ -204,2 +207,15 @@ multiLimit: Infinity,

},
es: {
all: "Todos",
none: "Ninguno",
actionAll: "Seleccionar todo",
actionNone: "Descartar todo",
empty: "No hay opciones disponibles",
emptySearch: "No se encontraron opciones",
limit: "No puedes seleccionar mas opciones",
placeholder: "Selecciona una opción...",
placeholderMulti: "Selecciona hasta :límite de opciones...",
search: "Escribe dentro para buscar...",
disabled: "Este campo esta deshabilitado"
},
fr: {

@@ -605,9 +621,17 @@ all: "Tous",

| API :: QUERY OPTIONS
| @version 0.5.8 [0.5.0]
| @version 0.5.9 [0.5.0]
*/
query: function(search, conf){
var root = create("DIV", "dropdown-inner"), self = this, item, tp, ul, li, a1, a2,
func = search? "finder": "walker", con = this.con, g = "getAttribute",
args = search? [search, conf]: [con.sortItems, con.sortGroups];
func = search? "finder": "walker", con = this.con, g = "getAttribute";
// Format Search
if(typeof(search) === "string" && search.length > 0){
for(var key in con.linguisticRules){
var re = new RegExp("(" + key + "|" + con.linguisticRules[key] + ")", "ig");
search = search.replace(re, "(" + key + "|" + con.linguisticRules[key] + ")");
}
}
var args = search? [search, conf]: [con.sortItems, con.sortGroups];
// Option Walker

@@ -614,0 +638,0 @@ this._query = (typeof(search) == "string")? search: false;

@@ -1,2 +0,2 @@

/* pytesNET/tail.select v.0.5.8 | Full Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
!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.8",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={de:{all:"Alle",none:"Keine",actionAll:"Alle auswählen",actionNone:"Alle abwählen",empty:"Keine Optionen verfügbar",emptySearch:"Keine Optionen gefunden",limit:"Keine weiteren Optionen wählbar",placeholder:"Wähle eine Option...",placeholderMulti:"Wähle bis zu :limit Optionen...",search:"Tippen zum suchen",disabled:"Dieses Feld ist deaktiviert"},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"},fr:{all:"Tous",none:"Aucun",actionAll:"Sélectionner tout",actionNone:"Sélectionner aucun",empty:"Aucune option disponible",emptySearch:"Aucune option trouvée",limit:"Aucune autre option sélectionnable",placeholder:"Choisissez une option ...",placeholderMulti:"Choisissez jusqu'à :limit option(s) ...",search:"Rechercher ...",disabled:"Ce champs est désactivé"},pt_BR:{all:"Todas",none:"Nenhuma",actionAll:"Selecionar todas",actionNone:"Desmarcar todas",empty:"Nenhuma opção disponível",emptySearch:"Nenhuma opção encontrada",limit:"Não é possível selecionar outra opção",placeholder:"Escolha uma opção ...",placeholderMulti:"Escolha até: :limit opção(ões) ...",search:"Buscar ...",disabled:"Campo desativado"},ru:{all:"Все",none:"Ничего",actionAll:"Выбрать все",actionNone:"Отменить все",empty:"Нет доступных вариантов",emptySearch:"Ничего не найдено",limit:"Вы не можете выбрать больше вариантов",placeholder:"Выберите вариант...",placeholderMulti:function(e){var t=e[":limit"];return"Выбор до :limit "+["варианта","вариантов","вариантов"][4<t%100&&t%100<20?2:[2,0,1,1,1,2][t%10<5?t%10:5]]+" ..."},search:"Начните набирать для поиска ...",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={_e:function(e,t,i){if(!(e in this.__))return i||e;if("function"==typeof(e=this.__[e])&&(e=e.call(this,t)),"object"==typeof t)for(var n in t)e=e.replace(n,t[n]);return e},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.__=h(p.strings.en,p.strings[i.locale]||{}),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._e("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._e("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._e("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._e("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._e("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._e("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,{":limit":i.multiLimit},e))+"</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("string"!=typeof e)return!1;return e=/^[0-9]+$/.test(e)?"_"+e:e,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=/^[0-9]+$/.test(i)?"_"+i:i,l=this.self.con;if((!l.multiple&&0<this.selected.length||l.multiple&&this.selected.length>=l.multiLimit)&&(e.selected=!1),!e.selected||!l.deselect||e.hasAttribute("selected")&&0!=l.multiLimit||(e.selected=!1,e.parentElement.selectedIndex=-1),e.hasAttribute("data-description")){var o=g("SPAN");o.innerHTML=e.getAttribute("data-description"),e.setAttribute("data-description",o.innerHTML)}return this.items[n][s]={key:i,value:e.text,description:e.getAttribute("data-description")||null,group:n,option:e,optgroup:"#"!=n?this.groups[n]:void 0,selected:e.selected,disabled:e.disabled},this.length++,e.selected&&this.select(this.items[n][s]),e.disabled&&this.disable(this.items[n][s]),!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){if(!(e=this.get(e,t)))return!1;e.selected&&this.unselect(e),e.disabled&&this.enable(e),e.option.parentElement.removeChild(e.option);var n=/^[0-9]+$/.test(e.key)?"_"+e.key:e.key;return delete this.items[e.group][n],this.length--,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();if(!(n in this.items))return!1;var 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});
/* pytesNET/tail.select v.0.5.9 | Full Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
!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 v(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 y(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.9",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",linguisticRules:{"ё":"е"},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={de:{all:"Alle",none:"Keine",actionAll:"Alle auswählen",actionNone:"Alle abwählen",empty:"Keine Optionen verfügbar",emptySearch:"Keine Optionen gefunden",limit:"Keine weiteren Optionen wählbar",placeholder:"Wähle eine Option...",placeholderMulti:"Wähle bis zu :limit Optionen...",search:"Tippen zum suchen",disabled:"Dieses Feld ist deaktiviert"},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"},es:{all:"Todos",none:"Ninguno",actionAll:"Seleccionar todo",actionNone:"Descartar todo",empty:"No hay opciones disponibles",emptySearch:"No se encontraron opciones",limit:"No puedes seleccionar mas opciones",placeholder:"Selecciona una opción...",placeholderMulti:"Selecciona hasta :límite de opciones...",search:"Escribe dentro para buscar...",disabled:"Este campo esta deshabilitado"},fr:{all:"Tous",none:"Aucun",actionAll:"Sélectionner tout",actionNone:"Sélectionner aucun",empty:"Aucune option disponible",emptySearch:"Aucune option trouvée",limit:"Aucune autre option sélectionnable",placeholder:"Choisissez une option ...",placeholderMulti:"Choisissez jusqu'à :limit option(s) ...",search:"Rechercher ...",disabled:"Ce champs est désactivé"},pt_BR:{all:"Todas",none:"Nenhuma",actionAll:"Selecionar todas",actionNone:"Desmarcar todas",empty:"Nenhuma opção disponível",emptySearch:"Nenhuma opção encontrada",limit:"Não é possível selecionar outra opção",placeholder:"Escolha uma opção ...",placeholderMulti:"Escolha até: :limit opção(ões) ...",search:"Buscar ...",disabled:"Campo desativado"},ru:{all:"Все",none:"Ничего",actionAll:"Выбрать все",actionNone:"Отменить все",empty:"Нет доступных вариантов",emptySearch:"Ничего не найдено",limit:"Вы не можете выбрать больше вариантов",placeholder:"Выберите вариант...",placeholderMulti:function(e){var t=e[":limit"];return"Выбор до :limit "+["варианта","вариантов","вариантов"][4<t%100&&t%100<20?2:[2,0,1,1,1,2][t%10<5?t%10:5]]+" ..."},search:"Начните набирать для поиска ...",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={_e:function(e,t,i){if(!(e in this.__))return i||e;if("function"==typeof(e=this.__[e])&&(e=e.call(this,t)),"object"==typeof t)for(var n in t)e=e.replace(n,t[n]);return e},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.__=h(p.strings.en,p.strings[i.locale]||{}),this._init=!0,this._query=!1,this.select=y("DIV",e),this.label=y("DIV","select-label"),this.dropdown=y("DIV","select-dropdown"),this.search=y("DIV","dropdown-search"),this.csvInput=y("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._e("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(!v(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])&&(!v(t,"dropdown-option")||v(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(!v(r.select,"active")||v(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=y("DIV","dropdown-inner"),c=this,h=e?"finder":"walker",d=this.con,u="getAttribute";if("string"==typeof e&&0<e.length)for(var p in d.linguisticRules){var f=new RegExp("("+p+"|"+d.linguisticRules[p]+")","ig");e=e.replace(f,"("+p+"|"+d.linguisticRules[p]+")")}var m=e?[e,t]:[d.sortItems,d.sortGroups];for(this._query="string"==typeof e&&e;i=this.options[h].apply(this.options,m);){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 b=a.querySelectorAll("*[data-key]").length;0==b&&(this.con.cbEmpty||function(e){var t=y("SPAN","dropdown-empty");t.innerText=this._e("empty"),e.appendChild(t)}).call(this,a,e),0<b&&d.multiple&&d.multiLimit==1/0&&d.multiSelectAll&&(o=y("BUTTON","tail-all"),r=y("BUTTON","tail-none"),o.innerText=this._e("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._e("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=y("SPAN","dropdown-action")).appendChild(o),l.appendChild(r),a.insertBefore(l,a.children[0]));var g=this.dropdown.querySelector(".dropdown-inner");return this.dropdown[(g?"replace":"append")+"Child"](a,g),v(this.select,"active")&&this.calc(),this.updateCSV().updateLabel()},cbGroup:function(e,t){var i,n,s=y("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=y("BUTTON","tail-none"),n=y("BUTTON","tail-all"),i.innerText=this._e("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._e("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=y("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"+(v(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,{":limit":i.multiLimit},e))+"</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=y("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(v(this.select,"active")||v(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(!v(this.select,"active")||v(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 v(this.select,"active")?this.close(e):v(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("string"!=typeof e)return!1;return e=/^[0-9]+$/.test(e)?"_"+e:e,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=/^[0-9]+$/.test(i)?"_"+i:i,l=this.self.con;if((!l.multiple&&0<this.selected.length||l.multiple&&this.selected.length>=l.multiLimit)&&(e.selected=!1),!e.selected||!l.deselect||e.hasAttribute("selected")&&0!=l.multiLimit||(e.selected=!1,e.parentElement.selectedIndex=-1),e.hasAttribute("data-description")){var o=y("SPAN");o.innerHTML=e.getAttribute("data-description"),e.setAttribute("data-description",o.innerHTML)}return this.items[n][s]={key:i,value:e.text,description:e.getAttribute("data-description")||null,group:n,option:e,optgroup:"#"!=n?this.groups[n]:void 0,selected:e.selected,disabled:e.disabled},this.length++,e.selected&&this.select(this.items[n][s]),e.disabled&&this.disable(this.items[n][s]),!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=y("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=y("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){if(!(e=this.get(e,t)))return!1;e.selected&&this.unselect(e),e.disabled&&this.enable(e),e.option.parentElement.removeChild(e.option);var n=/^[0-9]+$/.test(e.key)?"_"+e.key:e.key;return delete this.items[e.group][n],this.length--,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=v(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();if(!(n in this.items))return!1;var 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});

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -124,3 +124,3 @@ | @website https://github.com/pytesNET/tail.select

}, tailOptions;
tailSelect.version = "0.5.8";
tailSelect.version = "0.5.9";
tailSelect.status = "beta";

@@ -146,2 +146,5 @@ tailSelect.count = 0;

locale: "en",
linguisticRules: {
"ё": "е"
},
multiple: false,

@@ -548,9 +551,17 @@ multiLimit: Infinity,

| API :: QUERY OPTIONS
| @version 0.5.8 [0.5.0]
| @version 0.5.9 [0.5.0]
*/
query: function(search, conf){
var root = create("DIV", "dropdown-inner"), self = this, item, tp, ul, li, a1, a2,
func = search? "finder": "walker", con = this.con, g = "getAttribute",
args = search? [search, conf]: [con.sortItems, con.sortGroups];
func = search? "finder": "walker", con = this.con, g = "getAttribute";
// Format Search
if(typeof(search) === "string" && search.length > 0){
for(var key in con.linguisticRules){
var re = new RegExp("(" + key + "|" + con.linguisticRules[key] + ")", "ig");
search = search.replace(re, "(" + key + "|" + con.linguisticRules[key] + ")");
}
}
var args = search? [search, conf]: [con.sortItems, con.sortGroups];
// Option Walker

@@ -557,0 +568,0 @@ this._query = (typeof(search) == "string")? search: false;

@@ -1,2 +0,2 @@

/* pytesNET/tail.select v.0.5.8 | Basic Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
!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.8",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={_e:function(e,t,i){if(!(e in this.__))return i||e;if("function"==typeof(e=this.__[e])&&(e=e.call(this,t)),"object"==typeof t)for(var n in t)e=e.replace(n,t[n]);return e},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.__=h(p.strings.en,p.strings[i.locale]||{}),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._e("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._e("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._e("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._e("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._e("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._e("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,{":limit":i.multiLimit},e))+"</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("string"!=typeof e)return!1;return e=/^[0-9]+$/.test(e)?"_"+e:e,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=/^[0-9]+$/.test(i)?"_"+i:i,l=this.self.con;if((!l.multiple&&0<this.selected.length||l.multiple&&this.selected.length>=l.multiLimit)&&(e.selected=!1),!e.selected||!l.deselect||e.hasAttribute("selected")&&0!=l.multiLimit||(e.selected=!1,e.parentElement.selectedIndex=-1),e.hasAttribute("data-description")){var o=g("SPAN");o.innerHTML=e.getAttribute("data-description"),e.setAttribute("data-description",o.innerHTML)}return this.items[n][s]={key:i,value:e.text,description:e.getAttribute("data-description")||null,group:n,option:e,optgroup:"#"!=n?this.groups[n]:void 0,selected:e.selected,disabled:e.disabled},this.length++,e.selected&&this.select(this.items[n][s]),e.disabled&&this.disable(this.items[n][s]),!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){if(!(e=this.get(e,t)))return!1;e.selected&&this.unselect(e),e.disabled&&this.enable(e),e.option.parentElement.removeChild(e.option);var n=/^[0-9]+$/.test(e.key)?"_"+e.key:e.key;return delete this.items[e.group][n],this.length--,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();if(!(n in this.items))return!1;var 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});
/* pytesNET/tail.select v.0.5.9 | Basic Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
!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 o=e,d=e.document;function v(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 y(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 r=e.getAttribute("placeholder")||e.getAttribute("data-placeholder"),o="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=r||t.placeholder||null,t.width="auto"===t.width?e.offsetWidth+50:t.width,t.sourceBind=o in t?t[o]: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.9",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",linguisticRules:{"ё":"е"},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={_e:function(e,t,i){if(!(e in this.__))return i||e;if("function"==typeof(e=this.__[e])&&(e=e.call(this,t)),"object"==typeof t)for(var n in t)e=e.replace(n,t[n]);return e},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.__=h(p.strings.en,p.strings[i.locale]||{}),this._init=!0,this._query=!1,this.select=y("DIV",e),this.label=y("DIV","select-label"),this.dropdown=y("DIV","select-dropdown"),this.search=y("DIV","dropdown-search"),this.csvInput=y("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._e("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 r in i.items)"string"==typeof i.items[r]&&(i.items[r]={value:i.items[r]}),this.options.add(i.items[r].key||r,i.items[r].value,i.items[r].group,i.items[r].selected,i.items[r].disabled,i.items[r].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 o=this;return d.addEventListener("keydown",function(e){var t,i,n,s,l=e.keyCode||e.which;if(!v(o.select,"active")||[13,27,38,40].indexOf(l)<0)return!1;if(e.preventDefault(),e.stopPropagation(),13==l&&(t=o.dropdown.querySelector(".dropdown-option.hover:not(.disabled)"))&&o.options.select.call(o.options,t),27==l||13==l)return o.close(o.con.animate);if(t=o.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])&&(!v(t,"dropdown-option")||v(t,"disabled")););if(t||40!=l?t||38!=l||(t=o.dropdown.querySelector("ul:last-child li:not(.disabled):last-child")):t=o.dropdown.querySelector(".dropdown-option:not(.disabled)"),t&&(i=o.dropdown.querySelector(".dropdown-inner"))){var r=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"),r.top+2*r.height>i.offsetHeight+i.scrollTop?i.scrollBy(0,r.top+2*r.height-(i.offsetHeight+i.scrollTop)):r.top-r.height<i.scrollTop&&i.scrollBy(0,-Math.abs(i.scrollTop-r.top+r.height))}return!0}),d.addEventListener("click",function(e){if(!v(o.select,"active")||v(o.select,"idle"))return!1;if(!0===o.con.stayOpen)return!1;for(var t=[o.e,o.select,o.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 o.close.call(o,o.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)o.options.select.call(o.options,this.options[this.selectedIndex]);else{var t=[].concat(o.options.selected),i=[].filter.call(this.querySelectorAll("option:checked"),function(e){return!(0<=t.indexOf(e))||(t.splice(t.indexOf(e),1),!1)});o.options.walk.call(o.options,"unselect",t),o.options.walk.call(o.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=o.innerHeight-(s.top+s.height),r=l<t+i&&s.top>l;return!0===this.con.openAbove||!1!==this.con.openAbove&&r?(r=!0,t=Math.min(t,s.top-10),a(this.select,"open-top")):(r=!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,r,o,a=y("DIV","dropdown-inner"),c=this,h=e?"finder":"walker",d=this.con,u="getAttribute";if("string"==typeof e&&0<e.length)for(var p in d.linguisticRules){var f=new RegExp("("+p+"|"+d.linguisticRules[p]+")","ig");e=e.replace(f,"("+p+"|"+d.linguisticRules[p]+")")}var m=e?[e,t]:[d.sortItems,d.sortGroups];for(this._query="string"==typeof e&&e;i=this.options[h].apply(this.options,m);){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 b=a.querySelectorAll("*[data-key]").length;0==b&&(this.con.cbEmpty||function(e){var t=y("SPAN","dropdown-empty");t.innerText=this._e("empty"),e.appendChild(t)}).call(this,a,e),0<b&&d.multiple&&d.multiLimit==1/0&&d.multiSelectAll&&(r=y("BUTTON","tail-all"),o=y("BUTTON","tail-none"),r.innerText=this._e("actionAll"),r.addEventListener("click",function(e){e.preventDefault();var t=c.dropdown.querySelectorAll(".dropdown-inner .dropdown-option");c.options.walk.call(c.options,"select",t)}),o.innerText=this._e("actionNone"),o.addEventListener("click",function(e){e.preventDefault();var t=c.dropdown.querySelectorAll(".dropdown-inner .dropdown-option");c.options.walk.call(c.options,"unselect",t)}),(l=y("SPAN","dropdown-action")).appendChild(r),l.appendChild(o),a.insertBefore(l,a.children[0]));var g=this.dropdown.querySelector(".dropdown-inner");return this.dropdown[(g?"replace":"append")+"Child"](a,g),v(this.select,"active")&&this.calc(),this.updateCSV().updateLabel()},cbGroup:function(e,t){var i,n,s=y("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=y("BUTTON","tail-none"),n=y("BUTTON","tail-all"),i.innerText=this._e("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._e("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=y("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"+(v(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,{":limit":i.multiLimit},e))+"</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=y("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(v(this.select,"active")||v(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(!v(this.select,"active")||v(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 v(this.select,"active")?this.close(e):v(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("string"!=typeof e)return!1;return e=/^[0-9]+$/.test(e)?"_"+e:e,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=/^[0-9]+$/.test(i)?"_"+i:i,l=this.self.con;if((!l.multiple&&0<this.selected.length||l.multiple&&this.selected.length>=l.multiLimit)&&(e.selected=!1),!e.selected||!l.deselect||e.hasAttribute("selected")&&0!=l.multiLimit||(e.selected=!1,e.parentElement.selectedIndex=-1),e.hasAttribute("data-description")){var r=y("SPAN");r.innerHTML=e.getAttribute("data-description"),e.setAttribute("data-description",r.innerHTML)}return this.items[n][s]={key:i,value:e.text,description:e.getAttribute("data-description")||null,group:n,option:e,optgroup:"#"!=n?this.groups[n]:void 0,selected:e.selected,disabled:e.disabled},this.length++,e.selected&&this.select(this.items[n][s]),e.disabled&&this.disable(this.items[n][s]),!t||this.self.callback(this[this.length-1],"rebuild")},add:function(e,t,i,n,s,l,r){if(e instanceof Object){for(var o in e)this.add(e[o].key||o,e[o].value,e[o].group,e[o].selected,e[o].disabled,e[o].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=y("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,r)},move:function(e,t,i,n){if(!(e=this.get(e,t)))return!1;if("#"!==i&&!(i in this.groups)){var s=y("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){if(!(e=this.get(e,t)))return!1;e.selected&&this.unselect(e),e.disabled&&this.enable(e),e.option.parentElement.removeChild(e.option);var n=/^[0-9]+$/.test(e.key)?"_"+e.key:e.key;return delete this.items[e.group][n],this.length--,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=v(this.self.select,"disabled")||s.disabled||s.option.disabled,r=this.self.con.multiple&&this.self.con.multiLimit<=this.selected.length,o=!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||r||a||o)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 r in e)("string"==typeof e[r]||"number"==typeof e[r]||e[r]instanceof Element)&&this.handle.apply(this,[t,e[r],r in this.items?r:null]).concat(i)}return this},find:function(e,i){var n=new RegExp(e,"im"),s=[],l=this,r=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(r).length):r(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();if(!(n in this.items))return!1;var 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});

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -36,2 +36,25 @@ | @website https://github.com/pytesNET/tail.select

});
/*
| Translator: elPesecillo - (https://github.com/elPesecillo)
| GitHub: https://github.com/pytesNET/tail.select/issues/41
*/
select.strings.register("es", {
all: "Todos",
none: "Ninguno",
actionAll: "Seleccionar todo",
actionNone: "Descartar todo",
empty: "No hay opciones disponibles",
emptySearch: "No se encontraron opciones",
limit: "No puedes seleccionar mas opciones",
placeholder: "Selecciona una opción...",
placeholderMulti: "Selecciona hasta :límite de opciones...",
search: "Escribe dentro para buscar...",
disabled: "Este campo esta deshabilitado"
});
/*
| Translator: Anthony Rabine - (https://github.com/arabine)
| GitHub: https://github.com/pytesNET/tail.select/issues/11
*/
select.strings.register("fr", {

@@ -50,2 +73,7 @@ all: "Tous",

});
/*
| Translator: Anthony Rabine - (https://github.com/arabine)
| GitHub: https://github.com/pytesNET/tail.select/issues/11
*/
select.strings.register("pt_BR", {

@@ -64,2 +92,7 @@ all: "Todas",

});
/*
| Translator: Roman Yepanchenko - (https://github.com/tizis)
| GitHub: https://github.com/pytesNET/tail.select/issues/38
*/
select.strings.register("ru", {

@@ -66,0 +99,0 @@ all: "Все",

@@ -1,2 +0,2 @@

/* pytesNET/tail.select v.0.5.8 | Language Package | <@author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
!function(i){"function"==typeof define&&define.amd?define(function(){return function(e){i(e)}}):void 0!==window.tail&&window.tail.select&&i(window.tail.select)}(function(e){return e.strings.register("de",{all:"Alle",none:"Keine",actionAll:"Alle auswählen",actionNone:"Alle abwählen",empty:"Keine Optionen verfügbar",emptySearch:"Keine Optionen gefunden",limit:"Keine weiteren Optionen wählbar",placeholder:"Wähle eine Option...",placeholderMulti:"Wähle bis zu :limit Optionen...",search:"Tippen zum suchen",disabled:"Dieses Feld ist deaktiviert"}),e.strings.register("fr",{all:"Tous",none:"Aucun",actionAll:"Sélectionner tout",actionNone:"Sélectionner aucun",empty:"Aucune option disponible",emptySearch:"Aucune option trouvée",limit:"Aucune autre option sélectionnable",placeholder:"Choisissez une option ...",placeholderMulti:"Choisissez jusqu'à :limit option(s) ...",search:"Rechercher ...",disabled:"Ce champs est désactivé"}),e.strings.register("pt_BR",{all:"Todas",none:"Nenhuma",actionAll:"Selecionar todas",actionNone:"Desmarcar todas",empty:"Nenhuma opção disponível",emptySearch:"Nenhuma opção encontrada",limit:"Não é possível selecionar outra opção",placeholder:"Escolha uma opção ...",placeholderMulti:"Escolha até: :limit opção(ões) ...",search:"Buscar ...",disabled:"Campo desativado"}),e.strings.register("ru",{all:"Все",none:"Ничего",actionAll:"Выбрать все",actionNone:"Отменить все",empty:"Нет доступных вариантов",emptySearch:"Ничего не найдено",limit:"Вы не можете выбрать больше вариантов",placeholder:"Выберите вариант...",placeholderMulti:function(e){var i=e[":limit"];return"Выбор до :limit "+["варианта","вариантов","вариантов"][4<i%100&&i%100<20?2:[2,0,1,1,1,2][i%10<5?i%10:5]]+" ..."},search:"Начните набирать для поиска ...",disabled:"Поле отключено"}),e});
/* pytesNET/tail.select v.0.5.9 | Language Package | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */
!function(i){"function"==typeof define&&define.amd?define(function(){return function(e){i(e)}}):void 0!==window.tail&&window.tail.select&&i(window.tail.select)}(function(e){return e.strings.register("de",{all:"Alle",none:"Keine",actionAll:"Alle auswählen",actionNone:"Alle abwählen",empty:"Keine Optionen verfügbar",emptySearch:"Keine Optionen gefunden",limit:"Keine weiteren Optionen wählbar",placeholder:"Wähle eine Option...",placeholderMulti:"Wähle bis zu :limit Optionen...",search:"Tippen zum suchen",disabled:"Dieses Feld ist deaktiviert"}),e.strings.register("es",{all:"Todos",none:"Ninguno",actionAll:"Seleccionar todo",actionNone:"Descartar todo",empty:"No hay opciones disponibles",emptySearch:"No se encontraron opciones",limit:"No puedes seleccionar mas opciones",placeholder:"Selecciona una opción...",placeholderMulti:"Selecciona hasta :límite de opciones...",search:"Escribe dentro para buscar...",disabled:"Este campo esta deshabilitado"}),e.strings.register("fr",{all:"Tous",none:"Aucun",actionAll:"Sélectionner tout",actionNone:"Sélectionner aucun",empty:"Aucune option disponible",emptySearch:"Aucune option trouvée",limit:"Aucune autre option sélectionnable",placeholder:"Choisissez une option ...",placeholderMulti:"Choisissez jusqu'à :limit option(s) ...",search:"Rechercher ...",disabled:"Ce champs est désactivé"}),e.strings.register("pt_BR",{all:"Todas",none:"Nenhuma",actionAll:"Selecionar todas",actionNone:"Desmarcar todas",empty:"Nenhuma opção disponível",emptySearch:"Nenhuma opção encontrada",limit:"Não é possível selecionar outra opção",placeholder:"Escolha uma opção ...",placeholderMulti:"Escolha até: :limit opção(ões) ...",search:"Buscar ...",disabled:"Campo desativado"}),e.strings.register("ru",{all:"Все",none:"Ничего",actionAll:"Выбрать все",actionNone:"Отменить все",empty:"Нет доступных вариантов",emptySearch:"Ничего не найдено",limit:"Вы не можете выбрать больше вариантов",placeholder:"Выберите вариант...",placeholderMulti:function(e){var i=e[":limit"];return"Выбор до :limit "+["варианта","вариантов","вариантов"][4<i%100&&i%100<20?2:[2,0,1,1,1,2][i%10<5?i%10:5]]+" ..."},search:"Начните набирать для поиска ...",disabled:"Поле отключено"}),e});

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.select

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -12,2 +12,6 @@ | @website https://github.com/pytesNET/tail.select

*/
/*
| Translator: Anthony Rabine - (https://github.com/arabine)
| GitHub: https://github.com/pytesNET/tail.select/issues/11
*/
;(function(factory){

@@ -14,0 +18,0 @@ if(typeof(define) == "function" && define.amd){

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -12,2 +12,6 @@ | @website https://github.com/pytesNET/tail.select

*/
/*
| Translator: Igor - (https://github.com/igorcm)
| GitHub: https://github.com/pytesNET/tail.select/pull/34
*/
;(function(factory){

@@ -14,0 +18,0 @@ if(typeof(define) == "function" && define.amd){

@@ -5,3 +5,3 @@ /*

| @author SamBrishes <sam@pytes.net>
| @version 0.5.8 - Beta
| @version 0.5.9 - Beta
|

@@ -12,2 +12,6 @@ | @website https://github.com/pytesNET/tail.select

*/
/*
| Translator: Roman Yepanchenko - (https://github.com/tizis)
| GitHub: https://github.com/pytesNET/tail.select/issues/38
*/
;(function(factory){

@@ -14,0 +18,0 @@ if(typeof(define) == "function" && define.amd){

{
"name": "tail.select",
"version": "0.5.8",
"version": "0.5.9",
"description": "Create beautiful, functional and extensive (Multi) select fields, written in Vanilla without any dependencies!",

@@ -5,0 +5,0 @@ "keywords": [

@@ -71,3 +71,4 @@ tail.select - Beautify Select Fields

- [Igor](https://github.com/igorcm) / [Brazilian Portuguese Translation](https://github.com/pytesNET/tail.select/pull/34)
- [Roman Yepanchenko](https://github.com/tizis) / [Russian Translation](https://github.com/pytesNET/tail.select/issues/38))
- [Roman Yepanchenko](https://github.com/tizis) / [Russian Translation](https://github.com/pytesNET/tail.select/issues/38)
- [elPesecillo](https://github.com/elPesecillo) / [Spanish Translation](https://github.com/pytesNET/tail.select/issues/41)

@@ -145,2 +146,3 @@ Documentation

locale: "en", // NEW IN 0.5.0
lingusticRules: {}, // EXPERIMENTAL SINCE 0.5.9
multiple: false,

@@ -147,0 +149,0 @@ multiLimit: Infinity, // UPDATE IN 0.5.0

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc