choices-vue3
Version:
[](https://www.npmjs.com/package/choices-vue3) [](https://www.npmjs.com/package/choices-vue3) [{"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ChoicesVue2={},e.Vue)}(this,function(e,t){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return s=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},s.apply(this,arguments)};function o(e,t,i){for(var n,s=0,o=t.length;s<o;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r,a="ADD_CHOICE",c="REMOVE_CHOICE",l="FILTER_CHOICES",h="ACTIVATE_CHOICES",u="CLEAR_CHOICES",d="ADD_GROUP",p="ADD_ITEM",m="REMOVE_ITEM",f="HIGHLIGHT_ITEM",v="search",g="removeItem",_="highlightItem",y=["fuseOptions","classNames"],b="select-one",E="select-multiple",C=function(e){return{type:a,choice:e}},S=function(e){return{type:p,item:e}},w=function(e){return{type:m,item:e}},I=function(e,t){return{type:f,item:e,highlighted:t}},A=function(e){return Array.from({length:e},function(){return Math.floor(36*Math.random()+0).toString(36)}).join("")},x=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return x(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'").replace(/"/g,""")},O=(r=document.createElement("div"),function(e){r.innerHTML=e.trim();for(var t=r.children[0];r.firstChild;)r.removeChild(r.firstChild);return t}),L=function(e,t){return"function"==typeof e?e(x(t),t):e},M=function(e){return"function"==typeof e?e():e},T=function(e){if("string"==typeof e)return e;if("object"==typeof e){if("trusted"in e)return e.trusted;if("raw"in e)return e.raw}return""},N=function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""},F=function(e,t){return e?N(t):x(t)},k=function(e,t,i){e.innerHTML=F(t,i)},D=function(e,t){return e.rank-t.rank},P=function(e){return Array.isArray(e)?e:[e]},j=function(e){return e&&Array.isArray(e)?e.map(function(e){return".".concat(e)}).join(""):".".concat(e)},K=function(e,t){var i;(i=e.classList).add.apply(i,P(t))},V=function(e,t){var i;(i=e.classList).remove.apply(i,P(t))},R=function(e){if(void 0!==e)try{return JSON.parse(e)}catch(t){return e}return{}},B=function(){function e(e){var t=e.element,i=e.type,n=e.classNames;this.element=t,this.classNames=n,this.type=i,this.isActive=!1}return e.prototype.show=function(){return K(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},e.prototype.hide=function(){return V(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},e}(),$=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.isDisabled=!1,this.isLoading=!1}return e.prototype.shouldFlip=function(e,t){var i=!1;return"auto"===this.position?i=this.element.getBoundingClientRect().top-t>=0&&!window.matchMedia("(min-height: ".concat(e+1,"px)")).matches:"top"===this.position&&(i=!0),i},e.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},e.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},e.prototype.open=function(e,t){K(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e,t)&&(K(this.element,this.classNames.flippedState),this.isFlipped=!0)},e.prototype.close=function(){V(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(V(this.element,this.classNames.flippedState),this.isFlipped=!1)},e.prototype.addFocusState=function(){K(this.element,this.classNames.focusState)},e.prototype.removeFocusState=function(){V(this.element,this.classNames.focusState)},e.prototype.enable=function(){V(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===b&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},e.prototype.disable=function(){K(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===b&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},e.prototype.wrap=function(e){var t=this.element,i=e.parentNode;i&&(e.nextSibling?i.insertBefore(t,e.nextSibling):i.appendChild(t)),t.appendChild(e)},e.prototype.unwrap=function(e){var t=this.element,i=t.parentNode;i&&(i.insertBefore(e,t),i.removeChild(t))},e.prototype.addLoadingState=function(){K(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},e.prototype.removeLoadingState=function(){V(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},e}(),q=function(){function e(e){var t=e.element,i=e.type,n=e.classNames,s=e.preventPaste;this.element=t,this.type=i,this.classNames=n,this.preventPaste=s,this.isFocussed=this.element.isEqualNode(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)}return Object.defineProperty(e.prototype,"placeholder",{set:function(e){this.element.placeholder=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.addEventListeners=function(){var e=this.element;e.addEventListener("paste",this._onPaste),e.addEventListener("input",this._onInput,{passive:!0}),e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})},e.prototype.removeEventListeners=function(){var e=this.element;e.removeEventListener("input",this._onInput),e.removeEventListener("paste",this._onPaste),e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},e.prototype.focus=function(){this.isFocussed||this.element.focus()},e.prototype.blur=function(){this.isFocussed&&this.element.blur()},e.prototype.clear=function(e){return void 0===e&&(e=!0),this.element.value="",e&&this.setWidth(),this},e.prototype.setWidth=function(){var e=this.element;e.style.minWidth="".concat(e.placeholder.length+1,"ch"),e.style.width="".concat(e.value.length+1,"ch")},e.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},e.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},e.prototype._onInput=function(){this.type!==b&&this.setWidth()},e.prototype._onPaste=function(e){this.preventPaste&&e.preventDefault()},e.prototype._onFocus=function(){this.isFocussed=!0},e.prototype._onBlur=function(){this.isFocussed=!1},e}(),H=function(){function e(e){var t=e.element;this.element=t,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return e.prototype.prepend=function(e){var t=this.element.firstElementChild;t?this.element.insertBefore(e,t):this.element.append(e)},e.prototype.scrollToTop=function(){this.element.scrollTop=0},e.prototype.scrollToChildElement=function(e,t){var i=this;if(e){var n=this.element.offsetHeight,s=this.element.scrollTop+n,o=e.offsetHeight,r=e.offsetTop+o,a=t>0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame(function(){i._animateScroll(a,t)})}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),n<e&&(s=!0)):(this._scrollUp(n,4,e),n>e&&(s=!0)),s&&requestAnimationFrame(function(){i._animateScroll(e,t)})},e}(),W=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e=this.element;K(e,this.classNames.input),e.hidden=!0,e.tabIndex=-1;var t=e.getAttribute("style");t&&e.setAttribute("data-choice-orig-style",t),e.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e=this.element;V(e,this.classNames.input),e.hidden=!1,e.removeAttribute("tabindex");var t=e.getAttribute("data-choice-orig-style");t?(e.removeAttribute("data-choice-orig-style"),e.setAttribute("style",t)):e.removeAttribute("style"),e.removeAttribute("data-choice")},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t||{})},e}(),G=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(W),U=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},z=function(e){if("string"==typeof e&&(e=e.split(" ").filter(function(e){return e.length})),Array.isArray(e)&&e.length)return e},J=function(e,t,i){if(void 0===i&&(i=!0),"string"==typeof e){var n=x(e);return J({value:e,label:i||n===e?e:{escaped:n,raw:e},selected:!0},!1)}var s=e;if("choices"in s){if(!t)throw new TypeError("optGroup is not allowed");var o=s,r=o.choices.map(function(e){return J(e,!1)});return{id:0,label:T(o.label)||o.value,active:!!r.length,disabled:!!o.disabled,choices:r}}var a=s;return{id:0,group:null,score:0,rank:0,value:a.value,label:a.label||a.value,active:U(a.active),selected:U(a.selected,!1),disabled:U(a.disabled,!1),placeholder:U(a.placeholder,!1),highlighted:!1,labelClass:z(a.labelClass),labelDescription:a.labelDescription,customProperties:a.customProperties}},X=function(e){return"SELECT"===e.tagName},Q=function(e){function t(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return n(t,e),Object.defineProperty(t.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),t.prototype.addOptions=function(e){var t=this,i=document.createDocumentFragment();e.forEach(function(e){var n=e;if(!n.element){var s=t.template(n);i.appendChild(s),n.element=s}}),this.element.appendChild(i)},t.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach(function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))}),t},t.prototype._optionToChoice=function(e){return!e.hasAttribute("value")&&e.hasAttribute("placeholder")&&(e.setAttribute("value",""),e.value=""),{id:0,group:null,score:0,rank:0,value:e.value,label:e.label,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?z(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:R(e.dataset.customProperties)}},t.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map(function(e){return t._optionToChoice(e)});return{id:0,label:e.label||"",element:e,active:!!n.length,disabled:e.disabled,choices:n}},t}(W),Y={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,a=void 0===r?o:r;return T(s).localeCompare(T(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,placeholder:!0,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(e){return'Press Enter to add <b>"'.concat(e,'"</b>')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",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"],description:["choices__description"],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"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},Z=function(e){var t=e.itemEl;t&&(t.remove(),e.itemEl=void 0)},ee={groups:function(e,t){var i=e,n=!0;switch(t.type){case d:i.push(t.group);break;case u:i=[];break;default:n=!1}return{state:i,update:n}},items:function(e,t,i){var n=e,s=!0;switch(t.type){case p:t.item.selected=!0,(o=t.item.element)&&(o.selected=!0,o.setAttribute("selected","")),n.push(t.item);break;case m:var o;if(t.item.selected=!1,o=t.item.element){o.selected=!1,o.removeAttribute("selected");var r=o.parentElement;r&&X(r)&&r.type===b&&(r.value="")}Z(t.item),n=n.filter(function(e){return e.id!==t.item.id});break;case c:Z(t.choice),n=n.filter(function(e){return e.id!==t.choice.id});break;case f:var a=t.highlighted,l=n.find(function(e){return e.id===t.item.id});l&&l.highlighted!==a&&(l.highlighted=a,i&&function(e,t,i){var n=e.itemEl;n&&(V(n,i),K(n,t))}(l,a?i.classNames.highlightedState:i.classNames.selectedState,a?i.classNames.selectedState:i.classNames.highlightedState));break;default:s=!1}return{state:n,update:s}},choices:function(e,t,i){var n=e,s=!0;switch(t.type){case a:n.push(t.choice);break;case c:t.choice.choiceEl=void 0,t.choice.group&&(t.choice.group.choices=t.choice.group.choices.filter(function(e){return e.id!==t.choice.id})),n=n.filter(function(e){return e.id!==t.choice.id});break;case p:case m:t.item.choiceEl=void 0;break;case l:var o=[];t.results.forEach(function(e){o[e.item.id]=e}),n.forEach(function(e){var t=o[e.id];void 0!==t?(e.score=t.score,e.rank=t.rank,e.active=!0):(e.score=0,e.rank=0,e.active=!1),i&&i.appendGroupInSearch&&(e.choiceEl=void 0)});break;case h:n.forEach(function(e){e.active=t.active,i&&i.appendGroupInSearch&&(e.choiceEl=void 0)});break;case u:n=[];break;default:s=!1}return{state:n,update:s}}},te=function(){function e(e){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=e}return Object.defineProperty(e.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),e.prototype.changeSet=function(e){return{groups:e,items:e,choices:e}},e.prototype.reset=function(){this._state=this.defaultState;var e=this.changeSet(!0);this._txn?this._changeSet=e:this._listeners.forEach(function(t){return t(e)})},e.prototype.subscribe=function(e){return this._listeners.push(e),this},e.prototype.dispatch=function(e){var t=this,i=this._state,n=!1,s=this._changeSet||this.changeSet(!1);Object.keys(ee).forEach(function(o){var r=ee[o](i[o],e,t._context);r.update&&(n=!0,s[o]=!0,i[o]=r.state)}),n&&(this._txn?this._changeSet=s:this._listeners.forEach(function(e){return e(s)}))},e.prototype.withTxn=function(e){this._txn++;try{e()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var t=this._changeSet;t&&(this._changeSet=void 0,this._listeners.forEach(function(e){return e(t)}))}}},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightedActiveItems",{get:function(){return this.items.filter(function(e){return e.active&&e.highlighted})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeChoices",{get:function(){return this.choices.filter(function(e){return e.active})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"searchableChoices",{get:function(){return this.choices.filter(function(e){return!e.disabled&&!e.placeholder})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeGroups",{get:function(){var e=this;return this.state.groups.filter(function(t){var i=t.active&&!t.disabled,n=e.state.choices.some(function(e){return e.active&&!e.disabled});return i&&n},[])},enumerable:!1,configurable:!0}),e.prototype.inTxn=function(){return this._txn>0},e.prototype.getChoiceById=function(e){return this.activeChoices.find(function(t){return t.id===e})},e.prototype.getGroupById=function(e){return this.groups.find(function(t){return t.id===e})},e}(),ie="no-choices",ne="no-results",se="add-choice";function oe(e,t,i){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function re(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function ae(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?re(Object(i),!0).forEach(function(t){oe(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):re(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function ce(e){return Array.isArray?Array.isArray(e):"[object Array]"===me(e)}function le(e){return"string"==typeof e}function he(e){return"number"==typeof e}function ue(e){return"object"==typeof e}function de(e){return null!=e}function pe(e){return!e.trim().length}function me(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const fe=Object.prototype.hasOwnProperty;class ve{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let i=ge(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function ge(e){let t=null,i=null,n=null,s=1,o=null;if(le(e)||ce(e))n=e,t=_e(e),i=ye(e);else{if(!fe.call(e,"name"))throw new Error("Missing name property in key");const r=e.name;if(n=r,fe.call(e,"weight")&&(s=e.weight,s<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(r));t=_e(r),i=ye(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function _e(e){return ce(e)?e:e.split(".")}function ye(e){return ce(e)?e.join("."):e}const be={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(de(e))if(t[o]){const r=e[t[o]];if(!de(r))return;if(o===t.length-1&&(le(r)||he(r)||function(e){return!0===e||!1===e||function(e){return ue(e)&&null!==e}(e)&&"[object Boolean]"==me(e)}(r)))i.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(r));else if(ce(r)){n=!0;for(let e=0,i=r.length;e<i;e+=1)s(r[e],t,o+1)}else t.length&&s(r,t,o+1)}else i.push(e)};return s(e,le(t)?t.split("."):t,0),n?i:i[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Ee=ae(ae(ae(ae({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),be);const Ce=/[^ ]+/g;class Se{constructor({getFn:e=Ee.getFn,fieldNormWeight:t=Ee.fieldNormWeight}={}){this.norm=function(e=1,t=3){const i=new Map,n=Math.pow(10,t);return{get(t){const s=t.match(Ce).length;if(i.has(s))return i.get(s);const o=1/Math.pow(s,.5*e),r=parseFloat(Math.round(o*n)/n);return i.set(s,r),r},clear(){i.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,le(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();le(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t<i;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!de(e)||pe(e))return;let i={v:e,i:t,n:this.norm.get(e)};this.records.push(i)}_addObject(e,t){let i={i:t,$:{}};this.keys.forEach((t,n)=>{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(de(s))if(ce(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(de(n))if(le(n)&&!pe(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else ce(n)&&n.forEach((e,i)=>{t.push({nestedArrIndex:i,value:e})})}i.$[n]=e}else if(le(s)&&!pe(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}}),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function we(e,t,{getFn:i=Ee.getFn,fieldNormWeight:n=Ee.fieldNormWeight}={}){const s=new Se({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(ge)),s.setSources(t),s.create(),s}function Ie(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=Ee.distance,ignoreLocation:o=Ee.ignoreLocation}={}){const r=t/e.length;if(o)return r;const a=Math.abs(n-i);return s?r+a/s:a?1:r}const Ae=32;function xe(e){let t={};for(let i=0,n=e.length;i<n;i+=1){const s=e.charAt(i);t[s]=(t[s]||0)|1<<n-i-1}return t}class Oe{constructor(e,{location:t=Ee.location,threshold:i=Ee.threshold,distance:n=Ee.distance,includeMatches:s=Ee.includeMatches,findAllMatches:o=Ee.findAllMatches,minMatchCharLength:r=Ee.minMatchCharLength,isCaseSensitive:a=Ee.isCaseSensitive,ignoreLocation:c=Ee.ignoreLocation}={}){if(this.options={location:t,threshold:i,distance:n,includeMatches:s,findAllMatches:o,minMatchCharLength:r,isCaseSensitive:a,ignoreLocation:c},this.pattern=a?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(e,t)=>{this.chunks.push({pattern:e,alphabet:xe(e),startIndex:t})},h=this.pattern.length;if(h>Ae){let e=0;const t=h%Ae,i=h-t;for(;e<i;)l(this.pattern.substr(e,Ae),e),e+=Ae;if(t){const e=h-Ae;l(this.pattern.substr(e),e)}}else l(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:i}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return i&&(t.indices=[[0,e.length-1]]),t}const{location:n,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:a,ignoreLocation:c}=this.options;let l=[],h=0,u=!1;this.chunks.forEach(({pattern:t,alphabet:d,startIndex:p})=>{const{isMatch:m,score:f,indices:v}=function(e,t,i,{location:n=Ee.location,distance:s=Ee.distance,threshold:o=Ee.threshold,findAllMatches:r=Ee.findAllMatches,minMatchCharLength:a=Ee.minMatchCharLength,includeMatches:c=Ee.includeMatches,ignoreLocation:l=Ee.ignoreLocation}={}){if(t.length>Ae)throw new Error("Pattern length exceeds max of 32.");const h=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,m=d;const f=a>1||c,v=f?Array(u):[];let g;for(;(g=e.indexOf(t,m))>-1;){let e=Ie(t,{currentLocation:g,expectedLocation:d,distance:s,ignoreLocation:l});if(p=Math.min(e,p),m=g+h,f){let e=0;for(;e<h;)v[g+e]=1,e+=1}}m=-1;let _=[],y=1,b=h+u;const E=1<<h-1;for(let S=0;S<h;S+=1){let n=0,o=b;for(;n<o;)Ie(t,{errors:S,currentLocation:d+o,expectedLocation:d,distance:s,ignoreLocation:l})<=p?n=o:b=o,o=Math.floor((b-n)/2+n);b=o;let a=Math.max(1,d-o+1),c=r?u:Math.min(d+o,u)+h,g=Array(c+2);g[c+1]=(1<<S)-1;for(let r=c;r>=a;r-=1){let n=r-1,o=i[e.charAt(n)];if(f&&(v[n]=+!!o),g[r]=(g[r+1]<<1|1)&o,S&&(g[r]|=(_[r+1]|_[r])<<1|1|_[r+1]),g[r]&E&&(y=Ie(t,{errors:S,currentLocation:n,expectedLocation:d,distance:s,ignoreLocation:l}),y<=p)){if(p=y,m=n,m<=d)break;a=Math.max(1,2*d-m)}}if(Ie(t,{errors:S+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:l})>p)break;_=g}const C={isMatch:m>=0,score:Math.max(.001,y)};if(f){const e=function(e=[],t=Ee.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o<r;o+=1){let r=e[o];r&&-1===n?n=o:r||-1===n||(s=o-1,s-n+1>=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(v,a);e.length?c&&(C.indices=e):C.isMatch=!1}return C}(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:a,includeMatches:i,ignoreLocation:c});m&&(u=!0),h+=f,m&&v&&(l=[...l,...v])});let d={isMatch:u,score:u?h/this.chunks.length:1};return u&&i&&(d.indices=l),d}}class Le{constructor(e){this.pattern=e}static isMultiMatch(e){return Me(e,this.multiRegex)}static isSingleMatch(e){return Me(e,this.singleRegex)}search(){}}function Me(e,t){const i=e.match(t);return i?i[1]:null}class Te extends Le{constructor(e,{location:t=Ee.location,threshold:i=Ee.threshold,distance:n=Ee.distance,includeMatches:s=Ee.includeMatches,findAllMatches:o=Ee.findAllMatches,minMatchCharLength:r=Ee.minMatchCharLength,isCaseSensitive:a=Ee.isCaseSensitive,ignoreLocation:c=Ee.ignoreLocation}={}){super(e),this._bitapSearch=new Oe(e,{location:t,threshold:i,distance:n,includeMatches:s,findAllMatches:o,minMatchCharLength:r,isCaseSensitive:a,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Ne extends Le{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,i=0;const n=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,i))>-1;)i=t+s,n.push([t,i-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}const Fe=[class extends Le{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},Ne,class extends Le{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends Le{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends Le{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends Le{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends Le{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},Te],ke=Fe.length,De=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Pe=new Set([Te.type,Ne.type]),je=[];function Ke(e,t){for(let i=0,n=je.length;i<n;i+=1){let n=je[i];if(n.condition(e,t))return new n(e,t)}return new Oe(e,t)}const Ve="$and",Re="$path",Be=e=>!(!e[Ve]&&!e.$or),$e=e=>({[Ve]:Object.keys(e).map(t=>({[t]:e[t]}))});function qe(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[Re])(e);if(!o&&s.length>1&&!Be(e))return n($e(e));if((e=>!ce(e)&&ue(e)&&!Be(e))(e)){const n=o?e[Re]:s[0],r=o?e.$val:e[n];if(!le(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const a={keyId:ye(n),pattern:r};return i&&(a.searcher=Ke(r,t)),a}let r={children:[],operator:s[0]};return s.forEach(t=>{const i=e[t];ce(i)&&i.forEach(e=>{r.children.push(n(e))})}),r};return Be(e)||(e=$e(e)),n(e)}function He(e,t){const i=e.matches;t.matches=[],de(i)&&i.forEach(e=>{if(!de(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)})}function We(e,t){t.score=e.score}class Ge{constructor(e,t={},i){this.options=ae(ae({},Ee),t),this.options.useExtendedSearch,this._keyStore=new ve(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Se))throw new Error("Incorrect 'index' type");this._myIndex=t||we(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){de(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i<n;i+=1){const s=this._docs[i];e(s,i)&&(this.removeAt(i),i-=1,n-=1,t.push(s))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:i,includeScore:n,shouldSort:s,sortFn:o,ignoreFieldNorm:r}=this.options;let a=le(e)?le(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=Ee.ignoreFieldNorm}){e.forEach(e=>{let i=1;e.matches.forEach(({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))}),e.score=i})}(a,{ignoreFieldNorm:r}),s&&a.sort(o),he(t)&&t>-1&&(a=a.slice(0,t)),function(e,t,{includeMatches:i=Ee.includeMatches,includeScore:n=Ee.includeScore}={}){const s=[];return i&&s.push(He),n&&s.push(We),e.map(e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach(t=>{t(e,n)}),n})}(a,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=Ke(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach(({v:e,i:i,n:s})=>{if(!de(e))return;const{isMatch:o,score:r,indices:a}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:a}]})}),n}_searchLogical(e){const t=qe(e,this.options),i=(e,t,n)=>{if(!e.children){const{keyId:i,searcher:s}=e,o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(t,i),searcher:s});return o&&o.length?[{idx:n,item:t,matches:o}]:[]}const s=[];for(let o=0,r=e.children.length;o<r;o+=1){const r=e.children[o],a=i(r,t,n);if(a.length)s.push(...a);else if(e.operator===Ve)return[]}return s},n=this._myIndex.records,s={},o=[];return n.forEach(({$:e,i:n})=>{if(de(e)){let r=i(t,e,n);r.length&&(s[n]||(s[n]={idx:n,item:e,matches:[]},o.push(s[n])),r.forEach(({matches:e})=>{s[n].matches.push(...e)}))}}),o}_searchObjectList(e){const t=Ke(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach(({$:e,i:n})=>{if(!de(e))return;let o=[];i.forEach((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))}),o.length&&s.push({idx:n,item:e,matches:o})}),s}_findMatches({key:e,value:t,searcher:i}){if(!de(t))return[];let n=[];if(ce(t))t.forEach(({v:t,i:s,n:o})=>{if(!de(t))return;const{isMatch:r,score:a,indices:c}=i.searchIn(t);r&&n.push({score:a,key:e,value:t,idx:s,norm:o,indices:c})});else{const{v:s,n:o}=t,{isMatch:r,score:a,indices:c}=i.searchIn(s);r&&n.push({score:a,key:e,value:s,norm:o,indices:c})}return n}}Ge.version="7.0.0",Ge.createIndex=we,Ge.parseIndex=function(e,{getFn:t=Ee.getFn,fieldNormWeight:i=Ee.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new Se({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},Ge.config=Ee,Ge.parseQuery=qe,function(...e){je.push(...e)}(class{constructor(e,{isCaseSensitive:t=Ee.isCaseSensitive,includeMatches:i=Ee.includeMatches,minMatchCharLength:n=Ee.minMatchCharLength,ignoreLocation:s=Ee.ignoreLocation,findAllMatches:o=Ee.findAllMatches,location:r=Ee.location,threshold:a=Ee.threshold,distance:c=Ee.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:s,location:r,threshold:a,distance:c},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map(e=>{let i=e.trim().split(De).filter(e=>e&&!!e.trim()),n=[];for(let s=0,o=i.length;s<o;s+=1){const e=i[s];let o=!1,r=-1;for(;!o&&++r<ke;){const i=Fe[r];let s=i.isMultiMatch(e);s&&(n.push(new i(s,t)),o=!0)}if(!o)for(r=-1;++r<ke;){const i=Fe[r];let s=i.isSingleMatch(e);if(s){n.push(new i(s,t));break}}}return n})}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:i,isCaseSensitive:n}=this.options;e=n?e:e.toLowerCase();let s=0,o=[],r=0;for(let a=0,c=t.length;a<c;a+=1){const n=t[a];o.length=0,s=0;for(let t=0,a=n.length;t<a;t+=1){const a=n[t],{isMatch:c,indices:l,score:h}=a.search(e);if(!c){r=0,s=0,o.length=0;break}if(s+=1,r+=h,i){const e=a.constructor.type;Pe.has(e)?o=[...o,...l]:o.push(l)}}if(s){let e={isMatch:!0,score:r/s};return i&&(e.indices=o),e}}return{isMatch:!1,score:1}}});var Ue=function(){function e(e){this._haystack=[],this._fuseOptions=s(s({},e.fuseOptions),{keys:o([],e.searchFields),includeMatches:!0})}return e.prototype.index=function(e){this._haystack=e,this._fuse&&this._fuse.setCollection(e)},e.prototype.reset=function(){this._haystack=[],this._fuse=void 0},e.prototype.isEmptyIndex=function(){return!this._haystack.length},e.prototype.search=function(e){return this._fuse||(this._fuse=new Ge(this._haystack,this._fuseOptions)),this._fuse.search(e).map(function(e,t){return{item:e.item,score:e.score||0,rank:t+1}})},e}(),ze=function(e,t,i){var n=e.dataset,s=t.customProperties,o=t.labelClass,r=t.labelDescription;o&&(n.labelClass=P(o).join(" ")),r&&(n.labelDescription=r),i&&s&&("string"==typeof s?n.customProperties=s:"object"!=typeof s||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(s)||(n.customProperties=JSON.stringify(s)))},Je=function(e,t,i){var n=t&&e.querySelector("label[for='".concat(t,"']")),s=n&&n.innerText;s&&i.setAttribute("aria-label",s)},Xe={containerOuter:function(e,t,i,n,s,o,r){var a=e.classNames.containerOuter,c=document.createElement("div");return K(c,a),c.dataset.type=o,t&&(c.dir=t),n&&(c.tabIndex=0),i&&(c.setAttribute("role",s?"combobox":"listbox"),s?c.setAttribute("aria-autocomplete","list"):r||Je(this._docRoot,this.passedElement.element.id,c),c.setAttribute("aria-haspopup","true"),c.setAttribute("aria-expanded","false")),r&&c.setAttribute("aria-labelledby",r),c},containerInner:function(e){var t=e.classNames.containerInner,i=document.createElement("div");return K(i,t),i},itemList:function(e,t){var i=e.searchEnabled,n=e.classNames,s=n.list,o=n.listSingle,r=n.listItems,a=document.createElement("div");return K(a,s),K(a,t?o:r),this._isSelectElement&&i&&a.setAttribute("role","listbox"),a},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder,s=document.createElement("div");return K(s,n),k(s,i,t),s},item:function(e,t,i){var n=e.allowHTML,s=e.removeItemButtonAlignLeft,o=e.removeItemIconText,r=e.removeItemLabelText,a=e.classNames,c=a.item,l=a.button,h=a.highlightedState,u=a.itemSelectable,d=a.placeholder,p=T(t.value),m=document.createElement("div");if(K(m,c),t.labelClass){var f=document.createElement("span");k(f,n,t.label),K(f,t.labelClass),m.appendChild(f)}else k(m,n,t.label);if(m.dataset.item="",m.dataset.id=t.id,m.dataset.value=p,ze(m,t,!0),(t.disabled||this.containerOuter.isDisabled)&&m.setAttribute("aria-disabled","true"),this._isSelectElement&&(m.setAttribute("aria-selected","true"),m.setAttribute("role","option")),t.placeholder&&(K(m,d),m.dataset.placeholder=""),K(m,t.highlighted?h:u),i){t.disabled&&V(m,u),m.dataset.deletable="";var v=document.createElement("button");v.type="button",K(v,l),k(v,!0,L(o,t.value));var g=L(r,t.value);g&&v.setAttribute("aria-label",g),v.dataset.button="",s?m.insertAdjacentElement("afterbegin",v):m.appendChild(v)}return m},choiceList:function(e,t){var i=e.classNames.list,n=document.createElement("div");return K(n,i),t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,a=t.id,c=t.label,l=t.disabled,h=T(c),u=document.createElement("div");K(u,s),l&&K(u,r),u.setAttribute("role","group"),u.dataset.group="",u.dataset.id=a,u.dataset.value=h,l&&u.setAttribute("aria-disabled","true");var d=document.createElement("div");return K(d,o),k(d,i,c||""),u.appendChild(d),u},choice:function(e,t,i,n){var s=e.allowHTML,o=e.classNames,r=o.item,a=o.itemChoice,c=o.itemSelectable,l=o.selectedState,h=o.itemDisabled,u=o.description,d=o.placeholder,p=t.label,m=T(t.value),f=document.createElement("div");f.id=t.elementId,K(f,r),K(f,a),n&&"string"==typeof p&&(p=F(s,p),p={trusted:p+=" (".concat(n,")")});var v=f;if(t.labelClass){var g=document.createElement("span");k(g,s,p),K(g,t.labelClass),v=g,f.appendChild(g)}else k(f,s,p);if(t.labelDescription){var _="".concat(t.elementId,"-description");v.setAttribute("aria-describedby",_);var y=document.createElement("span");k(y,s,t.labelDescription),y.id=_,K(y,u),f.appendChild(y)}return t.selected&&K(f,l),t.placeholder&&K(f,d),f.setAttribute("role",t.group?"treeitem":"option"),f.dataset.choice="",f.dataset.id=t.id,f.dataset.value=m,i&&(f.dataset.selectText=i),t.group&&(f.dataset.groupId="".concat(t.group.id)),ze(f,t,!1),t.disabled?(K(f,h),f.dataset.choiceDisabled="",f.setAttribute("aria-disabled","true")):(K(f,c),f.dataset.choiceSelectable=""),f},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=e.labelId,r=document.createElement("input");return r.type="search",K(r,n),K(r,s),r.autocomplete="off",r.autocapitalize="off",r.spellcheck=!1,r.setAttribute("aria-autocomplete","list"),t?r.setAttribute("aria-label",t):o||Je(this._docRoot,this.passedElement.element.id,r),r},dropdown:function(e){var t=e.classNames,i=t.list,n=t.listDropdown,s=document.createElement("div");return K(s,i),K(s,n),s.setAttribute("aria-expanded","false"),s},notice:function(e,t,i){var n=e.classNames,s=n.item,o=n.itemChoice,r=n.addChoice,a=n.noResults,c=n.noChoices,l=n.notice;void 0===i&&(i="");var h=document.createElement("div");switch(k(h,!0,t),K(h,s),K(h,o),K(h,l),i){case se:K(h,r);break;case ne:K(h,a);break;case ie:K(h,c)}return i===se&&(h.dataset.choiceSelectable="",h.dataset.choice=""),h},option:function(e){var t=T(e.label),i=new Option(t,e.value,!1,e.selected);return ze(i,e,!0),i.disabled=e.disabled,e.selected&&i.setAttribute("selected",""),i}},Qe="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ye={},Ze=function(e){if(e)return e.dataset.id?parseInt(e.dataset.id,10):void 0},et="[data-choice-selectable]",tt=function(){function e(t,i){void 0===t&&(t="[data-choice]"),void 0===i&&(i={});var n=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var o=e.defaults;this.config=s(s(s({},o.allOptions),o.options),i),y.forEach(function(e){n.config[e]=s(s(s({},o.allOptions[e]),o.options[e]),i[e])});var r=this.config;r.silent||this._validateConfig();var a=r.shadowRoot||document.documentElement;this._docRoot=a;var c="string"==typeof t?a.querySelector(t):t;if(!c||"object"!=typeof c||"INPUT"!==c.tagName&&!X(c)){if(!c&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}var l=c.type,h="text"===l;(h||1!==r.maxItemCount)&&(r.singleModeForMultiSelect=!1),r.singleModeForMultiSelect&&(l=E);var u=l===b,d=l===E,p=u||d;if(this._elementType=l,this._isTextElement=h,this._isSelectOneElement=u,this._isSelectMultipleElement=d,this._isSelectElement=u||d,this._canAddUserChoices=h&&r.addItems||p&&r.addChoices,"boolean"!=typeof r.renderSelectedChoices&&(r.renderSelectedChoices="always"===r.renderSelectedChoices||u),"auto"===r.closeDropdownOnSelect?r.closeDropdownOnSelect=h||u||r.singleModeForMultiSelect:r.closeDropdownOnSelect=U(r.closeDropdownOnSelect),r.placeholder&&(r.placeholderValue?this._hasNonChoicePlaceholder=!0:c.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,r.placeholderValue=c.dataset.placeholder)),i.addItemFilter&&"function"!=typeof i.addItemFilter){var m=i.addItemFilter instanceof RegExp?i.addItemFilter:new RegExp(i.addItemFilter);r.addItemFilter=m.test.bind(m)}if(this._isTextElement)this.passedElement=new G({element:c,classNames:r.classNames});else{var f=c;this.passedElement=new Q({element:f,classNames:r.classNames,template:function(e){return n._templates.option(e)},extractPlaceholder:r.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new te(r),this._currentValue="",r.searchEnabled=!h&&r.searchEnabled||d,this._canSearch=r.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e){var t=e.id||e.name&&"".concat(e.name,"-").concat(A(2))||A(4);return t=t.replace(/(:|\.|\[|\]|,)/g,""),"".concat("choices-","-").concat(t)}(c),this._direction=c.dir,!this._direction){var v=window.getComputedStyle(c).direction;v!==window.getComputedStyle(document.documentElement).direction&&(this._direction=v)}if(this._idNames={itemChoice:"item-choice"},this._templates=o.templates,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._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return r.silent,this.initialised=!0,void(this.initialisedOK=!1);this.init(),this._initialItems=this._store.items.map(function(e){return e.value})}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ye},get allOptions(){return Y},get templates(){return Xe}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised&&void 0===this.initialisedOK){var e;this._searcher=(e=this.config,new Ue(e)),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var t=this.config.callbackOnInit;"function"==typeof t&&t.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=e.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.items.find(function(t){return t.id===e.id});return!i||i.highlighted||(this._store.dispatch(I(i,!0)),t&&this.passedElement.triggerEvent(_,this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.items.find(function(t){return t.id===e.id});return i&&i.highlighted?(this._store.dispatch(I(i,!1)),t&&this.passedElement.triggerEvent("unhighlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withTxn(function(){e._store.items.forEach(function(t){t.highlighted||(e._store.dispatch(I(t,!0)),e.passedElement.triggerEvent(_,e._getChoiceForOutput(t)))})}),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withTxn(function(){e._store.items.forEach(function(t){t.highlighted&&(e._store.dispatch(I(t,!1)),e.passedElement.triggerEvent(_,e._getChoiceForOutput(t)))})}),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withTxn(function(){t._store.items.filter(function(t){return t.value===e}).forEach(function(e){return t._removeItem(e)})}),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withTxn(function(){t._store.items.filter(function(t){return t.id!==e}).forEach(function(e){return t._removeItem(e)})}),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withTxn(function(){t._store.highlightedActiveItems.forEach(function(i){t._removeItem(i),e&&t._triggerChange(i.value)})}),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||(void 0===e&&(e=!this._canSearch),requestAnimationFrame(function(){t.dropdown.show();var i=t.dropdown.element.getBoundingClientRect();t.containerOuter.open(i.bottom,i.height),e||t.input.focus(),t.passedElement.triggerEvent("showDropdown")})),this},e.prototype.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("hideDropdown")}),this):this},e.prototype.getValue=function(e){var t=this,i=this._store.items.map(function(i){return e?i.value:t._getChoiceForOutput(i)});return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialisedOK?(this._store.withTxn(function(){e.forEach(function(e){e&&t._addChoice(J(e,!1))})}),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},e.proto