fuse.js
Version:
Lightweight fuzzy-search
9 lines • 17 kB
JavaScript
/**
* Fuse.js v7.3.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]"===o(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 function(e){return"object"==typeof e}(e)&&null!==e}(e)&&"[object Boolean]"==o(e)}function r(e){return null!=e}function u(e){return!e.trim().length}function o(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const c=Object.prototype.hasOwnProperty;class h{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{const s=a(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 a(t){let i=null,n=null,r=null,u=1,o=null;if(s(t)||e(t))r=t,i=l(t),n=d(t);else{if(!c.call(t,"name"))throw new Error((e=>`Missing ${e} property in key`)("name"));const e=t.name;if(r=e,c.call(t,"weight")&&(u=t.weight,u<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(e));i=l(e),n=d(e),o=t.getFn}return{path:i,id:n,weight:u,src:r,getFn:o}}function l(t){return e(t)?t:t.split(".")}function d(t){return e(t)?t.join("."):t}const f={useExtendedSearch:!1,useTokenSearch:!1,getFn:function(u,o){const c=[];let h=!1;const a=(u,o,l,d)=>{if(r(u))if(o[l]){const f=u[o[l]];if(!r(f))return;if(l===o.length-1&&(s(f)||i(f)||n(f)||"bigint"==typeof f))c.push(void 0!==d?{v:t(f),i:d}:t(f));else if(e(f)){h=!0;for(let e=0,t=f.length;e<t;e+=1)a(f[e],o,l+1,e)}else o.length&&a(f,o,l+1,d)}else c.push(void 0!==d?{v:u,i:d}:u)};return a(u,s(o)?o.split("."):o,0),h?c:c[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},g=Object.freeze({isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...f}),A=/[^ ]+/g;class p{constructor({getFn:e=g.getFn,fieldNormWeight:t=g.fieldNormWeight}={}){this.norm=function(e=1,t=3){const s=new Map,i=Math.pow(10,t);return{get(t){const n=t.match(A).length;if(s.has(n))return s.get(n);const r=1/Math.pow(n,.5*e),u=parseFloat(Math.round(r*i)/i);return s.set(n,u),u},clear(){s.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,s(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();s(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t<s;t+=1)this.records[t].i-=1}removeAll(e){for(let t=e.length-1;t>=0;t-=1)this.records.splice(e[t],1);for(let e=0,t=this.records.length;e<t;e+=1)this.records[e].i=e}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!r(e)||u(e))return;const s={v:e,i:t,n:this.norm.get(e)};this.records.push(s)}_addObject(i,n){const o={i:n,$:{}};this.keys.forEach((n,c)=>{const h=n.getFn?n.getFn(i):this.getFn(i,n.path);if(r(h))if(e(h)){const e=[];for(let i=0,n=h.length;i<n;i+=1){const n=h[i];if(r(n))if(s(n)){if(!u(n)){const t={v:n,i:i,n:this.norm.get(n)};e.push(t)}}else if(r(n.v)){const i=s(n.v)?n.v:t(n.v);if(!u(i)){const t={v:i,i:n.i,n:this.norm.get(i)};e.push(t)}}}o.$[c]=e}else if(s(h)&&!u(h)){const e={v:h,n:this.norm.get(h)};o.$[c]=e}}),this.records.push(o)}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}}function C(e,t,{getFn:s=g.getFn,fieldNormWeight:i=g.fieldNormWeight}={}){const n=new p({getFn:s,fieldNormWeight:i});return n.setKeys(e.map(a)),n.setSources(t),n.create(),n}const m=32;function F(e,t,s,{location:i=g.location,distance:n=g.distance,threshold:r=g.threshold,findAllMatches:u=g.findAllMatches,minMatchCharLength:o=g.minMatchCharLength,includeMatches:c=g.includeMatches,ignoreLocation:h=g.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,A=d;const p=(e,t)=>{const s=e/a;if(h)return s;const i=Math.abs(d-t);return n?s+i/n:i?1:s},C=o>1||c,F=C?Array(l):[];let E;for(;(E=e.indexOf(t,A))>-1;){const e=p(0,E);if(f=Math.min(e,f),A=E+a,C){let e=0;for(;e<a;)F[E+e]=1,e+=1}}A=-1;let D=[],B=1,y=a+l;const _=1<<a-1;for(let t=0;t<a;t+=1){let i=0,n=y;for(;i<n;){p(t,d+n)<=f?i=n:y=n,n=Math.floor((y-i)/2+i)}y=n;let r=Math.max(1,d-n+1);const o=u?l:Math.min(d+n,l)+a,c=Array(o+2);c[o+1]=(1<<t)-1;for(let i=o;i>=r;i-=1){const n=i-1,u=s[e[n]];if(C&&(F[n]=+!!u),c[i]=(c[i+1]<<1|1)&u,t&&(c[i]|=(D[i+1]|D[i])<<1|1|D[i+1]),c[i]&_&&(B=p(t,n),B<=f)){if(f=B,A=n,A<=d)break;r=Math.max(1,2*d-A)}}if(p(t+1,d)>f)break;D=c}const v={isMatch:A>=0,score:Math.max(.001,B)};if(C){const e=function(e=[],t=g.minMatchCharLength){const s=[];let i=-1,n=-1,r=0;for(let u=e.length;r<u;r+=1){const u=e[r];u&&-1===i?i=r:u||-1===i||(n=r-1,n-i+1>=t&&s.push([i,n]),i=-1)}return e[r-1]&&r-i>=t&&s.push([i,r-1]),s}(F,o);e.length?c&&(v.indices=e):v.isMatch=!1}return v}function E(e){const t={};for(let s=0,i=e.length;s<i;s+=1){const n=e.charAt(s);t[n]=(t[n]||0)|1<<i-s-1}return t}const D={"\u0142":"l","\u0141":"L","\u0111":"d","\u0110":"D","\xf8":"o","\xd8":"O","\u0127":"h","\u0126":"H","\u0167":"t","\u0166":"T","\u0131":"i","\xdf":"ss"},B=new RegExp("["+Object.keys(D).join("")+"]","g"),y=String.prototype.normalize?e=>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,"").replace(B,e=>D[e]):e=>e;class _{constructor(e,{location:t=g.location,threshold:s=g.threshold,distance:i=g.distance,includeMatches:n=g.includeMatches,findAllMatches:r=g.findAllMatches,minMatchCharLength:u=g.minMatchCharLength,isCaseSensitive:o=g.isCaseSensitive,ignoreDiacritics:c=g.ignoreDiacritics,ignoreLocation:h=g.ignoreLocation}={}){if(this.options={location:t,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:c,ignoreLocation:h},e=o?e:e.toLowerCase(),e=c?y(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const a=(e,t)=>{this.chunks.push({pattern:e,alphabet:E(e),startIndex:t})},l=this.pattern.length;if(l>m){let e=0;const t=l%m,s=l-t;for(;e<s;)a(this.pattern.substr(e,m),e),e+=m;if(t){const e=l-m;a(this.pattern.substr(e),e)}}else a(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:s,includeMatches:i}=this.options;if(e=t?e:e.toLowerCase(),e=s?y(e):e,this.pattern===e){const t={isMatch:!0,score:0};return i&&(t.indices=[[0,e.length-1]]),t}const{location:n,distance:r,threshold:u,findAllMatches:o,minMatchCharLength:c,ignoreLocation:h}=this.options,a=[];let l=0,d=!1;this.chunks.forEach(({pattern:t,alphabet:s,startIndex:f})=>{const{isMatch:g,score:A,indices:p}=F(e,t,s,{location:n+f,distance:r,threshold:u,findAllMatches:o,minMatchCharLength:c,includeMatches:i,ignoreLocation:h});g&&(d=!0),l+=A,g&&p&&a.push(...p)});const f={isMatch:d,score:d?l/this.chunks.length:1};return d&&i&&(f.indices=function(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);const t=[e[0]];for(let s=1,i=e.length;s<i;s+=1){const i=t[t.length-1],n=e[s];n[0]<=i[1]+1?i[1]=Math.max(i[1],n[1]):t.push(n)}return t}(a)),f}}const v=[];function x(e,t){for(let s=0,i=v.length;s<i;s+=1){const i=v[s];if(i.condition(e,t))return new i(e,t)}return new _(e,t)}function M(e,{ignoreFieldNorm:t=g.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 I{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){const t=this.heap;for(;e>0;){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(n<s&&t[n].score>t[i].score&&(i=n),r<s&&t[r].score>t[i].score&&(i=r),i!==e){const s=t[e];t[e]=t[i],t[i]=s}}while(i!==e)}}function k(e,t){const s=e.matches;t.matches=[],r(s)&&s.forEach(e=>{if(!r(e.indices)||!e.indices.length)return;const{indices:s,value:i}=e,n={indices:s,value:i};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)})}function S(e,t){t.score=e.score}const w=/\b\w+\b/g;function b({isCaseSensitive:e=!1,ignoreDiacritics:t=!1}={}){return{tokenize:s=>(e||(s=s.toLowerCase()),t&&(s=y(s)),s.match(w)||[])}}function N(e,t){for(const[s,i]of e.terms){const n=i.filter(e=>e.docIdx!==t),r=i.length-n.length;r>0&&(e.fieldCount-=r,e.df.set(s,(e.df.get(s)||0)-r),0===n.length?(e.terms.delete(s),e.df.delete(s)):e.terms.set(s,n))}}class L{constructor(e,t,s){if(this.options={...g,...t},this.options.useExtendedSearch)throw new Error("Extended search is not available");if(this.options.useTokenSearch)throw new Error("Token search is not available");this._keyStore=new h(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=x(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 p))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=b({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});this._invertedIndex=function(e,t,s){const i=new Map,n=new Map;let r=0;function u(e,t,u,o){const c=s.tokenize(e);if(!c.length)return;r++;const h=new Map;for(const e of c)h.set(e,(h.get(e)||0)+1);for(const[e,s]of h){const r={docIdx:t,keyIdx:u,subIdx:o,tf:s};let c=i.get(e);c||(c=[],i.set(e,c)),c.push(r),n.set(e,(n.get(e)||0)+1)}}for(const s of e){const{i:e,v:i,$:n}=s;if(void 0===i){if(n)for(let s=0;s<t;s++){const t=n[s];if(t)if(Array.isArray(t))for(const i of t)u(i.v,e,s,i.i??-1);else u(t.v,e,s,-1)}}else u(i,e,-1,-1)}return{terms:i,fieldCount:r,df:n}}(this._myIndex.records,this._myIndex.keys.length,e)}}add(e){if(r(e)&&(this._docs.push(e),this._myIndex.add(e),this._invertedIndex)){const e=this._myIndex.records[this._myIndex.records.length-1],t=b({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});!function(e,t,s,i){const{i:n,v:r,$:u}=t;function o(t,s,r){const u=i.tokenize(t);if(!u.length)return;e.fieldCount++;const o=new Map;for(const e of u)o.set(e,(o.get(e)||0)+1);for(const[t,i]of o){const u={docIdx:n,keyIdx:s,subIdx:r,tf:i};let o=e.terms.get(t);o||(o=[],e.terms.set(t,o)),o.push(u),e.df.set(t,(e.df.get(t)||0)+1)}}if(void 0===r){if(u)for(let e=0;e<s;e++){const t=u[e];if(t)if(Array.isArray(t))for(const s of t)o(s.v,e,s.i??-1);else o(t.v,e,-1)}}else o(r,-1,-1)}(this._invertedIndex,e,this._myIndex.keys.length,t)}}remove(e=()=>!1){const t=[],s=[];for(let i=0,n=this._docs.length;i<n;i+=1)e(this._docs[i],i)&&(t.push(this._docs[i]),s.push(i));if(s.length){if(this._invertedIndex)for(const e of s)N(this._invertedIndex,e);for(let e=s.length-1;e>=0;e-=1)this._docs.splice(s[e],1);this._myIndex.removeAll(s)}return t}removeAt(e){this._invertedIndex&&N(this._invertedIndex,e);const t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),t}getIndex(){return this._myIndex}search(e,t){const{limit:n=-1}=t||{},{includeMatches:r,includeScore:u,shouldSort:o,sortFn:c,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 I(n);s(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:h}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:h}),a=t.extractSorted(c)}else a=s(e)?s(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),function(e,{ignoreFieldNorm:t=g.ignoreFieldNorm}){e.forEach(e=>{e.score=M(e.matches,{ignoreFieldNorm:t})})}(a,{ignoreFieldNorm:h}),o&&a.sort(c),i(n)&&n>-1&&(a=a.slice(0,n));return function(e,t,{includeMatches:s=g.includeMatches,includeScore:i=g.includeScore}={}){const n=[];return s&&n.push(k),i&&n.push(S),e.map(e=>{const{idx:s}=e,i={item:t[s],refIndex:s};return n.length&&n.forEach(t=>{t(e,i)}),i})}(a,this._docs,{includeMatches:r,includeScore:u})}_searchStringList(e,{heap:t,ignoreFieldNorm:s}={}){const i=this._getSearcher(e),{records:n}=this._myIndex,u=t?null:[];return n.forEach(({v:e,i:n,n:o})=>{if(!r(e))return;const{isMatch:c,score:h,indices:a}=i.searchIn(e);if(c){const i={item:e,idx:n,matches:[{score:h,value:e,norm:o,indices:a}]};t?(i.score=M(i.matches,{ignoreFieldNorm:s}),t.shouldInsert(i.score)&&t.insert(i)):u.push(i)}}),u}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e,{heap:t,ignoreFieldNorm:s}={}){const i=this._getSearcher(e),{keys:n,records:u}=this._myIndex,o=t?null:[];return u.forEach(({$:e,i:u})=>{if(!r(e))return;const c=[];let h=!1,a=!1;if(n.forEach((t,s)=>{const n=this._findMatches({key:t,value:e[s],searcher:i});n.length?(c.push(...n),n[0].hasInverse&&(a=!0)):h=!0}),(!a||!h)&&c.length){const i={idx:u,item:e,matches:c};t?(i.score=M(i.matches,{ignoreFieldNorm:s}),t.shouldInsert(i.score)&&t.insert(i)):o.push(i)}}),o}_findMatches({key:t,value:s,searcher:i}){if(!r(s))return[];const n=[];if(e(s))s.forEach(({v:e,i:s,n:u})=>{if(!r(e))return;const{isMatch:o,score:c,indices:h,hasInverse:a}=i.searchIn(e);o&&n.push({score:c,key:t,value:e,idx:s,norm:u,indices:h,hasInverse:a})});else{const{v:e,n:r}=s,{isMatch:u,score:o,indices:c,hasInverse:h}=i.searchIn(e);u&&n.push({score:o,key:t,value:e,norm:r,indices:c,hasInverse:h})}return n}}L.version="7.3.0",L.createIndex=C,L.parseIndex=function(e,{getFn:t=g.getFn,fieldNormWeight:s=g.fieldNormWeight}={}){const{keys:i,records:n}=e,r=new p({getFn:t,fieldNormWeight:s});return r.setKeys(i),r.setIndexRecords(n),r},L.config=g,L.match=function(e,t,s){return x(e,{...g,...s}).searchIn(t)},L.use=function(...e){e.forEach(e=>function(...e){v.push(...e)}(e))};export{L as default};