/** * Fuse.js v7.4.0 - Lightweight fuzzy-search (http://fusejs.io) * * Copyright (c) 2026 Kiro Risk (http://kiro.me) * All Rights Reserved. Apache Software License 2.0 * * http://www.apache.org/licenses/LICENSE-2.0 */ function e(e){return Array.isArray?Array.isArray(e):"[object Array]"===u(e)}function t(e){return null==e?"":function(e){if("string"==typeof e)return e;if("bigint"==typeof e)return e.toString();const t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}function s(e){return"string"==typeof e}function i(e){return"number"==typeof e}function n(e){return!0===e||!1===e||function(e){return r(e)&&null!==e}(e)&&"[object Boolean]"==u(e)}function r(e){return"object"==typeof e}function o(e){return null!=e}function c(e){return!e.trim().length}function u(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const h="Invalid doc index: must be a non-negative integer within the bounds of the docs array",a=Object.prototype.hasOwnProperty;class l{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{const s=d(e);this._keys.push(s),this._keyMap[s.id]=s,t+=s.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function d(t){let i=null,n=null,r=null,o=1,c=null;if(s(t)||e(t))r=t,i=f(t),n=g(t);else{if(!a.call(t,"name"))throw new Error((e=>`Missing ${e} property in key`)("name"));const e=t.name;if(r=e,a.call(t,"weight")&&void 0!==t.weight&&(o=t.weight,o<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(g(e)));i=f(e),n=g(e),c=t.getFn??null}return{path:i,id:n,weight:o,src:r,getFn:c}}function f(t){return e(t)?t:t.split(".")}function g(t){return e(t)?t.join("."):t}const m={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:function(r,c){const u=[];let h=!1;const a=(r,c,l,d)=>{if(o(r))if(c[l]){const f=r[c[l]];if(!o(f))return;if(l===c.length-1&&(s(f)||i(f)||n(f)||"bigint"==typeof f))u.push(void 0!==d?{v:t(f),i:d}:t(f));else if(e(f)){h=!0;for(let e=0,t=f.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const e=this.docs.length;this.records=new Array(e);let t=0;if(s(this.docs[0]))for(let s=0;se&&(this.records[t].i-=1)}removeAll(e){const t=new Set;for(const s of e)Number.isInteger(s)&&s>=0&&t.add(s);if(0===t.size)return;this.records=this.records.filter(e=>!t.has(e.i));const s=Array.from(t).sort((e,t)=>e-t);for(const e of this.records){let t=0,i=s.length;for(;t>>1;s[n]t),records:this.records}}}function C(e,t,{getFn:s=p.getFn,fieldNormWeight:i=p.fieldNormWeight}={}){const n=new A({getFn:s,fieldNormWeight:i});return n.setKeys(e.map(d)),n.setSources(t),n.create(),n}const M=32;function y(e,t,s,{location:i=p.location,distance:n=p.distance,threshold:r=p.threshold,findAllMatches:o=p.findAllMatches,minMatchCharLength:c=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:h=p.ignoreLocation}={}){if(t.length>M)throw new Error(`Pattern length exceeds max of ${M}.`);const a=t.length,l=e.length,d=Math.max(0,Math.min(i,l));let f=r,g=d;const m=(e,t)=>{const s=e/a;if(h)return s;const i=Math.abs(d-t);return n?s+i/n:i?1:s},A=c>1||u,C=A?Array(l):[];let y;for(;(y=e.indexOf(t,g))>-1;){const e=m(0,y);if(f=Math.min(e,f),g=y+a,A){let e=0;for(;e=r;i-=1){const n=i-1,o=s[e[n]];if(u[i]=(u[i+1]<<1|1)&o,t&&(u[i]|=(F[i+1]|F[i])<<1|1|F[i+1]),u[i]&D&&(x=m(t,n),x<=f)){if(f=x,g=n,v=t,g<=d)break;r=Math.max(1,2*d-g)}}if(m(t+1,d)>f)break;F=u}if(A&&g>=0){const t=Math.min(l-1,g+a-1+v);for(let i=g;i<=t;i+=1)s[e[i]]&&(C[i]=1)}const _={isMatch:g>=0,score:Math.max(.001,x)};if(A){const e=function(e=[],t=p.minMatchCharLength){const s=[];let i=-1,n=-1,r=0;for(let o=e.length;r=t&&s.push([i,n]),i=-1)}return e[r-1]&&r-i>=t&&s.push([i,r-1]),s}(C,c);e.length?u&&(_.indices=e):_.isMatch=!1}return _}function F(e){const t={};for(let s=0,i=e.length;se[0]-t[0]||e[1]-t[1]);const t=[e[0]];for(let s=1,i=e.length;se.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,"").replace(k,e=>v[e]):e=>e;class _{constructor(e,{location:t=p.location,threshold:s=p.threshold,distance:i=p.distance,includeMatches:n=p.includeMatches,findAllMatches:r=p.findAllMatches,minMatchCharLength:o=p.minMatchCharLength,isCaseSensitive:c=p.isCaseSensitive,ignoreDiacritics:u=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){if(this.options={location:t,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:o,isCaseSensitive:c,ignoreDiacritics:u,ignoreLocation:h},e=c?e:e.toLowerCase(),e=u?D(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const a=(e,t)=>{this.chunks.push({pattern:e,alphabet:F(e),startIndex:t})},l=this.pattern.length;if(l>M){let e=0;const t=l%M,s=l-t;for(;e{const{isMatch:g,score:m,indices:p}=y(e,t,s,{location:n+f,distance:r,threshold:o,findAllMatches:c,minMatchCharLength:u,includeMatches:i,ignoreLocation:h});g&&(d=!0),l+=m,g&&p&&a.push(...p)});const f={isMatch:d,score:d?l/this.chunks.length:1};return d&&i&&(f.indices=x(a)),f}}const E=new Set(["fuzzy","include"]);function B(e){return e.startsWith("inverse")}const S=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:"exact",search(t){const s=t===e;return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:"include",search(t){let s,i=0;const n=[],r=e.length;for(;(s=t.indexOf(e,i))>-1;)i=s+r,n.push([s,i-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:"prefix-exact",search(t){const s=t.startsWith(e);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:"inverse-prefix-exact",search(t){const s=!t.startsWith(e);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:"inverse-suffix-exact",search(t){const s=!t.endsWith(e);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:"suffix-exact",search(t){const s=t.endsWith(e);return{isMatch:s,score:s?0:1,indices:[t.length-e.length,t.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:"inverse-exact",search(t){const s=-1===t.indexOf(e);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{const s=new _(e,{location:t.location??p.location,threshold:t.threshold??p.threshold,distance:t.distance??p.distance,includeMatches:t.includeMatches??p.includeMatches,findAllMatches:t.findAllMatches??p.findAllMatches,minMatchCharLength:t.minMatchCharLength??p.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??p.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??p.ignoreDiacritics,ignoreLocation:t.ignoreLocation??p.ignoreLocation});return{type:"fuzzy",search:e=>s.searchIn(e)}}}],I=S.length;function w(e,t){const s=e.match(t);return s?s[1]:null}class b{constructor(e,{isCaseSensitive:t=p.isCaseSensitive,ignoreDiacritics:s=p.ignoreDiacritics,includeMatches:i=p.includeMatches,minMatchCharLength:n=p.minMatchCharLength,ignoreLocation:r=p.ignoreLocation,findAllMatches:o=p.findAllMatches,location:c=p.location,threshold:u=p.threshold,distance:h=p.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:s,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:r,location:c,threshold:u,distance:h},e=t?e:e.toLowerCase(),e=s?D(e):e,this.pattern=e,this.query=function(e,t={}){return e.replace(/\\\|/g,"\0").split("|").map(e=>{const s=function(e){const t=[],s=e.length;let i=0;for(;i=s)break;let n=i;for(;n=s||" "===e[t]){n++;break}if("$"===e[t]&&(t+1>=s||" "===e[t+1])){n+=2;break}}n++}t.push(e.substring(i,n)),i=n}else{for(;ne&&!!e.trim()),i=[];for(let e=0,n=s.length;e!(!e[z]&&!e[R]),W=e=>({[z]:Object.keys(e).map(t=>({[t]:e[t]}))});function H(t,i,{auto:n=!0}={}){const o=t=>{if(s(t)){const e={keyId:null,pattern:t};return n&&(e.searcher=N(t,i)),e}const c=Object.keys(t),u=(e=>!!e[T])(t);if(!u&&c.length>1&&!j(t))return o(W(t));if((t=>!e(t)&&r(t)&&!j(t))(t)){const e=u?t[T]:c[0],r=u?t[O]:t[e];if(!s(r))throw new Error((e=>`Invalid value for key ${e}`)(e));const o={keyId:g(e),pattern:r};return n&&(o.searcher=N(r,i)),o}const h={children:[],operator:c[0]};return c.forEach(s=>{const i=t[s];e(i)&&i.forEach(e=>{h.children.push(o(e))})}),h};return j(t)||(t=W(t)),o(t)}function K(e,{ignoreFieldNorm:t=p.ignoreFieldNorm}){let s=1;return e.forEach(({key:e,norm:i,score:n})=>{const r=e?e.weight:null;s*=Math.pow(0===n&&r?Number.EPSILON:n,(r||1)*(t?1:i))}),s}class P{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size0;){const s=e-1>>1;if(t[e].score<=t[s].score)break;const i=t[e];t[e]=t[s],t[s]=i,e=s}}_sinkDown(e){const t=this.heap,s=t.length;let i=e;do{const n=2*(e=i)+1,r=2*e+2;if(nt[i].score&&(i=n),rt[i].score&&(i=r),i!==e){const s=t[e];t[e]=t[i],t[i]=s}}while(i!==e)}}function Q(e,t,{includeMatches:s=p.includeMatches,includeScore:i=p.includeScore}={}){return e.map(e=>{const{idx:n}=e,r={item:t[n],refIndex:n};return s&&(r.matches=function(e){const t=[];return e.matches.forEach(e=>{if(!o(e.indices)||!e.indices.length)return;const s={indices:e.indices,value:e.value};e.key&&(s.key=e.key.id),e.idx>-1&&(s.refIndex=e.idx),t.push(s)}),t}(e)),i&&(r.score=e.score),r})}const q=/[\p{L}\p{M}\p{N}_]+/gu;function J({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:s}={}){const i=function(e){return"function"==typeof e?t=>e(t):e instanceof RegExp?(e.global,t=>t.match(e)||[]):e=>e.match(q)||[]}(s);return{tokenize:s=>(e||(s=s.toLowerCase()),t&&(s=D(s)),i(s))}}class U{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=J({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});const s=this.analyzer.tokenize(e),i=t._invertedIndex,{df:n,fieldCount:r}=i;this.termSearchers=[],this.idfWeights=[];for(const e of s){this.termSearchers.push(new _(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));const s=n.get(e)||0,i=Math.log(1+(r-s+.5)/(s+.5));this.idfWeights.push(i)}this.combineAll="all"===t.tokenMatch,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};const t=[];let s=0,i=0,n=0,r=0;const o=this.combineAll&&!this.useMask?new Set:null;for(let c=0;c0?1-s/i:0,u={isMatch:!0,score:Math.max(.001,c)};return this.options.includeMatches&&t.length&&(u.indices=x(t)),this.combineAll&&(this.useMask?u.matchedMask=r:u.matchedTerms=o,u.termCount=this.numTerms),u}}function V(e,t,s,i){const n=i.tokenize(t);if(!n.length)return;e.fieldCount++,e.docFieldCount.set(s,(e.docFieldCount.get(s)||0)+1);const r=new Set(n);let o=e.docTermFieldHits.get(s);o||(o=new Map,e.docTermFieldHits.set(s,o));for(const t of r)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function G(e,t,s,i){const{i:n,v:r,$:o}=t;if(void 0===r){if(o)for(let t=0;te-t);for(const t of s)X(e,t);const i=e=>{let t=0,i=s.length;for(;t>>1;s[n]n?i(t):t,s);e.docFieldCount=r;const o=new Map;for(const[t,s]of e.docTermFieldHits)o.set(t>n?i(t):t,s);e.docTermFieldHits=o}class Z{constructor(e,t,s){this.options={...p,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new l(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,s),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;const t=N(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof A))throw new Error("Incorrect 'index' type");if(this._myIndex=t||C(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=function(e,t,s){const i={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const n of e)G(i,n,t,s);return i}(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!o(e))return;this._docs.push(e);const t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){const e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});!function(e,t,s,i){G(e,t,s,i)}(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){const t=[],s=[];for(let i=0,n=this._docs.length;i!e.has(s)),this._myIndex.removeAll(s),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw new Error(h);this._invertedIndex&&Y(this._invertedIndex,[e]);const t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){const{limit:n=-1}=t||{},{includeMatches:r,includeScore:o,shouldSort:c,sortFn:u,ignoreFieldNorm:h}=this.options;if(s(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return i(n)&&n>-1&&(e=e.slice(0,n)),e}let a;if(i(n)&&n>0&&s(e)){const t=new P(n);s(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:h}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:h}),a=t.extractSorted(u)}else a=s(e)?s(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),function(e,{ignoreFieldNorm:t=p.ignoreFieldNorm}){e.forEach(e=>{e.score=K(e.matches,{ignoreFieldNorm:t})})}(a,{ignoreFieldNorm:h}),c&&a.sort(u),i(n)&&n>-1&&(a=a.slice(0,n));return Q(a,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e,{heap:t,ignoreFieldNorm:s}={}){const i=this._getSearcher(e),n=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:r}=this._myIndex,c=t?null:[];return r.forEach(({v:e,i:r,n:u})=>{if(!o(e))return;const h=i.searchIn(e);if(h.isMatch){const i={score:h.score,value:e,norm:u,indices:h.indices};n&&(i.matchedMask=h.matchedMask,i.matchedTerms=h.matchedTerms,i.termCount=h.termCount);const o=[i];if(!n||this._coversAllTokens(o)){const i={item:e,idx:r,matches:o};t?(i.score=K(i.matches,{ignoreFieldNorm:s}),t.shouldInsert(i.score)&&t.insert(i)):c.push(i)}}}),c}_searchLogical(e){const t=H(e,this.options),s=(e,t,i)=>{if(!("children"in e)){const{keyId:s,searcher:n}=e;let r;return null===s?(r=[],this._myIndex.keys.forEach((e,s)=>{r.push(...this._findMatches({key:e,value:t[s],searcher:n}))})):r=this._findMatches({key:this._keyStore.get(s),value:this._myIndex.getValueForItemAtKeyId(t,s),searcher:n}),r&&r.length?[{idx:i,item:t,matches:r}]:[]}const{children:n,operator:r}=e,o=[];for(let e=0,c=n.length;e{if(o(e)){const o=s(t,e,i);o.length&&(n.has(i)||(n.set(i,{idx:i,item:e,matches:[]}),r.push(n.get(i))),o.forEach(({matches:e})=>{n.get(i).matches.push(...e)}))}}),r}_searchObjectList(e,{heap:t,ignoreFieldNorm:s}={}){const i=this._getSearcher(e),n=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{keys:r,records:c}=this._myIndex,u=t?null:[];return c.forEach(({$:e,i:c})=>{if(!o(e))return;const h=[];let a=!1,l=!1;if(r.forEach((t,s)=>{const n=this._findMatches({key:t,value:e[s],searcher:i});n.length?(h.push(...n),n[0].hasInverse&&(l=!0)):a=!0}),(!l||!a)&&h.length&&(!n||this._coversAllTokens(h))){const i={idx:c,item:e,matches:h};t?(i.score=K(i.matches,{ignoreFieldNorm:s}),t.shouldInsert(i.score)&&t.insert(i)):u.push(i)}}),u}_findMatches({key:t,value:s,searcher:i}){if(!o(s))return[];const n=[];if(e(s))s.forEach(({v:e,i:s,n:r})=>{if(!o(e))return;const c=i.searchIn(e);if(c.isMatch){const i={score:c.score,key:t,value:e,idx:s,norm:r,indices:c.indices,hasInverse:c.hasInverse};void 0!==c.termCount&&(i.matchedMask=c.matchedMask,i.matchedTerms=c.matchedTerms,i.termCount=c.termCount),n.push(i)}});else{const{v:e,n:r}=s,o=i.searchIn(e);if(o.isMatch){const s={score:o.score,key:t,value:e,norm:r,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(s.matchedMask=o.matchedMask,s.matchedTerms=o.matchedTerms,s.termCount=o.termCount),n.push(s)}}return n}_coversAllTokens(e){const t=e.length?e[0].termCount:void 0;if(void 0===t)return!0;if(t<=31){let s=0;for(let t=0;t{const{id:t,method:s,args:i}=e.data;try{let e;switch(s){case"init":{const[t,s]=i;ee=new Z(t,s),e=!0;break}case"search":e=ee.search(i[0],i[1]);break;case"add":ee.add(i[0]),e=!0;break;case"setCollection":ee.setCollection(i[0]),e=!0}self.postMessage({id:t,result:e})}catch(e){self.postMessage({id:t,error:e.message})}};