e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e,T=class{constructor(t,{location:s=l.location,threshold:n=l.threshold,distance:i=l.distance,includeMatches:r=l.includeMatches,findAllMatches:c=l.findAllMatches,minMatchCharLength:o=l.minMatchCharLength,isCaseSensitive:h=l.isCaseSensitive,ignoreDiacritics:u=l.ignoreDiacritics,ignoreLocation:a=l.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:i,includeMatches:r,findAllMatches:c,minMatchCharLength:o,isCaseSensitive:h,ignoreDiacritics:u,ignoreLocation:a},t=h?t:t.toLowerCase(),t=u?$(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;let d=(g,A)=>{this.chunks.push({pattern:g,alphabet:vt(g),startIndex:A})},f=this.pattern.length;if(f>L){let g=0,A=f%L,p=f-A;for(;g{let{isMatch:M,score:b,indices:x}=Tt(t,p,m,{location:r+_,distance:c,threshold:o,findAllMatches:h,minMatchCharLength:u,includeMatches:i,ignoreLocation:a});M&&(g=!0),f+=b,M&&x&&(d=[...d,...x])});let A={isMatch:g,score:g?f/this.chunks.length:1};return g&&i&&(A.indices=d),A}},B=class{constructor(t){this.pattern=t}static isMultiMatch(t){return ot(t,this.multiRegex)}static isSingleMatch(t){return ot(t,this.singleRegex)}search(){}};function ot(e,t){let s=e.match(t);return s?s[1]:null}var z=class extends B{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){let s=t===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Y=class extends B{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){let n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}},G=class extends B{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){let s=t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Q=class extends B{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){let s=!t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}},X=class extends B{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){let s=t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},J=class extends B{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){let s=!t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}},v=class extends B{constructor(t,{location:s=l.location,threshold:n=l.threshold,distance:i=l.distance,includeMatches:r=l.includeMatches,findAllMatches:c=l.findAllMatches,minMatchCharLength:o=l.minMatchCharLength,isCaseSensitive:h=l.isCaseSensitive,ignoreDiacritics:u=l.ignoreDiacritics,ignoreLocation:a=l.ignoreLocation}={}){super(t),this._bitapSearch=new T(t,{location:s,threshold:n,distance:i,includeMatches:r,findAllMatches:c,minMatchCharLength:o,isCaseSensitive:h,ignoreDiacritics:u,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}},P=class extends B{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let s=0,n,i=[],r=this.pattern.length;for(;(n=t.indexOf(this.pattern,s))>-1;)s=n+r,i.push([n,s-1]);let c=!!i.length;return{isMatch:c,score:c?0:1,indices:i}}},Z=[z,P,G,Q,J,X,Y,v],ht=Z.length,Pt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,jt="|";function Kt(e,t={}){return e.split(jt).map(s=>{let n=s.trim().split(Pt).filter(r=>r&&!!r.trim()),i=[];for(let r=0,c=n.length;r!!(e[j.AND]||e[j.OR]),Ht=e=>!!e[st.PATH],Ut=e=>!I(e)&&dt(e)&&!nt(e),at=e=>({[j.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function pt(e,t,{auto:s=!0}={}){let n=i=>{let r=Object.keys(i),c=Ht(i);if(!c&&r.length>1&&!nt(i))return n(at(i));if(Ut(i)){let h=c?i[st.PATH]:r[0],u=c?i[st.PATTERN]:i[h];if(!F(u))throw new Error(It(h));let a={keyId:U(h),pattern:u};return s&&(a.searcher=et(u,t)),a}let o={children:[],operator:r[0]};return r.forEach(h=>{let u=i[h];I(u)&&u.forEach(a=>{o.children.push(n(a))})}),o};return nt(e)||(e=at(e)),n(e)}function zt(e,{ignoreFieldNorm:t=l.ignoreFieldNorm}){e.forEach(s=>{let n=1;s.matches.forEach(({key:i,norm:r,score:c})=>{let o=i?i.weight:null;n*=Math.pow(c===0&&o?Number.EPSILON:c,(o||1)*(t?1:r))}),s.score=n})}function Yt(e,t){let s=e.matches;t.matches=[],C(s)&&s.forEach(n=>{if(!C(n.indices)||!n.indices.length)return;let{indices:i,value:r}=n,c={indices:i,value:r};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),t.matches.push(c)})}function Gt(e,t){t.score=e.score}function Qt(e,t,{includeMatches:s=l.includeMatches,includeScore:n=l.includeScore}={}){let i=[];return s&&i.push(Yt),n&&i.push(Gt),e.map(r=>{let{idx:c}=r,o={item:t[c],refIndex:c};return i.length&&i.forEach(h=>{h(r,o)}),o})}var y=class{constructor(t,s={},n){this.options={...l,...s},this.options.useExtendedSearch,this._keyStore=new H(this.options.keys),this.setCollection(t,n)}setCollection(t,s){if(this._docs=t,s&&!(s instanceof O))throw new Error(Mt);this._myIndex=s||At(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){C(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){let s=[];for(let n=0,i=this._docs.length;n-1&&(h=h.slice(0,s)),Qt(h,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){let s=et(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:r,i:c,n:o})=>{if(!C(r))return;let{isMatch:h,score:u,indices:a}=s.searchIn(r);h&&i.push({item:r,idx:c,matches:[{score:u,value:r,norm:o,indices:a}]})}),i}_searchLogical(t){let s=pt(t,this.options),n=(o,h,u)=>{if(!o.children){let{keyId:d,searcher:f}=o,g=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(h,d),searcher:f});return g&&g.length?[{idx:u,item:h,matches:g}]:[]}let a=[];for(let d=0,f=o.children.length;d{if(C(o)){let u=n(s,o,h);u.length&&(r[h]||(r[h]={idx:h,item:o,matches:[]},c.push(r[h])),u.forEach(({matches:a})=>{r[h].matches.push(...a)}))}}),c}_searchObjectList(t){let s=et(t,this.options),{keys:n,records:i}=this._myIndex,r=[];return i.forEach(({$:c,i:o})=>{if(!C(c))return;let h=[];n.forEach((u,a)=>{h.push(...this._findMatches({key:u,value:c[a],searcher:s}))}),h.length&&r.push({idx:o,item:c,matches:h})}),r}_findMatches({key:t,value:s,searcher:n}){if(!C(s))return[];let i=[];if(I(s))s.forEach(({v:r,i:c,n:o})=>{if(!C(r))return;let{isMatch:h,score:u,indices:a}=n.searchIn(r);h&&i.push({score:u,key:t,value:r,idx:c,norm:o,indices:a})});else{let{v:r,n:c}=s,{isMatch:o,score:h,indices:u}=n.searchIn(r);o&&i.push({score:h,key:t,value:r,norm:c,indices:u})}return i}};y.version="7.1.0";y.createIndex=At;y.parseIndex=Nt;y.config=l;y.parseQuery=pt;Vt(q);function Xt({key:e,state:t,displayName:s,isDropdown:n,shouldCloseOnSelect:i,getSetUsing:r,getIconsUsing:c,getIconSvgUsing:o,verifyStateUsing:h}){return{state:t,displayName:s,isDropdown:n,shouldCloseOnSelect:i,dropdownOpen:!1,set:null,icons:[],search:"",fuse:null,results:[],resultsVisible:[],minimumItems:300,resultsPerPage:50,resultsIndex:0,isLoading:!1,async init(){await h(this.state).then(u=>this.state=u),await this.loadIcons(),this.$wire.on(`custom-icon-uploaded::${e}`,u=>{this.displayName=u.label,this.set=u.set,this.afterSetUpdated()})},deferLoadingState(){return setTimeout(()=>this.isLoading=!0,150)},async loadIcons(){return this.isLoading=!0,await c(this.set).then(u=>{this.icons=u,this.createFuseObject(),this.resetSearchResults(),this.isLoading=!1})},async loadSet(){return this.isLoading=!0,await r(this.state).then(u=>{this.set=u,this.isLoading=!1})},afterStateUpdated(){},afterSetUpdated(){this.loadIcons()},async updateSelectedIcon(u=!0){this.icons.find(d=>d.id===this.state)||u&&(await this.loadSet(),await this.loadIcons(),await this.updateSelectedIcon(!1))},setElementIcon(u,a,d=null){o(a).then(f=>u.innerHTML=f).finally(d)},createFuseObject(){let u={includeScore:!0,keys:["id"]};this.fuse=new y(this.icons,u)},resetSearchResults(){this.resultsPerPage=20,this.resultsIndex=0,this.results=this.icons,this.resultsVisible=[],this.addSearchResultsChunk()},setSelect:{async"x-on:change"(u){let a=u.target.value;this.set=a||null,this.afterSetUpdated()}},searchInput:{"x-on:input.debounce"(u){let a=u.target.value,d=this.deferLoadingState();a.length?(this.resultsVisible=[],this.resultsIndex=0,this.results=this.fuse.search(a).map(f=>f.item),this.addSearchResultsChunk()):this.resetSearchResults(),clearTimeout(d),this.isLoading=!1}},dropdownTrigger:{"x-on:click.prevent"(){this.dropdownOpen=!0}},dropdownMenu:{"x-show"(){return!this.isDropdown||this.dropdownOpen},"x-on:click.outside"(){this.dropdownOpen=!1}},addSearchResultsChunk(){let u=this.resultsIndex+this.resultsPerPage;uthis.dropdownOpen=!1)):(this.state=null,this.displayName=null)}}}export{Xt as default};
2 |
--------------------------------------------------------------------------------