Comparing version 6.0.2 to 6.0.3
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -833,2 +833,4 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
function BitapSearch(pattern) { | ||
var _this = this; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
@@ -863,24 +865,29 @@ _ref$location = _ref.location, | ||
this.chunks = []; | ||
var i = 0; | ||
var addChunk = function addChunk(pattern, startIndex) { | ||
_this.chunks.push({ | ||
pattern: pattern, | ||
alphabet: createPatternAlphabet(pattern), | ||
startIndex: startIndex | ||
}); | ||
}; | ||
var len = this.pattern.length; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
while (i < end) { | ||
var _pattern = this.pattern.substr(i, MAX_BITS); | ||
if (len > MAX_BITS) { | ||
var i = 0; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
this.chunks.push({ | ||
pattern: _pattern, | ||
alphabet: createPatternAlphabet(_pattern) | ||
}); | ||
i += MAX_BITS; | ||
} | ||
while (i < end) { | ||
addChunk(this.pattern.substr(i, MAX_BITS), i); | ||
i += MAX_BITS; | ||
} | ||
if (remainder) { | ||
var _pattern2 = this.pattern.substr(len - MAX_BITS); | ||
this.chunks.push({ | ||
pattern: _pattern2, | ||
alphabet: createPatternAlphabet(_pattern2) | ||
}); | ||
if (remainder) { | ||
var startIndex = len - MAX_BITS; | ||
addChunk(this.pattern.substr(startIndex), startIndex); | ||
} | ||
} else { | ||
addChunk(this.pattern, 0); | ||
} | ||
@@ -924,8 +931,9 @@ } | ||
var hasMatches = false; | ||
this.chunks.forEach(function (_ref2, i) { | ||
this.chunks.forEach(function (_ref2) { | ||
var pattern = _ref2.pattern, | ||
alphabet = _ref2.alphabet; | ||
alphabet = _ref2.alphabet, | ||
startIndex = _ref2.startIndex; | ||
var _search = search(text, pattern, alphabet, { | ||
location: location + MAX_BITS * i, | ||
location: location + startIndex, | ||
distance: distance, | ||
@@ -1328,3 +1336,3 @@ threshold: threshold, | ||
Fuse.version = '6.0.2'; | ||
Fuse.version = '6.0.3'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1331,0 +1339,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -701,22 +701,28 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
let i = 0; | ||
const len = this.pattern.length; | ||
const remainder = len % MAX_BITS; | ||
const end = len - remainder; | ||
while (i < end) { | ||
const pattern = this.pattern.substr(i, MAX_BITS); | ||
const addChunk = (pattern, startIndex) => { | ||
this.chunks.push({ | ||
pattern, | ||
alphabet: createPatternAlphabet(pattern) | ||
alphabet: createPatternAlphabet(pattern), | ||
startIndex | ||
}); | ||
i += MAX_BITS; | ||
} | ||
}; | ||
if (remainder) { | ||
const pattern = this.pattern.substr(len - MAX_BITS); | ||
this.chunks.push({ | ||
pattern, | ||
alphabet: createPatternAlphabet(pattern) | ||
}); | ||
const len = this.pattern.length; | ||
if (len > MAX_BITS) { | ||
let i = 0; | ||
const remainder = len % MAX_BITS; | ||
const end = len - remainder; | ||
while (i < end) { | ||
addChunk(this.pattern.substr(i, MAX_BITS), i); | ||
i += MAX_BITS; | ||
} | ||
if (remainder) { | ||
const startIndex = len - MAX_BITS; | ||
addChunk(this.pattern.substr(startIndex), startIndex); | ||
} | ||
} else { | ||
addChunk(this.pattern, 0); | ||
} | ||
@@ -759,5 +765,5 @@ } | ||
this.chunks.forEach(({ pattern, alphabet }, i) => { | ||
this.chunks.forEach(({ pattern, alphabet, startIndex }) => { | ||
const { isMatch, score, indices } = search(text, pattern, alphabet, { | ||
location: location + MAX_BITS * i, | ||
location: location + startIndex, | ||
distance, | ||
@@ -1108,3 +1114,3 @@ threshold, | ||
Fuse.version = '6.0.2'; | ||
Fuse.version = '6.0.3'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1111,0 +1117,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -9,2 +9,2 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
*/ | ||
function e(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function t(e){return"string"==typeof e}function s(e){return"number"==typeof e}function n(e){return null!=e}function i(e){return!e.trim().length}const r=Object.prototype.hasOwnProperty;class c{constructor(e){this._keys={},this._keyNames=[];let s=0;e.forEach(e=>{let n,i=1;if(t(e))n=e;else{if(!r.call(e,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=e.name,r.call(e,"weight")&&(i=e.weight,i<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:i},s+=i}),this._keyNames.forEach(e=>{this._keys[e].weight/=s})}get(e,t){return this._keys[e]&&this._keys[e][t]}keys(){return this._keyNames}toJSON(){return JSON.stringify(this._keys)}}var o={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(i,r){let c=[],o=!1;const h=(i,r)=>{if(r){const a=r.indexOf(".");let l=r,d=null;-1!==a&&(l=r.slice(0,a),d=r.slice(a+1));const u=i[l];if(!n(u))return;if(d||!t(u)&&!s(u))if(e(u)){o=!0;for(let e=0,t=u.length;e<t;e+=1)h(u[e],d)}else d&&h(u,d);else c.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(u))}else c.push(i)};return h(i,r),o?c:c[0]}}};const h=/[^ ]+/g;class a{constructor({getFn:e=o.getFn}={}){this.norm=function(e=3){const t=new Map;return{get(s){const n=s.match(h).length;if(t.has(n))return t.get(n);const i=parseFloat((1/Math.sqrt(n)).toFixed(e));return t.set(n,i),i},clear(){t.clear()}}}(3),this.getFn=e,this.isCreated=!1,this.setRecords()}setCollection(e=[]){this.docs=e}setRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,t(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 s=this.size();t(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t<s;t+=1)this.records[t].i-=1}size(){return this.records.length}_addString(e,t){if(!n(e)||i(e))return;let s={v:e,i:t,n:this.norm.get(e)};this.records.push(s)}_addObject(s,r){let c={i:r,$:{}};this.keys.forEach((r,o)=>{let h=this.getFn(s,r);if(n(h))if(e(h)){let s=[];const r=[{nestedArrIndex:-1,value:h}];for(;r.length;){const{nestedArrIndex:c,value:o}=r.pop();if(n(o))if(t(o)&&!i(o)){let e={v:o,i:c,n:this.norm.get(o)};s.push(e)}else e(o)&&o.forEach((e,t)=>{r.push({nestedArrIndex:t,value:e})})}c.$[o]=s}else if(!i(h)){let e={v:h,n:this.norm.get(h)};c.$[o]=e}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function l(e,t,{getFn:s=o.getFn}={}){let n=new a({getFn:s});return n.setKeys(e),n.setCollection(t),n.create(),n}function d(e,t){const s=e.matches;t.matches=[],n(s)&&s.forEach(e=>{if(!n(e.indices)||!e.indices.length)return;const{indices:s,value:i}=e;let r={indices:s,value:i};e.key&&(r.key=e.key),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)})}function u(e,t){t.score=e.score}function f(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:i=o.distance}={}){const r=t/e.length,c=Math.abs(n-s);return i?r+c/i:c?1:r}function g(e,t,s,{location:n=o.location,distance:i=o.distance,threshold:r=o.threshold,findAllMatches:c=o.findAllMatches,minMatchCharLength:h=o.minMatchCharLength,includeMatches:a=o.includeMatches}={}){if(t.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const l=t.length,d=e.length,u=Math.max(0,Math.min(n,d));let g=r,p=u;const m=[];if(a)for(let e=0;e<d;e+=1)m[e]=0;let y;for(;(y=e.indexOf(t,p))>-1;){let e=f(t,{currentLocation:y,expectedLocation:u,distance:i});if(g=Math.min(e,g),p=y+l,a){let e=0;for(;e<l;)m[y+e]=1,e+=1}}p=-1;let M=[],x=1,k=l+d;const _=1<<l-1;for(let n=0;n<l;n+=1){let r=0,o=k;for(;r<o;){f(t,{errors:n,currentLocation:u+o,expectedLocation:u,distance:i})<=g?r=o:k=o,o=Math.floor((k-r)/2+r)}k=o;let h=Math.max(1,u-o+1),y=c?d:Math.min(u+o,d)+l,v=Array(y+2);v[y+1]=(1<<n)-1;for(let r=y;r>=h;r-=1){let c=r-1,o=s[e.charAt(c)];if(o&&a&&(m[c]=1),v[r]=(v[r+1]<<1|1)&o,0!==n&&(v[r]|=(M[r+1]|M[r])<<1|1|M[r+1]),v[r]&_&&(x=f(t,{errors:n,currentLocation:c,expectedLocation:u,distance:i}),x<=g)){if(g=x,p=c,p<=u)break;h=Math.max(1,2*u-p)}}if(f(t,{errors:n+1,currentLocation:u,expectedLocation:u,distance:i})>g)break;M=v}let v={isMatch:p>=0,score:Math.max(.001,x)};return a&&(v.indices=function(e=[],t=o.minMatchCharLength){let s=[],n=-1,i=-1,r=0;for(let c=e.length;r<c;r+=1){let c=e[r];c&&-1===n?n=r:c||-1===n||(i=r-1,i-n+1>=t&&s.push([n,i]),n=-1)}return e[r-1]&&r-n>=t&&s.push([n,r-1]),s}(m,h)),v}function p(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const i=e.charAt(s);t[i]=(t[i]||0)|1<<n-s-1}return t}class m{constructor(e,{location:t=o.location,threshold:s=o.threshold,distance:n=o.distance,includeMatches:i=o.includeMatches,findAllMatches:r=o.findAllMatches,minMatchCharLength:c=o.minMatchCharLength,isCaseSensitive:h=o.isCaseSensitive}={}){this.options={location:t,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:h},this.pattern=h?e:e.toLowerCase(),this.chunks=[];let a=0;const l=this.pattern.length,d=l%32,u=l-d;for(;a<u;){const e=this.pattern.substr(a,32);this.chunks.push({pattern:e,alphabet:p(e)}),a+=32}if(d){const e=this.pattern.substr(l-32);this.chunks.push({pattern:e,alphabet:p(e)})}}searchIn(e){const{isCaseSensitive:t,includeMatches:s}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return s&&(t.indices=[[0,e.length-1]]),t}const{location:n,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o}=this.options;let h=[],a=0,l=!1;this.chunks.forEach(({pattern:t,alphabet:d},u)=>{const{isMatch:f,score:p,indices:m}=g(e,t,d,{location:n+32*u,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o,includeMatches:s});f&&(l=!0),a+=p,f&&m&&(h=[...h,...m])});let d={isMatch:l,score:l?a/this.chunks.length:1};return l&&s&&(d.indices=h),d}}const y=[];function M(e,t){for(let s=0,n=y.length;s<n;s+=1){let n=y[s];if(n.condition(e,t))return new n(e,t)}return new m(e,t)}class x{constructor(e,t={},s){if(this.options={...o,...t},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new c(this.options.keys),this.setCollection(e,s)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof a))throw new Error("Incorrect 'index' type");this._myIndex=t||l(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}add(e){n(e)&&(this._docs.push(e),this._myIndex.add(e))}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:i,includeScore:r,shouldSort:c,sortFn:h}=this.options;let a=t(e)?t(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,t){e.forEach(e=>{let s=1;e.matches.forEach(({key:e,norm:n,score:i})=>{const r=t.get(e,"weight");s*=Math.pow(0===i&&r?Number.EPSILON:i,(r||1)*n)}),e.score=s})}(a,this._keyStore),c&&a.sort(h),s(n)&&n>-1&&(a=a.slice(0,n)),function(e,t,{includeMatches:s=o.includeMatches,includeScore:n=o.includeScore}={}){const i=[];s&&i.push(d);n&&i.push(u);return e.map(e=>{const{idx:s}=e,n={item:t[s],refIndex:s};return i.length&&i.forEach(t=>{t(e,n)}),n})}(a,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(e){const t=M(e,this.options),{records:s}=this._myIndex,i=[];return s.forEach(({v:e,i:s,n:r})=>{if(!n(e))return;const{isMatch:c,score:o,indices:h}=t.searchIn(e);c&&i.push({item:e,idx:s,matches:[{score:o,value:e,norm:r,indices:h}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const t=M(e,this.options),{keys:s,records:i}=this._myIndex,r=[];return i.forEach(({$:e,i:i})=>{if(!n(e))return;let c=[];s.forEach((s,n)=>{c.push(...this._findMatches({key:s,value:e[n],searcher:t}))}),c.length&&r.push({idx:i,item:e,matches:c})}),r}_findMatches({key:t,value:s,searcher:i}){if(!n(s))return[];let r=[];if(e(s))s.forEach(({v:e,i:s,n:c})=>{if(!n(e))return;const{isMatch:o,score:h,indices:a}=i.searchIn(e);o&&r.push({score:h,key:t,value:e,idx:s,norm:c,indices:a})});else{const{v:e,n:n}=s,{isMatch:c,score:o,indices:h}=i.searchIn(e);c&&r.push({score:o,key:t,value:e,norm:n,indices:h})}return r}}x.version="6.0.2",x.createIndex=l,x.parseIndex=function(e,{getFn:t=o.getFn}={}){const{keys:s,records:n}=e;let i=new a({getFn:t});return i.setKeys(s),i.setRecords(n),i},x.config=o;export default x; | ||
function e(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function t(e){return"string"==typeof e}function s(e){return"number"==typeof e}function n(e){return null!=e}function i(e){return!e.trim().length}const r=Object.prototype.hasOwnProperty;class c{constructor(e){this._keys={},this._keyNames=[];let s=0;e.forEach(e=>{let n,i=1;if(t(e))n=e;else{if(!r.call(e,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=e.name,r.call(e,"weight")&&(i=e.weight,i<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:i},s+=i}),this._keyNames.forEach(e=>{this._keys[e].weight/=s})}get(e,t){return this._keys[e]&&this._keys[e][t]}keys(){return this._keyNames}toJSON(){return JSON.stringify(this._keys)}}var o={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(i,r){let c=[],o=!1;const h=(i,r)=>{if(r){const a=r.indexOf(".");let l=r,d=null;-1!==a&&(l=r.slice(0,a),d=r.slice(a+1));const u=i[l];if(!n(u))return;if(d||!t(u)&&!s(u))if(e(u)){o=!0;for(let e=0,t=u.length;e<t;e+=1)h(u[e],d)}else d&&h(u,d);else c.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(u))}else c.push(i)};return h(i,r),o?c:c[0]}}};const h=/[^ ]+/g;class a{constructor({getFn:e=o.getFn}={}){this.norm=function(e=3){const t=new Map;return{get(s){const n=s.match(h).length;if(t.has(n))return t.get(n);const i=parseFloat((1/Math.sqrt(n)).toFixed(e));return t.set(n,i),i},clear(){t.clear()}}}(3),this.getFn=e,this.isCreated=!1,this.setRecords()}setCollection(e=[]){this.docs=e}setRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,t(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 s=this.size();t(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t<s;t+=1)this.records[t].i-=1}size(){return this.records.length}_addString(e,t){if(!n(e)||i(e))return;let s={v:e,i:t,n:this.norm.get(e)};this.records.push(s)}_addObject(s,r){let c={i:r,$:{}};this.keys.forEach((r,o)=>{let h=this.getFn(s,r);if(n(h))if(e(h)){let s=[];const r=[{nestedArrIndex:-1,value:h}];for(;r.length;){const{nestedArrIndex:c,value:o}=r.pop();if(n(o))if(t(o)&&!i(o)){let e={v:o,i:c,n:this.norm.get(o)};s.push(e)}else e(o)&&o.forEach((e,t)=>{r.push({nestedArrIndex:t,value:e})})}c.$[o]=s}else if(!i(h)){let e={v:h,n:this.norm.get(h)};c.$[o]=e}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function l(e,t,{getFn:s=o.getFn}={}){let n=new a({getFn:s});return n.setKeys(e),n.setCollection(t),n.create(),n}function d(e,t){const s=e.matches;t.matches=[],n(s)&&s.forEach(e=>{if(!n(e.indices)||!e.indices.length)return;const{indices:s,value:i}=e;let r={indices:s,value:i};e.key&&(r.key=e.key),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)})}function u(e,t){t.score=e.score}function f(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:i=o.distance}={}){const r=t/e.length,c=Math.abs(n-s);return i?r+c/i:c?1:r}function g(e,t,s,{location:n=o.location,distance:i=o.distance,threshold:r=o.threshold,findAllMatches:c=o.findAllMatches,minMatchCharLength:h=o.minMatchCharLength,includeMatches:a=o.includeMatches}={}){if(t.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const l=t.length,d=e.length,u=Math.max(0,Math.min(n,d));let g=r,p=u;const m=[];if(a)for(let e=0;e<d;e+=1)m[e]=0;let y;for(;(y=e.indexOf(t,p))>-1;){let e=f(t,{currentLocation:y,expectedLocation:u,distance:i});if(g=Math.min(e,g),p=y+l,a){let e=0;for(;e<l;)m[y+e]=1,e+=1}}p=-1;let M=[],x=1,k=l+d;const _=1<<l-1;for(let n=0;n<l;n+=1){let r=0,o=k;for(;r<o;){f(t,{errors:n,currentLocation:u+o,expectedLocation:u,distance:i})<=g?r=o:k=o,o=Math.floor((k-r)/2+r)}k=o;let h=Math.max(1,u-o+1),y=c?d:Math.min(u+o,d)+l,v=Array(y+2);v[y+1]=(1<<n)-1;for(let r=y;r>=h;r-=1){let c=r-1,o=s[e.charAt(c)];if(o&&a&&(m[c]=1),v[r]=(v[r+1]<<1|1)&o,0!==n&&(v[r]|=(M[r+1]|M[r])<<1|1|M[r+1]),v[r]&_&&(x=f(t,{errors:n,currentLocation:c,expectedLocation:u,distance:i}),x<=g)){if(g=x,p=c,p<=u)break;h=Math.max(1,2*u-p)}}if(f(t,{errors:n+1,currentLocation:u,expectedLocation:u,distance:i})>g)break;M=v}let v={isMatch:p>=0,score:Math.max(.001,x)};return a&&(v.indices=function(e=[],t=o.minMatchCharLength){let s=[],n=-1,i=-1,r=0;for(let c=e.length;r<c;r+=1){let c=e[r];c&&-1===n?n=r:c||-1===n||(i=r-1,i-n+1>=t&&s.push([n,i]),n=-1)}return e[r-1]&&r-n>=t&&s.push([n,r-1]),s}(m,h)),v}function p(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const i=e.charAt(s);t[i]=(t[i]||0)|1<<n-s-1}return t}class m{constructor(e,{location:t=o.location,threshold:s=o.threshold,distance:n=o.distance,includeMatches:i=o.includeMatches,findAllMatches:r=o.findAllMatches,minMatchCharLength:c=o.minMatchCharLength,isCaseSensitive:h=o.isCaseSensitive}={}){this.options={location:t,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:h},this.pattern=h?e:e.toLowerCase(),this.chunks=[];const a=(e,t)=>{this.chunks.push({pattern:e,alphabet:p(e),startIndex:t})},l=this.pattern.length;if(l>32){let e=0;const t=l%32,s=l-t;for(;e<s;)a(this.pattern.substr(e,32),e),e+=32;if(t){const e=l-32;a(this.pattern.substr(e),e)}}else a(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:s}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return s&&(t.indices=[[0,e.length-1]]),t}const{location:n,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o}=this.options;let h=[],a=0,l=!1;this.chunks.forEach(({pattern:t,alphabet:d,startIndex:u})=>{const{isMatch:f,score:p,indices:m}=g(e,t,d,{location:n+u,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o,includeMatches:s});f&&(l=!0),a+=p,f&&m&&(h=[...h,...m])});let d={isMatch:l,score:l?a/this.chunks.length:1};return l&&s&&(d.indices=h),d}}const y=[];function M(e,t){for(let s=0,n=y.length;s<n;s+=1){let n=y[s];if(n.condition(e,t))return new n(e,t)}return new m(e,t)}class x{constructor(e,t={},s){if(this.options={...o,...t},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new c(this.options.keys),this.setCollection(e,s)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof a))throw new Error("Incorrect 'index' type");this._myIndex=t||l(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}add(e){n(e)&&(this._docs.push(e),this._myIndex.add(e))}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:i,includeScore:r,shouldSort:c,sortFn:h}=this.options;let a=t(e)?t(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,t){e.forEach(e=>{let s=1;e.matches.forEach(({key:e,norm:n,score:i})=>{const r=t.get(e,"weight");s*=Math.pow(0===i&&r?Number.EPSILON:i,(r||1)*n)}),e.score=s})}(a,this._keyStore),c&&a.sort(h),s(n)&&n>-1&&(a=a.slice(0,n)),function(e,t,{includeMatches:s=o.includeMatches,includeScore:n=o.includeScore}={}){const i=[];s&&i.push(d);n&&i.push(u);return e.map(e=>{const{idx:s}=e,n={item:t[s],refIndex:s};return i.length&&i.forEach(t=>{t(e,n)}),n})}(a,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(e){const t=M(e,this.options),{records:s}=this._myIndex,i=[];return s.forEach(({v:e,i:s,n:r})=>{if(!n(e))return;const{isMatch:c,score:o,indices:h}=t.searchIn(e);c&&i.push({item:e,idx:s,matches:[{score:o,value:e,norm:r,indices:h}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const t=M(e,this.options),{keys:s,records:i}=this._myIndex,r=[];return i.forEach(({$:e,i:i})=>{if(!n(e))return;let c=[];s.forEach((s,n)=>{c.push(...this._findMatches({key:s,value:e[n],searcher:t}))}),c.length&&r.push({idx:i,item:e,matches:c})}),r}_findMatches({key:t,value:s,searcher:i}){if(!n(s))return[];let r=[];if(e(s))s.forEach(({v:e,i:s,n:c})=>{if(!n(e))return;const{isMatch:o,score:h,indices:a}=i.searchIn(e);o&&r.push({score:h,key:t,value:e,idx:s,norm:c,indices:a})});else{const{v:e,n:n}=s,{isMatch:c,score:o,indices:h}=i.searchIn(e);c&&r.push({score:o,key:t,value:e,norm:n,indices:h})}return r}}x.version="6.0.3",x.createIndex=l,x.parseIndex=function(e,{getFn:t=o.getFn}={}){const{keys:s,records:n}=e;let i=new a({getFn:t});return i.setKeys(s),i.setRecords(n),i},x.config=o;export default x; |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -837,2 +837,4 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
function BitapSearch(pattern) { | ||
var _this = this; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
@@ -867,24 +869,29 @@ _ref$location = _ref.location, | ||
this.chunks = []; | ||
var i = 0; | ||
var addChunk = function addChunk(pattern, startIndex) { | ||
_this.chunks.push({ | ||
pattern: pattern, | ||
alphabet: createPatternAlphabet(pattern), | ||
startIndex: startIndex | ||
}); | ||
}; | ||
var len = this.pattern.length; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
while (i < end) { | ||
var _pattern = this.pattern.substr(i, MAX_BITS); | ||
if (len > MAX_BITS) { | ||
var i = 0; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
this.chunks.push({ | ||
pattern: _pattern, | ||
alphabet: createPatternAlphabet(_pattern) | ||
}); | ||
i += MAX_BITS; | ||
} | ||
while (i < end) { | ||
addChunk(this.pattern.substr(i, MAX_BITS), i); | ||
i += MAX_BITS; | ||
} | ||
if (remainder) { | ||
var _pattern2 = this.pattern.substr(len - MAX_BITS); | ||
this.chunks.push({ | ||
pattern: _pattern2, | ||
alphabet: createPatternAlphabet(_pattern2) | ||
}); | ||
if (remainder) { | ||
var startIndex = len - MAX_BITS; | ||
addChunk(this.pattern.substr(startIndex), startIndex); | ||
} | ||
} else { | ||
addChunk(this.pattern, 0); | ||
} | ||
@@ -928,8 +935,9 @@ } | ||
var hasMatches = false; | ||
this.chunks.forEach(function (_ref2, i) { | ||
this.chunks.forEach(function (_ref2) { | ||
var pattern = _ref2.pattern, | ||
alphabet = _ref2.alphabet; | ||
alphabet = _ref2.alphabet, | ||
startIndex = _ref2.startIndex; | ||
var _search = search(text, pattern, alphabet, { | ||
location: location + MAX_BITS * i, | ||
location: location + startIndex, | ||
distance: distance, | ||
@@ -1332,3 +1340,3 @@ threshold: threshold, | ||
Fuse.version = '6.0.2'; | ||
Fuse.version = '6.0.3'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1335,0 +1343,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -9,2 +9,2 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
*/ | ||
var e,t;e=this,t=function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function h(e){return"string"==typeof e}function u(e){return"number"==typeof e}function d(e){return null!=e}function l(e){return!e.trim().length}var f=function(e){return"Pattern length exceeds max of ".concat(e,".")},v=Object.prototype.hasOwnProperty,y=function(){function t(n){var r=this;e(this,t),this._keys={},this._keyNames=[];var i=0;n.forEach((function(e){var t,n=1;if(h(e))t=e;else{if(!v.call(e,"name"))throw new Error("Missing ".concat("name"," property in key"));if(t=e.name,v.call(e,"weight")&&(n=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(t))}r._keyNames.push(t),r._keys[t]={weight:n},i+=n})),this._keyNames.forEach((function(e){r._keys[e].weight/=i}))}return n(t,[{key:"get",value:function(e,t){return this._keys[e]&&this._keys[e][t]}},{key:"keys",value:function(){return this._keyNames}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),t}(),p=o({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return 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},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i){if(i){var o=i.indexOf("."),s=i,a=null;-1!==o&&(s=i.slice(0,o),a=i.slice(o+1));var l=t[s];if(!d(l))return;if(a||!h(l)&&!u(l))if(c(l)){r=!0;for(var f=0,v=l.length;f<v;f+=1)e(l[f],a)}else a&&e(l,a);else n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(l))}else n.push(t)}(e,t),r?n:n[0]}}),g=/[^ ]+/g;function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(g).length;if(t.has(r))return t.get(r);var i=parseFloat((1/Math.sqrt(r)).toFixed(e));return t.set(r,i),i},clear:function(){t.clear()}}}var k=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?p.getFn:r;e(this,t),this.norm=m(3),this.getFn=i,this.isCreated=!1,this.setRecords()}return n(t,[{key:"setCollection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=e}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,h(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();h(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){if(d(e)&&!l(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:"_addObject",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,i){var o=n.getFn(e,t);if(d(o))if(c(o))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:o}];t.length;){var s=t.pop(),a=s.nestedArrIndex,u=s.value;if(d(u))if(h(u)&&!l(u)){var f={v:u,i:a,n:n.norm.get(u)};e.push(f)}else c(u)&&u.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[i]=e}();else if(!l(o)){var s={v:o,n:n.norm.get(o)};r.$[i]=s}})),this.records.push(r)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),t}();function b(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?p.getFn:r,o=new k({getFn:i});return o.setKeys(e),o.setCollection(t),o.create(),o}function M(e,t){var n=e.matches;t.matches=[],d(n)&&n.forEach((function(e){if(d(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function x(e,t){t.score=e.score}function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,s=t.expectedLocation,a=void 0===s?0:s,c=t.distance,h=void 0===c?p.distance:c,u=r/e.length,d=Math.abs(a-o);return h?u+d/h:d?1:u}function _(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.minMatchCharLength,n=[],r=-1,i=-1,o=0,s=e.length;o<s;o+=1){var a=e[o];a&&-1===r?r=o:a||-1===r||((i=o-1)-r+1>=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function O(e){for(var t={},n=0,r=e.length;n<r;n+=1){var i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}var S=function(){function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.location,o=void 0===i?p.location:i,s=r.threshold,a=void 0===s?p.threshold:s,c=r.distance,h=void 0===c?p.distance:c,u=r.includeMatches,d=void 0===u?p.includeMatches:u,l=r.findAllMatches,f=void 0===l?p.findAllMatches:l,v=r.minMatchCharLength,y=void 0===v?p.minMatchCharLength:v,g=r.isCaseSensitive,m=void 0===g?p.isCaseSensitive:g;e(this,t),this.options={location:o,threshold:a,distance:h,includeMatches:d,findAllMatches:f,minMatchCharLength:y,isCaseSensitive:m},this.pattern=m?n:n.toLowerCase(),this.chunks=[];for(var k=0,b=this.pattern.length,M=b%32,x=b-M;k<x;){var w=this.pattern.substr(k,32);this.chunks.push({pattern:w,alphabet:O(w)}),k+=32}if(M){var _=this.pattern.substr(b-32);this.chunks.push({pattern:_,alphabet:O(_)})}}return n(t,[{key:"searchIn",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var i={isMatch:!0,score:0};return r&&(i.indices=[[0,e.length-1]]),i}var o=this.options,a=o.location,c=o.distance,h=o.threshold,u=o.findAllMatches,d=o.minMatchCharLength,l=[],v=0,y=!1;this.chunks.forEach((function(t,n){var i=t.pattern,o=t.alphabet,g=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?p.location:i,s=r.distance,a=void 0===s?p.distance:s,c=r.threshold,h=void 0===c?p.threshold:c,u=r.findAllMatches,d=void 0===u?p.findAllMatches:u,l=r.minMatchCharLength,v=void 0===l?p.minMatchCharLength:l,y=r.includeMatches,g=void 0===y?p.includeMatches:y;if(t.length>32)throw new Error(f(32));var m,k=t.length,b=e.length,M=Math.max(0,Math.min(o,b)),x=h,O=M,S=[];if(g)for(var A=0;A<b;A+=1)S[A]=0;for(;(m=e.indexOf(t,O))>-1;){var E=w(t,{currentLocation:m,expectedLocation:M,distance:a});if(x=Math.min(E,x),O=m+k,g)for(var L=0;L<k;)S[m+L]=1,L+=1}O=-1;for(var j=[],C=1,I=k+b,F=1<<k-1,P=0;P<k;P+=1){for(var N=0,$=I;N<$;){var D=w(t,{errors:P,currentLocation:M+$,expectedLocation:M,distance:a});D<=x?N=$:I=$,$=Math.floor((I-N)/2+N)}I=$;var z=Math.max(1,M-$+1),J=d?b:Math.min(M+$,b)+k,K=Array(J+2);K[J+1]=(1<<P)-1;for(var R=J;R>=z;R-=1){var T=R-1,q=n[e.charAt(T)];if(q&&g&&(S[T]=1),K[R]=(K[R+1]<<1|1)&q,0!==P&&(K[R]|=(j[R+1]|j[R])<<1|1|j[R+1]),K[R]&F&&(C=w(t,{errors:P,currentLocation:T,expectedLocation:M,distance:a}))<=x){if(x=C,(O=T)<=M)break;z=Math.max(1,2*M-O)}}var U=w(t,{errors:P+1,currentLocation:M,expectedLocation:M,distance:a});if(U>x)break;j=K}var B={isMatch:O>=0,score:Math.max(.001,C)};return g&&(B.indices=_(S,v)),B}(e,i,o,{location:a+32*n,distance:c,threshold:h,findAllMatches:u,minMatchCharLength:d,includeMatches:r}),m=g.isMatch,k=g.score,b=g.indices;m&&(y=!0),v+=k,m&&b&&(l=[].concat(s(l),s(b)))}));var g={isMatch:y,score:y?v/this.chunks.length:1};return y&&r&&(g.indices=l),g}}]),t}(),A=[];function E(e,t){for(var n=0,r=A.length;n<r;n+=1){var i=A[n];if(i.condition(e,t))return new i(e,t)}return new S(e,t)}var L=function(){function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(e(this,t),this.options=o({},p,{},r),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new y(this.options.keys),this.setCollection(n,i)}return n(t,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof k))throw new Error("Incorrect 'index' type");this._myIndex=t||b(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){d(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,s=i.includeScore,a=i.shouldSort,c=i.sortFn,d=h(e)?h(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return j(d,this._keyStore),a&&d.sort(c),u(r)&&r>-1&&(d=d.slice(0,r)),C(d,this._docs,{includeMatches:o,includeScore:s})}},{key:"_searchStringList",value:function(e){var t=E(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(d(n)){var s=t.searchIn(n),a=s.isMatch,c=s.score,h=s.indices;a&&r.push({item:n,idx:i,matches:[{score:c,value:n,norm:o,indices:h}]})}})),r}},{key:"_searchLogical",value:function(e){throw new Error("Logical search is not available")}},{key:"_searchObjectList",value:function(e){var t=this,n=E(e,this.options),r=this._myIndex,i=r.keys,o=r.records,a=[];return o.forEach((function(e){var r=e.$,o=e.i;if(d(r)){var c=[];i.forEach((function(e,i){c.push.apply(c,s(t._findMatches({key:e,value:r[i],searcher:n})))})),c.length&&a.push({idx:o,item:r,matches:c})}})),a}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!d(n))return[];var i=[];if(c(n))n.forEach((function(e){var n=e.v,o=e.i,s=e.n;if(d(n)){var a=r.searchIn(n),c=a.isMatch,h=a.score,u=a.indices;c&&i.push({score:h,key:t,value:n,idx:o,norm:s,indices:u})}}));else{var o=n.v,s=n.n,a=r.searchIn(o),h=a.isMatch,u=a.score,l=a.indices;h&&i.push({score:u,key:t,value:o,norm:s,indices:l})}return i}}]),t}();function j(e,t){e.forEach((function(e){var n=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,s=t.get(r,"weight");n*=Math.pow(0===o&&s?Number.EPSILON:o,(s||1)*i)})),e.score=n}))}function C(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?p.includeMatches:r,o=n.includeScore,s=void 0===o?p.includeScore:o,a=[];return i&&a.push(M),s&&a.push(x),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return a.length&&a.forEach((function(t){t(e,r)})),r}))}return L.version="6.0.2",L.createIndex=b,L.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?p.getFn:n,i=e.keys,o=e.records,s=new k({getFn:r});return s.setKeys(i),s.setRecords(o),s},L.config=p,L},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); | ||
var e,t;e=this,t=function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function h(e){return"string"==typeof e}function u(e){return"number"==typeof e}function d(e){return null!=e}function f(e){return!e.trim().length}var l=function(e){return"Pattern length exceeds max of ".concat(e,".")},v=Object.prototype.hasOwnProperty,y=function(){function t(n){var r=this;e(this,t),this._keys={},this._keyNames=[];var i=0;n.forEach((function(e){var t,n=1;if(h(e))t=e;else{if(!v.call(e,"name"))throw new Error("Missing ".concat("name"," property in key"));if(t=e.name,v.call(e,"weight")&&(n=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(t))}r._keyNames.push(t),r._keys[t]={weight:n},i+=n})),this._keyNames.forEach((function(e){r._keys[e].weight/=i}))}return n(t,[{key:"get",value:function(e,t){return this._keys[e]&&this._keys[e][t]}},{key:"keys",value:function(){return this._keyNames}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),t}(),g=o({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return 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},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i){if(i){var o=i.indexOf("."),s=i,a=null;-1!==o&&(s=i.slice(0,o),a=i.slice(o+1));var f=t[s];if(!d(f))return;if(a||!h(f)&&!u(f))if(c(f)){r=!0;for(var l=0,v=f.length;l<v;l+=1)e(f[l],a)}else a&&e(f,a);else n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(f))}else n.push(t)}(e,t),r?n:n[0]}}),p=/[^ ]+/g;function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(p).length;if(t.has(r))return t.get(r);var i=parseFloat((1/Math.sqrt(r)).toFixed(e));return t.set(r,i),i},clear:function(){t.clear()}}}var k=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?g.getFn:r;e(this,t),this.norm=m(3),this.getFn=i,this.isCreated=!1,this.setRecords()}return n(t,[{key:"setCollection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=e}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,h(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();h(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){if(d(e)&&!f(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:"_addObject",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,i){var o=n.getFn(e,t);if(d(o))if(c(o))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:o}];t.length;){var s=t.pop(),a=s.nestedArrIndex,u=s.value;if(d(u))if(h(u)&&!f(u)){var l={v:u,i:a,n:n.norm.get(u)};e.push(l)}else c(u)&&u.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[i]=e}();else if(!f(o)){var s={v:o,n:n.norm.get(o)};r.$[i]=s}})),this.records.push(r)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),t}();function b(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?g.getFn:r,o=new k({getFn:i});return o.setKeys(e),o.setCollection(t),o.create(),o}function M(e,t){var n=e.matches;t.matches=[],d(n)&&n.forEach((function(e){if(d(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function x(e,t){t.score=e.score}function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,s=t.expectedLocation,a=void 0===s?0:s,c=t.distance,h=void 0===c?g.distance:c,u=r/e.length,d=Math.abs(a-o);return h?u+d/h:d?1:u}function _(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.minMatchCharLength,n=[],r=-1,i=-1,o=0,s=e.length;o<s;o+=1){var a=e[o];a&&-1===r?r=o:a||-1===r||((i=o-1)-r+1>=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function O(e){for(var t={},n=0,r=e.length;n<r;n+=1){var i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}var S=function(){function t(n){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,s=void 0===o?g.location:o,a=i.threshold,c=void 0===a?g.threshold:a,h=i.distance,u=void 0===h?g.distance:h,d=i.includeMatches,f=void 0===d?g.includeMatches:d,l=i.findAllMatches,v=void 0===l?g.findAllMatches:l,y=i.minMatchCharLength,p=void 0===y?g.minMatchCharLength:y,m=i.isCaseSensitive,k=void 0===m?g.isCaseSensitive:m;e(this,t),this.options={location:s,threshold:c,distance:u,includeMatches:f,findAllMatches:v,minMatchCharLength:p,isCaseSensitive:k},this.pattern=k?n:n.toLowerCase(),this.chunks=[];var b=function(e,t){r.chunks.push({pattern:e,alphabet:O(e),startIndex:t})},M=this.pattern.length;if(M>32){for(var x=0,w=M%32,_=M-w;x<_;)b(this.pattern.substr(x,32),x),x+=32;if(w){var S=M-32;b(this.pattern.substr(S),S)}}else b(this.pattern,0)}return n(t,[{key:"searchIn",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var i={isMatch:!0,score:0};return r&&(i.indices=[[0,e.length-1]]),i}var o=this.options,a=o.location,c=o.distance,h=o.threshold,u=o.findAllMatches,d=o.minMatchCharLength,f=[],v=0,y=!1;this.chunks.forEach((function(t){var n=t.pattern,i=t.alphabet,o=t.startIndex,p=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?g.location:i,s=r.distance,a=void 0===s?g.distance:s,c=r.threshold,h=void 0===c?g.threshold:c,u=r.findAllMatches,d=void 0===u?g.findAllMatches:u,f=r.minMatchCharLength,v=void 0===f?g.minMatchCharLength:f,y=r.includeMatches,p=void 0===y?g.includeMatches:y;if(t.length>32)throw new Error(l(32));var m,k=t.length,b=e.length,M=Math.max(0,Math.min(o,b)),x=h,O=M,S=[];if(p)for(var A=0;A<b;A+=1)S[A]=0;for(;(m=e.indexOf(t,O))>-1;){var E=w(t,{currentLocation:m,expectedLocation:M,distance:a});if(x=Math.min(E,x),O=m+k,p)for(var L=0;L<k;)S[m+L]=1,L+=1}O=-1;for(var j=[],C=1,I=k+b,F=1<<k-1,P=0;P<k;P+=1){for(var N=0,$=I;N<$;){var D=w(t,{errors:P,currentLocation:M+$,expectedLocation:M,distance:a});D<=x?N=$:I=$,$=Math.floor((I-N)/2+N)}I=$;var z=Math.max(1,M-$+1),J=d?b:Math.min(M+$,b)+k,K=Array(J+2);K[J+1]=(1<<P)-1;for(var R=J;R>=z;R-=1){var T=R-1,q=n[e.charAt(T)];if(q&&p&&(S[T]=1),K[R]=(K[R+1]<<1|1)&q,0!==P&&(K[R]|=(j[R+1]|j[R])<<1|1|j[R+1]),K[R]&F&&(C=w(t,{errors:P,currentLocation:T,expectedLocation:M,distance:a}))<=x){if(x=C,(O=T)<=M)break;z=Math.max(1,2*M-O)}}var U=w(t,{errors:P+1,currentLocation:M,expectedLocation:M,distance:a});if(U>x)break;j=K}var B={isMatch:O>=0,score:Math.max(.001,C)};return p&&(B.indices=_(S,v)),B}(e,n,i,{location:a+o,distance:c,threshold:h,findAllMatches:u,minMatchCharLength:d,includeMatches:r}),m=p.isMatch,k=p.score,b=p.indices;m&&(y=!0),v+=k,m&&b&&(f=[].concat(s(f),s(b)))}));var p={isMatch:y,score:y?v/this.chunks.length:1};return y&&r&&(p.indices=f),p}}]),t}(),A=[];function E(e,t){for(var n=0,r=A.length;n<r;n+=1){var i=A[n];if(i.condition(e,t))return new i(e,t)}return new S(e,t)}var L=function(){function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(e(this,t),this.options=o({},g,{},r),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new y(this.options.keys),this.setCollection(n,i)}return n(t,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof k))throw new Error("Incorrect 'index' type");this._myIndex=t||b(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){d(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,s=i.includeScore,a=i.shouldSort,c=i.sortFn,d=h(e)?h(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return j(d,this._keyStore),a&&d.sort(c),u(r)&&r>-1&&(d=d.slice(0,r)),C(d,this._docs,{includeMatches:o,includeScore:s})}},{key:"_searchStringList",value:function(e){var t=E(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(d(n)){var s=t.searchIn(n),a=s.isMatch,c=s.score,h=s.indices;a&&r.push({item:n,idx:i,matches:[{score:c,value:n,norm:o,indices:h}]})}})),r}},{key:"_searchLogical",value:function(e){throw new Error("Logical search is not available")}},{key:"_searchObjectList",value:function(e){var t=this,n=E(e,this.options),r=this._myIndex,i=r.keys,o=r.records,a=[];return o.forEach((function(e){var r=e.$,o=e.i;if(d(r)){var c=[];i.forEach((function(e,i){c.push.apply(c,s(t._findMatches({key:e,value:r[i],searcher:n})))})),c.length&&a.push({idx:o,item:r,matches:c})}})),a}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!d(n))return[];var i=[];if(c(n))n.forEach((function(e){var n=e.v,o=e.i,s=e.n;if(d(n)){var a=r.searchIn(n),c=a.isMatch,h=a.score,u=a.indices;c&&i.push({score:h,key:t,value:n,idx:o,norm:s,indices:u})}}));else{var o=n.v,s=n.n,a=r.searchIn(o),h=a.isMatch,u=a.score,f=a.indices;h&&i.push({score:u,key:t,value:o,norm:s,indices:f})}return i}}]),t}();function j(e,t){e.forEach((function(e){var n=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,s=t.get(r,"weight");n*=Math.pow(0===o&&s?Number.EPSILON:o,(s||1)*i)})),e.score=n}))}function C(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?g.includeMatches:r,o=n.includeScore,s=void 0===o?g.includeScore:o,a=[];return i&&a.push(M),s&&a.push(x),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return a.length&&a.forEach((function(t){t(e,r)})),r}))}return L.version="6.0.3",L.createIndex=b,L.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?g.getFn:n,i=e.keys,o=e.records,s=new k({getFn:r});return s.setKeys(i),s.setRecords(o),s},L.config=g,L},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -909,2 +909,4 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
function BitapSearch(pattern) { | ||
var _this = this; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
@@ -939,24 +941,29 @@ _ref$location = _ref.location, | ||
this.chunks = []; | ||
var i = 0; | ||
var addChunk = function addChunk(pattern, startIndex) { | ||
_this.chunks.push({ | ||
pattern: pattern, | ||
alphabet: createPatternAlphabet(pattern), | ||
startIndex: startIndex | ||
}); | ||
}; | ||
var len = this.pattern.length; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
while (i < end) { | ||
var _pattern = this.pattern.substr(i, MAX_BITS); | ||
if (len > MAX_BITS) { | ||
var i = 0; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
this.chunks.push({ | ||
pattern: _pattern, | ||
alphabet: createPatternAlphabet(_pattern) | ||
}); | ||
i += MAX_BITS; | ||
} | ||
while (i < end) { | ||
addChunk(this.pattern.substr(i, MAX_BITS), i); | ||
i += MAX_BITS; | ||
} | ||
if (remainder) { | ||
var _pattern2 = this.pattern.substr(len - MAX_BITS); | ||
this.chunks.push({ | ||
pattern: _pattern2, | ||
alphabet: createPatternAlphabet(_pattern2) | ||
}); | ||
if (remainder) { | ||
var startIndex = len - MAX_BITS; | ||
addChunk(this.pattern.substr(startIndex), startIndex); | ||
} | ||
} else { | ||
addChunk(this.pattern, 0); | ||
} | ||
@@ -1000,8 +1007,9 @@ } | ||
var hasMatches = false; | ||
this.chunks.forEach(function (_ref2, i) { | ||
this.chunks.forEach(function (_ref2) { | ||
var pattern = _ref2.pattern, | ||
alphabet = _ref2.alphabet; | ||
alphabet = _ref2.alphabet, | ||
startIndex = _ref2.startIndex; | ||
var _search = search(text, pattern, alphabet, { | ||
location: location + MAX_BITS * i, | ||
location: location + startIndex, | ||
distance: distance, | ||
@@ -2038,3 +2046,3 @@ threshold: threshold, | ||
Fuse.version = '6.0.2'; | ||
Fuse.version = '6.0.3'; | ||
Fuse.createIndex = createIndex; | ||
@@ -2041,0 +2049,0 @@ Fuse.parseIndex = parseIndex; |
@@ -1,2 +0,2 @@ | ||
// Type definitions for Fuse.js v6.0.2 | ||
// Type definitions for Fuse.js v6.0.3 | ||
// TypeScript v3.8.3 | ||
@@ -3,0 +3,0 @@ |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -699,22 +699,28 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
let i = 0; | ||
const len = this.pattern.length; | ||
const remainder = len % MAX_BITS; | ||
const end = len - remainder; | ||
while (i < end) { | ||
const pattern = this.pattern.substr(i, MAX_BITS); | ||
const addChunk = (pattern, startIndex) => { | ||
this.chunks.push({ | ||
pattern, | ||
alphabet: createPatternAlphabet(pattern) | ||
alphabet: createPatternAlphabet(pattern), | ||
startIndex | ||
}); | ||
i += MAX_BITS; | ||
} | ||
}; | ||
if (remainder) { | ||
const pattern = this.pattern.substr(len - MAX_BITS); | ||
this.chunks.push({ | ||
pattern, | ||
alphabet: createPatternAlphabet(pattern) | ||
}); | ||
const len = this.pattern.length; | ||
if (len > MAX_BITS) { | ||
let i = 0; | ||
const remainder = len % MAX_BITS; | ||
const end = len - remainder; | ||
while (i < end) { | ||
addChunk(this.pattern.substr(i, MAX_BITS), i); | ||
i += MAX_BITS; | ||
} | ||
if (remainder) { | ||
const startIndex = len - MAX_BITS; | ||
addChunk(this.pattern.substr(startIndex), startIndex); | ||
} | ||
} else { | ||
addChunk(this.pattern, 0); | ||
} | ||
@@ -757,5 +763,5 @@ } | ||
this.chunks.forEach(({ pattern, alphabet }, i) => { | ||
this.chunks.forEach(({ pattern, alphabet, startIndex }) => { | ||
const { isMatch, score, indices } = search(text, pattern, alphabet, { | ||
location: location + MAX_BITS * i, | ||
location: location + startIndex, | ||
distance, | ||
@@ -1591,3 +1597,3 @@ threshold, | ||
Fuse.version = '6.0.2'; | ||
Fuse.version = '6.0.3'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1594,0 +1600,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -9,2 +9,2 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
*/ | ||
function t(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function e(t){return"string"==typeof t}function s(t){return"number"==typeof t}function n(t){return null!=t}function r(t){return!t.trim().length}const i=Object.prototype.hasOwnProperty;class c{constructor(t){this._keys={},this._keyNames=[];let s=0;t.forEach(t=>{let n,r=1;if(e(t))n=t;else{if(!i.call(t,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=t.name,i.call(t,"weight")&&(r=t.weight,r<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:r},s+=r}),this._keyNames.forEach(t=>{this._keys[t].weight/=s})}get(t,e){return this._keys[t]&&this._keys[t][e]}keys(){return this._keyNames}toJSON(){return JSON.stringify(this._keys)}}var h={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(r,i){let c=[],h=!1;const o=(r,i)=>{if(i){const a=i.indexOf(".");let l=i,u=null;-1!==a&&(l=i.slice(0,a),u=i.slice(a+1));const d=r[l];if(!n(d))return;if(u||!e(d)&&!s(d))if(t(d)){h=!0;for(let t=0,e=d.length;t<e;t+=1)o(d[t],u)}else u&&o(d,u);else c.push(function(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}(d))}else c.push(r)};return o(r,i),h?c:c[0]}}};const o=/[^ ]+/g;class a{constructor({getFn:t=h.getFn}={}){this.norm=function(t=3){const e=new Map;return{get(s){const n=s.match(o).length;if(e.has(n))return e.get(n);const r=parseFloat((1/Math.sqrt(n)).toFixed(t));return e.set(n,r),r},clear(){e.clear()}}}(3),this.getFn=t,this.isCreated=!1,this.setRecords()}setCollection(t=[]){this.docs=t}setRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,e(this.docs[0])?this.docs.forEach((t,e)=>{this._addString(t,e)}):this.docs.forEach((t,e)=>{this._addObject(t,e)}),this.norm.clear())}add(t){const s=this.size();e(t)?this._addString(t,s):this._addObject(t,s)}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e<s;e+=1)this.records[e].i-=1}size(){return this.records.length}_addString(t,e){if(!n(t)||r(t))return;let s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(s,i){let c={i:i,$:{}};this.keys.forEach((i,h)=>{let o=this.getFn(s,i);if(n(o))if(t(o)){let s=[];const i=[{nestedArrIndex:-1,value:o}];for(;i.length;){const{nestedArrIndex:c,value:h}=i.pop();if(n(h))if(e(h)&&!r(h)){let t={v:h,i:c,n:this.norm.get(h)};s.push(t)}else t(h)&&h.forEach((t,e)=>{i.push({nestedArrIndex:e,value:t})})}c.$[h]=s}else if(!r(o)){let t={v:o,n:this.norm.get(o)};c.$[h]=t}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function l(t,e,{getFn:s=h.getFn}={}){let n=new a({getFn:s});return n.setKeys(t),n.setCollection(e),n.create(),n}function u(t,e){const s=t.matches;e.matches=[],n(s)&&s.forEach(t=>{if(!n(t.indices)||!t.indices.length)return;const{indices:s,value:r}=t;let i={indices:s,value:r};t.key&&(i.key=t.key),t.idx>-1&&(i.refIndex=t.idx),e.matches.push(i)})}function d(t,e){e.score=t.score}function f(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=h.distance}={}){const i=e/t.length,c=Math.abs(n-s);return r?i+c/r:c?1:i}function g(t,e,s,{location:n=h.location,distance:r=h.distance,threshold:i=h.threshold,findAllMatches:c=h.findAllMatches,minMatchCharLength:o=h.minMatchCharLength,includeMatches:a=h.includeMatches}={}){if(e.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const l=e.length,u=t.length,d=Math.max(0,Math.min(n,u));let g=i,p=d;const M=[];if(a)for(let t=0;t<u;t+=1)M[t]=0;let m;for(;(m=t.indexOf(e,p))>-1;){let t=f(e,{currentLocation:m,expectedLocation:d,distance:r});if(g=Math.min(t,g),p=m+l,a){let t=0;for(;t<l;)M[m+t]=1,t+=1}}p=-1;let y=[],x=1,k=l+u;const _=1<<l-1;for(let n=0;n<l;n+=1){let i=0,h=k;for(;i<h;){f(e,{errors:n,currentLocation:d+h,expectedLocation:d,distance:r})<=g?i=h:k=h,h=Math.floor((k-i)/2+i)}k=h;let o=Math.max(1,d-h+1),m=c?u:Math.min(d+h,u)+l,v=Array(m+2);v[m+1]=(1<<n)-1;for(let i=m;i>=o;i-=1){let c=i-1,h=s[t.charAt(c)];if(h&&a&&(M[c]=1),v[i]=(v[i+1]<<1|1)&h,0!==n&&(v[i]|=(y[i+1]|y[i])<<1|1|y[i+1]),v[i]&_&&(x=f(e,{errors:n,currentLocation:c,expectedLocation:d,distance:r}),x<=g)){if(g=x,p=c,p<=d)break;o=Math.max(1,2*d-p)}}if(f(e,{errors:n+1,currentLocation:d,expectedLocation:d,distance:r})>g)break;y=v}let v={isMatch:p>=0,score:Math.max(.001,x)};return a&&(v.indices=function(t=[],e=h.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=t.length;i<c;i+=1){let c=t[i];c&&-1===n?n=i:c||-1===n||(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}(M,o)),v}function p(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}class M{constructor(t,{location:e=h.location,threshold:s=h.threshold,distance:n=h.distance,includeMatches:r=h.includeMatches,findAllMatches:i=h.findAllMatches,minMatchCharLength:c=h.minMatchCharLength,isCaseSensitive:o=h.isCaseSensitive}={}){this.options={location:e,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:o},this.pattern=o?t:t.toLowerCase(),this.chunks=[];let a=0;const l=this.pattern.length,u=l%32,d=l-u;for(;a<d;){const t=this.pattern.substr(a,32);this.chunks.push({pattern:t,alphabet:p(t)}),a+=32}if(u){const t=this.pattern.substr(l-32);this.chunks.push({pattern:t,alphabet:p(t)})}}searchIn(t){const{isCaseSensitive:e,includeMatches:s}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return s&&(e.indices=[[0,t.length-1]]),e}const{location:n,distance:r,threshold:i,findAllMatches:c,minMatchCharLength:h}=this.options;let o=[],a=0,l=!1;this.chunks.forEach(({pattern:e,alphabet:u},d)=>{const{isMatch:f,score:p,indices:M}=g(t,e,u,{location:n+32*d,distance:r,threshold:i,findAllMatches:c,minMatchCharLength:h,includeMatches:s});f&&(l=!0),a+=p,f&&M&&(o=[...o,...M])});let u={isMatch:l,score:l?a/this.chunks.length:1};return l&&s&&(u.indices=o),u}}class m{constructor(t){this.pattern=t}static isMultiMatch(t){return y(t,this.multiRegex)}static isSingleMatch(t){return y(t,this.singleRegex)}search(){}}function y(t,e){const s=t.match(e);return s?s[1]:null}class x extends m{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,s=0;const n=[],r=this.pattern.length;for(;(e=t.indexOf(this.pattern,s))>-1;)s=e+r,n.push([e,s-1]);const i=!!n.length;return{isMatch:i,score:i?1:0,indices:n}}}class k extends m{constructor(t,{location:e=h.location,threshold:s=h.threshold,distance:n=h.distance,includeMatches:r=h.includeMatches,findAllMatches:i=h.findAllMatches,minMatchCharLength:c=h.minMatchCharLength,isCaseSensitive:o=h.isCaseSensitive}={}){super(t),this._bitapSearch=new M(t,{location:e,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:o})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}const _=[x,class extends m{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},k],v=_.length,S=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;const C=new Set([k.type,x.type]);class L{constructor(t,{isCaseSensitive:e=h.isCaseSensitive,includeMatches:s=h.includeMatches,minMatchCharLength:n=h.minMatchCharLength,findAllMatches:r=h.findAllMatches,location:i=h.location,threshold:c=h.threshold,distance:o=h.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:n,findAllMatches:r,location:i,threshold:c,distance:o},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map(t=>{let s=t.trim().split(S).filter(t=>t&&!!t.trim()),n=[];for(let t=0,r=s.length;t<r;t+=1){const r=s[t];let i=!1,c=-1;for(;!i&&++c<v;){const t=_[c];let s=t.isMultiMatch(r);s&&(n.push(new t(s,e)),i=!0)}if(!i)for(c=-1;++c<v;){const t=_[c];let s=t.isSingleMatch(r);if(s){n.push(new t(s,e));break}}}return n})}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:n}=this.options;t=n?t:t.toLowerCase();let r=0,i=[],c=0;for(let n=0,h=e.length;n<h;n+=1){const h=e[n];i.length=0,r=0;for(let e=0,n=h.length;e<n;e+=1){const n=h[e],{isMatch:o,indices:a,score:l}=n.search(t);if(!o){c=0,r=0,i.length=0;break}if(r+=1,c+=l,s){const t=n.constructor.type;C.has(t)?i=[...i,...a]:i.push(a)}}if(r){let t={isMatch:!0,score:c/r};return s&&(t.indices=i),t}}return{isMatch:!1,score:1}}}const w=[];function $(t,e){for(let s=0,n=w.length;s<n;s+=1){let n=w[s];if(n.condition(t,e))return new n(t,e)}return new M(t,e)}const b="$and",A="$or",E=t=>!(!t[b]&&!t[A]),I=t=>({[b]:Object.keys(t).map(e=>({[e]:t[e]}))});function O(s,n,{auto:r=!0}={}){const i=s=>{let c=Object.keys(s);if(c.length>1&&!E(s))return i(I(s));let h=c[0];if((e=>!t(e)&&"object"==typeof e&&!E(e))(s)){const t=s[h];if(!e(t))throw new Error((t=>`Invalid value for key ${t}`)(h));const i={key:h,pattern:t};return r&&(i.searcher=$(t,n)),i}let o={children:[],operator:h};return c.forEach(e=>{const n=s[e];t(n)&&n.forEach(t=>{o.children.push(i(t))})}),o};return E(s)||(s=I(s)),i(s)}class R{constructor(t,e={},s){this.options={...h,...e},this.options.useExtendedSearch,this._keyStore=new c(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof a))throw new Error("Incorrect 'index' type");this._myIndex=e||l(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}add(t){n(t)&&(this._docs.push(t),this._myIndex.add(t))}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:n=-1}={}){const{includeMatches:r,includeScore:i,shouldSort:c,sortFn:o}=this.options;let a=e(t)?e(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,e){t.forEach(t=>{let s=1;t.matches.forEach(({key:t,norm:n,score:r})=>{const i=e.get(t,"weight");s*=Math.pow(0===r&&i?Number.EPSILON:r,(i||1)*n)}),t.score=s})}(a,this._keyStore),c&&a.sort(o),s(n)&&n>-1&&(a=a.slice(0,n)),function(t,e,{includeMatches:s=h.includeMatches,includeScore:n=h.includeScore}={}){const r=[];s&&r.push(u);n&&r.push(d);return t.map(t=>{const{idx:s}=t,n={item:e[s],refIndex:s};return r.length&&r.forEach(e=>{e(t,n)}),n})}(a,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(t){const e=$(t,this.options),{records:s}=this._myIndex,r=[];return s.forEach(({v:t,i:s,n:i})=>{if(!n(t))return;const{isMatch:c,score:h,indices:o}=e.searchIn(t);c&&r.push({item:t,idx:s,matches:[{score:h,value:t,norm:i,indices:o}]})}),r}_searchLogical(t){const e=O(t,this.options),{keys:s,records:r}=this._myIndex,i={},c=[],h=(t,e,n)=>{if(!t.children){const{key:n,searcher:r}=t,i=e[s.indexOf(n)];return this._findMatches({key:n,value:i,searcher:r})}{const s=t.operator;let r=[];for(let i=0;i<t.children.length;i+=1){let c=t.children[i],o=h(c,e,n);if(o&&o.length){if(r.push({idx:n,item:e,matches:o}),s===A)break}else if(s===b){r.length=0;break}}r.length&&(i[n]||(i[n]={idx:n,item:e,matches:[]},c.push(i[n])),r.forEach(({matches:t})=>{i[n].matches.push(...t)}))}};return r.forEach(({$:t,i:s})=>{n(t)&&h(e,t,s)}),c}_searchObjectList(t){const e=$(t,this.options),{keys:s,records:r}=this._myIndex,i=[];return r.forEach(({$:t,i:r})=>{if(!n(t))return;let c=[];s.forEach((s,n)=>{c.push(...this._findMatches({key:s,value:t[n],searcher:e}))}),c.length&&i.push({idx:r,item:t,matches:c})}),i}_findMatches({key:e,value:s,searcher:r}){if(!n(s))return[];let i=[];if(t(s))s.forEach(({v:t,i:s,n:c})=>{if(!n(t))return;const{isMatch:h,score:o,indices:a}=r.searchIn(t);h&&i.push({score:o,key:e,value:t,idx:s,norm:c,indices:a})});else{const{v:t,n:n}=s,{isMatch:c,score:h,indices:o}=r.searchIn(t);c&&i.push({score:h,key:e,value:t,norm:n,indices:o})}return i}}R.version="6.0.2",R.createIndex=l,R.parseIndex=function(t,{getFn:e=h.getFn}={}){const{keys:s,records:n}=t;let r=new a({getFn:e});return r.setKeys(s),r.setRecords(n),r},R.config=h,function(...t){w.push(...t)}(L);export default R; | ||
function t(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function e(t){return"string"==typeof t}function s(t){return"number"==typeof t}function n(t){return null!=t}function r(t){return!t.trim().length}const i=Object.prototype.hasOwnProperty;class c{constructor(t){this._keys={},this._keyNames=[];let s=0;t.forEach(t=>{let n,r=1;if(e(t))n=t;else{if(!i.call(t,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=t.name,i.call(t,"weight")&&(r=t.weight,r<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:r},s+=r}),this._keyNames.forEach(t=>{this._keys[t].weight/=s})}get(t,e){return this._keys[t]&&this._keys[t][e]}keys(){return this._keyNames}toJSON(){return JSON.stringify(this._keys)}}var h={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(r,i){let c=[],h=!1;const o=(r,i)=>{if(i){const a=i.indexOf(".");let l=i,u=null;-1!==a&&(l=i.slice(0,a),u=i.slice(a+1));const d=r[l];if(!n(d))return;if(u||!e(d)&&!s(d))if(t(d)){h=!0;for(let t=0,e=d.length;t<e;t+=1)o(d[t],u)}else u&&o(d,u);else c.push(function(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}(d))}else c.push(r)};return o(r,i),h?c:c[0]}}};const o=/[^ ]+/g;class a{constructor({getFn:t=h.getFn}={}){this.norm=function(t=3){const e=new Map;return{get(s){const n=s.match(o).length;if(e.has(n))return e.get(n);const r=parseFloat((1/Math.sqrt(n)).toFixed(t));return e.set(n,r),r},clear(){e.clear()}}}(3),this.getFn=t,this.isCreated=!1,this.setRecords()}setCollection(t=[]){this.docs=t}setRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,e(this.docs[0])?this.docs.forEach((t,e)=>{this._addString(t,e)}):this.docs.forEach((t,e)=>{this._addObject(t,e)}),this.norm.clear())}add(t){const s=this.size();e(t)?this._addString(t,s):this._addObject(t,s)}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e<s;e+=1)this.records[e].i-=1}size(){return this.records.length}_addString(t,e){if(!n(t)||r(t))return;let s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(s,i){let c={i:i,$:{}};this.keys.forEach((i,h)=>{let o=this.getFn(s,i);if(n(o))if(t(o)){let s=[];const i=[{nestedArrIndex:-1,value:o}];for(;i.length;){const{nestedArrIndex:c,value:h}=i.pop();if(n(h))if(e(h)&&!r(h)){let t={v:h,i:c,n:this.norm.get(h)};s.push(t)}else t(h)&&h.forEach((t,e)=>{i.push({nestedArrIndex:e,value:t})})}c.$[h]=s}else if(!r(o)){let t={v:o,n:this.norm.get(o)};c.$[h]=t}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function l(t,e,{getFn:s=h.getFn}={}){let n=new a({getFn:s});return n.setKeys(t),n.setCollection(e),n.create(),n}function u(t,e){const s=t.matches;e.matches=[],n(s)&&s.forEach(t=>{if(!n(t.indices)||!t.indices.length)return;const{indices:s,value:r}=t;let i={indices:s,value:r};t.key&&(i.key=t.key),t.idx>-1&&(i.refIndex=t.idx),e.matches.push(i)})}function d(t,e){e.score=t.score}function f(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=h.distance}={}){const i=e/t.length,c=Math.abs(n-s);return r?i+c/r:c?1:i}function g(t,e,s,{location:n=h.location,distance:r=h.distance,threshold:i=h.threshold,findAllMatches:c=h.findAllMatches,minMatchCharLength:o=h.minMatchCharLength,includeMatches:a=h.includeMatches}={}){if(e.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const l=e.length,u=t.length,d=Math.max(0,Math.min(n,u));let g=i,p=d;const M=[];if(a)for(let t=0;t<u;t+=1)M[t]=0;let m;for(;(m=t.indexOf(e,p))>-1;){let t=f(e,{currentLocation:m,expectedLocation:d,distance:r});if(g=Math.min(t,g),p=m+l,a){let t=0;for(;t<l;)M[m+t]=1,t+=1}}p=-1;let x=[],y=1,k=l+u;const _=1<<l-1;for(let n=0;n<l;n+=1){let i=0,h=k;for(;i<h;){f(e,{errors:n,currentLocation:d+h,expectedLocation:d,distance:r})<=g?i=h:k=h,h=Math.floor((k-i)/2+i)}k=h;let o=Math.max(1,d-h+1),m=c?u:Math.min(d+h,u)+l,v=Array(m+2);v[m+1]=(1<<n)-1;for(let i=m;i>=o;i-=1){let c=i-1,h=s[t.charAt(c)];if(h&&a&&(M[c]=1),v[i]=(v[i+1]<<1|1)&h,0!==n&&(v[i]|=(x[i+1]|x[i])<<1|1|x[i+1]),v[i]&_&&(y=f(e,{errors:n,currentLocation:c,expectedLocation:d,distance:r}),y<=g)){if(g=y,p=c,p<=d)break;o=Math.max(1,2*d-p)}}if(f(e,{errors:n+1,currentLocation:d,expectedLocation:d,distance:r})>g)break;x=v}let v={isMatch:p>=0,score:Math.max(.001,y)};return a&&(v.indices=function(t=[],e=h.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=t.length;i<c;i+=1){let c=t[i];c&&-1===n?n=i:c||-1===n||(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}(M,o)),v}function p(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}class M{constructor(t,{location:e=h.location,threshold:s=h.threshold,distance:n=h.distance,includeMatches:r=h.includeMatches,findAllMatches:i=h.findAllMatches,minMatchCharLength:c=h.minMatchCharLength,isCaseSensitive:o=h.isCaseSensitive}={}){this.options={location:e,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:o},this.pattern=o?t:t.toLowerCase(),this.chunks=[];const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:p(t),startIndex:e})},l=this.pattern.length;if(l>32){let t=0;const e=l%32,s=l-e;for(;t<s;)a(this.pattern.substr(t,32),t),t+=32;if(e){const t=l-32;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:s}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return s&&(e.indices=[[0,t.length-1]]),e}const{location:n,distance:r,threshold:i,findAllMatches:c,minMatchCharLength:h}=this.options;let o=[],a=0,l=!1;this.chunks.forEach(({pattern:e,alphabet:u,startIndex:d})=>{const{isMatch:f,score:p,indices:M}=g(t,e,u,{location:n+d,distance:r,threshold:i,findAllMatches:c,minMatchCharLength:h,includeMatches:s});f&&(l=!0),a+=p,f&&M&&(o=[...o,...M])});let u={isMatch:l,score:l?a/this.chunks.length:1};return l&&s&&(u.indices=o),u}}class m{constructor(t){this.pattern=t}static isMultiMatch(t){return x(t,this.multiRegex)}static isSingleMatch(t){return x(t,this.singleRegex)}search(){}}function x(t,e){const s=t.match(e);return s?s[1]:null}class y extends m{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,s=0;const n=[],r=this.pattern.length;for(;(e=t.indexOf(this.pattern,s))>-1;)s=e+r,n.push([e,s-1]);const i=!!n.length;return{isMatch:i,score:i?1:0,indices:n}}}class k extends m{constructor(t,{location:e=h.location,threshold:s=h.threshold,distance:n=h.distance,includeMatches:r=h.includeMatches,findAllMatches:i=h.findAllMatches,minMatchCharLength:c=h.minMatchCharLength,isCaseSensitive:o=h.isCaseSensitive}={}){super(t),this._bitapSearch=new M(t,{location:e,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:o})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}const _=[y,class extends m{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends m{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},k],v=_.length,S=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;const C=new Set([k.type,y.type]);class L{constructor(t,{isCaseSensitive:e=h.isCaseSensitive,includeMatches:s=h.includeMatches,minMatchCharLength:n=h.minMatchCharLength,findAllMatches:r=h.findAllMatches,location:i=h.location,threshold:c=h.threshold,distance:o=h.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:n,findAllMatches:r,location:i,threshold:c,distance:o},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map(t=>{let s=t.trim().split(S).filter(t=>t&&!!t.trim()),n=[];for(let t=0,r=s.length;t<r;t+=1){const r=s[t];let i=!1,c=-1;for(;!i&&++c<v;){const t=_[c];let s=t.isMultiMatch(r);s&&(n.push(new t(s,e)),i=!0)}if(!i)for(c=-1;++c<v;){const t=_[c];let s=t.isSingleMatch(r);if(s){n.push(new t(s,e));break}}}return n})}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:n}=this.options;t=n?t:t.toLowerCase();let r=0,i=[],c=0;for(let n=0,h=e.length;n<h;n+=1){const h=e[n];i.length=0,r=0;for(let e=0,n=h.length;e<n;e+=1){const n=h[e],{isMatch:o,indices:a,score:l}=n.search(t);if(!o){c=0,r=0,i.length=0;break}if(r+=1,c+=l,s){const t=n.constructor.type;C.has(t)?i=[...i,...a]:i.push(a)}}if(r){let t={isMatch:!0,score:c/r};return s&&(t.indices=i),t}}return{isMatch:!1,score:1}}}const w=[];function $(t,e){for(let s=0,n=w.length;s<n;s+=1){let n=w[s];if(n.condition(t,e))return new n(t,e)}return new M(t,e)}const A="$and",E="$or",b=t=>!(!t[A]&&!t[E]),I=t=>({[A]:Object.keys(t).map(e=>({[e]:t[e]}))});function O(s,n,{auto:r=!0}={}){const i=s=>{let c=Object.keys(s);if(c.length>1&&!b(s))return i(I(s));let h=c[0];if((e=>!t(e)&&"object"==typeof e&&!b(e))(s)){const t=s[h];if(!e(t))throw new Error((t=>`Invalid value for key ${t}`)(h));const i={key:h,pattern:t};return r&&(i.searcher=$(t,n)),i}let o={children:[],operator:h};return c.forEach(e=>{const n=s[e];t(n)&&n.forEach(t=>{o.children.push(i(t))})}),o};return b(s)||(s=I(s)),i(s)}class R{constructor(t,e={},s){this.options={...h,...e},this.options.useExtendedSearch,this._keyStore=new c(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof a))throw new Error("Incorrect 'index' type");this._myIndex=e||l(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}add(t){n(t)&&(this._docs.push(t),this._myIndex.add(t))}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:n=-1}={}){const{includeMatches:r,includeScore:i,shouldSort:c,sortFn:o}=this.options;let a=e(t)?e(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,e){t.forEach(t=>{let s=1;t.matches.forEach(({key:t,norm:n,score:r})=>{const i=e.get(t,"weight");s*=Math.pow(0===r&&i?Number.EPSILON:r,(i||1)*n)}),t.score=s})}(a,this._keyStore),c&&a.sort(o),s(n)&&n>-1&&(a=a.slice(0,n)),function(t,e,{includeMatches:s=h.includeMatches,includeScore:n=h.includeScore}={}){const r=[];s&&r.push(u);n&&r.push(d);return t.map(t=>{const{idx:s}=t,n={item:e[s],refIndex:s};return r.length&&r.forEach(e=>{e(t,n)}),n})}(a,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(t){const e=$(t,this.options),{records:s}=this._myIndex,r=[];return s.forEach(({v:t,i:s,n:i})=>{if(!n(t))return;const{isMatch:c,score:h,indices:o}=e.searchIn(t);c&&r.push({item:t,idx:s,matches:[{score:h,value:t,norm:i,indices:o}]})}),r}_searchLogical(t){const e=O(t,this.options),{keys:s,records:r}=this._myIndex,i={},c=[],h=(t,e,n)=>{if(!t.children){const{key:n,searcher:r}=t,i=e[s.indexOf(n)];return this._findMatches({key:n,value:i,searcher:r})}{const s=t.operator;let r=[];for(let i=0;i<t.children.length;i+=1){let c=t.children[i],o=h(c,e,n);if(o&&o.length){if(r.push({idx:n,item:e,matches:o}),s===E)break}else if(s===A){r.length=0;break}}r.length&&(i[n]||(i[n]={idx:n,item:e,matches:[]},c.push(i[n])),r.forEach(({matches:t})=>{i[n].matches.push(...t)}))}};return r.forEach(({$:t,i:s})=>{n(t)&&h(e,t,s)}),c}_searchObjectList(t){const e=$(t,this.options),{keys:s,records:r}=this._myIndex,i=[];return r.forEach(({$:t,i:r})=>{if(!n(t))return;let c=[];s.forEach((s,n)=>{c.push(...this._findMatches({key:s,value:t[n],searcher:e}))}),c.length&&i.push({idx:r,item:t,matches:c})}),i}_findMatches({key:e,value:s,searcher:r}){if(!n(s))return[];let i=[];if(t(s))s.forEach(({v:t,i:s,n:c})=>{if(!n(t))return;const{isMatch:h,score:o,indices:a}=r.searchIn(t);h&&i.push({score:o,key:e,value:t,idx:s,norm:c,indices:a})});else{const{v:t,n:n}=s,{isMatch:c,score:h,indices:o}=r.searchIn(t);c&&i.push({score:h,key:e,value:t,norm:n,indices:o})}return i}}R.version="6.0.3",R.createIndex=l,R.parseIndex=function(t,{getFn:e=h.getFn}={}){const{keys:s,records:n}=t;let r=new a({getFn:e});return r.setKeys(s),r.setRecords(n),r},R.config=h,function(...t){w.push(...t)}(L);export default R; |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -913,2 +913,4 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
function BitapSearch(pattern) { | ||
var _this = this; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
@@ -943,24 +945,29 @@ _ref$location = _ref.location, | ||
this.chunks = []; | ||
var i = 0; | ||
var addChunk = function addChunk(pattern, startIndex) { | ||
_this.chunks.push({ | ||
pattern: pattern, | ||
alphabet: createPatternAlphabet(pattern), | ||
startIndex: startIndex | ||
}); | ||
}; | ||
var len = this.pattern.length; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
while (i < end) { | ||
var _pattern = this.pattern.substr(i, MAX_BITS); | ||
if (len > MAX_BITS) { | ||
var i = 0; | ||
var remainder = len % MAX_BITS; | ||
var end = len - remainder; | ||
this.chunks.push({ | ||
pattern: _pattern, | ||
alphabet: createPatternAlphabet(_pattern) | ||
}); | ||
i += MAX_BITS; | ||
} | ||
while (i < end) { | ||
addChunk(this.pattern.substr(i, MAX_BITS), i); | ||
i += MAX_BITS; | ||
} | ||
if (remainder) { | ||
var _pattern2 = this.pattern.substr(len - MAX_BITS); | ||
this.chunks.push({ | ||
pattern: _pattern2, | ||
alphabet: createPatternAlphabet(_pattern2) | ||
}); | ||
if (remainder) { | ||
var startIndex = len - MAX_BITS; | ||
addChunk(this.pattern.substr(startIndex), startIndex); | ||
} | ||
} else { | ||
addChunk(this.pattern, 0); | ||
} | ||
@@ -1004,8 +1011,9 @@ } | ||
var hasMatches = false; | ||
this.chunks.forEach(function (_ref2, i) { | ||
this.chunks.forEach(function (_ref2) { | ||
var pattern = _ref2.pattern, | ||
alphabet = _ref2.alphabet; | ||
alphabet = _ref2.alphabet, | ||
startIndex = _ref2.startIndex; | ||
var _search = search(text, pattern, alphabet, { | ||
location: location + MAX_BITS * i, | ||
location: location + startIndex, | ||
distance: distance, | ||
@@ -2042,3 +2050,3 @@ threshold: threshold, | ||
Fuse.version = '6.0.2'; | ||
Fuse.version = '6.0.3'; | ||
Fuse.createIndex = createIndex; | ||
@@ -2045,0 +2053,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.0.2 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.0.3 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -9,2 +9,2 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
*/ | ||
var e,t;e=this,t=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return function(){var t,n=a(e);if(h()){var r=a(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return f(this,t)}}function d(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function p(e){return"string"==typeof e}function g(e){return"number"==typeof e}function m(e){return null!=e}function k(e){return!e.trim().length}var M=function(e){return"Invalid value for key ".concat(e)},b=function(e){return"Pattern length exceeds max of ".concat(e,".")},x=Object.prototype.hasOwnProperty,S=function(){function e(n){var r=this;t(this,e),this._keys={},this._keyNames=[];var i=0;n.forEach((function(e){var t,n=1;if(p(e))t=e;else{if(!x.call(e,"name"))throw new Error("Missing ".concat("name"," property in key"));if(t=e.name,x.call(e,"weight")&&(n=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(t))}r._keyNames.push(t),r._keys[t]={weight:n},i+=n})),this._keyNames.forEach((function(e){r._keys[e].weight/=i}))}return r(e,[{key:"get",value:function(e,t){return this._keys[e]&&this._keys[e][t]}},{key:"keys",value:function(){return this._keyNames}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}(),_=c({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return 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},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i){if(i){var o=i.indexOf("."),c=i,s=null;-1!==o&&(c=i.slice(0,o),s=i.slice(o+1));var a=t[c];if(!m(a))return;if(s||!p(a)&&!g(a))if(y(a)){r=!0;for(var u=0,h=a.length;u<h;u+=1)e(a[u],s)}else s&&e(a,s);else n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(a))}else n.push(t)}(e,t),r?n:n[0]}}),w=/[^ ]+/g;function O(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(w).length;if(t.has(r))return t.get(r);var i=parseFloat((1/Math.sqrt(r)).toFixed(e));return t.set(r,i),i},clear:function(){t.clear()}}}var C=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?_.getFn:r;t(this,e),this.norm=O(3),this.getFn=i,this.isCreated=!1,this.setRecords()}return r(e,[{key:"setCollection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=e}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,p(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();p(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){if(m(e)&&!k(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:"_addObject",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,i){var o=n.getFn(e,t);if(m(o))if(y(o))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:o}];t.length;){var c=t.pop(),s=c.nestedArrIndex,a=c.value;if(m(a))if(p(a)&&!k(a)){var u={v:a,i:s,n:n.norm.get(a)};e.push(u)}else y(a)&&a.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[i]=e}();else if(!k(o)){var c={v:o,n:n.norm.get(o)};r.$[i]=c}})),this.records.push(r)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),e}();function L(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?_.getFn:r,o=new C({getFn:i});return o.setKeys(e),o.setCollection(t),o.create(),o}function j(e,t){var n=e.matches;t.matches=[],m(n)&&n.forEach((function(e){if(m(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function A(e,t){t.score=e.score}function E(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,c=t.expectedLocation,s=void 0===c?0:c,a=t.distance,u=void 0===a?_.distance:a,h=r/e.length,f=Math.abs(s-o);return u?h+f/u:f?1:h}function I(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o<c;o+=1){var s=e[o];s&&-1===r?r=o:s||-1===r||((i=o-1)-r+1>=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function $(e){for(var t={},n=0,r=e.length;n<r;n+=1){var i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}var R=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.location,o=void 0===i?_.location:i,c=r.threshold,s=void 0===c?_.threshold:c,a=r.distance,u=void 0===a?_.distance:a,h=r.includeMatches,f=void 0===h?_.includeMatches:h,l=r.findAllMatches,d=void 0===l?_.findAllMatches:l,v=r.minMatchCharLength,y=void 0===v?_.minMatchCharLength:v,p=r.isCaseSensitive,g=void 0===p?_.isCaseSensitive:p;t(this,e),this.options={location:o,threshold:s,distance:u,includeMatches:f,findAllMatches:d,minMatchCharLength:y,isCaseSensitive:g},this.pattern=g?n:n.toLowerCase(),this.chunks=[];for(var m=0,k=this.pattern.length,M=k%32,b=k-M;m<b;){var x=this.pattern.substr(m,32);this.chunks.push({pattern:x,alphabet:$(x)}),m+=32}if(M){var S=this.pattern.substr(k-32);this.chunks.push({pattern:S,alphabet:$(S)})}}return r(e,[{key:"searchIn",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var i={isMatch:!0,score:0};return r&&(i.indices=[[0,e.length-1]]),i}var o=this.options,c=o.location,s=o.distance,a=o.threshold,u=o.findAllMatches,h=o.minMatchCharLength,f=[],l=0,v=!1;this.chunks.forEach((function(t,n){var i=t.pattern,o=t.alphabet,y=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?_.location:i,c=r.distance,s=void 0===c?_.distance:c,a=r.threshold,u=void 0===a?_.threshold:a,h=r.findAllMatches,f=void 0===h?_.findAllMatches:h,l=r.minMatchCharLength,d=void 0===l?_.minMatchCharLength:l,v=r.includeMatches,y=void 0===v?_.includeMatches:v;if(t.length>32)throw new Error(b(32));var p,g=t.length,m=e.length,k=Math.max(0,Math.min(o,m)),M=u,x=k,S=[];if(y)for(var w=0;w<m;w+=1)S[w]=0;for(;(p=e.indexOf(t,x))>-1;){var O=E(t,{currentLocation:p,expectedLocation:k,distance:s});if(M=Math.min(O,M),x=p+g,y)for(var C=0;C<g;)S[p+C]=1,C+=1}x=-1;for(var L=[],j=1,A=g+m,$=1<<g-1,R=0;R<g;R+=1){for(var P=0,F=A;P<F;){var N=E(t,{errors:R,currentLocation:k+F,expectedLocation:k,distance:s});N<=M?P=F:A=F,F=Math.floor((A-P)/2+P)}A=F;var D=Math.max(1,k-F+1),z=f?m:Math.min(k+F,m)+g,q=Array(z+2);q[z+1]=(1<<R)-1;for(var W=z;W>=D;W-=1){var J=W-1,K=n[e.charAt(J)];if(K&&y&&(S[J]=1),q[W]=(q[W+1]<<1|1)&K,0!==R&&(q[W]|=(L[W+1]|L[W])<<1|1|L[W+1]),q[W]&$&&(j=E(t,{errors:R,currentLocation:J,expectedLocation:k,distance:s}))<=M){if(M=j,(x=J)<=k)break;D=Math.max(1,2*k-x)}}var T=E(t,{errors:R+1,currentLocation:k,expectedLocation:k,distance:s});if(T>M)break;L=q}var U={isMatch:x>=0,score:Math.max(.001,j)};return y&&(U.indices=I(S,d)),U}(e,i,o,{location:c+32*n,distance:s,threshold:a,findAllMatches:u,minMatchCharLength:h,includeMatches:r}),p=y.isMatch,g=y.score,m=y.indices;p&&(v=!0),l+=g,p&&m&&(f=[].concat(d(f),d(m)))}));var y={isMatch:v,score:v?l/this.chunks.length:1};return v&&r&&(y.indices=f),y}}]),e}(),P=function(){function e(n){t(this,e),this.pattern=n}return r(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return F(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return F(e,this.singleRegex)}}]),e}();function F(e,t){var n=e.match(t);return n?n[1]:null}var N=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){for(var t,n=0,r=[],i=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,r.push([t,n-1]);var o=!!r.length;return{isMatch:o,score:o?1:0,indices:r}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),i}(P),D=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),i}(P),z=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),i}(P),q=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),i}(P),W=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),i}(P),J=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),i}(P),K=function(e){s(i,e);var n=l(i);function i(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,s=void 0===c?_.location:c,a=o.threshold,u=void 0===a?_.threshold:a,h=o.distance,f=void 0===h?_.distance:h,l=o.includeMatches,d=void 0===l?_.includeMatches:l,v=o.findAllMatches,y=void 0===v?_.findAllMatches:v,p=o.minMatchCharLength,g=void 0===p?_.minMatchCharLength:p,m=o.isCaseSensitive,k=void 0===m?_.isCaseSensitive:m;return t(this,i),(r=n.call(this,e))._bitapSearch=new R(e,{location:s,threshold:u,distance:f,includeMatches:d,findAllMatches:y,minMatchCharLength:g,isCaseSensitive:k}),r}return r(i,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),i}(P),T=[N,z,q,J,W,D,K],U=T.length,B=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function G(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(B).filter((function(e){return e&&!!e.trim()})),r=[],i=0,o=n.length;i<o;i+=1){for(var c=n[i],s=!1,a=-1;!s&&++a<U;){var u=T[a],h=u.isMultiMatch(c);h&&(r.push(new u(h,t)),s=!0)}if(!s)for(a=-1;++a<U;){var f=T[a],l=f.isSingleMatch(c);if(l){r.push(new f(l,t));break}}}return r}))}var H=new Set([K.type,N.type]),Q=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.isCaseSensitive,o=void 0===i?_.isCaseSensitive:i,c=r.includeMatches,s=void 0===c?_.includeMatches:c,a=r.minMatchCharLength,u=void 0===a?_.minMatchCharLength:a,h=r.findAllMatches,f=void 0===h?_.findAllMatches:h,l=r.location,d=void 0===l?_.location:l,v=r.threshold,y=void 0===v?_.threshold:v,p=r.distance,g=void 0===p?_.distance:p;t(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:s,minMatchCharLength:u,findAllMatches:f,location:d,threshold:y,distance:g},this.pattern=o?n:n.toLowerCase(),this.query=G(this.pattern,this.options)}return r(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches;e=n.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],c=0,s=0,a=t.length;s<a;s+=1){var u=t[s];o.length=0,i=0;for(var h=0,f=u.length;h<f;h+=1){var l=u[h],v=l.search(e),y=v.isMatch,p=v.indices,g=v.score;if(!y){c=0,i=0,o.length=0;break}if(i+=1,c+=g,r){var m=l.constructor.type;H.has(m)?o=[].concat(d(o),d(p)):o.push(p)}}if(i){var k={isMatch:!0,score:c/i};return r&&(k.indices=o),k}}return{isMatch:!1,score:1}}}],[{key:"condition",value:function(e,t){return t.useExtendedSearch}}]),e}(),V=[];function X(e,t){for(var n=0,r=V.length;n<r;n+=1){var i=V[n];if(i.condition(e,t))return new i(e,t)}return new R(e,t)}var Y="$and",Z="$or",ee=function(e){return!(!e[Y]&&!e[Z])},te=function(t){return!y(t)&&"object"===e(t)&&!ee(t)},ne=function(e){return i({},Y,Object.keys(e).map((function(t){return i({},t,e[t])})))},re=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;t(this,e),this.options=c({},_,{},r),this.options.useExtendedSearch,this._keyStore=new S(this.options.keys),this.setCollection(n,i)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof C))throw new Error("Incorrect 'index' type");this._myIndex=t||L(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){m(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,c=i.includeScore,s=i.shouldSort,a=i.sortFn,u=p(e)?p(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return ie(u,this._keyStore),s&&u.sort(a),g(r)&&r>-1&&(u=u.slice(0,r)),oe(u,this._docs,{includeMatches:o,includeScore:c})}},{key:"_searchStringList",value:function(e){var t=X(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(m(n)){var c=t.searchIn(n),s=c.isMatch,a=c.score,u=c.indices;s&&r.push({item:n,idx:i,matches:[{score:a,value:n,norm:o,indices:u}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.auto,i=void 0===r||r,o=function e(n){var r=Object.keys(n);if(r.length>1&&!ee(n))return e(ne(n));var o=r[0];if(te(n)){var c=n[o];if(!p(c))throw new Error(M(o));var s={key:o,pattern:c};return i&&(s.searcher=X(c,t)),s}var a={children:[],operator:o};return r.forEach((function(t){var r=n[t];y(r)&&r.forEach((function(t){a.children.push(e(t))}))})),a};return ee(e)||(e=ne(e)),o(e)}(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c={},s=[];return o.forEach((function(e){var r=e.$,o=e.i;m(r)&&function e(n,r,o){if(!n.children){var a=n.key,u=n.searcher,h=r[i.indexOf(a)];return t._findMatches({key:a,value:h,searcher:u})}for(var f=n.operator,l=[],v=0;v<n.children.length;v+=1){var y=e(n.children[v],r,o);if(y&&y.length){if(l.push({idx:o,item:r,matches:y}),f===Z)break}else if(f===Y){l.length=0;break}}l.length&&(c[o]||(c[o]={idx:o,item:r,matches:[]},s.push(c[o])),l.forEach((function(e){var t,n=e.matches;(t=c[o].matches).push.apply(t,d(n))})))}(n,r,o)})),s}},{key:"_searchObjectList",value:function(e){var t=this,n=X(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c=[];return o.forEach((function(e){var r=e.$,o=e.i;if(m(r)){var s=[];i.forEach((function(e,i){s.push.apply(s,d(t._findMatches({key:e,value:r[i],searcher:n})))})),s.length&&c.push({idx:o,item:r,matches:s})}})),c}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!m(n))return[];var i=[];if(y(n))n.forEach((function(e){var n=e.v,o=e.i,c=e.n;if(m(n)){var s=r.searchIn(n),a=s.isMatch,u=s.score,h=s.indices;a&&i.push({score:u,key:t,value:n,idx:o,norm:c,indices:h})}}));else{var o=n.v,c=n.n,s=r.searchIn(o),a=s.isMatch,u=s.score,h=s.indices;a&&i.push({score:u,key:t,value:o,norm:c,indices:h})}return i}}]),e}();function ie(e,t){e.forEach((function(e){var n=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,c=t.get(r,"weight");n*=Math.pow(0===o&&c?Number.EPSILON:o,(c||1)*i)})),e.score=n}))}function oe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?_.includeMatches:r,o=n.includeScore,c=void 0===o?_.includeScore:o,s=[];return i&&s.push(j),c&&s.push(A),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return s.length&&s.forEach((function(t){t(e,r)})),r}))}return re.version="6.0.2",re.createIndex=L,re.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?_.getFn:n,i=e.keys,o=e.records,c=new C({getFn:r});return c.setKeys(i),c.setRecords(o),c},re.config=_,function(){V.push.apply(V,arguments)}(Q),re},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); | ||
var e,t;e=this,t=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return function(){var t,n=a(e);if(h()){var r=a(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return f(this,t)}}function d(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function g(e){return"string"==typeof e}function p(e){return"number"==typeof e}function m(e){return null!=e}function k(e){return!e.trim().length}var M=function(e){return"Invalid value for key ".concat(e)},b=function(e){return"Pattern length exceeds max of ".concat(e,".")},x=Object.prototype.hasOwnProperty,S=function(){function e(n){var r=this;t(this,e),this._keys={},this._keyNames=[];var i=0;n.forEach((function(e){var t,n=1;if(g(e))t=e;else{if(!x.call(e,"name"))throw new Error("Missing ".concat("name"," property in key"));if(t=e.name,x.call(e,"weight")&&(n=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(t))}r._keyNames.push(t),r._keys[t]={weight:n},i+=n})),this._keyNames.forEach((function(e){r._keys[e].weight/=i}))}return r(e,[{key:"get",value:function(e,t){return this._keys[e]&&this._keys[e][t]}},{key:"keys",value:function(){return this._keyNames}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}(),_=c({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return 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},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i){if(i){var o=i.indexOf("."),c=i,s=null;-1!==o&&(c=i.slice(0,o),s=i.slice(o+1));var a=t[c];if(!m(a))return;if(s||!g(a)&&!p(a))if(y(a)){r=!0;for(var u=0,h=a.length;u<h;u+=1)e(a[u],s)}else s&&e(a,s);else n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(a))}else n.push(t)}(e,t),r?n:n[0]}}),w=/[^ ]+/g;function O(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(w).length;if(t.has(r))return t.get(r);var i=parseFloat((1/Math.sqrt(r)).toFixed(e));return t.set(r,i),i},clear:function(){t.clear()}}}var C=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?_.getFn:r;t(this,e),this.norm=O(3),this.getFn=i,this.isCreated=!1,this.setRecords()}return r(e,[{key:"setCollection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=e}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,g(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();g(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){if(m(e)&&!k(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:"_addObject",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,i){var o=n.getFn(e,t);if(m(o))if(y(o))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:o}];t.length;){var c=t.pop(),s=c.nestedArrIndex,a=c.value;if(m(a))if(g(a)&&!k(a)){var u={v:a,i:s,n:n.norm.get(a)};e.push(u)}else y(a)&&a.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[i]=e}();else if(!k(o)){var c={v:o,n:n.norm.get(o)};r.$[i]=c}})),this.records.push(r)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),e}();function L(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?_.getFn:r,o=new C({getFn:i});return o.setKeys(e),o.setCollection(t),o.create(),o}function j(e,t){var n=e.matches;t.matches=[],m(n)&&n.forEach((function(e){if(m(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function A(e,t){t.score=e.score}function E(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,c=t.expectedLocation,s=void 0===c?0:c,a=t.distance,u=void 0===a?_.distance:a,h=r/e.length,f=Math.abs(s-o);return u?h+f/u:f?1:h}function I(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o<c;o+=1){var s=e[o];s&&-1===r?r=o:s||-1===r||((i=o-1)-r+1>=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function $(e){for(var t={},n=0,r=e.length;n<r;n+=1){var i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}var R=function(){function e(n){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,c=void 0===o?_.location:o,s=i.threshold,a=void 0===s?_.threshold:s,u=i.distance,h=void 0===u?_.distance:u,f=i.includeMatches,l=void 0===f?_.includeMatches:f,d=i.findAllMatches,v=void 0===d?_.findAllMatches:d,y=i.minMatchCharLength,g=void 0===y?_.minMatchCharLength:y,p=i.isCaseSensitive,m=void 0===p?_.isCaseSensitive:p;t(this,e),this.options={location:c,threshold:a,distance:h,includeMatches:l,findAllMatches:v,minMatchCharLength:g,isCaseSensitive:m},this.pattern=m?n:n.toLowerCase(),this.chunks=[];var k=function(e,t){r.chunks.push({pattern:e,alphabet:$(e),startIndex:t})},M=this.pattern.length;if(M>32){for(var b=0,x=M%32,S=M-x;b<S;)k(this.pattern.substr(b,32),b),b+=32;if(x){var w=M-32;k(this.pattern.substr(w),w)}}else k(this.pattern,0)}return r(e,[{key:"searchIn",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var i={isMatch:!0,score:0};return r&&(i.indices=[[0,e.length-1]]),i}var o=this.options,c=o.location,s=o.distance,a=o.threshold,u=o.findAllMatches,h=o.minMatchCharLength,f=[],l=0,v=!1;this.chunks.forEach((function(t){var n=t.pattern,i=t.alphabet,o=t.startIndex,y=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?_.location:i,c=r.distance,s=void 0===c?_.distance:c,a=r.threshold,u=void 0===a?_.threshold:a,h=r.findAllMatches,f=void 0===h?_.findAllMatches:h,l=r.minMatchCharLength,d=void 0===l?_.minMatchCharLength:l,v=r.includeMatches,y=void 0===v?_.includeMatches:v;if(t.length>32)throw new Error(b(32));var g,p=t.length,m=e.length,k=Math.max(0,Math.min(o,m)),M=u,x=k,S=[];if(y)for(var w=0;w<m;w+=1)S[w]=0;for(;(g=e.indexOf(t,x))>-1;){var O=E(t,{currentLocation:g,expectedLocation:k,distance:s});if(M=Math.min(O,M),x=g+p,y)for(var C=0;C<p;)S[g+C]=1,C+=1}x=-1;for(var L=[],j=1,A=p+m,$=1<<p-1,R=0;R<p;R+=1){for(var P=0,F=A;P<F;){var N=E(t,{errors:R,currentLocation:k+F,expectedLocation:k,distance:s});N<=M?P=F:A=F,F=Math.floor((A-P)/2+P)}A=F;var D=Math.max(1,k-F+1),z=f?m:Math.min(k+F,m)+p,q=Array(z+2);q[z+1]=(1<<R)-1;for(var W=z;W>=D;W-=1){var J=W-1,K=n[e.charAt(J)];if(K&&y&&(S[J]=1),q[W]=(q[W+1]<<1|1)&K,0!==R&&(q[W]|=(L[W+1]|L[W])<<1|1|L[W+1]),q[W]&$&&(j=E(t,{errors:R,currentLocation:J,expectedLocation:k,distance:s}))<=M){if(M=j,(x=J)<=k)break;D=Math.max(1,2*k-x)}}var T=E(t,{errors:R+1,currentLocation:k,expectedLocation:k,distance:s});if(T>M)break;L=q}var U={isMatch:x>=0,score:Math.max(.001,j)};return y&&(U.indices=I(S,d)),U}(e,n,i,{location:c+o,distance:s,threshold:a,findAllMatches:u,minMatchCharLength:h,includeMatches:r}),g=y.isMatch,p=y.score,m=y.indices;g&&(v=!0),l+=p,g&&m&&(f=[].concat(d(f),d(m)))}));var y={isMatch:v,score:v?l/this.chunks.length:1};return v&&r&&(y.indices=f),y}}]),e}(),P=function(){function e(n){t(this,e),this.pattern=n}return r(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return F(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return F(e,this.singleRegex)}}]),e}();function F(e,t){var n=e.match(t);return n?n[1]:null}var N=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){for(var t,n=0,r=[],i=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,r.push([t,n-1]);var o=!!r.length;return{isMatch:o,score:o?1:0,indices:r}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),i}(P),D=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),i}(P),z=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),i}(P),q=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),i}(P),W=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),i}(P),J=function(e){s(i,e);var n=l(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),i}(P),K=function(e){s(i,e);var n=l(i);function i(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,s=void 0===c?_.location:c,a=o.threshold,u=void 0===a?_.threshold:a,h=o.distance,f=void 0===h?_.distance:h,l=o.includeMatches,d=void 0===l?_.includeMatches:l,v=o.findAllMatches,y=void 0===v?_.findAllMatches:v,g=o.minMatchCharLength,p=void 0===g?_.minMatchCharLength:g,m=o.isCaseSensitive,k=void 0===m?_.isCaseSensitive:m;return t(this,i),(r=n.call(this,e))._bitapSearch=new R(e,{location:s,threshold:u,distance:f,includeMatches:d,findAllMatches:y,minMatchCharLength:p,isCaseSensitive:k}),r}return r(i,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),i}(P),T=[N,z,q,J,W,D,K],U=T.length,B=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function G(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(B).filter((function(e){return e&&!!e.trim()})),r=[],i=0,o=n.length;i<o;i+=1){for(var c=n[i],s=!1,a=-1;!s&&++a<U;){var u=T[a],h=u.isMultiMatch(c);h&&(r.push(new u(h,t)),s=!0)}if(!s)for(a=-1;++a<U;){var f=T[a],l=f.isSingleMatch(c);if(l){r.push(new f(l,t));break}}}return r}))}var H=new Set([K.type,N.type]),Q=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.isCaseSensitive,o=void 0===i?_.isCaseSensitive:i,c=r.includeMatches,s=void 0===c?_.includeMatches:c,a=r.minMatchCharLength,u=void 0===a?_.minMatchCharLength:a,h=r.findAllMatches,f=void 0===h?_.findAllMatches:h,l=r.location,d=void 0===l?_.location:l,v=r.threshold,y=void 0===v?_.threshold:v,g=r.distance,p=void 0===g?_.distance:g;t(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:s,minMatchCharLength:u,findAllMatches:f,location:d,threshold:y,distance:p},this.pattern=o?n:n.toLowerCase(),this.query=G(this.pattern,this.options)}return r(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches;e=n.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],c=0,s=0,a=t.length;s<a;s+=1){var u=t[s];o.length=0,i=0;for(var h=0,f=u.length;h<f;h+=1){var l=u[h],v=l.search(e),y=v.isMatch,g=v.indices,p=v.score;if(!y){c=0,i=0,o.length=0;break}if(i+=1,c+=p,r){var m=l.constructor.type;H.has(m)?o=[].concat(d(o),d(g)):o.push(g)}}if(i){var k={isMatch:!0,score:c/i};return r&&(k.indices=o),k}}return{isMatch:!1,score:1}}}],[{key:"condition",value:function(e,t){return t.useExtendedSearch}}]),e}(),V=[];function X(e,t){for(var n=0,r=V.length;n<r;n+=1){var i=V[n];if(i.condition(e,t))return new i(e,t)}return new R(e,t)}var Y="$and",Z="$or",ee=function(e){return!(!e[Y]&&!e[Z])},te=function(t){return!y(t)&&"object"===e(t)&&!ee(t)},ne=function(e){return i({},Y,Object.keys(e).map((function(t){return i({},t,e[t])})))},re=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;t(this,e),this.options=c({},_,{},r),this.options.useExtendedSearch,this._keyStore=new S(this.options.keys),this.setCollection(n,i)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof C))throw new Error("Incorrect 'index' type");this._myIndex=t||L(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){m(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,c=i.includeScore,s=i.shouldSort,a=i.sortFn,u=g(e)?g(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return ie(u,this._keyStore),s&&u.sort(a),p(r)&&r>-1&&(u=u.slice(0,r)),oe(u,this._docs,{includeMatches:o,includeScore:c})}},{key:"_searchStringList",value:function(e){var t=X(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(m(n)){var c=t.searchIn(n),s=c.isMatch,a=c.score,u=c.indices;s&&r.push({item:n,idx:i,matches:[{score:a,value:n,norm:o,indices:u}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.auto,i=void 0===r||r,o=function e(n){var r=Object.keys(n);if(r.length>1&&!ee(n))return e(ne(n));var o=r[0];if(te(n)){var c=n[o];if(!g(c))throw new Error(M(o));var s={key:o,pattern:c};return i&&(s.searcher=X(c,t)),s}var a={children:[],operator:o};return r.forEach((function(t){var r=n[t];y(r)&&r.forEach((function(t){a.children.push(e(t))}))})),a};return ee(e)||(e=ne(e)),o(e)}(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c={},s=[];return o.forEach((function(e){var r=e.$,o=e.i;m(r)&&function e(n,r,o){if(!n.children){var a=n.key,u=n.searcher,h=r[i.indexOf(a)];return t._findMatches({key:a,value:h,searcher:u})}for(var f=n.operator,l=[],v=0;v<n.children.length;v+=1){var y=e(n.children[v],r,o);if(y&&y.length){if(l.push({idx:o,item:r,matches:y}),f===Z)break}else if(f===Y){l.length=0;break}}l.length&&(c[o]||(c[o]={idx:o,item:r,matches:[]},s.push(c[o])),l.forEach((function(e){var t,n=e.matches;(t=c[o].matches).push.apply(t,d(n))})))}(n,r,o)})),s}},{key:"_searchObjectList",value:function(e){var t=this,n=X(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c=[];return o.forEach((function(e){var r=e.$,o=e.i;if(m(r)){var s=[];i.forEach((function(e,i){s.push.apply(s,d(t._findMatches({key:e,value:r[i],searcher:n})))})),s.length&&c.push({idx:o,item:r,matches:s})}})),c}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!m(n))return[];var i=[];if(y(n))n.forEach((function(e){var n=e.v,o=e.i,c=e.n;if(m(n)){var s=r.searchIn(n),a=s.isMatch,u=s.score,h=s.indices;a&&i.push({score:u,key:t,value:n,idx:o,norm:c,indices:h})}}));else{var o=n.v,c=n.n,s=r.searchIn(o),a=s.isMatch,u=s.score,h=s.indices;a&&i.push({score:u,key:t,value:o,norm:c,indices:h})}return i}}]),e}();function ie(e,t){e.forEach((function(e){var n=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,c=t.get(r,"weight");n*=Math.pow(0===o&&c?Number.EPSILON:o,(c||1)*i)})),e.score=n}))}function oe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?_.includeMatches:r,o=n.includeScore,c=void 0===o?_.includeScore:o,s=[];return i&&s.push(j),c&&s.push(A),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return s.length&&s.forEach((function(t){t(e,r)})),r}))}return re.version="6.0.3",re.createIndex=L,re.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?_.getFn:n,i=e.keys,o=e.records,c=new C({getFn:r});return c.setKeys(i),c.setRecords(o),c},re.config=_,function(){V.push.apply(V,arguments)}(Q),re},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"description": "Lightweight fuzzy-search", | ||
@@ -19,0 +19,0 @@ "license": "Apache-2.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
342200
8181