Comparing version 6.1.0-alpha.0 to 6.1.0-alpha.1
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -116,3 +116,3 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
@@ -293,7 +293,7 @@ } | ||
var MatchOptions = { | ||
// Whether the matches should be included in the result set. When true, each record in the result | ||
// Whether the matches should be included in the result set. When `true`, each record in the result | ||
// set will include the indices of the matched characters. | ||
// These can consequently be used for highlighting purposes. | ||
includeMatches: false, | ||
// When true, the matching function will continue to the end of a search pattern even if | ||
// When `true`, the matching function will continue to the end of a search pattern even if | ||
// a perfect match has already been located in the string. | ||
@@ -305,3 +305,3 @@ findAllMatches: false, | ||
var BasicOptions = { | ||
// When true, the algorithm continues searching to the end of the input even if a perfect | ||
// When `true`, the algorithm continues searching to the end of the input even if a perfect | ||
// match is found before the end of the same input. | ||
@@ -331,11 +331,18 @@ isCaseSensitive: false, | ||
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. | ||
distance: 100, | ||
ignoreLocation: false | ||
distance: 100 | ||
}; | ||
var AdvancedOptions = { | ||
// When true, it enables the use of unix-like search commands | ||
// When `true`, it enables the use of unix-like search commands | ||
useExtendedSearch: false, | ||
// The get function to use when fetching an object's properties. | ||
// The default will search nested paths *ie foo.bar.baz* | ||
getFn: get | ||
getFn: get, | ||
// When `true`, search will ignore `location` and `distance`, so it won't matter | ||
// where in the string the pattern appears. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score | ||
ignoreLocation: false, | ||
// When `true`, the calculation for the relevance score (used for sorting) will | ||
// ignore the field-length norm. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm | ||
ignoreFieldNorm: false | ||
}; | ||
@@ -379,8 +386,8 @@ var Config = _objectSpread2({}, BasicOptions, {}, MatchOptions, {}, FuzzyOptions, {}, AdvancedOptions); | ||
this.isCreated = false; | ||
this.setRecords(); | ||
this.setIndexRecords(); | ||
} | ||
_createClass(FuseIndex, [{ | ||
key: "setCollection", | ||
value: function setCollection() { | ||
key: "setSources", | ||
value: function setSources() { | ||
var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -390,4 +397,4 @@ this.docs = docs; | ||
}, { | ||
key: "setRecords", | ||
value: function setRecords() { | ||
key: "setIndexRecords", | ||
value: function setIndexRecords() { | ||
var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -551,3 +558,3 @@ this.records = records; | ||
myIndex.setKeys(keys); | ||
myIndex.setCollection(docs); | ||
myIndex.setSources(docs); | ||
myIndex.create(); | ||
@@ -567,3 +574,3 @@ return myIndex; | ||
myIndex.setKeys(keys); | ||
myIndex.setRecords(records); | ||
myIndex.setIndexRecords(records); | ||
return myIndex; | ||
@@ -1135,2 +1142,25 @@ } | ||
}, { | ||
key: "remove", | ||
value: function remove() { | ||
var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () { | ||
return ( | ||
/* doc, idx */ | ||
false | ||
); | ||
}; | ||
var results = []; | ||
for (var i = 0, len = this._docs.length; i < len; i += 1) { | ||
var doc = this._docs[i]; | ||
if (predicate(doc, i)) { | ||
this.removeAt(i); | ||
i -= 1; | ||
results.push(doc); | ||
} | ||
} | ||
return results; | ||
} | ||
}, { | ||
key: "removeAt", | ||
@@ -1158,5 +1188,8 @@ value: function removeAt(idx) { | ||
shouldSort = _this$options.shouldSort, | ||
sortFn = _this$options.sortFn; | ||
sortFn = _this$options.sortFn, | ||
ignoreFieldNorm = _this$options.ignoreFieldNorm; | ||
var results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query); | ||
computeScore$1(results, this._keyStore); | ||
computeScore$1(results, this._keyStore, { | ||
ignoreFieldNorm: ignoreFieldNorm | ||
}); | ||
@@ -1325,11 +1358,13 @@ if (shouldSort) { | ||
function computeScore$1(results, keyStore) { | ||
function computeScore$1(results, keyStore, _ref8) { | ||
var _ref8$ignoreFieldNorm = _ref8.ignoreFieldNorm, | ||
ignoreFieldNorm = _ref8$ignoreFieldNorm === void 0 ? Config.ignoreFieldNorm : _ref8$ignoreFieldNorm; | ||
results.forEach(function (result) { | ||
var totalScore = 1; | ||
result.matches.forEach(function (_ref8) { | ||
var key = _ref8.key, | ||
norm = _ref8.norm, | ||
score = _ref8.score; | ||
result.matches.forEach(function (_ref9) { | ||
var key = _ref9.key, | ||
norm = _ref9.norm, | ||
score = _ref9.score; | ||
var weight = keyStore.get(key, 'weight'); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * norm); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm)); | ||
}); | ||
@@ -1341,7 +1376,7 @@ result.score = totalScore; | ||
function format(results, docs) { | ||
var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref9$includeMatches = _ref9.includeMatches, | ||
includeMatches = _ref9$includeMatches === void 0 ? Config.includeMatches : _ref9$includeMatches, | ||
_ref9$includeScore = _ref9.includeScore, | ||
includeScore = _ref9$includeScore === void 0 ? Config.includeScore : _ref9$includeScore; | ||
var _ref10 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref10$includeMatches = _ref10.includeMatches, | ||
includeMatches = _ref10$includeMatches === void 0 ? Config.includeMatches : _ref10$includeMatches, | ||
_ref10$includeScore = _ref10.includeScore, | ||
includeScore = _ref10$includeScore === void 0 ? Config.includeScore : _ref10$includeScore; | ||
@@ -1368,3 +1403,3 @@ var transformers = []; | ||
Fuse.version = '6.1.0-alpha.0'; | ||
Fuse.version = '6.1.0-alpha.1'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1371,0 +1406,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -168,7 +168,7 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
const MatchOptions = { | ||
// Whether the matches should be included in the result set. When true, each record in the result | ||
// Whether the matches should be included in the result set. When `true`, each record in the result | ||
// set will include the indices of the matched characters. | ||
// These can consequently be used for highlighting purposes. | ||
includeMatches: false, | ||
// When true, the matching function will continue to the end of a search pattern even if | ||
// When `true`, the matching function will continue to the end of a search pattern even if | ||
// a perfect match has already been located in the string. | ||
@@ -181,3 +181,3 @@ findAllMatches: false, | ||
const BasicOptions = { | ||
// When true, the algorithm continues searching to the end of the input even if a perfect | ||
// When `true`, the algorithm continues searching to the end of the input even if a perfect | ||
// match is found before the end of the same input. | ||
@@ -207,13 +207,19 @@ isCaseSensitive: false, | ||
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. | ||
distance: 100, | ||
ignoreLocation: false | ||
distance: 100 | ||
}; | ||
const AdvancedOptions = { | ||
// When true, it enables the use of unix-like search commands | ||
// When `true`, it enables the use of unix-like search commands | ||
useExtendedSearch: false, | ||
// The get function to use when fetching an object's properties. | ||
// The default will search nested paths *ie foo.bar.baz* | ||
getFn: get | ||
getFn: get, | ||
// When `true`, search will ignore `location` and `distance`, so it won't matter | ||
// where in the string the pattern appears. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score | ||
ignoreLocation: false, | ||
// When `true`, the calculation for the relevance score (used for sorting) will | ||
// ignore the field-length norm. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm | ||
ignoreFieldNorm: false | ||
}; | ||
@@ -261,8 +267,8 @@ | ||
this.setRecords(); | ||
this.setIndexRecords(); | ||
} | ||
setCollection(docs = []) { | ||
setSources(docs = []) { | ||
this.docs = docs; | ||
} | ||
setRecords(records = []) { | ||
setIndexRecords(records = []) { | ||
this.records = records; | ||
@@ -392,3 +398,3 @@ } | ||
myIndex.setKeys(keys); | ||
myIndex.setCollection(docs); | ||
myIndex.setSources(docs); | ||
myIndex.create(); | ||
@@ -402,3 +408,3 @@ return myIndex | ||
myIndex.setKeys(keys); | ||
myIndex.setRecords(records); | ||
myIndex.setIndexRecords(records); | ||
return myIndex | ||
@@ -950,2 +956,18 @@ } | ||
remove(predicate = (/* doc, idx */) => false) { | ||
const results = []; | ||
for (let i = 0, len = this._docs.length; i < len; i += 1) { | ||
const doc = this._docs[i]; | ||
if (predicate(doc, i)) { | ||
this.removeAt(i); | ||
i -= 1; | ||
results.push(doc); | ||
} | ||
} | ||
return results | ||
} | ||
removeAt(idx) { | ||
@@ -961,3 +983,9 @@ this._docs.splice(idx, 1); | ||
search(query, { limit = -1 } = {}) { | ||
const { includeMatches, includeScore, shouldSort, sortFn } = this.options; | ||
const { | ||
includeMatches, | ||
includeScore, | ||
shouldSort, | ||
sortFn, | ||
ignoreFieldNorm | ||
} = this.options; | ||
@@ -970,3 +998,3 @@ let results = isString(query) | ||
computeScore$1(results, this._keyStore); | ||
computeScore$1(results, this._keyStore, { ignoreFieldNorm }); | ||
@@ -1094,3 +1122,7 @@ if (shouldSort) { | ||
// Practical scoring function | ||
function computeScore$1(results, keyStore) { | ||
function computeScore$1( | ||
results, | ||
keyStore, | ||
{ ignoreFieldNorm = Config.ignoreFieldNorm } | ||
) { | ||
results.forEach((result) => { | ||
@@ -1104,3 +1136,3 @@ let totalScore = 1; | ||
score === 0 && weight ? Number.EPSILON : score, | ||
(weight || 1) * norm | ||
(weight || 1) * (ignoreFieldNorm ? 1 : norm) | ||
); | ||
@@ -1144,3 +1176,3 @@ }); | ||
Fuse.version = '6.1.0-alpha.0'; | ||
Fuse.version = '6.1.0-alpha.1'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1147,0 +1179,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - 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 i(t){return!t.trim().length}const r=Object.prototype.hasOwnProperty;class o{constructor(t){this._keys={},this._keyNames=[];let s=0;t.forEach(t=>{let n,i=1;if(e(t))n=t;else{if(!r.call(t,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=t.name,r.call(t,"weight")&&(i=t.weight,i<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:i},s+=i}),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 c={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,ignoreLocation:!1,...{useExtendedSearch:!1,getFn:function(i,r){let o=[],c=!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||!e(u)&&!s(u))if(t(u)){c=!0;for(let t=0,e=u.length;t<e;t+=1)h(u[t],d)}else d&&h(u,d);else o.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)}(u))}else o.push(i)};return h(i,r),c?o:o[0]}}};const h=/[^ ]+/g;class a{constructor({getFn:t=c.getFn}={}){this.norm=function(t=3){const e=new Map;return{get(s){const n=s.match(h).length;if(e.has(n))return e.get(n);const i=parseFloat((1/Math.sqrt(n)).toFixed(t));return e.set(n,i),i},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)||i(t))return;let s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(s,r){let o={i:r,$:{}};this.keys.forEach((r,c)=>{let h=this.getFn(s,r);if(n(h))if(t(h)){let s=[];const r=[{nestedArrIndex:-1,value:h}];for(;r.length;){const{nestedArrIndex:o,value:c}=r.pop();if(n(c))if(e(c)&&!i(c)){let t={v:c,i:o,n:this.norm.get(c)};s.push(t)}else t(c)&&c.forEach((t,e)=>{r.push({nestedArrIndex:e,value:t})})}o.$[c]=s}else if(!i(h)){let t={v:h,n:this.norm.get(h)};o.$[c]=t}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function l(t,e,{getFn:s=c.getFn}={}){let n=new a({getFn:s});return n.setKeys(t),n.setCollection(e),n.create(),n}function d(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:i}=t;let r={indices:s,value:i};t.key&&(r.key=t.key),t.idx>-1&&(r.refIndex=t.idx),e.matches.push(r)})}function u(t,e){e.score=t.score}function f(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:i=c.distance,ignoreLocation:r=c.ignoreLocation}={}){const o=e/t.length;if(r)return o;const h=Math.abs(n-s);return i?o+h/i:h?1:o}function g(t,e,s,{location:n=c.location,distance:i=c.distance,threshold:r=c.threshold,findAllMatches:o=c.findAllMatches,minMatchCharLength:h=c.minMatchCharLength,includeMatches:a=c.includeMatches,ignoreLocation:l=c.ignoreLocation}={}){if(e.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const d=e.length,u=t.length,g=Math.max(0,Math.min(n,u));let p=r,m=g;const y=[];if(a)for(let t=0;t<u;t+=1)y[t]=0;let M;for(;(M=t.indexOf(e,m))>-1;){let t=f(e,{currentLocation:M,expectedLocation:g,distance:i,ignoreLocation:l});if(p=Math.min(t,p),m=M+d,a){let t=0;for(;t<d;)y[M+t]=1,t+=1}}m=-1;let x=[],L=1,k=d+u;const _=1<<d-1;for(let n=0;n<d;n+=1){let r=0,c=k;for(;r<c;){f(e,{errors:n,currentLocation:g+c,expectedLocation:g,distance:i,ignoreLocation:l})<=p?r=c:k=c,c=Math.floor((k-r)/2+r)}k=c;let h=Math.max(1,g-c+1),M=o?u:Math.min(g+c,u)+d,v=Array(M+2);v[M+1]=(1<<n)-1;for(let r=M;r>=h;r-=1){let o=r-1,c=s[t.charAt(o)];if(c&&a&&(y[o]=1),v[r]=(v[r+1]<<1|1)&c,0!==n&&(v[r]|=(x[r+1]|x[r])<<1|1|x[r+1]),v[r]&_&&(L=f(e,{errors:n,currentLocation:o,expectedLocation:g,distance:i,ignoreLocation:l}),L<=p)){if(p=L,m=o,m<=g)break;h=Math.max(1,2*g-m)}}if(f(e,{errors:n+1,currentLocation:g,expectedLocation:g,distance:i,ignoreLocation:l})>p)break;x=v}let v={isMatch:m>=0,score:Math.max(.001,L)};return a&&(v.indices=function(t=[],e=c.minMatchCharLength){let s=[],n=-1,i=-1,r=0;for(let o=t.length;r<o;r+=1){let o=t[r];o&&-1===n?n=r:o||-1===n||(i=r-1,i-n+1>=e&&s.push([n,i]),n=-1)}return t[r-1]&&r-n>=e&&s.push([n,r-1]),s}(y,h)),v}function p(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const i=t.charAt(s);e[i]=(e[i]||0)|1<<n-s-1}return e}class m{constructor(t,{location:e=c.location,threshold:s=c.threshold,distance:n=c.distance,includeMatches:i=c.includeMatches,findAllMatches:r=c.findAllMatches,minMatchCharLength:o=c.minMatchCharLength,isCaseSensitive:h=c.isCaseSensitive,ignoreLocation:a=c.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:o,isCaseSensitive:h,ignoreLocation:a},this.pattern=h?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(t,e)=>{this.chunks.push({pattern:t,alphabet:p(t),startIndex:e})},d=this.pattern.length;if(d>32){let t=0;const e=d%32,s=d-e;for(;t<s;)l(this.pattern.substr(t,32),t),t+=32;if(e){const t=d-32;l(this.pattern.substr(t),t)}}else l(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:i,threshold:r,findAllMatches:o,minMatchCharLength:c,ignoreLocation:h}=this.options;let a=[],l=0,d=!1;this.chunks.forEach(({pattern:e,alphabet:u,startIndex:f})=>{const{isMatch:p,score:m,indices:y}=g(t,e,u,{location:n+f,distance:i,threshold:r,findAllMatches:o,minMatchCharLength:c,includeMatches:s,ignoreLocation:h});p&&(d=!0),l+=m,p&&y&&(a=[...a,...y])});let u={isMatch:d,score:d?l/this.chunks.length:1};return d&&s&&(u.indices=a),u}}const y=[];function M(t,e){for(let s=0,n=y.length;s<n;s+=1){let n=y[s];if(n.condition(t,e))return new n(t,e)}return new m(t,e)}class x{constructor(t,e={},s){if(this.options={...c,...e},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new o(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:i,includeScore:r,shouldSort:o,sortFn:h}=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:i})=>{const r=e.get(t,"weight");s*=Math.pow(0===i&&r?Number.EPSILON:i,(r||1)*n)}),t.score=s})}(a,this._keyStore),o&&a.sort(h),s(n)&&n>-1&&(a=a.slice(0,n)),function(t,e,{includeMatches:s=c.includeMatches,includeScore:n=c.includeScore}={}){const i=[];s&&i.push(d);n&&i.push(u);return t.map(t=>{const{idx:s}=t,n={item:e[s],refIndex:s};return i.length&&i.forEach(e=>{e(t,n)}),n})}(a,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t){const e=M(t,this.options),{records:s}=this._myIndex,i=[];return s.forEach(({v:t,i:s,n:r})=>{if(!n(t))return;const{isMatch:o,score:c,indices:h}=e.searchIn(t);o&&i.push({item:t,idx:s,matches:[{score:c,value:t,norm:r,indices:h}]})}),i}_searchLogical(t){throw new Error("Logical search is not available")}_searchObjectList(t){const e=M(t,this.options),{keys:s,records:i}=this._myIndex,r=[];return i.forEach(({$:t,i:i})=>{if(!n(t))return;let o=[];s.forEach((s,n)=>{o.push(...this._findMatches({key:s,value:t[n],searcher:e}))}),o.length&&r.push({idx:i,item:t,matches:o})}),r}_findMatches({key:e,value:s,searcher:i}){if(!n(s))return[];let r=[];if(t(s))s.forEach(({v:t,i:s,n:o})=>{if(!n(t))return;const{isMatch:c,score:h,indices:a}=i.searchIn(t);c&&r.push({score:h,key:e,value:t,idx:s,norm:o,indices:a})});else{const{v:t,n:n}=s,{isMatch:o,score:c,indices:h}=i.searchIn(t);o&&r.push({score:c,key:e,value:t,norm:n,indices:h})}return r}}x.version="6.1.0-alpha.0",x.createIndex=l,x.parseIndex=function(t,{getFn:e=c.getFn}={}){const{keys:s,records:n}=t;let i=new a({getFn:e});return i.setKeys(s),i.setRecords(n),i},x.config=c;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 o{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 c={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 o=[],c=!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)){c=!0;for(let e=0,t=u.length;e<t;e+=1)h(u[e],d)}else d&&h(u,d);else o.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 o.push(i)};return h(i,r),c?o:o[0]},ignoreLocation:!1,ignoreFieldNorm:!1}};const h=/[^ ]+/g;class a{constructor({getFn:e=c.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.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(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 o={i:r,$:{}};this.keys.forEach((r,c)=>{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:o,value:c}=r.pop();if(n(c))if(t(c)&&!i(c)){let e={v:c,i:o,n:this.norm.get(c)};s.push(e)}else e(c)&&c.forEach((e,t)=>{r.push({nestedArrIndex:t,value:e})})}o.$[c]=s}else if(!i(h)){let e={v:h,n:this.norm.get(h)};o.$[c]=e}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function l(e,t,{getFn:s=c.getFn}={}){let n=new a({getFn:s});return n.setKeys(e),n.setSources(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=c.distance,ignoreLocation:r=c.ignoreLocation}={}){const o=t/e.length;if(r)return o;const h=Math.abs(n-s);return i?o+h/i:h?1:o}function g(e,t,s,{location:n=c.location,distance:i=c.distance,threshold:r=c.threshold,findAllMatches:o=c.findAllMatches,minMatchCharLength:h=c.minMatchCharLength,includeMatches:a=c.includeMatches,ignoreLocation:l=c.ignoreLocation}={}){if(t.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const d=t.length,u=e.length,g=Math.max(0,Math.min(n,u));let p=r,m=g;const y=[];if(a)for(let e=0;e<u;e+=1)y[e]=0;let M;for(;(M=e.indexOf(t,m))>-1;){let e=f(t,{currentLocation:M,expectedLocation:g,distance:i,ignoreLocation:l});if(p=Math.min(e,p),m=M+d,a){let e=0;for(;e<d;)y[M+e]=1,e+=1}}m=-1;let x=[],L=1,_=d+u;const k=1<<d-1;for(let n=0;n<d;n+=1){let r=0,c=_;for(;r<c;){f(t,{errors:n,currentLocation:g+c,expectedLocation:g,distance:i,ignoreLocation:l})<=p?r=c:_=c,c=Math.floor((_-r)/2+r)}_=c;let h=Math.max(1,g-c+1),M=o?u:Math.min(g+c,u)+d,v=Array(M+2);v[M+1]=(1<<n)-1;for(let r=M;r>=h;r-=1){let o=r-1,c=s[e.charAt(o)];if(c&&a&&(y[o]=1),v[r]=(v[r+1]<<1|1)&c,0!==n&&(v[r]|=(x[r+1]|x[r])<<1|1|x[r+1]),v[r]&k&&(L=f(t,{errors:n,currentLocation:o,expectedLocation:g,distance:i,ignoreLocation:l}),L<=p)){if(p=L,m=o,m<=g)break;h=Math.max(1,2*g-m)}}if(f(t,{errors:n+1,currentLocation:g,expectedLocation:g,distance:i,ignoreLocation:l})>p)break;x=v}let v={isMatch:m>=0,score:Math.max(.001,L)};return a&&(v.indices=function(e=[],t=c.minMatchCharLength){let s=[],n=-1,i=-1,r=0;for(let o=e.length;r<o;r+=1){let o=e[r];o&&-1===n?n=r:o||-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}(y,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=c.location,threshold:s=c.threshold,distance:n=c.distance,includeMatches:i=c.includeMatches,findAllMatches:r=c.findAllMatches,minMatchCharLength:o=c.minMatchCharLength,isCaseSensitive:h=c.isCaseSensitive,ignoreLocation:a=c.ignoreLocation}={}){if(this.options={location:t,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:o,isCaseSensitive:h,ignoreLocation:a},this.pattern=h?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(e,t)=>{this.chunks.push({pattern:e,alphabet:p(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0;const t=d%32,s=d-t;for(;e<s;)l(this.pattern.substr(e,32),e),e+=32;if(t){const e=d-32;l(this.pattern.substr(e),e)}}else l(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:o,minMatchCharLength:c,ignoreLocation:h}=this.options;let a=[],l=0,d=!1;this.chunks.forEach(({pattern:t,alphabet:u,startIndex:f})=>{const{isMatch:p,score:m,indices:y}=g(e,t,u,{location:n+f,distance:i,threshold:r,findAllMatches:o,minMatchCharLength:c,includeMatches:s,ignoreLocation:h});p&&(d=!0),l+=m,p&&y&&(a=[...a,...y])});let u={isMatch:d,score:d?l/this.chunks.length:1};return d&&s&&(u.indices=a),u}}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={...c,...t},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new o(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))}remove(e=(()=>!1)){const t=[];for(let s=0,n=this._docs.length;s<n;s+=1){const n=this._docs[s];e(n,s)&&(this.removeAt(s),s-=1,t.push(n))}return t}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:o,sortFn:h,ignoreFieldNorm:a}=this.options;let l=t(e)?t(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,t,{ignoreFieldNorm:s=c.ignoreFieldNorm}){e.forEach(e=>{let n=1;e.matches.forEach(({key:e,norm:i,score:r})=>{const o=t.get(e,"weight");n*=Math.pow(0===r&&o?Number.EPSILON:r,(o||1)*(s?1:i))}),e.score=n})}(l,this._keyStore,{ignoreFieldNorm:a}),o&&l.sort(h),s(n)&&n>-1&&(l=l.slice(0,n)),function(e,t,{includeMatches:s=c.includeMatches,includeScore:n=c.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})}(l,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:o,score:c,indices:h}=t.searchIn(e);o&&i.push({item:e,idx:s,matches:[{score:c,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 o=[];s.forEach((s,n)=>{o.push(...this._findMatches({key:s,value:e[n],searcher:t}))}),o.length&&r.push({idx:i,item:e,matches:o})}),r}_findMatches({key:t,value:s,searcher:i}){if(!n(s))return[];let r=[];if(e(s))s.forEach(({v:e,i:s,n:o})=>{if(!n(e))return;const{isMatch:c,score:h,indices:a}=i.searchIn(e);c&&r.push({score:h,key:t,value:e,idx:s,norm:o,indices:a})});else{const{v:e,n:n}=s,{isMatch:o,score:c,indices:h}=i.searchIn(e);o&&r.push({score:c,key:t,value:e,norm:n,indices:h})}return r}}x.version="6.1.0-alpha.1",x.createIndex=l,x.parseIndex=function(e,{getFn:t=c.getFn}={}){const{keys:s,records:n}=e;let i=new a({getFn:t});return i.setKeys(s),i.setIndexRecords(n),i},x.config=c;export default x; |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -120,3 +120,3 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
@@ -297,7 +297,7 @@ } | ||
var MatchOptions = { | ||
// Whether the matches should be included in the result set. When true, each record in the result | ||
// Whether the matches should be included in the result set. When `true`, each record in the result | ||
// set will include the indices of the matched characters. | ||
// These can consequently be used for highlighting purposes. | ||
includeMatches: false, | ||
// When true, the matching function will continue to the end of a search pattern even if | ||
// When `true`, the matching function will continue to the end of a search pattern even if | ||
// a perfect match has already been located in the string. | ||
@@ -309,3 +309,3 @@ findAllMatches: false, | ||
var BasicOptions = { | ||
// When true, the algorithm continues searching to the end of the input even if a perfect | ||
// When `true`, the algorithm continues searching to the end of the input even if a perfect | ||
// match is found before the end of the same input. | ||
@@ -335,11 +335,18 @@ isCaseSensitive: false, | ||
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. | ||
distance: 100, | ||
ignoreLocation: false | ||
distance: 100 | ||
}; | ||
var AdvancedOptions = { | ||
// When true, it enables the use of unix-like search commands | ||
// When `true`, it enables the use of unix-like search commands | ||
useExtendedSearch: false, | ||
// The get function to use when fetching an object's properties. | ||
// The default will search nested paths *ie foo.bar.baz* | ||
getFn: get | ||
getFn: get, | ||
// When `true`, search will ignore `location` and `distance`, so it won't matter | ||
// where in the string the pattern appears. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score | ||
ignoreLocation: false, | ||
// When `true`, the calculation for the relevance score (used for sorting) will | ||
// ignore the field-length norm. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm | ||
ignoreFieldNorm: false | ||
}; | ||
@@ -383,8 +390,8 @@ var Config = _objectSpread2({}, BasicOptions, {}, MatchOptions, {}, FuzzyOptions, {}, AdvancedOptions); | ||
this.isCreated = false; | ||
this.setRecords(); | ||
this.setIndexRecords(); | ||
} | ||
_createClass(FuseIndex, [{ | ||
key: "setCollection", | ||
value: function setCollection() { | ||
key: "setSources", | ||
value: function setSources() { | ||
var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -394,4 +401,4 @@ this.docs = docs; | ||
}, { | ||
key: "setRecords", | ||
value: function setRecords() { | ||
key: "setIndexRecords", | ||
value: function setIndexRecords() { | ||
var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -555,3 +562,3 @@ this.records = records; | ||
myIndex.setKeys(keys); | ||
myIndex.setCollection(docs); | ||
myIndex.setSources(docs); | ||
myIndex.create(); | ||
@@ -571,3 +578,3 @@ return myIndex; | ||
myIndex.setKeys(keys); | ||
myIndex.setRecords(records); | ||
myIndex.setIndexRecords(records); | ||
return myIndex; | ||
@@ -1139,2 +1146,25 @@ } | ||
}, { | ||
key: "remove", | ||
value: function remove() { | ||
var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () { | ||
return ( | ||
/* doc, idx */ | ||
false | ||
); | ||
}; | ||
var results = []; | ||
for (var i = 0, len = this._docs.length; i < len; i += 1) { | ||
var doc = this._docs[i]; | ||
if (predicate(doc, i)) { | ||
this.removeAt(i); | ||
i -= 1; | ||
results.push(doc); | ||
} | ||
} | ||
return results; | ||
} | ||
}, { | ||
key: "removeAt", | ||
@@ -1162,5 +1192,8 @@ value: function removeAt(idx) { | ||
shouldSort = _this$options.shouldSort, | ||
sortFn = _this$options.sortFn; | ||
sortFn = _this$options.sortFn, | ||
ignoreFieldNorm = _this$options.ignoreFieldNorm; | ||
var results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query); | ||
computeScore$1(results, this._keyStore); | ||
computeScore$1(results, this._keyStore, { | ||
ignoreFieldNorm: ignoreFieldNorm | ||
}); | ||
@@ -1329,11 +1362,13 @@ if (shouldSort) { | ||
function computeScore$1(results, keyStore) { | ||
function computeScore$1(results, keyStore, _ref8) { | ||
var _ref8$ignoreFieldNorm = _ref8.ignoreFieldNorm, | ||
ignoreFieldNorm = _ref8$ignoreFieldNorm === void 0 ? Config.ignoreFieldNorm : _ref8$ignoreFieldNorm; | ||
results.forEach(function (result) { | ||
var totalScore = 1; | ||
result.matches.forEach(function (_ref8) { | ||
var key = _ref8.key, | ||
norm = _ref8.norm, | ||
score = _ref8.score; | ||
result.matches.forEach(function (_ref9) { | ||
var key = _ref9.key, | ||
norm = _ref9.norm, | ||
score = _ref9.score; | ||
var weight = keyStore.get(key, 'weight'); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * norm); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm)); | ||
}); | ||
@@ -1345,7 +1380,7 @@ result.score = totalScore; | ||
function format(results, docs) { | ||
var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref9$includeMatches = _ref9.includeMatches, | ||
includeMatches = _ref9$includeMatches === void 0 ? Config.includeMatches : _ref9$includeMatches, | ||
_ref9$includeScore = _ref9.includeScore, | ||
includeScore = _ref9$includeScore === void 0 ? Config.includeScore : _ref9$includeScore; | ||
var _ref10 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref10$includeMatches = _ref10.includeMatches, | ||
includeMatches = _ref10$includeMatches === void 0 ? Config.includeMatches : _ref10$includeMatches, | ||
_ref10$includeScore = _ref10.includeScore, | ||
includeScore = _ref10$includeScore === void 0 ? Config.includeScore : _ref10$includeScore; | ||
@@ -1372,3 +1407,3 @@ var transformers = []; | ||
Fuse.version = '6.1.0-alpha.0'; | ||
Fuse.version = '6.1.0-alpha.1'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1375,0 +1410,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - 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 a(e){return function(e){if(Array.isArray(e))return c(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 c(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)?c(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 c(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 s(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,g=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}(),y=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,ignoreLocation:!1},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i){if(i){var o=i.indexOf("."),a=i,c=null;-1!==o&&(a=i.slice(0,o),c=i.slice(o+1));var f=t[a];if(!d(f))return;if(c||!h(f)&&!u(f))if(s(f)){r=!0;for(var l=0,v=f.length;l<v;l+=1)e(f[l],c)}else c&&e(f,c);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?y.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(s(o))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:o}];t.length;){var a=t.pop(),c=a.nestedArrIndex,u=a.value;if(d(u))if(h(u)&&!f(u)){var l={v:u,i:c,n:n.norm.get(u)};e.push(l)}else s(u)&&u.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[i]=e}();else if(!f(o)){var a={v:o,n:n.norm.get(o)};r.$[i]=a}})),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?y.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 L(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,a=t.expectedLocation,c=void 0===a?0:a,s=t.distance,h=void 0===s?y.distance:s,u=t.ignoreLocation,d=void 0===u?y.ignoreLocation:u,f=r/e.length;if(d)return f;var l=Math.abs(c-o);return h?f+l/h:l?1:f}function w(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.minMatchCharLength,n=[],r=-1,i=-1,o=0,a=e.length;o<a;o+=1){var c=e[o];c&&-1===r?r=o:c||-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 O=function(){function t(n){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,a=void 0===o?y.location:o,c=i.threshold,s=void 0===c?y.threshold:c,h=i.distance,u=void 0===h?y.distance:h,d=i.includeMatches,f=void 0===d?y.includeMatches:d,l=i.findAllMatches,v=void 0===l?y.findAllMatches:l,g=i.minMatchCharLength,p=void 0===g?y.minMatchCharLength:g,m=i.isCaseSensitive,k=void 0===m?y.isCaseSensitive:m,b=i.ignoreLocation,M=void 0===b?y.ignoreLocation:b;if(e(this,t),this.options={location:a,threshold:s,distance:u,includeMatches:f,findAllMatches:v,minMatchCharLength:p,isCaseSensitive:k,ignoreLocation:M},this.pattern=k?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var x=function(e,t){r.chunks.push({pattern:e,alphabet:_(e),startIndex:t})},L=this.pattern.length;if(L>32){for(var w=0,O=L%32,S=L-O;w<S;)x(this.pattern.substr(w,32),w),w+=32;if(O){var A=L-32;x(this.pattern.substr(A),A)}}else x(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,c=o.location,s=o.distance,h=o.threshold,u=o.findAllMatches,d=o.minMatchCharLength,f=o.ignoreLocation,v=[],g=0,p=!1;this.chunks.forEach((function(t){var n=t.pattern,i=t.alphabet,o=t.startIndex,m=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?y.location:i,a=r.distance,c=void 0===a?y.distance:a,s=r.threshold,h=void 0===s?y.threshold:s,u=r.findAllMatches,d=void 0===u?y.findAllMatches:u,f=r.minMatchCharLength,v=void 0===f?y.minMatchCharLength:f,g=r.includeMatches,p=void 0===g?y.includeMatches:g,m=r.ignoreLocation,k=void 0===m?y.ignoreLocation:m;if(t.length>32)throw new Error(l(32));var b,M=t.length,x=e.length,_=Math.max(0,Math.min(o,x)),O=h,S=_,A=[];if(p)for(var E=0;E<x;E+=1)A[E]=0;for(;(b=e.indexOf(t,S))>-1;){var j=L(t,{currentLocation:b,expectedLocation:_,distance:c,ignoreLocation:k});if(O=Math.min(j,O),S=b+M,p)for(var C=0;C<M;)A[b+C]=1,C+=1}S=-1;for(var I=[],F=1,P=M+x,N=1<<M-1,$=0;$<M;$+=1){for(var D=0,z=P;D<z;){var J=L(t,{errors:$,currentLocation:_+z,expectedLocation:_,distance:c,ignoreLocation:k});J<=O?D=z:P=z,z=Math.floor((P-D)/2+D)}P=z;var K=Math.max(1,_-z+1),R=d?x:Math.min(_+z,x)+M,T=Array(R+2);T[R+1]=(1<<$)-1;for(var q=R;q>=K;q-=1){var U=q-1,B=n[e.charAt(U)];if(B&&p&&(A[U]=1),T[q]=(T[q+1]<<1|1)&B,0!==$&&(T[q]|=(I[q+1]|I[q])<<1|1|I[q+1]),T[q]&N&&(F=L(t,{errors:$,currentLocation:U,expectedLocation:_,distance:c,ignoreLocation:k}))<=O){if(O=F,(S=U)<=_)break;K=Math.max(1,2*_-S)}}var G=L(t,{errors:$+1,currentLocation:_,expectedLocation:_,distance:c,ignoreLocation:k});if(G>O)break;I=T}var H={isMatch:S>=0,score:Math.max(.001,F)};return p&&(H.indices=w(A,v)),H}(e,n,i,{location:c+o,distance:s,threshold:h,findAllMatches:u,minMatchCharLength:d,includeMatches:r,ignoreLocation:f}),k=m.isMatch,b=m.score,M=m.indices;k&&(p=!0),g+=b,k&&M&&(v=[].concat(a(v),a(M)))}));var m={isMatch:p,score:p?g/this.chunks.length:1};return p&&r&&(m.indices=v),m}}]),t}(),S=[];function A(e,t){for(var n=0,r=S.length;n<r;n+=1){var i=S[n];if(i.condition(e,t))return new i(e,t)}return new O(e,t)}var E=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({},y,{},r),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new g(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,a=i.includeScore,c=i.shouldSort,s=i.sortFn,d=h(e)?h(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return j(d,this._keyStore),c&&d.sort(s),u(r)&&r>-1&&(d=d.slice(0,r)),C(d,this._docs,{includeMatches:o,includeScore:a})}},{key:"_searchStringList",value:function(e){var t=A(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 a=t.searchIn(n),c=a.isMatch,s=a.score,h=a.indices;c&&r.push({item:n,idx:i,matches:[{score:s,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=A(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(d(r)){var s=[];i.forEach((function(e,i){s.push.apply(s,a(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(!d(n))return[];var i=[];if(s(n))n.forEach((function(e){var n=e.v,o=e.i,a=e.n;if(d(n)){var c=r.searchIn(n),s=c.isMatch,h=c.score,u=c.indices;s&&i.push({score:h,key:t,value:n,idx:o,norm:a,indices:u})}}));else{var o=n.v,a=n.n,c=r.searchIn(o),h=c.isMatch,u=c.score,f=c.indices;h&&i.push({score:u,key:t,value:o,norm:a,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,a=t.get(r,"weight");n*=Math.pow(0===o&&a?Number.EPSILON:o,(a||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?y.includeMatches:r,o=n.includeScore,a=void 0===o?y.includeScore:o,c=[];return i&&c.push(M),a&&c.push(x),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return c.length&&c.forEach((function(t){t(e,r)})),r}))}return E.version="6.1.0-alpha.0",E.createIndex=b,E.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?y.getFn:n,i=e.keys,o=e.records,a=new k({getFn:r});return a.setKeys(i),a.setRecords(o),a},E.config=y,E},"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 a(e){return function(e){if(Array.isArray(e))return s(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 s(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(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(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 s(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,g=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}(),y=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("."),a=i,s=null;-1!==o&&(a=i.slice(0,o),s=i.slice(o+1));var f=t[a];if(!d(f))return;if(s||!h(f)&&!u(f))if(c(f)){r=!0;for(var l=0,v=f.length;l<v;l+=1)e(f[l],s)}else s&&e(f,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)}(f))}else n.push(t)}(e,t),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1}),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?y.getFn:r;e(this,t),this.norm=m(3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return n(t,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",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 a=t.pop(),s=a.nestedArrIndex,u=a.value;if(d(u))if(h(u)&&!f(u)){var l={v:u,i:s,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 a={v:o,n:n.norm.get(o)};r.$[i]=a}})),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?y.getFn:r,o=new k({getFn:i});return o.setKeys(e),o.setSources(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 L(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,a=t.expectedLocation,s=void 0===a?0:a,c=t.distance,h=void 0===c?y.distance:c,u=t.ignoreLocation,d=void 0===u?y.ignoreLocation:u,f=r/e.length;if(d)return f;var l=Math.abs(s-o);return h?f+l/h:l?1:f}function w(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.minMatchCharLength,n=[],r=-1,i=-1,o=0,a=e.length;o<a;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 O=function(){function t(n){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,a=void 0===o?y.location:o,s=i.threshold,c=void 0===s?y.threshold:s,h=i.distance,u=void 0===h?y.distance:h,d=i.includeMatches,f=void 0===d?y.includeMatches:d,l=i.findAllMatches,v=void 0===l?y.findAllMatches:l,g=i.minMatchCharLength,p=void 0===g?y.minMatchCharLength:g,m=i.isCaseSensitive,k=void 0===m?y.isCaseSensitive:m,b=i.ignoreLocation,M=void 0===b?y.ignoreLocation:b;if(e(this,t),this.options={location:a,threshold:c,distance:u,includeMatches:f,findAllMatches:v,minMatchCharLength:p,isCaseSensitive:k,ignoreLocation:M},this.pattern=k?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var x=function(e,t){r.chunks.push({pattern:e,alphabet:_(e),startIndex:t})},L=this.pattern.length;if(L>32){for(var w=0,O=L%32,S=L-O;w<S;)x(this.pattern.substr(w,32),w),w+=32;if(O){var A=L-32;x(this.pattern.substr(A),A)}}else x(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,s=o.location,c=o.distance,h=o.threshold,u=o.findAllMatches,d=o.minMatchCharLength,f=o.ignoreLocation,v=[],g=0,p=!1;this.chunks.forEach((function(t){var n=t.pattern,i=t.alphabet,o=t.startIndex,m=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?y.location:i,a=r.distance,s=void 0===a?y.distance:a,c=r.threshold,h=void 0===c?y.threshold:c,u=r.findAllMatches,d=void 0===u?y.findAllMatches:u,f=r.minMatchCharLength,v=void 0===f?y.minMatchCharLength:f,g=r.includeMatches,p=void 0===g?y.includeMatches:g,m=r.ignoreLocation,k=void 0===m?y.ignoreLocation:m;if(t.length>32)throw new Error(l(32));var b,M=t.length,x=e.length,_=Math.max(0,Math.min(o,x)),O=h,S=_,A=[];if(p)for(var E=0;E<x;E+=1)A[E]=0;for(;(b=e.indexOf(t,S))>-1;){var I=L(t,{currentLocation:b,expectedLocation:_,distance:s,ignoreLocation:k});if(O=Math.min(I,O),S=b+M,p)for(var j=0;j<M;)A[b+j]=1,j+=1}S=-1;for(var C=[],F=1,N=M+x,P=1<<M-1,$=0;$<M;$+=1){for(var D=0,z=N;D<z;){var J=L(t,{errors:$,currentLocation:_+z,expectedLocation:_,distance:s,ignoreLocation:k});J<=O?D=z:N=z,z=Math.floor((N-D)/2+D)}N=z;var K=Math.max(1,_-z+1),R=d?x:Math.min(_+z,x)+M,T=Array(R+2);T[R+1]=(1<<$)-1;for(var q=R;q>=K;q-=1){var U=q-1,B=n[e.charAt(U)];if(B&&p&&(A[U]=1),T[q]=(T[q+1]<<1|1)&B,0!==$&&(T[q]|=(C[q+1]|C[q])<<1|1|C[q+1]),T[q]&P&&(F=L(t,{errors:$,currentLocation:U,expectedLocation:_,distance:s,ignoreLocation:k}))<=O){if(O=F,(S=U)<=_)break;K=Math.max(1,2*_-S)}}var G=L(t,{errors:$+1,currentLocation:_,expectedLocation:_,distance:s,ignoreLocation:k});if(G>O)break;C=T}var H={isMatch:S>=0,score:Math.max(.001,F)};return p&&(H.indices=w(A,v)),H}(e,n,i,{location:s+o,distance:c,threshold:h,findAllMatches:u,minMatchCharLength:d,includeMatches:r,ignoreLocation:f}),k=m.isMatch,b=m.score,M=m.indices;k&&(p=!0),g+=b,k&&M&&(v=[].concat(a(v),a(M)))}));var m={isMatch:p,score:p?g/this.chunks.length:1};return p&&r&&(m.indices=v),m}}]),t}(),S=[];function A(e,t){for(var n=0,r=S.length;n<r;n+=1){var i=S[n];if(i.condition(e,t))return new i(e,t)}return new O(e,t)}var E=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({},y,{},r),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new g(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:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n<r;n+=1){var i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,t.push(i))}return t}},{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,a=i.includeScore,s=i.shouldSort,c=i.sortFn,d=i.ignoreFieldNorm,f=h(e)?h(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return I(f,this._keyStore,{ignoreFieldNorm:d}),s&&f.sort(c),u(r)&&r>-1&&(f=f.slice(0,r)),j(f,this._docs,{includeMatches:o,includeScore:a})}},{key:"_searchStringList",value:function(e){var t=A(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 a=t.searchIn(n),s=a.isMatch,c=a.score,h=a.indices;s&&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=A(e,this.options),r=this._myIndex,i=r.keys,o=r.records,s=[];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,a(t._findMatches({key:e,value:r[i],searcher:n})))})),c.length&&s.push({idx:o,item:r,matches:c})}})),s}},{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,a=e.n;if(d(n)){var s=r.searchIn(n),c=s.isMatch,h=s.score,u=s.indices;c&&i.push({score:h,key:t,value:n,idx:o,norm:a,indices:u})}}));else{var o=n.v,a=n.n,s=r.searchIn(o),h=s.isMatch,u=s.score,f=s.indices;h&&i.push({score:u,key:t,value:o,norm:a,indices:f})}return i}}]),t}();function I(e,t,n){var r=n.ignoreFieldNorm,i=void 0===r?y.ignoreFieldNorm:r;e.forEach((function(e){var n=1;e.matches.forEach((function(e){var r=e.key,o=e.norm,a=e.score,s=t.get(r,"weight");n*=Math.pow(0===a&&s?Number.EPSILON:a,(s||1)*(i?1:o))})),e.score=n}))}function j(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?y.includeMatches:r,o=n.includeScore,a=void 0===o?y.includeScore:o,s=[];return i&&s.push(M),a&&s.push(x),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 E.version="6.1.0-alpha.1",E.createIndex=b,E.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?y.getFn:n,i=e.keys,o=e.records,a=new k({getFn:r});return a.setKeys(i),a.setIndexRecords(o),a},E.config=y,E},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -160,7 +160,9 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
function _createSuper(Derived) { | ||
return function () { | ||
var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
return function _createSuperInternal() { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (_isNativeReflectConstruct()) { | ||
if (hasNativeReflectConstruct) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
@@ -194,3 +196,3 @@ | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
@@ -370,7 +372,7 @@ } | ||
var MatchOptions = { | ||
// Whether the matches should be included in the result set. When true, each record in the result | ||
// Whether the matches should be included in the result set. When `true`, each record in the result | ||
// set will include the indices of the matched characters. | ||
// These can consequently be used for highlighting purposes. | ||
includeMatches: false, | ||
// When true, the matching function will continue to the end of a search pattern even if | ||
// When `true`, the matching function will continue to the end of a search pattern even if | ||
// a perfect match has already been located in the string. | ||
@@ -382,3 +384,3 @@ findAllMatches: false, | ||
var BasicOptions = { | ||
// When true, the algorithm continues searching to the end of the input even if a perfect | ||
// When `true`, the algorithm continues searching to the end of the input even if a perfect | ||
// match is found before the end of the same input. | ||
@@ -408,11 +410,18 @@ isCaseSensitive: false, | ||
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. | ||
distance: 100, | ||
ignoreLocation: false | ||
distance: 100 | ||
}; | ||
var AdvancedOptions = { | ||
// When true, it enables the use of unix-like search commands | ||
// When `true`, it enables the use of unix-like search commands | ||
useExtendedSearch: false, | ||
// The get function to use when fetching an object's properties. | ||
// The default will search nested paths *ie foo.bar.baz* | ||
getFn: get | ||
getFn: get, | ||
// When `true`, search will ignore `location` and `distance`, so it won't matter | ||
// where in the string the pattern appears. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score | ||
ignoreLocation: false, | ||
// When `true`, the calculation for the relevance score (used for sorting) will | ||
// ignore the field-length norm. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm | ||
ignoreFieldNorm: false | ||
}; | ||
@@ -456,8 +465,8 @@ var Config = _objectSpread2({}, BasicOptions, {}, MatchOptions, {}, FuzzyOptions, {}, AdvancedOptions); | ||
this.isCreated = false; | ||
this.setRecords(); | ||
this.setIndexRecords(); | ||
} | ||
_createClass(FuseIndex, [{ | ||
key: "setCollection", | ||
value: function setCollection() { | ||
key: "setSources", | ||
value: function setSources() { | ||
var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -467,4 +476,4 @@ this.docs = docs; | ||
}, { | ||
key: "setRecords", | ||
value: function setRecords() { | ||
key: "setIndexRecords", | ||
value: function setIndexRecords() { | ||
var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -628,3 +637,3 @@ this.records = records; | ||
myIndex.setKeys(keys); | ||
myIndex.setCollection(docs); | ||
myIndex.setSources(docs); | ||
myIndex.create(); | ||
@@ -644,3 +653,3 @@ return myIndex; | ||
myIndex.setKeys(keys); | ||
myIndex.setRecords(records); | ||
myIndex.setIndexRecords(records); | ||
return myIndex; | ||
@@ -1774,2 +1783,25 @@ } | ||
}, { | ||
key: "remove", | ||
value: function remove() { | ||
var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () { | ||
return ( | ||
/* doc, idx */ | ||
false | ||
); | ||
}; | ||
var results = []; | ||
for (var i = 0, len = this._docs.length; i < len; i += 1) { | ||
var doc = this._docs[i]; | ||
if (predicate(doc, i)) { | ||
this.removeAt(i); | ||
i -= 1; | ||
results.push(doc); | ||
} | ||
} | ||
return results; | ||
} | ||
}, { | ||
key: "removeAt", | ||
@@ -1797,5 +1829,8 @@ value: function removeAt(idx) { | ||
shouldSort = _this$options.shouldSort, | ||
sortFn = _this$options.sortFn; | ||
sortFn = _this$options.sortFn, | ||
ignoreFieldNorm = _this$options.ignoreFieldNorm; | ||
var results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query); | ||
computeScore$1(results, this._keyStore); | ||
computeScore$1(results, this._keyStore, { | ||
ignoreFieldNorm: ignoreFieldNorm | ||
}); | ||
@@ -2036,11 +2071,13 @@ if (shouldSort) { | ||
function computeScore$1(results, keyStore) { | ||
function computeScore$1(results, keyStore, _ref8) { | ||
var _ref8$ignoreFieldNorm = _ref8.ignoreFieldNorm, | ||
ignoreFieldNorm = _ref8$ignoreFieldNorm === void 0 ? Config.ignoreFieldNorm : _ref8$ignoreFieldNorm; | ||
results.forEach(function (result) { | ||
var totalScore = 1; | ||
result.matches.forEach(function (_ref8) { | ||
var key = _ref8.key, | ||
norm = _ref8.norm, | ||
score = _ref8.score; | ||
result.matches.forEach(function (_ref9) { | ||
var key = _ref9.key, | ||
norm = _ref9.norm, | ||
score = _ref9.score; | ||
var weight = keyStore.get(key, 'weight'); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * norm); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm)); | ||
}); | ||
@@ -2052,7 +2089,7 @@ result.score = totalScore; | ||
function format(results, docs) { | ||
var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref9$includeMatches = _ref9.includeMatches, | ||
includeMatches = _ref9$includeMatches === void 0 ? Config.includeMatches : _ref9$includeMatches, | ||
_ref9$includeScore = _ref9.includeScore, | ||
includeScore = _ref9$includeScore === void 0 ? Config.includeScore : _ref9$includeScore; | ||
var _ref10 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref10$includeMatches = _ref10.includeMatches, | ||
includeMatches = _ref10$includeMatches === void 0 ? Config.includeMatches : _ref10$includeMatches, | ||
_ref10$includeScore = _ref10.includeScore, | ||
includeScore = _ref10$includeScore === void 0 ? Config.includeScore : _ref10$includeScore; | ||
@@ -2079,3 +2116,3 @@ var transformers = []; | ||
Fuse.version = '6.1.0-alpha.0'; | ||
Fuse.version = '6.1.0-alpha.1'; | ||
Fuse.createIndex = createIndex; | ||
@@ -2082,0 +2119,0 @@ Fuse.parseIndex = parseIndex; |
@@ -1,3 +0,3 @@ | ||
// Type definitions for Fuse.js v6.1.0-alpha.0 | ||
// TypeScript v3.8.3 | ||
// Type definitions for Fuse.js v6.1.0-alpha.1 | ||
// TypeScript v3.9.5 | ||
@@ -40,10 +40,20 @@ export default Fuse | ||
/** | ||
* Removes the doc at the specified index | ||
* Removes all documents from the list which the predicate returns truthy for, | ||
* and returns an array of the removed docs. | ||
* The predicate is invoked with two arguments: (doc, index). | ||
*/ | ||
remove(predicate: (doc: T, idx: number) => boolean): T[] | ||
/** | ||
* Removes the doc at the specified index. | ||
*/ | ||
removeAt(idx: number): void | ||
/** | ||
* Returns the generated Fuse index | ||
*/ | ||
getIndex(): FuseIndex<T> | ||
/** | ||
* Return the current version | ||
* Return the current version. | ||
*/ | ||
@@ -92,5 +102,5 @@ static version: string | ||
constructor(options?: Fuse.FuseIndexOptions<T>) | ||
setCollection(docs: ReadonlyArray<T>): void | ||
setSources(docs: ReadonlyArray<T>): void | ||
setKeys(keys: ReadonlyArray<string>): void | ||
setRecords(records: Fuse.FuseIndexRecords): void | ||
setIndexRecords(records: Fuse.FuseIndexRecords): void | ||
create(): void | ||
@@ -235,2 +245,3 @@ add(doc: T): void | ||
getFn?: FuseGetFunction<T> | ||
ignoreLocation?: boolean | ||
includeMatches?: boolean | ||
@@ -237,0 +248,0 @@ includeScore?: boolean |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -166,7 +166,7 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
const MatchOptions = { | ||
// Whether the matches should be included in the result set. When true, each record in the result | ||
// Whether the matches should be included in the result set. When `true`, each record in the result | ||
// set will include the indices of the matched characters. | ||
// These can consequently be used for highlighting purposes. | ||
includeMatches: false, | ||
// When true, the matching function will continue to the end of a search pattern even if | ||
// When `true`, the matching function will continue to the end of a search pattern even if | ||
// a perfect match has already been located in the string. | ||
@@ -179,3 +179,3 @@ findAllMatches: false, | ||
const BasicOptions = { | ||
// When true, the algorithm continues searching to the end of the input even if a perfect | ||
// When `true`, the algorithm continues searching to the end of the input even if a perfect | ||
// match is found before the end of the same input. | ||
@@ -205,13 +205,19 @@ isCaseSensitive: false, | ||
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. | ||
distance: 100, | ||
ignoreLocation: false | ||
distance: 100 | ||
}; | ||
const AdvancedOptions = { | ||
// When true, it enables the use of unix-like search commands | ||
// When `true`, it enables the use of unix-like search commands | ||
useExtendedSearch: false, | ||
// The get function to use when fetching an object's properties. | ||
// The default will search nested paths *ie foo.bar.baz* | ||
getFn: get | ||
getFn: get, | ||
// When `true`, search will ignore `location` and `distance`, so it won't matter | ||
// where in the string the pattern appears. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score | ||
ignoreLocation: false, | ||
// When `true`, the calculation for the relevance score (used for sorting) will | ||
// ignore the field-length norm. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm | ||
ignoreFieldNorm: false | ||
}; | ||
@@ -259,8 +265,8 @@ | ||
this.setRecords(); | ||
this.setIndexRecords(); | ||
} | ||
setCollection(docs = []) { | ||
setSources(docs = []) { | ||
this.docs = docs; | ||
} | ||
setRecords(records = []) { | ||
setIndexRecords(records = []) { | ||
this.records = records; | ||
@@ -390,3 +396,3 @@ } | ||
myIndex.setKeys(keys); | ||
myIndex.setCollection(docs); | ||
myIndex.setSources(docs); | ||
myIndex.create(); | ||
@@ -400,3 +406,3 @@ return myIndex | ||
myIndex.setKeys(keys); | ||
myIndex.setRecords(records); | ||
myIndex.setIndexRecords(records); | ||
return myIndex | ||
@@ -1375,2 +1381,18 @@ } | ||
remove(predicate = (/* doc, idx */) => false) { | ||
const results = []; | ||
for (let i = 0, len = this._docs.length; i < len; i += 1) { | ||
const doc = this._docs[i]; | ||
if (predicate(doc, i)) { | ||
this.removeAt(i); | ||
i -= 1; | ||
results.push(doc); | ||
} | ||
} | ||
return results | ||
} | ||
removeAt(idx) { | ||
@@ -1386,3 +1408,9 @@ this._docs.splice(idx, 1); | ||
search(query, { limit = -1 } = {}) { | ||
const { includeMatches, includeScore, shouldSort, sortFn } = this.options; | ||
const { | ||
includeMatches, | ||
includeScore, | ||
shouldSort, | ||
sortFn, | ||
ignoreFieldNorm | ||
} = this.options; | ||
@@ -1395,3 +1423,3 @@ let results = isString(query) | ||
computeScore$1(results, this._keyStore); | ||
computeScore$1(results, this._keyStore, { ignoreFieldNorm }); | ||
@@ -1577,3 +1605,7 @@ if (shouldSort) { | ||
// Practical scoring function | ||
function computeScore$1(results, keyStore) { | ||
function computeScore$1( | ||
results, | ||
keyStore, | ||
{ ignoreFieldNorm = Config.ignoreFieldNorm } | ||
) { | ||
results.forEach((result) => { | ||
@@ -1587,3 +1619,3 @@ let totalScore = 1; | ||
score === 0 && weight ? Number.EPSILON : score, | ||
(weight || 1) * norm | ||
(weight || 1) * (ignoreFieldNorm ? 1 : norm) | ||
); | ||
@@ -1627,3 +1659,3 @@ }); | ||
Fuse.version = '6.1.0-alpha.0'; | ||
Fuse.version = '6.1.0-alpha.1'; | ||
Fuse.createIndex = createIndex; | ||
@@ -1630,0 +1662,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - 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 i(t){return!t.trim().length}const r=Object.prototype.hasOwnProperty;class c{constructor(t){this._keys={},this._keyNames=[];let s=0;t.forEach(t=>{let n,i=1;if(e(t))n=t;else{if(!r.call(t,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=t.name,r.call(t,"weight")&&(i=t.weight,i<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:i},s+=i}),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 o={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,ignoreLocation:!1,...{useExtendedSearch:!1,getFn:function(i,r){let c=[],o=!1;const h=(i,r)=>{if(r){const a=r.indexOf(".");let l=r,u=null;-1!==a&&(l=r.slice(0,a),u=r.slice(a+1));const d=i[l];if(!n(d))return;if(u||!e(d)&&!s(d))if(t(d)){o=!0;for(let t=0,e=d.length;t<e;t+=1)h(d[t],u)}else u&&h(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(i)};return h(i,r),o?c:c[0]}}};const h=/[^ ]+/g;class a{constructor({getFn:t=o.getFn}={}){this.norm=function(t=3){const e=new Map;return{get(s){const n=s.match(h).length;if(e.has(n))return e.get(n);const i=parseFloat((1/Math.sqrt(n)).toFixed(t));return e.set(n,i),i},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)||i(t))return;let s={v:t,i:e,n:this.norm.get(t)};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(t(h)){let s=[];const r=[{nestedArrIndex:-1,value:h}];for(;r.length;){const{nestedArrIndex:c,value:o}=r.pop();if(n(o))if(e(o)&&!i(o)){let t={v:o,i:c,n:this.norm.get(o)};s.push(t)}else t(o)&&o.forEach((t,e)=>{r.push({nestedArrIndex:e,value:t})})}c.$[o]=s}else if(!i(h)){let t={v:h,n:this.norm.get(h)};c.$[o]=t}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function l(t,e,{getFn:s=o.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:i}=t;let r={indices:s,value:i};t.key&&(r.key=t.key),t.idx>-1&&(r.refIndex=t.idx),e.matches.push(r)})}function d(t,e){e.score=t.score}function g(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:i=o.distance,ignoreLocation:r=o.ignoreLocation}={}){const c=e/t.length;if(r)return c;const h=Math.abs(n-s);return i?c+h/i:h?1:c}function f(t,e,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,ignoreLocation:l=o.ignoreLocation}={}){if(e.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const u=e.length,d=t.length,f=Math.max(0,Math.min(n,d));let p=r,M=f;const m=[];if(a)for(let t=0;t<d;t+=1)m[t]=0;let x;for(;(x=t.indexOf(e,M))>-1;){let t=g(e,{currentLocation:x,expectedLocation:f,distance:i,ignoreLocation:l});if(p=Math.min(t,p),M=x+u,a){let t=0;for(;t<u;)m[x+t]=1,t+=1}}M=-1;let y=[],k=1,L=u+d;const _=1<<u-1;for(let n=0;n<u;n+=1){let r=0,o=L;for(;r<o;){g(e,{errors:n,currentLocation:f+o,expectedLocation:f,distance:i,ignoreLocation:l})<=p?r=o:L=o,o=Math.floor((L-r)/2+r)}L=o;let h=Math.max(1,f-o+1),x=c?d:Math.min(f+o,d)+u,v=Array(x+2);v[x+1]=(1<<n)-1;for(let r=x;r>=h;r-=1){let c=r-1,o=s[t.charAt(c)];if(o&&a&&(m[c]=1),v[r]=(v[r+1]<<1|1)&o,0!==n&&(v[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),v[r]&_&&(k=g(e,{errors:n,currentLocation:c,expectedLocation:f,distance:i,ignoreLocation:l}),k<=p)){if(p=k,M=c,M<=f)break;h=Math.max(1,2*f-M)}}if(g(e,{errors:n+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:l})>p)break;y=v}let v={isMatch:M>=0,score:Math.max(.001,k)};return a&&(v.indices=function(t=[],e=o.minMatchCharLength){let s=[],n=-1,i=-1,r=0;for(let c=t.length;r<c;r+=1){let c=t[r];c&&-1===n?n=r:c||-1===n||(i=r-1,i-n+1>=e&&s.push([n,i]),n=-1)}return t[r-1]&&r-n>=e&&s.push([n,r-1]),s}(m,h)),v}function p(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const i=t.charAt(s);e[i]=(e[i]||0)|1<<n-s-1}return e}class M{constructor(t,{location:e=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,ignoreLocation:a=o.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:h,ignoreLocation:a},this.pattern=h?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(t,e)=>{this.chunks.push({pattern:t,alphabet:p(t),startIndex:e})},u=this.pattern.length;if(u>32){let t=0;const e=u%32,s=u-e;for(;t<s;)l(this.pattern.substr(t,32),t),t+=32;if(e){const t=u-32;l(this.pattern.substr(t),t)}}else l(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:i,threshold:r,findAllMatches:c,minMatchCharLength:o,ignoreLocation:h}=this.options;let a=[],l=0,u=!1;this.chunks.forEach(({pattern:e,alphabet:d,startIndex:g})=>{const{isMatch:p,score:M,indices:m}=f(t,e,d,{location:n+g,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o,includeMatches:s,ignoreLocation:h});p&&(u=!0),l+=M,p&&m&&(a=[...a,...m])});let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&s&&(d.indices=a),d}}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=[],i=this.pattern.length;for(;(e=t.indexOf(this.pattern,s))>-1;)s=e+i,n.push([e,s-1]);const r=!!n.length;return{isMatch:r,score:r?1:0,indices:n}}}class k extends m{constructor(t,{location:e=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}={}){super(t),this._bitapSearch=new M(t,{location:e,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}const L=[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],_=L.length,v=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;const S=new Set([k.type,y.type]);class C{constructor(t,{isCaseSensitive:e=o.isCaseSensitive,includeMatches:s=o.includeMatches,minMatchCharLength:n=o.minMatchCharLength,findAllMatches:i=o.findAllMatches,location:r=o.location,threshold:c=o.threshold,distance:h=o.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:n,findAllMatches:i,location:r,threshold:c,distance:h},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map(t=>{let s=t.trim().split(v).filter(t=>t&&!!t.trim()),n=[];for(let t=0,i=s.length;t<i;t+=1){const i=s[t];let r=!1,c=-1;for(;!r&&++c<_;){const t=L[c];let s=t.isMultiMatch(i);s&&(n.push(new t(s,e)),r=!0)}if(!r)for(c=-1;++c<_;){const t=L[c];let s=t.isSingleMatch(i);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 i=0,r=[],c=0;for(let n=0,o=e.length;n<o;n+=1){const o=e[n];r.length=0,i=0;for(let e=0,n=o.length;e<n;e+=1){const n=o[e],{isMatch:h,indices:a,score:l}=n.search(t);if(!h){c=0,i=0,r.length=0;break}if(i+=1,c+=l,s){const t=n.constructor.type;S.has(t)?r=[...r,...a]:r.push(a)}}if(i){let t={isMatch:!0,score:c/i};return s&&(t.indices=r),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:i=!0}={}){const r=s=>{let c=Object.keys(s);if(c.length>1&&!b(s))return r(I(s));let o=c[0];if((e=>!t(e)&&"object"==typeof e&&!b(e))(s)){const t=s[o];if(!e(t))throw new Error((t=>`Invalid value for key ${t}`)(o));const r={key:o,pattern:t};return i&&(r.searcher=$(t,n)),r}let h={children:[],operator:o};return c.forEach(e=>{const n=s[e];t(n)&&n.forEach(t=>{h.children.push(r(t))})}),h};return b(s)||(s=I(s)),r(s)}class R{constructor(t,e={},s){this.options={...o,...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:i,includeScore:r,shouldSort:c,sortFn:h}=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:i})=>{const r=e.get(t,"weight");s*=Math.pow(0===i&&r?Number.EPSILON:i,(r||1)*n)}),t.score=s})}(a,this._keyStore),c&&a.sort(h),s(n)&&n>-1&&(a=a.slice(0,n)),function(t,e,{includeMatches:s=o.includeMatches,includeScore:n=o.includeScore}={}){const i=[];s&&i.push(u);n&&i.push(d);return t.map(t=>{const{idx:s}=t,n={item:e[s],refIndex:s};return i.length&&i.forEach(e=>{e(t,n)}),n})}(a,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t){const e=$(t,this.options),{records:s}=this._myIndex,i=[];return s.forEach(({v:t,i:s,n:r})=>{if(!n(t))return;const{isMatch:c,score:o,indices:h}=e.searchIn(t);c&&i.push({item:t,idx:s,matches:[{score:o,value:t,norm:r,indices:h}]})}),i}_searchLogical(t){const e=O(t,this.options),{keys:s,records:i}=this._myIndex,r={},c=[],o=(t,e,n)=>{if(!t.children){const{key:n,searcher:i}=t,r=e[s.indexOf(n)];return this._findMatches({key:n,value:r,searcher:i})}{const s=t.operator;let i=[];for(let r=0;r<t.children.length;r+=1){let c=t.children[r],h=o(c,e,n);if(h&&h.length){if(i.push({idx:n,item:e,matches:h}),s===E)break}else if(s===A){i.length=0;break}}i.length&&(r[n]||(r[n]={idx:n,item:e,matches:[]},c.push(r[n])),i.forEach(({matches:t})=>{r[n].matches.push(...t)}))}};return i.forEach(({$:t,i:s})=>{n(t)&&o(e,t,s)}),c}_searchObjectList(t){const e=$(t,this.options),{keys:s,records:i}=this._myIndex,r=[];return i.forEach(({$:t,i:i})=>{if(!n(t))return;let c=[];s.forEach((s,n)=>{c.push(...this._findMatches({key:s,value:t[n],searcher:e}))}),c.length&&r.push({idx:i,item:t,matches:c})}),r}_findMatches({key:e,value:s,searcher:i}){if(!n(s))return[];let r=[];if(t(s))s.forEach(({v:t,i:s,n:c})=>{if(!n(t))return;const{isMatch:o,score:h,indices:a}=i.searchIn(t);o&&r.push({score:h,key:e,value:t,idx:s,norm:c,indices:a})});else{const{v:t,n:n}=s,{isMatch:c,score:o,indices:h}=i.searchIn(t);c&&r.push({score:o,key:e,value:t,norm:n,indices:h})}return r}}R.version="6.1.0-alpha.0",R.createIndex=l,R.parseIndex=function(t,{getFn:e=o.getFn}={}){const{keys:s,records:n}=t;let i=new a({getFn:e});return i.setKeys(s),i.setRecords(n),i},R.config=o,function(...t){w.push(...t)}(C);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 i(t){return!t.trim().length}const r=Object.prototype.hasOwnProperty;class c{constructor(t){this._keys={},this._keyNames=[];let s=0;t.forEach(t=>{let n,i=1;if(e(t))n=t;else{if(!r.call(t,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=t.name,r.call(t,"weight")&&(i=t.weight,i<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:i},s+=i}),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 o={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(i,r){let c=[],o=!1;const h=(i,r)=>{if(r){const a=r.indexOf(".");let l=r,u=null;-1!==a&&(l=r.slice(0,a),u=r.slice(a+1));const d=i[l];if(!n(d))return;if(u||!e(d)&&!s(d))if(t(d)){o=!0;for(let t=0,e=d.length;t<e;t+=1)h(d[t],u)}else u&&h(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(i)};return h(i,r),o?c:c[0]},ignoreLocation:!1,ignoreFieldNorm:!1}};const h=/[^ ]+/g;class a{constructor({getFn:t=o.getFn}={}){this.norm=function(t=3){const e=new Map;return{get(s){const n=s.match(h).length;if(e.has(n))return e.get(n);const i=parseFloat((1/Math.sqrt(n)).toFixed(t));return e.set(n,i),i},clear(){e.clear()}}}(3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(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)||i(t))return;let s={v:t,i:e,n:this.norm.get(t)};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(t(h)){let s=[];const r=[{nestedArrIndex:-1,value:h}];for(;r.length;){const{nestedArrIndex:c,value:o}=r.pop();if(n(o))if(e(o)&&!i(o)){let t={v:o,i:c,n:this.norm.get(o)};s.push(t)}else t(o)&&o.forEach((t,e)=>{r.push({nestedArrIndex:e,value:t})})}c.$[o]=s}else if(!i(h)){let t={v:h,n:this.norm.get(h)};c.$[o]=t}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function l(t,e,{getFn:s=o.getFn}={}){let n=new a({getFn:s});return n.setKeys(t),n.setSources(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:i}=t;let r={indices:s,value:i};t.key&&(r.key=t.key),t.idx>-1&&(r.refIndex=t.idx),e.matches.push(r)})}function d(t,e){e.score=t.score}function g(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:i=o.distance,ignoreLocation:r=o.ignoreLocation}={}){const c=e/t.length;if(r)return c;const h=Math.abs(n-s);return i?c+h/i:h?1:c}function f(t,e,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,ignoreLocation:l=o.ignoreLocation}={}){if(e.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const u=e.length,d=t.length,f=Math.max(0,Math.min(n,d));let p=r,m=f;const M=[];if(a)for(let t=0;t<d;t+=1)M[t]=0;let x;for(;(x=t.indexOf(e,m))>-1;){let t=g(e,{currentLocation:x,expectedLocation:f,distance:i,ignoreLocation:l});if(p=Math.min(t,p),m=x+u,a){let t=0;for(;t<u;)M[x+t]=1,t+=1}}m=-1;let y=[],k=1,L=u+d;const _=1<<u-1;for(let n=0;n<u;n+=1){let r=0,o=L;for(;r<o;){g(e,{errors:n,currentLocation:f+o,expectedLocation:f,distance:i,ignoreLocation:l})<=p?r=o:L=o,o=Math.floor((L-r)/2+r)}L=o;let h=Math.max(1,f-o+1),x=c?d:Math.min(f+o,d)+u,v=Array(x+2);v[x+1]=(1<<n)-1;for(let r=x;r>=h;r-=1){let c=r-1,o=s[t.charAt(c)];if(o&&a&&(M[c]=1),v[r]=(v[r+1]<<1|1)&o,0!==n&&(v[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),v[r]&_&&(k=g(e,{errors:n,currentLocation:c,expectedLocation:f,distance:i,ignoreLocation:l}),k<=p)){if(p=k,m=c,m<=f)break;h=Math.max(1,2*f-m)}}if(g(e,{errors:n+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:l})>p)break;y=v}let v={isMatch:m>=0,score:Math.max(.001,k)};return a&&(v.indices=function(t=[],e=o.minMatchCharLength){let s=[],n=-1,i=-1,r=0;for(let c=t.length;r<c;r+=1){let c=t[r];c&&-1===n?n=r:c||-1===n||(i=r-1,i-n+1>=e&&s.push([n,i]),n=-1)}return t[r-1]&&r-n>=e&&s.push([n,r-1]),s}(M,h)),v}function p(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const i=t.charAt(s);e[i]=(e[i]||0)|1<<n-s-1}return e}class m{constructor(t,{location:e=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,ignoreLocation:a=o.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:h,ignoreLocation:a},this.pattern=h?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(t,e)=>{this.chunks.push({pattern:t,alphabet:p(t),startIndex:e})},u=this.pattern.length;if(u>32){let t=0;const e=u%32,s=u-e;for(;t<s;)l(this.pattern.substr(t,32),t),t+=32;if(e){const t=u-32;l(this.pattern.substr(t),t)}}else l(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:i,threshold:r,findAllMatches:c,minMatchCharLength:o,ignoreLocation:h}=this.options;let a=[],l=0,u=!1;this.chunks.forEach(({pattern:e,alphabet:d,startIndex:g})=>{const{isMatch:p,score:m,indices:M}=f(t,e,d,{location:n+g,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o,includeMatches:s,ignoreLocation:h});p&&(u=!0),l+=m,p&&M&&(a=[...a,...M])});let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&s&&(d.indices=a),d}}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=[],i=this.pattern.length;for(;(e=t.indexOf(this.pattern,s))>-1;)s=e+i,n.push([e,s-1]);const r=!!n.length;return{isMatch:r,score:r?1:0,indices:n}}}class k extends M{constructor(t,{location:e=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}={}){super(t),this._bitapSearch=new m(t,{location:e,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}const L=[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],_=L.length,v=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;const S=new Set([k.type,y.type]);class C{constructor(t,{isCaseSensitive:e=o.isCaseSensitive,includeMatches:s=o.includeMatches,minMatchCharLength:n=o.minMatchCharLength,findAllMatches:i=o.findAllMatches,location:r=o.location,threshold:c=o.threshold,distance:h=o.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:n,findAllMatches:i,location:r,threshold:c,distance:h},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map(t=>{let s=t.trim().split(v).filter(t=>t&&!!t.trim()),n=[];for(let t=0,i=s.length;t<i;t+=1){const i=s[t];let r=!1,c=-1;for(;!r&&++c<_;){const t=L[c];let s=t.isMultiMatch(i);s&&(n.push(new t(s,e)),r=!0)}if(!r)for(c=-1;++c<_;){const t=L[c];let s=t.isSingleMatch(i);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 i=0,r=[],c=0;for(let n=0,o=e.length;n<o;n+=1){const o=e[n];r.length=0,i=0;for(let e=0,n=o.length;e<n;e+=1){const n=o[e],{isMatch:h,indices:a,score:l}=n.search(t);if(!h){c=0,i=0,r.length=0;break}if(i+=1,c+=l,s){const t=n.constructor.type;S.has(t)?r=[...r,...a]:r.push(a)}}if(i){let t={isMatch:!0,score:c/i};return s&&(t.indices=r),t}}return{isMatch:!1,score:1}}}const w=[];function A(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 I="$and",$="$or",E=t=>!(!t[I]&&!t[$]),b=t=>({[I]:Object.keys(t).map(e=>({[e]:t[e]}))});function F(s,n,{auto:i=!0}={}){const r=s=>{let c=Object.keys(s);if(c.length>1&&!E(s))return r(b(s));let o=c[0];if((e=>!t(e)&&"object"==typeof e&&!E(e))(s)){const t=s[o];if(!e(t))throw new Error((t=>"Invalid value for key "+t)(o));const r={key:o,pattern:t};return i&&(r.searcher=A(t,n)),r}let h={children:[],operator:o};return c.forEach(e=>{const n=s[e];t(n)&&n.forEach(t=>{h.children.push(r(t))})}),h};return E(s)||(s=b(s)),r(s)}class O{constructor(t,e={},s){this.options={...o,...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))}remove(t=(()=>!1)){const e=[];for(let s=0,n=this._docs.length;s<n;s+=1){const n=this._docs[s];t(n,s)&&(this.removeAt(s),s-=1,e.push(n))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:n=-1}={}){const{includeMatches:i,includeScore:r,shouldSort:c,sortFn:h,ignoreFieldNorm:a}=this.options;let l=e(t)?e(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,e,{ignoreFieldNorm:s=o.ignoreFieldNorm}){t.forEach(t=>{let n=1;t.matches.forEach(({key:t,norm:i,score:r})=>{const c=e.get(t,"weight");n*=Math.pow(0===r&&c?Number.EPSILON:r,(c||1)*(s?1:i))}),t.score=n})}(l,this._keyStore,{ignoreFieldNorm:a}),c&&l.sort(h),s(n)&&n>-1&&(l=l.slice(0,n)),function(t,e,{includeMatches:s=o.includeMatches,includeScore:n=o.includeScore}={}){const i=[];s&&i.push(u);n&&i.push(d);return t.map(t=>{const{idx:s}=t,n={item:e[s],refIndex:s};return i.length&&i.forEach(e=>{e(t,n)}),n})}(l,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t){const e=A(t,this.options),{records:s}=this._myIndex,i=[];return s.forEach(({v:t,i:s,n:r})=>{if(!n(t))return;const{isMatch:c,score:o,indices:h}=e.searchIn(t);c&&i.push({item:t,idx:s,matches:[{score:o,value:t,norm:r,indices:h}]})}),i}_searchLogical(t){const e=F(t,this.options),{keys:s,records:i}=this._myIndex,r={},c=[],o=(t,e,n)=>{if(!t.children){const{key:n,searcher:i}=t,r=e[s.indexOf(n)];return this._findMatches({key:n,value:r,searcher:i})}{const s=t.operator;let i=[];for(let r=0;r<t.children.length;r+=1){let c=t.children[r],h=o(c,e,n);if(h&&h.length){if(i.push({idx:n,item:e,matches:h}),s===$)break}else if(s===I){i.length=0;break}}i.length&&(r[n]||(r[n]={idx:n,item:e,matches:[]},c.push(r[n])),i.forEach(({matches:t})=>{r[n].matches.push(...t)}))}};return i.forEach(({$:t,i:s})=>{n(t)&&o(e,t,s)}),c}_searchObjectList(t){const e=A(t,this.options),{keys:s,records:i}=this._myIndex,r=[];return i.forEach(({$:t,i:i})=>{if(!n(t))return;let c=[];s.forEach((s,n)=>{c.push(...this._findMatches({key:s,value:t[n],searcher:e}))}),c.length&&r.push({idx:i,item:t,matches:c})}),r}_findMatches({key:e,value:s,searcher:i}){if(!n(s))return[];let r=[];if(t(s))s.forEach(({v:t,i:s,n:c})=>{if(!n(t))return;const{isMatch:o,score:h,indices:a}=i.searchIn(t);o&&r.push({score:h,key:e,value:t,idx:s,norm:c,indices:a})});else{const{v:t,n:n}=s,{isMatch:c,score:o,indices:h}=i.searchIn(t);c&&r.push({score:o,key:e,value:t,norm:n,indices:h})}return r}}O.version="6.1.0-alpha.1",O.createIndex=l,O.parseIndex=function(t,{getFn:e=o.getFn}={}){const{keys:s,records:n}=t;let i=new a({getFn:e});return i.setKeys(s),i.setIndexRecords(n),i},O.config=o,function(...t){w.push(...t)}(C);export default O; |
101
dist/fuse.js
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -164,7 +164,9 @@ * Copyright (c) 2020 Kiro Risk (http://kiro.me) | ||
function _createSuper(Derived) { | ||
return function () { | ||
var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
return function _createSuperInternal() { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (_isNativeReflectConstruct()) { | ||
if (hasNativeReflectConstruct) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
@@ -198,3 +200,3 @@ | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
@@ -374,7 +376,7 @@ } | ||
var MatchOptions = { | ||
// Whether the matches should be included in the result set. When true, each record in the result | ||
// Whether the matches should be included in the result set. When `true`, each record in the result | ||
// set will include the indices of the matched characters. | ||
// These can consequently be used for highlighting purposes. | ||
includeMatches: false, | ||
// When true, the matching function will continue to the end of a search pattern even if | ||
// When `true`, the matching function will continue to the end of a search pattern even if | ||
// a perfect match has already been located in the string. | ||
@@ -386,3 +388,3 @@ findAllMatches: false, | ||
var BasicOptions = { | ||
// When true, the algorithm continues searching to the end of the input even if a perfect | ||
// When `true`, the algorithm continues searching to the end of the input even if a perfect | ||
// match is found before the end of the same input. | ||
@@ -412,11 +414,18 @@ isCaseSensitive: false, | ||
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. | ||
distance: 100, | ||
ignoreLocation: false | ||
distance: 100 | ||
}; | ||
var AdvancedOptions = { | ||
// When true, it enables the use of unix-like search commands | ||
// When `true`, it enables the use of unix-like search commands | ||
useExtendedSearch: false, | ||
// The get function to use when fetching an object's properties. | ||
// The default will search nested paths *ie foo.bar.baz* | ||
getFn: get | ||
getFn: get, | ||
// When `true`, search will ignore `location` and `distance`, so it won't matter | ||
// where in the string the pattern appears. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score | ||
ignoreLocation: false, | ||
// When `true`, the calculation for the relevance score (used for sorting) will | ||
// ignore the field-length norm. | ||
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm | ||
ignoreFieldNorm: false | ||
}; | ||
@@ -460,8 +469,8 @@ var Config = _objectSpread2({}, BasicOptions, {}, MatchOptions, {}, FuzzyOptions, {}, AdvancedOptions); | ||
this.isCreated = false; | ||
this.setRecords(); | ||
this.setIndexRecords(); | ||
} | ||
_createClass(FuseIndex, [{ | ||
key: "setCollection", | ||
value: function setCollection() { | ||
key: "setSources", | ||
value: function setSources() { | ||
var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -471,4 +480,4 @@ this.docs = docs; | ||
}, { | ||
key: "setRecords", | ||
value: function setRecords() { | ||
key: "setIndexRecords", | ||
value: function setIndexRecords() { | ||
var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
@@ -632,3 +641,3 @@ this.records = records; | ||
myIndex.setKeys(keys); | ||
myIndex.setCollection(docs); | ||
myIndex.setSources(docs); | ||
myIndex.create(); | ||
@@ -648,3 +657,3 @@ return myIndex; | ||
myIndex.setKeys(keys); | ||
myIndex.setRecords(records); | ||
myIndex.setIndexRecords(records); | ||
return myIndex; | ||
@@ -1778,2 +1787,25 @@ } | ||
}, { | ||
key: "remove", | ||
value: function remove() { | ||
var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () { | ||
return ( | ||
/* doc, idx */ | ||
false | ||
); | ||
}; | ||
var results = []; | ||
for (var i = 0, len = this._docs.length; i < len; i += 1) { | ||
var doc = this._docs[i]; | ||
if (predicate(doc, i)) { | ||
this.removeAt(i); | ||
i -= 1; | ||
results.push(doc); | ||
} | ||
} | ||
return results; | ||
} | ||
}, { | ||
key: "removeAt", | ||
@@ -1801,5 +1833,8 @@ value: function removeAt(idx) { | ||
shouldSort = _this$options.shouldSort, | ||
sortFn = _this$options.sortFn; | ||
sortFn = _this$options.sortFn, | ||
ignoreFieldNorm = _this$options.ignoreFieldNorm; | ||
var results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query); | ||
computeScore$1(results, this._keyStore); | ||
computeScore$1(results, this._keyStore, { | ||
ignoreFieldNorm: ignoreFieldNorm | ||
}); | ||
@@ -2040,11 +2075,13 @@ if (shouldSort) { | ||
function computeScore$1(results, keyStore) { | ||
function computeScore$1(results, keyStore, _ref8) { | ||
var _ref8$ignoreFieldNorm = _ref8.ignoreFieldNorm, | ||
ignoreFieldNorm = _ref8$ignoreFieldNorm === void 0 ? Config.ignoreFieldNorm : _ref8$ignoreFieldNorm; | ||
results.forEach(function (result) { | ||
var totalScore = 1; | ||
result.matches.forEach(function (_ref8) { | ||
var key = _ref8.key, | ||
norm = _ref8.norm, | ||
score = _ref8.score; | ||
result.matches.forEach(function (_ref9) { | ||
var key = _ref9.key, | ||
norm = _ref9.norm, | ||
score = _ref9.score; | ||
var weight = keyStore.get(key, 'weight'); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * norm); | ||
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm)); | ||
}); | ||
@@ -2056,7 +2093,7 @@ result.score = totalScore; | ||
function format(results, docs) { | ||
var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref9$includeMatches = _ref9.includeMatches, | ||
includeMatches = _ref9$includeMatches === void 0 ? Config.includeMatches : _ref9$includeMatches, | ||
_ref9$includeScore = _ref9.includeScore, | ||
includeScore = _ref9$includeScore === void 0 ? Config.includeScore : _ref9$includeScore; | ||
var _ref10 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref10$includeMatches = _ref10.includeMatches, | ||
includeMatches = _ref10$includeMatches === void 0 ? Config.includeMatches : _ref10$includeMatches, | ||
_ref10$includeScore = _ref10.includeScore, | ||
includeScore = _ref10$includeScore === void 0 ? Config.includeScore : _ref10$includeScore; | ||
@@ -2083,3 +2120,3 @@ var transformers = []; | ||
Fuse.version = '6.1.0-alpha.0'; | ||
Fuse.version = '6.1.0-alpha.1'; | ||
Fuse.createIndex = createIndex; | ||
@@ -2086,0 +2123,0 @@ Fuse.parseIndex = parseIndex; |
/** | ||
* Fuse.js v6.1.0-alpha.0 - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v6.1.0-alpha.1 - 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 a(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 s(e){return(s=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=s(e);if(h()){var r=s(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,ignoreLocation:!1},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i){if(i){var o=i.indexOf("."),c=i,a=null;-1!==o&&(c=i.slice(0,o),a=i.slice(o+1));var s=t[c];if(!m(s))return;if(a||!g(s)&&!p(s))if(y(s)){r=!0;for(var u=0,h=s.length;u<h;u+=1)e(s[u],a)}else a&&e(s,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)}(s))}else n.push(t)}(e,t),r?n:n[0]}}),w=/[^ ]+/g;function L(){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 O=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=L(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(),a=c.nestedArrIndex,s=c.value;if(m(s))if(g(s)&&!k(s)){var u={v:s,i:a,n:n.norm.get(s)};e.push(u)}else y(s)&&s.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 C(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?_.getFn:r,o=new O({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,a=void 0===c?0:c,s=t.distance,u=void 0===s?_.distance:s,h=t.ignoreLocation,f=void 0===h?_.ignoreLocation:h,l=r/e.length;if(f)return l;var d=Math.abs(a-o);return u?l+d/u:d?1:l}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 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 $(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,a=i.threshold,s=void 0===a?_.threshold:a,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,k=i.ignoreLocation,M=void 0===k?_.ignoreLocation:k;if(t(this,e),this.options={location:c,threshold:s,distance:h,includeMatches:l,findAllMatches:v,minMatchCharLength:g,isCaseSensitive:m,ignoreLocation:M},this.pattern=m?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var b=function(e,t){r.chunks.push({pattern:e,alphabet:$(e),startIndex:t})},x=this.pattern.length;if(x>32){for(var S=0,w=x%32,L=x-w;S<L;)b(this.pattern.substr(S,32),S),S+=32;if(w){var O=x-32;b(this.pattern.substr(O),O)}}else b(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,a=o.distance,s=o.threshold,u=o.findAllMatches,h=o.minMatchCharLength,f=o.ignoreLocation,l=[],v=0,y=!1;this.chunks.forEach((function(t){var n=t.pattern,i=t.alphabet,o=t.startIndex,g=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,a=void 0===c?_.distance:c,s=r.threshold,u=void 0===s?_.threshold:s,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,g=r.ignoreLocation,p=void 0===g?_.ignoreLocation:g;if(t.length>32)throw new Error(b(32));var m,k=t.length,M=e.length,x=Math.max(0,Math.min(o,M)),S=u,w=x,L=[];if(y)for(var O=0;O<M;O+=1)L[O]=0;for(;(m=e.indexOf(t,w))>-1;){var C=E(t,{currentLocation:m,expectedLocation:x,distance:a,ignoreLocation:p});if(S=Math.min(C,S),w=m+k,y)for(var j=0;j<k;)L[m+j]=1,j+=1}w=-1;for(var A=[],$=1,R=k+M,P=1<<k-1,F=0;F<k;F+=1){for(var N=0,D=R;N<D;){var z=E(t,{errors:F,currentLocation:x+D,expectedLocation:x,distance:a,ignoreLocation:p});z<=S?N=D:R=D,D=Math.floor((R-N)/2+N)}R=D;var q=Math.max(1,x-D+1),W=f?M:Math.min(x+D,M)+k,J=Array(W+2);J[W+1]=(1<<F)-1;for(var K=W;K>=q;K-=1){var T=K-1,U=n[e.charAt(T)];if(U&&y&&(L[T]=1),J[K]=(J[K+1]<<1|1)&U,0!==F&&(J[K]|=(A[K+1]|A[K])<<1|1|A[K+1]),J[K]&P&&($=E(t,{errors:F,currentLocation:T,expectedLocation:x,distance:a,ignoreLocation:p}))<=S){if(S=$,(w=T)<=x)break;q=Math.max(1,2*x-w)}}var B=E(t,{errors:F+1,currentLocation:x,expectedLocation:x,distance:a,ignoreLocation:p});if(B>S)break;A=J}var G={isMatch:w>=0,score:Math.max(.001,$)};return y&&(G.indices=I(L,d)),G}(e,n,i,{location:c+o,distance:a,threshold:s,findAllMatches:u,minMatchCharLength:h,includeMatches:r,ignoreLocation:f}),p=g.isMatch,m=g.score,k=g.indices;p&&(y=!0),v+=m,p&&k&&(l=[].concat(d(l),d(k)))}));var g={isMatch:y,score:y?v/this.chunks.length:1};return y&&r&&(g.indices=l),g}}]),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){a(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){a(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){a(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){a(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){a(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){a(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){a(i,e);var n=l(i);function i(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,a=void 0===c?_.location:c,s=o.threshold,u=void 0===s?_.threshold:s,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:a,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],a=!1,s=-1;!a&&++s<U;){var u=T[s],h=u.isMultiMatch(c);h&&(r.push(new u(h,t)),a=!0)}if(!a)for(s=-1;++s<U;){var f=T[s],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,a=void 0===c?_.includeMatches:c,s=r.minMatchCharLength,u=void 0===s?_.minMatchCharLength:s,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:a,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,a=0,s=t.length;a<s;a+=1){var u=t[a];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 O))throw new Error("Incorrect 'index' type");this._myIndex=t||C(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,a=i.shouldSort,s=i.sortFn,u=g(e)?g(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return ie(u,this._keyStore),a&&u.sort(s),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),a=c.isMatch,s=c.score,u=c.indices;a&&r.push({item:n,idx:i,matches:[{score:s,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 a={key:o,pattern:c};return i&&(a.searcher=X(c,t)),a}var s={children:[],operator:o};return r.forEach((function(t){var r=n[t];y(r)&&r.forEach((function(t){s.children.push(e(t))}))})),s};return ee(e)||(e=ne(e)),o(e)}(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c={},a=[];return o.forEach((function(e){var r=e.$,o=e.i;m(r)&&function e(n,r,o){if(!n.children){var s=n.key,u=n.searcher,h=r[i.indexOf(s)];return t._findMatches({key:s,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:[]},a.push(c[o])),l.forEach((function(e){var t,n=e.matches;(t=c[o].matches).push.apply(t,d(n))})))}(n,r,o)})),a}},{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 a=[];i.forEach((function(e,i){a.push.apply(a,d(t._findMatches({key:e,value:r[i],searcher:n})))})),a.length&&c.push({idx:o,item:r,matches:a})}})),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 a=r.searchIn(n),s=a.isMatch,u=a.score,h=a.indices;s&&i.push({score:u,key:t,value:n,idx:o,norm:c,indices:h})}}));else{var o=n.v,c=n.n,a=r.searchIn(o),s=a.isMatch,u=a.score,h=a.indices;s&&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,a=[];return i&&a.push(j),c&&a.push(A),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 re.version="6.1.0-alpha.0",re.createIndex=C,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 O({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 a(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 s(e){return(s=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(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 f(e){var t=function(){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}}();return function(){var n,r=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h(this,n)}}function l(e){return function(e){if(Array.isArray(e))return d(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 d(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(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(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 d(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 v(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function g(e){return"string"==typeof e}function y(e){return"number"==typeof e}function p(e){return null!=e}function m(e){return!e.trim().length}var k=function(e){return"Invalid value for key ".concat(e)},M=function(e){return"Pattern length exceeds max of ".concat(e,".")},x=Object.prototype.hasOwnProperty,b=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}(),S=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,a=null;-1!==o&&(c=i.slice(0,o),a=i.slice(o+1));var s=t[c];if(!p(s))return;if(a||!g(s)&&!y(s))if(v(s)){r=!0;for(var u=0,h=s.length;u<h;u+=1)e(s[u],a)}else a&&e(s,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)}(s))}else n.push(t)}(e,t),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1}),_=/[^ ]+/g;function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(_).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 L=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?S.getFn:r;t(this,e),this.norm=w(3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return r(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",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(p(e)&&!m(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(p(o))if(v(o))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:o}];t.length;){var c=t.pop(),a=c.nestedArrIndex,s=c.value;if(p(s))if(g(s)&&!m(s)){var u={v:s,i:a,n:n.norm.get(s)};e.push(u)}else v(s)&&s.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[i]=e}();else if(!m(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 O(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?S.getFn:r,o=new L({getFn:i});return o.setKeys(e),o.setSources(t),o.create(),o}function C(e,t){var n=e.matches;t.matches=[],p(n)&&n.forEach((function(e){if(p(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 j(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,a=void 0===c?0:c,s=t.distance,u=void 0===s?S.distance:s,h=t.ignoreLocation,f=void 0===h?S.ignoreLocation:h,l=r/e.length;if(f)return l;var d=Math.abs(a-o);return u?l+d/u:d?1:l}function E(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o<c;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 I(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 $=function(){function e(n){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,c=void 0===o?S.location:o,a=i.threshold,s=void 0===a?S.threshold:a,u=i.distance,h=void 0===u?S.distance:u,f=i.includeMatches,l=void 0===f?S.includeMatches:f,d=i.findAllMatches,v=void 0===d?S.findAllMatches:d,g=i.minMatchCharLength,y=void 0===g?S.minMatchCharLength:g,p=i.isCaseSensitive,m=void 0===p?S.isCaseSensitive:p,k=i.ignoreLocation,M=void 0===k?S.ignoreLocation:k;if(t(this,e),this.options={location:c,threshold:s,distance:h,includeMatches:l,findAllMatches:v,minMatchCharLength:y,isCaseSensitive:m,ignoreLocation:M},this.pattern=m?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var x=function(e,t){r.chunks.push({pattern:e,alphabet:I(e),startIndex:t})},b=this.pattern.length;if(b>32){for(var _=0,w=b%32,L=b-w;_<L;)x(this.pattern.substr(_,32),_),_+=32;if(w){var O=b-32;x(this.pattern.substr(O),O)}}else x(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,a=o.distance,s=o.threshold,u=o.findAllMatches,h=o.minMatchCharLength,f=o.ignoreLocation,d=[],v=0,g=!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?S.location:i,c=r.distance,a=void 0===c?S.distance:c,s=r.threshold,u=void 0===s?S.threshold:s,h=r.findAllMatches,f=void 0===h?S.findAllMatches:h,l=r.minMatchCharLength,d=void 0===l?S.minMatchCharLength:l,v=r.includeMatches,g=void 0===v?S.includeMatches:v,y=r.ignoreLocation,p=void 0===y?S.ignoreLocation:y;if(t.length>32)throw new Error(M(32));var m,k=t.length,x=e.length,b=Math.max(0,Math.min(o,x)),_=u,w=b,L=[];if(g)for(var O=0;O<x;O+=1)L[O]=0;for(;(m=e.indexOf(t,w))>-1;){var C=j(t,{currentLocation:m,expectedLocation:b,distance:a,ignoreLocation:p});if(_=Math.min(C,_),w=m+k,g)for(var A=0;A<k;)L[m+A]=1,A+=1}w=-1;for(var I=[],$=1,R=k+x,F=1<<k-1,P=0;P<k;P+=1){for(var N=0,D=R;N<D;){var z=j(t,{errors:P,currentLocation:b+D,expectedLocation:b,distance:a,ignoreLocation:p});z<=_?N=D:R=D,D=Math.floor((R-N)/2+N)}R=D;var q=Math.max(1,b-D+1),W=f?x:Math.min(b+D,x)+k,J=Array(W+2);J[W+1]=(1<<P)-1;for(var K=W;K>=q;K-=1){var T=K-1,U=n[e.charAt(T)];if(U&&g&&(L[T]=1),J[K]=(J[K+1]<<1|1)&U,0!==P&&(J[K]|=(I[K+1]|I[K])<<1|1|I[K+1]),J[K]&F&&($=j(t,{errors:P,currentLocation:T,expectedLocation:b,distance:a,ignoreLocation:p}))<=_){if(_=$,(w=T)<=b)break;q=Math.max(1,2*b-w)}}var B=j(t,{errors:P+1,currentLocation:b,expectedLocation:b,distance:a,ignoreLocation:p});if(B>_)break;I=J}var G={isMatch:w>=0,score:Math.max(.001,$)};return g&&(G.indices=E(L,d)),G}(e,n,i,{location:c+o,distance:a,threshold:s,findAllMatches:u,minMatchCharLength:h,includeMatches:r,ignoreLocation:f}),p=y.isMatch,m=y.score,k=y.indices;p&&(g=!0),v+=m,p&&k&&(d=[].concat(l(d),l(k)))}));var y={isMatch:g,score:g?v/this.chunks.length:1};return g&&r&&(y.indices=d),y}}]),e}(),R=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 P=function(e){a(i,e);var n=f(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}(R),N=function(e){a(i,e);var n=f(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}(R),D=function(e){a(i,e);var n=f(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}(R),z=function(e){a(i,e);var n=f(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}(R),q=function(e){a(i,e);var n=f(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}(R),W=function(e){a(i,e);var n=f(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}(R),J=function(e){a(i,e);var n=f(i);function i(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,a=void 0===c?S.location:c,s=o.threshold,u=void 0===s?S.threshold:s,h=o.distance,f=void 0===h?S.distance:h,l=o.includeMatches,d=void 0===l?S.includeMatches:l,v=o.findAllMatches,g=void 0===v?S.findAllMatches:v,y=o.minMatchCharLength,p=void 0===y?S.minMatchCharLength:y,m=o.isCaseSensitive,k=void 0===m?S.isCaseSensitive:m;return t(this,i),(r=n.call(this,e))._bitapSearch=new $(e,{location:a,threshold:u,distance:f,includeMatches:d,findAllMatches:g,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}(R),K=[P,D,z,W,q,N,J],T=K.length,U=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(U).filter((function(e){return e&&!!e.trim()})),r=[],i=0,o=n.length;i<o;i+=1){for(var c=n[i],a=!1,s=-1;!a&&++s<T;){var u=K[s],h=u.isMultiMatch(c);h&&(r.push(new u(h,t)),a=!0)}if(!a)for(s=-1;++s<T;){var f=K[s],l=f.isSingleMatch(c);if(l){r.push(new f(l,t));break}}}return r}))}var G=new Set([J.type,P.type]),H=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.isCaseSensitive,o=void 0===i?S.isCaseSensitive:i,c=r.includeMatches,a=void 0===c?S.includeMatches:c,s=r.minMatchCharLength,u=void 0===s?S.minMatchCharLength:s,h=r.findAllMatches,f=void 0===h?S.findAllMatches:h,l=r.location,d=void 0===l?S.location:l,v=r.threshold,g=void 0===v?S.threshold:v,y=r.distance,p=void 0===y?S.distance:y;t(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:a,minMatchCharLength:u,findAllMatches:f,location:d,threshold:g,distance:p},this.pattern=o?n:n.toLowerCase(),this.query=B(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,a=0,s=t.length;a<s;a+=1){var u=t[a];o.length=0,i=0;for(var h=0,f=u.length;h<f;h+=1){var d=u[h],v=d.search(e),g=v.isMatch,y=v.indices,p=v.score;if(!g){c=0,i=0,o.length=0;break}if(i+=1,c+=p,r){var m=d.constructor.type;G.has(m)?o=[].concat(l(o),l(y)):o.push(y)}}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}(),Q=[];function V(e,t){for(var n=0,r=Q.length;n<r;n+=1){var i=Q[n];if(i.condition(e,t))return new i(e,t)}return new $(e,t)}var X="$and",Y="$or",Z=function(e){return!(!e[X]&&!e[Y])},ee=function(t){return!v(t)&&"object"===e(t)&&!Z(t)},te=function(e){return i({},X,Object.keys(e).map((function(t){return i({},t,e[t])})))},ne=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({},S,{},r),this.options.useExtendedSearch,this._keyStore=new b(this.options.keys),this.setCollection(n,i)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof L))throw new Error("Incorrect 'index' type");this._myIndex=t||O(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){p(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n<r;n+=1){var i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,t.push(i))}return t}},{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,a=i.shouldSort,s=i.sortFn,u=i.ignoreFieldNorm,h=g(e)?g(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return re(h,this._keyStore,{ignoreFieldNorm:u}),a&&h.sort(s),y(r)&&r>-1&&(h=h.slice(0,r)),ie(h,this._docs,{includeMatches:o,includeScore:c})}},{key:"_searchStringList",value:function(e){var t=V(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(p(n)){var c=t.searchIn(n),a=c.isMatch,s=c.score,u=c.indices;a&&r.push({item:n,idx:i,matches:[{score:s,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&&!Z(n))return e(te(n));var o=r[0];if(ee(n)){var c=n[o];if(!g(c))throw new Error(k(o));var a={key:o,pattern:c};return i&&(a.searcher=V(c,t)),a}var s={children:[],operator:o};return r.forEach((function(t){var r=n[t];v(r)&&r.forEach((function(t){s.children.push(e(t))}))})),s};return Z(e)||(e=te(e)),o(e)}(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c={},a=[];return o.forEach((function(e){var r=e.$,o=e.i;p(r)&&function e(n,r,o){if(!n.children){var s=n.key,u=n.searcher,h=r[i.indexOf(s)];return t._findMatches({key:s,value:h,searcher:u})}for(var f=n.operator,d=[],v=0;v<n.children.length;v+=1){var g=e(n.children[v],r,o);if(g&&g.length){if(d.push({idx:o,item:r,matches:g}),f===Y)break}else if(f===X){d.length=0;break}}d.length&&(c[o]||(c[o]={idx:o,item:r,matches:[]},a.push(c[o])),d.forEach((function(e){var t,n=e.matches;(t=c[o].matches).push.apply(t,l(n))})))}(n,r,o)})),a}},{key:"_searchObjectList",value:function(e){var t=this,n=V(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(p(r)){var a=[];i.forEach((function(e,i){a.push.apply(a,l(t._findMatches({key:e,value:r[i],searcher:n})))})),a.length&&c.push({idx:o,item:r,matches:a})}})),c}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!p(n))return[];var i=[];if(v(n))n.forEach((function(e){var n=e.v,o=e.i,c=e.n;if(p(n)){var a=r.searchIn(n),s=a.isMatch,u=a.score,h=a.indices;s&&i.push({score:u,key:t,value:n,idx:o,norm:c,indices:h})}}));else{var o=n.v,c=n.n,a=r.searchIn(o),s=a.isMatch,u=a.score,h=a.indices;s&&i.push({score:u,key:t,value:o,norm:c,indices:h})}return i}}]),e}();function re(e,t,n){var r=n.ignoreFieldNorm,i=void 0===r?S.ignoreFieldNorm:r;e.forEach((function(e){var n=1;e.matches.forEach((function(e){var r=e.key,o=e.norm,c=e.score,a=t.get(r,"weight");n*=Math.pow(0===c&&a?Number.EPSILON:c,(a||1)*(i?1:o))})),e.score=n}))}function ie(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?S.includeMatches:r,o=n.includeScore,c=void 0===o?S.includeScore:o,a=[];return i&&a.push(C),c&&a.push(A),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 ne.version="6.1.0-alpha.1",ne.createIndex=O,ne.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?S.getFn:n,i=e.keys,o=e.records,c=new L({getFn:r});return c.setKeys(i),c.setIndexRecords(o),c},ne.config=S,function(){Q.push.apply(Q,arguments)}(H),ne},"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.1.0-alpha.0", | ||
"version": "6.1.0-alpha.1", | ||
"description": "Lightweight fuzzy-search", | ||
@@ -42,3 +42,3 @@ "license": "Apache-2.0", | ||
"devDependencies": { | ||
"@babel/cli": "7.2.3", | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.3.4", | ||
@@ -48,7 +48,7 @@ "@babel/plugin-proposal-object-rest-spread": "7.9.0", | ||
"@babel/preset-typescript": "7.9.0", | ||
"@rollup/plugin-node-resolve": "7.1.1", | ||
"@rollup/plugin-replace": "2.3.1", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"@rollup/plugin-replace": "^2.3.1", | ||
"@types/jest": "25.1.4", | ||
"@vuepress/plugin-google-analytics": "1.4.0", | ||
"babel-eslint": "10.1.0", | ||
"@vuepress/plugin-google-analytics": "^1.4.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-loader": "^8.0.5", | ||
@@ -60,18 +60,18 @@ "codemirror": "5.52.2", | ||
"faker": "4.1.0", | ||
"jest": "25.1.0", | ||
"jest": "^25.1.0", | ||
"prettier": "2.0.2", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.1.0", | ||
"rollup-plugin-babel": "4.4.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-copy": "3.3.0", | ||
"terser-webpack-plugin": "2.3.5", | ||
"typescript": "3.8.3", | ||
"vue-codemirror": "4.0.6", | ||
"vue-eslint-parser": "7.0.0", | ||
"vuepress": "1.4.0", | ||
"vuepress-plugin-element-tabs": "0.2.8", | ||
"vuepress-plugin-smooth-scroll": "0.0.9", | ||
"vuepress-plugin-social-share": "0.2.1", | ||
"webpack": "4.42.0", | ||
"webpack-cli": "3.3.11" | ||
"typescript": "^3.8.3", | ||
"vue-codemirror": "^4.0.6", | ||
"vue-eslint-parser": "^7.0.0", | ||
"vuepress": "^1.4.0", | ||
"vuepress-plugin-element-tabs": "^0.2.8", | ||
"vuepress-plugin-smooth-scroll": "^0.0.9", | ||
"vuepress-plugin-social-share": "^0.2.1", | ||
"webpack": "^4.42.0", | ||
"webpack-cli": "^3.3.11" | ||
}, | ||
@@ -78,0 +78,0 @@ "engines": { |
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
357133
8493