/*! choices.js v9.0.1 | © 2019 josh johnson | https://github.com/jshjohnson/choices#readme */ window.choices=function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||object.defineproperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof symbol&&symbol.tostringtag&&object.defineproperty(e,symbol.tostringtag,{value:"module"}),object.defineproperty(e,"__esmodule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esmodule)return e;var n=object.create(null);if(i.r(n),object.defineproperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esmodule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return object.prototype.hasownproperty.call(e,t)},i.p="/public/assets/scripts/",i(i.s=4)}([function(e,t,i){"use strict";var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=object.prototype.tostring.call(e);return"[object regexp]"===t||"[object date]"===t||function(e){return e.$$typeof===s}(e)}(e)};var s="function"==typeof symbol&&symbol.for?symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.ismergeableobject(e)?l((i=e,array.isarray(i)?[]:{}),e,t):e;var i}function o(e,t,i){return e.concat(t).map((function(e){return r(e,i)}))}function a(e){return object.keys(e).concat(function(e){return object.getownpropertysymbols?object.getownpropertysymbols(e).filter((function(t){return e.propertyisenumerable(t)})):[]}(e))}function c(e,t,i){var n={};return i.ismergeableobject(e)&&a(e).foreach((function(t){n[t]=r(e[t],i)})),a(t).foreach((function(s){(function(e,t){try{return t in e&&!(object.hasownproperty.call(e,t)&&object.propertyisenumerable.call(e,t))}catch(e){return!1}})(e,s)||(i.ismergeableobject(t[s])&&e[s]?n[s]=function(e,t){if(!t.custommerge)return l;var i=t.custommerge(e);return"function"==typeof i?i:l}(s,i)(e[s],t[s],i):n[s]=r(t[s],i))})),n}function l(e,t,i){(i=i||{}).arraymerge=i.arraymerge||o,i.ismergeableobject=i.ismergeableobject||n,i.cloneunlessotherwisespecified=r;var s=array.isarray(t);return s===array.isarray(e)?s?i.arraymerge(e,t,i):c(e,t,i):r(t,i)}l.all=function(e,t){if(!array.isarray(e))throw new error("first argument should be an array");return e.reduce((function(e,i){return l(e,i,t)}),{})};var h=l;e.exports=h},function(e,t,i){"use strict";(function(e,n){var s,r=i(3);s="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var o=object(r.a)(s);t.a=o}).call(this,i(5),i(6)(e))},function(e,t,i){ /*! * fuse.js v3.4.5 - lightweight fuzzy-search (http://fusejs.io) * * copyright (c) 2012-2017 kirollos risk (http://kiro.me) * all rights reserved. apache software license 2.0 * * http://www.apache.org/licenses/license-2.0 */ e.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||object.defineproperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof symbol&&symbol.tostringtag&&object.defineproperty(e,symbol.tostringtag,{value:"module"}),object.defineproperty(e,"__esmodule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esmodule)return e;var n=object.create(null);if(i.r(n),object.defineproperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esmodule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return object.prototype.hasownproperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t){e.exports=function(e){return array.isarray?array.isarray(e):"[object array]"===object.prototype.tostring.call(e)}},function(e,t,i){function n(e){return(n="function"==typeof symbol&&"symbol"==typeof symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof symbol&&e.constructor===symbol&&e!==symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nsearch pattern: "'.concat(e,'"'));var i=this._preparesearchers(e),n=i.tokensearchers,s=i.fullsearcher,r=this._search(n,s),o=r.weights,a=r.results;return this._computescore(o,a),this.options.shouldsort&&this._sort(a),t.limit&&"number"==typeof t.limit&&(a=a.slice(0,t.limit)),this._format(a)}},{key:"_preparesearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var i=e.split(this.options.tokenseparator),n=0,s=i.length;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},s=[];if("string"==typeof i[0]){for(var r=0,o=i.length;r1)throw new error("key weight has to be > 0 and <= 1");p=p.name}else a[p]={weight:1};this._analyze({key:p,value:this.options.getfn(h,p),record:h,index:c},{resultmap:n,results:s,tokensearchers:e,fullsearcher:t})}return{weights:a,results:s}}},{key:"_analyze",value:function(e,t){var i=e.key,n=e.arrayindex,s=void 0===n?-1:n,r=e.value,o=e.record,c=e.index,l=t.tokensearchers,h=void 0===l?[]:l,u=t.fullsearcher,d=void 0===u?[]:u,p=t.resultmap,m=void 0===p?{}:p,f=t.results,v=void 0===f?[]:f;if(null!=r){var g=!1,_=-1,b=0;if("string"==typeof r){this._log("\nkey: ".concat(""===i?"-":i));var y=d.search(r);if(this._log('full text: "'.concat(r,'", score: ').concat(y.score)),this.options.tokenize){for(var e=r.split(this.options.tokenseparator),i=[],s=0;s-1&&(p=(p+_)/2),this._log("score average:",p);var d=!this.options.tokenize||!this.options.matchalltokens||b>=h.length;if(this._log("\ncheck matches: ".concat(d)),(g||y.ismatch)&&d){var m=m[c];m?m.output.push({key:i,arrayindex:s,value:r,score:p,matchedindices:y.matchedindices}):(m[c]={item:o,output:[{key:i,arrayindex:s,value:r,score:p,matchedindices:y.matchedindices}]},v.push(m[c]))}}else if(a(r))for(var n=0,f=r.length;n-1&&(o.arrayindex=r.arrayindex),t.matches.push(o)}}})),this.options.includescore&&s.push((function(e,t){t.score=e.score}));for(var r=0,o=e.length;ri)return s(e,this.pattern,n);var o=this.options,a=o.location,c=o.distance,l=o.threshold,h=o.findallmatches,u=o.minmatchcharlength;return r(e,this.pattern,this.patternalphabet,{location:a,distance:c,threshold:l,findallmatches:h,minmatchcharlength:u})}}])&&n(t.prototype,i),e}();e.exports=a},function(e,t){var i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,s=new regexp(t.replace(i,"\\$&").replace(n,"|")),r=e.match(s),o=!!r,a=[];if(o)for(var c=0,l=r.length;c=p;n-=1){var f=n-1,j=i[e.charat(f)];if(j&&(e[f]=1),m[n]=(m[n+1]<<1|1)&j,0!==t&&(m[n]|=(o[n+1]|o[n])<<1|1|o[n+1]),m[n]&l&&(c=n(t,{errors:t,currentlocation:f,expectedlocation:v,distance:l}))<=_){if(_=c,(b=f)<=v)break;p=math.max(1,2*v-b)}}if(n(t,{errors:t+1,currentlocation:v,expectedlocation:v,distance:l})>_)break;o=m}return{ismatch:b>=0,score:0===c?.001:c,matchedindices:s(e,f)}}},function(e,t){e.exports=function(e,t){var i=t.errors,n=void 0===i?0:i,s=t.currentlocation,r=void 0===s?0:s,o=t.expectedlocation,a=void 0===o?0:o,c=t.distance,l=void 0===c?100:c,h=n/e.length,u=math.abs(a-r);return l?h+u/l:u?1:h}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[],n=-1,s=-1,r=0,o=e.length;r=t&&i.push([n,s]),n=-1)}return e[r-1]&&r-n>=t&&i.push([n,r-1]),i}},function(e,t){e.exports=function(e){for(var t={},i=e.length,n=0;n/g,"&rt;").replace(/-1?e.map((function(e){var i=e;return i.id===parseint(t.choiceid,10)&&(i.selected=!0),i})):e;case"remove_item":return t.choiceid>-1?e.map((function(e){var i=e;return i.id===parseint(t.choiceid,10)&&(i.selected=!1),i})):e;case"filter_choices":return e.map((function(e){var i=e;return i.active=t.results.some((function(e){var t=e.item,n=e.score;return t.id===i.id&&(i.score=n,!0)})),i}));case"activate_choices":return e.map((function(e){var i=e;return i.active=t.active,i}));case"clear_choices":return f;default:return e}},general:_}),t=function(e,t){var i=e;if("clear_all"===t.type)i=void 0;else if("reset_to"===t.type)return c(t.state);return l(i,t)};function x(e,t){for(var i=0;i"'+s(e)+'"'},maxitemtext:function(e){return"only "+e+" values can be added"},valuecomparer:function(e,t){return e===t},fuseoptions:{includescore:!0},callbackoninit:null,callbackoncreatetemplates:null,classnames:{containerouter:"choices",containerinner:"choices__inner",input:"choices__input",inputcloned:"choices__input--cloned",list:"choices__list",listitems:"choices__list--multiple",listsingle:"choices__list--single",listdropdown:"choices__list--dropdown",item:"choices__item",itemselectable:"choices__item--selectable",itemdisabled:"choices__item--disabled",itemchoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupheading:"choices__heading",button:"choices__button",activestate:"is-active",focusstate:"is-focused",openstate:"is-open",disabledstate:"is-disabled",highlightedstate:"is-highlighted",selectedstate:"is-selected",flippedstate:"is-flipped",loadingstate:"is-loading",noresults:"has-no-results",nochoices:"has-no-choices"}},n="showdropdown",f="hidedropdown",j="change",k="choice",r="search",h="additem",b="removeitem",v="highlightitem",g="highlightchoice",q="add_choice",u="filter_choices",z="activate_choices",w="clear_choices",x="add_group",$="add_item",j="remove_item",y="highlight_item",z=46,q=8,ee=13,te=65,ie=27,ne=38,se=40,re=33,oe=34,ae="text",ce="select-one",le="select-multiple",he=function(){function e(e){var t=e.element,i=e.type,n=e.classnames,s=e.position;this.element=t,this.classnames=n,this.type=i,this.position=s,this.isopen=!1,this.isflipped=!1,this.isfocussed=!1,this.isdisabled=!1,this.isloading=!1,this._onfocus=this._onfocus.bind(this),this._onblur=this._onblur.bind(this)}var t=e.prototype;return t.addeventlisteners=function(){this.element.addeventlistener("focus",this._onfocus),this.element.addeventlistener("blur",this._onblur)},t.removeeventlisteners=function(){this.element.removeeventlistener("focus",this._onfocus),this.element.removeeventlistener("blur",this._onblur)},t.shouldflip=function(e){if("number"!=typeof e)return!1;var t=!1;return"auto"===this.position?t=!window.matchmedia("(min-height: "+(e+1)+"px)").matches:"top"===this.position&&(t=!0),t},t.setactivedescendant=function(e){this.element.setattribute("aria-activedescendant",e)},t.removeactivedescendant=function(){this.element.removeattribute("aria-activedescendant")},t.open=function(e){this.element.classlist.add(this.classnames.openstate),this.element.setattribute("aria-expanded","true"),this.isopen=!0,this.shouldflip(e)&&(this.element.classlist.add(this.classnames.flippedstate),this.isflipped=!0)},t.close=function(){this.element.classlist.remove(this.classnames.openstate),this.element.setattribute("aria-expanded","false"),this.removeactivedescendant(),this.isopen=!1,this.isflipped&&(this.element.classlist.remove(this.classnames.flippedstate),this.isflipped=!1)},t.focus=function(){this.isfocussed||this.element.focus()},t.addfocusstate=function(){this.element.classlist.add(this.classnames.focusstate)},t.removefocusstate=function(){this.element.classlist.remove(this.classnames.focusstate)},t.enable=function(){this.element.classlist.remove(this.classnames.disabledstate),this.element.removeattribute("aria-disabled"),this.type===ce&&this.element.setattribute("tabindex","0"),this.isdisabled=!1},t.disable=function(){this.element.classlist.add(this.classnames.disabledstate),this.element.setattribute("aria-disabled","true"),this.type===ce&&this.element.setattribute("tabindex","-1"),this.isdisabled=!0},t.wrap=function(e){!function(e,t){void 0===t&&(t=document.createelement("div")),e.nextsibling?e.parentnode.insertbefore(t,e.nextsibling):e.parentnode.appendchild(t),t.appendchild(e)}(e,this.element)},t.unwrap=function(e){this.element.parentnode.insertbefore(e,this.element),this.element.parentnode.removechild(this.element)},t.addloadingstate=function(){this.element.classlist.add(this.classnames.loadingstate),this.element.setattribute("aria-busy","true"),this.isloading=!0},t.removeloadingstate=function(){this.element.classlist.remove(this.classnames.loadingstate),this.element.removeattribute("aria-busy"),this.isloading=!1},t._onfocus=function(){this.isfocussed=!0},t._onblur=function(){this.isfocussed=!1},e}();function ue(e,t){for(var i=0;i0?this.element.scrolltop+o-s:e.offsettop;requestanimationframe((function(){i._animatescroll(a,t)}))}},t._scrolldown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrolltop=e+s},t._scrollup=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrolltop=e-s},t._animatescroll=function(e,t){var i=this,n=this.element.scrolltop,s=!1;t>0?(this._scrolldown(n,4,e),ne&&(s=!0)),s&&requestanimationframe((function(){i._animatescroll(e,t)}))},e}();function me(e,t){for(var i=0;i0?"treeitem":"option"),object.assign(g.dataset,{choice:"",id:l,value:h,selecttext:i}),m?(g.classlist.add(a),g.dataset.choicedisabled="",g.setattribute("aria-disabled","true")):(g.classlist.add(r),g.dataset.choiceselectable=""),g},input:function(e,t){var i=e.input,n=e.inputcloned,s=object.assign(document.createelement("input"),{type:"text",classname:i+" "+n,autocomplete:"off",autocapitalize:"off",spellcheck:!1});return s.setattribute("role","textbox"),s.setattribute("aria-autocomplete","list"),s.setattribute("aria-label",t),s},dropdown:function(e){var t=e.list,i=e.listdropdown,n=document.createelement("div");return n.classlist.add(t,i),n.setattribute("aria-expanded","false"),n},notice:function(e,t,i){var n=e.item,s=e.itemchoice,r=e.noresults,o=e.nochoices;void 0===i&&(i="");var a=[n,s];return"no-choices"===i?a.push(o):"no-results"===i&&a.push(r),object.assign(document.createelement("div"),{innerhtml:t,classname:a.join(" ")})},option:function(e){var t=e.label,i=e.value,n=e.customproperties,s=e.active,r=e.disabled,o=new option(t,i,!1,s);return n&&(o.dataset.customproperties=n),o.disabled=r,o}},ee=function(e){return void 0===e&&(e=!0),{type:z,active:e}},ie=function(e,t){return{type:y,id:e,highlighted:t}},se=function(e){var t=e.value,i=e.id,n=e.active,s=e.disabled;return{type:x,value:t,id:i,active:n,disabled:s}},we=function(e){return{type:"set_is_loading",isloading:e}};function oe(e,t){for(var i=0;i=0?this._store.getgroupbyid(s):null;return this._store.dispatch(ie(i,!0)),t&&this.passedelement.triggerevent(v,{id:i,value:o,label:c,groupvalue:l&&l.value?l.value:null}),this},r.unhighlightitem=function(e){if(!e)return this;var t=e.id,i=e.groupid,n=void 0===i?-1:i,s=e.value,r=void 0===s?"":s,o=e.label,a=void 0===o?"":o,c=n>=0?this._store.getgroupbyid(n):null;return this._store.dispatch(ie(t,!1)),this.passedelement.triggerevent(v,{id:t,value:r,label:a,groupvalue:c&&c.value?c.value:null}),this},r.highlightall=function(){var e=this;return this._store.items.foreach((function(t){return e.highlightitem(t)})),this},r.unhighlightall=function(){var e=this;return this._store.items.foreach((function(t){return e.unhighlightitem(t)})),this},r.removeactiveitemsbyvalue=function(e){var t=this;return this._store.activeitems.filter((function(t){return t.value===e})).foreach((function(e){return t._removeitem(e)})),this},r.removeactiveitems=function(e){var t=this;return this._store.activeitems.filter((function(t){return t.id!==e})).foreach((function(e){return t._removeitem(e)})),this},r.removehighlighteditems=function(e){var t=this;return void 0===e&&(e=!1),this._store.highlightedactiveitems.foreach((function(i){t._removeitem(i),e&&t._triggerchange(i.value)})),this},r.showdropdown=function(e){var t=this;return this.dropdown.isactive?this:(requestanimationframe((function(){t.dropdown.show(),t.containerouter.open(t.dropdown.distancefromtopwindow),!e&&t._cansearch&&t.input.focus(),t.passedelement.triggerevent(n,{})})),this)},r.hidedropdown=function(e){var t=this;return this.dropdown.isactive?(requestanimationframe((function(){t.dropdown.hide(),t.containerouter.close(),!e&&t._cansearch&&(t.input.removeactivedescendant(),t.input.blur()),t.passedelement.triggerevent(f,{})})),this):this},r.getvalue=function(e){void 0===e&&(e=!1);var t=this._store.activeitems.reduce((function(t,i){var n=e?i.value:i;return t.push(n),t}),[]);return this._isselectoneelement?t[0]:t},r.setvalue=function(e){var t=this;return this.initialised?(e.foreach((function(e){return t._setchoiceoritem(e)})),this):this},r.setchoicebyvalue=function(e){var t=this;return!this.initialised||this._istextelement?this:((array.isarray(e)?e:[e]).foreach((function(e){return t._findandselectchoicebyvalue(e)})),this)},r.setchoices=function(e,t,i,n){var s=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===i&&(i="label"),void 0===n&&(n=!1),!this.initialised)throw new referenceerror("setchoices was called on a non-initialized instance of choices");if(!this._isselectelement)throw new typeerror("setchoices can't be used with input based choices");if("string"!=typeof t||!t)throw new typeerror("value parameter must be a name of 'value' field in passed objects");if(n&&this.clearchoices(),"function"==typeof e){var r=e(this);if("function"==typeof promise&&r instanceof promise)return new promise((function(e){return requestanimationframe(e)})).then((function(){return s._handleloadingstate(!0)})).then((function(){return r})).then((function(e){return s.setchoices(e,t,i,n)})).catch((function(e){s.config.silent||console.error(e)})).then((function(){return s._handleloadingstate(!1)})).then((function(){return s}));if(!array.isarray(r))throw new typeerror(".setchoices first argument function must return either array of choices or promise, got: "+typeof r);return this.setchoices(r,t,i,!1)}if(!array.isarray(e))throw new typeerror(".setchoices must be called either with array of choices with a function resulting into promise of array of choices");return this.containerouter.removeloadingstate(),this._startloading(),e.foreach((function(e){e.choices?s._addgroup({id:parseint(e.id,10)||null,group:e,valuekey:t,labelkey:i}):s._addchoice({value:e[t],label:e[i],isselected:e.selected,isdisabled:e.disabled,customproperties:e.customproperties,placeholder:e.placeholder})})),this._stoploading(),this},r.clearchoices=function(){return this._store.dispatch({type:w}),this},r.clearstore=function(){return this._store.dispatch({type:"clear_all"}),this},r.clearinput=function(){var e=!this._isselectoneelement;return this.input.clear(e),!this._istextelement&&this._cansearch&&(this._issearching=!1,this._store.dispatch(ee(!0))),this},r._render=function(){if(!this._store.isloading()){this._currentstate=this._store.state;var e=this._currentstate.choices!==this._prevstate.choices||this._currentstate.groups!==this._prevstate.groups||this._currentstate.items!==this._prevstate.items,t=this._isselectelement,i=this._currentstate.items!==this._prevstate.items;e&&(t&&this._renderchoices(),i&&this._renderitems(),this._prevstate=this._currentstate)}},r._renderchoices=function(){var e=this,t=this._store,i=t.activegroups,n=t.activechoices,s=document.createdocumentfragment();if(this.choicelist.clear(),this.config.resetscrollposition&&requestanimationframe((function(){return e.choicelist.scrolltotop()})),i.length>=1&&!this._issearching){var r=n.filter((function(e){return!0===e.placeholder&&-1===e.groupid}));r.length>=1&&(s=this._createchoicesfragment(r,s)),s=this._creategroupsfragment(i,n,s)}else n.length>=1&&(s=this._createchoicesfragment(n,s));if(s.childnodes&&s.childnodes.length>0){var o=this._store.activeitems,a=this._canadditem(o,this.input.value);a.response?(this.choicelist.append(s),this._highlightchoice()):this.choicelist.append(this._gettemplate("notice",a.notice))}else{var c,l;this._issearching?(l="function"==typeof this.config.noresultstext?this.config.noresultstext():this.config.noresultstext,c=this._gettemplate("notice",l,"no-results")):(l="function"==typeof this.config.nochoicestext?this.config.nochoicestext():this.config.nochoicestext,c=this._gettemplate("notice",l,"no-choices")),this.choicelist.append(c)}},r._renderitems=function(){var e=this._store.activeitems||[];this.itemlist.clear();var t=this._createitemsfragment(e);t.childnodes&&this.itemlist.append(t)},r._creategroupsfragment=function(e,t,i){var n=this;void 0===i&&(i=document.createdocumentfragment());return this.config.shouldsort&&e.sort(this.config.sorter),e.foreach((function(e){var s=function(e){return t.filter((function(t){return n._isselectoneelement?t.groupid===e.id:t.groupid===e.id&&("always"===n.config.renderselectedchoices||!t.selected)}))}(e);if(s.length>=1){var r=n._gettemplate("choicegroup",e);i.appendchild(r),n._createchoicesfragment(s,i,!0)}})),i},r._createchoicesfragment=function(e,t,i){var n=this;void 0===t&&(t=document.createdocumentfragment()),void 0===i&&(i=!1);var s=this.config,r=s.renderselectedchoices,o=s.searchresultlimit,a=s.renderchoicelimit,c=this._issearching?o:this.config.sorter,l=function(e){if("auto"!==r||(n._isselectoneelement||!e.selected)){var i=n._gettemplate("choice",e,n.config.itemselecttext);t.appendchild(i)}},h=e;"auto"!==r||this._isselectoneelement||(h=e.filter((function(e){return!e.selected})));var u=h.reduce((function(e,t){return t.placeholder?e.placeholderchoices.push(t):e.normalchoices.push(t),e}),{placeholderchoices:[],normalchoices:[]}),d=u.placeholderchoices,p=u.normalchoices;(this.config.shouldsort||this._issearching)&&p.sort(c);var m=h.length,f=this._isselectoneelement?[].concat(d,p):p;this._issearching?m=o:a&&a>0&&!i&&(m=a);for(var v=0;v=n){var o=s?this._searchchoices(e):0;this.passedelement.triggerevent(r,{value:e,resultcount:o})}else r&&(this._issearching=!1,this._store.dispatch(ee(!0)))}},r._canadditem=function(e,t){var i=!0,n="function"==typeof this.config.additemtext?this.config.additemtext(t):this.config.additemtext;if(!this._isselectoneelement){var s=function(e,t,i){return void 0===i&&(i="value"),e.some((function(e){return"string"==typeof t?e[i]===t.trim():e[i]===t}))}(e,t);this.config.maxitemcount>0&&this.config.maxitemcount<=e.length&&(i=!1,n="function"==typeof this.config.maxitemtext?this.config.maxitemtext(this.config.maxitemcount):this.config.maxitemtext),!this.config.duplicateitemsallowed&&s&&i&&(i=!1,n="function"==typeof this.config.uniqueitemtext?this.config.uniqueitemtext(t):this.config.uniqueitemtext),this._istextelement&&this.config.additems&&i&&"function"==typeof this.config.additemfilter&&!this.config.additemfilter(t)&&(i=!1,n="function"==typeof this.config.customadditemtext?this.config.customadditemtext(t):this.config.customadditemtext)}return{response:i,notice:n}},r._searchchoices=function(e){var t="string"==typeof e?e.trim():e,i="string"==typeof this._currentvalue?this._currentvalue.trim():this._currentvalue;if(t.length<1&&t===i+" ")return 0;var n=this._store.searchablechoices,r=t,o=[].concat(this.config.searchfields),a=object.assign(this.config.fuseoptions,{keys:o}),c=new s.a(n,a).search(r);return this._currentvalue=t,this._highlightposition=0,this._issearching=!0,this._store.dispatch(function(e){return{type:u,results:e}}(c)),c.length},r._addeventlisteners=function(){var e=document.documentelement;e.addeventlistener("touchend",this._ontouchend,!0),this.containerouter.element.addeventlistener("keydown",this._onkeydown,!0),this.containerouter.element.addeventlistener("mousedown",this._onmousedown,!0),e.addeventlistener("click",this._onclick,{passive:!0}),e.addeventlistener("touchmove",this._ontouchmove,{passive:!0}),this.dropdown.element.addeventlistener("mouseover",this._onmouseover,{passive:!0}),this._isselectoneelement&&(this.containerouter.element.addeventlistener("focus",this._onfocus,{passive:!0}),this.containerouter.element.addeventlistener("blur",this._onblur,{passive:!0})),this.input.element.addeventlistener("keyup",this._onkeyup,{passive:!0}),this.input.element.addeventlistener("focus",this._onfocus,{passive:!0}),this.input.element.addeventlistener("blur",this._onblur,{passive:!0}),this.input.element.form&&this.input.element.form.addeventlistener("reset",this._onformreset,{passive:!0}),this.input.addeventlisteners()},r._removeeventlisteners=function(){var e=document.documentelement;e.removeeventlistener("touchend",this._ontouchend,!0),this.containerouter.element.removeeventlistener("keydown",this._onkeydown,!0),this.containerouter.element.removeeventlistener("mousedown",this._onmousedown,!0),e.removeeventlistener("click",this._onclick),e.removeeventlistener("touchmove",this._ontouchmove),this.dropdown.element.removeeventlistener("mouseover",this._onmouseover),this._isselectoneelement&&(this.containerouter.element.removeeventlistener("focus",this._onfocus),this.containerouter.element.removeeventlistener("blur",this._onblur)),this.input.element.removeeventlistener("keyup",this._onkeyup),this.input.element.removeeventlistener("focus",this._onfocus),this.input.element.removeeventlistener("blur",this._onblur),this.input.element.form&&this.input.element.form.removeeventlistener("reset",this._onformreset),this.input.removeeventlisteners()},r._onkeydown=function(e){var t,i=e.target,n=e.keycode,s=e.ctrlkey,r=e.metakey,o=this._store.activeitems,a=this.input.isfocussed,c=this.dropdown.isactive,l=this.itemlist.haschildren(),h=string.fromcharcode(n),u=z,d=q,p=ee,m=te,f=ie,v=ne,g=se,_=re,b=oe,y=s||r;!this._istextelement&&/[a-za-z0-9-_ ]/.test(h)&&this.showdropdown();var e=((t={})[m]=this._onakey,t[p]=this._onenterkey,t[f]=this._onescapekey,t[v]=this._ondirectionkey,t[_]=this._ondirectionkey,t[g]=this._ondirectionkey,t[b]=this._ondirectionkey,t[d]=this._ondeletekey,t[u]=this._ondeletekey,t);e[n]&&e[n]({event:e,target:i,keycode:n,metakey:r,activeitems:o,hasfocusedinput:a,hasactivedropdown:c,hasitems:l,hasctrldownkeypressed:y})},r._onkeyup=function(e){var t=e.target,i=e.keycode,n=this.input.value,s=this._store.activeitems,r=this._canadditem(s,n),o=z,a=q;if(this._istextelement){if(r.notice&&n){var c=this._gettemplate("notice",r.notice);this.dropdown.element.innerhtml=c.outerhtml,this.showdropdown(!0)}else this.hidedropdown(!0)}else{var l=(i===o||i===a)&&!t.value,h=!this._istextelement&&this._issearching,u=this._cansearch&&r.response;l&&h?(this._issearching=!1,this._store.dispatch(ee(!0))):u&&this._handlesearch(this.input.value)}this._cansearch=this.config.searchenabled},r._onakey=function(e){var t=e.hasitems;e.hasctrldownkeypressed&&t&&(this._cansearch=!1,this.config.removeitems&&!this.input.value&&this.input.element===document.activeelement&&this.highlightall())},r._onenterkey=function(e){var t=e.event,i=e.target,n=e.activeitems,s=e.hasactivedropdown,r=ee,o=i.hasattribute("data-button");if(this._istextelement&&i.value){var a=this.input.value;this._canadditem(n,a).response&&(this.hidedropdown(!0),this._additem({value:a}),this._triggerchange(a),this.clearinput())}if(o&&(this._handlebuttonaction(n,i),t.preventdefault()),s){var c=this.dropdown.getchild("."+this.config.classnames.highlightedstate);c&&(n[0]&&(n[0].keycode=r),this._handlechoiceaction(n,c)),t.preventdefault()}else this._isselectoneelement&&(this.showdropdown(),t.preventdefault())},r._onescapekey=function(e){e.hasactivedropdown&&(this.hidedropdown(!0),this.containerouter.focus())},r._ondirectionkey=function(e){var t,i,n,s=e.event,r=e.hasactivedropdown,o=e.keycode,a=e.metakey,c=se,l=re,h=oe;if(r||this._isselectoneelement){this.showdropdown(),this._cansearch=!1;var u,d=o===c||o===h?1:-1;if(a||o===h||o===l)u=d>0?this.dropdown.element.queryselector("[data-choice-selectable]:last-of-type"):this.dropdown.element.queryselector("[data-choice-selectable]");else{var p=this.dropdown.element.queryselector("."+this.config.classnames.highlightedstate);u=p?function(e,t,i){if(void 0===i&&(i=1),e instanceof element&&"string"==typeof t){for(var n=(i>0?"next":"previous")+"elementsibling",s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}}(p,"[data-choice-selectable]",d):this.dropdown.element.queryselector("[data-choice-selectable]")}u&&(t=u,i=this.choicelist.element,void 0===(n=d)&&(n=1),t&&(n>0?i.scrolltop+i.offsetheight>=t.offsettop+t.offsetheight:t.offsettop>=i.scrolltop)||this.choicelist.scrolltochildelement(u,d),this._highlightchoice(u)),s.preventdefault()}},r._ondeletekey=function(e){var t=e.event,i=e.target,n=e.hasfocusedinput,s=e.activeitems;!n||i.value||this._isselectoneelement||(this._handlebackspace(s),t.preventdefault())},r._ontouchmove=function(){this._wastap&&(this._wastap=!1)},r._ontouchend=function(e){var t=(e||e.touches[0]).target;this._wastap&&this.containerouter.element.contains(t)&&((t===this.containerouter.element||t===this.containerinner.element)&&(this._istextelement?this.input.focus():this._isselectmultipleelement&&this.showdropdown()),e.stoppropagation());this._wastap=!0},r._onmousedown=function(e){var t=e.target;if(t instanceof htmlelement){if(ce&&this.choicelist.element.contains(t)){var i=this.choicelist.element.firstelementchild,n="ltr"===this._direction?e.offsetx>=i.offsetwidth:e.offsetx0&&this.unhighlightall(),this.containerouter.removefocusstate(),this.hidedropdown(!0))},r._onfocus=function(e){var t,i=this,n=e.target;this.containerouter.element.contains(n)&&((t={})[ae]=function(){n===i.input.element&&i.containerouter.addfocusstate()},t[ce]=function(){i.containerouter.addfocusstate(),n===i.input.element&&i.showdropdown(!0)},t[le]=function(){n===i.input.element&&(i.showdropdown(!0),i.containerouter.addfocusstate())},t)[this.passedelement.element.type]()},r._onblur=function(e){var t=this,i=e.target;if(this.containerouter.element.contains(i)&&!this._isscrollingonie){var n,s=this._store.activeitems.some((function(e){return e.highlighted}));((n={})[ae]=function(){i===t.input.element&&(t.containerouter.removefocusstate(),s&&t.unhighlightall(),t.hidedropdown(!0))},n[ce]=function(){t.containerouter.removefocusstate(),(i===t.input.element||i===t.containerouter.element&&!t._cansearch)&&t.hidedropdown(!0)},n[le]=function(){i===t.input.element&&(t.containerouter.removefocusstate(),t.hidedropdown(!0),s&&t.unhighlightall())},n)[this.passedelement.element.type]()}else this._isscrollingonie=!1,this.input.element.focus()},r._onformreset=function(){this._store.dispatch({type:"reset_to",state:this._initialstate})},r._highlightchoice=function(e){var t=this;void 0===e&&(e=null);var i=array.from(this.dropdown.element.queryselectorall("[data-choice-selectable]"));if(i.length){var n=e;array.from(this.dropdown.element.queryselectorall("."+this.config.classnames.highlightedstate)).foreach((function(e){e.classlist.remove(t.config.classnames.highlightedstate),e.setattribute("aria-selected","false")})),n?this._highlightposition=i.indexof(n):(n=i.length>this._highlightposition?i[this._highlightposition]:i[i.length-1])||(n=i[0]),n.classlist.add(this.config.classnames.highlightedstate),n.setattribute("aria-selected","true"),this.passedelement.triggerevent(g,{el:n}),this.dropdown.isactive&&(this.input.setactivedescendant(n.id),this.containerouter.setactivedescendant(n.id))}},r._additem=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,s=e.choiceid,r=void 0===s?-1:s,o=e.groupid,a=void 0===o?-1:o,c=e.customproperties,l=void 0===c?null:c,h=e.placeholder,u=void 0!==h&&h,d=e.keycode,p=void 0===d?null:d,m="string"==typeof t?t.trim():t,f=p,v=l,g=this._store.items,_=n||m,b=r||-1,y=a>=0?this._store.getgroupbyid(a):null,e=g?g.length+1:1;return this.config.prependvalue&&(m=this.config.prependvalue+m.tostring()),this.config.appendvalue&&(m+=this.config.appendvalue.tostring()),this._store.dispatch(function(e){var t=e.value,i=e.label,n=e.id,s=e.choiceid,r=e.groupid,o=e.customproperties,a=e.placeholder,c=e.keycode;return{type:$,value:t,label:i,id:n,choiceid:s,groupid:r,customproperties:o,placeholder:a,keycode:c}}({value:m,label:_,id:e,choiceid:b,groupid:a,customproperties:l,placeholder:u,keycode:f})),this._isselectoneelement&&this.removeactiveitems(e),this.passedelement.triggerevent(h,{id:e,value:m,label:_,customproperties:v,groupvalue:y&&y.value?y.value:void 0,keycode:f}),this},r._removeitem=function(e){if(!e||!i("object",e))return this;var t=e.id,i=e.value,n=e.label,s=e.choiceid,r=e.groupid,o=r>=0?this._store.getgroupbyid(r):null;return this._store.dispatch(function(e,t){return{type:j,id:e,choiceid:t}}(t,s)),o&&o.value?this.passedelement.triggerevent(b,{id:t,value:i,label:n,groupvalue:o.value}):this.passedelement.triggerevent(b,{id:t,value:i,label:n}),this},r._addchoice=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,s=e.isselected,r=void 0!==s&&s,o=e.isdisabled,a=void 0!==o&&o,c=e.groupid,l=void 0===c?-1:c,h=e.customproperties,u=void 0===h?null:h,d=e.placeholder,p=void 0!==d&&d,m=e.keycode,f=void 0===m?null:m;if(null!=t){var v=this._store.choices,g=n||t,_=v?v.length+1:1,b=this._baseid+"-"+this._idnames.itemchoice+"-"+_;this._store.dispatch(function(e){var t=e.value,i=e.label,n=e.id,s=e.groupid,r=e.disabled,o=e.elementid,a=e.customproperties,c=e.placeholder,l=e.keycode;return{type:q,value:t,label:i,id:n,groupid:s,disabled:r,elementid:o,customproperties:a,placeholder:c,keycode:l}}({id:_,groupid:l,elementid:b,value:t,label:g,disabled:a,customproperties:u,placeholder:p,keycode:f})),r&&this._additem({value:t,label:g,choiceid:_,customproperties:u,placeholder:p,keycode:f})}},r._addgroup=function(e){var t=this,i=e.group,n=e.id,s=e.valuekey,r=void 0===s?"value":s,o=e.labelkey,a=void 0===o?"label":o,c=i("object",i)?i.choices:array.from(i.getelementsbytagname("option")),l=n||math.floor((new date).valueof()*math.random()),h=!!i.disabled&&i.disabled;if(c){this._store.dispatch(se({value:i.label,id:l,active:!0,disabled:h}));c.foreach((function(e){var i=e.disabled||e.parentnode&&e.parentnode.disabled;t._addchoice({value:e[r],label:i("object",e)?e[a]:e.innerhtml,isselected:e.selected,isdisabled:i,groupid:l,customproperties:e.customproperties,placeholder:e.placeholder})}))}else this._store.dispatch(se({value:i.label,id:i.id,active:!1,disabled:i.disabled}))},r._gettemplate=function(e){var t;if(!e)return null;for(var i=this.config.classnames,n=arguments.length,s=new array(n>1?n-1:0),r=1;r