smart-admin/rc-busness/static/royalcanin-cdn-assets-new/css_js/royal-canin.pkg.choices.js
2022-01-11 11:57:54 +08:00

12 lines
84 KiB
JavaScript

(window["RCDLjsonFunction"]=window["RCDLjsonFunction"]||[]).push([[111],{842:function(e,t,i){
/*! choices.js v9.0.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(t,i){if(true)e.exports=i();else{}})(window,(function(){return function(e){var t={};function __webpack_require__(i){if(t[i]){return t[i].exports}var n=t[i]={i:i,l:false,exports:{}};e[i].call(n.exports,n,n.exports,__webpack_require__);n.l=true;return n.exports}__webpack_require__.m=e;__webpack_require__.c=t;__webpack_require__.d=function(e,t,i){if(!__webpack_require__.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:i})}};__webpack_require__.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})};__webpack_require__.t=function(e,t){if(t&1)e=__webpack_require__(e);if(t&8)return e;if(t&4&&typeof e==="object"&&e&&e.__esModule)return e;var i=Object.create(null);__webpack_require__.r(i);Object.defineProperty(i,"default",{enumerable:true,value:e});if(t&2&&typeof e!="string")for(var n in e)__webpack_require__.d(i,n,function(t){return e[t]}.bind(null,n));return i};__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e["default"]}:function getModuleExports(){return e};__webpack_require__.d(t,"a",t);return t};__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};__webpack_require__.p="/public/assets/scripts/";return __webpack_require__(__webpack_require__.s=4)}([function(e,t,i){"use strict";var n=function isMergeableObject(e){return isNonNullObject(e)&&!isSpecial(e)};function isNonNullObject(e){return!!e&&typeof e==="object"}function isSpecial(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||isReactElement(e)}var r=typeof Symbol==="function"&&Symbol.for;var s=r?Symbol.for("react.element"):60103;function isReactElement(e){return e.$$typeof===s}function emptyTarget(e){return Array.isArray(e)?[]:{}}function cloneUnlessOtherwiseSpecified(e,t){return t.clone!==false&&t.isMergeableObject(e)?deepmerge(emptyTarget(e),e,t):e}function defaultArrayMerge(e,t,i){return e.concat(t).map((function(e){return cloneUnlessOtherwiseSpecified(e,i)}))}function getMergeFunction(e,t){if(!t.customMerge){return deepmerge}var i=t.customMerge(e);return typeof i==="function"?i:deepmerge}function getEnumerableOwnPropertySymbols(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}function getKeys(e){return Object.keys(e).concat(getEnumerableOwnPropertySymbols(e))}function propertyIsUnsafe(e,t){try{return t in e&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}catch(e){return false}}function mergeObject(e,t,i){var n={};if(i.isMergeableObject(e)){getKeys(e).forEach((function(t){n[t]=cloneUnlessOtherwiseSpecified(e[t],i)}))}getKeys(t).forEach((function(r){if(propertyIsUnsafe(e,r)){return}if(!i.isMergeableObject(t[r])||!e[r]){n[r]=cloneUnlessOtherwiseSpecified(t[r],i)}else{n[r]=getMergeFunction(r,i)(e[r],t[r],i)}}));return n}function deepmerge(e,t,i){i=i||{};i.arrayMerge=i.arrayMerge||defaultArrayMerge;i.isMergeableObject=i.isMergeableObject||n;i.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var r=Array.isArray(t);var s=Array.isArray(e);var o=r===s;if(!o){return cloneUnlessOtherwiseSpecified(t,i)}else if(r){return i.arrayMerge(e,t,i)}else{return mergeObject(e,t,i)}}deepmerge.all=function deepmergeAll(e,t){if(!Array.isArray(e)){throw new Error("first argument should be an array")}return e.reduce((function(e,i){return deepmerge(e,i,t)}),{})};var o=deepmerge;e.exports=o},function(e,t,i){"use strict";(function(e,n){var r=i(3);var s;if(typeof self!=="undefined"){s=self}else if(typeof window!=="undefined"){s=window}else if(typeof e!=="undefined"){s=e}else if(true){s=n}else{}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
*/
!function(t,i){true?e.exports=i():undefined}(this,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(t,i,n){function r(e){return(r="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 o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=n(2),a=n(8),c=n(0),l=function(){function e(t,i){var n=i.location,r=void 0===n?0:n,s=i.distance,o=void 0===s?100:s,c=i.threshold,l=void 0===c?.6:c,u=i.maxPatternLength,h=void 0===u?32:u,d=i.caseSensitive,f=void 0!==d&&d,p=i.tokenSeparator,m=void 0===p?/ +/g:p,v=i.findAllMatches,g=void 0!==v&&v,_=i.minMatchCharLength,b=void 0===_?1:_,y=i.id,E=void 0===y?null:y,w=i.keys,I=void 0===w?[]:w,S=i.shouldSort,C=void 0===S||S,O=i.getFn,A=void 0===O?a:O,L=i.sortFn,T=void 0===L?function(e,t){return e.score-t.score}:L,P=i.tokenize,x=void 0!==P&&P,D=i.matchAllTokens,k=void 0!==D&&D,M=i.includeMatches,N=void 0!==M&&M,j=i.includeScore,F=void 0!==j&&j,K=i.verbose,R=void 0!==K&&K;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:r,distance:o,threshold:l,maxPatternLength:h,isCaseSensitive:f,tokenSeparator:m,findAllMatches:g,minMatchCharLength:b,id:E,keys:I,includeMatches:N,includeScore:F,shouldSort:C,getFn:A,sortFn:T,verbose:R,tokenize:x,matchAllTokens:k},this.setCollection(t)}var t,i,n;return t=e,(i=[{key:"setCollection",value:function(e){return this.list=e,e}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var i=this._prepareSearchers(e),n=i.tokenSearchers,r=i.fullSearcher,s=this._search(n,r),o=s.weights,a=s.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,r=i.length;n<r;n+=1)t.push(new s(i[n],this.options));return{tokenSearchers:t,fullSearcher:new s(e,this.options)}}},{key:"_search",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},r=[];if("string"==typeof i[0]){for(var s=0,o=i.length;s<o;s+=1)this._analyze({key:"",value:i[s],record:s,index:s},{resultMap:n,results:r,tokenSearchers:e,fullSearcher:t});return{weights:null,results:r}}for(var a={},c=0,l=i.length;c<l;c+=1)for(var u=i[c],h=0,d=this.options.keys.length;h<d;h+=1){var f=this.options.keys[h];if("string"!=typeof f){if(a[f.name]={weight:1-f.weight||1},f.weight<=0||f.weight>1)throw new Error("Key weight has to be > 0 and <= 1");f=f.name}else a[f]={weight:1};this._analyze({key:f,value:this.options.getFn(u,f),record:u,index:c},{resultMap:n,results:r,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:r}}},{key:"_analyze",value:function(e,t){var i=e.key,n=e.arrayIndex,r=void 0===n?-1:n,s=e.value,o=e.record,a=e.index,l=t.tokenSearchers,u=void 0===l?[]:l,h=t.fullSearcher,d=void 0===h?[]:h,f=t.resultMap,p=void 0===f?{}:f,m=t.results,v=void 0===m?[]:m;if(null!=s){var g=!1,_=-1,b=0;if("string"==typeof s){this._log("\nKey: ".concat(""===i?"-":i));var y=d.search(s);if(this._log('Full text: "'.concat(s,'", score: ').concat(y.score)),this.options.tokenize){for(var E=s.split(this.options.tokenSeparator),w=[],I=0;I<u.length;I+=1){var S=u[I];this._log('\nPattern: "'.concat(S.pattern,'"'));for(var C=!1,O=0;O<E.length;O+=1){var A=E[O],L=S.search(A),T={};L.isMatch?(T[A]=L.score,g=!0,C=!0,w.push(L.score)):(T[A]=1,this.options.matchAllTokens||w.push(1)),this._log('Token: "'.concat(A,'", score: ').concat(T[A]))}C&&(b+=1)}_=w[0];for(var P=w.length,x=1;x<P;x+=1)_+=w[x];_/=P,this._log("Token score average:",_)}var D=y.score;_>-1&&(D=(D+_)/2),this._log("Score average:",D);var k=!this.options.tokenize||!this.options.matchAllTokens||b>=u.length;if(this._log("\nCheck Matches: ".concat(k)),(g||y.isMatch)&&k){var M=p[a];M?M.output.push({key:i,arrayIndex:r,value:s,score:D,matchedIndices:y.matchedIndices}):(p[a]={item:o,output:[{key:i,arrayIndex:r,value:s,score:D,matchedIndices:y.matchedIndices}]},v.push(p[a]))}}else if(c(s))for(var N=0,j=s.length;N<j;N+=1)this._analyze({key:i,arrayIndex:N,value:s[N],record:o,index:a},{resultMap:p,results:v,tokenSearchers:u,fullSearcher:d})}}},{key:"_computeScore",value:function(e,t){this._log("\n\nComputing score:\n");for(var i=0,n=t.length;i<n;i+=1){for(var r=t[i].output,s=r.length,o=1,a=1,c=0;c<s;c+=1){var l=e?e[r[c].key].weight:1,u=(1===l?r[c].score:r[c].score||.001)*l;1!==l?a=Math.min(a,u):(r[c].nScore=u,o*=u)}t[i].score=1===a?o:a,this._log(t[i])}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];if(this.options.verbose){var i=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,(function(e,t){if("object"===r(t)&&null!==t){if(-1!==i.indexOf(t))return;i.push(t)}return t}))),i=null}var n=[];this.options.includeMatches&&n.push((function(e,t){var i=e.output;t.matches=[];for(var n=0,r=i.length;n<r;n+=1){var s=i[n];if(0!==s.matchedIndices.length){var o={indices:s.matchedIndices,value:s.value};s.key&&(o.key=s.key),s.hasOwnProperty("arrayIndex")&&s.arrayIndex>-1&&(o.arrayIndex=s.arrayIndex),t.matches.push(o)}}})),this.options.includeScore&&n.push((function(e,t){t.score=e.score}));for(var s=0,o=e.length;s<o;s+=1){var a=e[s];if(this.options.id&&(a.item=this.options.getFn(a.item,this.options.id)[0]),n.length){for(var c={item:a.item},l=0,u=n.length;l<u;l+=1)n[l](a,c);t.push(c)}else t.push(a.item)}return t}},{key:"_log",value:function(){var e;this.options.verbose&&(e=console).log.apply(e,arguments)}}])&&o(t.prototype,i),n&&o(t,n),e}();t.exports=l},function(t,i,n){function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=n(3),o=n(4),a=n(7),c=function(){function e(t,i){var n=i.location,r=void 0===n?0:n,s=i.distance,o=void 0===s?100:s,c=i.threshold,l=void 0===c?.6:c,u=i.maxPatternLength,h=void 0===u?32:u,d=i.isCaseSensitive,f=void 0!==d&&d,p=i.tokenSeparator,m=void 0===p?/ +/g:p,v=i.findAllMatches,g=void 0!==v&&v,_=i.minMatchCharLength,b=void 0===_?1:_;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:r,distance:o,threshold:l,maxPatternLength:h,isCaseSensitive:f,tokenSeparator:m,findAllMatches:g,minMatchCharLength:b},this.pattern=this.options.isCaseSensitive?t:t.toLowerCase(),this.pattern.length<=h&&(this.patternAlphabet=a(this.pattern))}var t,i,n;return t=e,(i=[{key:"search",value:function(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};var t=this.options,i=t.maxPatternLength,n=t.tokenSeparator;if(this.pattern.length>i)return s(e,this.pattern,n);var r=this.options,a=r.location,c=r.distance,l=r.threshold,u=r.findAllMatches,h=r.minMatchCharLength;return o(e,this.pattern,this.patternAlphabet,{location:a,distance:c,threshold:l,findAllMatches:u,minMatchCharLength:h})}}])&&r(t.prototype,i),n&&r(t,n),e}();t.exports=c},function(e,t){var i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(i,"\\$&").replace(n,"|")),s=e.match(r),o=!!s,a=[];if(o)for(var c=0,l=s.length;c<l;c+=1){var u=s[c];a.push([e.indexOf(u),u.length-1])}return{score:o?.5:1,isMatch:o,matchedIndices:a}}},function(e,t,i){var n=i(5),r=i(6);e.exports=function(e,t,i,s){for(var o=s.location,a=void 0===o?0:o,c=s.distance,l=void 0===c?100:c,u=s.threshold,h=void 0===u?.6:u,d=s.findAllMatches,f=void 0!==d&&d,p=s.minMatchCharLength,m=void 0===p?1:p,v=a,g=e.length,_=h,b=e.indexOf(t,v),y=t.length,E=[],w=0;w<g;w+=1)E[w]=0;if(-1!==b){var I=n(t,{errors:0,currentLocation:b,expectedLocation:v,distance:l});if(_=Math.min(I,_),-1!==(b=e.lastIndexOf(t,v+y))){var S=n(t,{errors:0,currentLocation:b,expectedLocation:v,distance:l});_=Math.min(S,_)}}b=-1;for(var C=[],O=1,A=y+g,L=1<<y-1,T=0;T<y;T+=1){for(var P=0,x=A;P<x;){n(t,{errors:T,currentLocation:v+x,expectedLocation:v,distance:l})<=_?P=x:A=x,x=Math.floor((A-P)/2+P)}A=x;var D=Math.max(1,v-x+1),k=f?g:Math.min(v+x,g)+y,M=Array(k+2);M[k+1]=(1<<T)-1;for(var N=k;N>=D;N-=1){var j=N-1,F=i[e.charAt(j)];if(F&&(E[j]=1),M[N]=(M[N+1]<<1|1)&F,0!==T&&(M[N]|=(C[N+1]|C[N])<<1|1|C[N+1]),M[N]&L&&(O=n(t,{errors:T,currentLocation:j,expectedLocation:v,distance:l}))<=_){if(_=O,(b=j)<=v)break;D=Math.max(1,2*v-b)}}if(n(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:l})>_)break;C=M}return{isMatch:b>=0,score:0===O?.001:O,matchedIndices:r(E,m)}}},function(e,t){e.exports=function(e,t){var i=t.errors,n=void 0===i?0:i,r=t.currentLocation,s=void 0===r?0:r,o=t.expectedLocation,a=void 0===o?0:o,c=t.distance,l=void 0===c?100:c,u=n/e.length,h=Math.abs(a-s);return l?u+h/l:h?1:u}},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,r=-1,s=0,o=e.length;s<o;s+=1){var a=e[s];a&&-1===n?n=s:a||-1===n||((r=s-1)-n+1>=t&&i.push([n,r]),n=-1)}return e[s-1]&&s-n>=t&&i.push([n,s-1]),i}},function(e,t){e.exports=function(e){for(var t={},i=e.length,n=0;n<i;n+=1)t[e.charAt(n)]=0;for(var r=0;r<i;r+=1)t[e.charAt(r)]|=1<<i-r-1;return t}},function(t,i,n){var r=n(0);t.exports=function(e,t){return function e(t,i,n){if(i){var s=i.indexOf("."),o=i,a=null;-1!==s&&(o=i.slice(0,s),a=i.slice(s+1));var c=t[o];if(null!=c)if(a||"string"!=typeof c&&"number"!=typeof c)if(r(c))for(var l=0,u=c.length;l<u;l+=1)e(c[l],a,n);else a&&e(c,a,n);else n.push(c.toString())}else n.push(t);return n}(e,t,[])}}])}))},function(e,t,i){"use strict";i.d(t,"a",(function(){return symbolObservablePonyfill}));function symbolObservablePonyfill(e){var t;var i=e.Symbol;if(typeof i==="function"){if(i.observable){t=i.observable}else{t=i("observable");i.observable=t}}else{t="@@observable"}return t}},function(e,t,i){e.exports=i(7)},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){if(typeof window==="object")i=window}e.exports=i},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);if(!t.children)t.children=[];Object.defineProperty(t,"loaded",{enumerable:true,get:function(){return t.l}});Object.defineProperty(t,"id",{enumerable:true,get:function(){return t.i}});Object.defineProperty(t,"exports",{enumerable:true});t.webpackPolyfill=1}return t}},function(e,t,i){"use strict";i.r(t);var n=i(2);var r=i.n(n);var s=i(0);var o=i.n(s);var a=i(1);var c=function randomString(){return Math.random().toString(36).substring(7).split("").join(".")};var l={INIT:"@@redux/INIT"+c(),REPLACE:"@@redux/REPLACE"+c(),PROBE_UNKNOWN_ACTION:function PROBE_UNKNOWN_ACTION(){return"@@redux/PROBE_UNKNOWN_ACTION"+c()}};function isPlainObject(e){if(typeof e!=="object"||e===null)return false;var t=e;while(Object.getPrototypeOf(t)!==null){t=Object.getPrototypeOf(t)}return Object.getPrototypeOf(e)===t}function createStore(e,t,i){var n;if(typeof t==="function"&&typeof i==="function"||typeof i==="function"&&typeof arguments[3]==="function"){throw new Error("It looks like you are passing several store enhancers to "+"createStore(). This is not supported. Instead, compose them "+"together to a single function.")}if(typeof t==="function"&&typeof i==="undefined"){i=t;t=undefined}if(typeof i!=="undefined"){if(typeof i!=="function"){throw new Error("Expected the enhancer to be a function.")}return i(createStore)(e,t)}if(typeof e!=="function"){throw new Error("Expected the reducer to be a function.")}var r=e;var s=t;var o=[];var c=o;var u=false;function ensureCanMutateNextListeners(){if(c===o){c=o.slice()}}function getState(){if(u){throw new Error("You may not call store.getState() while the reducer is executing. "+"The reducer has already received the state as an argument. "+"Pass it down from the top reducer instead of reading it from the store.")}return s}function subscribe(e){if(typeof e!=="function"){throw new Error("Expected the listener to be a function.")}if(u){throw new Error("You may not call store.subscribe() while the reducer is executing. "+"If you would like to be notified after the store has been updated, subscribe from a "+"component and invoke store.getState() in the callback to access the latest state. "+"See https://redux.js.org/api-reference/store#subscribe(listener) for more details.")}var t=true;ensureCanMutateNextListeners();c.push(e);return function unsubscribe(){if(!t){return}if(u){throw new Error("You may not unsubscribe from a store listener while the reducer is executing. "+"See https://redux.js.org/api-reference/store#subscribe(listener) for more details.")}t=false;ensureCanMutateNextListeners();var i=c.indexOf(e);c.splice(i,1)}}function dispatch(e){if(!isPlainObject(e)){throw new Error("Actions must be plain objects. "+"Use custom middleware for async actions.")}if(typeof e.type==="undefined"){throw new Error('Actions may not have an undefined "type" property. '+"Have you misspelled a constant?")}if(u){throw new Error("Reducers may not dispatch actions.")}try{u=true;s=r(s,e)}finally{u=false}var t=o=c;for(var i=0;i<t.length;i++){var n=t[i];n()}return e}function replaceReducer(e){if(typeof e!=="function"){throw new Error("Expected the nextReducer to be a function.")}r=e;dispatch({type:l.REPLACE})}function observable(){var e;var t=subscribe;return e={subscribe:function subscribe(e){if(typeof e!=="object"||e===null){throw new TypeError("Expected the observer to be an object.")}function observeState(){if(e.next){e.next(getState())}}observeState();var i=t(observeState);return{unsubscribe:i}}},e[a["a"]]=function(){return this},e}dispatch({type:l.INIT});return n={dispatch:dispatch,subscribe:subscribe,getState:getState,replaceReducer:replaceReducer},n[a["a"]]=observable,n}function warning(e){if(typeof console!=="undefined"&&typeof console.error==="function"){console.error(e)}try{throw new Error(e)}catch(e){}}function getUndefinedStateErrorMessage(e,t){var i=t&&t.type;var n=i&&'action "'+String(i)+'"'||"an action";return"Given "+n+', reducer "'+e+'" returned undefined. '+"To ignore an action, you must explicitly return the previous state. "+"If you want this reducer to hold no value, you can return null instead of undefined."}function getUnexpectedStateShapeWarningMessage(e,t,i,n){var r=Object.keys(t);var s=i&&i.type===l.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(r.length===0){return"Store does not have a valid reducer. Make sure the argument passed "+"to combineReducers is an object whose values are reducers."}if(!isPlainObject(e)){return"The "+s+' has unexpected type of "'+{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1]+'". Expected argument to be an object with the following '+('keys: "'+r.join('", "')+'"')}var o=Object.keys(e).filter((function(e){return!t.hasOwnProperty(e)&&!n[e]}));o.forEach((function(e){n[e]=true}));if(i&&i.type===l.REPLACE)return;if(o.length>0){return"Unexpected "+(o.length>1?"keys":"key")+" "+('"'+o.join('", "')+'" found in '+s+". ")+"Expected to find one of the known reducer keys instead: "+('"'+r.join('", "')+'". Unexpected keys will be ignored.')}}function assertReducerShape(e){Object.keys(e).forEach((function(t){var i=e[t];var n=i(undefined,{type:l.INIT});if(typeof n==="undefined"){throw new Error('Reducer "'+t+'" returned undefined during initialization. '+"If the state passed to the reducer is undefined, you must "+"explicitly return the initial state. The initial state may "+"not be undefined. If you don't want to set a value for this reducer, "+"you can use null instead of undefined.")}if(typeof i(undefined,{type:l.PROBE_UNKNOWN_ACTION()})==="undefined"){throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+l.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the "+"current state for any unknown actions, unless it is undefined, "+"in which case you must return the initial state, regardless of the "+"action type. The initial state may not be undefined, but can be null.")}}))}function combineReducers(e){var t=Object.keys(e);var i={};for(var n=0;n<t.length;n++){var r=t[n];if(false){}if(typeof e[r]==="function"){i[r]=e[r]}}var s=Object.keys(i);var o;if(false){}var a;try{assertReducerShape(i)}catch(e){a=e}return function combination(e,t){if(e===void 0){e={}}if(a){throw a}if(false){var n}var r=false;var o={};for(var c=0;c<s.length;c++){var l=s[c];var u=i[l];var h=e[l];var d=u(h,t);if(typeof d==="undefined"){var f=getUndefinedStateErrorMessage(l,t);throw new Error(f)}o[l]=d;r=r||d!==h}return r?o:e}}function bindActionCreator(e,t){return function(){return t(e.apply(this,arguments))}}function bindActionCreators(e,t){if(typeof e==="function"){return bindActionCreator(e,t)}if(typeof e!=="object"||e===null){throw new Error("bindActionCreators expected an object or a function, instead received "+(e===null?"null":typeof e)+". "+'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?')}var i={};for(var n in e){var r=e[n];if(typeof r==="function"){i[n]=bindActionCreator(r,t)}}return i}function _defineProperty(e,t,i){if(t in e){Object.defineProperty(e,t,{value:i,enumerable:true,configurable:true,writable:true})}else{e[t]=i}return e}function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){i.push.apply(i,Object.getOwnPropertySymbols(e))}if(t)i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}));return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};if(t%2){ownKeys(i,true).forEach((function(t){_defineProperty(e,t,i[t])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(i))}else{ownKeys(i).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}}return e}function compose(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++){t[i]=arguments[i]}if(t.length===0){return function(e){return e}}if(t.length===1){return t[0]}return t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function applyMiddleware(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++){t[i]=arguments[i]}return function(e){return function(){var i=e.apply(void 0,arguments);var n=function dispatch(){throw new Error("Dispatching while constructing your middleware is not allowed. "+"Other middleware would not be applied to this dispatch.")};var r={getState:i.getState,dispatch:function dispatch(){return n.apply(void 0,arguments)}};var s=t.map((function(e){return e(r)}));n=compose.apply(void 0,s)(i.dispatch);return _objectSpread2({},i,{dispatch:n})}}}function isCrushed(){}if(false){}var u=[];function items_items(e,t){if(e===void 0){e=u}switch(t.type){case"ADD_ITEM":{var i=[].concat(e,[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:true,highlighted:false,customProperties:t.customProperties,placeholder:t.placeholder||false,keyCode:null}]);return i.map((function(e){var t=e;t.highlighted=false;return t}))}case"REMOVE_ITEM":{return e.map((function(e){var i=e;if(i.id===t.id){i.active=false}return i}))}case"HIGHLIGHT_ITEM":{return e.map((function(e){var i=e;if(i.id===t.id){i.highlighted=t.highlighted}return i}))}default:{return e}}}var h=[];function groups(e,t){if(e===void 0){e=h}switch(t.type){case"ADD_GROUP":{return[].concat(e,[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}])}case"CLEAR_CHOICES":{return[]}default:{return e}}}var d=[];function choices_choices(e,t){if(e===void 0){e=d}switch(t.type){case"ADD_CHOICE":{return[].concat(e,[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||false,selected:false,active:true,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||false,keyCode:null}])}case"ADD_ITEM":{if(t.activateOptions){return e.map((function(e){var i=e;i.active=t.active;return i}))}if(t.choiceId>-1){return e.map((function(e){var i=e;if(i.id===parseInt(t.choiceId,10)){i.selected=true}return i}))}return e}case"REMOVE_ITEM":{if(t.choiceId>-1){return e.map((function(e){var i=e;if(i.id===parseInt(t.choiceId,10)){i.selected=false}return i}))}return e}case"FILTER_CHOICES":{return e.map((function(e){var i=e;i.active=t.results.some((function(e){var t=e.item,n=e.score;if(t.id===i.id){i.score=n;return true}return false}));return i}))}case"ACTIVATE_CHOICES":{return e.map((function(e){var i=e;i.active=t.active;return i}))}case"CLEAR_CHOICES":{return d}default:{return e}}}var f={loading:false};var p=function general(e,t){if(e===void 0){e=f}switch(t.type){case"SET_IS_LOADING":{return{loading:t.isLoading}}default:{return e}}};var m=p;var v=function getRandomNumber(e,t){return Math.floor(Math.random()*(t-e)+e)};var g=function generateChars(e){return Array.from({length:e},(function(){return v(0,36).toString(36)})).join("")};var _=function generateId(e,t){var i=e.id||e.name&&e.name+"-"+g(2)||g(4);i=i.replace(/(:|\.|\[|\]|,)/g,"");i=t+"-"+i;return i};var b=function getType(e){return Object.prototype.toString.call(e).slice(8,-1)};var y=function isType(e,t){return t!==undefined&&t!==null&&b(t)===e};var E=function wrap(e,t){if(t===void 0){t=document.createElement("div")}if(e.nextSibling){e.parentNode.insertBefore(t,e.nextSibling)}else{e.parentNode.appendChild(t)}return t.appendChild(e)};var w=function getAdjacentEl(e,t,i){if(i===void 0){i=1}if(!(e instanceof Element)||typeof t!=="string"){return undefined}var n=(i>0?"next":"previous")+"ElementSibling";var r=e[n];while(r){if(r.matches(t)){return r}r=r[n]}return r};var I=function isScrolledIntoView(e,t,i){if(i===void 0){i=1}if(!e){return false}var n;if(i>0){n=t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight}else{n=e.offsetTop>=t.scrollTop}return n};var S=function sanitise(e){if(typeof e!=="string"){return e}return e.replace(/&/g,"&amp;").replace(/>/g,"&rt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")};var C=function(){var e=document.createElement("div");return function(t){var i=t.trim();e.innerHTML=i;var n=e.children[0];while(e.firstChild){e.removeChild(e.firstChild)}return n}}();var O=function sortByAlpha(e,t){var i=e.value,n=e.label,r=n===void 0?i:n;var s=t.value,o=t.label,a=o===void 0?s:o;return r.localeCompare(a,[],{sensitivity:"base",ignorePunctuation:true,numeric:true})};var A=function sortByScore(e,t){return e.score-t.score};var L=function dispatchEvent(e,t,i){if(i===void 0){i=null}var n=new CustomEvent(t,{detail:i,bubbles:true,cancelable:true});return e.dispatchEvent(n)};var T=function existsInArray(e,t,i){if(i===void 0){i="value"}return e.some((function(e){if(typeof t==="string"){return e[i]===t.trim()}return e[i]===t}))};var P=function cloneObject(e){return JSON.parse(JSON.stringify(e))};var x=function diff(e,t){var i=Object.keys(e).sort();var n=Object.keys(t).sort();return i.filter((function(e){return n.indexOf(e)<0}))};var D=combineReducers({items:items_items,groups:groups,choices:choices_choices,general:m});var k=function rootReducer(e,t){var i=e;if(t.type==="CLEAR_ALL"){i=undefined}else if(t.type==="RESET_TO"){return P(t.state)}return D(i,t)};var M=k;function _defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function _createClass(e,t,i){if(t)_defineProperties(e.prototype,t);if(i)_defineProperties(e,i);return e}var N=function(){function Store(){this._store=createStore(M,window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__())}var e=Store.prototype;e.subscribe=function subscribe(e){this._store.subscribe(e)};e.dispatch=function dispatch(e){this._store.dispatch(e)};e.isLoading=function isLoading(){return this.state.general.loading};e.getChoiceById=function getChoiceById(e){return this.activeChoices.find((function(t){return t.id===parseInt(e,10)}))};e.getGroupById=function getGroupById(e){return this.groups.find((function(t){return t.id===e}))};_createClass(Store,[{key:"state",get:function get(){return this._store.getState()}},{key:"items",get:function get(){return this.state.items}},{key:"activeItems",get:function get(){return this.items.filter((function(e){return e.active===true}))}},{key:"highlightedActiveItems",get:function get(){return this.items.filter((function(e){return e.active&&e.highlighted}))}},{key:"choices",get:function get(){return this.state.choices}},{key:"activeChoices",get:function get(){return this.choices.filter((function(e){return e.active===true}))}},{key:"selectableChoices",get:function get(){return this.choices.filter((function(e){return e.disabled!==true}))}},{key:"searchableChoices",get:function get(){return this.selectableChoices.filter((function(e){return e.placeholder!==true}))}},{key:"placeholderChoice",get:function get(){return[].concat(this.choices).reverse().find((function(e){return e.placeholder===true}))}},{key:"groups",get:function get(){return this.state.groups}},{key:"activeGroups",get:function get(){var e=this.groups,t=this.choices;return e.filter((function(e){var i=e.active===true&&e.disabled===false;var n=t.some((function(e){return e.active===true&&e.disabled===false}));return i&&n}),[])}}]);return Store}();function dropdown_defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function dropdown_createClass(e,t,i){if(t)dropdown_defineProperties(e.prototype,t);if(i)dropdown_defineProperties(e,i);return e}var j=function(){function Dropdown(e){var t=e.element,i=e.type,n=e.classNames;this.element=t;this.classNames=n;this.type=i;this.isActive=false}var e=Dropdown.prototype;e.getChild=function getChild(e){return this.element.querySelector(e)};e.show=function show(){this.element.classList.add(this.classNames.activeState);this.element.setAttribute("aria-expanded","true");this.isActive=true;return this};e.hide=function hide(){this.element.classList.remove(this.classNames.activeState);this.element.setAttribute("aria-expanded","false");this.isActive=false;return this};dropdown_createClass(Dropdown,[{key:"distanceFromTopWindow",get:function get(){return this.element.getBoundingClientRect().bottom}}]);return Dropdown}();var F={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"};var K={items:[],choices:[],silent:false,renderChoiceLimit:-1,maxItemCount:-1,addItems:true,addItemFilter:null,removeItems:true,removeItemButton:false,editItems:false,duplicateItemsAllowed:true,delimiter:",",paste:true,searchEnabled:true,searchChoices:true,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:true,shouldSort:true,shouldSortItems:false,sorter:O,placeholder:true,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function addItemText(e){return'Press Enter to add <b>"'+S(e)+'"</b>'},maxItemText:function maxItemText(e){return"Only "+e+" values can be added"},valueComparer:function valueComparer(e,t){return e===t},fuseOptions:{includeScore:true},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:F};var R={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"};var H={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"};var B={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34};var G="text";var V="select-one";var U="select-multiple";var q=4;var W=function(){function Container(e){var t=e.element,i=e.type,n=e.classNames,r=e.position;this.element=t;this.classNames=n;this.type=i;this.position=r;this.isOpen=false;this.isFlipped=false;this.isFocussed=false;this.isDisabled=false;this.isLoading=false;this._onFocus=this._onFocus.bind(this);this._onBlur=this._onBlur.bind(this)}var e=Container.prototype;e.addEventListeners=function addEventListeners(){this.element.addEventListener("focus",this._onFocus);this.element.addEventListener("blur",this._onBlur)};e.removeEventListeners=function removeEventListeners(){this.element.removeEventListener("focus",this._onFocus);this.element.removeEventListener("blur",this._onBlur)};e.shouldFlip=function shouldFlip(e){if(typeof e!=="number"){return false}var shouldFlip=false;if(this.position==="auto"){shouldFlip=!window.matchMedia("(min-height: "+(e+1)+"px)").matches}else if(this.position==="top"){shouldFlip=true}return shouldFlip};e.setActiveDescendant=function setActiveDescendant(e){this.element.setAttribute("aria-activedescendant",e)};e.removeActiveDescendant=function removeActiveDescendant(){this.element.removeAttribute("aria-activedescendant")};e.open=function open(e){this.element.classList.add(this.classNames.openState);this.element.setAttribute("aria-expanded","true");this.isOpen=true;if(this.shouldFlip(e)){this.element.classList.add(this.classNames.flippedState);this.isFlipped=true}};e.close=function close(){this.element.classList.remove(this.classNames.openState);this.element.setAttribute("aria-expanded","false");this.removeActiveDescendant();this.isOpen=false;if(this.isFlipped){this.element.classList.remove(this.classNames.flippedState);this.isFlipped=false}};e.focus=function focus(){if(!this.isFocussed){this.element.focus()}};e.addFocusState=function addFocusState(){this.element.classList.add(this.classNames.focusState)};e.removeFocusState=function removeFocusState(){this.element.classList.remove(this.classNames.focusState)};e.enable=function enable(){this.element.classList.remove(this.classNames.disabledState);this.element.removeAttribute("aria-disabled");if(this.type===V){this.element.setAttribute("tabindex","0")}this.isDisabled=false};e.disable=function disable(){this.element.classList.add(this.classNames.disabledState);this.element.setAttribute("aria-disabled","true");if(this.type===V){this.element.setAttribute("tabindex","-1")}this.isDisabled=true};e.wrap=function wrap(e){E(e,this.element)};e.unwrap=function unwrap(e){this.element.parentNode.insertBefore(e,this.element);this.element.parentNode.removeChild(this.element)};e.addLoadingState=function addLoadingState(){this.element.classList.add(this.classNames.loadingState);this.element.setAttribute("aria-busy","true");this.isLoading=true};e.removeLoadingState=function removeLoadingState(){this.element.classList.remove(this.classNames.loadingState);this.element.removeAttribute("aria-busy");this.isLoading=false};e._onFocus=function _onFocus(){this.isFocussed=true};e._onBlur=function _onBlur(){this.isFocussed=false};return Container}();function input_defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function input_createClass(e,t,i){if(t)input_defineProperties(e.prototype,t);if(i)input_defineProperties(e,i);return e}var Y=function(){function Input(e){var t=e.element,i=e.type,n=e.classNames,r=e.preventPaste;this.element=t;this.type=i;this.classNames=n;this.preventPaste=r;this.isFocussed=this.element===document.activeElement;this.isDisabled=t.disabled;this._onPaste=this._onPaste.bind(this);this._onInput=this._onInput.bind(this);this._onFocus=this._onFocus.bind(this);this._onBlur=this._onBlur.bind(this)}var e=Input.prototype;e.addEventListeners=function addEventListeners(){this.element.addEventListener("paste",this._onPaste);this.element.addEventListener("input",this._onInput,{passive:true});this.element.addEventListener("focus",this._onFocus,{passive:true});this.element.addEventListener("blur",this._onBlur,{passive:true})};e.removeEventListeners=function removeEventListeners(){this.element.removeEventListener("input",this._onInput,{passive:true});this.element.removeEventListener("paste",this._onPaste);this.element.removeEventListener("focus",this._onFocus,{passive:true});this.element.removeEventListener("blur",this._onBlur,{passive:true})};e.enable=function enable(){this.element.removeAttribute("disabled");this.isDisabled=false};e.disable=function disable(){this.element.setAttribute("disabled","");this.isDisabled=true};e.focus=function focus(){if(!this.isFocussed){this.element.focus()}};e.blur=function blur(){if(this.isFocussed){this.element.blur()}};e.clear=function clear(e){if(e===void 0){e=true}if(this.element.value){this.element.value=""}if(e){this.setWidth()}return this};e.setWidth=function setWidth(){var e=this.element,t=e.style,i=e.value,n=e.placeholder;t.minWidth=n.length+1+"ch";t.width=i.length+1+"ch"};e.setActiveDescendant=function setActiveDescendant(e){this.element.setAttribute("aria-activedescendant",e)};e.removeActiveDescendant=function removeActiveDescendant(){this.element.removeAttribute("aria-activedescendant")};e._onInput=function _onInput(){if(this.type!==V){this.setWidth()}};e._onPaste=function _onPaste(e){if(this.preventPaste){e.preventDefault()}};e._onFocus=function _onFocus(){this.isFocussed=true};e._onBlur=function _onBlur(){this.isFocussed=false};input_createClass(Input,[{key:"placeholder",set:function set(e){this.element.placeholder=e}},{key:"value",get:function get(){return S(this.element.value)},set:function set(e){this.element.value=e}}]);return Input}();var z=function(){function List(e){var t=e.element;this.element=t;this.scrollPos=this.element.scrollTop;this.height=this.element.offsetHeight}var e=List.prototype;e.clear=function clear(){this.element.innerHTML=""};e.append=function append(e){this.element.appendChild(e)};e.getChild=function getChild(e){return this.element.querySelector(e)};e.hasChildren=function hasChildren(){return this.element.hasChildNodes()};e.scrollToTop=function scrollToTop(){this.element.scrollTop=0};e.scrollToChildElement=function scrollToChildElement(e,t){var i=this;if(!e){return}var n=this.element.offsetHeight;var r=this.element.scrollTop+n;var s=e.offsetHeight;var o=e.offsetTop+s;var a=t>0?this.element.scrollTop+o-r:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,t)}))};e._scrollDown=function _scrollDown(e,t,i){var n=(i-e)/t;var r=n>1?n:1;this.element.scrollTop=e+r};e._scrollUp=function _scrollUp(e,t,i){var n=(e-i)/t;var r=n>1?n:1;this.element.scrollTop=e-r};e._animateScroll=function _animateScroll(e,t){var i=this;var n=q;var r=this.element.scrollTop;var s=false;if(t>0){this._scrollDown(r,n,e);if(r<e){s=true}}else{this._scrollUp(r,n,e);if(r>e){s=true}}if(s){requestAnimationFrame((function(){i._animateScroll(e,t)}))}};return List}();function wrapped_element_defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function wrapped_element_createClass(e,t,i){if(t)wrapped_element_defineProperties(e.prototype,t);if(i)wrapped_element_defineProperties(e,i);return e}var X=function(){function WrappedElement(e){var t=e.element,i=e.classNames;this.element=t;this.classNames=i;if(!(t instanceof HTMLInputElement)&&!(t instanceof HTMLSelectElement)){throw new TypeError("Invalid element passed")}this.isDisabled=false}var e=WrappedElement.prototype;e.conceal=function conceal(){this.element.classList.add(this.classNames.input);this.element.hidden=true;this.element.tabIndex=-1;var e=this.element.getAttribute("style");if(e){this.element.setAttribute("data-choice-orig-style",e)}this.element.setAttribute("data-choice","active")};e.reveal=function reveal(){this.element.classList.remove(this.classNames.input);this.element.hidden=false;this.element.removeAttribute("tabindex");var e=this.element.getAttribute("data-choice-orig-style");if(e){this.element.removeAttribute("data-choice-orig-style");this.element.setAttribute("style",e)}else{this.element.removeAttribute("style")}this.element.removeAttribute("data-choice");this.element.value=this.element.value};e.enable=function enable(){this.element.removeAttribute("disabled");this.element.disabled=false;this.isDisabled=false};e.disable=function disable(){this.element.setAttribute("disabled","");this.element.disabled=true;this.isDisabled=true};e.triggerEvent=function triggerEvent(e,t){L(this.element,e,t)};wrapped_element_createClass(WrappedElement,[{key:"isActive",get:function get(){return this.element.dataset.choice==="active"}},{key:"dir",get:function get(){return this.element.dir}},{key:"value",get:function get(){return this.element.value},set:function set(e){this.element.value=e}}]);return WrappedElement}();function wrapped_input_defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function wrapped_input_createClass(e,t,i){if(t)wrapped_input_defineProperties(e.prototype,t);if(i)wrapped_input_defineProperties(e,i);return e}function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype);e.prototype.constructor=e;e.__proto__=t}var $=function(e){_inheritsLoose(WrappedInput,e);function WrappedInput(t){var i;var n=t.element,r=t.classNames,s=t.delimiter;i=e.call(this,{element:n,classNames:r})||this;i.delimiter=s;return i}wrapped_input_createClass(WrappedInput,[{key:"value",get:function get(){return this.element.value},set:function set(e){var t=e.map((function(e){var t=e.value;return t}));var i=t.join(this.delimiter);this.element.setAttribute("value",i);this.element.value=i}}]);return WrappedInput}(X);function wrapped_select_defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function wrapped_select_createClass(e,t,i){if(t)wrapped_select_defineProperties(e.prototype,t);if(i)wrapped_select_defineProperties(e,i);return e}function wrapped_select_inheritsLoose(e,t){e.prototype=Object.create(t.prototype);e.prototype.constructor=e;e.__proto__=t}var J=function(e){wrapped_select_inheritsLoose(WrappedSelect,e);function WrappedSelect(t){var i;var n=t.element,r=t.classNames,s=t.template;i=e.call(this,{element:n,classNames:r})||this;i.template=s;return i}var t=WrappedSelect.prototype;t.appendDocFragment=function appendDocFragment(e){this.element.innerHTML="";this.element.appendChild(e)};wrapped_select_createClass(WrappedSelect,[{key:"placeholderOption",get:function get(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")}},{key:"optionGroups",get:function get(){return Array.from(this.element.getElementsByTagName("OPTGROUP"))}},{key:"options",get:function get(){return Array.from(this.element.options)},set:function set(e){var t=this;var i=document.createDocumentFragment();var n=function addOptionToFragment(e){var n=t.template(e);i.appendChild(n)};e.forEach((function(e){return n(e)}));this.appendDocFragment(i)}}]);return WrappedSelect}(X);var Z={containerOuter:function containerOuter(e,t,i,n,r,s){var o=e.containerOuter;var a=Object.assign(document.createElement("div"),{className:o});a.dataset.type=s;if(t){a.dir=t}if(n){a.tabIndex=0}if(i){a.setAttribute("role",r?"combobox":"listbox");if(r){a.setAttribute("aria-autocomplete","list")}}a.setAttribute("aria-haspopup","true");a.setAttribute("aria-expanded","false");return a},containerInner:function containerInner(e){var t=e.containerInner;return Object.assign(document.createElement("div"),{className:t})},itemList:function itemList(e,t){var i=e.list,n=e.listSingle,r=e.listItems;return Object.assign(document.createElement("div"),{className:i+" "+(t?n:r)})},placeholder:function placeholder(e,t){var i=e.placeholder;return Object.assign(document.createElement("div"),{className:i,innerHTML:t})},item:function item(e,t,i){var n=e.item,r=e.button,s=e.highlightedState,o=e.itemSelectable,a=e.placeholder;var c=t.id,l=t.value,u=t.label,h=t.customProperties,d=t.active,f=t.disabled,p=t.highlighted,m=t.placeholder;var v=Object.assign(document.createElement("div"),{className:n,innerHTML:u});Object.assign(v.dataset,{item:"",id:c,value:l,customProperties:h});if(d){v.setAttribute("aria-selected","true")}if(f){v.setAttribute("aria-disabled","true")}if(m){v.classList.add(a)}v.classList.add(p?s:o);if(i){if(f){v.classList.remove(o)}v.dataset.deletable="";var g="Remove item";var _=Object.assign(document.createElement("button"),{type:"button",className:r,innerHTML:g});_.setAttribute("aria-label",g+": '"+l+"'");_.dataset.button="";v.appendChild(_)}return v},choiceList:function choiceList(e,t){var i=e.list;var n=Object.assign(document.createElement("div"),{className:i});if(!t){n.setAttribute("aria-multiselectable","true")}n.setAttribute("role","listbox");return n},choiceGroup:function choiceGroup(e,t){var i=e.group,n=e.groupHeading,r=e.itemDisabled;var s=t.id,o=t.value,a=t.disabled;var c=Object.assign(document.createElement("div"),{className:i+" "+(a?r:"")});c.setAttribute("role","group");Object.assign(c.dataset,{group:"",id:s,value:o});if(a){c.setAttribute("aria-disabled","true")}c.appendChild(Object.assign(document.createElement("div"),{className:n,innerHTML:o}));return c},choice:function choice(e,t,i){var n=e.item,r=e.itemChoice,s=e.itemSelectable,o=e.selectedState,a=e.itemDisabled,c=e.placeholder;var l=t.id,u=t.value,h=t.label,d=t.groupId,f=t.elementId,p=t.disabled,m=t.selected,v=t.placeholder;var g=Object.assign(document.createElement("div"),{id:f,innerHTML:h,className:n+" "+r});if(m){g.classList.add(o)}if(v){g.classList.add(c)}g.setAttribute("role",d>0?"treeitem":"option");Object.assign(g.dataset,{choice:"",id:l,value:u,selectText:i});if(p){g.classList.add(a);g.dataset.choiceDisabled="";g.setAttribute("aria-disabled","true")}else{g.classList.add(s);g.dataset.choiceSelectable=""}return g},input:function input(e,t){var i=e.input,n=e.inputCloned;var r=Object.assign(document.createElement("input"),{type:"text",className:i+" "+n,autocomplete:"off",autocapitalize:"off",spellcheck:false});r.setAttribute("role","textbox");r.setAttribute("aria-autocomplete","list");r.setAttribute("aria-label",t);return r},dropdown:function dropdown(e){var t=e.list,i=e.listDropdown;var n=document.createElement("div");n.classList.add(t,i);n.setAttribute("aria-expanded","false");return n},notice:function notice(e,t,i){var n=e.item,r=e.itemChoice,s=e.noResults,o=e.noChoices;if(i===void 0){i=""}var a=[n,r];if(i==="no-choices"){a.push(o)}else if(i==="no-results"){a.push(s)}return Object.assign(document.createElement("div"),{innerHTML:t,className:a.join(" ")})},option:function option(e){var t=e.label,i=e.value,n=e.customProperties,r=e.active,s=e.disabled;var o=new Option(t,i,false,r);if(n){o.dataset.customProperties=n}o.disabled=s;return o}};var Q=Z;var ee=function addChoice(e){var t=e.value,i=e.label,n=e.id,r=e.groupId,s=e.disabled,o=e.elementId,a=e.customProperties,c=e.placeholder,l=e.keyCode;return{type:H.ADD_CHOICE,value:t,label:i,id:n,groupId:r,disabled:s,elementId:o,customProperties:a,placeholder:c,keyCode:l}};var te=function filterChoices(e){return{type:H.FILTER_CHOICES,results:e}};var ie=function activateChoices(e){if(e===void 0){e=true}return{type:H.ACTIVATE_CHOICES,active:e}};var ne=function clearChoices(){return{type:H.CLEAR_CHOICES}};var re=function addItem(e){var t=e.value,i=e.label,n=e.id,r=e.choiceId,s=e.groupId,o=e.customProperties,a=e.placeholder,c=e.keyCode;return{type:H.ADD_ITEM,value:t,label:i,id:n,choiceId:r,groupId:s,customProperties:o,placeholder:a,keyCode:c}};var se=function removeItem(e,t){return{type:H.REMOVE_ITEM,id:e,choiceId:t}};var oe=function highlightItem(e,t){return{type:H.HIGHLIGHT_ITEM,id:e,highlighted:t}};var ae=function addGroup(e){var t=e.value,i=e.id,n=e.active,r=e.disabled;return{type:H.ADD_GROUP,value:t,id:i,active:n,disabled:r}};var ce=function clearAll(){return{type:"CLEAR_ALL"}};var le=function resetTo(e){return{type:"RESET_TO",state:e}};var ue=function setIsLoading(e){return{type:"SET_IS_LOADING",isLoading:e}};function choices_defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function choices_createClass(e,t,i){if(t)choices_defineProperties(e.prototype,t);if(i)choices_defineProperties(e,i);return e}var he="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style;var de={};var fe=function(){choices_createClass(Choices,null,[{key:"defaults",get:function get(){return Object.preventExtensions({get options(){return de},get templates(){return Z}})}}]);function Choices(e,t){var i=this;if(e===void 0){e="[data-choice]"}if(t===void 0){t={}}this.config=o.a.all([K,Choices.defaults.options,t],{arrayMerge:function arrayMerge(e,t){return[].concat(t)}});var n=x(this.config,K);if(n.length){console.warn("Unknown config option(s) passed",n.join(", "))}var r=typeof e==="string"?document.querySelector(e):e;if(!(r instanceof HTMLInputElement||r instanceof HTMLSelectElement)){throw TypeError("Expected one of the following types text|select-one|select-multiple")}this._isTextElement=r.type===G;this._isSelectOneElement=r.type===V;this._isSelectMultipleElement=r.type===U;this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement;this.config.searchEnabled=this._isSelectMultipleElement||this.config.searchEnabled;if(!["auto","always"].includes(this.config.renderSelectedChoices)){this.config.renderSelectedChoices="auto"}if(t.addItemFilter&&typeof t.addItemFilter!=="function"){var s=t.addItemFilter instanceof RegExp?t.addItemFilter:new RegExp(t.addItemFilter);this.config.addItemFilter=s.test.bind(s)}if(this._isTextElement){this.passedElement=new $({element:r,classNames:this.config.classNames,delimiter:this.config.delimiter})}else{this.passedElement=new J({element:r,classNames:this.config.classNames,template:function template(e){return i._templates.option(e)}})}this.initialised=false;this._store=new N;this._initialState={};this._currentState={};this._prevState={};this._currentValue="";this._canSearch=this.config.searchEnabled;this._isScrollingOnIe=false;this._highlightPosition=0;this._wasTap=true;this._placeholderValue=this._generatePlaceholderValue();this._baseId=_(this.passedElement.element,"choices-");this._direction=this.passedElement.dir;if(!this._direction){var a=window.getComputedStyle(this.passedElement.element),c=a.direction;var l=window.getComputedStyle(document.documentElement),u=l.direction;if(c!==u){this._direction=c}}this._idNames={itemChoice:"item-choice"};this._presetGroups=this.passedElement.optionGroups;this._presetOptions=this.passedElement.options;this._presetChoices=this.config.choices;this._presetItems=this.config.items;if(this.passedElement.value){this._presetItems=this._presetItems.concat(this.passedElement.value.split(this.config.delimiter))}if(this.passedElement.options){this.passedElement.options.forEach((function(e){i._presetChoices.push({value:e.value,label:e.innerHTML,selected:e.selected,disabled:e.disabled||e.parentNode.disabled,placeholder:e.value===""||e.hasAttribute("placeholder"),customProperties:e.getAttribute("data-custom-properties")})}))}this._render=this._render.bind(this);this._onFocus=this._onFocus.bind(this);this._onBlur=this._onBlur.bind(this);this._onKeyUp=this._onKeyUp.bind(this);this._onKeyDown=this._onKeyDown.bind(this);this._onClick=this._onClick.bind(this);this._onTouchMove=this._onTouchMove.bind(this);this._onTouchEnd=this._onTouchEnd.bind(this);this._onMouseDown=this._onMouseDown.bind(this);this._onMouseOver=this._onMouseOver.bind(this);this._onFormReset=this._onFormReset.bind(this);this._onAKey=this._onAKey.bind(this);this._onEnterKey=this._onEnterKey.bind(this);this._onEscapeKey=this._onEscapeKey.bind(this);this._onDirectionKey=this._onDirectionKey.bind(this);this._onDeleteKey=this._onDeleteKey.bind(this);if(this.passedElement.isActive){if(!this.config.silent){console.warn("Trying to initialise Choices on element already initialised")}this.initialised=true;return}this.init()}var e=Choices.prototype;e.init=function init(){if(this.initialised){return}this._createTemplates();this._createElements();this._createStructure();this._initialState=P(this._store.state);this._store.subscribe(this._render);this._render();this._addEventListeners();var e=!this.config.addItems||this.passedElement.element.hasAttribute("disabled");if(e){this.disable()}this.initialised=true;var t=this.config.callbackOnInit;if(t&&typeof t==="function"){t.call(this)}};e.destroy=function destroy(){if(!this.initialised){return}this._removeEventListeners();this.passedElement.reveal();this.containerOuter.unwrap(this.passedElement.element);this.clearStore();if(this._isSelectElement){this.passedElement.options=this._presetOptions}this._templates=null;this.initialised=false};e.enable=function enable(){if(this.passedElement.isDisabled){this.passedElement.enable()}if(this.containerOuter.isDisabled){this._addEventListeners();this.input.enable();this.containerOuter.enable()}return this};e.disable=function disable(){if(!this.passedElement.isDisabled){this.passedElement.disable()}if(!this.containerOuter.isDisabled){this._removeEventListeners();this.input.disable();this.containerOuter.disable()}return this};e.highlightItem=function highlightItem(e,t){if(t===void 0){t=true}if(!e){return this}var i=e.id,n=e.groupId,r=n===void 0?-1:n,s=e.value,o=s===void 0?"":s,a=e.label,c=a===void 0?"":a;var l=r>=0?this._store.getGroupById(r):null;this._store.dispatch(oe(i,true));if(t){this.passedElement.triggerEvent(R.highlightItem,{id:i,value:o,label:c,groupValue:l&&l.value?l.value:null})}return this};e.unhighlightItem=function unhighlightItem(e){if(!e){return this}var t=e.id,i=e.groupId,n=i===void 0?-1:i,r=e.value,s=r===void 0?"":r,o=e.label,a=o===void 0?"":o;var c=n>=0?this._store.getGroupById(n):null;this._store.dispatch(oe(t,false));this.passedElement.triggerEvent(R.highlightItem,{id:t,value:s,label:a,groupValue:c&&c.value?c.value:null});return this};e.highlightAll=function highlightAll(){var e=this;this._store.items.forEach((function(t){return e.highlightItem(t)}));return this};e.unhighlightAll=function unhighlightAll(){var e=this;this._store.items.forEach((function(t){return e.unhighlightItem(t)}));return this};e.removeActiveItemsByValue=function removeActiveItemsByValue(e){var t=this;this._store.activeItems.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}));return this};e.removeActiveItems=function removeActiveItems(e){var t=this;this._store.activeItems.filter((function(t){var i=t.id;return i!==e})).forEach((function(e){return t._removeItem(e)}));return this};e.removeHighlightedItems=function removeHighlightedItems(e){var t=this;if(e===void 0){e=false}this._store.highlightedActiveItems.forEach((function(i){t._removeItem(i);if(e){t._triggerChange(i.value)}}));return this};e.showDropdown=function showDropdown(e){var t=this;if(this.dropdown.isActive){return this}requestAnimationFrame((function(){t.dropdown.show();t.containerOuter.open(t.dropdown.distanceFromTopWindow);if(!e&&t._canSearch){t.input.focus()}t.passedElement.triggerEvent(R.showDropdown,{})}));return this};e.hideDropdown=function hideDropdown(e){var t=this;if(!this.dropdown.isActive){return this}requestAnimationFrame((function(){t.dropdown.hide();t.containerOuter.close();if(!e&&t._canSearch){t.input.removeActiveDescendant();t.input.blur()}t.passedElement.triggerEvent(R.hideDropdown,{})}));return this};e.getValue=function getValue(e){if(e===void 0){e=false}var t=this._store.activeItems.reduce((function(t,i){var n=e?i.value:i;t.push(n);return t}),[]);return this._isSelectOneElement?t[0]:t};e.setValue=function setValue(e){var t=this;if(!this.initialised){return this}e.forEach((function(e){return t._setChoiceOrItem(e)}));return this};e.setChoiceByValue=function setChoiceByValue(e){var t=this;if(!this.initialised||this._isTextElement){return this}var i=Array.isArray(e)?e:[e];i.forEach((function(e){return t._findAndSelectChoiceByValue(e)}));return this};e.setChoices=function setChoices(e,t,i,n){var r=this;if(e===void 0){e=[]}if(t===void 0){t="value"}if(i===void 0){i="label"}if(n===void 0){n=false}if(!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(typeof t!=="string"||!t){throw new TypeError("value parameter must be a name of 'value' field in passed objects")}if(n){this.clearChoices()}if(typeof e==="function"){var s=e(this);if(typeof Promise==="function"&&s instanceof Promise){return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return r._handleLoadingState(true)})).then((function(){return s})).then((function(e){return r.setChoices(e,t,i,n)})).catch((function(e){if(!r.config.silent){console.error(e)}})).then((function(){return r._handleLoadingState(false)})).then((function(){return r}))}if(!Array.isArray(s)){throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: "+typeof s)}return this.setChoices(s,t,i,false)}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")}this.containerOuter.removeLoadingState();this._startLoading();e.forEach((function(e){if(e.choices){r._addGroup({id:parseInt(e.id,10)||null,group:e,valueKey:t,labelKey:i})}else{r._addChoice({value:e[t],label:e[i],isSelected:e.selected,isDisabled:e.disabled,customProperties:e.customProperties,placeholder:e.placeholder})}}));this._stopLoading();return this};e.clearChoices=function clearChoices(){this._store.dispatch(ne());return this};e.clearStore=function clearStore(){this._store.dispatch(ce());return this};e.clearInput=function clearInput(){var e=!this._isSelectOneElement;this.input.clear(e);if(!this._isTextElement&&this._canSearch){this._isSearching=false;this._store.dispatch(ie(true))}return this};e._render=function _render(){if(this._store.isLoading()){return}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;var t=this._isSelectElement;var i=this._currentState.items!==this._prevState.items;if(!e){return}if(t){this._renderChoices()}if(i){this._renderItems()}this._prevState=this._currentState};e._renderChoices=function _renderChoices(){var e=this;var t=this._store,i=t.activeGroups,n=t.activeChoices;var r=document.createDocumentFragment();this.choiceList.clear();if(this.config.resetScrollPosition){requestAnimationFrame((function(){return e.choiceList.scrollToTop()}))}if(i.length>=1&&!this._isSearching){var s=n.filter((function(e){return e.placeholder===true&&e.groupId===-1}));if(s.length>=1){r=this._createChoicesFragment(s,r)}r=this._createGroupsFragment(i,n,r)}else if(n.length>=1){r=this._createChoicesFragment(n,r)}if(r.childNodes&&r.childNodes.length>0){var o=this._store.activeItems;var a=this._canAddItem(o,this.input.value);if(a.response){this.choiceList.append(r);this._highlightChoice()}else{this.choiceList.append(this._getTemplate("notice",a.notice))}}else{var c;var l;if(this._isSearching){l=typeof this.config.noResultsText==="function"?this.config.noResultsText():this.config.noResultsText;c=this._getTemplate("notice",l,"no-results")}else{l=typeof this.config.noChoicesText==="function"?this.config.noChoicesText():this.config.noChoicesText;c=this._getTemplate("notice",l,"no-choices")}this.choiceList.append(c)}};e._renderItems=function _renderItems(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);if(t.childNodes){this.itemList.append(t)}};e._createGroupsFragment=function _createGroupsFragment(e,t,i){var n=this;if(i===void 0){i=document.createDocumentFragment()}var r=function getGroupChoices(e){return t.filter((function(t){if(n._isSelectOneElement){return t.groupId===e.id}return t.groupId===e.id&&(n.config.renderSelectedChoices==="always"||!t.selected)}))};if(this.config.shouldSort){e.sort(this.config.sorter)}e.forEach((function(e){var t=r(e);if(t.length>=1){var s=n._getTemplate("choiceGroup",e);i.appendChild(s);n._createChoicesFragment(t,i,true)}}));return i};e._createChoicesFragment=function _createChoicesFragment(e,t,i){var n=this;if(t===void 0){t=document.createDocumentFragment()}if(i===void 0){i=false}var r=this.config,s=r.renderSelectedChoices,o=r.searchResultLimit,a=r.renderChoiceLimit;var c=this._isSearching?A:this.config.sorter;var l=function appendChoice(e){var i=s==="auto"?n._isSelectOneElement||!e.selected:true;if(i){var r=n._getTemplate("choice",e,n.config.itemSelectText);t.appendChild(r)}};var u=e;if(s==="auto"&&!this._isSelectOneElement){u=e.filter((function(e){return!e.selected}))}var h=u.reduce((function(e,t){if(t.placeholder){e.placeholderChoices.push(t)}else{e.normalChoices.push(t)}return e}),{placeholderChoices:[],normalChoices:[]}),d=h.placeholderChoices,f=h.normalChoices;if(this.config.shouldSort||this._isSearching){f.sort(c)}var p=u.length;var m=this._isSelectOneElement?[].concat(d,f):f;if(this._isSearching){p=o}else if(a&&a>0&&!i){p=a}for(var v=0;v<p;v+=1){if(m[v]){l(m[v])}}return t};e._createItemsFragment=function _createItemsFragment(e,t){var i=this;if(t===void 0){t=document.createDocumentFragment()}var n=this.config,r=n.shouldSortItems,s=n.sorter,o=n.removeItemButton;if(r&&!this._isSelectOneElement){e.sort(s)}if(this._isTextElement){this.passedElement.value=e}else{this.passedElement.options=e}var a=function addItemToFragment(e){var n=i._getTemplate("item",e,o);t.appendChild(n)};e.forEach(a);return t};e._triggerChange=function _triggerChange(e){if(e===undefined||e===null){return}this.passedElement.triggerEvent(R.change,{value:e})};e._selectPlaceholderChoice=function _selectPlaceholderChoice(){var e=this._store.placeholderChoice;if(e){this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder:e.placeholder});this._triggerChange(e.value)}};e._handleButtonAction=function _handleButtonAction(e,t){if(!e||!t||!this.config.removeItems||!this.config.removeItemButton){return}var i=t.parentNode.getAttribute("data-id");var n=e.find((function(e){return e.id===parseInt(i,10)}));this._removeItem(n);this._triggerChange(n.value);if(this._isSelectOneElement){this._selectPlaceholderChoice()}};e._handleItemAction=function _handleItemAction(e,t,i){var n=this;if(i===void 0){i=false}if(!e||!t||!this.config.removeItems||this._isSelectOneElement){return}var r=t.getAttribute("data-id");e.forEach((function(e){if(e.id===parseInt(r,10)&&!e.highlighted){n.highlightItem(e)}else if(!i&&e.highlighted){n.unhighlightItem(e)}}));this.input.focus()};e._handleChoiceAction=function _handleChoiceAction(e,t){if(!e||!t){return}var i=t.dataset.id;var n=this._store.getChoiceById(i);if(!n){return}var r=e[0]&&e[0].keyCode?e[0].keyCode:null;var s=this.dropdown.isActive;n.keyCode=r;this.passedElement.triggerEvent(R.choice,{choice:n});if(!n.selected&&!n.disabled){var o=this._canAddItem(e,n.value);if(o.response){this._addItem({value:n.value,label:n.label,choiceId:n.id,groupId:n.groupId,customProperties:n.customProperties,placeholder:n.placeholder,keyCode:n.keyCode});this._triggerChange(n.value)}}this.clearInput();if(s&&this._isSelectOneElement){this.hideDropdown(true);this.containerOuter.focus()}};e._handleBackspace=function _handleBackspace(e){if(!this.config.removeItems||!e){return}var t=e[e.length-1];var i=e.some((function(e){return e.highlighted}));if(this.config.editItems&&!i&&t){this.input.value=t.value;this.input.setWidth();this._removeItem(t);this._triggerChange(t.value)}else{if(!i){this.highlightItem(t,false)}this.removeHighlightedItems(true)}};e._startLoading=function _startLoading(){this._store.dispatch(ue(true))};e._stopLoading=function _stopLoading(){this._store.dispatch(ue(false))};e._handleLoadingState=function _handleLoadingState(e){if(e===void 0){e=true}var t=this.itemList.getChild("."+this.config.classNames.placeholder);if(e){this.disable();this.containerOuter.addLoadingState();if(this._isSelectOneElement){if(!t){t=this._getTemplate("placeholder",this.config.loadingText);this.itemList.append(t)}else{t.innerHTML=this.config.loadingText}}else{this.input.placeholder=this.config.loadingText}}else{this.enable();this.containerOuter.removeLoadingState();if(this._isSelectOneElement){t.innerHTML=this._placeholderValue||""}else{this.input.placeholder=this._placeholderValue||""}}};e._handleSearch=function _handleSearch(e){if(!e||!this.input.isFocussed){return}var t=this._store.choices;var i=this.config,n=i.searchFloor,r=i.searchChoices;var s=t.some((function(e){return!e.active}));if(e&&e.length>=n){var o=r?this._searchChoices(e):0;this.passedElement.triggerEvent(R.search,{value:e,resultCount:o})}else if(s){this._isSearching=false;this._store.dispatch(ie(true))}};e._canAddItem=function _canAddItem(e,t){var i=true;var n=typeof this.config.addItemText==="function"?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var r=T(e,t);if(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length){i=false;n=typeof this.config.maxItemText==="function"?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText}if(!this.config.duplicateItemsAllowed&&r&&i){i=false;n=typeof this.config.uniqueItemText==="function"?this.config.uniqueItemText(t):this.config.uniqueItemText}if(this._isTextElement&&this.config.addItems&&i&&typeof this.config.addItemFilter==="function"&&!this.config.addItemFilter(t)){i=false;n=typeof this.config.customAddItemText==="function"?this.config.customAddItemText(t):this.config.customAddItemText}}return{response:i,notice:n}};e._searchChoices=function _searchChoices(e){var t=typeof e==="string"?e.trim():e;var i=typeof this._currentValue==="string"?this._currentValue.trim():this._currentValue;if(t.length<1&&t===i+" "){return 0}var n=this._store.searchableChoices;var s=t;var o=[].concat(this.config.searchFields);var a=Object.assign(this.config.fuseOptions,{keys:o});var c=new r.a(n,a);var l=c.search(s);this._currentValue=t;this._highlightPosition=0;this._isSearching=true;this._store.dispatch(te(l));return l.length};e._addEventListeners=function _addEventListeners(){var e=document,t=e.documentElement;t.addEventListener("touchend",this._onTouchEnd,true);this.containerOuter.element.addEventListener("keydown",this._onKeyDown,true);this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,true);t.addEventListener("click",this._onClick,{passive:true});t.addEventListener("touchmove",this._onTouchMove,{passive:true});this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:true});if(this._isSelectOneElement){this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:true});this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:true})}this.input.element.addEventListener("keyup",this._onKeyUp,{passive:true});this.input.element.addEventListener("focus",this._onFocus,{passive:true});this.input.element.addEventListener("blur",this._onBlur,{passive:true});if(this.input.element.form){this.input.element.form.addEventListener("reset",this._onFormReset,{passive:true})}this.input.addEventListeners()};e._removeEventListeners=function _removeEventListeners(){var e=document,t=e.documentElement;t.removeEventListener("touchend",this._onTouchEnd,true);this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,true);this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,true);t.removeEventListener("click",this._onClick);t.removeEventListener("touchmove",this._onTouchMove);this.dropdown.element.removeEventListener("mouseover",this._onMouseOver);if(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);if(this.input.element.form){this.input.element.form.removeEventListener("reset",this._onFormReset)}this.input.removeEventListeners()};e._onKeyDown=function _onKeyDown(e){var t;var i=e.target,n=e.keyCode,r=e.ctrlKey,s=e.metaKey;var o=this._store.activeItems;var a=this.input.isFocussed;var c=this.dropdown.isActive;var l=this.itemList.hasChildren();var u=String.fromCharCode(n);var h=B.BACK_KEY,d=B.DELETE_KEY,f=B.ENTER_KEY,p=B.A_KEY,m=B.ESC_KEY,v=B.UP_KEY,g=B.DOWN_KEY,_=B.PAGE_UP_KEY,b=B.PAGE_DOWN_KEY;var y=r||s;if(!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(u)){this.showDropdown()}var E=(t={},t[p]=this._onAKey,t[f]=this._onEnterKey,t[m]=this._onEscapeKey,t[v]=this._onDirectionKey,t[_]=this._onDirectionKey,t[g]=this._onDirectionKey,t[b]=this._onDirectionKey,t[d]=this._onDeleteKey,t[h]=this._onDeleteKey,t);if(E[n]){E[n]({event:e,target:i,keyCode:n,metaKey:s,activeItems:o,hasFocusedInput:a,hasActiveDropdown:c,hasItems:l,hasCtrlDownKeyPressed:y})}};e._onKeyUp=function _onKeyUp(e){var t=e.target,i=e.keyCode;var n=this.input.value;var r=this._store.activeItems;var s=this._canAddItem(r,n);var o=B.BACK_KEY,a=B.DELETE_KEY;if(this._isTextElement){var c=s.notice&&n;if(c){var l=this._getTemplate("notice",s.notice);this.dropdown.element.innerHTML=l.outerHTML;this.showDropdown(true)}else{this.hideDropdown(true)}}else{var u=(i===o||i===a)&&!t.value;var h=!this._isTextElement&&this._isSearching;var d=this._canSearch&&s.response;if(u&&h){this._isSearching=false;this._store.dispatch(ie(true))}else if(d){this._handleSearch(this.input.value)}}this._canSearch=this.config.searchEnabled};e._onAKey=function _onAKey(e){var t=e.hasItems,i=e.hasCtrlDownKeyPressed;if(i&&t){this._canSearch=false;var n=this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement;if(n){this.highlightAll()}}};e._onEnterKey=function _onEnterKey(e){var t=e.event,i=e.target,n=e.activeItems,r=e.hasActiveDropdown;var s=B.ENTER_KEY;var o=i.hasAttribute("data-button");if(this._isTextElement&&i.value){var a=this.input.value;var c=this._canAddItem(n,a);if(c.response){this.hideDropdown(true);this._addItem({value:a});this._triggerChange(a);this.clearInput()}}if(o){this._handleButtonAction(n,i);t.preventDefault()}if(r){var l=this.dropdown.getChild("."+this.config.classNames.highlightedState);if(l){if(n[0]){n[0].keyCode=s}this._handleChoiceAction(n,l)}t.preventDefault()}else if(this._isSelectOneElement){this.showDropdown();t.preventDefault()}};e._onEscapeKey=function _onEscapeKey(e){var t=e.hasActiveDropdown;if(t){this.hideDropdown(true);this.containerOuter.focus()}};e._onDirectionKey=function _onDirectionKey(e){var t=e.event,i=e.hasActiveDropdown,n=e.keyCode,r=e.metaKey;var s=B.DOWN_KEY,o=B.PAGE_UP_KEY,a=B.PAGE_DOWN_KEY;if(i||this._isSelectOneElement){this.showDropdown();this._canSearch=false;var c=n===s||n===a?1:-1;var l=r||n===a||n===o;var u="[data-choice-selectable]";var h;if(l){if(c>0){h=this.dropdown.element.querySelector(u+":last-of-type")}else{h=this.dropdown.element.querySelector(u)}}else{var d=this.dropdown.element.querySelector("."+this.config.classNames.highlightedState);if(d){h=w(d,u,c)}else{h=this.dropdown.element.querySelector(u)}}if(h){if(!I(h,this.choiceList.element,c)){this.choiceList.scrollToChildElement(h,c)}this._highlightChoice(h)}t.preventDefault()}};e._onDeleteKey=function _onDeleteKey(e){var t=e.event,i=e.target,n=e.hasFocusedInput,r=e.activeItems;if(n&&!i.value&&!this._isSelectOneElement){this._handleBackspace(r);t.preventDefault()}};e._onTouchMove=function _onTouchMove(){if(this._wasTap){this._wasTap=false}};e._onTouchEnd=function _onTouchEnd(e){var t=e||e.touches[0],i=t.target;var n=this._wasTap&&this.containerOuter.element.contains(i);if(n){var r=i===this.containerOuter.element||i===this.containerInner.element;if(r){if(this._isTextElement){this.input.focus()}else if(this._isSelectMultipleElement){this.showDropdown()}}e.stopPropagation()}this._wasTap=true};e._onMouseDown=function _onMouseDown(e){var t=e.target;if(!(t instanceof HTMLElement)){return}if(he&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;var n=this._direction==="ltr"?e.offsetX>=i.offsetWidth:e.offsetX<i.offsetLeft;this._isScrollingOnIe=n}if(t===this.input.element){return}var r=t.closest("[data-button],[data-item],[data-choice]");if(r instanceof HTMLElement){var s=e.shiftKey;var o=this._store.activeItems;var a=r.dataset;if("button"in a){this._handleButtonAction(o,r)}else if("item"in a){this._handleItemAction(o,r,s)}else if("choice"in a){this._handleChoiceAction(o,r)}}e.preventDefault()};e._onMouseOver=function _onMouseOver(e){var t=e.target;if(t instanceof HTMLElement&&"choice"in t.dataset){this._highlightChoice(t)}};e._onClick=function _onClick(e){var t=e.target;var i=this.containerOuter.element.contains(t);if(i){if(!this.dropdown.isActive&&!this.containerOuter.isDisabled){if(this._isTextElement){if(document.activeElement!==this.input.element){this.input.focus()}}else{this.showDropdown();this.containerOuter.focus()}}else if(this._isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)){this.hideDropdown()}}else{var n=this._store.highlightedActiveItems.length>0;if(n){this.unhighlightAll()}this.containerOuter.removeFocusState();this.hideDropdown(true)}};e._onFocus=function _onFocus(e){var t=this,i;var n=e.target;var r=this.containerOuter.element.contains(n);if(!r){return}var s=(i={},i[G]=function(){if(n===t.input.element){t.containerOuter.addFocusState()}},i[V]=function(){t.containerOuter.addFocusState();if(n===t.input.element){t.showDropdown(true)}},i[U]=function(){if(n===t.input.element){t.showDropdown(true);t.containerOuter.addFocusState()}},i);s[this.passedElement.element.type]()};e._onBlur=function _onBlur(e){var t=this;var i=e.target;var n=this.containerOuter.element.contains(i);if(n&&!this._isScrollingOnIe){var r;var s=this._store.activeItems;var o=s.some((function(e){return e.highlighted}));var a=(r={},r[G]=function(){if(i===t.input.element){t.containerOuter.removeFocusState();if(o){t.unhighlightAll()}t.hideDropdown(true)}},r[V]=function(){t.containerOuter.removeFocusState();if(i===t.input.element||i===t.containerOuter.element&&!t._canSearch){t.hideDropdown(true)}},r[U]=function(){if(i===t.input.element){t.containerOuter.removeFocusState();t.hideDropdown(true);if(o){t.unhighlightAll()}}},r);a[this.passedElement.element.type]()}else{this._isScrollingOnIe=false;this.input.element.focus()}};e._onFormReset=function _onFormReset(){this._store.dispatch(le(this._initialState))};e._highlightChoice=function _highlightChoice(e){var t=this;if(e===void 0){e=null}var i=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(!i.length){return}var n=e;var r=Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState));r.forEach((function(e){e.classList.remove(t.config.classNames.highlightedState);e.setAttribute("aria-selected","false")}));if(n){this._highlightPosition=i.indexOf(n)}else{if(i.length>this._highlightPosition){n=i[this._highlightPosition]}else{n=i[i.length-1]}if(!n){n=i[0]}}n.classList.add(this.config.classNames.highlightedState);n.setAttribute("aria-selected","true");this.passedElement.triggerEvent(R.highlightChoice,{el:n});if(this.dropdown.isActive){this.input.setActiveDescendant(n.id);this.containerOuter.setActiveDescendant(n.id)}};e._addItem=function _addItem(e){var t=e.value,i=e.label,n=i===void 0?null:i,r=e.choiceId,s=r===void 0?-1:r,o=e.groupId,a=o===void 0?-1:o,c=e.customProperties,l=c===void 0?null:c,u=e.placeholder,h=u===void 0?false:u,d=e.keyCode,f=d===void 0?null:d;var p=typeof t==="string"?t.trim():t;var m=f;var v=l;var g=this._store.items;var _=n||p;var b=s||-1;var y=a>=0?this._store.getGroupById(a):null;var E=g?g.length+1:1;if(this.config.prependValue){p=this.config.prependValue+p.toString()}if(this.config.appendValue){p+=this.config.appendValue.toString()}this._store.dispatch(re({value:p,label:_,id:E,choiceId:b,groupId:a,customProperties:l,placeholder:h,keyCode:m}));if(this._isSelectOneElement){this.removeActiveItems(E)}this.passedElement.triggerEvent(R.addItem,{id:E,value:p,label:_,customProperties:v,groupValue:y&&y.value?y.value:undefined,keyCode:m});return this};e._removeItem=function _removeItem(e){if(!e||!y("Object",e)){return this}var t=e.id,i=e.value,n=e.label,r=e.choiceId,s=e.groupId;var o=s>=0?this._store.getGroupById(s):null;this._store.dispatch(se(t,r));if(o&&o.value){this.passedElement.triggerEvent(R.removeItem,{id:t,value:i,label:n,groupValue:o.value})}else{this.passedElement.triggerEvent(R.removeItem,{id:t,value:i,label:n})}return this};e._addChoice=function _addChoice(e){var t=e.value,i=e.label,n=i===void 0?null:i,r=e.isSelected,s=r===void 0?false:r,o=e.isDisabled,a=o===void 0?false:o,c=e.groupId,l=c===void 0?-1:c,u=e.customProperties,h=u===void 0?null:u,d=e.placeholder,f=d===void 0?false:d,p=e.keyCode,m=p===void 0?null:p;if(typeof t==="undefined"||t===null){return}var v=this._store.choices;var g=n||t;var _=v?v.length+1:1;var b=this._baseId+"-"+this._idNames.itemChoice+"-"+_;this._store.dispatch(ee({id:_,groupId:l,elementId:b,value:t,label:g,disabled:a,customProperties:h,placeholder:f,keyCode:m}));if(s){this._addItem({value:t,label:g,choiceId:_,customProperties:h,placeholder:f,keyCode:m})}};e._addGroup=function _addGroup(e){var t=this;var i=e.group,n=e.id,r=e.valueKey,s=r===void 0?"value":r,o=e.labelKey,a=o===void 0?"label":o;var c=y("Object",i)?i.choices:Array.from(i.getElementsByTagName("OPTION"));var l=n||Math.floor((new Date).valueOf()*Math.random());var u=i.disabled?i.disabled:false;if(c){this._store.dispatch(ae({value:i.label,id:l,active:true,disabled:u}));var h=function addGroupChoices(e){var i=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[s],label:y("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:i,groupId:l,customProperties:e.customProperties,placeholder:e.placeholder})};c.forEach(h)}else{this._store.dispatch(ae({value:i.label,id:i.id,active:false,disabled:i.disabled}))}};e._getTemplate=function _getTemplate(e){var t;if(!e){return null}var i=this.config.classNames;for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++){r[s-1]=arguments[s]}return(t=this._templates[e]).call.apply(t,[this,i].concat(r))};e._createTemplates=function _createTemplates(){var e=this.config.callbackOnCreateTemplates;var t={};if(e&&typeof e==="function"){t=e.call(this,C)}this._templates=o()(Z,t)};e._createElements=function _createElements(){this.containerOuter=new W({element:this._getTemplate("containerOuter",this._direction,this._isSelectElement,this._isSelectOneElement,this.config.searchEnabled,this.passedElement.element.type),classNames:this.config.classNames,type:this.passedElement.element.type,position:this.config.position});this.containerInner=new W({element:this._getTemplate("containerInner"),classNames:this.config.classNames,type:this.passedElement.element.type,position:this.config.position});this.input=new Y({element:this._getTemplate("input",this._placeholderValue),classNames:this.config.classNames,type:this.passedElement.element.type,preventPaste:!this.config.paste});this.choiceList=new z({element:this._getTemplate("choiceList",this._isSelectOneElement)});this.itemList=new z({element:this._getTemplate("itemList",this._isSelectOneElement)});this.dropdown=new j({element:this._getTemplate("dropdown"),classNames:this.config.classNames,type:this.passedElement.element.type})};e._createStructure=function _createStructure(){this.passedElement.conceal();this.containerInner.wrap(this.passedElement.element);this.containerOuter.wrap(this.containerInner.element);if(this._isSelectOneElement){this.input.placeholder=this.config.searchPlaceholderValue||""}else if(this._placeholderValue){this.input.placeholder=this._placeholderValue;this.input.setWidth()}this.containerOuter.element.appendChild(this.containerInner.element);this.containerOuter.element.appendChild(this.dropdown.element);this.containerInner.element.appendChild(this.itemList.element);if(!this._isTextElement){this.dropdown.element.appendChild(this.choiceList.element)}if(!this._isSelectOneElement){this.containerInner.element.appendChild(this.input.element)}else if(this.config.searchEnabled){this.dropdown.element.insertBefore(this.input.element,this.dropdown.element.firstChild)}if(this._isSelectElement){this._highlightPosition=0;this._isSearching=false;this._startLoading();if(this._presetGroups.length){this._addPredefinedGroups(this._presetGroups)}else{this._addPredefinedChoices(this._presetChoices)}this._stopLoading()}if(this._isTextElement){this._addPredefinedItems(this._presetItems)}};e._addPredefinedGroups=function _addPredefinedGroups(e){var t=this;var i=this.passedElement.placeholderOption;if(i&&i.parentNode.tagName==="SELECT"){this._addChoice({value:i.value,label:i.innerHTML,isSelected:i.selected,isDisabled:i.disabled,placeholder:true})}e.forEach((function(e){return t._addGroup({group:e,id:e.id||null})}))};e._addPredefinedChoices=function _addPredefinedChoices(e){var t=this;if(this.config.shouldSort){e.sort(this.config.sorter)}var i=e.some((function(e){return e.selected}));var n=e.findIndex((function(e){return e.disabled===undefined||!e.disabled}));e.forEach((function(e,r){var s=e.value,o=e.label,a=e.customProperties,c=e.placeholder;if(t._isSelectElement){if(e.choices){t._addGroup({group:e,id:e.id||null})}else{var l=t._isSelectOneElement&&!i&&r===n;var u=l?true:e.selected;var h=e.disabled;t._addChoice({value:s,label:o,isSelected:u,isDisabled:h,customProperties:a,placeholder:c})}}else{t._addChoice({value:s,label:o,isSelected:e.selected,isDisabled:e.disabled,customProperties:a,placeholder:c})}}))};e._addPredefinedItems=function _addPredefinedItems(e){var t=this;e.forEach((function(e){if(typeof e==="object"&&e.value){t._addItem({value:e.value,label:e.label,choiceId:e.id,customProperties:e.customProperties,placeholder:e.placeholder})}if(typeof e==="string"){t._addItem({value:e})}}))};e._setChoiceOrItem=function _setChoiceOrItem(e){var t=this;var i=b(e).toLowerCase();var n={object:function object(){if(!e.value){return}if(!t._isTextElement){t._addChoice({value:e.value,label:e.label,isSelected:true,isDisabled:false,customProperties:e.customProperties,placeholder:e.placeholder})}else{t._addItem({value:e.value,label:e.label,choiceId:e.id,customProperties:e.customProperties,placeholder:e.placeholder})}},string:function string(){if(!t._isTextElement){t._addChoice({value:e,label:e,isSelected:true,isDisabled:false})}else{t._addItem({value:e})}}};n[i]()};e._findAndSelectChoiceByValue=function _findAndSelectChoiceByValue(e){var t=this;var i=this._store.choices;var n=i.find((function(i){return t.config.valueComparer(i.value,e)}));if(n&&!n.selected){this._addItem({value:n.value,label:n.label,choiceId:n.id,groupId:n.groupId,customProperties:n.customProperties,placeholder:n.placeholder,keyCode:n.keyCode})}};e._generatePlaceholderValue=function _generatePlaceholderValue(){if(this._isSelectElement){var e=this.passedElement.placeholderOption;return e?e.text:false}var t=this.config,i=t.placeholder,n=t.placeholderValue;var r=this.passedElement.element.dataset;if(i){if(n){return n}if(r.placeholder){return r.placeholder}}return false};return Choices}();var pe=t["default"]=fe}])["default"]}))}}]);