diff --git a/CHANGELOG.md b/CHANGELOG.md index a382622..a026e8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## v2.5.6 + +> `2022-09-28` + +### 🐞 Bug Fixes + - Async options resolve fix [#266](https://github.com/vueform/multiselect/issues/266). + ## v2.5.5 > `2022-09-26` diff --git a/dist/multiselect.global.js b/dist/multiselect.global.js index 969685d..e5d6b98 100644 --- a/dist/multiselect.global.js +++ b/dist/multiselect.global.js @@ -1 +1 @@ -var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,n){const{object:u,valueProp:r,mode:i}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=n.iv,c=e=>u.value||a(e)?e:Array.isArray(e)?e.map((e=>e[r.value])):e[r.value],d=e=>a(e)?"single"===i.value?{}:[]:e;return{update:e=>{s.value=d(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:n,mode:u,valueProp:r}=e.toRefs(a),i=e.ref("single"!==u.value?[]:{}),o=n&&void 0!==n.value?n:t,s=e.computed((()=>"single"===u.value?i.value[r.value]:i.value.map((e=>e[r.value])))),c=e.computed((()=>"single"!==u.value?i.value.map((e=>e[r.value])).join(","):i.value[r.value]));return{iv:i,internalValue:i,ev:o,externalValue:o,textValue:c,plainValue:s}}function n(a,l,t){const{regex:n}=e.toRefs(a),u=e.getCurrentInstance().proxy,r=t.isOpen,i=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!r.value&&e&&i(),l.emit("search-change",e,u)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(n&&n.value){let a=n.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(n&&n.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=n.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,u)}}}function u(a,l,t){const{groupSelect:n,mode:u,groups:r,disabledProp:i}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[i.value]||r.value&&e&&e.group&&("single"===u.value||!n.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function r(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function i(l,t,n){const{options:u,mode:i,trackBy:o,limit:s,hideSelected:c,createTag:d,createOption:v,label:p,appendNewTag:m,appendNewOption:f,multipleLabel:g,object:h,loading:b,delay:y,resolveOnLoad:S,minChars:k,filterResults:L,clearOnSearch:O,clearOnSelect:C,valueProp:w,canDeselect:E,max:T,strict:V,closeOnSelect:x,groups:B,reverse:q,infinite:P,groupOptions:N,groupHideEmpty:_,groupSelect:I,onCreate:R,disabledProp:D,searchStart:M}=e.toRefs(l),A=e.getCurrentInstance().proxy,z=n.iv,j=n.ev,H=n.search,K=n.clearSearch,$=n.update,F=n.pointer,G=n.clearPointer,W=n.focus,U=n.deactivate,J=n.close,Q=e.ref([]),X=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(P.value&&-1===s.value?10:s.value),ae=e.computed((()=>d.value||v.value||!1)),le=e.computed((()=>void 0!==m.value?m.value:void 0===f.value||f.value)),te=e.computed((()=>{if(B.value){let e=X.value||[],a=[];return e.forEach((e=>{Pe(e[N.value]).forEach((l=>{a.push(Object.assign({},l,e[D.value]?{[D.value]:!0}:{}))}))})),a}{let e=Pe(X.value||[]);return Q.value.length&&(e=e.concat(Q.value)),e}})),ne=e.computed((()=>B.value?Be((X.value||[]).map(((e,a)=>{const l=Pe(e[N.value]);return{...e,index:a,group:!0,[N.value]:qe(l,!1).map((a=>Object.assign({},a,e[D.value]?{[D.value]:!0}:{}))),__VISIBLE__:qe(l).map((a=>Object.assign({},a,e[D.value]?{[D.value]:!0}:{})))}}))):[])),ue=e.computed((()=>{let e=te.value;return q.value&&(e=e.reverse()),de.value.length&&(e=de.value.concat(e)),qe(e)})),re=e.computed((()=>{let e=ue.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),ie=e.computed((()=>{switch(i.value){case"single":return!a(z.value[w.value]);case"multiple":case"tags":return!a(z.value)&&z.value.length>0}})),oe=e.computed((()=>void 0!==g&&void 0!==g.value?g.value(z.value,A):z.value&&z.value.length>1?`${z.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!de.value.length)),ce=e.computed((()=>te.value.length>0&&0==re.value.length&&(H.value&&B.value||!B.value))),de=e.computed((()=>!1!==ae.value&&H.value?-1!==Ve(H.value)?[]:[{[w.value]:H.value,[p.value]:H.value,[ve.value]:H.value,__CREATE__:!0}]:[])),ve=e.computed((()=>o.value||p.value)),pe=e.computed((()=>{switch(i.value){case"single":return null;case"multiple":case"tags":return[]}})),me=e.computed((()=>b.value||Y.value)),fe=e=>{switch("object"!=typeof e&&(e=Te(e)),i.value){case"single":$(e);break;case"multiple":case"tags":$(z.value.concat(e))}t.emit("select",he(e),e,A)},ge=e=>{switch("object"!=typeof e&&(e=Te(e)),i.value){case"single":ye();break;case"tags":case"multiple":$(Array.isArray(e)?z.value.filter((a=>-1===e.map((e=>e[w.value])).indexOf(a[w.value]))):z.value.filter((a=>a[w.value]!=e[w.value])))}t.emit("deselect",he(e),e,A)},he=e=>h.value?e:e[w.value],be=e=>{ge(e)},ye=()=>{t.emit("clear",A),$(pe.value)},Se=e=>{if(void 0!==e.group)return"single"!==i.value&&(Ee(e[N.value])&&e[N.value].length);switch(i.value){case"single":return!a(z.value)&&z.value[w.value]==e[w.value];case"tags":case"multiple":return!a(z.value)&&-1!==z.value.map((e=>e[w.value])).indexOf(e[w.value])}},ke=e=>!0===e[D.value],Le=()=>!(void 0===T||-1===T.value||!ie.value&&T.value>0)&&z.value.length>=T.value,Oe=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,i.value){case"single":if(e&&Se(e))return void(E.value&&ge(e));e&&Ce(e),C.value&&K(),x.value&&(G(),J()),e&&fe(e);break;case"multiple":if(e&&Se(e))return void ge(e);if(Le())return;e&&(Ce(e),fe(e)),C.value&&K(),c.value&&G(),x.value&&J();break;case"tags":if(e&&Se(e))return void ge(e);if(Le())return;e&&Ce(e),C.value&&K(),e&&fe(e),c.value&&G(),x.value&&J()}x.value||W()},Ce=e=>{void 0===Te(e[w.value])&&ae.value&&(t.emit("tag",e[w.value],A),t.emit("option",e[w.value],A),le.value&&xe(e),K())},we=e=>void 0===e.find((e=>!Se(e)&&!e[D.value])),Ee=e=>void 0===e.find((e=>!Se(e))),Te=e=>te.value[te.value.map((e=>String(e[w.value]))).indexOf(String(e))],Ve=(e,a=!0)=>te.value.map((e=>parseInt(e[ve.value])==e[ve.value]?parseInt(e[ve.value]):e[ve.value])).indexOf(parseInt(e)==e?parseInt(e):e),xe=e=>{Q.value.push(e)},Be=e=>_.value?e.filter((e=>H.value?e.__VISIBLE__.length:e[N.value].length)):e.filter((e=>!H.value||e.__VISIBLE__.length)),qe=(e,a=!0)=>{let l=e;return H.value&&L.value&&(l=l.filter((e=>M.value?r(e[ve.value],V.value).startsWith(r(H.value,V.value)):-1!==r(e[ve.value],V.value).indexOf(r(H.value,V.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(i.value)&&c.value&&Se(e))(e)))),l},Pe=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[w.value]:e,[ve.value]:l,[p.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[w.value]:e,[ve.value]:e,[p.value]:e})),a},Ne=()=>{a(j.value)||(z.value=Re(j.value))},_e=e=>(Y.value=!0,new Promise(((a,l)=>{u.value(H.value,A).then((a=>{X.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),X.value=[],Y.value=!1})).finally((()=>{a()}))}))),Ie=()=>{if(ie.value)if("single"===i.value){let e=Te(z.value[w.value]);if(void 0!==e){let a=e[p.value];z.value[p.value]=a,h.value&&(j.value[p.value]=a)}}else z.value.forEach(((e,a)=>{let l=Te(z.value[a][w.value]);if(void 0!==l){let e=l[p.value];z.value[a][p.value]=e,h.value&&(j.value[a][p.value]=e)}}))},Re=e=>a(e)?"single"===i.value?{}:[]:h.value?e:"single"===i.value?Te(e)||{}:e.filter((e=>!!Te(e))).map((e=>Te(e))),De=()=>{Z.value=e.watch(H,(e=>{e.length{e==H.value&&u.value(H.value,A).then((a=>{e!=H.value&&H.value||(X.value=a,F.value=re.value.filter((e=>!0!==e[D.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==i.value&&!a(j.value)&&!Array.isArray(j.value))throw new Error(`v-model must be an array when using "${i.value}" mode`);return u&&"function"==typeof u.value?S.value?_e(Ne):1==h.value&&Ne():(X.value=u.value,Ne()),y.value>-1&&De(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&De()})),e.watch(j,(e=>{if(a(e))z.value=Re(e);else switch(i.value){case"single":(h.value?e[w.value]!=z.value[w.value]:e!=z.value[w.value])&&(z.value=Re(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(h.value?e.map((e=>e[w.value])):e,z.value.map((e=>e[w.value])))||(z.value=Re(e))}}),{deep:!0}),e.watch(u,((e,a)=>{"function"==typeof l.options?S.value&&_e():(X.value=l.options,Object.keys(z.value).length||Ne(),Ie())})),e.watch(p,Ie),{pfo:ue,fo:re,filteredOptions:re,hasSelected:ie,multipleLabelText:oe,eo:te,extendedOptions:te,fg:ne,filteredGroups:ne,noOptions:se,noResults:ce,resolving:Y,busy:me,offset:ee,select:fe,deselect:ge,remove:be,selectAll:()=>{"single"!==i.value&&fe(re.value)},clear:ye,isSelected:Se,isDisabled:ke,isMax:Le,getOption:Te,handleOptionClick:e=>{if(!ke(e))return R&&R.value&&!Se(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=R.value(e,A))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Oe(e)}))):void Oe(e)},handleGroupClick:e=>{if(!ke(e)&&"single"!==i.value&&I.value){switch(i.value){case"multiple":case"tags":we(e[N.value])?ge(e[N.value]):fe(e[N.value].filter((e=>-1===z.value.map((e=>e[w.value])).indexOf(e[w.value]))).filter((e=>!e[D.value])).filter(((e,a)=>z.value.length+1+a<=T.value||-1===T.value)))}x.value&&U()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{_e(e)},resolveOptions:_e,refreshLabels:Ie}}function o(a,l,t){const{valueProp:n,showOptions:u,searchable:r,groupLabel:i,groups:o,mode:s,groupSelect:c,disabledProp:d}=e.toRefs(a),v=t.fo,p=t.fg,m=t.handleOptionClick,f=t.handleGroupClick,g=t.search,h=t.pointer,b=t.setPointer,y=t.clearPointer,S=t.multiselect,k=t.isOpen,L=e.computed((()=>v.value.filter((e=>!e[d.value])))),O=e.computed((()=>p.value.filter((e=>!e[d.value])))),C=e.computed((()=>"single"!==s.value&&c.value)),w=e.computed((()=>h.value&&h.value.group)),E=e.computed((()=>R(h.value))),T=e.computed((()=>{const e=w.value?h.value:R(h.value),a=O.value.map((e=>e[i.value])).indexOf(e[i.value]);let l=O.value[a-1];return void 0===l&&(l=x.value),l})),V=e.computed((()=>{let e=O.value.map((e=>e.label)).indexOf(w.value?h.value[i.value]:R(h.value)[i.value])+1;return O.value.length<=e&&(e=0),O.value[e]})),x=e.computed((()=>[...O.value].slice(-1)[0])),B=e.computed((()=>h.value.__VISIBLE__.filter((e=>!e[d.value]))[0])),q=e.computed((()=>{const e=E.value.__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[n.value])).indexOf(h.value[n.value])-1]})),P=e.computed((()=>{const e=R(h.value).__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[n.value])).indexOf(h.value[n.value])+1]})),N=e.computed((()=>[...T.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),_=e.computed((()=>[...x.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),I=()=>{b(L.value[0]||null)},R=e=>O.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[n.value])).indexOf(e[n.value]))),D=()=>{let e=S.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=w.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop{r.value&&(e.length&&u.value?I():y())})),e.watch(k,(a=>{if(a){let a=S.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:h,canPointGroups:C,isPointed:e=>!(!h.value||!(!e.group&&h.value[n.value]==e[n.value]||void 0!==e.group&&h.value[i.value]==e[i.value]))||void 0,setPointerFirst:I,selectPointer:()=>{h.value&&!0!==h.value[d.value]&&(w.value?f(h.value):m(h.value))},forwardPointer:()=>{if(null===h.value)b((o.value&&C.value?O.value[0]:L.value[0])||null);else if(o.value&&C.value){let e=w.value?B.value:P.value;void 0===e&&(e=V.value),b(e||null)}else{let e=L.value.map((e=>e[n.value])).indexOf(h.value[n.value])+1;L.value.length<=e&&(e=0),b(L.value[e]||null)}e.nextTick((()=>{D()}))},backwardPointer:()=>{if(null===h.value){let e=L.value[L.value.length-1];o.value&&C.value&&(e=_.value,void 0===e&&(e=x.value)),b(e||null)}else if(o.value&&C.value){let e=w.value?N.value:q.value;void 0===e&&(e=w.value?T.value:E.value),b(e||null)}else{let e=L.value.map((e=>e[n.value])).indexOf(h.value[n.value])-1;e<0&&(e=L.value.length-1),b(L.value[e]||null)}e.nextTick((()=>{D()}))}}}function s(a,l,t){const{disabled:n}=e.toRefs(a),u=e.getCurrentInstance().proxy,r=e.ref(!1);return{isOpen:r,open:()=>{r.value||n.value||(r.value=!0,l.emit("open",u))},close:()=>{r.value&&(r.value=!1,l.emit("close",u))}}}function c(a,l,t){const{searchable:n,disabled:u}=e.toRefs(a),r=t.input,i=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,d=e.ref(null),v=e.ref(null),p=e.ref(!1),m=e.ref(!1),f=e.computed((()=>n.value||u.value?-1:0)),g=()=>{n.value&&r.value.blur(),d.value.blur()},h=(e=!0)=>{u.value||(p.value=!0,e&&i())},b=()=>{p.value=!1,setTimeout((()=>{p.value||(o(),s())}),1)};return{multiselect:d,tags:v,tabindex:f,isActive:p,mouseClicked:m,blur:g,focus:()=>{n.value&&!u.value&&r.value.focus()},activate:h,deactivate:b,handleFocusIn:()=>{h(m.value)},handleFocusOut:()=>{b()},handleCaretClick:()=>{b(),g()},handleMousedown:e=>{m.value=!0,c.value&&(e.target.isEqualNode(d.value)||e.target.isEqualNode(v.value))?setTimeout((()=>{b()}),0):document.activeElement.isEqualNode(d.value)&&!c.value&&h(),setTimeout((()=>{m.value=!1}),0)}}}function d(a,l,t){const{mode:n,addTagOn:u,openDirection:r,searchable:i,showOptions:o,valueProp:s,groups:c,addOptionOn:d,createTag:v,createOption:p,reverse:m}=e.toRefs(a),f=e.getCurrentInstance().proxy,g=t.iv,h=t.update,b=t.search,y=t.setPointer,S=t.selectPointer,k=t.backwardPointer,L=t.forwardPointer,O=t.multiselect,C=t.tags,w=t.isOpen,E=t.open,T=t.blur,V=t.fo,x=e.computed((()=>v.value||p.value||!1)),B=e.computed((()=>void 0!==u.value?u.value:void 0!==d.value?d.value:["enter"])),q=()=>{"tags"===n.value&&!o.value&&x.value&&i.value&&!c.value&&y(V.value[V.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,f),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===n.value&&(a=[...O.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==C.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===n.value)return;if(i.value&&-1===[null,""].indexOf(b.value))return;if(0===g.value.length)return;h([...g.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),-1!==t&&void 0!==t)return h([...g.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():i.value?C.value.querySelector("input").focus():O.value.focus()));if(-1===B.value.indexOf("enter")&&x.value)return;q(),S();break;case" ":if(!x.value&&!i.value)return e.preventDefault(),q(),void S();if(!x.value)return!1;if(-1===B.value.indexOf("space")&&x.value)return;e.preventDefault(),q(),S();break;case"Tab":case";":case",":if(-1===B.value.indexOf(e.key.toLowerCase())||!x.value)return;q(),S(),e.preventDefault();break;case"Escape":T();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;w.value||E(),k();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;w.value||E(),L();break;case"ArrowLeft":if(i.value&&C.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==n.value||!g.value||!g.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==n.value||!g.value||!g.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():i.value?C.value.querySelector("input").focus():i.value||O.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,f)},preparePointer:q}}function v(a,l,t){const{classes:n,disabled:u,openDirection:r,showOptions:i}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,d=t.isDisabled,v=t.isActive,p=t.canPointGroups,m=t.resolving,f=t.fo,g=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer",...n.value}))),h=e.computed((()=>!!(o.value&&i.value&&(!m.value||m.value&&f.value.length))));return{classList:e.computed((()=>{const e=g.value;return{container:[e.container].concat(u.value?e.containerDisabled:[]).concat(h.value&&"top"===r.value?e.containerOpenTop:[]).concat(h.value&&"top"!==r.value?e.containerOpen:[]).concat(v.value?e.containerActive:[]),spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(u.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===r.value?e.dropdownTop:[]).concat(o.value&&i.value&&h.value?[]:e.dropdownHidden),options:[e.options].concat("top"===r.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&p.value?l.push(d(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):d(a)&&l.push(e.groupLabelDisabled),p.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(d(a)?e.optionSelectedDisabled:e.optionSelected):(d(a)||l&&d(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,fakeInput:e.fakeInput}})),showDropdown:h}}function p(a,l,t){const{limit:n,infinite:u}=e.toRefs(a),r=t.isOpen,i=t.offset,o=t.search,s=t.pfo,c=t.eo,d=e.ref(null),v=e.ref(null),p=e.computed((()=>i.value{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;i.value+=-1==n.value?10:n.value,e.nextTick((()=>{a.scrollTop=l}))}},f=()=>{r.value&&i.value{u.value&&f()})),e.watch(o,(()=>{u.value&&(i.value=n.value,f())}),{flush:"post"}),e.watch(c,(()=>{u.value&&f()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(d.value=new IntersectionObserver(m))})),{hasMore:p,infiniteLoader:v}}function m(a,l,t){const{placeholder:n,id:u,valueProp:r,label:i,mode:o,groupLabel:s}=e.toRefs(a),c=t.pointer;t.iv,t.hasSelected,t.multipleLabelText,t.isOpen;const d=e.ref(null),v=e.computed((()=>{let e=[];return u&&u.value&&e.push(u.value),e.push("multiselect-options"),e.join("-")})),p=e.computed((()=>{let e=[];if(u&&u.value&&e.push(u.value),c.value)return e.push(c.value.group?"multiselect-group":"multiselect-option"),e.push(c.value.group?c.value.index:c.value[r.value]),e.join("-")})),m=e.computed((()=>n.value)),f=e.computed((()=>"single"!==o.value));return e.onMounted((()=>{if(u&&u.value&&document&&document.querySelector){let e=document.querySelector(`[for="${u.value}"]`);d.value=e?e.innerText:null}})),{ariaOwns:v,ariaPlaceholder:m,ariaMultiselectable:f,ariaActiveDescendant:p,ariaOptionId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-option"),a.push(e[r.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[i.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}var f={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,u,s,n,l,c,i,p,o,d,v,m])};const g=["tabindex","id","dir","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable","role"],h=["type","modelValue","value","autocomplete","id","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],b=["onKeyup","aria-label"],y=["onClick"],S=["type","modelValue","value","id","autocomplete","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],k=["innerHTML"],L=["innerHTML"],O=["id"],C=["id","aria-label","aria-selected"],w=["data-pointed","onMouseenter","onClick"],E=["innerHTML"],T=["aria-label"],V=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],x=["innerHTML"],B=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],q=["innerHTML"],P=["innerHTML"],N=["innerHTML"],_=["value"],I=["name","value"],R=["name","value"];return f.render=function(a,l,t,n,u,r){return e.openBlock(),e.createElementBlock("div",e.mergeProps({ref:"multiselect",tabindex:a.tabindex,class:a.classList.container,id:t.searchable?void 0:t.id,dir:t.rtl?"rtl":void 0,onFocusin:l[9]||(l[9]=(...e)=>a.handleFocusIn&&a.handleFocusIn(...e)),onFocusout:l[10]||(l[10]=(...e)=>a.handleFocusOut&&a.handleFocusOut(...e)),onKeydown:l[11]||(l[11]=(...e)=>a.handleKeydown&&a.handleKeydown(...e)),onKeyup:l[12]||(l[12]=(...e)=>a.handleKeyup&&a.handleKeyup(...e)),onMousedown:l[13]||(l[13]=(...e)=>a.handleMousedown&&a.handleMousedown(...e)),"aria-owns":t.searchable?void 0:a.ariaOwns,"aria-placeholder":t.searchable?void 0:a.ariaPlaceholder,"aria-expanded":t.searchable?void 0:a.isOpen,"aria-activedescendant":t.searchable?void 0:a.ariaActiveDescendant,"aria-multiselectable":t.searchable?void 0:a.ariaMultiselectable,role:t.searchable?void 0:"listbox"},t.searchable?{}:t.aria),[e.createCommentVNode(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.search,autocomplete:t.autocomplete,id:t.searchable?t.id:void 0,onInput:l[0]||(l[0]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[1]||(l[1]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[2]||(l[2]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-owns":a.ariaOwns,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"listbox"},{...t.attrs,...t.aria}),null,16,h)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Tags (with search) "),"tags"==t.mode?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(a.classList.tags),"data-tags":""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.iv,((l,n,u)=>e.renderSlot(a.$slots,"tag",{option:l,handleTagRemove:a.handleTagRemove,disabled:t.disabled},(()=>[(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(a.classList.tag),tabindex:"-1",onKeyup:e.withKeys((e=>a.handleTagRemove(l,e)),["enter"]),key:u,"aria-label":a.ariaTagLabel(l[t.label])},[e.createTextVNode(e.toDisplayString(l[t.label])+" ",1),t.disabled?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(a.classList.tagRemove),onClick:e=>a.handleTagRemove(l,e)},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagRemoveIcon)},null,2)],10,y))],42,b))])))),256)),e.createElementVNode("div",{class:e.normalizeClass(a.classList.tagsSearchWrapper),ref:"tags"},[e.createCommentVNode(" Used for measuring search width "),e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagsSearchCopy)},e.toDisplayString(a.search),3),e.createCommentVNode(" Actual search input "),t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.tagsSearch,id:t.searchable?t.id:void 0,autocomplete:t.autocomplete,onInput:l[3]||(l[3]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[4]||(l[4]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[5]||(l[5]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-owns":a.ariaOwns,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"listbox"},{...t.attrs,...t.aria}),null,16,S)):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Single label "),"single"==t.mode&&a.hasSelected&&!a.search&&a.iv?e.renderSlot(a.$slots,"singlelabel",{key:2,value:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.singleLabel),"aria-hidden":"true"},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.singleLabelText),innerHTML:a.iv[t.label]},null,10,k)],2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Multiple label "),"multiple"==t.mode&&a.hasSelected&&!a.search?e.renderSlot(a.$slots,"multiplelabel",{key:3,values:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.multipleLabel),innerHTML:a.multipleLabelText,"aria-hidden":"true"},null,10,L)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Placeholder "),!t.placeholder||a.hasSelected||a.search?e.createCommentVNode("v-if",!0):e.renderSlot(a.$slots,"placeholder",{key:4},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.placeholder),"aria-hidden":"true"},e.toDisplayString(t.placeholder),3)])),e.createCommentVNode(" Spinner "),t.loading||a.resolving?e.renderSlot(a.$slots,"spinner",{key:5},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.spinner),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Clear "),a.hasSelected&&!t.disabled&&t.canClear&&!a.busy?e.renderSlot(a.$slots,"clear",{key:6,clear:a.clear},(()=>[e.createElementVNode("span",{tabindex:"0",role:"button","aria-label":"❎",class:e.normalizeClass(a.classList.clear),onClick:l[6]||(l[6]=(...e)=>a.clear&&a.clear(...e)),onKeyup:l[7]||(l[7]=e.withKeys(((...e)=>a.clear&&a.clear(...e)),["enter"]))},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.clearIcon)},null,2)],34)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Caret "),t.caret&&t.showOptions?e.renderSlot(a.$slots,"caret",{key:7},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.caret),onClick:l[8]||(l[8]=(...e)=>a.handleCaretClick&&a.handleCaretClick(...e)),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Options "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.dropdown),tabindex:"-1"},[e.renderSlot(a.$slots,"beforelist",{options:a.fo}),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.options),id:a.ariaOwns},[t.groups?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.fg,((l,n,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.group),key:u,id:a.ariaGroupId(l),"aria-label":a.ariaGroupLabel(l),"aria-selected":a.isSelected(l),role:"option"},[e.createElementVNode("div",{class:e.normalizeClass(a.classList.groupLabel(l)),"data-pointed":a.isPointed(l),onMouseenter:e=>a.setPointer(l,n),onClick:e=>a.handleGroupClick(l)},[e.renderSlot(a.$slots,"grouplabel",{group:l,isSelected:a.isSelected,isPointed:a.isPointed},(()=>[e.createElementVNode("span",{innerHTML:l[t.groupLabel]},null,8,E)]))],42,w),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.groupOptions),"aria-label":a.ariaGroupLabel(l),role:"group"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.__VISIBLE__,((n,u,r)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(n,l)),"data-pointed":a.isPointed(n),"data-selected":a.isSelected(n)||void 0,key:r,onMouseenter:e=>a.setPointer(n),onClick:e=>a.handleOptionClick(n),id:a.ariaOptionId(n),"aria-selected":a.isSelected(n),"aria-label":a.ariaOptionLabel(n),role:"option"},[e.renderSlot(a.$slots,"option",{option:n,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",{innerHTML:n[t.label]},null,8,x)]))],42,V)))),128))],10,T)],10,C)))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.fo,((l,n,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(l)),"data-pointed":a.isPointed(l),"data-selected":a.isSelected(l)||void 0,key:u,onMouseenter:e=>a.setPointer(l),onClick:e=>a.handleOptionClick(l),id:a.ariaOptionId(l),"aria-selected":a.isSelected(l),"aria-label":a.ariaOptionLabel(l),role:"option"},[e.renderSlot(a.$slots,"option",{option:l,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",{innerHTML:l[t.label]},null,8,q)]))],42,B)))),128))],10,O),a.noOptions?e.renderSlot(a.$slots,"nooptions",{key:0},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noOptions),innerHTML:t.noOptionsText},null,10,P)])):e.createCommentVNode("v-if",!0),a.noResults?e.renderSlot(a.$slots,"noresults",{key:1},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noResults),innerHTML:t.noResultsText},null,10,N)])):e.createCommentVNode("v-if",!0),t.infinite&&a.hasMore?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(a.classList.inifinite),ref:"infiniteLoader"},[e.renderSlot(a.$slots,"infinite",{},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.inifiniteSpinner)},null,2)]))],2)):e.createCommentVNode("v-if",!0),e.renderSlot(a.$slots,"afterlist",{options:a.fo})],2),e.createCommentVNode(" Hacky input element to show HTML5 required warning "),t.required?(e.openBlock(),e.createElementBlock("input",{key:8,class:e.normalizeClass(a.classList.fakeInput),tabindex:"-1",value:a.textValue,required:""},null,10,_)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Native input support "),t.nativeSupport?(e.openBlock(),e.createElementBlock(e.Fragment,{key:9},["single"==t.mode?(e.openBlock(),e.createElementBlock("input",{key:0,type:"hidden",name:t.name,value:void 0!==a.plainValue?a.plainValue:""},null,8,I)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.plainValue,((a,l)=>(e.openBlock(),e.createElementBlock("input",{type:"hidden",name:`${t.name}[]`,value:a,key:l},null,8,R)))),128))],64)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Create height for empty input "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.spacer)},null,2)],16,g)},f.__file="src/Multiselect.vue",f}(Vue); +var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,n){const{object:u,valueProp:r,mode:i}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=n.iv,c=e=>u.value||a(e)?e:Array.isArray(e)?e.map((e=>e[r.value])):e[r.value],d=e=>a(e)?"single"===i.value?{}:[]:e;return{update:e=>{s.value=d(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:n,mode:u,valueProp:r}=e.toRefs(a),i=e.ref("single"!==u.value?[]:{}),o=n&&void 0!==n.value?n:t,s=e.computed((()=>"single"===u.value?i.value[r.value]:i.value.map((e=>e[r.value])))),c=e.computed((()=>"single"!==u.value?i.value.map((e=>e[r.value])).join(","):i.value[r.value]));return{iv:i,internalValue:i,ev:o,externalValue:o,textValue:c,plainValue:s}}function n(a,l,t){const{regex:n}=e.toRefs(a),u=e.getCurrentInstance().proxy,r=t.isOpen,i=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!r.value&&e&&i(),l.emit("search-change",e,u)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(n&&n.value){let a=n.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(n&&n.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=n.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,u)}}}function u(a,l,t){const{groupSelect:n,mode:u,groups:r,disabledProp:i}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[i.value]||r.value&&e&&e.group&&("single"===u.value||!n.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function r(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function i(l,t,n){const{options:u,mode:i,trackBy:o,limit:s,hideSelected:c,createTag:d,createOption:v,label:p,appendNewTag:m,appendNewOption:f,multipleLabel:g,object:h,loading:b,delay:y,resolveOnLoad:S,minChars:k,filterResults:L,clearOnSearch:O,clearOnSelect:C,valueProp:w,canDeselect:E,max:T,strict:V,closeOnSelect:x,groups:B,reverse:q,infinite:P,groupOptions:N,groupHideEmpty:_,groupSelect:I,onCreate:R,disabledProp:D,searchStart:M}=e.toRefs(l),A=e.getCurrentInstance().proxy,z=n.iv,j=n.ev,H=n.search,K=n.clearSearch,$=n.update,F=n.pointer,G=n.clearPointer,W=n.focus,U=n.deactivate,J=n.close,Q=e.ref([]),X=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(P.value&&-1===s.value?10:s.value),ae=e.computed((()=>d.value||v.value||!1)),le=e.computed((()=>void 0!==m.value?m.value:void 0===f.value||f.value)),te=e.computed((()=>{if(B.value){let e=X.value||[],a=[];return e.forEach((e=>{Pe(e[N.value]).forEach((l=>{a.push(Object.assign({},l,e[D.value]?{[D.value]:!0}:{}))}))})),a}{let e=Pe(X.value||[]);return Q.value.length&&(e=e.concat(Q.value)),e}})),ne=e.computed((()=>B.value?Be((X.value||[]).map(((e,a)=>{const l=Pe(e[N.value]);return{...e,index:a,group:!0,[N.value]:qe(l,!1).map((a=>Object.assign({},a,e[D.value]?{[D.value]:!0}:{}))),__VISIBLE__:qe(l).map((a=>Object.assign({},a,e[D.value]?{[D.value]:!0}:{})))}}))):[])),ue=e.computed((()=>{let e=te.value;return q.value&&(e=e.reverse()),de.value.length&&(e=de.value.concat(e)),qe(e)})),re=e.computed((()=>{let e=ue.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),ie=e.computed((()=>{switch(i.value){case"single":return!a(z.value[w.value]);case"multiple":case"tags":return!a(z.value)&&z.value.length>0}})),oe=e.computed((()=>void 0!==g&&void 0!==g.value?g.value(z.value,A):z.value&&z.value.length>1?`${z.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!de.value.length)),ce=e.computed((()=>te.value.length>0&&0==re.value.length&&(H.value&&B.value||!B.value))),de=e.computed((()=>!1!==ae.value&&H.value?-1!==Ve(H.value)?[]:[{[w.value]:H.value,[p.value]:H.value,[ve.value]:H.value,__CREATE__:!0}]:[])),ve=e.computed((()=>o.value||p.value)),pe=e.computed((()=>{switch(i.value){case"single":return null;case"multiple":case"tags":return[]}})),me=e.computed((()=>b.value||Y.value)),fe=e=>{switch("object"!=typeof e&&(e=Te(e)),i.value){case"single":$(e);break;case"multiple":case"tags":$(z.value.concat(e))}t.emit("select",he(e),e,A)},ge=e=>{switch("object"!=typeof e&&(e=Te(e)),i.value){case"single":ye();break;case"tags":case"multiple":$(Array.isArray(e)?z.value.filter((a=>-1===e.map((e=>e[w.value])).indexOf(a[w.value]))):z.value.filter((a=>a[w.value]!=e[w.value])))}t.emit("deselect",he(e),e,A)},he=e=>h.value?e:e[w.value],be=e=>{ge(e)},ye=()=>{t.emit("clear",A),$(pe.value)},Se=e=>{if(void 0!==e.group)return"single"!==i.value&&(Ee(e[N.value])&&e[N.value].length);switch(i.value){case"single":return!a(z.value)&&z.value[w.value]==e[w.value];case"tags":case"multiple":return!a(z.value)&&-1!==z.value.map((e=>e[w.value])).indexOf(e[w.value])}},ke=e=>!0===e[D.value],Le=()=>!(void 0===T||-1===T.value||!ie.value&&T.value>0)&&z.value.length>=T.value,Oe=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,i.value){case"single":if(e&&Se(e))return void(E.value&&ge(e));e&&Ce(e),C.value&&K(),x.value&&(G(),J()),e&&fe(e);break;case"multiple":if(e&&Se(e))return void ge(e);if(Le())return;e&&(Ce(e),fe(e)),C.value&&K(),c.value&&G(),x.value&&J();break;case"tags":if(e&&Se(e))return void ge(e);if(Le())return;e&&Ce(e),C.value&&K(),e&&fe(e),c.value&&G(),x.value&&J()}x.value||W()},Ce=e=>{void 0===Te(e[w.value])&&ae.value&&(t.emit("tag",e[w.value],A),t.emit("option",e[w.value],A),le.value&&xe(e),K())},we=e=>void 0===e.find((e=>!Se(e)&&!e[D.value])),Ee=e=>void 0===e.find((e=>!Se(e))),Te=e=>te.value[te.value.map((e=>String(e[w.value]))).indexOf(String(e))],Ve=(e,a=!0)=>te.value.map((e=>parseInt(e[ve.value])==e[ve.value]?parseInt(e[ve.value]):e[ve.value])).indexOf(parseInt(e)==e?parseInt(e):e),xe=e=>{Q.value.push(e)},Be=e=>_.value?e.filter((e=>H.value?e.__VISIBLE__.length:e[N.value].length)):e.filter((e=>!H.value||e.__VISIBLE__.length)),qe=(e,a=!0)=>{let l=e;return H.value&&L.value&&(l=l.filter((e=>M.value?r(e[ve.value],V.value).startsWith(r(H.value,V.value)):-1!==r(e[ve.value],V.value).indexOf(r(H.value,V.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(i.value)&&c.value&&Se(e))(e)))),l},Pe=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[w.value]:e,[ve.value]:l,[p.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[w.value]:e,[ve.value]:e,[p.value]:e})),a},Ne=()=>{a(j.value)||(z.value=Re(j.value))},_e=e=>(Y.value=!0,new Promise(((a,l)=>{u.value(H.value,A).then((a=>{X.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),X.value=[],Y.value=!1})).finally((()=>{a()}))}))),Ie=()=>{if(ie.value)if("single"===i.value){let e=Te(z.value[w.value]);if(void 0!==e){let a=e[p.value];z.value[p.value]=a,h.value&&(j.value[p.value]=a)}}else z.value.forEach(((e,a)=>{let l=Te(z.value[a][w.value]);if(void 0!==l){let e=l[p.value];z.value[a][p.value]=e,h.value&&(j.value[a][p.value]=e)}}))},Re=e=>a(e)?"single"===i.value?{}:[]:h.value?e:"single"===i.value?Te(e)||{}:e.filter((e=>!!Te(e))).map((e=>Te(e))),De=()=>{Z.value=e.watch(H,(e=>{e.length{e==H.value&&u.value(H.value,A).then((a=>{e!=H.value&&H.value||(X.value=a,F.value=re.value.filter((e=>!0!==e[D.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==i.value&&!a(j.value)&&!Array.isArray(j.value))throw new Error(`v-model must be an array when using "${i.value}" mode`);return u&&"function"==typeof u.value?S.value?_e(Ne):1==h.value&&Ne():(X.value=u.value,Ne()),y.value>-1&&De(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&De()})),e.watch(j,(e=>{if(a(e))z.value=Re(e);else switch(i.value){case"single":(h.value?e[w.value]!=z.value[w.value]:e!=z.value[w.value])&&(z.value=Re(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(h.value?e.map((e=>e[w.value])):e,z.value.map((e=>e[w.value])))||(z.value=Re(e))}}),{deep:!0}),e.watch(u,((e,a)=>{"function"==typeof l.options?S.value&&(!a||e&&e.toString()!==a.toString())&&_e():(X.value=l.options,Object.keys(z.value).length||Ne(),Ie())})),e.watch(p,Ie),{pfo:ue,fo:re,filteredOptions:re,hasSelected:ie,multipleLabelText:oe,eo:te,extendedOptions:te,fg:ne,filteredGroups:ne,noOptions:se,noResults:ce,resolving:Y,busy:me,offset:ee,select:fe,deselect:ge,remove:be,selectAll:()=>{"single"!==i.value&&fe(re.value)},clear:ye,isSelected:Se,isDisabled:ke,isMax:Le,getOption:Te,handleOptionClick:e=>{if(!ke(e))return R&&R.value&&!Se(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=R.value(e,A))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Oe(e)}))):void Oe(e)},handleGroupClick:e=>{if(!ke(e)&&"single"!==i.value&&I.value){switch(i.value){case"multiple":case"tags":we(e[N.value])?ge(e[N.value]):fe(e[N.value].filter((e=>-1===z.value.map((e=>e[w.value])).indexOf(e[w.value]))).filter((e=>!e[D.value])).filter(((e,a)=>z.value.length+1+a<=T.value||-1===T.value)))}x.value&&U()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{_e(e)},resolveOptions:_e,refreshLabels:Ie}}function o(a,l,t){const{valueProp:n,showOptions:u,searchable:r,groupLabel:i,groups:o,mode:s,groupSelect:c,disabledProp:d}=e.toRefs(a),v=t.fo,p=t.fg,m=t.handleOptionClick,f=t.handleGroupClick,g=t.search,h=t.pointer,b=t.setPointer,y=t.clearPointer,S=t.multiselect,k=t.isOpen,L=e.computed((()=>v.value.filter((e=>!e[d.value])))),O=e.computed((()=>p.value.filter((e=>!e[d.value])))),C=e.computed((()=>"single"!==s.value&&c.value)),w=e.computed((()=>h.value&&h.value.group)),E=e.computed((()=>R(h.value))),T=e.computed((()=>{const e=w.value?h.value:R(h.value),a=O.value.map((e=>e[i.value])).indexOf(e[i.value]);let l=O.value[a-1];return void 0===l&&(l=x.value),l})),V=e.computed((()=>{let e=O.value.map((e=>e.label)).indexOf(w.value?h.value[i.value]:R(h.value)[i.value])+1;return O.value.length<=e&&(e=0),O.value[e]})),x=e.computed((()=>[...O.value].slice(-1)[0])),B=e.computed((()=>h.value.__VISIBLE__.filter((e=>!e[d.value]))[0])),q=e.computed((()=>{const e=E.value.__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[n.value])).indexOf(h.value[n.value])-1]})),P=e.computed((()=>{const e=R(h.value).__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[n.value])).indexOf(h.value[n.value])+1]})),N=e.computed((()=>[...T.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),_=e.computed((()=>[...x.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),I=()=>{b(L.value[0]||null)},R=e=>O.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[n.value])).indexOf(e[n.value]))),D=()=>{let e=S.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=w.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop{r.value&&(e.length&&u.value?I():y())})),e.watch(k,(a=>{if(a){let a=S.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:h,canPointGroups:C,isPointed:e=>!(!h.value||!(!e.group&&h.value[n.value]==e[n.value]||void 0!==e.group&&h.value[i.value]==e[i.value]))||void 0,setPointerFirst:I,selectPointer:()=>{h.value&&!0!==h.value[d.value]&&(w.value?f(h.value):m(h.value))},forwardPointer:()=>{if(null===h.value)b((o.value&&C.value?O.value[0]:L.value[0])||null);else if(o.value&&C.value){let e=w.value?B.value:P.value;void 0===e&&(e=V.value),b(e||null)}else{let e=L.value.map((e=>e[n.value])).indexOf(h.value[n.value])+1;L.value.length<=e&&(e=0),b(L.value[e]||null)}e.nextTick((()=>{D()}))},backwardPointer:()=>{if(null===h.value){let e=L.value[L.value.length-1];o.value&&C.value&&(e=_.value,void 0===e&&(e=x.value)),b(e||null)}else if(o.value&&C.value){let e=w.value?N.value:q.value;void 0===e&&(e=w.value?T.value:E.value),b(e||null)}else{let e=L.value.map((e=>e[n.value])).indexOf(h.value[n.value])-1;e<0&&(e=L.value.length-1),b(L.value[e]||null)}e.nextTick((()=>{D()}))}}}function s(a,l,t){const{disabled:n}=e.toRefs(a),u=e.getCurrentInstance().proxy,r=e.ref(!1);return{isOpen:r,open:()=>{r.value||n.value||(r.value=!0,l.emit("open",u))},close:()=>{r.value&&(r.value=!1,l.emit("close",u))}}}function c(a,l,t){const{searchable:n,disabled:u}=e.toRefs(a),r=t.input,i=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,d=e.ref(null),v=e.ref(null),p=e.ref(!1),m=e.ref(!1),f=e.computed((()=>n.value||u.value?-1:0)),g=()=>{n.value&&r.value.blur(),d.value.blur()},h=(e=!0)=>{u.value||(p.value=!0,e&&i())},b=()=>{p.value=!1,setTimeout((()=>{p.value||(o(),s())}),1)};return{multiselect:d,tags:v,tabindex:f,isActive:p,mouseClicked:m,blur:g,focus:()=>{n.value&&!u.value&&r.value.focus()},activate:h,deactivate:b,handleFocusIn:()=>{h(m.value)},handleFocusOut:()=>{b()},handleCaretClick:()=>{b(),g()},handleMousedown:e=>{m.value=!0,c.value&&(e.target.isEqualNode(d.value)||e.target.isEqualNode(v.value))?setTimeout((()=>{b()}),0):document.activeElement.isEqualNode(d.value)&&!c.value&&h(),setTimeout((()=>{m.value=!1}),0)}}}function d(a,l,t){const{mode:n,addTagOn:u,openDirection:r,searchable:i,showOptions:o,valueProp:s,groups:c,addOptionOn:d,createTag:v,createOption:p,reverse:m}=e.toRefs(a),f=e.getCurrentInstance().proxy,g=t.iv,h=t.update,b=t.search,y=t.setPointer,S=t.selectPointer,k=t.backwardPointer,L=t.forwardPointer,O=t.multiselect,C=t.tags,w=t.isOpen,E=t.open,T=t.blur,V=t.fo,x=e.computed((()=>v.value||p.value||!1)),B=e.computed((()=>void 0!==u.value?u.value:void 0!==d.value?d.value:["enter"])),q=()=>{"tags"===n.value&&!o.value&&x.value&&i.value&&!c.value&&y(V.value[V.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,f),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===n.value&&(a=[...O.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==C.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===n.value)return;if(i.value&&-1===[null,""].indexOf(b.value))return;if(0===g.value.length)return;h([...g.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),-1!==t&&void 0!==t)return h([...g.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():i.value?C.value.querySelector("input").focus():O.value.focus()));if(-1===B.value.indexOf("enter")&&x.value)return;q(),S();break;case" ":if(!x.value&&!i.value)return e.preventDefault(),q(),void S();if(!x.value)return!1;if(-1===B.value.indexOf("space")&&x.value)return;e.preventDefault(),q(),S();break;case"Tab":case";":case",":if(-1===B.value.indexOf(e.key.toLowerCase())||!x.value)return;q(),S(),e.preventDefault();break;case"Escape":T();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;w.value||E(),k();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;w.value||E(),L();break;case"ArrowLeft":if(i.value&&C.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==n.value||!g.value||!g.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==n.value||!g.value||!g.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():i.value?C.value.querySelector("input").focus():i.value||O.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,f)},preparePointer:q}}function v(a,l,t){const{classes:n,disabled:u,openDirection:r,showOptions:i}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,d=t.isDisabled,v=t.isActive,p=t.canPointGroups,m=t.resolving,f=t.fo,g=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer",...n.value}))),h=e.computed((()=>!!(o.value&&i.value&&(!m.value||m.value&&f.value.length))));return{classList:e.computed((()=>{const e=g.value;return{container:[e.container].concat(u.value?e.containerDisabled:[]).concat(h.value&&"top"===r.value?e.containerOpenTop:[]).concat(h.value&&"top"!==r.value?e.containerOpen:[]).concat(v.value?e.containerActive:[]),spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(u.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===r.value?e.dropdownTop:[]).concat(o.value&&i.value&&h.value?[]:e.dropdownHidden),options:[e.options].concat("top"===r.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&p.value?l.push(d(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):d(a)&&l.push(e.groupLabelDisabled),p.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(d(a)?e.optionSelectedDisabled:e.optionSelected):(d(a)||l&&d(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,fakeInput:e.fakeInput}})),showDropdown:h}}function p(a,l,t){const{limit:n,infinite:u}=e.toRefs(a),r=t.isOpen,i=t.offset,o=t.search,s=t.pfo,c=t.eo,d=e.ref(null),v=e.ref(null),p=e.computed((()=>i.value{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;i.value+=-1==n.value?10:n.value,e.nextTick((()=>{a.scrollTop=l}))}},f=()=>{r.value&&i.value{u.value&&f()})),e.watch(o,(()=>{u.value&&(i.value=n.value,f())}),{flush:"post"}),e.watch(c,(()=>{u.value&&f()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(d.value=new IntersectionObserver(m))})),{hasMore:p,infiniteLoader:v}}function m(a,l,t){const{placeholder:n,id:u,valueProp:r,label:i,mode:o,groupLabel:s}=e.toRefs(a),c=t.pointer;t.iv,t.hasSelected,t.multipleLabelText,t.isOpen;const d=e.ref(null),v=e.computed((()=>{let e=[];return u&&u.value&&e.push(u.value),e.push("multiselect-options"),e.join("-")})),p=e.computed((()=>{let e=[];if(u&&u.value&&e.push(u.value),c.value)return e.push(c.value.group?"multiselect-group":"multiselect-option"),e.push(c.value.group?c.value.index:c.value[r.value]),e.join("-")})),m=e.computed((()=>n.value)),f=e.computed((()=>"single"!==o.value));return e.onMounted((()=>{if(u&&u.value&&document&&document.querySelector){let e=document.querySelector(`[for="${u.value}"]`);d.value=e?e.innerText:null}})),{ariaOwns:v,ariaPlaceholder:m,ariaMultiselectable:f,ariaActiveDescendant:p,ariaOptionId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-option"),a.push(e[r.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[i.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}var f={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,u,s,n,l,c,i,p,o,d,v,m])};const g=["tabindex","id","dir","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable","role"],h=["type","modelValue","value","autocomplete","id","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],b=["onKeyup","aria-label"],y=["onClick"],S=["type","modelValue","value","id","autocomplete","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],k=["innerHTML"],L=["innerHTML"],O=["id"],C=["id","aria-label","aria-selected"],w=["data-pointed","onMouseenter","onClick"],E=["innerHTML"],T=["aria-label"],V=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],x=["innerHTML"],B=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],q=["innerHTML"],P=["innerHTML"],N=["innerHTML"],_=["value"],I=["name","value"],R=["name","value"];return f.render=function(a,l,t,n,u,r){return e.openBlock(),e.createElementBlock("div",e.mergeProps({ref:"multiselect",tabindex:a.tabindex,class:a.classList.container,id:t.searchable?void 0:t.id,dir:t.rtl?"rtl":void 0,onFocusin:l[9]||(l[9]=(...e)=>a.handleFocusIn&&a.handleFocusIn(...e)),onFocusout:l[10]||(l[10]=(...e)=>a.handleFocusOut&&a.handleFocusOut(...e)),onKeydown:l[11]||(l[11]=(...e)=>a.handleKeydown&&a.handleKeydown(...e)),onKeyup:l[12]||(l[12]=(...e)=>a.handleKeyup&&a.handleKeyup(...e)),onMousedown:l[13]||(l[13]=(...e)=>a.handleMousedown&&a.handleMousedown(...e)),"aria-owns":t.searchable?void 0:a.ariaOwns,"aria-placeholder":t.searchable?void 0:a.ariaPlaceholder,"aria-expanded":t.searchable?void 0:a.isOpen,"aria-activedescendant":t.searchable?void 0:a.ariaActiveDescendant,"aria-multiselectable":t.searchable?void 0:a.ariaMultiselectable,role:t.searchable?void 0:"listbox"},t.searchable?{}:t.aria),[e.createCommentVNode(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.search,autocomplete:t.autocomplete,id:t.searchable?t.id:void 0,onInput:l[0]||(l[0]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[1]||(l[1]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[2]||(l[2]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-owns":a.ariaOwns,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"listbox"},{...t.attrs,...t.aria}),null,16,h)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Tags (with search) "),"tags"==t.mode?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(a.classList.tags),"data-tags":""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.iv,((l,n,u)=>e.renderSlot(a.$slots,"tag",{option:l,handleTagRemove:a.handleTagRemove,disabled:t.disabled},(()=>[(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(a.classList.tag),tabindex:"-1",onKeyup:e.withKeys((e=>a.handleTagRemove(l,e)),["enter"]),key:u,"aria-label":a.ariaTagLabel(l[t.label])},[e.createTextVNode(e.toDisplayString(l[t.label])+" ",1),t.disabled?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(a.classList.tagRemove),onClick:e=>a.handleTagRemove(l,e)},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagRemoveIcon)},null,2)],10,y))],42,b))])))),256)),e.createElementVNode("div",{class:e.normalizeClass(a.classList.tagsSearchWrapper),ref:"tags"},[e.createCommentVNode(" Used for measuring search width "),e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagsSearchCopy)},e.toDisplayString(a.search),3),e.createCommentVNode(" Actual search input "),t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.tagsSearch,id:t.searchable?t.id:void 0,autocomplete:t.autocomplete,onInput:l[3]||(l[3]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[4]||(l[4]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[5]||(l[5]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-owns":a.ariaOwns,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"listbox"},{...t.attrs,...t.aria}),null,16,S)):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Single label "),"single"==t.mode&&a.hasSelected&&!a.search&&a.iv?e.renderSlot(a.$slots,"singlelabel",{key:2,value:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.singleLabel),"aria-hidden":"true"},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.singleLabelText),innerHTML:a.iv[t.label]},null,10,k)],2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Multiple label "),"multiple"==t.mode&&a.hasSelected&&!a.search?e.renderSlot(a.$slots,"multiplelabel",{key:3,values:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.multipleLabel),innerHTML:a.multipleLabelText,"aria-hidden":"true"},null,10,L)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Placeholder "),!t.placeholder||a.hasSelected||a.search?e.createCommentVNode("v-if",!0):e.renderSlot(a.$slots,"placeholder",{key:4},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.placeholder),"aria-hidden":"true"},e.toDisplayString(t.placeholder),3)])),e.createCommentVNode(" Spinner "),t.loading||a.resolving?e.renderSlot(a.$slots,"spinner",{key:5},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.spinner),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Clear "),a.hasSelected&&!t.disabled&&t.canClear&&!a.busy?e.renderSlot(a.$slots,"clear",{key:6,clear:a.clear},(()=>[e.createElementVNode("span",{tabindex:"0",role:"button","aria-label":"❎",class:e.normalizeClass(a.classList.clear),onClick:l[6]||(l[6]=(...e)=>a.clear&&a.clear(...e)),onKeyup:l[7]||(l[7]=e.withKeys(((...e)=>a.clear&&a.clear(...e)),["enter"]))},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.clearIcon)},null,2)],34)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Caret "),t.caret&&t.showOptions?e.renderSlot(a.$slots,"caret",{key:7},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.caret),onClick:l[8]||(l[8]=(...e)=>a.handleCaretClick&&a.handleCaretClick(...e)),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Options "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.dropdown),tabindex:"-1"},[e.renderSlot(a.$slots,"beforelist",{options:a.fo}),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.options),id:a.ariaOwns},[t.groups?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.fg,((l,n,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.group),key:u,id:a.ariaGroupId(l),"aria-label":a.ariaGroupLabel(l),"aria-selected":a.isSelected(l),role:"option"},[e.createElementVNode("div",{class:e.normalizeClass(a.classList.groupLabel(l)),"data-pointed":a.isPointed(l),onMouseenter:e=>a.setPointer(l,n),onClick:e=>a.handleGroupClick(l)},[e.renderSlot(a.$slots,"grouplabel",{group:l,isSelected:a.isSelected,isPointed:a.isPointed},(()=>[e.createElementVNode("span",{innerHTML:l[t.groupLabel]},null,8,E)]))],42,w),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.groupOptions),"aria-label":a.ariaGroupLabel(l),role:"group"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.__VISIBLE__,((n,u,r)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(n,l)),"data-pointed":a.isPointed(n),"data-selected":a.isSelected(n)||void 0,key:r,onMouseenter:e=>a.setPointer(n),onClick:e=>a.handleOptionClick(n),id:a.ariaOptionId(n),"aria-selected":a.isSelected(n),"aria-label":a.ariaOptionLabel(n),role:"option"},[e.renderSlot(a.$slots,"option",{option:n,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",{innerHTML:n[t.label]},null,8,x)]))],42,V)))),128))],10,T)],10,C)))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.fo,((l,n,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(l)),"data-pointed":a.isPointed(l),"data-selected":a.isSelected(l)||void 0,key:u,onMouseenter:e=>a.setPointer(l),onClick:e=>a.handleOptionClick(l),id:a.ariaOptionId(l),"aria-selected":a.isSelected(l),"aria-label":a.ariaOptionLabel(l),role:"option"},[e.renderSlot(a.$slots,"option",{option:l,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",{innerHTML:l[t.label]},null,8,q)]))],42,B)))),128))],10,O),a.noOptions?e.renderSlot(a.$slots,"nooptions",{key:0},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noOptions),innerHTML:t.noOptionsText},null,10,P)])):e.createCommentVNode("v-if",!0),a.noResults?e.renderSlot(a.$slots,"noresults",{key:1},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noResults),innerHTML:t.noResultsText},null,10,N)])):e.createCommentVNode("v-if",!0),t.infinite&&a.hasMore?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(a.classList.inifinite),ref:"infiniteLoader"},[e.renderSlot(a.$slots,"infinite",{},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.inifiniteSpinner)},null,2)]))],2)):e.createCommentVNode("v-if",!0),e.renderSlot(a.$slots,"afterlist",{options:a.fo})],2),e.createCommentVNode(" Hacky input element to show HTML5 required warning "),t.required?(e.openBlock(),e.createElementBlock("input",{key:8,class:e.normalizeClass(a.classList.fakeInput),tabindex:"-1",value:a.textValue,required:""},null,10,_)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Native input support "),t.nativeSupport?(e.openBlock(),e.createElementBlock(e.Fragment,{key:9},["single"==t.mode?(e.openBlock(),e.createElementBlock("input",{key:0,type:"hidden",name:t.name,value:void 0!==a.plainValue?a.plainValue:""},null,8,I)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.plainValue,((a,l)=>(e.openBlock(),e.createElementBlock("input",{type:"hidden",name:`${t.name}[]`,value:a,key:l},null,8,R)))),128))],64)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Create height for empty input "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.spacer)},null,2)],16,g)},f.__file="src/Multiselect.vue",f}(Vue); diff --git a/dist/multiselect.js b/dist/multiselect.js index 89dc42b..9b6645f 100644 --- a/dist/multiselect.js +++ b/dist/multiselect.js @@ -943,7 +943,7 @@ function useOptions (props, context, dep) watch(options, (n, o) => { if (typeof props.options === 'function') { - if (resolveOnLoad.value) { + if (resolveOnLoad.value && (!o || (n && n.toString() !== o.toString()))) { resolveOptions(); } } else { diff --git a/dist/multiselect.vue2.global.js b/dist/multiselect.vue2.global.js index b444dc0..065f3f0 100644 --- a/dist/multiselect.vue2.global.js +++ b/dist/multiselect.vue2.global.js @@ -1 +1 @@ -var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,u){const{object:n,valueProp:i,mode:r}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=u.iv,c=e=>n.value||a(e)?e:Array.isArray(e)?e.map((e=>e[i.value])):e[i.value],v=e=>a(e)?"single"===r.value?{}:[]:e;return{update:e=>{s.value=v(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:u,mode:n,valueProp:i}=e.toRefs(a),r=e.ref("single"!==n.value?[]:{}),o=u&&void 0!==u.value?u:t,s=e.computed((()=>"single"===n.value?r.value[i.value]:r.value.map((e=>e[i.value])))),c=e.computed((()=>"single"!==n.value?r.value.map((e=>e[i.value])).join(","):r.value[i.value]));return{iv:r,internalValue:r,ev:o,externalValue:o,textValue:c,plainValue:s}}function u(a,l,t){const{regex:u}=e.toRefs(a),n=e.getCurrentInstance().proxy,i=t.isOpen,r=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!i.value&&e&&r(),l.emit("search-change",e,n)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(u&&u.value){let a=u.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(u&&u.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=u.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,n)}}}function n(a,l,t){const{groupSelect:u,mode:n,groups:i,disabledProp:r}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[r.value]||i.value&&e&&e.group&&("single"===n.value||!u.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function i(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function r(l,t,u){const{options:n,mode:r,trackBy:o,limit:s,hideSelected:c,createTag:v,createOption:d,label:p,appendNewTag:f,appendNewOption:g,multipleLabel:h,object:m,loading:b,delay:y,resolveOnLoad:_,minChars:O,filterResults:S,clearOnSearch:L,clearOnSelect:w,valueProp:x,canDeselect:P,max:T,strict:k,closeOnSelect:q,groups:E,reverse:I,infinite:R,groupOptions:C,groupHideEmpty:B,groupSelect:D,onCreate:A,disabledProp:j,searchStart:V}=e.toRefs(l),M=e.getCurrentInstance().proxy,N=u.iv,H=u.ev,F=u.search,G=u.clearSearch,$=u.update,K=u.pointer,W=u.clearPointer,U=u.focus,X=u.deactivate,z=u.close,J=e.ref([]),Q=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(R.value&&-1===s.value?10:s.value),ae=e.computed((()=>v.value||d.value||!1)),le=e.computed((()=>void 0!==f.value?f.value:void 0===g.value||g.value)),te=e.computed((()=>{if(E.value){let e=Q.value||[],a=[];return e.forEach((e=>{Re(e[C.value]).forEach((l=>{a.push(Object.assign({},l,e[j.value]?{[j.value]:!0}:{}))}))})),a}{let e=Re(Q.value||[]);return J.value.length&&(e=e.concat(J.value)),e}})),ue=e.computed((()=>E.value?Ee((Q.value||[]).map(((e,a)=>{const l=Re(e[C.value]);return{...e,index:a,group:!0,[C.value]:Ie(l,!1).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{}))),__VISIBLE__:Ie(l).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{})))}}))):[])),ne=e.computed((()=>{let e=te.value;return I.value&&(e=e.reverse()),ve.value.length&&(e=ve.value.concat(e)),Ie(e)})),ie=e.computed((()=>{let e=ne.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),re=e.computed((()=>{switch(r.value){case"single":return!a(N.value[x.value]);case"multiple":case"tags":return!a(N.value)&&N.value.length>0}})),oe=e.computed((()=>void 0!==h&&void 0!==h.value?h.value(N.value,M):N.value&&N.value.length>1?`${N.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!ve.value.length)),ce=e.computed((()=>te.value.length>0&&0==ie.value.length&&(F.value&&E.value||!E.value))),ve=e.computed((()=>!1!==ae.value&&F.value?-1!==ke(F.value)?[]:[{[x.value]:F.value,[p.value]:F.value,[de.value]:F.value,__CREATE__:!0}]:[])),de=e.computed((()=>o.value||p.value)),pe=e.computed((()=>{switch(r.value){case"single":return null;case"multiple":case"tags":return[]}})),fe=e.computed((()=>b.value||Y.value)),ge=e=>{switch("object"!=typeof e&&(e=Te(e)),r.value){case"single":$(e);break;case"multiple":case"tags":$(N.value.concat(e))}t.emit("select",me(e),e,M)},he=e=>{switch("object"!=typeof e&&(e=Te(e)),r.value){case"single":ye();break;case"tags":case"multiple":$(Array.isArray(e)?N.value.filter((a=>-1===e.map((e=>e[x.value])).indexOf(a[x.value]))):N.value.filter((a=>a[x.value]!=e[x.value])))}t.emit("deselect",me(e),e,M)},me=e=>m.value?e:e[x.value],be=e=>{he(e)},ye=()=>{t.emit("clear",M),$(pe.value)},_e=e=>{if(void 0!==e.group)return"single"!==r.value&&(Pe(e[C.value])&&e[C.value].length);switch(r.value){case"single":return!a(N.value)&&N.value[x.value]==e[x.value];case"tags":case"multiple":return!a(N.value)&&-1!==N.value.map((e=>e[x.value])).indexOf(e[x.value])}},Oe=e=>!0===e[j.value],Se=()=>!(void 0===T||-1===T.value||!re.value&&T.value>0)&&N.value.length>=T.value,Le=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,r.value){case"single":if(e&&_e(e))return void(P.value&&he(e));e&&we(e),w.value&&G(),q.value&&(W(),z()),e&&ge(e);break;case"multiple":if(e&&_e(e))return void he(e);if(Se())return;e&&(we(e),ge(e)),w.value&&G(),c.value&&W(),q.value&&z();break;case"tags":if(e&&_e(e))return void he(e);if(Se())return;e&&we(e),w.value&&G(),e&&ge(e),c.value&&W(),q.value&&z()}q.value||U()},we=e=>{void 0===Te(e[x.value])&&ae.value&&(t.emit("tag",e[x.value],M),t.emit("option",e[x.value],M),le.value&&qe(e),G())},xe=e=>void 0===e.find((e=>!_e(e)&&!e[j.value])),Pe=e=>void 0===e.find((e=>!_e(e))),Te=e=>te.value[te.value.map((e=>String(e[x.value]))).indexOf(String(e))],ke=(e,a=!0)=>te.value.map((e=>parseInt(e[de.value])==e[de.value]?parseInt(e[de.value]):e[de.value])).indexOf(parseInt(e)==e?parseInt(e):e),qe=e=>{J.value.push(e)},Ee=e=>B.value?e.filter((e=>F.value?e.__VISIBLE__.length:e[C.value].length)):e.filter((e=>!F.value||e.__VISIBLE__.length)),Ie=(e,a=!0)=>{let l=e;return F.value&&S.value&&(l=l.filter((e=>V.value?i(e[de.value],k.value).startsWith(i(F.value,k.value)):-1!==i(e[de.value],k.value).indexOf(i(F.value,k.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(r.value)&&c.value&&_e(e))(e)))),l},Re=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[x.value]:e,[de.value]:l,[p.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[x.value]:e,[de.value]:e,[p.value]:e})),a},Ce=()=>{a(H.value)||(N.value=Ae(H.value))},Be=e=>(Y.value=!0,new Promise(((a,l)=>{n.value(F.value,M).then((a=>{Q.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),Q.value=[],Y.value=!1})).finally((()=>{a()}))}))),De=()=>{if(re.value)if("single"===r.value){let e=Te(N.value[x.value]);if(void 0!==e){let a=e[p.value];N.value[p.value]=a,m.value&&(H.value[p.value]=a)}}else N.value.forEach(((e,a)=>{let l=Te(N.value[a][x.value]);if(void 0!==l){let e=l[p.value];N.value[a][p.value]=e,m.value&&(H.value[a][p.value]=e)}}))},Ae=e=>a(e)?"single"===r.value?{}:[]:m.value?e:"single"===r.value?Te(e)||{}:e.filter((e=>!!Te(e))).map((e=>Te(e))),je=()=>{Z.value=e.watch(F,(e=>{e.length{e==F.value&&n.value(F.value,M).then((a=>{e!=F.value&&F.value||(Q.value=a,K.value=ie.value.filter((e=>!0!==e[j.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==r.value&&!a(H.value)&&!Array.isArray(H.value))throw new Error(`v-model must be an array when using "${r.value}" mode`);return n&&"function"==typeof n.value?_.value?Be(Ce):1==m.value&&Ce():(Q.value=n.value,Ce()),y.value>-1&&je(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&je()})),e.watch(H,(e=>{if(a(e))N.value=Ae(e);else switch(r.value){case"single":(m.value?e[x.value]!=N.value[x.value]:e!=N.value[x.value])&&(N.value=Ae(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(m.value?e.map((e=>e[x.value])):e,N.value.map((e=>e[x.value])))||(N.value=Ae(e))}}),{deep:!0}),e.watch(n,((e,a)=>{"function"==typeof l.options?_.value&&Be():(Q.value=l.options,Object.keys(N.value).length||Ce(),De())})),e.watch(p,De),{pfo:ne,fo:ie,filteredOptions:ie,hasSelected:re,multipleLabelText:oe,eo:te,extendedOptions:te,fg:ue,filteredGroups:ue,noOptions:se,noResults:ce,resolving:Y,busy:fe,offset:ee,select:ge,deselect:he,remove:be,selectAll:()=>{"single"!==r.value&&ge(ie.value)},clear:ye,isSelected:_e,isDisabled:Oe,isMax:Se,getOption:Te,handleOptionClick:e=>{if(!Oe(e))return A&&A.value&&!_e(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=A.value(e,M))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Le(e)}))):void Le(e)},handleGroupClick:e=>{if(!Oe(e)&&"single"!==r.value&&D.value){switch(r.value){case"multiple":case"tags":xe(e[C.value])?he(e[C.value]):ge(e[C.value].filter((e=>-1===N.value.map((e=>e[x.value])).indexOf(e[x.value]))).filter((e=>!e[j.value])).filter(((e,a)=>N.value.length+1+a<=T.value||-1===T.value)))}q.value&&X()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{Be(e)},resolveOptions:Be,refreshLabels:De}}function o(a,l,t){const{valueProp:u,showOptions:n,searchable:i,groupLabel:r,groups:o,mode:s,groupSelect:c,disabledProp:v}=e.toRefs(a),d=t.fo,p=t.fg,f=t.handleOptionClick,g=t.handleGroupClick,h=t.search,m=t.pointer,b=t.setPointer,y=t.clearPointer,_=t.multiselect,O=t.isOpen,S=e.computed((()=>d.value.filter((e=>!e[v.value])))),L=e.computed((()=>p.value.filter((e=>!e[v.value])))),w=e.computed((()=>"single"!==s.value&&c.value)),x=e.computed((()=>m.value&&m.value.group)),P=e.computed((()=>A(m.value))),T=e.computed((()=>{const e=x.value?m.value:A(m.value),a=L.value.map((e=>e[r.value])).indexOf(e[r.value]);let l=L.value[a-1];return void 0===l&&(l=q.value),l})),k=e.computed((()=>{let e=L.value.map((e=>e.label)).indexOf(x.value?m.value[r.value]:A(m.value)[r.value])+1;return L.value.length<=e&&(e=0),L.value[e]})),q=e.computed((()=>[...L.value].slice(-1)[0])),E=e.computed((()=>m.value.__VISIBLE__.filter((e=>!e[v.value]))[0])),I=e.computed((()=>{const e=P.value.__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(m.value[u.value])-1]})),R=e.computed((()=>{const e=A(m.value).__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(m.value[u.value])+1]})),C=e.computed((()=>[...T.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),B=e.computed((()=>[...q.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),D=()=>{b(S.value[0]||null)},A=e=>L.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[u.value])).indexOf(e[u.value]))),j=()=>{let e=_.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=x.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop{i.value&&(e.length&&n.value?D():y())})),e.watch(O,(a=>{if(a){let a=_.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:m,canPointGroups:w,isPointed:e=>!(!m.value||!(!e.group&&m.value[u.value]==e[u.value]||void 0!==e.group&&m.value[r.value]==e[r.value]))||void 0,setPointerFirst:D,selectPointer:()=>{m.value&&!0!==m.value[v.value]&&(x.value?g(m.value):f(m.value))},forwardPointer:()=>{if(null===m.value)b((o.value&&w.value?L.value[0]:S.value[0])||null);else if(o.value&&w.value){let e=x.value?E.value:R.value;void 0===e&&(e=k.value),b(e||null)}else{let e=S.value.map((e=>e[u.value])).indexOf(m.value[u.value])+1;S.value.length<=e&&(e=0),b(S.value[e]||null)}e.nextTick((()=>{j()}))},backwardPointer:()=>{if(null===m.value){let e=S.value[S.value.length-1];o.value&&w.value&&(e=B.value,void 0===e&&(e=q.value)),b(e||null)}else if(o.value&&w.value){let e=x.value?C.value:I.value;void 0===e&&(e=x.value?T.value:P.value),b(e||null)}else{let e=S.value.map((e=>e[u.value])).indexOf(m.value[u.value])-1;e<0&&(e=S.value.length-1),b(S.value[e]||null)}e.nextTick((()=>{j()}))}}}function s(a,l,t){const{disabled:u}=e.toRefs(a),n=e.getCurrentInstance().proxy,i=e.ref(!1);return{isOpen:i,open:()=>{i.value||u.value||(i.value=!0,l.emit("open",n))},close:()=>{i.value&&(i.value=!1,l.emit("close",n))}}}function c(a,l,t){const{searchable:u,disabled:n}=e.toRefs(a),i=t.input,r=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,v=e.ref(null),d=e.ref(null),p=e.ref(!1),f=e.ref(!1),g=e.computed((()=>u.value||n.value?-1:0)),h=()=>{u.value&&i.value.blur(),v.value.blur()},m=(e=!0)=>{n.value||(p.value=!0,e&&r())},b=()=>{p.value=!1,setTimeout((()=>{p.value||(o(),s())}),1)};return{multiselect:v,tags:d,tabindex:g,isActive:p,mouseClicked:f,blur:h,focus:()=>{u.value&&!n.value&&i.value.focus()},activate:m,deactivate:b,handleFocusIn:()=>{m(f.value)},handleFocusOut:()=>{b()},handleCaretClick:()=>{b(),h()},handleMousedown:e=>{f.value=!0,c.value&&(e.target.isEqualNode(v.value)||e.target.isEqualNode(d.value))?setTimeout((()=>{b()}),0):document.activeElement.isEqualNode(v.value)&&!c.value&&m(),setTimeout((()=>{f.value=!1}),0)}}}function v(a,l,t){const{mode:u,addTagOn:n,openDirection:i,searchable:r,showOptions:o,valueProp:s,groups:c,addOptionOn:v,createTag:d,createOption:p,reverse:f}=e.toRefs(a),g=e.getCurrentInstance().proxy,h=t.iv,m=t.update,b=t.search,y=t.setPointer,_=t.selectPointer,O=t.backwardPointer,S=t.forwardPointer,L=t.multiselect,w=t.tags,x=t.isOpen,P=t.open,T=t.blur,k=t.fo,q=e.computed((()=>d.value||p.value||!1)),E=e.computed((()=>void 0!==n.value?n.value:void 0!==v.value?v.value:["enter"])),I=()=>{"tags"===u.value&&!o.value&&q.value&&r.value&&!c.value&&y(k.value[k.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,g),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===u.value&&(a=[...L.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==w.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===u.value)return;if(r.value&&-1===[null,""].indexOf(b.value))return;if(0===h.value.length)return;m([...h.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),-1!==t&&void 0!==t)return m([...h.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():r.value?w.value.querySelector("input").focus():L.value.focus()));if(-1===E.value.indexOf("enter")&&q.value)return;I(),_();break;case" ":if(!q.value&&!r.value)return e.preventDefault(),I(),void _();if(!q.value)return!1;if(-1===E.value.indexOf("space")&&q.value)return;e.preventDefault(),I(),_();break;case"Tab":case";":case",":if(-1===E.value.indexOf(e.key.toLowerCase())||!q.value)return;I(),_(),e.preventDefault();break;case"Escape":T();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;x.value||P(),O();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;x.value||P(),S();break;case"ArrowLeft":if(r.value&&w.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==u.value||!h.value||!h.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==u.value||!h.value||!h.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():r.value?w.value.querySelector("input").focus():r.value||L.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,g)},preparePointer:I}}function d(a,l,t){const{classes:u,disabled:n,openDirection:i,showOptions:r}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,v=t.isDisabled,d=t.isActive,p=t.canPointGroups,f=t.resolving,g=t.fo,h=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer",...u.value}))),m=e.computed((()=>!!(o.value&&r.value&&(!f.value||f.value&&g.value.length))));return{classList:e.computed((()=>{const e=h.value;return{container:[e.container].concat(n.value?e.containerDisabled:[]).concat(m.value&&"top"===i.value?e.containerOpenTop:[]).concat(m.value&&"top"!==i.value?e.containerOpen:[]).concat(d.value?e.containerActive:[]),spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(n.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===i.value?e.dropdownTop:[]).concat(o.value&&r.value&&m.value?[]:e.dropdownHidden),options:[e.options].concat("top"===i.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&p.value?l.push(v(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):v(a)&&l.push(e.groupLabelDisabled),p.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(v(a)?e.optionSelectedDisabled:e.optionSelected):(v(a)||l&&v(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,fakeInput:e.fakeInput}})),showDropdown:m}}function p(a,l,t){const{limit:u,infinite:n}=e.toRefs(a),i=t.isOpen,r=t.offset,o=t.search,s=t.pfo,c=t.eo,v=e.ref(null),d=e.ref(null),p=e.computed((()=>r.value{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;r.value+=-1==u.value?10:u.value,e.nextTick((()=>{a.scrollTop=l}))}},g=()=>{i.value&&r.value{n.value&&g()})),e.watch(o,(()=>{n.value&&(r.value=u.value,g())}),{flush:"post"}),e.watch(c,(()=>{n.value&&g()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(v.value=new IntersectionObserver(f))})),{hasMore:p,infiniteLoader:d}}function f(a,l,t){const{placeholder:u,id:n,valueProp:i,label:r,mode:o,groupLabel:s}=e.toRefs(a),c=t.pointer;t.iv,t.hasSelected,t.multipleLabelText,t.isOpen;const v=e.ref(null),d=e.computed((()=>{let e=[];return n&&n.value&&e.push(n.value),e.push("multiselect-options"),e.join("-")})),p=e.computed((()=>{let e=[];if(n&&n.value&&e.push(n.value),c.value)return e.push(c.value.group?"multiselect-group":"multiselect-option"),e.push(c.value.group?c.value.index:c.value[i.value]),e.join("-")})),f=e.computed((()=>u.value)),g=e.computed((()=>"single"!==o.value));return e.onMounted((()=>{if(n&&n.value&&document&&document.querySelector){let e=document.querySelector(`[for="${n.value}"]`);v.value=e?e.innerText:null}})),{ariaOwns:d,ariaPlaceholder:f,ariaMultiselectable:g,ariaActiveDescendant:p,ariaOptionId:e=>{let a=[];return n&&n.value&&a.push(n.value),a.push("multiselect-option"),a.push(e[i.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[r.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return n&&n.value&&a.push(n.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}function g(e,a,l,t,u,n,i,r,o,s){"boolean"!=typeof i&&(o=r,r=i,i=!1);const c="function"==typeof l?l.options:l;let v;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,u&&(c.functional=!0)),t&&(c._scopeId=t),n?(v=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(n)},c._ssrRegister=v):a&&(v=i?function(e){a.call(this,s(e,this.$root.$options.shadowRoot))}:function(e){a.call(this,r(e))}),v)if(c.functional){const e=c.render;c.render=function(a,l){return v.call(l),e(a,l)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,v):[v]}return l}const h={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,n,s,u,l,c,r,p,o,v,d,f])};var m=function(){var e=this,a=e.$createElement,l=e._self._c||a;return l("div",e._b({ref:"multiselect",class:e.classList.container,attrs:{tabindex:e.tabindex,id:e.searchable?void 0:e.id,dir:e.rtl?"rtl":void 0,"aria-owns":e.searchable?void 0:e.ariaOwns,"aria-placeholder":e.searchable?void 0:e.ariaPlaceholder,"aria-expanded":e.searchable?void 0:e.isOpen,"aria-activedescendant":e.searchable?void 0:e.ariaActiveDescendant,"aria-multiselectable":e.searchable?void 0:e.ariaMultiselectable,role:e.searchable?void 0:"listbox"},on:{focusin:e.handleFocusIn,focusout:e.handleFocusOut,keydown:e.handleKeydown,keyup:e.handleKeyup,mousedown:e.handleMousedown}},"div",e.searchable?{}:e.aria,!1),["tags"!==e.mode&&e.searchable&&!e.disabled?[l("input",e._b({ref:"input",class:e.classList.search,attrs:{type:e.inputType,modelValue:e.search,autocomplete:e.autocomplete,id:e.searchable?e.id:void 0,"aria-owns":e.ariaOwns,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"listbox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.aria),!1))]:e._e(),e._v(" "),"tags"==e.mode?[l("div",{class:e.classList.tags,attrs:{"data-tags":""}},[e._l(e.iv,(function(a,t,u){return e._t("tag",(function(){return[l("span",{key:u,class:e.classList.tag,attrs:{tabindex:"-1","aria-label":e.ariaTagLabel(a[e.label])},on:{keyup:function(l){return!l.type.indexOf("key")&&e._k(l.keyCode,"enter",13,l.key,"Enter")?null:e.handleTagRemove(a,l)}}},[e._v("\n "+e._s(a[e.label])+"\n "),e.disabled?e._e():l("span",{class:e.classList.tagRemove,on:{click:function(l){return e.handleTagRemove(a,l)}}},[l("span",{class:e.classList.tagRemoveIcon})])])]}),{option:a,handleTagRemove:e.handleTagRemove,disabled:e.disabled})})),e._v(" "),l("div",{ref:"tags",class:e.classList.tagsSearchWrapper},[l("span",{class:e.classList.tagsSearchCopy},[e._v(e._s(e.search))]),e._v(" "),e.searchable&&!e.disabled?l("input",e._b({ref:"input",class:e.classList.tagsSearch,attrs:{type:e.inputType,modelValue:e.search,id:e.searchable?e.id:void 0,autocomplete:e.autocomplete,"aria-owns":e.ariaOwns,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"listbox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.aria),!1)):e._e()])],2)]:e._e(),e._v(" "),"single"==e.mode&&e.hasSelected&&!e.search&&e.iv?[e._t("singlelabel",(function(){return[l("div",{class:e.classList.singleLabel,attrs:{"aria-hidden":"true"}},[l("span",{class:e.classList.singleLabelText,domProps:{innerHTML:e._s(e.iv[e.label])}})])]}),{value:e.iv})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",(function(){return[l("div",{class:e.classList.multipleLabel,attrs:{"aria-hidden":"true"},domProps:{innerHTML:e._s(e.multipleLabelText)}})]}),{values:e.iv})]:e._e(),e._v(" "),!e.placeholder||e.hasSelected||e.search?e._e():[e._t("placeholder",(function(){return[l("div",{class:e.classList.placeholder,attrs:{"aria-hidden":"true"}},[e._v("\n "+e._s(e.placeholder)+"\n ")])]}))],e._v(" "),e.loading||e.resolving?e._t("spinner",(function(){return[l("span",{class:e.classList.spinner,attrs:{"aria-hidden":"true"}})]})):e._e(),e._v(" "),e.hasSelected&&!e.disabled&&e.canClear&&!e.busy?e._t("clear",(function(){return[l("span",{class:e.classList.clear,attrs:{tabindex:"0",role:"button","aria-label":"❎"},on:{click:e.clear,keyup:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.clear.apply(null,arguments)}}},[l("span",{class:e.classList.clearIcon})])]}),{clear:e.clear}):e._e(),e._v(" "),e.caret&&e.showOptions?e._t("caret",(function(){return[l("span",{class:e.classList.caret,attrs:{"aria-hidden":"true"},on:{click:e.handleCaretClick}})]})):e._e(),e._v(" "),l("div",{class:e.classList.dropdown,attrs:{tabindex:"-1"}},[e._t("beforelist",null,{options:e.fo}),e._v(" "),l("ul",{class:e.classList.options,attrs:{id:e.ariaOwns}},[e.groups?e._l(e.fg,(function(a,t,u){return l("li",{key:u,class:e.classList.group,attrs:{id:e.ariaGroupId(a),"aria-label":e.ariaGroupLabel(a),"aria-selected":e.isSelected(a),role:"option"}},[l("div",{class:e.classList.groupLabel(a),attrs:{"data-pointed":e.isPointed(a)},on:{mouseenter:function(l){return e.setPointer(a,t)},click:function(l){return e.handleGroupClick(a)}}},[e._t("grouplabel",(function(){return[l("span",{domProps:{innerHTML:e._s(a[e.groupLabel])}})]}),{group:a,isSelected:e.isSelected,isPointed:e.isPointed})],2),e._v(" "),l("ul",{class:e.classList.groupOptions,attrs:{"aria-label":e.ariaGroupLabel(a),role:"group"}},e._l(a.__VISIBLE__,(function(t,u,n){return l("li",{key:n,class:e.classList.option(t,a),attrs:{"data-pointed":e.isPointed(t),"data-selected":e.isSelected(t)||void 0,id:e.ariaOptionId(t),"aria-selected":e.isSelected(t),"aria-label":e.ariaOptionLabel(t),role:"option"},on:{mouseenter:function(a){return e.setPointer(t)},click:function(a){return e.handleOptionClick(t)}}},[e._t("option",(function(){return[l("span",{domProps:{innerHTML:e._s(t[e.label])}})]}),{option:t,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)})),0)])})):e._l(e.fo,(function(a,t,u){return l("li",{key:u,class:e.classList.option(a),attrs:{"data-pointed":e.isPointed(a),"data-selected":e.isSelected(a)||void 0,id:e.ariaOptionId(a),"aria-selected":e.isSelected(a),"aria-label":e.ariaOptionLabel(a),role:"option"},on:{mouseenter:function(l){return e.setPointer(a)},click:function(l){return e.handleOptionClick(a)}}},[e._t("option",(function(){return[l("span",{domProps:{innerHTML:e._s(a[e.label])}})]}),{option:a,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)}))],2),e._v(" "),e.noOptions?e._t("nooptions",(function(){return[l("div",{class:e.classList.noOptions,domProps:{innerHTML:e._s(e.noOptionsText)}})]})):e._e(),e._v(" "),e.noResults?e._t("noresults",(function(){return[l("div",{class:e.classList.noResults,domProps:{innerHTML:e._s(e.noResultsText)}})]})):e._e(),e._v(" "),e.infinite&&e.hasMore?l("div",{ref:"infiniteLoader",class:e.classList.inifinite},[e._t("infinite",(function(){return[l("span",{class:e.classList.inifiniteSpinner})]}))],2):e._e(),e._v(" "),e._t("afterlist",null,{options:e.fo})],2),e._v(" "),e.required?l("input",{class:e.classList.fakeInput,attrs:{tabindex:"-1",required:""},domProps:{value:e.textValue}}):e._e(),e._v(" "),e.nativeSupport?["single"==e.mode?l("input",{attrs:{type:"hidden",name:e.name},domProps:{value:void 0!==e.plainValue?e.plainValue:""}}):e._l(e.plainValue,(function(a,t){return l("input",{key:t,attrs:{type:"hidden",name:e.name+"[]"},domProps:{value:a}})}))]:e._e(),e._v(" "),l("div",{class:e.classList.spacer})],2)};m._withStripped=!0;return g({render:m,staticRenderFns:[]},undefined,h,undefined,false,undefined,!1,void 0,void 0,void 0)}(Vue); +var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,u){const{object:n,valueProp:i,mode:r}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=u.iv,c=e=>n.value||a(e)?e:Array.isArray(e)?e.map((e=>e[i.value])):e[i.value],v=e=>a(e)?"single"===r.value?{}:[]:e;return{update:e=>{s.value=v(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:u,mode:n,valueProp:i}=e.toRefs(a),r=e.ref("single"!==n.value?[]:{}),o=u&&void 0!==u.value?u:t,s=e.computed((()=>"single"===n.value?r.value[i.value]:r.value.map((e=>e[i.value])))),c=e.computed((()=>"single"!==n.value?r.value.map((e=>e[i.value])).join(","):r.value[i.value]));return{iv:r,internalValue:r,ev:o,externalValue:o,textValue:c,plainValue:s}}function u(a,l,t){const{regex:u}=e.toRefs(a),n=e.getCurrentInstance().proxy,i=t.isOpen,r=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!i.value&&e&&r(),l.emit("search-change",e,n)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(u&&u.value){let a=u.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(u&&u.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=u.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,n)}}}function n(a,l,t){const{groupSelect:u,mode:n,groups:i,disabledProp:r}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[r.value]||i.value&&e&&e.group&&("single"===n.value||!u.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function i(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function r(l,t,u){const{options:n,mode:r,trackBy:o,limit:s,hideSelected:c,createTag:v,createOption:d,label:p,appendNewTag:f,appendNewOption:g,multipleLabel:h,object:m,loading:b,delay:y,resolveOnLoad:_,minChars:O,filterResults:S,clearOnSearch:L,clearOnSelect:w,valueProp:x,canDeselect:P,max:T,strict:k,closeOnSelect:q,groups:E,reverse:I,infinite:R,groupOptions:C,groupHideEmpty:B,groupSelect:D,onCreate:A,disabledProp:j,searchStart:V}=e.toRefs(l),M=e.getCurrentInstance().proxy,N=u.iv,H=u.ev,F=u.search,G=u.clearSearch,$=u.update,K=u.pointer,W=u.clearPointer,U=u.focus,X=u.deactivate,z=u.close,J=e.ref([]),Q=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(R.value&&-1===s.value?10:s.value),ae=e.computed((()=>v.value||d.value||!1)),le=e.computed((()=>void 0!==f.value?f.value:void 0===g.value||g.value)),te=e.computed((()=>{if(E.value){let e=Q.value||[],a=[];return e.forEach((e=>{Re(e[C.value]).forEach((l=>{a.push(Object.assign({},l,e[j.value]?{[j.value]:!0}:{}))}))})),a}{let e=Re(Q.value||[]);return J.value.length&&(e=e.concat(J.value)),e}})),ue=e.computed((()=>E.value?Ee((Q.value||[]).map(((e,a)=>{const l=Re(e[C.value]);return{...e,index:a,group:!0,[C.value]:Ie(l,!1).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{}))),__VISIBLE__:Ie(l).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{})))}}))):[])),ne=e.computed((()=>{let e=te.value;return I.value&&(e=e.reverse()),ve.value.length&&(e=ve.value.concat(e)),Ie(e)})),ie=e.computed((()=>{let e=ne.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),re=e.computed((()=>{switch(r.value){case"single":return!a(N.value[x.value]);case"multiple":case"tags":return!a(N.value)&&N.value.length>0}})),oe=e.computed((()=>void 0!==h&&void 0!==h.value?h.value(N.value,M):N.value&&N.value.length>1?`${N.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!ve.value.length)),ce=e.computed((()=>te.value.length>0&&0==ie.value.length&&(F.value&&E.value||!E.value))),ve=e.computed((()=>!1!==ae.value&&F.value?-1!==ke(F.value)?[]:[{[x.value]:F.value,[p.value]:F.value,[de.value]:F.value,__CREATE__:!0}]:[])),de=e.computed((()=>o.value||p.value)),pe=e.computed((()=>{switch(r.value){case"single":return null;case"multiple":case"tags":return[]}})),fe=e.computed((()=>b.value||Y.value)),ge=e=>{switch("object"!=typeof e&&(e=Te(e)),r.value){case"single":$(e);break;case"multiple":case"tags":$(N.value.concat(e))}t.emit("select",me(e),e,M)},he=e=>{switch("object"!=typeof e&&(e=Te(e)),r.value){case"single":ye();break;case"tags":case"multiple":$(Array.isArray(e)?N.value.filter((a=>-1===e.map((e=>e[x.value])).indexOf(a[x.value]))):N.value.filter((a=>a[x.value]!=e[x.value])))}t.emit("deselect",me(e),e,M)},me=e=>m.value?e:e[x.value],be=e=>{he(e)},ye=()=>{t.emit("clear",M),$(pe.value)},_e=e=>{if(void 0!==e.group)return"single"!==r.value&&(Pe(e[C.value])&&e[C.value].length);switch(r.value){case"single":return!a(N.value)&&N.value[x.value]==e[x.value];case"tags":case"multiple":return!a(N.value)&&-1!==N.value.map((e=>e[x.value])).indexOf(e[x.value])}},Oe=e=>!0===e[j.value],Se=()=>!(void 0===T||-1===T.value||!re.value&&T.value>0)&&N.value.length>=T.value,Le=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,r.value){case"single":if(e&&_e(e))return void(P.value&&he(e));e&&we(e),w.value&&G(),q.value&&(W(),z()),e&&ge(e);break;case"multiple":if(e&&_e(e))return void he(e);if(Se())return;e&&(we(e),ge(e)),w.value&&G(),c.value&&W(),q.value&&z();break;case"tags":if(e&&_e(e))return void he(e);if(Se())return;e&&we(e),w.value&&G(),e&&ge(e),c.value&&W(),q.value&&z()}q.value||U()},we=e=>{void 0===Te(e[x.value])&&ae.value&&(t.emit("tag",e[x.value],M),t.emit("option",e[x.value],M),le.value&&qe(e),G())},xe=e=>void 0===e.find((e=>!_e(e)&&!e[j.value])),Pe=e=>void 0===e.find((e=>!_e(e))),Te=e=>te.value[te.value.map((e=>String(e[x.value]))).indexOf(String(e))],ke=(e,a=!0)=>te.value.map((e=>parseInt(e[de.value])==e[de.value]?parseInt(e[de.value]):e[de.value])).indexOf(parseInt(e)==e?parseInt(e):e),qe=e=>{J.value.push(e)},Ee=e=>B.value?e.filter((e=>F.value?e.__VISIBLE__.length:e[C.value].length)):e.filter((e=>!F.value||e.__VISIBLE__.length)),Ie=(e,a=!0)=>{let l=e;return F.value&&S.value&&(l=l.filter((e=>V.value?i(e[de.value],k.value).startsWith(i(F.value,k.value)):-1!==i(e[de.value],k.value).indexOf(i(F.value,k.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(r.value)&&c.value&&_e(e))(e)))),l},Re=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[x.value]:e,[de.value]:l,[p.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[x.value]:e,[de.value]:e,[p.value]:e})),a},Ce=()=>{a(H.value)||(N.value=Ae(H.value))},Be=e=>(Y.value=!0,new Promise(((a,l)=>{n.value(F.value,M).then((a=>{Q.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),Q.value=[],Y.value=!1})).finally((()=>{a()}))}))),De=()=>{if(re.value)if("single"===r.value){let e=Te(N.value[x.value]);if(void 0!==e){let a=e[p.value];N.value[p.value]=a,m.value&&(H.value[p.value]=a)}}else N.value.forEach(((e,a)=>{let l=Te(N.value[a][x.value]);if(void 0!==l){let e=l[p.value];N.value[a][p.value]=e,m.value&&(H.value[a][p.value]=e)}}))},Ae=e=>a(e)?"single"===r.value?{}:[]:m.value?e:"single"===r.value?Te(e)||{}:e.filter((e=>!!Te(e))).map((e=>Te(e))),je=()=>{Z.value=e.watch(F,(e=>{e.length{e==F.value&&n.value(F.value,M).then((a=>{e!=F.value&&F.value||(Q.value=a,K.value=ie.value.filter((e=>!0!==e[j.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==r.value&&!a(H.value)&&!Array.isArray(H.value))throw new Error(`v-model must be an array when using "${r.value}" mode`);return n&&"function"==typeof n.value?_.value?Be(Ce):1==m.value&&Ce():(Q.value=n.value,Ce()),y.value>-1&&je(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&je()})),e.watch(H,(e=>{if(a(e))N.value=Ae(e);else switch(r.value){case"single":(m.value?e[x.value]!=N.value[x.value]:e!=N.value[x.value])&&(N.value=Ae(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(m.value?e.map((e=>e[x.value])):e,N.value.map((e=>e[x.value])))||(N.value=Ae(e))}}),{deep:!0}),e.watch(n,((e,a)=>{"function"==typeof l.options?_.value&&(!a||e&&e.toString()!==a.toString())&&Be():(Q.value=l.options,Object.keys(N.value).length||Ce(),De())})),e.watch(p,De),{pfo:ne,fo:ie,filteredOptions:ie,hasSelected:re,multipleLabelText:oe,eo:te,extendedOptions:te,fg:ue,filteredGroups:ue,noOptions:se,noResults:ce,resolving:Y,busy:fe,offset:ee,select:ge,deselect:he,remove:be,selectAll:()=>{"single"!==r.value&&ge(ie.value)},clear:ye,isSelected:_e,isDisabled:Oe,isMax:Se,getOption:Te,handleOptionClick:e=>{if(!Oe(e))return A&&A.value&&!_e(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=A.value(e,M))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Le(e)}))):void Le(e)},handleGroupClick:e=>{if(!Oe(e)&&"single"!==r.value&&D.value){switch(r.value){case"multiple":case"tags":xe(e[C.value])?he(e[C.value]):ge(e[C.value].filter((e=>-1===N.value.map((e=>e[x.value])).indexOf(e[x.value]))).filter((e=>!e[j.value])).filter(((e,a)=>N.value.length+1+a<=T.value||-1===T.value)))}q.value&&X()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{Be(e)},resolveOptions:Be,refreshLabels:De}}function o(a,l,t){const{valueProp:u,showOptions:n,searchable:i,groupLabel:r,groups:o,mode:s,groupSelect:c,disabledProp:v}=e.toRefs(a),d=t.fo,p=t.fg,f=t.handleOptionClick,g=t.handleGroupClick,h=t.search,m=t.pointer,b=t.setPointer,y=t.clearPointer,_=t.multiselect,O=t.isOpen,S=e.computed((()=>d.value.filter((e=>!e[v.value])))),L=e.computed((()=>p.value.filter((e=>!e[v.value])))),w=e.computed((()=>"single"!==s.value&&c.value)),x=e.computed((()=>m.value&&m.value.group)),P=e.computed((()=>A(m.value))),T=e.computed((()=>{const e=x.value?m.value:A(m.value),a=L.value.map((e=>e[r.value])).indexOf(e[r.value]);let l=L.value[a-1];return void 0===l&&(l=q.value),l})),k=e.computed((()=>{let e=L.value.map((e=>e.label)).indexOf(x.value?m.value[r.value]:A(m.value)[r.value])+1;return L.value.length<=e&&(e=0),L.value[e]})),q=e.computed((()=>[...L.value].slice(-1)[0])),E=e.computed((()=>m.value.__VISIBLE__.filter((e=>!e[v.value]))[0])),I=e.computed((()=>{const e=P.value.__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(m.value[u.value])-1]})),R=e.computed((()=>{const e=A(m.value).__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(m.value[u.value])+1]})),C=e.computed((()=>[...T.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),B=e.computed((()=>[...q.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),D=()=>{b(S.value[0]||null)},A=e=>L.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[u.value])).indexOf(e[u.value]))),j=()=>{let e=_.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=x.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop{i.value&&(e.length&&n.value?D():y())})),e.watch(O,(a=>{if(a){let a=_.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:m,canPointGroups:w,isPointed:e=>!(!m.value||!(!e.group&&m.value[u.value]==e[u.value]||void 0!==e.group&&m.value[r.value]==e[r.value]))||void 0,setPointerFirst:D,selectPointer:()=>{m.value&&!0!==m.value[v.value]&&(x.value?g(m.value):f(m.value))},forwardPointer:()=>{if(null===m.value)b((o.value&&w.value?L.value[0]:S.value[0])||null);else if(o.value&&w.value){let e=x.value?E.value:R.value;void 0===e&&(e=k.value),b(e||null)}else{let e=S.value.map((e=>e[u.value])).indexOf(m.value[u.value])+1;S.value.length<=e&&(e=0),b(S.value[e]||null)}e.nextTick((()=>{j()}))},backwardPointer:()=>{if(null===m.value){let e=S.value[S.value.length-1];o.value&&w.value&&(e=B.value,void 0===e&&(e=q.value)),b(e||null)}else if(o.value&&w.value){let e=x.value?C.value:I.value;void 0===e&&(e=x.value?T.value:P.value),b(e||null)}else{let e=S.value.map((e=>e[u.value])).indexOf(m.value[u.value])-1;e<0&&(e=S.value.length-1),b(S.value[e]||null)}e.nextTick((()=>{j()}))}}}function s(a,l,t){const{disabled:u}=e.toRefs(a),n=e.getCurrentInstance().proxy,i=e.ref(!1);return{isOpen:i,open:()=>{i.value||u.value||(i.value=!0,l.emit("open",n))},close:()=>{i.value&&(i.value=!1,l.emit("close",n))}}}function c(a,l,t){const{searchable:u,disabled:n}=e.toRefs(a),i=t.input,r=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,v=e.ref(null),d=e.ref(null),p=e.ref(!1),f=e.ref(!1),g=e.computed((()=>u.value||n.value?-1:0)),h=()=>{u.value&&i.value.blur(),v.value.blur()},m=(e=!0)=>{n.value||(p.value=!0,e&&r())},b=()=>{p.value=!1,setTimeout((()=>{p.value||(o(),s())}),1)};return{multiselect:v,tags:d,tabindex:g,isActive:p,mouseClicked:f,blur:h,focus:()=>{u.value&&!n.value&&i.value.focus()},activate:m,deactivate:b,handleFocusIn:()=>{m(f.value)},handleFocusOut:()=>{b()},handleCaretClick:()=>{b(),h()},handleMousedown:e=>{f.value=!0,c.value&&(e.target.isEqualNode(v.value)||e.target.isEqualNode(d.value))?setTimeout((()=>{b()}),0):document.activeElement.isEqualNode(v.value)&&!c.value&&m(),setTimeout((()=>{f.value=!1}),0)}}}function v(a,l,t){const{mode:u,addTagOn:n,openDirection:i,searchable:r,showOptions:o,valueProp:s,groups:c,addOptionOn:v,createTag:d,createOption:p,reverse:f}=e.toRefs(a),g=e.getCurrentInstance().proxy,h=t.iv,m=t.update,b=t.search,y=t.setPointer,_=t.selectPointer,O=t.backwardPointer,S=t.forwardPointer,L=t.multiselect,w=t.tags,x=t.isOpen,P=t.open,T=t.blur,k=t.fo,q=e.computed((()=>d.value||p.value||!1)),E=e.computed((()=>void 0!==n.value?n.value:void 0!==v.value?v.value:["enter"])),I=()=>{"tags"===u.value&&!o.value&&q.value&&r.value&&!c.value&&y(k.value[k.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,g),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===u.value&&(a=[...L.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==w.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===u.value)return;if(r.value&&-1===[null,""].indexOf(b.value))return;if(0===h.value.length)return;m([...h.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),-1!==t&&void 0!==t)return m([...h.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():r.value?w.value.querySelector("input").focus():L.value.focus()));if(-1===E.value.indexOf("enter")&&q.value)return;I(),_();break;case" ":if(!q.value&&!r.value)return e.preventDefault(),I(),void _();if(!q.value)return!1;if(-1===E.value.indexOf("space")&&q.value)return;e.preventDefault(),I(),_();break;case"Tab":case";":case",":if(-1===E.value.indexOf(e.key.toLowerCase())||!q.value)return;I(),_(),e.preventDefault();break;case"Escape":T();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;x.value||P(),O();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;x.value||P(),S();break;case"ArrowLeft":if(r.value&&w.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==u.value||!h.value||!h.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==u.value||!h.value||!h.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():r.value?w.value.querySelector("input").focus():r.value||L.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,g)},preparePointer:I}}function d(a,l,t){const{classes:u,disabled:n,openDirection:i,showOptions:r}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,v=t.isDisabled,d=t.isActive,p=t.canPointGroups,f=t.resolving,g=t.fo,h=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer",...u.value}))),m=e.computed((()=>!!(o.value&&r.value&&(!f.value||f.value&&g.value.length))));return{classList:e.computed((()=>{const e=h.value;return{container:[e.container].concat(n.value?e.containerDisabled:[]).concat(m.value&&"top"===i.value?e.containerOpenTop:[]).concat(m.value&&"top"!==i.value?e.containerOpen:[]).concat(d.value?e.containerActive:[]),spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(n.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===i.value?e.dropdownTop:[]).concat(o.value&&r.value&&m.value?[]:e.dropdownHidden),options:[e.options].concat("top"===i.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&p.value?l.push(v(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):v(a)&&l.push(e.groupLabelDisabled),p.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(v(a)?e.optionSelectedDisabled:e.optionSelected):(v(a)||l&&v(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,fakeInput:e.fakeInput}})),showDropdown:m}}function p(a,l,t){const{limit:u,infinite:n}=e.toRefs(a),i=t.isOpen,r=t.offset,o=t.search,s=t.pfo,c=t.eo,v=e.ref(null),d=e.ref(null),p=e.computed((()=>r.value{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;r.value+=-1==u.value?10:u.value,e.nextTick((()=>{a.scrollTop=l}))}},g=()=>{i.value&&r.value{n.value&&g()})),e.watch(o,(()=>{n.value&&(r.value=u.value,g())}),{flush:"post"}),e.watch(c,(()=>{n.value&&g()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(v.value=new IntersectionObserver(f))})),{hasMore:p,infiniteLoader:d}}function f(a,l,t){const{placeholder:u,id:n,valueProp:i,label:r,mode:o,groupLabel:s}=e.toRefs(a),c=t.pointer;t.iv,t.hasSelected,t.multipleLabelText,t.isOpen;const v=e.ref(null),d=e.computed((()=>{let e=[];return n&&n.value&&e.push(n.value),e.push("multiselect-options"),e.join("-")})),p=e.computed((()=>{let e=[];if(n&&n.value&&e.push(n.value),c.value)return e.push(c.value.group?"multiselect-group":"multiselect-option"),e.push(c.value.group?c.value.index:c.value[i.value]),e.join("-")})),f=e.computed((()=>u.value)),g=e.computed((()=>"single"!==o.value));return e.onMounted((()=>{if(n&&n.value&&document&&document.querySelector){let e=document.querySelector(`[for="${n.value}"]`);v.value=e?e.innerText:null}})),{ariaOwns:d,ariaPlaceholder:f,ariaMultiselectable:g,ariaActiveDescendant:p,ariaOptionId:e=>{let a=[];return n&&n.value&&a.push(n.value),a.push("multiselect-option"),a.push(e[i.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[r.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return n&&n.value&&a.push(n.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}function g(e,a,l,t,u,n,i,r,o,s){"boolean"!=typeof i&&(o=r,r=i,i=!1);const c="function"==typeof l?l.options:l;let v;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,u&&(c.functional=!0)),t&&(c._scopeId=t),n?(v=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(n)},c._ssrRegister=v):a&&(v=i?function(e){a.call(this,s(e,this.$root.$options.shadowRoot))}:function(e){a.call(this,r(e))}),v)if(c.functional){const e=c.render;c.render=function(a,l){return v.call(l),e(a,l)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,v):[v]}return l}const h={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,n,s,u,l,c,r,p,o,v,d,f])};var m=function(){var e=this,a=e.$createElement,l=e._self._c||a;return l("div",e._b({ref:"multiselect",class:e.classList.container,attrs:{tabindex:e.tabindex,id:e.searchable?void 0:e.id,dir:e.rtl?"rtl":void 0,"aria-owns":e.searchable?void 0:e.ariaOwns,"aria-placeholder":e.searchable?void 0:e.ariaPlaceholder,"aria-expanded":e.searchable?void 0:e.isOpen,"aria-activedescendant":e.searchable?void 0:e.ariaActiveDescendant,"aria-multiselectable":e.searchable?void 0:e.ariaMultiselectable,role:e.searchable?void 0:"listbox"},on:{focusin:e.handleFocusIn,focusout:e.handleFocusOut,keydown:e.handleKeydown,keyup:e.handleKeyup,mousedown:e.handleMousedown}},"div",e.searchable?{}:e.aria,!1),["tags"!==e.mode&&e.searchable&&!e.disabled?[l("input",e._b({ref:"input",class:e.classList.search,attrs:{type:e.inputType,modelValue:e.search,autocomplete:e.autocomplete,id:e.searchable?e.id:void 0,"aria-owns":e.ariaOwns,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"listbox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.aria),!1))]:e._e(),e._v(" "),"tags"==e.mode?[l("div",{class:e.classList.tags,attrs:{"data-tags":""}},[e._l(e.iv,(function(a,t,u){return e._t("tag",(function(){return[l("span",{key:u,class:e.classList.tag,attrs:{tabindex:"-1","aria-label":e.ariaTagLabel(a[e.label])},on:{keyup:function(l){return!l.type.indexOf("key")&&e._k(l.keyCode,"enter",13,l.key,"Enter")?null:e.handleTagRemove(a,l)}}},[e._v("\n "+e._s(a[e.label])+"\n "),e.disabled?e._e():l("span",{class:e.classList.tagRemove,on:{click:function(l){return e.handleTagRemove(a,l)}}},[l("span",{class:e.classList.tagRemoveIcon})])])]}),{option:a,handleTagRemove:e.handleTagRemove,disabled:e.disabled})})),e._v(" "),l("div",{ref:"tags",class:e.classList.tagsSearchWrapper},[l("span",{class:e.classList.tagsSearchCopy},[e._v(e._s(e.search))]),e._v(" "),e.searchable&&!e.disabled?l("input",e._b({ref:"input",class:e.classList.tagsSearch,attrs:{type:e.inputType,modelValue:e.search,id:e.searchable?e.id:void 0,autocomplete:e.autocomplete,"aria-owns":e.ariaOwns,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"listbox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.aria),!1)):e._e()])],2)]:e._e(),e._v(" "),"single"==e.mode&&e.hasSelected&&!e.search&&e.iv?[e._t("singlelabel",(function(){return[l("div",{class:e.classList.singleLabel,attrs:{"aria-hidden":"true"}},[l("span",{class:e.classList.singleLabelText,domProps:{innerHTML:e._s(e.iv[e.label])}})])]}),{value:e.iv})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",(function(){return[l("div",{class:e.classList.multipleLabel,attrs:{"aria-hidden":"true"},domProps:{innerHTML:e._s(e.multipleLabelText)}})]}),{values:e.iv})]:e._e(),e._v(" "),!e.placeholder||e.hasSelected||e.search?e._e():[e._t("placeholder",(function(){return[l("div",{class:e.classList.placeholder,attrs:{"aria-hidden":"true"}},[e._v("\n "+e._s(e.placeholder)+"\n ")])]}))],e._v(" "),e.loading||e.resolving?e._t("spinner",(function(){return[l("span",{class:e.classList.spinner,attrs:{"aria-hidden":"true"}})]})):e._e(),e._v(" "),e.hasSelected&&!e.disabled&&e.canClear&&!e.busy?e._t("clear",(function(){return[l("span",{class:e.classList.clear,attrs:{tabindex:"0",role:"button","aria-label":"❎"},on:{click:e.clear,keyup:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.clear.apply(null,arguments)}}},[l("span",{class:e.classList.clearIcon})])]}),{clear:e.clear}):e._e(),e._v(" "),e.caret&&e.showOptions?e._t("caret",(function(){return[l("span",{class:e.classList.caret,attrs:{"aria-hidden":"true"},on:{click:e.handleCaretClick}})]})):e._e(),e._v(" "),l("div",{class:e.classList.dropdown,attrs:{tabindex:"-1"}},[e._t("beforelist",null,{options:e.fo}),e._v(" "),l("ul",{class:e.classList.options,attrs:{id:e.ariaOwns}},[e.groups?e._l(e.fg,(function(a,t,u){return l("li",{key:u,class:e.classList.group,attrs:{id:e.ariaGroupId(a),"aria-label":e.ariaGroupLabel(a),"aria-selected":e.isSelected(a),role:"option"}},[l("div",{class:e.classList.groupLabel(a),attrs:{"data-pointed":e.isPointed(a)},on:{mouseenter:function(l){return e.setPointer(a,t)},click:function(l){return e.handleGroupClick(a)}}},[e._t("grouplabel",(function(){return[l("span",{domProps:{innerHTML:e._s(a[e.groupLabel])}})]}),{group:a,isSelected:e.isSelected,isPointed:e.isPointed})],2),e._v(" "),l("ul",{class:e.classList.groupOptions,attrs:{"aria-label":e.ariaGroupLabel(a),role:"group"}},e._l(a.__VISIBLE__,(function(t,u,n){return l("li",{key:n,class:e.classList.option(t,a),attrs:{"data-pointed":e.isPointed(t),"data-selected":e.isSelected(t)||void 0,id:e.ariaOptionId(t),"aria-selected":e.isSelected(t),"aria-label":e.ariaOptionLabel(t),role:"option"},on:{mouseenter:function(a){return e.setPointer(t)},click:function(a){return e.handleOptionClick(t)}}},[e._t("option",(function(){return[l("span",{domProps:{innerHTML:e._s(t[e.label])}})]}),{option:t,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)})),0)])})):e._l(e.fo,(function(a,t,u){return l("li",{key:u,class:e.classList.option(a),attrs:{"data-pointed":e.isPointed(a),"data-selected":e.isSelected(a)||void 0,id:e.ariaOptionId(a),"aria-selected":e.isSelected(a),"aria-label":e.ariaOptionLabel(a),role:"option"},on:{mouseenter:function(l){return e.setPointer(a)},click:function(l){return e.handleOptionClick(a)}}},[e._t("option",(function(){return[l("span",{domProps:{innerHTML:e._s(a[e.label])}})]}),{option:a,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)}))],2),e._v(" "),e.noOptions?e._t("nooptions",(function(){return[l("div",{class:e.classList.noOptions,domProps:{innerHTML:e._s(e.noOptionsText)}})]})):e._e(),e._v(" "),e.noResults?e._t("noresults",(function(){return[l("div",{class:e.classList.noResults,domProps:{innerHTML:e._s(e.noResultsText)}})]})):e._e(),e._v(" "),e.infinite&&e.hasMore?l("div",{ref:"infiniteLoader",class:e.classList.inifinite},[e._t("infinite",(function(){return[l("span",{class:e.classList.inifiniteSpinner})]}))],2):e._e(),e._v(" "),e._t("afterlist",null,{options:e.fo})],2),e._v(" "),e.required?l("input",{class:e.classList.fakeInput,attrs:{tabindex:"-1",required:""},domProps:{value:e.textValue}}):e._e(),e._v(" "),e.nativeSupport?["single"==e.mode?l("input",{attrs:{type:"hidden",name:e.name},domProps:{value:void 0!==e.plainValue?e.plainValue:""}}):e._l(e.plainValue,(function(a,t){return l("input",{key:t,attrs:{type:"hidden",name:e.name+"[]"},domProps:{value:a}})}))]:e._e(),e._v(" "),l("div",{class:e.classList.spacer})],2)};m._withStripped=!0;return g({render:m,staticRenderFns:[]},undefined,h,undefined,false,undefined,!1,void 0,void 0,void 0)}(Vue); diff --git a/dist/multiselect.vue2.js b/dist/multiselect.vue2.js index aa4e6d2..9d386d2 100644 --- a/dist/multiselect.vue2.js +++ b/dist/multiselect.vue2.js @@ -943,7 +943,7 @@ function useOptions (props, context, dep) watch(options, (n, o) => { if (typeof props.options === 'function') { - if (resolveOnLoad.value) { + if (resolveOnLoad.value && (!o || (n && n.toString() !== o.toString()))) { resolveOptions(); } } else { diff --git a/package.json b/package.json index a996795..999f078 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vueform/multiselect", - "version": "2.5.5", + "version": "2.5.6", "private": false, "description": "Vue 3 multiselect component with single select, multiselect and tagging options.", "license": "MIT",