this.matcher.get(k)));if(g&&this.replacer)for(d=0;g&&dthis.S&&(this.G.clear(),this.L=this.L/1.1|0));g&&c.push(g)}this.finalize&&(c=this.finalize(c)||c);this.cache&&a.length<=this.K&&(this.B.set(a,c),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return c};function K(a){a.H=null;a.B.clear();a.G.clear()};let M,N;async function ka(a){a=a.data;var b=a.task;const c=a.id;let e=a.args;switch(b){case "init":N=a.options||{};(b=a.factory)?(Function("return "+b)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:c});break;default:let d;"export"===b&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===b?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[b].apply(M,e))&&d.then&&(d=await d);postMessage("search"===b?{id:c,msg:d}:{id:c})}};function la(a){ma.call(a,"add");ma.call(a,"append");ma.call(a,"search");ma.call(a,"update");ma.call(a,"remove")}let na,oa,pa;function qa(){na=pa=0}
function ma(a){this[a+"Async"]=function(){const b=arguments;var c=b[b.length-1];let e;"function"===typeof c&&(e=c,delete b[b.length-1]);na?pa||(pa=Date.now()-oa>=this.priority*this.priority*3):(na=setTimeout(qa,0),oa=Date.now());if(pa){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,b))},0)})}const d=this[a].apply(this,b);c=d.then?d:new Promise(f=>f(d));e&&c.then(e);return c}};let P=0;
-function Q(a={}){function b(g){function k(h){h=h.data||h;const l=h.id,n=l&&d.h[l];n&&(n(h.msg),delete d.h[l])}this.worker=g;this.h=B();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++P]=function(){h(d);1E9=g.length)b-=g.length;else{b=g[e?"splice":"slice"](b,c);const k=b.length;if(k&&(d=d.length?d.concat(b):b,c-=k,e&&(a.length-=k),!c))break;b=0}return d}
-function S(a){if(!this)return new S(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(c,e){if("length"===e)return b.length;if("push"===e)return function(d){b.index[b.index.length-1].push(d);b.length++};if("pop"===e)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===e)return function(d){let f=0;for(let g=0,k,h;gc||e?h.slice(e,c+e):h;else{if(ac||e)h=h.slice(e,c+e)}else{d=[];for(let m=0,q;me)e-=
-q.length;else{if(q.length>c||e)q=q.slice(e,c+e),c-=q.length,e&&(e-=q.length);d.push(q);if(!c)break}h=1b?b?a.slice(c,c+b):a.slice(c):a,e?W.call(this,a):a;let d=[];for(let f=0,g,k;f=k){c-=k;continue}cb&&(g=g.slice(0,b),k=b);if(!d.length&&k>=b)return e?W.call(this,g):g;d.push(g);b-=k;if(!b)break}d=1a.length?this.result=a[0]:(this.result=Fa(a,c,e,!1,this.h),e=0));return f?this.resolve(c,e,d):this};X.prototype.and=function(){let a=this.result.length,b,c,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,b=f.limit,c=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:n,suggest:m}=Ia(this,"and",arguments);return Ka.call(this,f,g,k,h,l,n,m)}return d?this.resolve(b,c,e):this};
-function Ka(a,b,c,e,d,f,g){if(b.length){const k=this;return Promise.all(b).then(function(h){a=[];for(let l=0,n;la.length)this.result=a[0];else{if(b=ca(a))return this.result=Ea(a,b,c,e,g,this.h,f),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(c,e,d):this};X.prototype.xor=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f,suggest:g}=Ia(this,"xor",arguments);return La.call(this,a,b,c,e,d,f,g)};
-function La(a,b,c,e,d,f,g){if(b.length){const k=this;return Promise.all(b).then(function(h){a=[];for(let l=0,n;la.length)this.result=a[0];else return this.result=Ma.call(this,a,c,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(c,e,d):this}
-function Ma(a,b,c,e,d){const f=[],g=B();let k=0;for(let h=0,l;hc||e)a=a.slice(e,e+c);d&&(a=W.call(this,a));return a}}function W(a){if(!this||!this.store)return a;const b=Array(a.length);for(let c=0,e;cthis.limit&&this.cache.delete(this.cache.keys().next().value)};
-Y.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Y.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Va={normalize:function(a){return a.toLowerCase()}};const Wa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Xa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Ya=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Za={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const $a=/[\x00-\x7F]+/g;const ab=/[\x00-\x7F]+/g;const bb=/[\x00-\x7F]+/g;var cb={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Va,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Wa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Wa,matcher:Xa,replacer:Ya},LatinExtra:{normalize:!0,dedupe:!0,mapper:Wa,replacer:Ya.concat([/(?!^)[aeo]/g,""]),matcher:Xa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;ct;f--){g=r.substring(t,f);v=this.rtl?d-1-t:t;var k=this.score?this.score(b,r,p,g,v):eb(q,e,p,d,v);
-fb(this,n,g,k,a,c)}break}case "reverse":if(1g?0:1),e,p,k-1,h-1),v=this.bidirectional&&
-r>f;fb(this,l,v?f:r,t,a,c,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.T&&gb(this));return this};
-function fb(a,b,c,e,d,f,g){let k=g?a.ctx:a.map,h;if(!b[c]||g&&!(h=b[c])[g])if(g?(b=h||(b[c]=B()),b[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):b[c]=1,(h=k.get(c))?k=h:k.set(c,k=h=[]),k=k[e]||(k[e]=[]),!f||!k.includes(d)){if(k.length===2**31-1){b=new S(k);if(a.fastupdate)for(let l of a.reg.values())l.includes(k)&&(l[l.indexOf(k)]=b);h[e]=k=b}k.push(d);a.fastupdate&&((e=a.reg.get(d))?e.push(k):a.reg.set(d,[k]))}}
-function eb(a,b,c,e,d){return c&&1c)&&(h=c,c=b,b=h);if(a.db)return a.db.get(b,c,e,d,f,g,k);a=c?(a=a.ctx.get(c))&&a.get(b):a.map.get(b);return a};O.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let e=0,d;ed.length)d.pop();else{const f=d.indexOf(a);f===c.length-1?d.pop():d.splice(f,1)}}else lb(this.map,a),this.depth&&lb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&gb(this));this.cache&&this.cache.remove(a);return this};
-function lb(a,b){let c=0;if(a.constructor===Array)for(let e=0,d,f;ec.add(a,b)):this.add(a,b)};
-function nb(a){let b=0;if(a.constructor===Array)for(let c=0,e;c{d.objectStoreNames.contains(f)||d.createObjectStore(f)})};e.onblocked=function(d){console.error("blocked",d);c()};e.onerror=function(d){console.error(this.error,d);c()};e.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})};
-u.close=function(){this.db.close();this.db=null};u.destroy=function(){const a=ob.deleteDatabase(this.id+(this.field?":"+this.field:""));return Z(a)};u.clear=function(){const a=this.db.transaction(pb,"readwrite");for(let b=0;b=n.length){e-=n.length;continue}const m=c?e+Math.min(n.length-e,c):n.length;for(let q=e;q=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return e?d.enrich(f):f})};
-u.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let e=0;e{d.onerror=h=>{d.abort();d=e=null;g(h)};d.oncomplete=h=>{d=e=null;f(h||!0)};const k=c.call(this,e);this.h[a+":"+b]=null;return k})};
-u.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let e=a.commit_task;a.commit_task=[];for(let d=0,f;dn&&!f&&"string"===typeof m&&!isNaN(m)&&(n=h.indexOf(parseInt(m,10)))&&(f=1),0<=n)if(d=1,1{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};export default {Index:O,Charset:cb,Encoder:J,Document:V,Worker:Q,Resolver:X,IndexedDB:qb,Language:{}};
-export const Index=O;export const Charset=cb;export const Encoder=J;export const Document=V;export const Worker=Q;export const Resolver=X;export const IndexedDB=qb;export const Language={};
\ No newline at end of file
+function ya(a,b,c,e,d,f,g=0){const h=e&&e.constructor===Array;var k=h?e.shift():e;if(!k)return this.export(a,b,d,f+1);if((k=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(k)))&&k.then){const l=this;return k.then(function(){return ya.call(l,a,b,c,h?e:null,d,f,g+1)})}return ya.call(this,a,b,c,h?e:null,d,f,g+1)}
+function za(a,b){let c="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,h;g=g.length)b-=g.length;else{b=g[e?"splice":"slice"](b,c);const h=b.length;if(h&&(d=d.length?d.concat(b):b,c-=h,e&&(a.length-=h),!c))break;b=0}return d}
+function S(a){if(!this||this.constructor!==S)return new S(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(c,e){if("length"===e)return b.length;if("push"===e)return function(d){b.index[b.index.length-1].push(d);b.length++};if("pop"===e)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===e)return function(d){let f=0;for(let g=0,h,k;gc||e?k.slice(e,c+e):k;else{if(ac||e)k=k.slice(e,c+e)}else{d=[];for(let n=
+0,p;ne)e-=p.length;else{if(p.length>c||e)p=p.slice(e,c+e),c-=p.length,e&&(e-=p.length);d.push(p);if(!c)break}k=1b?b?a.slice(c,c+b):a.slice(c):a,e?W.call(this,a):a;let d=[];for(let f=0,g,h;f=h){c-=h;continue}cb&&(g=g.slice(0,b),h=b);if(!d.length&&h>=b)return e?W.call(this,g):g;d.push(g);b-=h;if(!b)break}d=1a.length?this.result=a[0]:(this.result=Ga(a,c,e,!1,this.h),e=0));return f?this.resolve(c,e,d):this};X.prototype.and=function(){let a=this.result.length,b,c,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,b=f.limit,c=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:h,offset:k,enrich:l,resolve:m,suggest:n}=Ja(this,"and",arguments);return La.call(this,f,g,h,k,l,m,n)}return d?this.resolve(b,c,e):this};
+function La(a,b,c,e,d,f,g){if(b.length){const h=this;return Promise.all(b).then(function(k){a=[];for(let l=0,m;la.length)this.result=a[0];else{if(b=ca(a))return this.result=Fa(a,b,c,e,g,this.h,f),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(c,e,d):this};X.prototype.xor=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f,suggest:g}=Ja(this,"xor",arguments);return Ma.call(this,a,b,c,e,d,f,g)};
+function Ma(a,b,c,e,d,f,g){if(b.length){const h=this;return Promise.all(b).then(function(k){a=[];for(let l=0,m;la.length)this.result=a[0];else return this.result=Na.call(this,a,c,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(c,e,d):this}
+function Na(a,b,c,e,d){const f=[],g=B();let h=0;for(let k=0,l;kc||e)a=a.slice(e,e+c);d&&(a=W.call(this,a));return a}}function W(a){if(!this||!this.store)return a;const b=Array(a.length);for(let c=0,e;cthis.limit&&this.cache.delete(this.cache.keys().next().value)};
+Y.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Y.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Wa={normalize:function(a){return a.toLowerCase()}};const Xa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Ya=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Za=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const $a={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const ab=/[\x00-\x7F]+/g;const bb=/[\x00-\x7F]+/g;const cb=/[\x00-\x7F]+/g;var db={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Wa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Xa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Xa,matcher:Ya,replacer:Za},LatinExtra:{normalize:!0,dedupe:!0,mapper:Xa,replacer:Za.concat([/(?!^)[aeo]/g,""]),matcher:Ya},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;cu;f--){g=q.substring(u,f);v=this.rtl?d-1-u:u;var h=this.score?this.score(b,q,r,g,v):fb(p,e,r,d,v);
+gb(this,m,g,h,a,c)}break}case "reverse":if(1g?0:1),e,r,h-1,k-1),v=this.bidirectional&&
+q>f;gb(this,l,v?f:q,u,a,c,v?q:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.T&&hb(this));return this};
+function gb(a,b,c,e,d,f,g){let h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=B()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[e]||(h[e]=[]),!f||!h.includes(d)){if(h.length===2**31-1){b=new S(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.indexOf(h)]=b);k[e]=h=b}h.push(d);a.fastupdate&&((e=a.reg.get(d))?e.push(h):a.reg.set(d,[h]))}}
+function fb(a,b,c,e,d){return c&&1c)&&(k=c,c=b,b=k);if(a.db)return a.db.get(b,c,e,d,f,g,h);a=c?(a=a.ctx.get(c))&&a.get(b):a.map.get(b);return a};O.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let e=0,d;ed.length)d.pop();else{const f=d.indexOf(a);f===c.length-1?d.pop():d.splice(f,1)}}else mb(this.map,a),this.depth&&mb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&hb(this));this.cache&&this.cache.remove(a);return this};
+function mb(a,b){let c=0;if(a.constructor===Array)for(let e=0,d,f;ec.add(a,b)):this.add(a,b)};
+function ob(a){let b=0;if(a.constructor===Array)for(let c=0,e;c{d.objectStoreNames.contains(f)||d.createObjectStore(f)})};e.onblocked=function(d){console.error("blocked",d);c()};e.onerror=function(d){console.error(this.error,d);c()};e.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})};
+t.close=function(){this.db&&this.db.close();this.db=null};t.destroy=function(){const a=pb.deleteDatabase(this.id+(this.field?":"+this.field:""));return Z(a)};t.clear=function(){const a=this.db.transaction(qb,"readwrite");for(let b=0;b=m.length){e-=m.length;continue}const n=c?e+Math.min(m.length-e,c):m.length;for(let p=e;p=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return e?d.enrich(f):f})};
+t.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let e=0;e{d.onerror=k=>{d.abort();d=e=null;g(k)};d.oncomplete=k=>{d=e=null;f(k||!0)};const h=c.call(this,e);this.h[a+":"+b]=null;return h})};
+t.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let e=a.commit_task;a.commit_task=[];for(let d=0,f;dm&&!f&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(d=1,1{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};export default {Index:O,Charset:db,Encoder:J,Document:V,Worker:Q,Resolver:X,IndexedDB:rb,Language:{}};
+export const Index=O;export const Charset=db;export const Encoder=J;export const Document=V;export const Worker=Q;export const Resolver=X;export const IndexedDB=rb;export const Language={};
\ No newline at end of file
diff --git a/dist/flexsearch.compact.debug.js b/dist/flexsearch.compact.debug.js
index 91ba9ff..e7d68ba 100644
--- a/dist/flexsearch.compact.debug.js
+++ b/dist/flexsearch.compact.debug.js
@@ -1,5 +1,5 @@
/**!
- * FlexSearch.js v0.8.123 (Bundle/Debug)
+ * FlexSearch.js v0.8.132 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -13,8 +13,8 @@ function B(a, c, b) {
if ("undefined" !== d) {
if (b) {
if ("function" === d && e === d) {
- return function(k) {
- return a(b(k));
+ return function(h) {
+ return a(b(h));
};
}
c = a.constructor;
@@ -128,15 +128,16 @@ x.assign = function(a) {
this.prepare = B(a.prepare, null, this.prepare);
this.finalize = B(a.finalize, null, this.finalize);
ha || (this.mapper = new Map(ba));
- this.rtl = B(a.rtl, !1, this.rtl);
+ b = a.filter;
+ this.filter = "function" === typeof b ? b : B(b && new Set(b), null, this.filter);
this.dedupe = B(a.dedupe, !1, this.dedupe);
- this.filter = B((b = a.filter) && new Set(b), null, this.filter);
this.matcher = B((b = a.matcher) && new Map(b), null, this.matcher);
this.mapper = B((b = a.mapper) && new Map(b), null, this.mapper);
this.stemmer = B((b = a.stemmer) && new Map(b), null, this.stemmer);
this.replacer = B(a.replacer, null, this.replacer);
this.minlength = B(a.minlength, 1, this.minlength);
this.maxlength = B(a.maxlength, 0, this.maxlength);
+ this.rtl = B(a.rtl, !1, this.rtl);
if (this.cache = b = B(a.cache, !0, this.cache)) {
this.H = null, this.R = "number" === typeof b ? b : 2e5, this.F = new Map(), this.G = new Map(), this.L = this.K = 128;
}
@@ -165,8 +166,7 @@ x.addStemmer = function(a, c) {
return this;
};
x.addFilter = function(a) {
- this.filter || (this.filter = new Set());
- this.filter.add(a);
+ "function" === typeof a ? this.filter = a : (this.filter || (this.filter = new Set()), this.filter.add(a));
this.cache && L(this);
return this;
};
@@ -220,12 +220,12 @@ x.encode = function(a) {
this.numeric && 3 < a.length && (a = a.replace(ea, "$1 $2").replace(fa, "$1 $2").replace(da, "$1 "));
const c = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
let b = [], e = this.split || "" === this.split ? a.split(this.split) : a;
- for (let f = 0, g, k; f < e.length; f++) {
- if ((g = k = e[f]) && !(g.length < this.minlength)) {
+ for (let f = 0, g, h; f < e.length; f++) {
+ if ((g = h = e[f]) && !(g.length < this.minlength)) {
if (c) {
b.push(g);
} else {
- if (!this.filter || !this.filter.has(g)) {
+ if (!this.filter || ("function" === typeof this.filter ? this.filter(g) : !this.filter.has(g))) {
if (this.cache && g.length <= this.L) {
if (this.H) {
var d = this.G.get(g);
@@ -237,21 +237,21 @@ x.encode = function(a) {
this.H = setTimeout(L, 50, this);
}
}
- this.stemmer && 2 < g.length && (this.N || (this.N = new RegExp("(?!^)(" + this.D + ")$")), g = g.replace(this.N, h => this.stemmer.get(h)), g.length < this.minlength || this.filter && this.filter.has(g)) && (g = "");
+ this.stemmer && 2 < g.length && (this.N || (this.N = new RegExp("(?!^)(" + this.D + ")$")), d = g, g = g.replace(this.N, k => this.stemmer.get(k)), d !== g && this.filter && g.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(g) : this.filter.has(g)) && (g = ""));
if (g && (this.mapper || this.dedupe && 1 < g.length)) {
d = "";
- for (let h = 0, l = "", m, n; h < g.length; h++) {
- m = g.charAt(h), m === l && this.dedupe || ((n = this.mapper && this.mapper.get(m)) || "" === n ? n === l && this.dedupe || !(l = n) || (d += n) : d += l = m);
+ for (let k = 0, l = "", m, n; k < g.length; k++) {
+ m = g.charAt(k), m === l && this.dedupe || ((n = this.mapper && this.mapper.get(m)) || "" === n ? n === l && this.dedupe || !(l = n) || (d += n) : d += l = m);
}
g = d;
}
- this.matcher && 1 < g.length && (this.M || (this.M = new RegExp("(" + this.h + ")", "g")), g = g.replace(this.M, h => this.matcher.get(h)));
+ this.matcher && 1 < g.length && (this.M || (this.M = new RegExp("(" + this.h + ")", "g")), g = g.replace(this.M, k => this.matcher.get(k)));
if (g && this.replacer) {
for (d = 0; g && d < this.replacer.length; d += 2) {
g = g.replace(this.replacer[d], this.replacer[d + 1]);
}
}
- this.cache && k.length <= this.L && (this.G.set(k, g), this.G.size > this.R && (this.G.clear(), this.L = this.L / 1.1 | 0));
+ this.cache && h.length <= this.L && (this.G.set(h, g), this.G.size > this.R && (this.G.clear(), this.L = this.L / 1.1 | 0));
g && b.push(g);
}
}
@@ -332,19 +332,19 @@ function P(a) {
;let R = 0;
function S(a = {}) {
function c(g) {
- function k(h) {
- h = h.data || h;
- const l = h.id, m = l && d.h[l];
- m && (m(h.msg), delete d.h[l]);
+ function h(k) {
+ k = k.data || k;
+ const l = k.id, m = l && d.h[l];
+ m && (m(k.msg), delete d.h[l]);
}
this.worker = g;
this.h = C();
if (this.worker) {
- e ? this.worker.on("message", k) : this.worker.onmessage = k;
+ e ? this.worker.on("message", h) : this.worker.onmessage = h;
if (a.config) {
- return new Promise(function(h) {
+ return new Promise(function(k) {
d.h[++R] = function() {
- h(d);
+ k(d);
1e9 < R && (R = 0);
};
d.worker.postMessage({id:R, task:"init", factory:b, options:a});
@@ -440,18 +440,38 @@ function ta(a, c) {
return c;
}
function U(a, c, b, e, d, f, g = 0) {
- const k = e && e.constructor === Array;
- var h = k ? e.shift() : e;
- if (!h) {
+ const h = e && e.constructor === Array;
+ var k = h ? e.shift() : e;
+ if (!k) {
return this.export(a, c, d, f + 1);
}
- if ((h = a((c ? c + "." : "") + (g + 1) + "." + b, JSON.stringify(h))) && h.then) {
+ if ((k = a((c ? c + "." : "") + (g + 1) + "." + b, JSON.stringify(k))) && k.then) {
const l = this;
- return h.then(function() {
- return U.call(l, a, c, b, k ? e : null, d, f, g + 1);
+ return k.then(function() {
+ return U.call(l, a, c, b, h ? e : null, d, f, g + 1);
});
}
- return U.call(this, a, c, b, k ? e : null, d, f, g + 1);
+ return U.call(this, a, c, b, h ? e : null, d, f, g + 1);
+}
+function ua(a, c) {
+ let b = "";
+ for (const e of a.entries()) {
+ a = e[0];
+ const d = e[1];
+ let f = "";
+ for (let g = 0, h; g < d.length; g++) {
+ h = d[g] || [""];
+ let k = "";
+ for (let l = 0; l < h.length; l++) {
+ k += (k ? "," : "") + ("string" === c ? '"' + h[l] + '"' : h[l]);
+ }
+ k = "[" + k + "]";
+ f += (f ? "," : "") + k;
+ }
+ f = '["' + a + '",[' + f + "]]";
+ b += (b ? "," : "") + f;
+ }
+ return b;
}
;V.prototype.add = function(a, c, b) {
I(a) && (c = a, a = J(c, this.key));
@@ -459,15 +479,15 @@ function U(a, c, b, e, d, f, g = 0) {
if (!b && this.reg.has(a)) {
return this.update(a, c);
}
- for (let k = 0, h; k < this.field.length; k++) {
- h = this.C[k];
- var e = this.index.get(this.field[k]);
- if ("function" === typeof h) {
- var d = h(c);
+ for (let h = 0, k; h < this.field.length; h++) {
+ k = this.C[h];
+ var e = this.index.get(this.field[h]);
+ if ("function" === typeof k) {
+ var d = k(c);
d && e.add(a, d, !1, !0);
} else {
- if (d = h.I, !d || d(c)) {
- h.constructor === String ? h = ["" + h] : D(h) && (h = [h]), ua(c, h, this.J, 0, e, a, h[0], b);
+ if (d = k.I, !d || d(c)) {
+ k.constructor === String ? k = ["" + k] : D(k) && (k = [k]), va(c, k, this.J, 0, e, a, k[0], b);
}
}
}
@@ -475,14 +495,14 @@ function U(a, c, b, e, d, f, g = 0) {
for (e = 0; e < this.B.length; e++) {
var f = this.B[e], g = this.T[e];
d = this.tag.get(g);
- let k = C();
+ let h = C();
if ("function" === typeof f) {
if (f = f(c), !f) {
continue;
}
} else {
- const h = f.I;
- if (h && !h(c)) {
+ const k = f.I;
+ if (k && !k(c)) {
continue;
}
f.constructor === String && (f = "" + f);
@@ -490,8 +510,8 @@ function U(a, c, b, e, d, f, g = 0) {
}
if (d && f) {
D(f) && (f = [f]);
- for (let h = 0, l, m; h < f.length; h++) {
- l = f[h], k[l] || (k[l] = 1, (g = d.get(l)) ? m = g : d.set(l, m = []), b && m.includes(a) || (m.push(a), this.fastupdate && ((g = this.reg.get(a)) ? g.push(m) : this.reg.set(a, [m]))));
+ for (let k = 0, l, m; k < f.length; k++) {
+ l = f[k], h[l] || (h[l] = 1, (g = d.get(l)) ? m = g : d.set(l, m = []), b && m.includes(a) || (m.push(a), this.fastupdate && ((g = this.reg.get(a)) ? g.push(m) : this.reg.set(a, [m]))));
}
} else {
d || console.warn("Tag '" + g + "' was not found");
@@ -499,11 +519,11 @@ function U(a, c, b, e, d, f, g = 0) {
}
}
if (this.store && (!b || !this.store.has(a))) {
- let k;
+ let h;
if (this.A) {
- k = C();
- for (let h = 0, l; h < this.A.length; h++) {
- l = this.A[h];
+ h = C();
+ for (let k = 0, l; k < this.A.length; k++) {
+ l = this.A[k];
if ((b = l.I) && !b(c)) {
continue;
}
@@ -515,32 +535,32 @@ function U(a, c, b, e, d, f, g = 0) {
}
l = [l.U];
} else if (D(l) || l.constructor === String) {
- k[l] = c[l];
+ h[l] = c[l];
continue;
}
- va(c, k, l, 0, l[0], m);
+ wa(c, h, l, 0, l[0], m);
}
}
- this.store.set(a, k || c);
+ this.store.set(a, h || c);
}
}
return this;
};
-function va(a, c, b, e, d, f) {
+function wa(a, c, b, e, d, f) {
a = a[d];
if (e === b.length - 1) {
c[d] = f || a;
} else if (a) {
if (a.constructor === Array) {
for (c = c[d] = Array(a.length), d = 0; d < a.length; d++) {
- va(a, c, b, e, d);
+ wa(a, c, b, e, d);
}
} else {
- c = c[d] || (c[d] = C()), d = b[++e], va(a, c, b, e, d);
+ c = c[d] || (c[d] = C()), d = b[++e], wa(a, c, b, e, d);
}
}
}
-function ua(a, c, b, e, d, f, g, k) {
+function va(a, c, b, e, d, f, g, h) {
if (a = a[g]) {
if (e === c.length - 1) {
if (a.constructor === Array) {
@@ -552,34 +572,36 @@ function ua(a, c, b, e, d, f, g, k) {
}
a = a.join(" ");
}
- d.add(f, a, k, !0);
+ d.add(f, a, h, !0);
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
- ua(a, c, b, e, d, f, g, k);
+ va(a, c, b, e, d, f, g, h);
}
} else {
- g = c[++e], ua(a, c, b, e, d, f, g, k);
+ g = c[++e], va(a, c, b, e, d, f, g, h);
}
}
}
}
-;function wa(a, c, b, e, d) {
+;function xa(a, c, b, e, d) {
const f = a.length;
- let g = [], k, h;
- k = C();
+ let g = [], h, k;
+ h = C();
for (let l = 0, m, n, t, p; l < c; l++) {
for (let q = 0; q < f; q++) {
if (t = a[q], l < t.length && (m = t[l])) {
for (let v = 0; v < m.length; v++) {
- n = m[v], (h = k[n]) ? k[n]++ : (h = 0, k[n] = 1), p = g[h] || (g[h] = []), p.push(n);
+ if (n = m[v], (k = h[n]) ? h[n]++ : (k = 0, h[n] = 1), p = g[k] || (g[k] = []), p.push(n), b && k === f - 1 && p.length - e === b) {
+ return p;
+ }
}
}
}
}
if (a = g.length) {
if (d) {
- g = 1 < g.length ? xa(g, b, e) : (g = g[0]).length > b || e ? g.slice(e, b + e) : g;
+ g = 1 < g.length ? ya(g, b, e) : (g = g[0]).length > b || e ? g.slice(e, b + e) : g;
} else {
if (a < f) {
return [];
@@ -594,14 +616,14 @@ function ua(a, c, b, e, d, f, g, k) {
}
return g;
}
-function xa(a, c, b) {
+function ya(a, c, b) {
const e = [], d = C();
let f;
var g = a.length;
- let k;
- for (let h = g - 1; 0 <= h; h--) {
- if (k = (g = a[h]) && g.length) {
- for (let l = 0; l < k; l++) {
+ let h;
+ for (let k = g - 1; 0 <= k; k--) {
+ if (h = (g = a[k]) && g.length) {
+ for (let l = 0; l < h; l++) {
if (f = g[l], !d[f]) {
if (d[f] = 1, b) {
b--;
@@ -616,7 +638,7 @@ function xa(a, c, b) {
}
return e;
}
-function ya(a, c) {
+function za(a, c) {
const b = C(), e = [];
for (let d = 0, f; d < c.length; d++) {
f = c[d];
@@ -629,7 +651,7 @@ function ya(a, c) {
}
return e;
}
-;function za(a, c, b, e) {
+;function Aa(a, c, b, e) {
if (!a.length) {
return a;
}
@@ -637,21 +659,21 @@ function ya(a, c) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a, e ? W.call(this, a) : a;
}
let d = [];
- for (let f = 0, g, k; f < a.length; f++) {
- if ((g = a[f]) && (k = g.length)) {
+ for (let f = 0, g, h; f < a.length; f++) {
+ if ((g = a[f]) && (h = g.length)) {
if (b) {
- if (b >= k) {
- b -= k;
+ if (b >= h) {
+ b -= h;
continue;
}
- b < k && (g = c ? g.slice(b, b + c) : g.slice(b), k = g.length, b = 0);
+ b < h && (g = c ? g.slice(b, b + c) : g.slice(b), h = g.length, b = 0);
}
- k > c && (g = g.slice(0, c), k = c);
- if (!d.length && k >= c) {
+ h > c && (g = g.slice(0, c), h = c);
+ if (!d.length && h >= c) {
return e ? W.call(this, g) : g;
}
d.push(g);
- c -= k;
+ c -= h;
if (!c) {
break;
}
@@ -660,7 +682,7 @@ function ya(a, c) {
d = 1 < d.length ? [].concat.apply([], d) : d[0];
return e ? W.call(this, d) : d;
}
-;function Aa(a, c, b) {
+;function Ba(a, c, b) {
var e = b[0];
if (e.then) {
return Promise.all(b).then(function(m) {
@@ -671,7 +693,7 @@ function ya(a, c) {
return a[c].apply(a, e);
}
e = [];
- let d = [], f = 0, g = 0, k, h, l;
+ let d = [], f = 0, g = 0, h, k, l;
for (let m = 0, n; m < b.length; m++) {
if (n = b[m]) {
let t;
@@ -680,8 +702,8 @@ function ya(a, c) {
} else if (n.constructor === Array) {
t = n;
} else {
- if (f = n.limit || 0, g = n.offset || 0, l = n.suggest, h = n.resolve, k = n.enrich && h, n.index) {
- n.resolve = !1, n.enrich = !1, t = n.index.search(n).result, n.resolve = h, n.enrich = k;
+ if (f = n.limit || 0, g = n.offset || 0, l = n.suggest, k = n.resolve, h = n.enrich && k, n.index) {
+ n.resolve = !1, n.enrich = !1, t = n.index.search(n).result, n.resolve = k, n.enrich = h;
} else if (n.and) {
t = a.and(n.and);
} else if (n.or) {
@@ -704,24 +726,24 @@ function ya(a, c) {
}
}
}
- return {O:e, P:d, limit:f, offset:g, enrich:k, resolve:h, suggest:l};
+ return {O:e, P:d, limit:f, offset:g, enrich:h, resolve:k, suggest:l};
}
;X.prototype.or = function() {
- const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f} = Aa(this, "or", arguments);
- return Ba.call(this, a, c, b, e, d, f);
+ const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f} = Ba(this, "or", arguments);
+ return Ca.call(this, a, c, b, e, d, f);
};
-function Ba(a, c, b, e, d, f) {
+function Ca(a, c, b, e, d, f) {
if (c.length) {
const g = this;
- return Promise.all(c).then(function(k) {
+ return Promise.all(c).then(function(h) {
a = [];
- for (let h = 0, l; h < k.length; h++) {
- (l = k[h]).length && (a[h] = l);
+ for (let k = 0, l; k < h.length; k++) {
+ (l = h[k]).length && (a[k] = l);
}
- return Ba.call(g, a, [], b, e, d, f);
+ return Ca.call(g, a, [], b, e, d, f);
});
}
- a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = xa(a, b, e), e = 0));
+ a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = ya(a, b, e), e = 0));
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.and = function() {
@@ -731,20 +753,20 @@ function Ba(a, c, b, e, d, f) {
f && (a = !!f.suggest, d = f.resolve, c = f.limit, b = f.offset, e = f.enrich && d);
}
if (a) {
- const {O:f, P:g, limit:k, offset:h, enrich:l, resolve:m, suggest:n} = Aa(this, "and", arguments);
- return Ca.call(this, f, g, k, h, l, m, n);
+ const {O:f, P:g, limit:h, offset:k, enrich:l, resolve:m, suggest:n} = Ba(this, "and", arguments);
+ return Da.call(this, f, g, h, k, l, m, n);
}
return d ? this.resolve(c, b, e) : this;
};
-function Ca(a, c, b, e, d, f, g) {
+function Da(a, c, b, e, d, f, g) {
if (c.length) {
- const k = this;
- return Promise.all(c).then(function(h) {
+ const h = this;
+ return Promise.all(c).then(function(k) {
a = [];
- for (let l = 0, m; l < h.length; l++) {
- (m = h[l]).length && (a[l] = m);
+ for (let l = 0, m; l < k.length; l++) {
+ (m = k[l]).length && (a[l] = m);
}
- return Ca.call(k, a, [], b, e, d, f, g);
+ return Da.call(h, a, [], b, e, d, f, g);
});
}
if (a.length) {
@@ -752,7 +774,7 @@ function Ca(a, c, b, e, d, f, g) {
this.result = a[0];
} else {
if (c = aa(a)) {
- return this.result = wa(a, c, b, e, g), f ? d ? W.call(this.index, this.result) : this.result : this;
+ return this.result = xa(a, c, b, e, g), f ? d ? W.call(this.index, this.result) : this.result : this;
}
this.result = [];
}
@@ -762,37 +784,37 @@ function Ca(a, c, b, e, d, f, g) {
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.xor = function() {
- const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "xor", arguments);
- return Da.call(this, a, c, b, e, d, f, g);
+ const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ba(this, "xor", arguments);
+ return Ea.call(this, a, c, b, e, d, f, g);
};
-function Da(a, c, b, e, d, f, g) {
+function Ea(a, c, b, e, d, f, g) {
if (c.length) {
- const k = this;
- return Promise.all(c).then(function(h) {
+ const h = this;
+ return Promise.all(c).then(function(k) {
a = [];
- for (let l = 0, m; l < h.length; l++) {
- (m = h[l]).length && (a[l] = m);
+ for (let l = 0, m; l < k.length; l++) {
+ (m = k[l]).length && (a[l] = m);
}
- return Da.call(k, a, [], b, e, d, f, g);
+ return Ea.call(h, a, [], b, e, d, f, g);
});
}
if (a.length) {
if (this.result.length && a.unshift(this.result), 2 > a.length) {
this.result = a[0];
} else {
- return this.result = Ea.call(this, a, b, e, f, this.h), f ? d ? W.call(this.index, this.result) : this.result : this;
+ return this.result = Fa.call(this, a, b, e, f, this.h), f ? d ? W.call(this.index, this.result) : this.result : this;
}
} else {
g || (this.result = a);
}
return f ? this.resolve(b, e, d) : this;
}
-function Ea(a, c, b, e, d) {
+function Fa(a, c, b, e, d) {
const f = [], g = C();
- let k = 0;
- for (let h = 0, l; h < a.length; h++) {
- if (l = a[h]) {
- k < l.length && (k = l.length);
+ let h = 0;
+ for (let k = 0, l; k < a.length; k++) {
+ if (l = a[k]) {
+ h < l.length && (h = l.length);
for (let m = 0, n; m < l.length; m++) {
if (n = l[m]) {
for (let t = 0, p; t < n.length; t++) {
@@ -802,10 +824,10 @@ function Ea(a, c, b, e, d) {
}
}
}
- for (let h = 0, l, m = 0; h < k; h++) {
+ for (let k = 0, l, m = 0; k < h; k++) {
for (let n = 0, t; n < a.length; n++) {
if (t = a[n]) {
- if (l = t[h]) {
+ if (l = t[k]) {
for (let p = 0, q; p < l.length; p++) {
if (q = l[p], 1 === g[q]) {
if (b) {
@@ -816,7 +838,7 @@ function Ea(a, c, b, e, d) {
return f;
}
} else {
- const v = h + (n ? d : 0);
+ const v = k + (n ? d : 0);
f[v] || (f[v] = []);
f[v].push(q);
if (++m === c) {
@@ -833,34 +855,34 @@ function Ea(a, c, b, e, d) {
return f;
}
;X.prototype.not = function() {
- const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "not", arguments);
- return Fa.call(this, a, c, b, e, d, f, g);
+ const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ba(this, "not", arguments);
+ return Ga.call(this, a, c, b, e, d, f, g);
};
-function Fa(a, c, b, e, d, f, g) {
+function Ga(a, c, b, e, d, f, g) {
if (c.length) {
- const k = this;
- return Promise.all(c).then(function(h) {
+ const h = this;
+ return Promise.all(c).then(function(k) {
a = [];
- for (let l = 0, m; l < h.length; l++) {
- (m = h[l]).length && (a[l] = m);
+ for (let l = 0, m; l < k.length; l++) {
+ (m = k[l]).length && (a[l] = m);
}
- return Fa.call(k, a, [], b, e, d, f, g);
+ return Ga.call(h, a, [], b, e, d, f, g);
});
}
if (a.length && this.result.length) {
- this.result = Ga.call(this, a, b, e, f);
+ this.result = Ha.call(this, a, b, e, f);
} else if (f) {
return this.resolve(b, e, d);
}
return f ? d ? W.call(this.index, this.result) : this.result : this;
}
-function Ga(a, c, b, e) {
+function Ha(a, c, b, e) {
const d = [];
a = new Set(a.flat().flat());
- for (let f = 0, g, k = 0; f < this.result.length; f++) {
+ for (let f = 0, g, h = 0; f < this.result.length; f++) {
if (g = this.result[f]) {
- for (let h = 0, l; h < g.length; h++) {
- if (l = g[h], !a.has(l)) {
+ for (let k = 0, l; k < g.length; k++) {
+ if (l = g[k], !a.has(l)) {
if (b) {
b--;
} else {
@@ -869,7 +891,7 @@ function Ga(a, c, b, e) {
return d;
}
} else {
- if (d[f] || (d[f] = []), d[f].push(l), ++k === c) {
+ if (d[f] || (d[f] = []), d[f].push(l), ++h === c) {
return d;
}
}
@@ -929,26 +951,25 @@ X.prototype.boost = function(a) {
X.prototype.resolve = function(a, c, b) {
const e = this.result, d = this.index;
this.result = this.index = null;
- return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), za.call(d, e, a || 100, c, b)) : e;
+ return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), Aa.call(d, e, a || 100, c, b)) : e;
};
C();
V.prototype.search = function(a, c, b, e) {
b || (!c && I(a) ? (b = a, a = "") : I(c) && (b = c, c = 0));
let d = [];
var f = [];
- let g, k, h, l, m, n, t = 0, p = !0, q;
+ let g, h, k, l, m, n, t = 0, p = !0, q;
if (b) {
b.constructor === Array && (b = {index:b});
a = b.query || a;
var v = b.pluck;
- k = b.merge;
+ h = b.merge;
l = v || b.field || (l = b.index) && (l.index ? null : l);
m = this.tag && b.tag;
- h = b.suggest;
+ k = b.suggest;
p = !0;
this.store && b.enrich && !p && console.warn("Enrich results can only be done on a final resolver task or when calling .resolve({ enrich: true })");
- g = this.store && b.enrich && p;
- q = b.highlight && g;
+ q = (g = this.store && b.enrich && p) && b.highlight;
c = b.limit || c;
n = b.offset || 0;
c || (c = 100);
@@ -990,7 +1011,7 @@ V.prototype.search = function(a, c, b, e) {
e = [];
if (u.length) {
for (f = 0; f < u.length; f += 2) {
- v = Ha.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:v});
+ v = Ia.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:v});
}
}
return e.length ? Promise.all(e).then(function(y) {
@@ -1008,7 +1029,7 @@ V.prototype.search = function(a, c, b, e) {
for (let y = 0, r, E, F; y < l.length; y++) {
E = l[y];
let A;
- D(E) || (A = E, E = A.field, a = A.query || a, c = A.limit || c, n = A.offset || n, h = A.suggest || h, g = this.store && (A.enrich || g));
+ D(E) || (A = E, E = A.field, a = A.query || a, c = A.limit || c, n = A.offset || n, k = A.suggest || k, g = this.store && (A.enrich || g));
if (e) {
r = e[y];
} else {
@@ -1024,25 +1045,25 @@ V.prototype.search = function(a, c, b, e) {
if (m && F) {
w = [];
z = 0;
- for (let G = 0, H, Ya; G < m.length; G += 2) {
+ for (let G = 0, H, Za; G < m.length; G += 2) {
H = this.tag.get(m[G]);
if (!H) {
- if (console.warn("Tag '" + m[G] + ":" + m[G + 1] + "' will be skipped because there is no field '" + m[G] + "'."), h) {
+ if (console.warn("Tag '" + m[G] + ":" + m[G + 1] + "' will be skipped because there is no field '" + m[G] + "'."), k) {
continue;
} else {
return p ? d : new X(d);
}
}
- if (Ya = (H = H && H.get(m[G + 1])) && H.length) {
+ if (Za = (H = H && H.get(m[G + 1])) && H.length) {
z++, w.push(H);
- } else if (!h) {
+ } else if (!k) {
return p ? d : new X(d);
}
}
if (z) {
- r = ya(r, w);
+ r = za(r, w);
F = r.length;
- if (!F && !h) {
+ if (!F && !k) {
return p ? r : new X(r);
}
z--;
@@ -1075,18 +1096,19 @@ V.prototype.search = function(a, c, b, e) {
}
d[y] = {field:f[y], result:r};
}
- return k ? Ia(d, c) : q ? Ja(d, a, this.index, this.field, this.C, q) : d;
+ return h ? Ja(d, c) : q ? Ka(d, a, this.index, this.field, this.C, q) : d;
};
-function Ja(a, c, b, e, d, f) {
- let g, k, h;
+function Ka(a, c, b, e, d, f) {
+ console.log("template", f);
+ let g, h, k;
for (let m = 0, n, t, p, q, v; m < a.length; m++) {
n = a[m].result;
t = a[m].field;
q = b.get(t);
p = q.encoder;
- h = q.tokenize;
+ k = q.tokenize;
v = d[e.indexOf(t)];
- p !== g && (g = p, k = g.encode(c));
+ p !== g && (g = p, h = g.encode(c));
for (let u = 0; u < n.length; u++) {
let w = "";
var l = J(n[u].doc, v);
@@ -1096,8 +1118,8 @@ function Ja(a, c, b, e, d, f) {
r = z[y];
E = l[y];
let F;
- for (let A = 0, G; A < k.length; A++) {
- if (G = k[A], "strict" === h) {
+ for (let A = 0, G; A < h.length; A++) {
+ if (G = h[A], "strict" === k) {
if (r === G) {
w += (w ? " " : "") + f.replace("$1", E);
F = !0;
@@ -1119,26 +1141,26 @@ function Ja(a, c, b, e, d, f) {
}
return a;
}
-function Ia(a, c) {
+function Ja(a, c) {
const b = [], e = C();
for (let d = 0, f, g; d < a.length; d++) {
f = a[d];
g = f.result;
- for (let k = 0, h, l, m; k < g.length; k++) {
- if (l = g[k], "object" !== typeof l && (l = {id:l}), h = l.id, m = e[h]) {
+ for (let h = 0, k, l, m; h < g.length; h++) {
+ if (l = g[h], "object" !== typeof l && (l = {id:l}), k = l.id, m = e[k]) {
m.push(f.field);
} else {
if (b.length === c) {
return b;
}
- l.field = e[h] = [f.field];
+ l.field = e[k] = [f.field];
b.push(l);
}
}
}
return b;
}
-function Ha(a, c, b, e, d) {
+function Ia(a, c, b, e, d) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -1170,7 +1192,7 @@ function W(a) {
this.C = [];
this.field = [];
this.J = [];
- this.key = (b = c.key || c.id) && Ka(b, this.J) || "id";
+ this.key = (b = c.key || c.id) && La(b, this.J) || "id";
this.reg = (this.fastupdate = !!a.fastupdate) ? new Map() : new Set();
this.A = (b = c.store || null) && b && !0 !== b && [];
this.store = b && new Map();
@@ -1181,13 +1203,13 @@ function W(a) {
let e = c.index || c.field || c;
D(e) && (e = [e]);
for (let d = 0, f, g; d < e.length; d++) {
- f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = Ka(f, this.J), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].I = g.filter)), this.field[d] = f;
+ f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = La(f, this.J), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].I = g.filter)), this.field[d] = f;
}
if (this.A) {
a = c.store;
D(a) && (a = [a]);
for (let d = 0, f, g; d < a.length; d++) {
- f = a[d], g = f.field || f, f.custom ? (this.A[d] = f.custom, f.custom.U = g) : (this.A[d] = Ka(g, this.J), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].I = f.filter));
+ f = a[d], g = f.field || f, f.custom ? (this.A[d] = f.custom, f.custom.U = g) : (this.A[d] = La(g, this.J), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].I = f.filter));
}
}
this.index = b;
@@ -1203,14 +1225,14 @@ function W(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
- f.custom ? this.B[d] = f.custom : (this.B[d] = Ka(g, this.J), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].I = f.filter));
+ f.custom ? this.B[d] = f.custom : (this.B[d] = La(g, this.J), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].I = f.filter));
this.T[d] = g;
this.tag.set(g, new Map());
}
}
}
}
-function Ka(a, c) {
+function La(a, c) {
const b = a.split(":");
let e = 0;
for (let d = 0; d < b.length; d++) {
@@ -1248,16 +1270,19 @@ x.remove = function(a) {
return this;
};
x.clear = function() {
- for (const a of this.index.values()) {
- a.clear();
+ const a = [];
+ for (const c of this.index.values()) {
+ const b = c.clear();
+ b.then && a.push(b);
}
if (this.tag) {
- for (const a of this.tag.values()) {
- a.clear();
+ for (const c of this.tag.values()) {
+ c.clear();
}
}
this.store && this.store.clear();
- return this;
+ this.cache && this.cache.clear();
+ return a.length ? Promise.all(a) : this;
};
x.contain = function(a) {
return this.reg.has(a);
@@ -1275,14 +1300,14 @@ x.set = function(a, c) {
this.store.set(a, c);
return this;
};
-x.searchCache = La;
+x.searchCache = Ma;
x.export = function(a, c, b = 0, e = 0) {
if (b < this.field.length) {
const g = this.field[b];
if ((c = this.index.get(g).export(a, g, b, e = 1)) && c.then) {
- const k = this;
+ const h = this;
return c.then(function() {
- return k.export(a, g, b + 1);
+ return h.export(a, g, b + 1);
});
}
return this.export(a, g, b + 1);
@@ -1336,7 +1361,7 @@ x.import = function(a, c) {
}
};
ja(V.prototype);
-function La(a, c, b) {
+function Ma(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new Y());
let e = this.cache.get(a);
@@ -1377,31 +1402,31 @@ Y.prototype.clear = function() {
this.cache.clear();
this.h = "";
};
-const Ma = {normalize:function(a) {
+const Na = {normalize:function(a) {
return a.toLowerCase();
}};
-const Na = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
-const Oa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Pa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
-const Qa = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
-const Ra = /[\x00-\x7F]+/g;
+const Oa = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
+const Pa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Qa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
+const Ra = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
const Sa = /[\x00-\x7F]+/g;
const Ta = /[\x00-\x7F]+/g;
-var Ua = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:Ma, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Na}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Na, matcher:Oa, replacer:Pa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Na, replacer:Pa.concat([/(?!^)[aeo]/g, ""]), matcher:Oa}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
+const Ua = /[\x00-\x7F]+/g;
+var Va = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:Na, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Oa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Oa, matcher:Pa, replacer:Qa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Oa, replacer:Qa.concat([/(?!^)[aeo]/g, ""]), matcher:Pa}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
for (let b = 0; b < a.length; b++) {
var c = a[b];
- let e = c.charAt(0), d = Qa[e];
- for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = Qa[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
+ let e = c.charAt(0), d = Ra[e];
+ for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = Ra[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
}
a[b] = e;
}
}}, ArabicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
- return ("" + a).replace(Ra, " ");
+ return ("" + a).replace(Sa, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
- return ("" + a).replace(Sa, "");
+ return ("" + a).replace(Ta, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
- return ("" + a).replace(Ta, " ");
+ return ("" + a).replace(Ua, " ");
}}};
-const Va = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
+const Wa = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
O.prototype.add = function(a, c, b, e) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
@@ -1414,7 +1439,7 @@ O.prototype.add = function(a, c, b, e) {
let q = c[this.rtl ? e - 1 - p : p];
var d = q.length;
if (d && (n || !m[q])) {
- var f = this.score ? this.score(c, q, p, null, 0) : Wa(t, e, p), g = "";
+ var f = this.score ? this.score(c, q, p, null, 0) : Xa(t, e, p), g = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
@@ -1422,34 +1447,34 @@ O.prototype.add = function(a, c, b, e) {
for (f = d; f > v; f--) {
g = q.substring(v, f);
u = this.rtl ? d - 1 - v : v;
- var k = this.score ? this.score(c, q, p, g, u) : Wa(t, e, p, d, u);
- Z(this, m, g, k, a, b);
+ var h = this.score ? this.score(c, q, p, g, u) : Xa(t, e, p, d, u);
+ Z(this, m, g, h, a, b);
}
}
break;
}
case "reverse":
if (1 < d) {
- for (k = d - 1; 0 < k; k--) {
- g = q[this.rtl ? d - 1 - k : k] + g;
- var h = this.score ? this.score(c, q, p, g, k) : Wa(t, e, p, d, k);
- Z(this, m, g, h, a, b);
+ for (h = d - 1; 0 < h; h--) {
+ g = q[this.rtl ? d - 1 - h : h] + g;
+ var k = this.score ? this.score(c, q, p, g, h) : Xa(t, e, p, d, h);
+ Z(this, m, g, k, a, b);
}
g = "";
}
case "forward":
if (1 < d) {
- for (k = 0; k < d; k++) {
- g += q[this.rtl ? d - 1 - k : k], Z(this, m, g, f, a, b);
+ for (h = 0; h < d; h++) {
+ g += q[this.rtl ? d - 1 - h : h], Z(this, m, g, f, a, b);
}
break;
}
default:
if (Z(this, m, q, f, a, b), n && 1 < e && p < e - 1) {
- for (d = C(), g = this.S, f = q, k = Math.min(n + 1, this.rtl ? p + 1 : e - p), d[f] = 1, h = 1; h < k; h++) {
- if ((q = c[this.rtl ? e - 1 - p - h : p + h]) && !d[q]) {
+ for (d = C(), g = this.S, f = q, h = Math.min(n + 1, this.rtl ? p + 1 : e - p), d[f] = 1, k = 1; k < h; k++) {
+ if ((q = c[this.rtl ? e - 1 - p - k : p + k]) && !d[q]) {
d[q] = 1;
- const v = this.score ? this.score(c, f, p, q, h - 1) : Wa(g + (e / 2 > g ? 0 : 1), e, p, k - 1, h - 1), u = this.bidirectional && q > f;
+ const v = this.score ? this.score(c, f, p, q, k - 1) : Xa(g + (e / 2 > g ? 0 : 1), e, p, h - 1, k - 1), u = this.bidirectional && q > f;
Z(this, l, u ? f : q, v, a, b, u ? q : f);
}
}
@@ -1463,12 +1488,12 @@ O.prototype.add = function(a, c, b, e) {
return this;
};
function Z(a, c, b, e, d, f, g) {
- let k = g ? a.ctx : a.map, h;
- if (!c[b] || g && !(h = c[b])[g]) {
- g ? (c = h || (c[b] = C()), c[g] = 1, (h = k.get(g)) ? k = h : k.set(g, k = new Map())) : c[b] = 1, (h = k.get(b)) ? k = h : k.set(b, k = []), k = k[e] || (k[e] = []), f && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
+ let h = g ? a.ctx : a.map, k;
+ if (!c[b] || g && !(k = c[b])[g]) {
+ g ? (c = k || (c[b] = C()), c[g] = 1, (k = h.get(g)) ? h = k : h.set(g, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[e] || (h[e] = []), f && h.includes(d) || (h.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(h) : a.reg.set(d, [h])));
}
}
-function Wa(a, c, b, e, d) {
+function Xa(a, c, b, e, d) {
return b && 1 < a ? c + (e || 0) <= a ? b + (d || 0) : (a - 1) / (c + (e || 0)) * (b + (d || 0)) + 1 | 0 : 0;
}
;O.prototype.search = function(a, c, b) {
@@ -1480,35 +1505,35 @@ function Wa(a, c, b, e, d) {
d = b.offset || 0;
var f = b.context;
var g = b.suggest;
- var k = !0;
- var h = b.resolution;
+ var h = !0;
+ var k = b.resolution;
} else {
- k = !0;
+ h = !0;
}
a = this.encoder.encode(a);
b = a.length;
- c = c || (k ? 100 : 0);
+ c = c || (h ? 100 : 0);
if (1 === b) {
- return g = c, (c = Xa(this, a[0], "")) && c.length ? za.call(this, c, g, d) : [];
+ return g = c, (c = Ya(this, a[0], "")) && c.length ? Aa.call(this, c, g, d) : [];
}
f = this.depth && !1 !== f;
if (2 === b && f && !g) {
- return g = c, (c = Xa(this, a[0], a[1])) && c.length ? za.call(this, c, g, d) : [];
+ return g = c, (c = Ya(this, a[0], a[1])) && c.length ? Aa.call(this, c, g, d) : [];
}
- k = C();
+ h = C();
let l = 0;
if (1 < b && f) {
var m = a[0];
l = 1;
}
- h || 0 === h || (h = m ? this.S : this.resolution);
+ k || 0 === k || (k = m ? this.S : this.resolution);
for (let q, v; l < b; l++) {
- if ((v = a[l]) && !k[v]) {
- k[v] = 1;
- q = Xa(this, v, m);
+ if ((v = a[l]) && !h[v]) {
+ h[v] = 1;
+ q = Ya(this, v, m);
a: {
f = q;
- var n = e, t = g, p = h;
+ var n = e, t = g, p = k;
let u = [];
if (f && f.length) {
if (f.length <= p) {
@@ -1535,23 +1560,23 @@ function Wa(a, c, b, e, d) {
}
m && (g && q && e.length || (m = v));
}
- g && m && l === b - 1 && !e.length && (h = this.resolution, m = "", l = -1, k = C());
+ g && m && l === b - 1 && !e.length && (k = this.resolution, m = "", l = -1, h = C());
}
a: {
a = e;
e = a.length;
m = a;
if (1 < e) {
- m = wa(a, h, c, d, g);
+ m = xa(a, k, c, d, g);
} else if (1 === e) {
- g = za.call(null, a[0], c, d);
+ g = Aa.call(null, a[0], c, d);
break a;
}
g = m;
}
return g;
};
-function Xa(a, c, b) {
+function Ya(a, c, b) {
let e;
b && (e = a.bidirectional && c > b) && (e = b, b = c, c = e);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
@@ -1572,14 +1597,14 @@ function Xa(a, c, b) {
}
}
} else {
- Za(this.map, a), this.depth && Za(this.ctx, a);
+ $a(this.map, a), this.depth && $a(this.ctx, a);
}
c || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
-function Za(a, c) {
+function $a(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let e = 0, d, f; e < a.length; e++) {
@@ -1594,7 +1619,7 @@ function Za(a, c) {
}
} else {
for (let e of a.entries()) {
- const d = e[0], f = Za(e[1], c);
+ const d = e[0], f = $a(e[1], c);
f ? b += f : a.delete(d);
}
}
@@ -1606,19 +1631,20 @@ function Za(a, c) {
}
if (a) {
var b = D(a) ? a : a.preset;
- b && (Va[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Va[b], a));
+ b && (Wa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Wa[b], a));
} else {
a = {};
}
b = a.context;
- const e = !0 === b ? {depth:1} : b || {}, d = D(a.encoder) ? Ua[a.encoder] : a.encode || a.encoder || Ma;
+ const e = !0 === b ? {depth:1} : b || {}, d = D(a.encoder) ? Va[a.encoder] : a.encode || a.encoder || Na;
this.encoder = d.encode ? d : "object" === typeof d ? new K(d) : {encode:d};
this.resolution = a.resolution || 9;
- this.tokenize = (b = a.tokenize) && "default" !== b && b || "strict";
+ this.tokenize = b = (b = a.tokenize) && "default" !== b && b || "strict";
this.depth = "strict" === b && e.depth || 0;
this.bidirectional = !1 !== e.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
+ e && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
b = !1;
this.map = new Map();
this.ctx = new Map();
@@ -1646,15 +1672,15 @@ x.update = function(a, c) {
const b = this, e = this.remove(a);
return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c);
};
-function $a(a) {
+function ab(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, e; b < a.length; b++) {
(e = a[b]) && (c += e.length);
}
} else {
- for (const b of a) {
- const e = b[0], d = $a(b[1]);
+ for (const b of a.entries()) {
+ const e = b[0], d = ab(b[1]);
d ? c += d : a.delete(e);
}
}
@@ -1664,11 +1690,11 @@ x.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
- $a(this.map);
- this.depth && $a(this.ctx);
+ ab(this.map);
+ this.depth && ab(this.ctx);
return this;
};
-x.searchCache = La;
+x.searchCache = Ma;
x.export = function(a, c, b = 0, e = 0) {
let d, f;
switch(e) {
@@ -1709,59 +1735,30 @@ x.import = function(a, c) {
}
};
x.serialize = function(a = !0) {
- if (!this.reg.size) {
- return "";
- }
- let c = "", b = "";
- for (var e of this.reg.keys()) {
- b || (b = typeof e), c += (c ? "," : "") + ("string" === b ? '"' + e + '"' : e);
- }
- c = "index.reg=new Set([" + c + "]);";
- e = "";
- for (var d of this.map.entries()) {
- var f = d[0], g = d[1], k = "";
- for (let m = 0, n; m < g.length; m++) {
- n = g[m] || [""];
- var h = "";
- for (var l = 0; l < n.length; l++) {
- h += (h ? "," : "") + ("string" === b ? '"' + n[l] + '"' : n[l]);
- }
- h = "[" + h + "]";
- k += (k ? "," : "") + h;
+ let c = "", b = "", e = "";
+ if (this.reg.size) {
+ let f;
+ for (var d of this.reg.keys()) {
+ f || (f = typeof d), c += (c ? "," : "") + ("string" === f ? '"' + d + '"' : d);
}
- k = '["' + f + '",[' + k + "]]";
- e += (e ? "," : "") + k;
- }
- e = "index.map=new Map([" + e + "]);";
- d = "";
- for (const m of this.ctx.entries()) {
- f = m[0];
- g = m[1];
- for (const n of g.entries()) {
- g = n[0];
- k = n[1];
- h = "";
- for (let t = 0, p; t < k.length; t++) {
- p = k[t] || [""];
- l = "";
- for (let q = 0; q < p.length; q++) {
- l += (l ? "," : "") + ("string" === b ? '"' + p[q] + '"' : p[q]);
- }
- l = "[" + l + "]";
- h += (h ? "," : "") + l;
- }
- h = 'new Map([["' + g + '",[' + h + "]]])";
- h = '["' + f + '",' + h + "]";
- d += (d ? "," : "") + h;
+ c = "index.reg=new Set([" + c + "]);";
+ b = ua(this.map, f);
+ b = "index.map=new Map([" + b + "]);";
+ for (const g of this.ctx.entries()) {
+ d = g[0];
+ let h = ua(g[1], f);
+ h = "new Map([" + h + "])";
+ h = '["' + d + '",' + h + "]";
+ e += (e ? "," : "") + h;
}
+ e = "index.ctx=new Map([" + e + "]);";
}
- d = "index.ctx=new Map([" + d + "]);";
- return a ? "function inject(index){" + c + e + d + "}" : c + e + d;
+ return a ? "function inject(index){" + c + b + e + "}" : c + b + e;
};
ja(O.prototype);
-const ab = {Index:O, Charset:Ua, Encoder:K, Document:V, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, bb = self;
-let cb;
-(cb = bb.define) && cb.amd ? cb([], function() {
- return ab;
-}) : "object" === typeof bb.exports ? bb.exports = ab : bb.FlexSearch = ab;
+const bb = {Index:O, Charset:Va, Encoder:K, Document:V, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, cb = self;
+let db;
+(db = cb.define) && db.amd ? db([], function() {
+ return bb;
+}) : "object" === typeof cb.exports ? cb.exports = bb : cb.FlexSearch = bb;
}(this||self));
diff --git a/dist/flexsearch.compact.min.js b/dist/flexsearch.compact.min.js
index 465ee56..6376fe8 100644
--- a/dist/flexsearch.compact.min.js
+++ b/dist/flexsearch.compact.min.js
@@ -1,11 +1,11 @@
/**!
- * FlexSearch.js v0.8.123 (Bundle)
+ * FlexSearch.js v0.8.132 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
-(function(self){'use strict';var x;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
+(function(self){'use strict';var x;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function I(a,c){if(D(c))a=a[c];else for(let b=0;a&&b"a1a".split(b).length;
-this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ca)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);ha||(this.mapper=new Map(ba));this.rtl=B(a.rtl,!1,this.rtl);this.dedupe=B(a.dedupe,!1,this.dedupe);this.filter=B((b=a.filter)&&new Set(b),null,this.filter);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
-B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
-(this.D?"|":"")+d;return this};x.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.D+=(this.D?"|":"")+a;this.N=null;this.cache&&L(this);return this};x.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&L(this);return this};x.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.h+=(this.h?"|":"")+a;this.M=null;this.cache&&L(this);return this};x.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&L(this);return this};
+this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ca)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);ha||(this.mapper=new Map(ba));b=a.filter;this.filter="function"===typeof b?b:B(b&&new Set(b),null,this.filter);this.dedupe=B(a.dedupe,!1,this.dedupe);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
+B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);this.rtl=B(a.rtl,!1,this.rtl);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
+(this.D?"|":"")+d;return this};x.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.D+=(this.D?"|":"")+a;this.N=null;this.cache&&L(this);return this};x.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&L(this);return this};
+x.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.h+=(this.h?"|":"")+a;this.M=null;this.cache&&L(this);return this};
+x.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&L(this);return this};
x.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ha?a.normalize("NFKD").replace(ha,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3this.stemmer.get(h)),g.lengththis.matcher.get(h)));if(g&&this.replacer)for(d=0;g&&d
-this.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ka,la,Q;function ma(){ka=Q=0}
+[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,h;fthis.stemmer.get(k)),d!==g&&this.filter&&
+g.length>=this.minlength&&("function"===typeof this.filter?!this.filter(g):this.filter.has(g))&&(g=""));if(g&&(this.mapper||this.dedupe&&1this.matcher.get(k)));if(g&&this.replacer)for(d=0;g&&dthis.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ka,la,Q;function ma(){ka=Q=0}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);ka?Q||(Q=Date.now()-la>=this.priority*this.priority*3):(ka=setTimeout(ma,0),la=Date.now());if(Q){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let R=0;
-function S(a={}){function c(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=C();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++R]=function(){h(d);1E9b||e?g.slice(e,b+e):g;else{if(ab||e)g=g.slice(e,b+e)}return g}
-function xa(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;lc?c?a.slice(b,b+c):a.slice(b):a,e?W.call(this,a):a;let d=[];for(let f=0,g,k;f=k){b-=k;continue}bc&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1a.length?this.result=a[0]:(this.result=xa(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=Aa(this,"and",arguments);return Ca.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
-function Ca(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;la.length)this.result=a[0];else{if(c=aa(a))return this.result=wa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Aa(this,"xor",arguments);return Da.call(this,a,c,b,e,d,f,g)};
-function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;la.length)this.result=a[0];else return this.result=Ea.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
-function Ea(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;hb||e?g.slice(e,b+e):g;else{if(ab||e)g=g.slice(e,b+e)}return g}
+function ya(a,c,b){const e=[],d=C();let f;var g=a.length;let h;for(let k=g-1;0<=k;k--)if(h=(g=a[k])&&g.length)for(let l=0;lc?c?a.slice(b,b+c):a.slice(b):a,e?W.call(this,a):a;let d=[];for(let f=0,g,h;f=h){b-=h;continue}bc&&(g=g.slice(0,c),h=c);if(!d.length&&h>=c)return e?W.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1a.length?this.result=a[0]:(this.result=ya(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:h,offset:k,enrich:l,resolve:m,suggest:n}=Ba(this,"and",arguments);return Da.call(this,f,g,h,k,l,m,n)}return d?this.resolve(c,b,e):this};
+function Da(a,c,b,e,d,f,g){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,m;la.length)this.result=a[0];else{if(c=aa(a))return this.result=xa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ba(this,"xor",arguments);return Ea.call(this,a,c,b,e,d,f,g)};
+function Ea(a,c,b,e,d,f,g){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,m;la.length)this.result=a[0];else return this.result=Fa.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
+function Fa(a,c,b,e,d){const f=[],g=C();let h=0;for(let k=0,l;kb||e)a=a.slice(e,e+b);d&&(a=W.call(this,a));return a}}function W(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;bb||e)a=a.slice(e,e+b);d&&(a=W.call(this,a));return a}}function W(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;bthis.limit&&this.cache.delete(this.cache.keys().next().value)};
-Y.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Ma={normalize:function(a){return a.toLowerCase()}};const Na=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Oa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Pa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Qa={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Ra=/[\x00-\x7F]+/g;const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;var Ua={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Ma,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Na},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Na,matcher:Oa,replacer:Pa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Na,replacer:Pa.concat([/(?!^)[aeo]/g,""]),matcher:Oa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;bv;f--){g=q.substring(v,f);u=this.rtl?d-1-v:v;var k=this.score?this.score(c,q,p,g,u):Wa(t,e,p,d,u);
-Z(this,m,g,k,a,b)}break}case "reverse":if(1g?0:1),e,p,k-1,h-1),u=this.bidirectional&&
-q>f;Z(this,l,u?f:q,v,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Wa(a,c,b,e,d){return b&&1b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};O.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;ed.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else Za(this.map,a),this.depth&&Za(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
-function Za(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;ethis.limit&&this.cache.delete(this.cache.keys().next().value)};
+Y.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Na={normalize:function(a){return a.toLowerCase()}};const Oa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Pa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Ra={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;const Ua=/[\x00-\x7F]+/g;var Va={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Na,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Oa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Oa,matcher:Pa,replacer:Qa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Oa,replacer:Qa.concat([/(?!^)[aeo]/g,""]),matcher:Pa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;bv;f--){g=q.substring(v,f);u=this.rtl?d-1-v:v;var h=this.score?this.score(c,q,p,g,u):Xa(t,e,p,d,u);
+Z(this,m,g,h,a,b)}break}case "reverse":if(1g?0:1),e,p,h-1,k-1),u=this.bidirectional&&
+q>f;Z(this,l,u?f:q,v,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let h=g?a.ctx:a.map,k;if(!c[b]||g&&!(k=c[b])[g])g?(c=k||(c[b]=C()),c[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[e]||(h[e]=[]),f&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function Xa(a,c,b,e,d){return b&&1b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};O.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;ed.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else $a(this.map,a),this.depth&&$a(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
+function $a(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;eb.add(a,c)):this.add(a,c)};function $a(a){let c=0;if(a.constructor===Array)for(let b=0,e;bb.add(a,c)):this.add(a,c)};function ab(a){let c=0;if(a.constructor===Array)for(let b=0,e;b this.stemmer.get(h)), g.length < this.minlength || this.filter && this.filter.has(g)) && (g = "");
+ this.stemmer && 2 < g.length && (this.N || (this.N = new RegExp("(?!^)(" + this.D + ")$")), d = g, g = g.replace(this.N, k => this.stemmer.get(k)), d !== g && this.filter && g.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(g) : this.filter.has(g)) && (g = ""));
if (g && (this.mapper || this.dedupe && 1 < g.length)) {
d = "";
- for (let h = 0, l = "", m, n; h < g.length; h++) {
- m = g.charAt(h), m === l && this.dedupe || ((n = this.mapper && this.mapper.get(m)) || "" === n ? n === l && this.dedupe || !(l = n) || (d += n) : d += l = m);
+ for (let k = 0, l = "", m, n; k < g.length; k++) {
+ m = g.charAt(k), m === l && this.dedupe || ((n = this.mapper && this.mapper.get(m)) || "" === n ? n === l && this.dedupe || !(l = n) || (d += n) : d += l = m);
}
g = d;
}
- this.matcher && 1 < g.length && (this.M || (this.M = new RegExp("(" + this.h + ")", "g")), g = g.replace(this.M, h => this.matcher.get(h)));
+ this.matcher && 1 < g.length && (this.M || (this.M = new RegExp("(" + this.h + ")", "g")), g = g.replace(this.M, k => this.matcher.get(k)));
if (g && this.replacer) {
for (d = 0; g && d < this.replacer.length; d += 2) {
g = g.replace(this.replacer[d], this.replacer[d + 1]);
}
}
- this.cache && k.length <= this.L && (this.G.set(k, g), this.G.size > this.R && (this.G.clear(), this.L = this.L / 1.1 | 0));
+ this.cache && h.length <= this.L && (this.G.set(h, g), this.G.size > this.R && (this.G.clear(), this.L = this.L / 1.1 | 0));
g && b.push(g);
}
}
@@ -331,19 +331,19 @@ function P(a) {
;let R = 0;
function S(a = {}) {
function c(g) {
- function k(h) {
- h = h.data || h;
- const l = h.id, m = l && d.h[l];
- m && (m(h.msg), delete d.h[l]);
+ function h(k) {
+ k = k.data || k;
+ const l = k.id, m = l && d.h[l];
+ m && (m(k.msg), delete d.h[l]);
}
this.worker = g;
this.h = C();
if (this.worker) {
- e ? this.worker.on("message", k) : this.worker.onmessage = k;
+ e ? this.worker.on("message", h) : this.worker.onmessage = h;
if (a.config) {
- return new Promise(function(h) {
+ return new Promise(function(k) {
d.h[++R] = function() {
- h(d);
+ k(d);
1e9 < R && (R = 0);
};
d.worker.postMessage({id:R, task:"init", factory:b, options:a});
@@ -439,18 +439,38 @@ function ta(a, c) {
return c;
}
function U(a, c, b, e, d, f, g = 0) {
- const k = e && e.constructor === Array;
- var h = k ? e.shift() : e;
- if (!h) {
+ const h = e && e.constructor === Array;
+ var k = h ? e.shift() : e;
+ if (!k) {
return this.export(a, c, d, f + 1);
}
- if ((h = a((c ? c + "." : "") + (g + 1) + "." + b, JSON.stringify(h))) && h.then) {
+ if ((k = a((c ? c + "." : "") + (g + 1) + "." + b, JSON.stringify(k))) && k.then) {
const l = this;
- return h.then(function() {
- return U.call(l, a, c, b, k ? e : null, d, f, g + 1);
+ return k.then(function() {
+ return U.call(l, a, c, b, h ? e : null, d, f, g + 1);
});
}
- return U.call(this, a, c, b, k ? e : null, d, f, g + 1);
+ return U.call(this, a, c, b, h ? e : null, d, f, g + 1);
+}
+function ua(a, c) {
+ let b = "";
+ for (const e of a.entries()) {
+ a = e[0];
+ const d = e[1];
+ let f = "";
+ for (let g = 0, h; g < d.length; g++) {
+ h = d[g] || [""];
+ let k = "";
+ for (let l = 0; l < h.length; l++) {
+ k += (k ? "," : "") + ("string" === c ? '"' + h[l] + '"' : h[l]);
+ }
+ k = "[" + k + "]";
+ f += (f ? "," : "") + k;
+ }
+ f = '["' + a + '",[' + f + "]]";
+ b += (b ? "," : "") + f;
+ }
+ return b;
}
;V.prototype.add = function(a, c, b) {
I(a) && (c = a, a = J(c, this.key));
@@ -458,15 +478,15 @@ function U(a, c, b, e, d, f, g = 0) {
if (!b && this.reg.has(a)) {
return this.update(a, c);
}
- for (let k = 0, h; k < this.field.length; k++) {
- h = this.C[k];
- var e = this.index.get(this.field[k]);
- if ("function" === typeof h) {
- var d = h(c);
+ for (let h = 0, k; h < this.field.length; h++) {
+ k = this.C[h];
+ var e = this.index.get(this.field[h]);
+ if ("function" === typeof k) {
+ var d = k(c);
d && e.add(a, d, !1, !0);
} else {
- if (d = h.I, !d || d(c)) {
- h.constructor === String ? h = ["" + h] : D(h) && (h = [h]), ua(c, h, this.J, 0, e, a, h[0], b);
+ if (d = k.I, !d || d(c)) {
+ k.constructor === String ? k = ["" + k] : D(k) && (k = [k]), va(c, k, this.J, 0, e, a, k[0], b);
}
}
}
@@ -474,14 +494,14 @@ function U(a, c, b, e, d, f, g = 0) {
for (e = 0; e < this.B.length; e++) {
var f = this.B[e], g = this.T[e];
d = this.tag.get(g);
- let k = C();
+ let h = C();
if ("function" === typeof f) {
if (f = f(c), !f) {
continue;
}
} else {
- const h = f.I;
- if (h && !h(c)) {
+ const k = f.I;
+ if (k && !k(c)) {
continue;
}
f.constructor === String && (f = "" + f);
@@ -489,8 +509,8 @@ function U(a, c, b, e, d, f, g = 0) {
}
if (d && f) {
D(f) && (f = [f]);
- for (let h = 0, l, m; h < f.length; h++) {
- l = f[h], k[l] || (k[l] = 1, (g = d.get(l)) ? m = g : d.set(l, m = []), b && m.includes(a) || (m.push(a), this.fastupdate && ((g = this.reg.get(a)) ? g.push(m) : this.reg.set(a, [m]))));
+ for (let k = 0, l, m; k < f.length; k++) {
+ l = f[k], h[l] || (h[l] = 1, (g = d.get(l)) ? m = g : d.set(l, m = []), b && m.includes(a) || (m.push(a), this.fastupdate && ((g = this.reg.get(a)) ? g.push(m) : this.reg.set(a, [m]))));
}
} else {
d || console.warn("Tag '" + g + "' was not found");
@@ -498,11 +518,11 @@ function U(a, c, b, e, d, f, g = 0) {
}
}
if (this.store && (!b || !this.store.has(a))) {
- let k;
+ let h;
if (this.A) {
- k = C();
- for (let h = 0, l; h < this.A.length; h++) {
- l = this.A[h];
+ h = C();
+ for (let k = 0, l; k < this.A.length; k++) {
+ l = this.A[k];
if ((b = l.I) && !b(c)) {
continue;
}
@@ -514,32 +534,32 @@ function U(a, c, b, e, d, f, g = 0) {
}
l = [l.U];
} else if (D(l) || l.constructor === String) {
- k[l] = c[l];
+ h[l] = c[l];
continue;
}
- va(c, k, l, 0, l[0], m);
+ wa(c, h, l, 0, l[0], m);
}
}
- this.store.set(a, k || c);
+ this.store.set(a, h || c);
}
}
return this;
};
-function va(a, c, b, e, d, f) {
+function wa(a, c, b, e, d, f) {
a = a[d];
if (e === b.length - 1) {
c[d] = f || a;
} else if (a) {
if (a.constructor === Array) {
for (c = c[d] = Array(a.length), d = 0; d < a.length; d++) {
- va(a, c, b, e, d);
+ wa(a, c, b, e, d);
}
} else {
- c = c[d] || (c[d] = C()), d = b[++e], va(a, c, b, e, d);
+ c = c[d] || (c[d] = C()), d = b[++e], wa(a, c, b, e, d);
}
}
}
-function ua(a, c, b, e, d, f, g, k) {
+function va(a, c, b, e, d, f, g, h) {
if (a = a[g]) {
if (e === c.length - 1) {
if (a.constructor === Array) {
@@ -551,34 +571,36 @@ function ua(a, c, b, e, d, f, g, k) {
}
a = a.join(" ");
}
- d.add(f, a, k, !0);
+ d.add(f, a, h, !0);
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
- ua(a, c, b, e, d, f, g, k);
+ va(a, c, b, e, d, f, g, h);
}
} else {
- g = c[++e], ua(a, c, b, e, d, f, g, k);
+ g = c[++e], va(a, c, b, e, d, f, g, h);
}
}
}
}
-;function wa(a, c, b, e, d) {
+;function xa(a, c, b, e, d) {
const f = a.length;
- let g = [], k, h;
- k = C();
+ let g = [], h, k;
+ h = C();
for (let l = 0, m, n, t, p; l < c; l++) {
for (let q = 0; q < f; q++) {
if (t = a[q], l < t.length && (m = t[l])) {
for (let v = 0; v < m.length; v++) {
- n = m[v], (h = k[n]) ? k[n]++ : (h = 0, k[n] = 1), p = g[h] || (g[h] = []), p.push(n);
+ if (n = m[v], (k = h[n]) ? h[n]++ : (k = 0, h[n] = 1), p = g[k] || (g[k] = []), p.push(n), b && k === f - 1 && p.length - e === b) {
+ return p;
+ }
}
}
}
}
if (a = g.length) {
if (d) {
- g = 1 < g.length ? xa(g, b, e) : (g = g[0]).length > b || e ? g.slice(e, b + e) : g;
+ g = 1 < g.length ? ya(g, b, e) : (g = g[0]).length > b || e ? g.slice(e, b + e) : g;
} else {
if (a < f) {
return [];
@@ -593,14 +615,14 @@ function ua(a, c, b, e, d, f, g, k) {
}
return g;
}
-function xa(a, c, b) {
+function ya(a, c, b) {
const e = [], d = C();
let f;
var g = a.length;
- let k;
- for (let h = g - 1; 0 <= h; h--) {
- if (k = (g = a[h]) && g.length) {
- for (let l = 0; l < k; l++) {
+ let h;
+ for (let k = g - 1; 0 <= k; k--) {
+ if (h = (g = a[k]) && g.length) {
+ for (let l = 0; l < h; l++) {
if (f = g[l], !d[f]) {
if (d[f] = 1, b) {
b--;
@@ -615,7 +637,7 @@ function xa(a, c, b) {
}
return e;
}
-function ya(a, c) {
+function za(a, c) {
const b = C(), e = [];
for (let d = 0, f; d < c.length; d++) {
f = c[d];
@@ -628,7 +650,7 @@ function ya(a, c) {
}
return e;
}
-;function za(a, c, b, e) {
+;function Aa(a, c, b, e) {
if (!a.length) {
return a;
}
@@ -636,21 +658,21 @@ function ya(a, c) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a, e ? W.call(this, a) : a;
}
let d = [];
- for (let f = 0, g, k; f < a.length; f++) {
- if ((g = a[f]) && (k = g.length)) {
+ for (let f = 0, g, h; f < a.length; f++) {
+ if ((g = a[f]) && (h = g.length)) {
if (b) {
- if (b >= k) {
- b -= k;
+ if (b >= h) {
+ b -= h;
continue;
}
- b < k && (g = c ? g.slice(b, b + c) : g.slice(b), k = g.length, b = 0);
+ b < h && (g = c ? g.slice(b, b + c) : g.slice(b), h = g.length, b = 0);
}
- k > c && (g = g.slice(0, c), k = c);
- if (!d.length && k >= c) {
+ h > c && (g = g.slice(0, c), h = c);
+ if (!d.length && h >= c) {
return e ? W.call(this, g) : g;
}
d.push(g);
- c -= k;
+ c -= h;
if (!c) {
break;
}
@@ -659,7 +681,7 @@ function ya(a, c) {
d = 1 < d.length ? [].concat.apply([], d) : d[0];
return e ? W.call(this, d) : d;
}
-;function Aa(a, c, b) {
+;function Ba(a, c, b) {
var e = b[0];
if (e.then) {
return Promise.all(b).then(function(m) {
@@ -670,7 +692,7 @@ function ya(a, c) {
return a[c].apply(a, e);
}
e = [];
- let d = [], f = 0, g = 0, k, h, l;
+ let d = [], f = 0, g = 0, h, k, l;
for (let m = 0, n; m < b.length; m++) {
if (n = b[m]) {
let t;
@@ -679,8 +701,8 @@ function ya(a, c) {
} else if (n.constructor === Array) {
t = n;
} else {
- if (f = n.limit || 0, g = n.offset || 0, l = n.suggest, h = n.resolve, k = n.enrich && h, n.index) {
- n.resolve = !1, n.enrich = !1, t = n.index.search(n).result, n.resolve = h, n.enrich = k;
+ if (f = n.limit || 0, g = n.offset || 0, l = n.suggest, k = n.resolve, h = n.enrich && k, n.index) {
+ n.resolve = !1, n.enrich = !1, t = n.index.search(n).result, n.resolve = k, n.enrich = h;
} else if (n.and) {
t = a.and(n.and);
} else if (n.or) {
@@ -703,24 +725,24 @@ function ya(a, c) {
}
}
}
- return {O:e, P:d, limit:f, offset:g, enrich:k, resolve:h, suggest:l};
+ return {O:e, P:d, limit:f, offset:g, enrich:h, resolve:k, suggest:l};
}
;X.prototype.or = function() {
- const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f} = Aa(this, "or", arguments);
- return Ba.call(this, a, c, b, e, d, f);
+ const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f} = Ba(this, "or", arguments);
+ return Ca.call(this, a, c, b, e, d, f);
};
-function Ba(a, c, b, e, d, f) {
+function Ca(a, c, b, e, d, f) {
if (c.length) {
const g = this;
- return Promise.all(c).then(function(k) {
+ return Promise.all(c).then(function(h) {
a = [];
- for (let h = 0, l; h < k.length; h++) {
- (l = k[h]).length && (a[h] = l);
+ for (let k = 0, l; k < h.length; k++) {
+ (l = h[k]).length && (a[k] = l);
}
- return Ba.call(g, a, [], b, e, d, f);
+ return Ca.call(g, a, [], b, e, d, f);
});
}
- a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = xa(a, b, e), e = 0));
+ a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = ya(a, b, e), e = 0));
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.and = function() {
@@ -730,20 +752,20 @@ function Ba(a, c, b, e, d, f) {
f && (a = !!f.suggest, d = f.resolve, c = f.limit, b = f.offset, e = f.enrich && d);
}
if (a) {
- const {O:f, P:g, limit:k, offset:h, enrich:l, resolve:m, suggest:n} = Aa(this, "and", arguments);
- return Ca.call(this, f, g, k, h, l, m, n);
+ const {O:f, P:g, limit:h, offset:k, enrich:l, resolve:m, suggest:n} = Ba(this, "and", arguments);
+ return Da.call(this, f, g, h, k, l, m, n);
}
return d ? this.resolve(c, b, e) : this;
};
-function Ca(a, c, b, e, d, f, g) {
+function Da(a, c, b, e, d, f, g) {
if (c.length) {
- const k = this;
- return Promise.all(c).then(function(h) {
+ const h = this;
+ return Promise.all(c).then(function(k) {
a = [];
- for (let l = 0, m; l < h.length; l++) {
- (m = h[l]).length && (a[l] = m);
+ for (let l = 0, m; l < k.length; l++) {
+ (m = k[l]).length && (a[l] = m);
}
- return Ca.call(k, a, [], b, e, d, f, g);
+ return Da.call(h, a, [], b, e, d, f, g);
});
}
if (a.length) {
@@ -751,7 +773,7 @@ function Ca(a, c, b, e, d, f, g) {
this.result = a[0];
} else {
if (c = aa(a)) {
- return this.result = wa(a, c, b, e, g), f ? d ? W.call(this.index, this.result) : this.result : this;
+ return this.result = xa(a, c, b, e, g), f ? d ? W.call(this.index, this.result) : this.result : this;
}
this.result = [];
}
@@ -761,37 +783,37 @@ function Ca(a, c, b, e, d, f, g) {
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.xor = function() {
- const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "xor", arguments);
- return Da.call(this, a, c, b, e, d, f, g);
+ const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ba(this, "xor", arguments);
+ return Ea.call(this, a, c, b, e, d, f, g);
};
-function Da(a, c, b, e, d, f, g) {
+function Ea(a, c, b, e, d, f, g) {
if (c.length) {
- const k = this;
- return Promise.all(c).then(function(h) {
+ const h = this;
+ return Promise.all(c).then(function(k) {
a = [];
- for (let l = 0, m; l < h.length; l++) {
- (m = h[l]).length && (a[l] = m);
+ for (let l = 0, m; l < k.length; l++) {
+ (m = k[l]).length && (a[l] = m);
}
- return Da.call(k, a, [], b, e, d, f, g);
+ return Ea.call(h, a, [], b, e, d, f, g);
});
}
if (a.length) {
if (this.result.length && a.unshift(this.result), 2 > a.length) {
this.result = a[0];
} else {
- return this.result = Ea.call(this, a, b, e, f, this.h), f ? d ? W.call(this.index, this.result) : this.result : this;
+ return this.result = Fa.call(this, a, b, e, f, this.h), f ? d ? W.call(this.index, this.result) : this.result : this;
}
} else {
g || (this.result = a);
}
return f ? this.resolve(b, e, d) : this;
}
-function Ea(a, c, b, e, d) {
+function Fa(a, c, b, e, d) {
const f = [], g = C();
- let k = 0;
- for (let h = 0, l; h < a.length; h++) {
- if (l = a[h]) {
- k < l.length && (k = l.length);
+ let h = 0;
+ for (let k = 0, l; k < a.length; k++) {
+ if (l = a[k]) {
+ h < l.length && (h = l.length);
for (let m = 0, n; m < l.length; m++) {
if (n = l[m]) {
for (let t = 0, p; t < n.length; t++) {
@@ -801,10 +823,10 @@ function Ea(a, c, b, e, d) {
}
}
}
- for (let h = 0, l, m = 0; h < k; h++) {
+ for (let k = 0, l, m = 0; k < h; k++) {
for (let n = 0, t; n < a.length; n++) {
if (t = a[n]) {
- if (l = t[h]) {
+ if (l = t[k]) {
for (let p = 0, q; p < l.length; p++) {
if (q = l[p], 1 === g[q]) {
if (b) {
@@ -815,7 +837,7 @@ function Ea(a, c, b, e, d) {
return f;
}
} else {
- const v = h + (n ? d : 0);
+ const v = k + (n ? d : 0);
f[v] || (f[v] = []);
f[v].push(q);
if (++m === c) {
@@ -832,34 +854,34 @@ function Ea(a, c, b, e, d) {
return f;
}
;X.prototype.not = function() {
- const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "not", arguments);
- return Fa.call(this, a, c, b, e, d, f, g);
+ const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ba(this, "not", arguments);
+ return Ga.call(this, a, c, b, e, d, f, g);
};
-function Fa(a, c, b, e, d, f, g) {
+function Ga(a, c, b, e, d, f, g) {
if (c.length) {
- const k = this;
- return Promise.all(c).then(function(h) {
+ const h = this;
+ return Promise.all(c).then(function(k) {
a = [];
- for (let l = 0, m; l < h.length; l++) {
- (m = h[l]).length && (a[l] = m);
+ for (let l = 0, m; l < k.length; l++) {
+ (m = k[l]).length && (a[l] = m);
}
- return Fa.call(k, a, [], b, e, d, f, g);
+ return Ga.call(h, a, [], b, e, d, f, g);
});
}
if (a.length && this.result.length) {
- this.result = Ga.call(this, a, b, e, f);
+ this.result = Ha.call(this, a, b, e, f);
} else if (f) {
return this.resolve(b, e, d);
}
return f ? d ? W.call(this.index, this.result) : this.result : this;
}
-function Ga(a, c, b, e) {
+function Ha(a, c, b, e) {
const d = [];
a = new Set(a.flat().flat());
- for (let f = 0, g, k = 0; f < this.result.length; f++) {
+ for (let f = 0, g, h = 0; f < this.result.length; f++) {
if (g = this.result[f]) {
- for (let h = 0, l; h < g.length; h++) {
- if (l = g[h], !a.has(l)) {
+ for (let k = 0, l; k < g.length; k++) {
+ if (l = g[k], !a.has(l)) {
if (b) {
b--;
} else {
@@ -868,7 +890,7 @@ function Ga(a, c, b, e) {
return d;
}
} else {
- if (d[f] || (d[f] = []), d[f].push(l), ++k === c) {
+ if (d[f] || (d[f] = []), d[f].push(l), ++h === c) {
return d;
}
}
@@ -928,26 +950,25 @@ X.prototype.boost = function(a) {
X.prototype.resolve = function(a, c, b) {
const e = this.result, d = this.index;
this.result = this.index = null;
- return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), za.call(d, e, a || 100, c, b)) : e;
+ return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), Aa.call(d, e, a || 100, c, b)) : e;
};
C();
V.prototype.search = function(a, c, b, e) {
b || (!c && I(a) ? (b = a, a = "") : I(c) && (b = c, c = 0));
let d = [];
var f = [];
- let g, k, h, l, m, n, t = 0, p = !0, q;
+ let g, h, k, l, m, n, t = 0, p = !0, q;
if (b) {
b.constructor === Array && (b = {index:b});
a = b.query || a;
var v = b.pluck;
- k = b.merge;
+ h = b.merge;
l = v || b.field || (l = b.index) && (l.index ? null : l);
m = this.tag && b.tag;
- h = b.suggest;
+ k = b.suggest;
p = !0;
this.store && b.enrich && !p && console.warn("Enrich results can only be done on a final resolver task or when calling .resolve({ enrich: true })");
- g = this.store && b.enrich && p;
- q = b.highlight && g;
+ q = (g = this.store && b.enrich && p) && b.highlight;
c = b.limit || c;
n = b.offset || 0;
c || (c = 100);
@@ -989,7 +1010,7 @@ V.prototype.search = function(a, c, b, e) {
e = [];
if (u.length) {
for (f = 0; f < u.length; f += 2) {
- v = Ha.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:v});
+ v = Ia.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:v});
}
}
return e.length ? Promise.all(e).then(function(y) {
@@ -1007,7 +1028,7 @@ V.prototype.search = function(a, c, b, e) {
for (let y = 0, r, E, F; y < l.length; y++) {
E = l[y];
let A;
- D(E) || (A = E, E = A.field, a = A.query || a, c = A.limit || c, n = A.offset || n, h = A.suggest || h, g = this.store && (A.enrich || g));
+ D(E) || (A = E, E = A.field, a = A.query || a, c = A.limit || c, n = A.offset || n, k = A.suggest || k, g = this.store && (A.enrich || g));
if (e) {
r = e[y];
} else {
@@ -1023,25 +1044,25 @@ V.prototype.search = function(a, c, b, e) {
if (m && F) {
w = [];
z = 0;
- for (let G = 0, H, Va; G < m.length; G += 2) {
+ for (let G = 0, H, Wa; G < m.length; G += 2) {
H = this.tag.get(m[G]);
if (!H) {
- if (console.warn("Tag '" + m[G] + ":" + m[G + 1] + "' will be skipped because there is no field '" + m[G] + "'."), h) {
+ if (console.warn("Tag '" + m[G] + ":" + m[G + 1] + "' will be skipped because there is no field '" + m[G] + "'."), k) {
continue;
} else {
return p ? d : new X(d);
}
}
- if (Va = (H = H && H.get(m[G + 1])) && H.length) {
+ if (Wa = (H = H && H.get(m[G + 1])) && H.length) {
z++, w.push(H);
- } else if (!h) {
+ } else if (!k) {
return p ? d : new X(d);
}
}
if (z) {
- r = ya(r, w);
+ r = za(r, w);
F = r.length;
- if (!F && !h) {
+ if (!F && !k) {
return p ? r : new X(r);
}
z--;
@@ -1074,18 +1095,19 @@ V.prototype.search = function(a, c, b, e) {
}
d[y] = {field:f[y], result:r};
}
- return k ? Ia(d, c) : q ? Ja(d, a, this.index, this.field, this.C, q) : d;
+ return h ? Ja(d, c) : q ? Ka(d, a, this.index, this.field, this.C, q) : d;
};
-function Ja(a, c, b, e, d, f) {
- let g, k, h;
+function Ka(a, c, b, e, d, f) {
+ console.log("template", f);
+ let g, h, k;
for (let m = 0, n, t, p, q, v; m < a.length; m++) {
n = a[m].result;
t = a[m].field;
q = b.get(t);
p = q.encoder;
- h = q.tokenize;
+ k = q.tokenize;
v = d[e.indexOf(t)];
- p !== g && (g = p, k = g.encode(c));
+ p !== g && (g = p, h = g.encode(c));
for (let u = 0; u < n.length; u++) {
let w = "";
var l = J(n[u].doc, v);
@@ -1095,8 +1117,8 @@ function Ja(a, c, b, e, d, f) {
r = z[y];
E = l[y];
let F;
- for (let A = 0, G; A < k.length; A++) {
- if (G = k[A], "strict" === h) {
+ for (let A = 0, G; A < h.length; A++) {
+ if (G = h[A], "strict" === k) {
if (r === G) {
w += (w ? " " : "") + f.replace("$1", E);
F = !0;
@@ -1118,26 +1140,26 @@ function Ja(a, c, b, e, d, f) {
}
return a;
}
-function Ia(a, c) {
+function Ja(a, c) {
const b = [], e = C();
for (let d = 0, f, g; d < a.length; d++) {
f = a[d];
g = f.result;
- for (let k = 0, h, l, m; k < g.length; k++) {
- if (l = g[k], "object" !== typeof l && (l = {id:l}), h = l.id, m = e[h]) {
+ for (let h = 0, k, l, m; h < g.length; h++) {
+ if (l = g[h], "object" !== typeof l && (l = {id:l}), k = l.id, m = e[k]) {
m.push(f.field);
} else {
if (b.length === c) {
return b;
}
- l.field = e[h] = [f.field];
+ l.field = e[k] = [f.field];
b.push(l);
}
}
}
return b;
}
-function Ha(a, c, b, e, d) {
+function Ia(a, c, b, e, d) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -1169,7 +1191,7 @@ function W(a) {
this.C = [];
this.field = [];
this.J = [];
- this.key = (b = c.key || c.id) && Ka(b, this.J) || "id";
+ this.key = (b = c.key || c.id) && La(b, this.J) || "id";
this.reg = (this.fastupdate = !!a.fastupdate) ? new Map() : new Set();
this.A = (b = c.store || null) && b && !0 !== b && [];
this.store = b && new Map();
@@ -1180,13 +1202,13 @@ function W(a) {
let e = c.index || c.field || c;
D(e) && (e = [e]);
for (let d = 0, f, g; d < e.length; d++) {
- f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = Ka(f, this.J), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].I = g.filter)), this.field[d] = f;
+ f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = La(f, this.J), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].I = g.filter)), this.field[d] = f;
}
if (this.A) {
a = c.store;
D(a) && (a = [a]);
for (let d = 0, f, g; d < a.length; d++) {
- f = a[d], g = f.field || f, f.custom ? (this.A[d] = f.custom, f.custom.U = g) : (this.A[d] = Ka(g, this.J), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].I = f.filter));
+ f = a[d], g = f.field || f, f.custom ? (this.A[d] = f.custom, f.custom.U = g) : (this.A[d] = La(g, this.J), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].I = f.filter));
}
}
this.index = b;
@@ -1202,14 +1224,14 @@ function W(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
- f.custom ? this.B[d] = f.custom : (this.B[d] = Ka(g, this.J), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].I = f.filter));
+ f.custom ? this.B[d] = f.custom : (this.B[d] = La(g, this.J), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].I = f.filter));
this.T[d] = g;
this.tag.set(g, new Map());
}
}
}
}
-function Ka(a, c) {
+function La(a, c) {
const b = a.split(":");
let e = 0;
for (let d = 0; d < b.length; d++) {
@@ -1247,16 +1269,19 @@ x.remove = function(a) {
return this;
};
x.clear = function() {
- for (const a of this.index.values()) {
- a.clear();
+ const a = [];
+ for (const c of this.index.values()) {
+ const b = c.clear();
+ b.then && a.push(b);
}
if (this.tag) {
- for (const a of this.tag.values()) {
- a.clear();
+ for (const c of this.tag.values()) {
+ c.clear();
}
}
this.store && this.store.clear();
- return this;
+ this.cache && this.cache.clear();
+ return a.length ? Promise.all(a) : this;
};
x.contain = function(a) {
return this.reg.has(a);
@@ -1274,14 +1299,14 @@ x.set = function(a, c) {
this.store.set(a, c);
return this;
};
-x.searchCache = La;
+x.searchCache = Ma;
x.export = function(a, c, b = 0, e = 0) {
if (b < this.field.length) {
const g = this.field[b];
if ((c = this.index.get(g).export(a, g, b, e = 1)) && c.then) {
- const k = this;
+ const h = this;
return c.then(function() {
- return k.export(a, g, b + 1);
+ return h.export(a, g, b + 1);
});
}
return this.export(a, g, b + 1);
@@ -1335,7 +1360,7 @@ x.import = function(a, c) {
}
};
ja(V.prototype);
-function La(a, c, b) {
+function Ma(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new Y());
let e = this.cache.get(a);
@@ -1376,31 +1401,31 @@ Y.prototype.clear = function() {
this.cache.clear();
this.h = "";
};
-const Ma = {normalize:function(a) {
+const Na = {normalize:function(a) {
return a.toLowerCase();
}};
-const Na = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
-const Oa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Pa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
-const Qa = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
-const Ra = /[\x00-\x7F]+/g;
+const Oa = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
+const Pa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Qa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
+const Ra = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
const Sa = /[\x00-\x7F]+/g;
const Ta = /[\x00-\x7F]+/g;
-var Ua = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:Ma, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Na}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Na, matcher:Oa, replacer:Pa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Na, replacer:Pa.concat([/(?!^)[aeo]/g, ""]), matcher:Oa}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
+const Ua = /[\x00-\x7F]+/g;
+var Va = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:Na, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Oa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Oa, matcher:Pa, replacer:Qa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Oa, replacer:Qa.concat([/(?!^)[aeo]/g, ""]), matcher:Pa}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
for (let b = 0; b < a.length; b++) {
var c = a[b];
- let e = c.charAt(0), d = Qa[e];
- for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = Qa[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
+ let e = c.charAt(0), d = Ra[e];
+ for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = Ra[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
}
a[b] = e;
}
}}, ArabicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
- return ("" + a).replace(Ra, " ");
+ return ("" + a).replace(Sa, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
- return ("" + a).replace(Sa, "");
+ return ("" + a).replace(Ta, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
- return ("" + a).replace(Ta, " ");
+ return ("" + a).replace(Ua, " ");
}}};
-const Wa = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
+const Xa = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
O.prototype.add = function(a, c, b, e) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
@@ -1413,7 +1438,7 @@ O.prototype.add = function(a, c, b, e) {
let q = c[this.rtl ? e - 1 - p : p];
var d = q.length;
if (d && (n || !m[q])) {
- var f = this.score ? this.score(c, q, p, null, 0) : Xa(t, e, p), g = "";
+ var f = this.score ? this.score(c, q, p, null, 0) : Ya(t, e, p), g = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
@@ -1421,34 +1446,34 @@ O.prototype.add = function(a, c, b, e) {
for (f = d; f > v; f--) {
g = q.substring(v, f);
u = this.rtl ? d - 1 - v : v;
- var k = this.score ? this.score(c, q, p, g, u) : Xa(t, e, p, d, u);
- Z(this, m, g, k, a, b);
+ var h = this.score ? this.score(c, q, p, g, u) : Ya(t, e, p, d, u);
+ Z(this, m, g, h, a, b);
}
}
break;
}
case "reverse":
if (1 < d) {
- for (k = d - 1; 0 < k; k--) {
- g = q[this.rtl ? d - 1 - k : k] + g;
- var h = this.score ? this.score(c, q, p, g, k) : Xa(t, e, p, d, k);
- Z(this, m, g, h, a, b);
+ for (h = d - 1; 0 < h; h--) {
+ g = q[this.rtl ? d - 1 - h : h] + g;
+ var k = this.score ? this.score(c, q, p, g, h) : Ya(t, e, p, d, h);
+ Z(this, m, g, k, a, b);
}
g = "";
}
case "forward":
if (1 < d) {
- for (k = 0; k < d; k++) {
- g += q[this.rtl ? d - 1 - k : k], Z(this, m, g, f, a, b);
+ for (h = 0; h < d; h++) {
+ g += q[this.rtl ? d - 1 - h : h], Z(this, m, g, f, a, b);
}
break;
}
default:
if (Z(this, m, q, f, a, b), n && 1 < e && p < e - 1) {
- for (d = C(), g = this.S, f = q, k = Math.min(n + 1, this.rtl ? p + 1 : e - p), d[f] = 1, h = 1; h < k; h++) {
- if ((q = c[this.rtl ? e - 1 - p - h : p + h]) && !d[q]) {
+ for (d = C(), g = this.S, f = q, h = Math.min(n + 1, this.rtl ? p + 1 : e - p), d[f] = 1, k = 1; k < h; k++) {
+ if ((q = c[this.rtl ? e - 1 - p - k : p + k]) && !d[q]) {
d[q] = 1;
- const v = this.score ? this.score(c, f, p, q, h - 1) : Xa(g + (e / 2 > g ? 0 : 1), e, p, k - 1, h - 1), u = this.bidirectional && q > f;
+ const v = this.score ? this.score(c, f, p, q, k - 1) : Ya(g + (e / 2 > g ? 0 : 1), e, p, h - 1, k - 1), u = this.bidirectional && q > f;
Z(this, l, u ? f : q, v, a, b, u ? q : f);
}
}
@@ -1462,12 +1487,12 @@ O.prototype.add = function(a, c, b, e) {
return this;
};
function Z(a, c, b, e, d, f, g) {
- let k = g ? a.ctx : a.map, h;
- if (!c[b] || g && !(h = c[b])[g]) {
- g ? (c = h || (c[b] = C()), c[g] = 1, (h = k.get(g)) ? k = h : k.set(g, k = new Map())) : c[b] = 1, (h = k.get(b)) ? k = h : k.set(b, k = []), k = k[e] || (k[e] = []), f && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
+ let h = g ? a.ctx : a.map, k;
+ if (!c[b] || g && !(k = c[b])[g]) {
+ g ? (c = k || (c[b] = C()), c[g] = 1, (k = h.get(g)) ? h = k : h.set(g, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[e] || (h[e] = []), f && h.includes(d) || (h.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(h) : a.reg.set(d, [h])));
}
}
-function Xa(a, c, b, e, d) {
+function Ya(a, c, b, e, d) {
return b && 1 < a ? c + (e || 0) <= a ? b + (d || 0) : (a - 1) / (c + (e || 0)) * (b + (d || 0)) + 1 | 0 : 0;
}
;O.prototype.search = function(a, c, b) {
@@ -1479,35 +1504,35 @@ function Xa(a, c, b, e, d) {
d = b.offset || 0;
var f = b.context;
var g = b.suggest;
- var k = !0;
- var h = b.resolution;
+ var h = !0;
+ var k = b.resolution;
} else {
- k = !0;
+ h = !0;
}
a = this.encoder.encode(a);
b = a.length;
- c = c || (k ? 100 : 0);
+ c = c || (h ? 100 : 0);
if (1 === b) {
- return g = c, (c = Ya(this, a[0], "")) && c.length ? za.call(this, c, g, d) : [];
+ return g = c, (c = Za(this, a[0], "")) && c.length ? Aa.call(this, c, g, d) : [];
}
f = this.depth && !1 !== f;
if (2 === b && f && !g) {
- return g = c, (c = Ya(this, a[0], a[1])) && c.length ? za.call(this, c, g, d) : [];
+ return g = c, (c = Za(this, a[0], a[1])) && c.length ? Aa.call(this, c, g, d) : [];
}
- k = C();
+ h = C();
let l = 0;
if (1 < b && f) {
var m = a[0];
l = 1;
}
- h || 0 === h || (h = m ? this.S : this.resolution);
+ k || 0 === k || (k = m ? this.S : this.resolution);
for (let q, v; l < b; l++) {
- if ((v = a[l]) && !k[v]) {
- k[v] = 1;
- q = Ya(this, v, m);
+ if ((v = a[l]) && !h[v]) {
+ h[v] = 1;
+ q = Za(this, v, m);
a: {
f = q;
- var n = e, t = g, p = h;
+ var n = e, t = g, p = k;
let u = [];
if (f && f.length) {
if (f.length <= p) {
@@ -1534,23 +1559,23 @@ function Xa(a, c, b, e, d) {
}
m && (g && q && e.length || (m = v));
}
- g && m && l === b - 1 && !e.length && (h = this.resolution, m = "", l = -1, k = C());
+ g && m && l === b - 1 && !e.length && (k = this.resolution, m = "", l = -1, h = C());
}
a: {
a = e;
e = a.length;
m = a;
if (1 < e) {
- m = wa(a, h, c, d, g);
+ m = xa(a, k, c, d, g);
} else if (1 === e) {
- g = za.call(null, a[0], c, d);
+ g = Aa.call(null, a[0], c, d);
break a;
}
g = m;
}
return g;
};
-function Ya(a, c, b) {
+function Za(a, c, b) {
let e;
b && (e = a.bidirectional && c > b) && (e = b, b = c, c = e);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
@@ -1571,14 +1596,14 @@ function Ya(a, c, b) {
}
}
} else {
- Za(this.map, a), this.depth && Za(this.ctx, a);
+ $a(this.map, a), this.depth && $a(this.ctx, a);
}
c || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
-function Za(a, c) {
+function $a(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let e = 0, d, f; e < a.length; e++) {
@@ -1593,7 +1618,7 @@ function Za(a, c) {
}
} else {
for (let e of a.entries()) {
- const d = e[0], f = Za(e[1], c);
+ const d = e[0], f = $a(e[1], c);
f ? b += f : a.delete(d);
}
}
@@ -1605,19 +1630,20 @@ function Za(a, c) {
}
if (a) {
var b = D(a) ? a : a.preset;
- b && (Wa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Wa[b], a));
+ b && (Xa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Xa[b], a));
} else {
a = {};
}
b = a.context;
- const e = !0 === b ? {depth:1} : b || {}, d = D(a.encoder) ? Ua[a.encoder] : a.encode || a.encoder || Ma;
+ const e = !0 === b ? {depth:1} : b || {}, d = D(a.encoder) ? Va[a.encoder] : a.encode || a.encoder || Na;
this.encoder = d.encode ? d : "object" === typeof d ? new K(d) : {encode:d};
this.resolution = a.resolution || 9;
- this.tokenize = (b = a.tokenize) && "default" !== b && b || "strict";
+ this.tokenize = b = (b = a.tokenize) && "default" !== b && b || "strict";
this.depth = "strict" === b && e.depth || 0;
this.bidirectional = !1 !== e.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
+ e && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
b = !1;
this.map = new Map();
this.ctx = new Map();
@@ -1645,15 +1671,15 @@ x.update = function(a, c) {
const b = this, e = this.remove(a);
return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c);
};
-function $a(a) {
+function ab(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, e; b < a.length; b++) {
(e = a[b]) && (c += e.length);
}
} else {
- for (const b of a) {
- const e = b[0], d = $a(b[1]);
+ for (const b of a.entries()) {
+ const e = b[0], d = ab(b[1]);
d ? c += d : a.delete(e);
}
}
@@ -1663,11 +1689,11 @@ x.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
- $a(this.map);
- this.depth && $a(this.ctx);
+ ab(this.map);
+ this.depth && ab(this.ctx);
return this;
};
-x.searchCache = La;
+x.searchCache = Ma;
x.export = function(a, c, b = 0, e = 0) {
let d, f;
switch(e) {
@@ -1708,56 +1734,27 @@ x.import = function(a, c) {
}
};
x.serialize = function(a = !0) {
- if (!this.reg.size) {
- return "";
- }
- let c = "", b = "";
- for (var e of this.reg.keys()) {
- b || (b = typeof e), c += (c ? "," : "") + ("string" === b ? '"' + e + '"' : e);
- }
- c = "index.reg=new Set([" + c + "]);";
- e = "";
- for (var d of this.map.entries()) {
- var f = d[0], g = d[1], k = "";
- for (let m = 0, n; m < g.length; m++) {
- n = g[m] || [""];
- var h = "";
- for (var l = 0; l < n.length; l++) {
- h += (h ? "," : "") + ("string" === b ? '"' + n[l] + '"' : n[l]);
- }
- h = "[" + h + "]";
- k += (k ? "," : "") + h;
+ let c = "", b = "", e = "";
+ if (this.reg.size) {
+ let f;
+ for (var d of this.reg.keys()) {
+ f || (f = typeof d), c += (c ? "," : "") + ("string" === f ? '"' + d + '"' : d);
}
- k = '["' + f + '",[' + k + "]]";
- e += (e ? "," : "") + k;
- }
- e = "index.map=new Map([" + e + "]);";
- d = "";
- for (const m of this.ctx.entries()) {
- f = m[0];
- g = m[1];
- for (const n of g.entries()) {
- g = n[0];
- k = n[1];
- h = "";
- for (let t = 0, p; t < k.length; t++) {
- p = k[t] || [""];
- l = "";
- for (let q = 0; q < p.length; q++) {
- l += (l ? "," : "") + ("string" === b ? '"' + p[q] + '"' : p[q]);
- }
- l = "[" + l + "]";
- h += (h ? "," : "") + l;
- }
- h = 'new Map([["' + g + '",[' + h + "]]])";
- h = '["' + f + '",' + h + "]";
- d += (d ? "," : "") + h;
+ c = "index.reg=new Set([" + c + "]);";
+ b = ua(this.map, f);
+ b = "index.map=new Map([" + b + "]);";
+ for (const g of this.ctx.entries()) {
+ d = g[0];
+ let h = ua(g[1], f);
+ h = "new Map([" + h + "])";
+ h = '["' + d + '",' + h + "]";
+ e += (e ? "," : "") + h;
}
+ e = "index.ctx=new Map([" + e + "]);";
}
- d = "index.ctx=new Map([" + d + "]);";
- return a ? "function inject(index){" + c + e + d + "}" : c + e + d;
+ return a ? "function inject(index){" + c + b + e + "}" : c + b + e;
};
ja(O.prototype);
-export default {Index:O, Charset:Ua, Encoder:K, Document:V, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
+export default {Index:O, Charset:Va, Encoder:K, Document:V, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
-export const Index=O;export const Charset=Ua;export const Encoder=K;export const Document=V;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
\ No newline at end of file
+export const Index=O;export const Charset=Va;export const Encoder=K;export const Document=V;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
\ No newline at end of file
diff --git a/dist/flexsearch.compact.module.min.js b/dist/flexsearch.compact.module.min.js
index b10d0c1..dde4ef3 100644
--- a/dist/flexsearch.compact.module.min.js
+++ b/dist/flexsearch.compact.module.min.js
@@ -1,11 +1,11 @@
/**!
- * FlexSearch.js v0.8.123 (Bundle)
+ * FlexSearch.js v0.8.132 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
-var x;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
+var x;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function I(a,c){if(D(c))a=a[c];else for(let b=0;a&&b"a1a".split(b).length;
-this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ca)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);ha||(this.mapper=new Map(ba));this.rtl=B(a.rtl,!1,this.rtl);this.dedupe=B(a.dedupe,!1,this.dedupe);this.filter=B((b=a.filter)&&new Set(b),null,this.filter);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
-B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
-(this.D?"|":"")+d;return this};x.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.D+=(this.D?"|":"")+a;this.N=null;this.cache&&L(this);return this};x.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&L(this);return this};x.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.h+=(this.h?"|":"")+a;this.M=null;this.cache&&L(this);return this};x.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&L(this);return this};
+this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ca)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);ha||(this.mapper=new Map(ba));b=a.filter;this.filter="function"===typeof b?b:B(b&&new Set(b),null,this.filter);this.dedupe=B(a.dedupe,!1,this.dedupe);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
+B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);this.rtl=B(a.rtl,!1,this.rtl);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
+(this.D?"|":"")+d;return this};x.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.D+=(this.D?"|":"")+a;this.N=null;this.cache&&L(this);return this};x.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&L(this);return this};
+x.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.h+=(this.h?"|":"")+a;this.M=null;this.cache&&L(this);return this};
+x.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&L(this);return this};
x.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ha?a.normalize("NFKD").replace(ha,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3this.stemmer.get(h)),g.lengththis.matcher.get(h)));if(g&&this.replacer)for(d=0;g&&d
-this.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ka,la,Q;function ma(){ka=Q=0}
+[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,h;fthis.stemmer.get(k)),d!==g&&this.filter&&
+g.length>=this.minlength&&("function"===typeof this.filter?!this.filter(g):this.filter.has(g))&&(g=""));if(g&&(this.mapper||this.dedupe&&1this.matcher.get(k)));if(g&&this.replacer)for(d=0;g&&dthis.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ka,la,Q;function ma(){ka=Q=0}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);ka?Q||(Q=Date.now()-la>=this.priority*this.priority*3):(ka=setTimeout(ma,0),la=Date.now());if(Q){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let R=0;
-function S(a={}){function c(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=C();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++R]=function(){h(d);1E9b||e?g.slice(e,b+e):g;else{if(ab||e)g=g.slice(e,b+e)}return g}
-function xa(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;lc?c?a.slice(b,b+c):a.slice(b):a,e?W.call(this,a):a;let d=[];for(let f=0,g,k;f=k){b-=k;continue}bc&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1a.length?this.result=a[0]:(this.result=xa(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=Aa(this,"and",arguments);return Ca.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
-function Ca(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;la.length)this.result=a[0];else{if(c=aa(a))return this.result=wa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Aa(this,"xor",arguments);return Da.call(this,a,c,b,e,d,f,g)};
-function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;la.length)this.result=a[0];else return this.result=Ea.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
-function Ea(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;hb||e?g.slice(e,b+e):g;else{if(ab||e)g=g.slice(e,b+e)}return g}
+function ya(a,c,b){const e=[],d=C();let f;var g=a.length;let h;for(let k=g-1;0<=k;k--)if(h=(g=a[k])&&g.length)for(let l=0;lc?c?a.slice(b,b+c):a.slice(b):a,e?W.call(this,a):a;let d=[];for(let f=0,g,h;f=h){b-=h;continue}bc&&(g=g.slice(0,c),h=c);if(!d.length&&h>=c)return e?W.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1a.length?this.result=a[0]:(this.result=ya(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:h,offset:k,enrich:l,resolve:m,suggest:n}=Ba(this,"and",arguments);return Da.call(this,f,g,h,k,l,m,n)}return d?this.resolve(c,b,e):this};
+function Da(a,c,b,e,d,f,g){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,m;la.length)this.result=a[0];else{if(c=aa(a))return this.result=xa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ba(this,"xor",arguments);return Ea.call(this,a,c,b,e,d,f,g)};
+function Ea(a,c,b,e,d,f,g){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,m;la.length)this.result=a[0];else return this.result=Fa.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
+function Fa(a,c,b,e,d){const f=[],g=C();let h=0;for(let k=0,l;kb||e)a=a.slice(e,e+b);d&&(a=W.call(this,a));return a}}function W(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;bb||e)a=a.slice(e,e+b);d&&(a=W.call(this,a));return a}}function W(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;bthis.limit&&this.cache.delete(this.cache.keys().next().value)};
-Y.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Ma={normalize:function(a){return a.toLowerCase()}};const Na=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Oa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Pa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Qa={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Ra=/[\x00-\x7F]+/g;const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;var Va={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Ma,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Na},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Na,matcher:Oa,replacer:Pa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Na,replacer:Pa.concat([/(?!^)[aeo]/g,""]),matcher:Oa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;bv;f--){g=q.substring(v,f);u=this.rtl?d-1-v:v;var k=this.score?this.score(c,q,p,g,u):Xa(t,e,p,d,u);
-Z(this,m,g,k,a,b)}break}case "reverse":if(1g?0:1),e,p,k-1,h-1),u=this.bidirectional&&
-q>f;Z(this,l,u?f:q,v,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Xa(a,c,b,e,d){return b&&1b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};O.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;ed.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else Za(this.map,a),this.depth&&Za(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
-function Za(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;ethis.limit&&this.cache.delete(this.cache.keys().next().value)};
+Y.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Na={normalize:function(a){return a.toLowerCase()}};const Oa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Pa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Ra={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;const Ua=/[\x00-\x7F]+/g;var Wa={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Na,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Oa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Oa,matcher:Pa,replacer:Qa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Oa,replacer:Qa.concat([/(?!^)[aeo]/g,""]),matcher:Pa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;bv;f--){g=q.substring(v,f);u=this.rtl?d-1-v:v;var h=this.score?this.score(c,q,p,g,u):Ya(t,e,p,d,u);
+Z(this,m,g,h,a,b)}break}case "reverse":if(1g?0:1),e,p,h-1,k-1),u=this.bidirectional&&
+q>f;Z(this,l,u?f:q,v,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let h=g?a.ctx:a.map,k;if(!c[b]||g&&!(k=c[b])[g])g?(c=k||(c[b]=C()),c[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[e]||(h[e]=[]),f&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function Ya(a,c,b,e,d){return b&&1b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};O.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;ed.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else $a(this.map,a),this.depth&&$a(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
+function $a(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;eb.add(a,c)):this.add(a,c)};function $a(a){let c=0;if(a.constructor===Array)for(let b=0,e;bb.add(a,c)):this.add(a,c)};function ab(a){let c=0;if(a.constructor===Array)for(let b=0,e;b c && (c = Math.max(c + e, 0)); c < e; c++) {
- var f = d[c];
- if (f === b || Object.is(f, b)) {
+ var g = d[c];
+ if (g === b || Object.is(g, b)) {
return !0;
}
}
@@ -830,8 +830,8 @@ function I(a, b, c) {
if ("undefined" !== e) {
if (c) {
if ("function" === e && d === e) {
- return function(f) {
- return a(c(f));
+ return function(g) {
+ return a(c(g));
};
}
b = a.constructor;
@@ -841,7 +841,7 @@ function I(a, b, c) {
}
if (b === Map) {
b = new Map(c);
- d = w(a);
+ d = x(a);
for (e = d.next(); !e.done; e = d.next()) {
e = e.value, b.set(e[0], e[1]);
}
@@ -849,7 +849,7 @@ function I(a, b, c) {
}
if (b === Set) {
b = new Set(c);
- d = w(a.values());
+ d = x(a.values());
for (e = d.next(); !e.done; e = d.next()) {
b.add(e.value);
}
@@ -869,12 +869,12 @@ function J() {
function K(a) {
return "string" === typeof a;
}
-function M(a) {
+function L(a) {
return "object" === typeof a;
}
function xa(a) {
var b = [];
- a = w(a.keys());
+ a = x(a.keys());
for (var c = a.next(); !c.done; c = a.next()) {
b.push(c.value);
}
@@ -910,15 +910,15 @@ function Ga(a) {
if (!this || this.constructor !== Ga) {
var b = Function.prototype.bind, c = b.apply, d = [null], e = d.concat;
if (arguments instanceof Array) {
- var f = arguments;
+ var g = arguments;
} else {
- f = w(arguments);
- for (var g, h = []; !(g = f.next()).done;) {
- h.push(g.value);
+ g = x(arguments);
+ for (var f, h = []; !(f = g.next()).done;) {
+ h.push(f.value);
}
- f = h;
+ g = h;
}
- return new (c.call(b, Ga, e.call(d, f)))();
+ return new (c.call(b, Ga, e.call(d, g)))();
}
if (arguments.length) {
for (b = 0; b < arguments.length; b++) {
@@ -947,7 +947,7 @@ u.assign = function(a) {
}
try {
this.split = new RegExp("[" + (b ? "^" : "") + d + "]+", "u");
- } catch (f) {
+ } catch (g) {
console.error("Your split configuration:", c, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
} else {
@@ -957,7 +957,7 @@ u.assign = function(a) {
} else {
try {
this.split = I(this.split, Ba);
- } catch (f) {
+ } catch (g) {
console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
this.numeric = I(a.numeric, I(this.numeric, !0));
@@ -965,15 +965,16 @@ u.assign = function(a) {
this.prepare = I(a.prepare, null, this.prepare);
this.finalize = I(a.finalize, null, this.finalize);
Fa || (this.mapper = new Map(Aa));
- this.rtl = I(a.rtl, !1, this.rtl);
+ c = a.filter;
+ this.filter = "function" === typeof c ? c : I(c && new Set(c), null, this.filter);
this.dedupe = I(a.dedupe, !1, this.dedupe);
- this.filter = I((c = a.filter) && new Set(c), null, this.filter);
this.matcher = I((c = a.matcher) && new Map(c), null, this.matcher);
this.mapper = I((c = a.mapper) && new Map(c), null, this.mapper);
this.stemmer = I((c = a.stemmer) && new Map(c), null, this.stemmer);
this.replacer = I(a.replacer, null, this.replacer);
this.minlength = I(a.minlength, 1, this.minlength);
this.maxlength = I(a.maxlength, 0, this.maxlength);
+ this.rtl = I(a.rtl, !1, this.rtl);
if (this.cache = c = I(a.cache, !0, this.cache)) {
this.D = null, this.T = "number" === typeof c ? c : 2e5, this.B = new Map(), this.C = new Map(), this.H = this.G = 128;
}
@@ -982,12 +983,12 @@ u.assign = function(a) {
this.A = "";
this.N = null;
if (this.matcher) {
- for (a = w(this.matcher.keys()), b = a.next(); !b.done; b = a.next()) {
+ for (a = x(this.matcher.keys()), b = a.next(); !b.done; b = a.next()) {
this.h += (this.h ? "|" : "") + b.value;
}
}
if (this.stemmer) {
- for (a = w(this.stemmer.keys()), b = a.next(); !b.done; b = a.next()) {
+ for (a = x(this.stemmer.keys()), b = a.next(); !b.done; b = a.next()) {
this.A += (this.A ? "|" : "") + b.value;
}
}
@@ -1002,8 +1003,7 @@ u.addStemmer = function(a, b) {
return this;
};
u.addFilter = function(a) {
- this.filter || (this.filter = new Set());
- this.filter.add(a);
+ "function" === typeof a ? this.filter = a : (this.filter || (this.filter = new Set()), this.filter.add(a));
this.cache && N(this);
return this;
};
@@ -1056,15 +1056,15 @@ u.encode = function(a) {
this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = Fa ? a.normalize("NFKD").replace(Fa, "").toLowerCase() : a.toLowerCase());
this.prepare && (a = this.prepare(a));
this.numeric && 3 < a.length && (a = a.replace(Da, "$1 $2").replace(Ea, "$1 $2").replace(Ca, "$1 "));
- for (var c = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer), d = [], e = this.split || "" === this.split ? a.split(this.split) : a, f = 0, g = void 0, h = void 0; f < e.length; f++) {
- if ((g = h = e[f]) && !(g.length < this.minlength)) {
+ for (var c = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer), d = [], e = this.split || "" === this.split ? a.split(this.split) : a, g = 0, f = void 0, h = void 0; g < e.length; g++) {
+ if ((f = h = e[g]) && !(f.length < this.minlength)) {
if (c) {
- d.push(g);
+ d.push(f);
} else {
- if (!this.filter || !this.filter.has(g)) {
- if (this.cache && g.length <= this.H) {
+ if (!this.filter || ("function" === typeof this.filter ? this.filter(f) : !this.filter.has(f))) {
+ if (this.cache && f.length <= this.H) {
if (this.D) {
- var k = this.C.get(g);
+ var k = this.C.get(f);
if (k || "" === k) {
k && d.push(k);
continue;
@@ -1073,26 +1073,26 @@ u.encode = function(a) {
this.D = setTimeout(N, 50, this);
}
}
- this.stemmer && 2 < g.length && (this.N || (this.N = new RegExp("(?!^)(" + this.A + ")$")), g = g.replace(this.N, function(q) {
+ this.stemmer && 2 < f.length && (this.N || (this.N = new RegExp("(?!^)(" + this.A + ")$")), k = f, f = f.replace(this.N, function(q) {
return b.stemmer.get(q);
- }), g.length < this.minlength || this.filter && this.filter.has(g)) && (g = "");
- if (g && (this.mapper || this.dedupe && 1 < g.length)) {
+ }), k !== f && this.filter && f.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(f) : this.filter.has(f)) && (f = ""));
+ if (f && (this.mapper || this.dedupe && 1 < f.length)) {
k = "";
- for (var l = 0, m = "", n = void 0, p = void 0; l < g.length; l++) {
- n = g.charAt(l), n === m && this.dedupe || ((p = this.mapper && this.mapper.get(n)) || "" === p ? p === m && this.dedupe || !(m = p) || (k += p) : k += m = n);
+ for (var l = 0, m = "", n = void 0, p = void 0; l < f.length; l++) {
+ n = f.charAt(l), n === m && this.dedupe || ((p = this.mapper && this.mapper.get(n)) || "" === p ? p === m && this.dedupe || !(m = p) || (k += p) : k += m = n);
}
- g = k;
+ f = k;
}
- this.matcher && 1 < g.length && (this.M || (this.M = new RegExp("(" + this.h + ")", "g")), g = g.replace(this.M, function(q) {
+ this.matcher && 1 < f.length && (this.M || (this.M = new RegExp("(" + this.h + ")", "g")), f = f.replace(this.M, function(q) {
return b.matcher.get(q);
}));
- if (g && this.replacer) {
- for (k = 0; g && k < this.replacer.length; k += 2) {
- g = g.replace(this.replacer[k], this.replacer[k + 1]);
+ if (f && this.replacer) {
+ for (k = 0; f && k < this.replacer.length; k += 2) {
+ f = f.replace(this.replacer[k], this.replacer[k + 1]);
}
}
- this.cache && h.length <= this.H && (this.C.set(h, g), this.C.size > this.T && (this.C.clear(), this.H = this.H / 1.1 | 0));
- g && d.push(g);
+ this.cache && h.length <= this.H && (this.C.set(h, f), this.C.size > this.T && (this.C.clear(), this.H = this.H / 1.1 | 0));
+ f && d.push(f);
}
}
}
@@ -1106,9 +1106,9 @@ function N(a) {
a.B.clear();
a.C.clear();
}
-;var O, P;
-function Ha(a) {
- var b, c, d, e, f, g;
+;var Ha, O;
+function Ia(a) {
+ var b, c, d, e, g, f;
return ta(function(h) {
switch(h.h) {
case 1:
@@ -1118,8 +1118,8 @@ function Ha(a) {
d = a.args;
switch(b) {
case "init":
- P = a.options || {};
- (e = a.factory) ? (Function("return " + e)()(self), O = new self.FlexSearch.Index(P), delete self.FlexSearch) : O = new S(P);
+ O = a.options || {};
+ (e = a.factory) ? (Function("return " + e)()(self), Ha = new self.FlexSearch.Index(O), delete self.FlexSearch) : Ha = new P(O);
postMessage({id:c});
break;
default:
@@ -1129,92 +1129,92 @@ function Ha(a) {
break;
case 2:
if ("export" === b) {
- if (!P.export || "function" !== typeof P.export) {
+ if (!O.export || "function" !== typeof O.export) {
throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "export".');
}
- d[1] ? (d[0] = P.export, d[2] = 0, d[3] = 1) : d = null;
+ d[1] ? (d[0] = O.export, d[2] = 0, d[3] = 1) : d = null;
}
if ("import" === b) {
- if (!P.import || "function" !== typeof P.import) {
+ if (!O.import || "function" !== typeof O.import) {
throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "import".');
}
if (!d[0]) {
h.h = 5;
break;
}
- return E(h, P.import.call(O, d[0]), 9);
+ return E(h, O.import.call(Ha, d[0]), 9);
}
- f = d && O[b].apply(O, d);
- if (!f || !f.then) {
+ g = d && Ha[b].apply(Ha, d);
+ if (!g || !g.then) {
h.h = 5;
break;
}
- return E(h, f, 7);
+ return E(h, g, 7);
case 7:
- f = h.D;
+ g = h.D;
h.h = 5;
break;
case 9:
- g = h.D, O.import(d[0], g);
+ f = h.D, Ha.import(d[0], f);
case 5:
- postMessage("search" === b ? {id:c, msg:f} : {id:c}), h.h = 0;
+ postMessage("search" === b ? {id:c, msg:g} : {id:c}), h.h = 0;
}
});
}
-;function Ia(a) {
- La.call(a, "add");
- La.call(a, "append");
- La.call(a, "search");
- La.call(a, "update");
- La.call(a, "remove");
+;function La(a) {
+ Ma.call(a, "add");
+ Ma.call(a, "append");
+ Ma.call(a, "search");
+ Ma.call(a, "update");
+ Ma.call(a, "remove");
}
-var Ma, Na, Oa;
-function Pa() {
- Ma = Oa = 0;
+var Na, Oa, Pa;
+function Qa() {
+ Na = Pa = 0;
}
-function La(a) {
+function Ma(a) {
this[a + "Async"] = function() {
var b = arguments, c = b[b.length - 1];
if ("function" === typeof c) {
var d = c;
delete b[b.length - 1];
}
- Ma ? Oa || (Oa = Date.now() - Na >= this.priority * this.priority * 3) : (Ma = setTimeout(Pa, 0), Na = Date.now());
- if (Oa) {
+ Na ? Pa || (Pa = Date.now() - Oa >= this.priority * this.priority * 3) : (Na = setTimeout(Qa, 0), Oa = Date.now());
+ if (Pa) {
var e = this;
- return new Promise(function(g) {
+ return new Promise(function(f) {
setTimeout(function() {
- g(e[a + "Async"].apply(e, b));
+ f(e[a + "Async"].apply(e, b));
}, 0);
});
}
- var f = this[a].apply(this, b);
- c = f.then ? f : new Promise(function(g) {
- return g(f);
+ var g = this[a].apply(this, b);
+ c = g.then ? g : new Promise(function(f) {
+ return f(g);
});
d && c.then(d);
return c;
};
}
-;var Qa = 0;
-function Ra(a) {
- function b(g) {
+;var Ra = 0;
+function Sa(a) {
+ function b(f) {
function h(k) {
k = k.data || k;
var l = k.id, m = l && e.h[l];
m && (m(k.msg), delete e.h[l]);
}
- this.worker = g;
+ this.worker = f;
this.h = J();
if (this.worker) {
d ? this.worker.on("message", h) : this.worker.onmessage = h;
if (a.config) {
return new Promise(function(k) {
- e.h[++Qa] = function() {
+ e.h[++Ra] = function() {
k(e);
- 1e9 < Qa && (Qa = 0);
+ 1e9 < Ra && (Ra = 0);
};
- e.worker.postMessage({id:Qa, task:"init", factory:c, options:a});
+ e.worker.postMessage({id:Ra, task:"init", factory:c, options:a});
});
}
this.worker.postMessage({task:"init", factory:c, options:a});
@@ -1223,118 +1223,138 @@ function Ra(a) {
}
}
a = void 0 === a ? {} : a;
- if (!this || this.constructor !== Ra) {
- return new Ra(a);
+ if (!this || this.constructor !== Sa) {
+ return new Sa(a);
}
var c = "undefined" !== typeof self ? self._factory : "undefined" !== typeof window ? window._factory : null;
c && (c = c.toString());
- var d = "undefined" === typeof window, e = this, f = Sa(c, d, a.worker);
- return f.then ? f.then(function(g) {
- return b.call(e, g);
- }) : b.call(this, f);
+ var d = "undefined" === typeof window, e = this, g = Ta(c, d, a.worker);
+ return g.then ? g.then(function(f) {
+ return b.call(e, f);
+ }) : b.call(this, g);
}
-T("add");
-T("append");
-T("search");
-T("update");
-T("remove");
-T("clear");
-T("export");
-T("import");
-Ia(Ra.prototype);
-function T(a) {
- Ra.prototype[a] = function() {
+S("add");
+S("append");
+S("search");
+S("update");
+S("remove");
+S("clear");
+S("export");
+S("import");
+La(Sa.prototype);
+function S(a) {
+ Sa.prototype[a] = function() {
var b = this, c = [].slice.call(arguments), d = c[c.length - 1];
if ("function" === typeof d) {
var e = d;
c.pop();
}
- d = new Promise(function(f) {
+ d = new Promise(function(g) {
"export" === a && "function" === typeof c[0] && (c[0] = null);
- b.h[++Qa] = f;
- b.worker.postMessage({task:a, id:Qa, args:c});
+ b.h[++Ra] = g;
+ b.worker.postMessage({task:a, id:Ra, args:c});
});
return e ? (d.then(e), this) : d;
};
}
-function Sa(a, b, c) {
- return b ? "undefined" !== typeof module ? new(require("worker_threads")["Worker"])(__dirname+"/node/node.js") : import("worker_threads").then(function(worker){return new worker["Worker"]((1,eval)("import.meta.dirname")+"/node/node.mjs")}) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + Ha.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof c ? c : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
+function Ta(a, b, c) {
+ return b ? "undefined" !== typeof module ? new(require("worker_threads")["Worker"])(__dirname+"/node/node.js") : import("worker_threads").then(function(worker){return new worker["Worker"]((1,eval)("import.meta.dirname")+"/node/node.mjs")}) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + Ia.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof c ? c : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"), {type:"module"});
}
-;function Ta(a, b) {
+;function Ua(a, b) {
b = void 0 === b ? 0 : b;
var c = [], d = [];
b && (b = 250000 / b * 5000 | 0);
- a = w(a.entries());
+ a = x(a.entries());
for (var e = a.next(); !e.done; e = a.next()) {
d.push(e.value), d.length === b && (c.push(d), d = []);
}
d.length && c.push(d);
return c;
}
-function Ua(a, b) {
+function Va(a, b) {
b || (b = new Map());
for (var c = 0, d; c < a.length; c++) {
d = a[c], b.set(d[0], d[1]);
}
return b;
}
-function Va(a, b) {
+function Wa(a, b) {
b = void 0 === b ? 0 : b;
var c = [], d = [];
b && (b = 250000 / b * 1000 | 0);
- a = w(a.entries());
+ a = x(a.entries());
for (var e = a.next(); !e.done; e = a.next()) {
- e = e.value, d.push([e[0], Ta(e[1])[0]]), d.length === b && (c.push(d), d = []);
+ e = e.value, d.push([e[0], Ua(e[1])[0]]), d.length === b && (c.push(d), d = []);
}
d.length && c.push(d);
return c;
}
-function Wa(a, b) {
+function Xa(a, b) {
b || (b = new Map());
for (var c = 0, d, e; c < a.length; c++) {
- d = a[c], e = b.get(d[0]), b.set(d[0], Ua(d[1], e));
+ d = a[c], e = b.get(d[0]), b.set(d[0], Va(d[1], e));
}
return b;
}
-function Xa(a) {
+function Ya(a) {
var b = [], c = [];
- a = w(a.keys());
+ a = x(a.keys());
for (var d = a.next(); !d.done; d = a.next()) {
c.push(d.value), 250000 === c.length && (b.push(c), c = []);
}
c.length && b.push(c);
return b;
}
-function Ya(a, b) {
+function Za(a, b) {
b || (b = new Set());
for (var c = 0; c < a.length; c++) {
b.add(a[c]);
}
return b;
}
-function Za(a, b, c, d, e, f, g) {
- g = void 0 === g ? 0 : g;
+function $a(a, b, c, d, e, g, f) {
+ f = void 0 === f ? 0 : f;
var h = d && d.constructor === Array, k = h ? d.shift() : d;
if (!k) {
- return this.export(a, b, e, f + 1);
+ return this.export(a, b, e, g + 1);
}
- if ((k = a((b ? b + "." : "") + (g + 1) + "." + c, JSON.stringify(k))) && k.then) {
+ if ((k = a((b ? b + "." : "") + (f + 1) + "." + c, JSON.stringify(k))) && k.then) {
var l = this;
return k.then(function() {
- return Za.call(l, a, b, c, h ? d : null, e, f, g + 1);
+ return $a.call(l, a, b, c, h ? d : null, e, g, f + 1);
});
}
- return Za.call(this, a, b, c, h ? d : null, e, f, g + 1);
+ return $a.call(this, a, b, c, h ? d : null, e, g, f + 1);
}
-;function $a(a, b, c, d) {
- for (var e = [], f = 0, g; f < a.index.length; f++) {
- if (g = a.index[f], b >= g.length) {
- b -= g.length;
+function ab(a, b) {
+ var c = "";
+ a = x(a.entries());
+ for (var d = a.next(); !d.done; d = a.next()) {
+ var e = d.value;
+ d = e[0];
+ e = e[1];
+ for (var g = "", f = 0, h; f < e.length; f++) {
+ h = e[f] || [""];
+ for (var k = "", l = 0; l < h.length; l++) {
+ k += (k ? "," : "") + ("string" === b ? '"' + h[l] + '"' : h[l]);
+ }
+ k = "[" + k + "]";
+ g += (g ? "," : "") + k;
+ }
+ g = '["' + d + '",[' + g + "]]";
+ c += (c ? "," : "") + g;
+ }
+ return c;
+}
+;function bb(a, b, c, d) {
+ for (var e = [], g = 0, f; g < a.index.length; g++) {
+ if (f = a.index[g], b >= f.length) {
+ b -= f.length;
} else {
- b = g[d ? "splice" : "slice"](b, c);
- if (g = b.length) {
- if (e = e.length ? e.concat(b) : b, c -= g, d && (a.length -= g), !c) {
+ b = f[d ? "splice" : "slice"](b, c);
+ if (f = b.length) {
+ if (e = e.length ? e.concat(b) : b, c -= f, d && (a.length -= f), !c) {
break;
}
}
@@ -1343,9 +1363,9 @@ function Za(a, b, c, d, e, f, g) {
}
return e;
}
-function ab(a) {
- if (!this) {
- return new ab(a);
+function T(a) {
+ if (!this || this.constructor !== T) {
+ return new T(a);
}
this.index = a ? [a] : [];
this.length = a ? a.length : 0;
@@ -1369,21 +1389,21 @@ function ab(a) {
}
if ("indexOf" === d) {
return function(e) {
- for (var f = 0, g = 0, h, k; g < b.index.length; g++) {
- h = b.index[g];
+ for (var g = 0, f = 0, h, k; f < b.index.length; f++) {
+ h = b.index[f];
k = h.indexOf(e);
if (0 <= k) {
- return f + k;
+ return g + k;
}
- f += h.length;
+ g += h.length;
}
return -1;
};
}
if ("includes" === d) {
return function(e) {
- for (var f = 0; f < b.index.length; f++) {
- if (b.index[f].includes(e)) {
+ for (var g = 0; g < b.index.length; g++) {
+ if (b.index[g].includes(e)) {
return !0;
}
}
@@ -1391,13 +1411,13 @@ function ab(a) {
};
}
if ("slice" === d) {
- return function(e, f) {
- return $a(b, e || 0, f || b.length, !1);
+ return function(e, g) {
+ return bb(b, e || 0, g || b.length, !1);
};
}
if ("splice" === d) {
- return function(e, f) {
- return $a(b, e || 0, f || b.length, !0);
+ return function(e, g) {
+ return bb(b, e || 0, g || b.length, !0);
};
}
if ("constructor" === d) {
@@ -1413,52 +1433,53 @@ function ab(a) {
return !0;
}});
}
-ab.prototype.clear = function() {
+T.prototype.clear = function() {
this.index.length = 0;
};
-ab.prototype.destroy = function() {
+T.prototype.destroy = function() {
this.proxy = this.index = null;
};
-ab.prototype.push = function() {
+T.prototype.push = function() {
};
function U(a) {
a = void 0 === a ? 8 : a;
- if (!this) {
+ if (!this || this.constructor !== U) {
return new U(a);
}
this.index = J();
- this.B = [];
+ this.h = [];
this.size = 0;
- 32 < a ? (this.h = bb, this.A = BigInt(a)) : (this.h = cb, this.A = a);
+ 32 < a ? (this.A = cb, this.B = BigInt(a)) : (this.A = db, this.B = a);
}
U.prototype.get = function(a) {
- var b = this.h(a);
+ var b = this.A(a);
return (b = this.index[b]) && b.get(a);
};
U.prototype.set = function(a, b) {
- var c = this.h(a), d = this.index[c];
- d ? (c = d.size, d.set(a, b), (c -= d.size) && this.size++) : (this.index[c] = d = new Map([[a, b]]), this.B.push(d));
+ var c = this.A(a), d = this.index[c];
+ d ? (c = d.size, d.set(a, b), (c -= d.size) && this.size++) : (this.index[c] = d = new Map([[a, b]]), this.h.push(d), this.size++);
};
function V(a) {
a = void 0 === a ? 8 : a;
- if (!this) {
+ if (!this || this.constructor !== V) {
return new V(a);
}
this.index = J();
this.h = [];
- 32 < a ? (this.B = bb, this.A = BigInt(a)) : (this.B = cb, this.A = a);
+ this.size = 0;
+ 32 < a ? (this.A = cb, this.B = BigInt(a)) : (this.A = db, this.B = a);
}
V.prototype.add = function(a) {
- var b = this.B(a), c = this.index[b];
- c ? (b = c.size, c.add(a), (b -= c.size) && this.size++) : (this.index[b] = c = new Set([a]), this.h.push(c));
+ var b = this.A(a), c = this.index[b];
+ c ? (b = c.size, c.add(a), (b -= c.size) && this.size++) : (this.index[b] = c = new Set([a]), this.h.push(c), this.size++);
};
u = U.prototype;
u.has = V.prototype.has = function(a) {
- var b = this.B(a);
+ var b = this.A(a);
return (b = this.index[b]) && b.has(a);
};
u.delete = V.prototype.delete = function(a) {
- var b = this.B(a);
+ var b = this.A(a);
(b = this.index[b]) && b.delete(a) && this.size--;
};
u.clear = V.prototype.clear = function() {
@@ -1466,149 +1487,149 @@ u.clear = V.prototype.clear = function() {
this.h = [];
this.size = 0;
};
-u.values = V.prototype.values = function db() {
- var b, c = this, d, e, f;
- return ra(db, function(g) {
- switch(g.h) {
+u.values = V.prototype.values = function eb() {
+ var b, c = this, d, e, g;
+ return ra(eb, function(f) {
+ switch(f.h) {
case 1:
b = 0;
case 2:
if (!(b < c.h.length)) {
- g.h = 0;
+ f.h = 0;
break;
}
- d = w(c.h[b].values());
+ d = x(c.h[b].values());
e = d.next();
case 5:
if (e.done) {
b++;
- g.h = 2;
+ f.h = 2;
break;
}
- f = e.value;
- return E(g, f, 6);
+ g = e.value;
+ return E(f, g, 6);
case 6:
- e = d.next(), g.h = 5;
+ e = d.next(), f.h = 5;
}
});
};
-u.keys = V.prototype.keys = function eb() {
- var b, c = this, d, e, f;
- return ra(eb, function(g) {
- switch(g.h) {
+u.keys = V.prototype.keys = function fb() {
+ var b, c = this, d, e, g;
+ return ra(fb, function(f) {
+ switch(f.h) {
case 1:
b = 0;
case 2:
if (!(b < c.h.length)) {
- g.h = 0;
+ f.h = 0;
break;
}
- d = w(c.h[b].keys());
+ d = x(c.h[b].keys());
e = d.next();
case 5:
if (e.done) {
b++;
- g.h = 2;
+ f.h = 2;
break;
}
- f = e.value;
- return E(g, f, 6);
+ g = e.value;
+ return E(f, g, 6);
case 6:
- e = d.next(), g.h = 5;
+ e = d.next(), f.h = 5;
}
});
};
-u.entries = V.prototype.entries = function fb() {
- var b, c = this, d, e, f;
- return ra(fb, function(g) {
- switch(g.h) {
+u.entries = V.prototype.entries = function gb() {
+ var b, c = this, d, e, g;
+ return ra(gb, function(f) {
+ switch(f.h) {
case 1:
b = 0;
case 2:
if (!(b < c.h.length)) {
- g.h = 0;
+ f.h = 0;
break;
}
- d = w(c.h[b].entries());
+ d = x(c.h[b].entries());
e = d.next();
case 5:
if (e.done) {
b++;
- g.h = 2;
+ f.h = 2;
break;
}
- f = e.value;
- return E(g, f, 6);
+ g = e.value;
+ return E(f, g, 6);
case 6:
- e = d.next(), g.h = 5;
+ e = d.next(), f.h = 5;
}
});
};
-function cb(a) {
- var b = Math.pow(2, this.A) - 1;
+function db(a) {
+ var b = Math.pow(2, this.B) - 1;
if ("number" == typeof a) {
return a & b;
}
- for (var c = 0, d = this.A + 1, e = 0; e < a.length; e++) {
+ for (var c = 0, d = this.B + 1, e = 0; e < a.length; e++) {
c = (c * d ^ a.charCodeAt(e)) & b;
}
- return 32 === this.A ? c + Math.pow(2, 31) : c;
+ return 32 === this.B ? c + Math.pow(2, 31) : c;
}
-function bb() {
+function cb() {
throw Error("The keystore is limited to 32 for EcmaScript5");
}
;W.prototype.add = function(a, b, c) {
- M(a) && (b = a, a = ya(b, this.key));
+ L(a) && (b = a, a = ya(b, this.key));
if (b && (a || 0 === a)) {
if (!c && this.reg.has(a)) {
return this.update(a, b);
}
for (var d = 0, e; d < this.field.length; d++) {
e = this.J[d];
- var f = this.index.get(this.field[d]);
+ var g = this.index.get(this.field[d]);
if ("function" === typeof e) {
- (e = e(b)) && f.add(a, e, !1, !0);
+ (e = e(b)) && g.add(a, e, !1, !0);
} else {
- var g = e.R;
- if (!g || g(b)) {
- e.constructor === String ? e = ["" + e] : K(e) && (e = [e]), gb(b, e, this.S, 0, f, a, e[0], c);
+ var f = e.R;
+ if (!f || f(b)) {
+ e.constructor === String ? e = ["" + e] : K(e) && (e = [e]), hb(b, e, this.S, 0, g, a, e[0], c);
}
}
}
if (this.tag) {
for (d = 0; d < this.L.length; d++) {
- g = this.L[d];
+ f = this.L[d];
var h = this.aa[d];
- f = this.tag.get(h);
+ g = this.tag.get(h);
e = J();
- if ("function" === typeof g) {
- if (g = g(b), !g) {
+ if ("function" === typeof f) {
+ if (f = f(b), !f) {
continue;
}
} else {
- var k = g.R;
+ var k = f.R;
if (k && !k(b)) {
continue;
}
- g.constructor === String && (g = "" + g);
- g = ya(b, g);
+ f.constructor === String && (f = "" + f);
+ f = ya(b, f);
}
- if (f && g) {
- for (K(g) && (g = [g]), h = 0, k = void 0; h < g.length; h++) {
- var l = g[h];
+ if (g && f) {
+ for (K(f) && (f = [f]), h = 0, k = void 0; h < f.length; h++) {
+ var l = f[h];
if (!e[l]) {
e[l] = 1;
var m;
- (m = f.get(l)) ? k = m : f.set(l, k = []);
+ (m = g.get(l)) ? k = m : g.set(l, k = []);
if (!c || !k.includes(a)) {
if (k.length === Math.pow(2, 31) - 1) {
- m = new ab(k);
+ m = new T(k);
if (this.fastupdate) {
- for (var n = w(this.reg.values()), p = n.next(); !p.done; p = n.next()) {
+ for (var n = x(this.reg.values()), p = n.next(); !p.done; p = n.next()) {
p = p.value, p.includes(k) && (p[p.indexOf(k)] = m);
}
}
- f.set(l, k = m);
+ g.set(l, k = m);
}
k.push(a);
this.fastupdate && ((l = this.reg.get(a)) ? l.push(k) : this.reg.set(a, [k]));
@@ -1616,7 +1637,7 @@ function bb() {
}
}
} else {
- f || console.warn("Tag '" + h + "' was not found");
+ g || console.warn("Tag '" + h + "' was not found");
}
}
}
@@ -1624,11 +1645,11 @@ function bb() {
if (this.I) {
var q = J();
for (c = 0; c < this.I.length; c++) {
- if (d = this.I[c], f = d.R, !f || f(b)) {
- f = void 0;
+ if (d = this.I[c], g = d.R, !g || g(b)) {
+ g = void 0;
if ("function" === typeof d) {
- f = d(b);
- if (!f) {
+ g = d(b);
+ if (!g) {
continue;
}
d = [d.ja];
@@ -1636,7 +1657,7 @@ function bb() {
q[d] = b[d];
continue;
}
- hb(b, q, d, 0, d[0], f);
+ ib(b, q, d, 0, d[0], g);
}
}
}
@@ -1646,88 +1667,92 @@ function bb() {
}
return this;
};
-function hb(a, b, c, d, e, f) {
+function ib(a, b, c, d, e, g) {
a = a[e];
if (d === c.length - 1) {
- b[e] = f || a;
+ b[e] = g || a;
} else if (a) {
if (a.constructor === Array) {
for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) {
- hb(a, b, c, d, e);
+ ib(a, b, c, d, e);
}
} else {
- b = b[e] || (b[e] = J()), e = c[++d], hb(a, b, c, d, e);
+ b = b[e] || (b[e] = J()), e = c[++d], ib(a, b, c, d, e);
}
}
}
-function gb(a, b, c, d, e, f, g, h) {
- if (a = a[g]) {
+function hb(a, b, c, d, e, g, f, h) {
+ if (a = a[f]) {
if (d === b.length - 1) {
if (a.constructor === Array) {
if (c[d]) {
for (b = 0; b < a.length; b++) {
- e.add(f, a[b], !0, !0);
+ e.add(g, a[b], !0, !0);
}
return;
}
a = a.join(" ");
}
- e.add(f, a, h, !0);
+ e.add(g, a, h, !0);
} else {
if (a.constructor === Array) {
- for (g = 0; g < a.length; g++) {
- gb(a, b, c, d, e, f, g, h);
+ for (f = 0; f < a.length; f++) {
+ hb(a, b, c, d, e, g, f, h);
}
} else {
- g = b[++d], gb(a, b, c, d, e, f, g, h);
+ f = b[++d], hb(a, b, c, d, e, g, f, h);
}
}
} else {
- e.db && e.remove(f);
+ e.db && e.remove(g);
}
}
-;function ib(a, b, c, d, e, f, g) {
- var h = a.length, k = [], l;
- var m = J();
- for (var n = 0, p = void 0, q; n < b; n++) {
- for (var r = 0; r < h; r++) {
- if (q = a[r], n < q.length && (p = q[n])) {
- for (var x = 0; x < p.length; x++) {
- q = p[x];
- (l = m[q]) ? m[q]++ : (l = 0, m[q] = 1);
- l = k[l] || (k[l] = []);
- if (!g) {
- var t = n + (r || !e ? 0 : f || 0);
- l = l[t] || (l[t] = []);
+;function jb(a, b, c, d, e, g, f) {
+ var h = a.length, k = [];
+ var l = J();
+ for (var m = 0, n = void 0, p, q; m < b; m++) {
+ for (var t = 0; t < h; t++) {
+ var w = a[t];
+ if (m < w.length && (n = w[m])) {
+ for (var r = 0; r < n.length; r++) {
+ p = n[r];
+ (w = l[p]) ? l[p]++ : (w = 0, l[p] = 1);
+ q = k[w] || (k[w] = []);
+ if (!f) {
+ var A = m + (t || !e ? 0 : g || 0);
+ q = q[A] || (q[A] = []);
+ }
+ q.push(p);
+ if (f && c && w === h - 1 && q.length - d === c) {
+ return q;
}
- l.push(q);
}
}
}
}
if (a = k.length) {
if (e) {
- k = 1 < k.length ? jb(k, c, d, g, f) : (k = k[0]).length > c || d ? k.slice(d, c + d) : k;
+ k = 1 < k.length ? kb(k, c, d, f, g) : (k = k[0]).length > c || d ? k.slice(d, c + d) : k;
} else {
if (a < h) {
return [];
}
k = k[a - 1];
if (c || d) {
- if (g) {
+ if (f) {
if (k.length > c || d) {
k = k.slice(d, c + d);
}
} else {
e = [];
- for (f = 0; f < k.length; f++) {
- if (g = k[f], g.length > d) {
- d -= g.length;
+ for (g = 0; g < k.length; g++) {
+ if (f = k[g], f.length > d) {
+ d -= f.length;
} else {
- if (g.length > c || d) {
- g = g.slice(d, c + d), c -= g.length, d && (d -= g.length);
+ if (f.length > c || d) {
+ f = f.slice(d, c + d), c -= f.length, d && (d -= f.length);
}
- e.push(g);
+ e.push(f);
if (!c) {
break;
}
@@ -1740,19 +1765,19 @@ function gb(a, b, c, d, e, f, g, h) {
}
return k;
}
-function jb(a, b, c, d, e) {
- var f = [], g = J(), h = a.length, k;
+function kb(a, b, c, d, e) {
+ var g = [], f = J(), h = a.length, k;
if (d) {
for (e = h - 1; 0 <= e; e--) {
if (k = (d = a[e]) && d.length) {
for (h = 0; h < k; h++) {
var l = d[h];
- if (!g[l]) {
- if (g[l] = 1, c) {
+ if (!f[l]) {
+ if (f[l] = 1, c) {
c--;
} else {
- if (f.push(l), f.length === b) {
- return f;
+ if (g.push(l), g.length === b) {
+ return g;
}
}
}
@@ -1764,15 +1789,15 @@ function jb(a, b, c, d, e) {
n = a[m];
for (var q = 0; q < n.length; q++) {
if (k = (d = n[q]) && d.length) {
- for (var r = 0; r < k; r++) {
- if (l = d[r], !g[l]) {
- if (g[l] = 1, c) {
+ for (var t = 0; t < k; t++) {
+ if (l = d[t], !f[l]) {
+ if (f[l] = 1, c) {
c--;
} else {
- var x = (q + (m < h - 1 ? e || 0 : 0)) / (m + 1) | 0;
- (f[x] || (f[x] = [])).push(l);
+ var w = (q + (m < h - 1 ? e || 0 : 0)) / (m + 1) | 0;
+ (g[w] || (g[w] = [])).push(l);
if (++p === b) {
- return f;
+ return g;
}
}
}
@@ -1781,13 +1806,13 @@ function jb(a, b, c, d, e) {
}
}
}
- return f;
+ return g;
}
-function kb(a, b, c) {
- for (var d = J(), e = [], f = 0, g; f < b.length; f++) {
- g = b[f];
- for (var h = 0; h < g.length; h++) {
- d[g[h]] = 1;
+function lb(a, b, c) {
+ for (var d = J(), e = [], g = 0, f; g < b.length; g++) {
+ f = b[g];
+ for (var h = 0; h < f.length; h++) {
+ d[f[h]] = 1;
}
}
if (c) {
@@ -1796,34 +1821,34 @@ function kb(a, b, c) {
}
} else {
for (b = 0; b < a.result.length; b++) {
- for (c = a.result[b], g = 0; g < c.length; g++) {
- f = c[g], d[f] && ((e[b] || (e[b] = [])).push(f), d[f] = 0);
+ for (c = a.result[b], f = 0; f < c.length; f++) {
+ g = c[f], d[g] && ((e[b] || (e[b] = [])).push(g), d[g] = 0);
}
}
}
return e;
}
-;function lb(a, b, c, d) {
+;function mb(a, b, c, d) {
if (!a.length) {
return a;
}
if (1 === a.length) {
return a = a[0], a = c || a.length > b ? b ? a.slice(c, c + b) : a.slice(c) : a, d ? X.call(this, a) : a;
}
- for (var e = [], f = 0, g = void 0, h = void 0; f < a.length; f++) {
- if ((g = a[f]) && (h = g.length)) {
+ for (var e = [], g = 0, f = void 0, h = void 0; g < a.length; g++) {
+ if ((f = a[g]) && (h = f.length)) {
if (c) {
if (c >= h) {
c -= h;
continue;
}
- c < h && (g = b ? g.slice(c, c + b) : g.slice(c), h = g.length, c = 0);
+ c < h && (f = b ? f.slice(c, c + b) : f.slice(c), h = f.length, c = 0);
}
- h > b && (g = g.slice(0, b), h = b);
+ h > b && (f = f.slice(0, b), h = b);
if (!e.length && h >= b) {
- return d ? X.call(this, g) : g;
+ return d ? X.call(this, f) : f;
}
- e.push(g);
+ e.push(f);
b -= h;
if (!b) {
break;
@@ -1833,7 +1858,7 @@ function kb(a, b, c) {
e = 1 < e.length ? [].concat.apply([], e) : e[0];
return d ? X.call(this, e) : e;
}
-;function mb(a, b, c) {
+;function nb(a, b, c) {
var d = c[0];
if (d.then) {
return Promise.all(c).then(function(q) {
@@ -1844,7 +1869,7 @@ function kb(a, b, c) {
return a[b].apply(a, d);
}
d = [];
- for (var e = [], f = 0, g = 0, h, k, l, m = 0, n = void 0; m < c.length; m++) {
+ for (var e = [], g = 0, f = 0, h, k, l, m = 0, n = void 0; m < c.length; m++) {
if (n = c[m]) {
var p = void 0;
if (n.constructor === Y) {
@@ -1852,7 +1877,7 @@ function kb(a, b, c) {
} else if (n.constructor === Array) {
p = n;
} else {
- if (f = n.limit || 0, g = n.offset || 0, l = n.suggest, k = n.resolve, h = n.enrich && k, n.index) {
+ if (g = n.limit || 0, f = n.offset || 0, l = n.suggest, k = n.resolve, h = n.enrich && k, n.index) {
n.resolve = !1, n.enrich = !1, p = n.index.search(n).result, n.resolve = k, n.enrich = h;
} else if (n.and) {
p = a.and(n.and);
@@ -1876,25 +1901,25 @@ function kb(a, b, c) {
}
}
}
- return {W:d, $:e, limit:f, offset:g, enrich:h, resolve:k, suggest:l};
+ return {W:d, $:e, limit:g, offset:f, enrich:h, resolve:k, suggest:l};
}
;Y.prototype.or = function() {
- var a = mb(this, "or", arguments);
- return nb.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve);
+ var a = nb(this, "or", arguments);
+ return ob.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve);
};
-function nb(a, b, c, d, e, f) {
+function ob(a, b, c, d, e, g) {
if (b.length) {
- var g = this;
+ var f = this;
return Promise.all(b).then(function(h) {
a = [];
for (var k = 0, l = void 0; k < h.length; k++) {
(l = h[k]).length && (a[k] = l);
}
- return nb.call(g, a, [], c, d, e, f);
+ return ob.call(f, a, [], c, d, e, g);
});
}
- a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = jb(a, c, d, !1, this.h), d = 0));
- return f ? this.resolve(c, d, e) : this;
+ a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = kb(a, c, d, !1, this.h), d = 0));
+ return g ? this.resolve(c, d, e) : this;
}
;Y.prototype.and = function() {
var a = this.result.length;
@@ -1905,12 +1930,12 @@ function nb(a, b, c, d, e, f) {
var c = b.resolve;
var d = b.limit;
var e = b.offset;
- var f = b.enrich && c;
+ var g = b.enrich && c;
}
}
- return a ? (a = mb(this, "and", arguments), ob.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve, a.suggest)) : c ? this.resolve(d, e, f) : this;
+ return a ? (a = nb(this, "and", arguments), pb.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve, a.suggest)) : c ? this.resolve(d, e, g) : this;
};
-function ob(a, b, c, d, e, f, g) {
+function pb(a, b, c, d, e, g, f) {
if (b.length) {
var h = this;
return Promise.all(b).then(function(k) {
@@ -1918,7 +1943,7 @@ function ob(a, b, c, d, e, f, g) {
for (var l = 0, m = void 0; l < k.length; l++) {
(m = k[l]).length && (a[l] = m);
}
- return ob.call(h, a, [], c, d, e, f, g);
+ return pb.call(h, a, [], c, d, e, g, f);
});
}
if (a.length) {
@@ -1926,20 +1951,20 @@ function ob(a, b, c, d, e, f, g) {
this.result = a[0];
} else {
if (b = za(a)) {
- return this.result = ib(a, b, c, d, g, this.h, f), f ? e ? X.call(this.index, this.result) : this.result : this;
+ return this.result = jb(a, b, c, d, f, this.h, g), g ? e ? X.call(this.index, this.result) : this.result : this;
}
this.result = [];
}
} else {
- g || (this.result = a);
+ f || (this.result = a);
}
- return f ? this.resolve(c, d, e) : this;
+ return g ? this.resolve(c, d, e) : this;
}
;Y.prototype.xor = function() {
- var a = mb(this, "xor", arguments);
- return pb.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve, a.suggest);
+ var a = nb(this, "xor", arguments);
+ return qb.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve, a.suggest);
};
-function pb(a, b, c, d, e, f, g) {
+function qb(a, b, c, d, e, g, f) {
if (b.length) {
var h = this;
return Promise.all(b).then(function(k) {
@@ -1947,28 +1972,28 @@ function pb(a, b, c, d, e, f, g) {
for (var l = 0, m = void 0; l < k.length; l++) {
(m = k[l]).length && (a[l] = m);
}
- return pb.call(h, a, [], c, d, e, f, g);
+ return qb.call(h, a, [], c, d, e, g, f);
});
}
if (a.length) {
if (this.result.length && a.unshift(this.result), 2 > a.length) {
this.result = a[0];
} else {
- return this.result = qb.call(this, a, c, d, f, this.h), f ? e ? X.call(this.index, this.result) : this.result : this;
+ return this.result = rb.call(this, a, c, d, g, this.h), g ? e ? X.call(this.index, this.result) : this.result : this;
}
} else {
- g || (this.result = a);
+ f || (this.result = a);
}
- return f ? this.resolve(c, d, e) : this;
+ return g ? this.resolve(c, d, e) : this;
}
-function qb(a, b, c, d, e) {
- for (var f = [], g = J(), h = 0, k = 0, l; k < a.length; k++) {
+function rb(a, b, c, d, e) {
+ for (var g = [], f = J(), h = 0, k = 0, l; k < a.length; k++) {
if (l = a[k]) {
h < l.length && (h = l.length);
for (var m = 0, n; m < l.length; m++) {
if (n = l[m]) {
for (var p = 0, q; p < n.length; p++) {
- q = n[p], g[q] = g[q] ? 2 : 1;
+ q = n[p], f[q] = f[q] ? 2 : 1;
}
}
}
@@ -1979,20 +2004,20 @@ function qb(a, b, c, d, e) {
if (n = a[m]) {
if (n = n[k]) {
for (p = 0; p < n.length; p++) {
- if (q = n[p], 1 === g[q]) {
+ if (q = n[p], 1 === f[q]) {
if (c) {
c--;
} else {
if (d) {
- if (f.push(q), f.length === b) {
- return f;
+ if (g.push(q), g.length === b) {
+ return g;
}
} else {
- var r = k + (m ? e : 0);
- f[r] || (f[r] = []);
- f[r].push(q);
+ var t = k + (m ? e : 0);
+ g[t] || (g[t] = []);
+ g[t].push(q);
if (++l === b) {
- return f;
+ return g;
}
}
}
@@ -2002,13 +2027,13 @@ function qb(a, b, c, d, e) {
}
}
}
- return f;
+ return g;
}
;Y.prototype.not = function() {
- var a = mb(this, "not", arguments);
- return rb.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve, a.suggest);
+ var a = nb(this, "not", arguments);
+ return sb.call(this, a.W, a.$, a.limit, a.offset, a.enrich, a.resolve, a.suggest);
};
-function rb(a, b, c, d, e, f, g) {
+function sb(a, b, c, d, e, g, f) {
if (b.length) {
var h = this;
return Promise.all(b).then(function(k) {
@@ -2016,23 +2041,23 @@ function rb(a, b, c, d, e, f, g) {
for (var l = 0, m = void 0; l < k.length; l++) {
(m = k[l]).length && (a[l] = m);
}
- return rb.call(h, a, [], c, d, e, f, g);
+ return sb.call(h, a, [], c, d, e, g, f);
});
}
if (a.length && this.result.length) {
- this.result = sb.call(this, a, c, d, f);
- } else if (f) {
+ this.result = tb.call(this, a, c, d, g);
+ } else if (g) {
return this.resolve(c, d, e);
}
- return f ? e ? X.call(this.index, this.result) : this.result : this;
+ return g ? e ? X.call(this.index, this.result) : this.result : this;
}
-function sb(a, b, c, d) {
+function tb(a, b, c, d) {
var e = [];
a = new Set(a.flat().flat());
- for (var f = 0, g, h = 0; f < this.result.length; f++) {
- if (g = this.result[f]) {
- for (var k = 0, l; k < g.length; k++) {
- if (l = g[k], !a.has(l)) {
+ for (var g = 0, f, h = 0; g < this.result.length; g++) {
+ if (f = this.result[g]) {
+ for (var k = 0, l; k < f.length; k++) {
+ if (l = f[k], !a.has(l)) {
if (c) {
c--;
} else {
@@ -2041,7 +2066,7 @@ function sb(a, b, c, d) {
return e;
}
} else {
- if (e[f] || (e[f] = []), e[f].push(l), ++h === b) {
+ if (e[g] || (e[g] = []), e[g].push(l), ++h === b) {
return e;
}
}
@@ -2099,39 +2124,38 @@ Y.prototype.boost = function(a) {
Y.prototype.resolve = function(a, b, c) {
var d = this.result, e = this.index;
this.result = this.index = null;
- return d.length ? ("object" === typeof a && (c = a.enrich, b = a.offset, a = a.limit), lb.call(e, d, a || 100, b, c)) : d;
+ return d.length ? ("object" === typeof a && (c = a.enrich, b = a.offset, a = a.limit), mb.call(e, d, a || 100, b, c)) : d;
};
J();
W.prototype.search = function(a, b, c, d) {
- c || (!b && M(a) ? (c = a, a = "") : M(b) && (c = b, b = 0));
- var e = [], f = [], g = 0, h = !0;
+ c || (!b && L(a) ? (c = a, a = "") : L(b) && (c = b, b = 0));
+ var e = [], g = [], f, h = 0, k = !0;
if (c) {
c.constructor === Array && (c = {index:c});
a = c.query || a;
- var k = c.pluck;
- var l = c.merge;
- var m = k || c.field || (m = c.index) && (m.index ? null : m);
- var n = this.tag && c.tag;
- var p = c.suggest;
- h = !1 !== c.resolve;
- if (!h && !k) {
- if (m = m || this.field) {
- K(m) ? k = m : (m.constructor === Array && 1 === m.length && (m = m[0]), k = m.field || m.index);
+ var l = c.pluck;
+ var m = c.merge;
+ var n = l || c.field || (n = c.index) && (n.index ? null : n);
+ var p = this.tag && c.tag;
+ var q = c.suggest;
+ k = !1 !== c.resolve;
+ if (!k && !l) {
+ if (n = n || this.field) {
+ K(n) ? l = n : (n.constructor === Array && 1 === n.length && (n = n[0]), l = n.field || n.index);
}
- if (!k) {
+ if (!l) {
throw Error("Apply resolver on document search requires either the option 'pluck' to be set or just select a single field name in your query.");
}
}
- this.store && c.enrich && !h && console.warn("Enrich results can only be done on a final resolver task or when calling .resolve({ enrich: true })");
- var q = this.store && c.enrich && h;
- var r = c.highlight && q;
+ this.store && c.enrich && !k && console.warn("Enrich results can only be done on a final resolver task or when calling .resolve({ enrich: true })");
+ var t = (f = this.store && c.enrich && k) && c.highlight;
b = c.limit || b;
- var x = c.offset || 0;
+ var w = c.offset || 0;
b || (b = 100);
- if (n && (!this.db || !d)) {
- n.constructor !== Array && (n = [n]);
- for (var t = [], A = 0, z = void 0; A < n.length; A++) {
- z = n[A];
+ if (p && (!this.db || !d)) {
+ p.constructor !== Array && (p = [p]);
+ for (var r = [], A = 0, z = void 0; A < p.length; A++) {
+ z = p[A];
if (K(z)) {
throw Error("A tag option can't be a string, instead it needs a { field: tag } format.");
}
@@ -2139,10 +2163,10 @@ W.prototype.search = function(a, b, c, d) {
var v = z.tag;
if (v.constructor === Array) {
for (var y = 0; y < v.length; y++) {
- t.push(z.field, v[y]);
+ r.push(z.field, v[y]);
}
} else {
- t.push(z.field, v);
+ r.push(z.field, v);
}
} else {
v = Object.keys(z);
@@ -2150,37 +2174,37 @@ W.prototype.search = function(a, b, c, d) {
for (var D = void 0, G = void 0; y < v.length; y++) {
if (D = v[y], G = z[D], G.constructor === Array) {
for (var H = 0; H < G.length; H++) {
- t.push(D, G[H]);
+ r.push(D, G[H]);
}
} else {
- t.push(D, G);
+ r.push(D, G);
}
}
}
}
- if (!t.length) {
+ if (!r.length) {
throw Error("Your tag definition within the search options is probably wrong. No valid tags found.");
}
- n = t;
+ p = r;
if (!a) {
- h = [];
- if (t.length) {
- for (f = 0; f < t.length; f += 2) {
- k = void 0;
+ k = [];
+ if (r.length) {
+ for (g = 0; g < r.length; g += 2) {
+ l = void 0;
if (this.db) {
- k = this.index.get(t[f]);
- if (!k) {
- console.warn("Tag '" + t[f] + ":" + t[f + 1] + "' will be skipped because there is no field '" + t[f] + "'.");
+ l = this.index.get(r[g]);
+ if (!l) {
+ console.warn("Tag '" + r[g] + ":" + r[g + 1] + "' will be skipped because there is no field '" + r[g] + "'.");
continue;
}
- h.push(k = k.db.tag(t[f + 1], b, x, q));
+ k.push(l = l.db.tag(r[g + 1], b, w, f));
} else {
- k = tb.call(this, t[f], t[f + 1], b, x, q);
+ l = ub.call(this, r[g], r[g + 1], b, w, f);
}
- e.push({field:t[f], tag:t[f + 1], result:k});
+ e.push({field:r[g], tag:r[g + 1], result:l});
}
}
- return h.length ? Promise.all(h).then(function(Q) {
+ return k.length ? Promise.all(k).then(function(Q) {
for (var R = 0; R < Q.length; R++) {
e[R].result = Q[R];
}
@@ -2188,191 +2212,192 @@ W.prototype.search = function(a, b, c, d) {
}) : e;
}
}
- m && m.constructor !== Array && (m = [m]);
+ n && n.constructor !== Array && (n = [n]);
}
- m || (m = this.field);
- t = !d && (this.worker || this.db) && [];
+ n || (n = this.field);
+ r = !d && (this.worker || this.db) && [];
A = 0;
- for (y = z = v = void 0; A < m.length; A++) {
- if (z = m[A], !this.db || !this.tag || this.J[A]) {
+ for (y = z = v = void 0; A < n.length; A++) {
+ if (z = n[A], !this.db || !this.tag || this.J[A]) {
v = void 0;
- K(z) || (v = z, z = v.field, a = v.query || a, b = v.limit || b, x = v.offset || x, p = v.suggest || p, q = this.store && (v.enrich || q));
+ K(z) || (v = z, z = v.field, a = v.query || a, b = v.limit || b, w = v.offset || w, q = v.suggest || q, f = this.store && (v.enrich || f));
if (d) {
v = d[A];
} else {
y = v || c;
v = this.index.get(z);
- if (n) {
+ if (p) {
if (this.db) {
- y.tag = n;
+ y.tag = p;
var Ja = v.db.support_tag_search;
- y.field = m;
+ y.field = n;
}
Ja || (y.enrich = !1);
}
- if (t) {
- t[A] = v.search(a, b, y);
- y && q && (y.enrich = q);
+ if (r) {
+ r[A] = v.search(a, b, y);
+ y && f && (y.enrich = f);
continue;
} else {
- v = v.search(a, b, y), y && q && (y.enrich = q);
+ v = v.search(a, b, y), y && f && (y.enrich = f);
}
}
- y = v && (h ? v.length : v.result.length);
- if (n && y) {
+ y = v && (k ? v.length : v.result.length);
+ if (p && y) {
D = [];
G = 0;
if (this.db && d) {
if (!Ja) {
- for (H = m.length; H < d.length; H++) {
- var L = d[H];
- if (L && L.length) {
- G++, D.push(L);
- } else if (!p) {
- return h ? e : new Y(e);
+ for (H = n.length; H < d.length; H++) {
+ var M = d[H];
+ if (M && M.length) {
+ G++, D.push(M);
+ } else if (!q) {
+ return k ? e : new Y(e);
}
}
}
} else {
H = 0;
- for (var Wb = L = void 0; H < n.length; H += 2) {
- L = this.tag.get(n[H]);
- if (!L) {
- if (console.warn("Tag '" + n[H] + ":" + n[H + 1] + "' will be skipped because there is no field '" + n[H] + "'."), p) {
+ for (var Xb = M = void 0; H < p.length; H += 2) {
+ M = this.tag.get(p[H]);
+ if (!M) {
+ if (console.warn("Tag '" + p[H] + ":" + p[H + 1] + "' will be skipped because there is no field '" + p[H] + "'."), q) {
continue;
} else {
- return h ? e : new Y(e);
+ return k ? e : new Y(e);
}
}
- if (Wb = (L = L && L.get(n[H + 1])) && L.length) {
- G++, D.push(L);
- } else if (!p) {
- return h ? e : new Y(e);
+ if (Xb = (M = M && M.get(p[H + 1])) && M.length) {
+ G++, D.push(M);
+ } else if (!q) {
+ return k ? e : new Y(e);
}
}
}
if (G) {
- v = kb(v, D, h);
+ v = lb(v, D, k);
y = v.length;
- if (!y && !p) {
- return h ? v : new Y(v);
+ if (!y && !q) {
+ return k ? v : new Y(v);
}
G--;
}
}
if (y) {
- f[g] = z, e.push(v), g++;
- } else if (1 === m.length) {
- return h ? e : new Y(e);
+ g[h] = z, e.push(v), h++;
+ } else if (1 === n.length) {
+ return k ? e : new Y(e);
}
}
}
- if (t) {
- if (this.db && n && n.length && !Ja) {
- for (q = 0; q < n.length; q += 2) {
- f = this.index.get(n[q]);
- if (!f) {
- if (console.warn("Tag '" + n[q] + ":" + n[q + 1] + "' was not found because there is no field '" + n[q] + "'."), p) {
+ if (r) {
+ if (this.db && p && p.length && !Ja) {
+ for (f = 0; f < p.length; f += 2) {
+ g = this.index.get(p[f]);
+ if (!g) {
+ if (console.warn("Tag '" + p[f] + ":" + p[f + 1] + "' was not found because there is no field '" + p[f] + "'."), q) {
continue;
} else {
- return h ? e : new Y(e);
+ return k ? e : new Y(e);
}
}
- t.push(f.db.tag(n[q + 1], b, x, !1));
+ r.push(g.db.tag(p[f + 1], b, w, !1));
}
}
- var Xb = this;
- return Promise.all(t).then(function(Q) {
- return Q.length ? Xb.search(a, b, c, Q) : Q;
+ var Yb = this;
+ return Promise.all(r).then(function(Q) {
+ return Q.length ? Yb.search(a, b, c, Q) : Q;
});
}
- if (!g) {
- return h ? e : new Y(e);
+ if (!h) {
+ return k ? e : new Y(e);
}
- if (k && (!q || !this.store)) {
+ if (l && (!f || !this.store)) {
return e[0];
}
- t = [];
- x = 0;
- for (p = void 0; x < f.length; x++) {
- p = e[x];
- q && p.length && !p[0].doc && (this.db ? t.push(p = this.index.get(this.field[0]).db.enrich(p)) : p = X.call(this, p));
- if (k) {
- return h ? p : new Y(p);
+ r = [];
+ w = 0;
+ for (q = void 0; w < g.length; w++) {
+ q = e[w];
+ f && q.length && !q[0].doc && (this.db ? r.push(q = this.index.get(this.field[0]).db.enrich(q)) : q = X.call(this, q));
+ if (l) {
+ return k ? q : new Y(q);
}
- e[x] = {field:f[x], result:p};
+ e[w] = {field:g[w], result:q};
}
- if (q && this.db && t.length) {
+ if (f && this.db && r.length) {
var Ka = this;
- return Promise.all(t).then(function(Q) {
+ return Promise.all(r).then(function(Q) {
for (var R = 0; R < Q.length; R++) {
e[R].result = Q[R];
}
- return l ? ub(e, b) : r ? vb(e, a, Ka.index, Ka.field, Ka.J, r) : e;
+ return m ? vb(e, b) : t ? wb(e, a, Ka.index, Ka.field, Ka.J, t) : e;
});
}
- return l ? ub(e, b) : r ? vb(e, a, this.index, this.field, this.J, r) : e;
+ return m ? vb(e, b) : t ? wb(e, a, this.index, this.field, this.J, t) : e;
};
-function vb(a, b, c, d, e, f) {
- for (var g, h, k, l = 0, m, n, p; l < a.length; l++) {
- for (m = a[l].result, n = a[l].field, k = c.get(n), p = k.encoder, k = k.tokenize, n = e[d.indexOf(n)], p !== g && (g = p, h = g.encode(b)), p = 0; p < m.length; p++) {
- var q = "", r = ya(m[p].doc, n), x = g.encode(r);
- r = r.split(g.split);
- for (var t = 0, A, z; t < x.length; t++) {
- A = x[t];
- z = r[t];
+function wb(a, b, c, d, e, g) {
+ console.log("template", g);
+ for (var f, h, k, l = 0, m, n, p; l < a.length; l++) {
+ for (m = a[l].result, n = a[l].field, k = c.get(n), p = k.encoder, k = k.tokenize, n = e[d.indexOf(n)], p !== f && (f = p, h = f.encode(b)), p = 0; p < m.length; p++) {
+ var q = "", t = ya(m[p].doc, n), w = f.encode(t);
+ t = t.split(f.split);
+ for (var r = 0, A, z; r < w.length; r++) {
+ A = w[r];
+ z = t[r];
for (var v = void 0, y = 0, D; y < h.length; y++) {
if (D = h[y], "strict" === k) {
if (A === D) {
- q += (q ? " " : "") + f.replace("$1", z);
+ q += (q ? " " : "") + g.replace("$1", z);
v = !0;
break;
}
} else {
var G = A.indexOf(D);
if (-1 < G) {
- q += (q ? " " : "") + z.substring(0, G) + f.replace("$1", z.substring(G, D.length)) + z.substring(G + D.length);
+ q += (q ? " " : "") + z.substring(0, G) + g.replace("$1", z.substring(G, D.length)) + z.substring(G + D.length);
v = !0;
break;
}
}
}
- v || (q += (q ? " " : "") + r[t]);
+ v || (q += (q ? " " : "") + t[r]);
}
m[p].highlight = q;
}
}
return a;
}
-function ub(a, b) {
- for (var c = [], d = J(), e = 0, f, g; e < a.length; e++) {
- f = a[e];
- g = f.result;
- for (var h = 0, k, l, m; h < g.length; h++) {
- if (l = g[h], "object" !== typeof l && (l = {id:l}), k = l.id, m = d[k]) {
- m.push(f.field);
+function vb(a, b) {
+ for (var c = [], d = J(), e = 0, g, f; e < a.length; e++) {
+ g = a[e];
+ f = g.result;
+ for (var h = 0, k, l, m; h < f.length; h++) {
+ if (l = f[h], "object" !== typeof l && (l = {id:l}), k = l.id, m = d[k]) {
+ m.push(g.field);
} else {
if (c.length === b) {
return c;
}
- l.field = d[k] = [f.field];
+ l.field = d[k] = [g.field];
c.push(l);
}
}
}
return c;
}
-function tb(a, b, c, d, e) {
- var f = this.tag.get(a);
- if (!f) {
+function ub(a, b, c, d, e) {
+ var g = this.tag.get(a);
+ if (!g) {
return console.warn("Tag '" + a + "' was not found"), [];
}
- if ((a = (f = f && f.get(b)) && f.length - d) && 0 < a) {
+ if ((a = (g = g && g.get(b)) && g.length - d) && 0 < a) {
if (a > c || d) {
- f = f.slice(d, d + c);
+ g = g.slice(d, d + c);
}
- e && (f = X.call(this, f));
- return f;
+ e && (g = X.call(this, g));
+ return g;
}
}
function X(a) {
@@ -2392,7 +2417,7 @@ function X(a) {
this.J = [];
this.field = [];
this.S = [];
- this.key = (c = b.key || b.id) && wb(c, this.S) || "id";
+ this.key = (c = b.key || b.id) && xb(c, this.S) || "id";
(d = a.keystore || 0) && (this.keystore = d);
this.fastupdate = !!a.fastupdate;
this.reg = !this.fastupdate || a.worker || a.db ? d ? new V(d) : new Set() : d ? new U(d) : new Map();
@@ -2402,7 +2427,7 @@ function X(a) {
a.cache = !1;
this.worker = a.worker;
this.priority = a.priority || 4;
- this.index = xb.call(this, a, b);
+ this.index = yb.call(this, a, b);
this.tag = null;
if (c = b.tag) {
if ("string" === typeof c && (c = [c]), c.length) {
@@ -2416,7 +2441,7 @@ function X(a) {
if (!e) {
throw Error("The tag field from the document descriptor is undefined.");
}
- d.custom ? this.L[b] = d.custom : (this.L[b] = wb(e, this.S), d.filter && ("string" === typeof this.L[b] && (this.L[b] = new String(this.L[b])), this.L[b].R = d.filter));
+ d.custom ? this.L[b] = d.custom : (this.L[b] = xb(e, this.S), d.filter && ("string" === typeof this.L[b] && (this.L[b] = new String(this.L[b])), this.L[b].R = d.filter));
this.aa[b] = e;
this.tag.set(e, new Map());
}
@@ -2425,19 +2450,19 @@ function X(a) {
if (this.worker) {
this.fastupdate = !1;
a = [];
- c = w(this.index.values());
+ c = x(this.index.values());
for (b = c.next(); !b.done; b = c.next()) {
b = b.value, b.then && a.push(b);
}
if (a.length) {
- var f = this;
- return Promise.all(a).then(function(g) {
- for (var h = 0, k = w(f.index.entries()), l = k.next(); !l.done; l = k.next()) {
+ var g = this;
+ return Promise.all(a).then(function(f) {
+ for (var h = 0, k = x(g.index.entries()), l = k.next(); !l.done; l = k.next()) {
l = l.value;
var m = l[0];
- l[1].then && f.index.set(m, g[h++]);
+ l[1].then && g.index.set(m, f[h++]);
}
- return f;
+ return g;
});
}
} else {
@@ -2454,7 +2479,7 @@ u.mount = function(a) {
for (var c = 0, d; c < this.aa.length; c++) {
d = this.aa[c];
var e;
- this.index.set(d, e = new S({}, this.reg));
+ this.index.set(d, e = new P({}, this.reg));
b === this.field && (b = b.slice(0));
b.push(d);
e.tag = this.tag.get(d);
@@ -2463,26 +2488,26 @@ u.mount = function(a) {
c = [];
d = {db:a.db, type:a.type, fastupdate:a.fastupdate};
e = 0;
- for (var f; e < b.length; e++) {
- d.field = f = b[e];
- f = this.index.get(f);
- var g = new a.constructor(a.id, d);
- g.id = a.id;
- c[e] = g.mount(f);
- f.document = !0;
- e ? f.bypass = !0 : f.store = this.store;
+ for (var g; e < b.length; e++) {
+ d.field = g = b[e];
+ g = this.index.get(g);
+ var f = new a.constructor(a.id, d);
+ f.id = a.id;
+ c[e] = f.mount(g);
+ g.document = !0;
+ e ? g.bypass = !0 : g.store = this.store;
}
this.db = !0;
return Promise.all(c);
};
u.commit = function(a, b) {
- var c = this, d, e, f, g;
+ var c = this, d, e, g, f;
return ta(function(h) {
if (1 == h.h) {
d = [];
- e = w(c.index.values());
- for (f = e.next(); !f.done; f = e.next()) {
- g = f.value, d.push(g.db.commit(g, a, b));
+ e = x(c.index.values());
+ for (g = e.next(); !g.done; g = e.next()) {
+ f = g.value, d.push(f.commit(f, a, b));
}
return E(h, Promise.all(d), 2);
}
@@ -2491,34 +2516,34 @@ u.commit = function(a, b) {
});
};
u.destroy = function() {
- for (var a = [], b = w(this.index.values()), c = b.next(); !c.done; c = b.next()) {
+ for (var a = [], b = x(this.index.values()), c = b.next(); !c.done; c = b.next()) {
a.push(c.value.destroy());
}
return Promise.all(a);
};
-function xb(a, b) {
+function yb(a, b) {
var c = new Map(), d = b.index || b.field || b;
K(d) && (d = [d]);
- for (var e = 0, f, g = void 0; e < d.length; e++) {
- f = d[e];
- K(f) || (g = f, f = f.field);
- g = M(g) ? Object.assign({}, a, g) : a;
+ for (var e = 0, g, f = void 0; e < d.length; e++) {
+ g = d[e];
+ K(g) || (f = g, g = g.field);
+ f = L(f) ? Object.assign({}, a, f) : a;
if (this.worker) {
- var h = new Ra(g);
- c.set(f, h);
+ var h = new Sa(f);
+ c.set(g, h);
}
- this.worker || c.set(f, new S(g, this.reg));
- g.custom ? this.J[e] = g.custom : (this.J[e] = wb(f, this.S), g.filter && ("string" === typeof this.J[e] && (this.J[e] = new String(this.J[e])), this.J[e].R = g.filter));
- this.field[e] = f;
+ this.worker || c.set(g, new P(f, this.reg));
+ f.custom ? this.J[e] = f.custom : (this.J[e] = xb(g, this.S), f.filter && ("string" === typeof this.J[e] && (this.J[e] = new String(this.J[e])), this.J[e].R = f.filter));
+ this.field[e] = g;
}
if (this.I) {
for (a = b.store, K(a) && (a = [a]), b = 0; b < a.length; b++) {
- d = a[b], e = d.field || d, d.custom ? (this.I[b] = d.custom, d.custom.ja = e) : (this.I[b] = wb(e, this.S), d.filter && ("string" === typeof this.I[b] && (this.I[b] = new String(this.I[b])), this.I[b].R = d.filter));
+ d = a[b], e = d.field || d, d.custom ? (this.I[b] = d.custom, d.custom.ja = e) : (this.I[b] = xb(e, this.S), d.filter && ("string" === typeof this.I[b] && (this.I[b] = new String(this.I[b])), this.I[b].R = d.filter));
}
}
return c;
}
-function wb(a, b) {
+function xb(a, b) {
for (var c = a.split(":"), d = 0, e = 0; e < c.length; e++) {
a = c[e], "]" === a[a.length - 1] && (a = a.substring(0, a.length - 2)) && (b[d] = !0), a && (c[d++] = a);
}
@@ -2532,20 +2557,20 @@ u.update = function(a, b) {
return this.remove(a).add(a, b);
};
u.remove = function(a) {
- M(a) && (a = ya(a, this.key));
- for (var b = w(this.index.values()), c = b.next(); !c.done; c = b.next()) {
+ L(a) && (a = ya(a, this.key));
+ for (var b = x(this.index.values()), c = b.next(); !c.done; c = b.next()) {
c.value.remove(a, !0);
}
if (this.reg.has(a)) {
if (this.tag && !this.fastupdate) {
- for (b = w(this.tag.values()), c = b.next(); !c.done; c = b.next()) {
+ for (b = x(this.tag.values()), c = b.next(); !c.done; c = b.next()) {
c = c.value;
- for (var d = w(c), e = d.next(); !e.done; e = d.next()) {
- var f = e.value;
- e = f[0];
- f = f[1];
- var g = f.indexOf(a);
- -1 < g && (1 < f.length ? f.splice(g, 1) : c.delete(e));
+ for (var d = x(c), e = d.next(); !e.done; e = d.next()) {
+ var g = e.value;
+ e = g[0];
+ g = g[1];
+ var f = g.indexOf(a);
+ -1 < f && (1 < g.length ? g.splice(f, 1) : c.delete(e));
}
}
}
@@ -2556,22 +2581,23 @@ u.remove = function(a) {
return this;
};
u.clear = function() {
- for (var a = w(this.index.values()), b = a.next(); !b.done; b = a.next()) {
- b.value.clear();
+ for (var a = [], b = x(this.index.values()), c = b.next(); !c.done; c = b.next()) {
+ c = c.value.clear(), c.then && a.push(c);
}
if (this.tag) {
- for (a = w(this.tag.values()), b = a.next(); !b.done; b = a.next()) {
- b.value.clear();
+ for (b = x(this.tag.values()), c = b.next(); !c.done; c = b.next()) {
+ c.value.clear();
}
}
this.store && this.store.clear();
- return this;
+ this.cache && this.cache.clear();
+ return a.length ? Promise.all(a) : this;
};
u.contain = function(a) {
return this.db ? this.index.get(this.field[0]).db.has(a) : this.reg.has(a);
};
u.cleanup = function() {
- for (var a = w(this.index.values()), b = a.next(); !b.done; b = a.next()) {
+ for (var a = x(this.index.values()), b = a.next(); !b.done; b = a.next()) {
b.value.cleanup();
}
return this;
@@ -2585,40 +2611,40 @@ u.set = function(a, b) {
this.store.set(a, b);
return this;
};
-u.searchCache = yb;
+u.searchCache = zb;
u.export = function(a, b, c, d) {
c = void 0 === c ? 0 : c;
d = void 0 === d ? 0 : d;
if (c < this.field.length) {
var e = this.field[c];
if ((b = this.index.get(e).export(a, e, c, d = 1)) && b.then) {
- var f = this;
+ var g = this;
return b.then(function() {
- return f.export(a, e, c + 1);
+ return g.export(a, e, c + 1);
});
}
return this.export(a, e, c + 1);
}
switch(d) {
case 0:
- var g = "reg";
- var h = Xa(this.reg);
+ var f = "reg";
+ var h = Ya(this.reg);
b = null;
break;
case 1:
- g = "tag";
- h = this.tag && Va(this.tag, this.reg.size);
+ f = "tag";
+ h = this.tag && Wa(this.tag, this.reg.size);
b = null;
break;
case 2:
- g = "doc";
- h = this.store && Ta(this.store);
+ f = "doc";
+ h = this.store && Ua(this.store);
b = null;
break;
default:
return;
}
- return Za.call(this, a, b, g, h, c, d);
+ return $a.call(this, a, b, f, h, c, d);
};
u.import = function(a, b) {
var c = a.split(".");
@@ -2636,13 +2662,13 @@ u.import = function(a, b) {
switch(c) {
case "reg":
this.fastupdate = !1;
- this.reg = Ya(b, this.reg);
+ this.reg = Za(b, this.reg);
for (b = 0; b < this.field.length; b++) {
d = this.index.get(this.field[b]), d.fastupdate = !1, d.reg = this.reg;
}
if (this.worker) {
b = [];
- d = w(this.index.values());
+ d = x(this.index.values());
for (c = d.next(); !c.done; c = d.next()) {
b.push(c.value.import(a));
}
@@ -2650,15 +2676,15 @@ u.import = function(a, b) {
}
break;
case "tag":
- this.tag = Wa(b, this.tag);
+ this.tag = Xa(b, this.tag);
break;
case "doc":
- this.store = Ua(b, this.store);
+ this.store = Va(b, this.store);
}
}
};
-Ia(W.prototype);
-function yb(a, b, c) {
+La(W.prototype);
+function zb(a, b, c) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new Z());
var d = this.cache.get(a);
@@ -2666,9 +2692,9 @@ function yb(a, b, c) {
d = this.search(a, b, c);
if (d.then) {
var e = this;
- d.then(function(f) {
- e.cache.set(a, f);
- return f;
+ d.then(function(g) {
+ e.cache.set(a, g);
+ return g;
});
}
this.cache.set(a, d);
@@ -2690,7 +2716,7 @@ Z.prototype.get = function(a) {
return b;
};
Z.prototype.remove = function(a) {
- for (var b = w(this.cache), c = b.next(); !c.done; c = b.next()) {
+ for (var b = x(this.cache), c = b.next(); !c.done; c = b.next()) {
c = c.value;
var d = c[0];
c[1].includes(a) && this.cache.delete(d);
@@ -2700,72 +2726,72 @@ Z.prototype.clear = function() {
this.cache.clear();
this.h = "";
};
-var zb = {normalize:function(a) {
+var Ab = {normalize:function(a) {
return a.toLowerCase();
}};
-var Ab = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
-var Bb = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Cb = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
-var Db = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
-var Eb = /[\x00-\x7F]+/g;
+var Bb = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
+var Cb = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Db = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
+var Eb = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
var Fb = /[\x00-\x7F]+/g;
var Gb = /[\x00-\x7F]+/g;
-var Hb = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:zb, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Ab}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Ab, matcher:Bb, replacer:Cb}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Ab, replacer:Cb.concat([/(?!^)[aeo]/g, ""]), matcher:Bb}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
+var Hb = /[\x00-\x7F]+/g;
+var Ib = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:Ab, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Bb}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Bb, matcher:Cb, replacer:Db}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Bb, replacer:Db.concat([/(?!^)[aeo]/g, ""]), matcher:Cb}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
for (var b = 0; b < a.length; b++) {
- for (var c = a[b], d = c.charAt(0), e = Db[d], f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = Db[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
+ for (var c = a[b], d = c.charAt(0), e = Eb[d], g = 1, f; g < c.length && (f = c.charAt(g), "h" === f || "w" === f || !(f = Eb[f]) || f === e || (d += f, e = f, 4 !== d.length)); g++) {
}
a[b] = d;
}
}}, ArabicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
- return ("" + a).replace(Eb, " ");
+ return ("" + a).replace(Fb, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
- return ("" + a).replace(Fb, "");
+ return ("" + a).replace(Gb, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
- return ("" + a).replace(Gb, " ");
+ return ("" + a).replace(Hb, " ");
}}};
-var Ib = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
-S.prototype.add = function(a, b, c, d) {
+var Jb = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
+P.prototype.add = function(a, b, c, d) {
if (b && (a || 0 === a)) {
if (!d && !c && this.reg.has(a)) {
return this.update(a, b);
}
b = this.encoder.encode(b);
if (d = b.length) {
- for (var e = J(), f = J(), g = this.depth, h = this.resolution, k = 0; k < d; k++) {
+ for (var e = J(), g = J(), f = this.depth, h = this.resolution, k = 0; k < d; k++) {
var l = b[this.rtl ? d - 1 - k : k], m = l.length;
- if (m && (g || !f[l])) {
- var n = this.score ? this.score(b, l, k, null, 0) : Jb(h, d, k), p = "";
+ if (m && (f || !g[l])) {
+ var n = this.score ? this.score(b, l, k, null, 0) : Kb(h, d, k), p = "";
switch(this.tokenize) {
case "full":
if (2 < m) {
n = 0;
for (var q; n < m; n++) {
- for (var r = m; r > n; r--) {
- p = l.substring(n, r), q = this.rtl ? m - 1 - n : n, q = this.score ? this.score(b, l, k, p, q) : Jb(h, d, k, m, q), Kb(this, f, p, q, a, c);
+ for (var t = m; t > n; t--) {
+ p = l.substring(n, t), q = this.rtl ? m - 1 - n : n, q = this.score ? this.score(b, l, k, p, q) : Kb(h, d, k, m, q), Lb(this, g, p, q, a, c);
}
}
break;
}
case "reverse":
if (1 < m) {
- for (r = m - 1; 0 < r; r--) {
- p = l[this.rtl ? m - 1 - r : r] + p, q = this.score ? this.score(b, l, k, p, r) : Jb(h, d, k, m, r), Kb(this, f, p, q, a, c);
+ for (t = m - 1; 0 < t; t--) {
+ p = l[this.rtl ? m - 1 - t : t] + p, q = this.score ? this.score(b, l, k, p, t) : Kb(h, d, k, m, t), Lb(this, g, p, q, a, c);
}
p = "";
}
case "forward":
if (1 < m) {
- for (r = 0; r < m; r++) {
- p += l[this.rtl ? m - 1 - r : r], Kb(this, f, p, n, a, c);
+ for (t = 0; t < m; t++) {
+ p += l[this.rtl ? m - 1 - t : t], Lb(this, g, p, n, a, c);
}
break;
}
default:
- if (Kb(this, f, l, n, a, c), g && 1 < d && k < d - 1) {
- for (m = J(), p = this.da, n = l, r = Math.min(g + 1, this.rtl ? k + 1 : d - k), q = m[n] = 1; q < r; q++) {
+ if (Lb(this, g, l, n, a, c), f && 1 < d && k < d - 1) {
+ for (m = J(), p = this.da, n = l, t = Math.min(f + 1, this.rtl ? k + 1 : d - k), q = m[n] = 1; q < t; q++) {
if ((l = b[this.rtl ? d - 1 - k - q : k + q]) && !m[l]) {
m[l] = 1;
- var x = this.score ? this.score(b, n, k, l, q - 1) : Jb(p + (d / 2 > p ? 0 : 1), d, k, r - 1, q - 1), t = this.bidirectional && l > n;
- Kb(this, e, t ? n : l, x, a, c, t ? l : n);
+ var w = this.score ? this.score(b, n, k, l, q - 1) : Kb(p + (d / 2 > p ? 0 : 1), d, k, t - 1, q - 1), r = this.bidirectional && l > n;
+ Lb(this, e, r ? n : l, w, a, c, r ? l : n);
}
}
}
@@ -2777,18 +2803,18 @@ S.prototype.add = function(a, b, c, d) {
b = "";
}
}
- this.db && (b || this.commit_task.push({del:a}), this.ca && Lb(this));
+ this.db && (b || this.commit_task.push({del:a}), this.ca && Mb(this));
return this;
};
-function Kb(a, b, c, d, e, f, g) {
- var h = g ? a.ctx : a.map, k;
- if (!b[c] || g && !(k = b[c])[g]) {
- if (g ? (b = k || (b[c] = J()), b[g] = 1, (k = h.get(g)) ? h = k : h.set(g, h = new Map())) : b[c] = 1, (k = h.get(c)) ? h = k : h.set(c, h = k = []), h = h[d] || (h[d] = []), !f || !h.includes(e)) {
+function Lb(a, b, c, d, e, g, f) {
+ var h = f ? a.ctx : a.map, k;
+ if (!b[c] || f && !(k = b[c])[f]) {
+ if (f ? (b = k || (b[c] = J()), b[f] = 1, (k = h.get(f)) ? h = k : h.set(f, h = new Map())) : b[c] = 1, (k = h.get(c)) ? h = k : h.set(c, h = k = []), h = h[d] || (h[d] = []), !g || !h.includes(e)) {
if (h.length === Math.pow(2, 31) - 1) {
- b = new ab(h);
+ b = new T(h);
if (a.fastupdate) {
- for (c = w(a.reg.values()), f = c.next(); !f.done; f = c.next()) {
- f = f.value, f.includes(h) && (f[f.indexOf(h)] = b);
+ for (c = x(a.reg.values()), g = c.next(); !g.done; g = c.next()) {
+ g = g.value, g.includes(h) && (g[g.indexOf(h)] = b);
}
}
k[d] = h = b;
@@ -2798,43 +2824,43 @@ function Kb(a, b, c, d, e, f, g) {
}
}
}
-function Jb(a, b, c, d, e) {
+function Kb(a, b, c, d, e) {
return c && 1 < a ? b + (d || 0) <= a ? c + (e || 0) : (a - 1) / (b + (d || 0)) * (c + (e || 0)) + 1 | 0 : 0;
}
-;S.prototype.search = function(a, b, c) {
- c || (!b && M(a) ? (c = a, a = "") : M(b) && (c = b, b = 0));
- var d = [], e = 0, f;
+;P.prototype.search = function(a, b, c) {
+ c || (!b && L(a) ? (c = a, a = "") : L(b) && (c = b, b = 0));
+ var d = [], e = 0, g;
if (c) {
a = c.query || a;
b = c.limit || b;
e = c.offset || 0;
- var g = c.context;
+ var f = c.context;
var h = c.suggest;
- var k = (f = !1 !== c.resolve) && c.enrich;
+ var k = (g = !1 !== c.resolve) && c.enrich;
var l = c.boost;
var m = c.resolution;
var n = this.db && c.tag;
} else {
- f = this.resolve;
+ g = this.resolve;
}
var p = this.encoder.encode(a);
var q = p.length;
- b = b || (f ? 100 : 0);
+ b = b || (g ? 100 : 0);
if (1 === q) {
- return Mb.call(this, p[0], "", b, e, f, k, n);
+ return Nb.call(this, p[0], "", b, e, g, k, n);
}
- g = this.depth && !1 !== g;
- if (2 === q && g && !h) {
- return Mb.call(this, p[0], p[1], b, e, f, k, n);
+ f = this.depth && !1 !== f;
+ if (2 === q && f && !h) {
+ return Nb.call(this, p[0], p[1], b, e, g, k, n);
}
- var r = J(), x = 0;
- if (1 < q && g) {
- var t = p[0];
- x = 1;
+ var t = J(), w = 0;
+ if (1 < q && f) {
+ var r = p[0];
+ w = 1;
}
- m || 0 === m || (m = t ? this.da : this.resolution);
+ m || 0 === m || (m = r ? this.da : this.resolution);
if (this.db) {
- if (this.db.search && (a = this.db.search(this, p, b, e, h, f, k, n), !1 !== a)) {
+ if (this.db.search && (a = this.db.search(this, p, b, e, h, g, k, n), !1 !== a)) {
return a;
}
var A = this;
@@ -2845,75 +2871,75 @@ function Jb(a, b, c, d, e) {
case 1:
v = z = void 0;
case 2:
- if (!(x < q)) {
+ if (!(w < q)) {
y.h = 4;
break;
}
- v = p[x];
- if (!v || r[v]) {
+ v = p[w];
+ if (!v || t[v]) {
y.h = 5;
break;
}
- r[v] = 1;
- return E(y, Nb(A, v, t, 0, 0, !1, !1), 6);
+ t[v] = 1;
+ return E(y, Ob(A, v, r, 0, 0, !1, !1), 6);
case 6:
z = y.D;
- if (z = Ob(z, d, h, m)) {
+ if (z = Pb(z, d, h, m)) {
d = z;
y.h = 4;
break;
}
- t && (h && z && d.length || (t = v));
+ r && (h && z && d.length || (r = v));
case 5:
- h && t && x === q - 1 && !d.length && (m = A.resolution, t = "", x = -1, r = J());
- x++;
+ h && r && w === q - 1 && !d.length && (m = A.resolution, r = "", w = -1, t = J());
+ w++;
y.h = 2;
break;
case 4:
- return y.return(Pb(d, m, b, e, h, l, f));
+ return y.return(Qb(d, m, b, e, h, l, g));
}
});
}();
}
- for (c = a = void 0; x < q; x++) {
- if ((c = p[x]) && !r[c]) {
- r[c] = 1;
- a = Nb(this, c, t, 0, 0, !1, !1);
- if (a = Ob(a, d, h, m)) {
+ for (c = a = void 0; w < q; w++) {
+ if ((c = p[w]) && !t[c]) {
+ t[c] = 1;
+ a = Ob(this, c, r, 0, 0, !1, !1);
+ if (a = Pb(a, d, h, m)) {
d = a;
break;
}
- t && (h && a && d.length || (t = c));
+ r && (h && a && d.length || (r = c));
}
- h && t && x === q - 1 && !d.length && (m = this.resolution, t = "", x = -1, r = J());
+ h && r && w === q - 1 && !d.length && (m = this.resolution, r = "", w = -1, t = J());
}
- return Pb(d, m, b, e, h, l, f);
+ return Qb(d, m, b, e, h, l, g);
};
-function Pb(a, b, c, d, e, f, g) {
+function Qb(a, b, c, d, e, g, f) {
var h = a.length, k = a;
if (1 < h) {
- k = ib(a, b, c, d, e, f, g);
+ k = jb(a, b, c, d, e, g, f);
} else if (1 === h) {
- return g ? lb.call(null, a[0], c, d) : new Y(a[0]);
+ return f ? mb.call(null, a[0], c, d) : new Y(a[0]);
}
- return g ? k : new Y(k);
+ return f ? k : new Y(k);
}
-function Mb(a, b, c, d, e, f, g) {
- a = Nb(this, a, b, c, d, e, f, g);
+function Nb(a, b, c, d, e, g, f) {
+ a = Ob(this, a, b, c, d, e, g, f);
return this.db ? a.then(function(h) {
return e ? h || [] : new Y(h);
- }) : a && a.length ? e ? lb.call(this, a, c, d) : new Y(a) : e ? [] : new Y();
+ }) : a && a.length ? e ? mb.call(this, a, c, d) : new Y(a) : e ? [] : new Y();
}
-function Ob(a, b, c, d) {
+function Pb(a, b, c, d) {
var e = [];
if (a && a.length) {
if (a.length <= d) {
b.push(a);
return;
}
- for (var f = 0, g; f < d; f++) {
- if (g = a[f]) {
- e[f] = g;
+ for (var g = 0, f; g < d; g++) {
+ if (f = a[g]) {
+ e[g] = f;
}
}
if (e.length) {
@@ -2925,16 +2951,16 @@ function Ob(a, b, c, d) {
return e;
}
}
-function Nb(a, b, c, d, e, f, g, h) {
+function Ob(a, b, c, d, e, g, f, h) {
var k;
c && (k = a.bidirectional && b > c) && (k = c, c = b, b = k);
if (a.db) {
- return a.db.get(b, c, d, e, f, g, h);
+ return a.db.get(b, c, d, e, g, f, h);
}
a = c ? (a = a.ctx.get(c)) && a.get(b) : a.map.get(b);
return a;
}
-;S.prototype.remove = function(a, b) {
+;P.prototype.remove = function(a, b) {
var c = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (c) {
if (this.fastupdate) {
@@ -2943,27 +2969,27 @@ function Nb(a, b, c, d, e, f, g, h) {
if (2 > e.length) {
e.pop();
} else {
- var f = e.indexOf(a);
- f === c.length - 1 ? e.pop() : e.splice(f, 1);
+ var g = e.indexOf(a);
+ g === c.length - 1 ? e.pop() : e.splice(g, 1);
}
}
}
} else {
- Qb(this.map, a), this.depth && Qb(this.ctx, a);
+ Rb(this.map, a), this.depth && Rb(this.ctx, a);
}
b || this.reg.delete(a);
}
- this.db && (this.commit_task.push({del:a}), this.ca && Lb(this));
+ this.db && (this.commit_task.push({del:a}), this.ca && Mb(this));
this.cache && this.cache.remove(a);
return this;
};
-function Qb(a, b) {
+function Rb(a, b) {
var c = 0;
if (a.constructor === Array) {
- for (var d = 0, e = void 0, f; d < a.length; d++) {
+ for (var d = 0, e = void 0, g; d < a.length; d++) {
if ((e = a[d]) && e.length) {
- if (f = e.indexOf(b), 0 <= f) {
- 1 < e.length ? (e.splice(f, 1), c++) : delete a[d];
+ if (g = e.indexOf(b), 0 <= g) {
+ 1 < e.length ? (e.splice(g, 1), c++) : delete a[d];
break;
} else {
c++;
@@ -2971,31 +2997,32 @@ function Qb(a, b) {
}
}
} else {
- for (d = w(a.entries()), e = d.next(); !e.done; e = d.next()) {
- f = e.value, e = f[0], (f = Qb(f[1], b)) ? c += f : a.delete(e);
+ for (d = x(a.entries()), e = d.next(); !e.done; e = d.next()) {
+ g = e.value, e = g[0], (g = Rb(g[1], b)) ? c += g : a.delete(e);
}
}
return c;
}
-;function S(a, b) {
- if (!this || this.constructor !== S) {
- return new S(a);
+;function P(a, b) {
+ if (!this || this.constructor !== P) {
+ return new P(a);
}
if (a) {
var c = K(a) ? a : a.preset;
- c && (Ib[c] || console.warn("Preset not found: " + c), a = Object.assign({}, Ib[c], a));
+ c && (Jb[c] || console.warn("Preset not found: " + c), a = Object.assign({}, Jb[c], a));
} else {
a = {};
}
c = a.context;
- var d = !0 === c ? {depth:1} : c || {}, e = K(a.encoder) ? Hb[a.encoder] : a.encode || a.encoder || zb;
+ var d = !0 === c ? {depth:1} : c || {}, e = K(a.encoder) ? Ib[a.encoder] : a.encode || a.encoder || Ab;
this.encoder = e.encode ? e : "object" === typeof e ? new Ga(e) : {encode:e};
this.resolution = a.resolution || 9;
- this.tokenize = (c = a.tokenize) && "default" !== c && c || "strict";
+ this.tokenize = c = (c = a.tokenize) && "default" !== c && c || "strict";
this.depth = "strict" === c && d.depth || 0;
this.bidirectional = !1 !== d.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
+ d && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
(c = a.keystore || 0) && (this.keystore = c);
this.map = c ? new U(c) : new Map();
this.ctx = c ? new U(c) : new Map();
@@ -3012,7 +3039,7 @@ function Qb(a, b) {
this.commit_timer = null;
this.priority = a.priority || 4;
}
-u = S.prototype;
+u = P.prototype;
u.mount = function(a) {
this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null);
return a.mount(this);
@@ -3025,7 +3052,7 @@ u.destroy = function() {
this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null);
return this.db.destroy();
};
-function Lb(a) {
+function Mb(a) {
a.commit_timer || (a.commit_timer = setTimeout(function() {
a.commit_timer = null;
a.db.commit(a, void 0, void 0);
@@ -3051,17 +3078,17 @@ u.update = function(a, b) {
return c.add(a, b);
}) : this.add(a, b);
};
-function Rb(a) {
+function Sb(a) {
var b = 0;
if (a.constructor === Array) {
for (var c = 0, d = void 0; c < a.length; c++) {
(d = a[c]) && (b += d.length);
}
} else {
- for (c = w(a), d = c.next(); !d.done; d = c.next()) {
+ for (c = x(a.entries()), d = c.next(); !d.done; d = c.next()) {
var e = d.value;
d = e[0];
- (e = Rb(e[1])) ? b += e : a.delete(d);
+ (e = Sb(e[1])) ? b += e : a.delete(d);
}
}
return b;
@@ -3070,109 +3097,82 @@ u.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
- Rb(this.map);
- this.depth && Rb(this.ctx);
+ Sb(this.map);
+ this.depth && Sb(this.ctx);
return this;
};
-u.searchCache = yb;
+u.searchCache = zb;
u.export = function(a, b, c, d) {
c = void 0 === c ? 0 : c;
d = void 0 === d ? 0 : d;
switch(d) {
case 0:
var e = "reg";
- var f = Xa(this.reg);
+ var g = Ya(this.reg);
break;
case 1:
e = "cfg";
- f = null;
+ g = null;
break;
case 2:
e = "map";
- f = Ta(this.map, this.reg.size);
+ g = Ua(this.map, this.reg.size);
break;
case 3:
e = "ctx";
- f = Va(this.ctx, this.reg.size);
+ g = Wa(this.ctx, this.reg.size);
break;
default:
return;
}
- return Za.call(this, a, b, e, f, c, d);
+ return $a.call(this, a, b, e, g, c, d);
};
u.import = function(a, b) {
if (b) {
switch("string" === typeof b && (b = JSON.parse(b)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), 3 === a.length && a.shift(), a = 1 < a.length ? a[1] : a[0], a) {
case "reg":
this.fastupdate = !1;
- this.reg = Ya(b, this.reg);
+ this.reg = Za(b, this.reg);
break;
case "map":
- this.map = Ua(b, this.map);
+ this.map = Va(b, this.map);
break;
case "ctx":
- this.ctx = Wa(b, this.ctx);
+ this.ctx = Xa(b, this.ctx);
}
}
};
u.serialize = function(a) {
a = void 0 === a ? !0 : a;
- if (!this.reg.size) {
- return "";
- }
- for (var b = "", c = "", d = w(this.reg.keys()), e = d.next(); !e.done; e = d.next()) {
- e = e.value, c || (c = typeof e), b += (b ? "," : "") + ("string" === c ? '"' + e + '"' : e);
- }
- b = "index.reg=new Set([" + b + "]);";
- d = "";
- e = w(this.map.entries());
- for (var f = e.next(); !f.done; f = e.next()) {
- var g = f.value;
- f = g[0];
- g = g[1];
- for (var h = "", k = 0, l; k < g.length; k++) {
- l = g[k] || [""];
- for (var m = "", n = 0; n < l.length; n++) {
- m += (m ? "," : "") + ("string" === c ? '"' + l[n] + '"' : l[n]);
- }
- m = "[" + m + "]";
- h += (h ? "," : "") + m;
+ var b = "", c = "", d = "";
+ if (this.reg.size) {
+ var e;
+ c = x(this.reg.keys());
+ for (var g = c.next(); !g.done; g = c.next()) {
+ g = g.value, e || (e = typeof g), b += (b ? "," : "") + ("string" === e ? '"' + g + '"' : g);
}
- h = '["' + f + '",[' + h + "]]";
- d += (d ? "," : "") + h;
- }
- d = "index.map=new Map([" + d + "]);";
- e = "";
- f = w(this.ctx.entries());
- for (g = f.next(); !g.done; g = f.next()) {
- for (h = g.value, g = h[0], h = w(h[1].entries()), k = h.next(); !k.done; k = h.next()) {
- l = k.value;
- k = l[0];
- l = l[1];
- m = "";
- n = 0;
- for (var p; n < l.length; n++) {
- p = l[n] || [""];
- for (var q = "", r = 0; r < p.length; r++) {
- q += (q ? "," : "") + ("string" === c ? '"' + p[r] + '"' : p[r]);
- }
- q = "[" + q + "]";
- m += (m ? "," : "") + q;
- }
- m = 'new Map([["' + k + '",[' + m + "]]])";
- m = '["' + g + '",' + m + "]";
- e += (e ? "," : "") + m;
+ b = "index.reg=new Set([" + b + "]);";
+ c = ab(this.map, e);
+ c = "index.map=new Map([" + c + "]);";
+ g = x(this.ctx.entries());
+ for (var f = g.next(); !f.done; f = g.next()) {
+ var h = f.value;
+ f = h[0];
+ h = ab(h[1], e);
+ h = "new Map([" + h + "])";
+ h = '["' + f + '",' + h + "]";
+ d += (d ? "," : "") + h;
}
+ d = "index.ctx=new Map([" + d + "]);";
}
- e = "index.ctx=new Map([" + e + "]);";
- return a ? "function inject(index){" + b + d + e + "}" : b + d + e;
+ return a ? "function inject(index){" + b + c + d + "}" : b + c + d;
};
-Ia(S.prototype);
-var Sb = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), Tb = ["map", "ctx", "tag", "reg", "cfg"];
-function Ub(a, b) {
+La(P.prototype);
+var Tb = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), Ub = ["map", "ctx", "tag", "reg", "cfg"];
+function Vb(a, b) {
b = void 0 === b ? {} : b;
if (!this) {
- return new Ub(a, b);
+ return new Vb(a, b);
}
"object" === typeof a && (b = a, a = a.name);
a || console.info("Default storage space was used, because a name was not passed.");
@@ -3183,7 +3183,7 @@ function Ub(a, b) {
this.db = null;
this.h = {};
}
-u = Ub.prototype;
+u = Vb.prototype;
u.mount = function(a) {
if (!a.encoder) {
return a.mount(this);
@@ -3195,11 +3195,11 @@ u.open = function() {
var a = this;
navigator.storage && navigator.storage.persist();
return this.db || new Promise(function(b, c) {
- var d = Sb.open(a.id + (a.field ? ":" + a.field : ""), 1);
+ var d = Tb.open(a.id + (a.field ? ":" + a.field : ""), 1);
d.onupgradeneeded = function() {
var e = a.db = this.result;
- Tb.forEach(function(f) {
- e.objectStoreNames.contains(f) || e.createObjectStore(f);
+ Ub.forEach(function(g) {
+ e.objectStoreNames.contains(g) || e.createObjectStore(g);
});
};
d.onblocked = function(e) {
@@ -3220,27 +3220,27 @@ u.open = function() {
});
};
u.close = function() {
- this.db.close();
+ this.db && this.db.close();
this.db = null;
};
u.destroy = function() {
- var a = Sb.deleteDatabase(this.id + (this.field ? ":" + this.field : ""));
- return Vb(a);
+ var a = Tb.deleteDatabase(this.id + (this.field ? ":" + this.field : ""));
+ return Wb(a);
};
u.clear = function() {
- for (var a = this.db.transaction(Tb, "readwrite"), b = 0; b < Tb.length; b++) {
- a.objectStore(Tb[b]).clear();
+ for (var a = this.db.transaction(Ub, "readwrite"), b = 0; b < Ub.length; b++) {
+ a.objectStore(Ub[b]).clear();
}
- return Vb(a);
+ return Wb(a);
};
-u.get = function(a, b, c, d, e, f) {
+u.get = function(a, b, c, d, e, g) {
c = void 0 === c ? 0 : c;
d = void 0 === d ? 0 : d;
e = void 0 === e ? !0 : e;
- f = void 0 === f ? !1 : f;
+ g = void 0 === g ? !1 : g;
a = this.db.transaction(b ? "ctx" : "map", "readonly").objectStore(b ? "ctx" : "map").get(b ? b + ":" + a : a);
- var g = this;
- return Vb(a).then(function(h) {
+ var f = this;
+ return Wb(a).then(function(h) {
var k = [];
if (!h || !h.length) {
return k;
@@ -3264,7 +3264,7 @@ u.get = function(a, b, c, d, e, f) {
}
}
}
- return f ? g.enrich(k) : k;
+ return g ? f.enrich(k) : k;
}
return h;
});
@@ -3275,32 +3275,34 @@ u.tag = function(a, b, c, d) {
d = void 0 === d ? !1 : d;
a = this.db.transaction("tag", "readonly").objectStore("tag").get(a);
var e = this;
- return Vb(a).then(function(f) {
- if (!f || !f.length || c >= f.length) {
+ return Wb(a).then(function(g) {
+ if (!g || !g.length || c >= g.length) {
return [];
}
if (!b && !c) {
- return f;
+ return g;
}
- f = f.slice(c, c + b);
- return d ? e.enrich(f) : f;
+ g = g.slice(c, c + b);
+ return d ? e.enrich(g) : g;
});
};
u.enrich = function(a) {
"object" !== typeof a && (a = [a]);
for (var b = this.db.transaction("reg", "readonly").objectStore("reg"), c = [], d = 0; d < a.length; d++) {
- c[d] = Vb(b.get(a[d]));
+ c[d] = Wb(b.get(a[d]));
}
return Promise.all(c).then(function(e) {
- for (var f = 0; f < e.length; f++) {
- e[f] = {id:a[f], doc:e[f] ? JSON.parse(e[f]) : null};
+ for (var g = 0; g < e.length; g++) {
+ e[g] = {id:a[g], doc:e[g] ? JSON.parse(e[g]) : null};
}
return e;
});
};
u.has = function(a) {
a = this.db.transaction("reg", "readonly").objectStore("reg").getKey(a);
- return Vb(a);
+ return Wb(a).then(function(b) {
+ return !!b;
+ });
};
u.search = null;
u.info = function() {
@@ -3310,17 +3312,17 @@ u.transaction = function(a, b, c) {
if (e) {
return c.call(this, e);
}
- var f = this.db.transaction(a, b);
- this.h[a + ":" + b] = e = f.objectStore(a);
- return new Promise(function(g, h) {
- f.onerror = function(l) {
- f.abort();
- f = e = null;
+ var g = this.db.transaction(a, b);
+ this.h[a + ":" + b] = e = g.objectStore(a);
+ return new Promise(function(f, h) {
+ g.onerror = function(l) {
+ g.abort();
+ g = e = null;
h(l);
};
- f.oncomplete = function(l) {
- f = e = null;
- g(l || !0);
+ g.oncomplete = function(l) {
+ g = e = null;
+ f(l || !0);
};
var k = c.call(d, e);
d.h[a + ":" + b] = null;
@@ -3328,7 +3330,7 @@ u.transaction = function(a, b, c) {
});
};
u.commit = function(a, b, c) {
- var d = this, e, f, g;
+ var d = this, e, g, f;
return ta(function(h) {
switch(h.h) {
case 1:
@@ -3337,16 +3339,16 @@ u.commit = function(a, b, c) {
}
e = a.commit_task;
a.commit_task = [];
- f = 0;
- g = void 0;
+ g = 0;
+ f = void 0;
case 4:
- if (!(f < e.length)) {
+ if (!(g < e.length)) {
h.h = 6;
break;
}
- g = e[f];
- if (!g.clear) {
- e[f] = g.ma;
+ f = e[g];
+ if (!f.clear) {
+ e[g] = f.ma;
h.h = 5;
break;
}
@@ -3356,7 +3358,7 @@ u.commit = function(a, b, c) {
h.h = 6;
break;
case 5:
- f++;
+ g++;
h.h = 4;
break;
case 6:
@@ -3378,58 +3380,58 @@ u.commit = function(a, b, c) {
a.commit_task = [];
case 3:
return a.reg.size ? E(h, d.transaction("map", "readwrite", function(k) {
- for (var l = w(a.map), m = l.next(), n = {}; !m.done; n = {O:void 0, Y:void 0}, m = l.next()) {
+ for (var l = x(a.map), m = l.next(), n = {}; !m.done; n = {O:void 0, Y:void 0}, m = l.next()) {
m = m.value, n.Y = m[0], n.O = m[1], n.O.length && (b ? k.put(n.O, n.Y) : k.get(n.Y).onsuccess = function(p) {
return function() {
- var q = this.result, r;
+ var q = this.result, t;
if (q && q.length) {
- for (var x = Math.max(q.length, p.O.length), t = 0, A; t < x; t++) {
- if ((A = p.O[t]) && A.length) {
- if ((r = q[t]) && r.length) {
+ for (var w = Math.max(q.length, p.O.length), r = 0, A; r < w; r++) {
+ if ((A = p.O[r]) && A.length) {
+ if ((t = q[r]) && t.length) {
for (var z = 0; z < A.length; z++) {
- r.push(A[z]);
+ t.push(A[z]);
}
} else {
- q[t] = A;
+ q[r] = A;
}
- r = 1;
+ t = 1;
}
}
} else {
- q = p.O, r = 1;
+ q = p.O, t = 1;
}
- r && k.put(q, p.Y);
+ t && k.put(q, p.Y);
};
}(n));
}
}), 13) : h.return();
case 13:
return E(h, d.transaction("ctx", "readwrite", function(k) {
- for (var l = w(a.ctx), m = l.next(), n = {}; !m.done; n = {V:void 0}, m = l.next()) {
+ for (var l = x(a.ctx), m = l.next(), n = {}; !m.done; n = {V:void 0}, m = l.next()) {
m = m.value;
n.V = m[0];
- m = w(m[1]);
+ m = x(m[1]);
for (var p = m.next(), q = {}; !p.done; q = {P:void 0, Z:void 0}, p = m.next()) {
- p = p.value, q.Z = p[0], q.P = p[1], q.P.length && (b ? k.put(q.P, n.V + ":" + q.Z) : k.get(n.V + ":" + q.Z).onsuccess = function(r, x) {
+ p = p.value, q.Z = p[0], q.P = p[1], q.P.length && (b ? k.put(q.P, n.V + ":" + q.Z) : k.get(n.V + ":" + q.Z).onsuccess = function(t, w) {
return function() {
- var t = this.result, A;
- if (t && t.length) {
- for (var z = Math.max(t.length, r.P.length), v = 0, y; v < z; v++) {
- if ((y = r.P[v]) && y.length) {
- if ((A = t[v]) && A.length) {
+ var r = this.result, A;
+ if (r && r.length) {
+ for (var z = Math.max(r.length, t.P.length), v = 0, y; v < z; v++) {
+ if ((y = t.P[v]) && y.length) {
+ if ((A = r[v]) && A.length) {
for (var D = 0; D < y.length; D++) {
A.push(y[D]);
}
} else {
- t[v] = y;
+ r[v] = y;
}
A = 1;
}
}
} else {
- t = r.P, A = 1;
+ r = t.P, A = 1;
}
- A && k.put(t, x.V + ":" + r.Z);
+ A && k.put(r, w.V + ":" + t.Z);
};
}(q, n));
}
@@ -3438,7 +3440,7 @@ u.commit = function(a, b, c) {
case 14:
if (a.store) {
return E(h, d.transaction("reg", "readwrite", function(k) {
- for (var l = w(a.store), m = l.next(); !m.done; m = l.next()) {
+ for (var l = x(a.store), m = l.next(); !m.done; m = l.next()) {
var n = m.value;
m = n[0];
n = n[1];
@@ -3451,7 +3453,7 @@ u.commit = function(a, b, c) {
break;
}
return E(h, d.transaction("reg", "readwrite", function(k) {
- for (var l = w(a.reg.keys()), m = l.next(); !m.done; m = l.next()) {
+ for (var l = x(a.reg.keys()), m = l.next(); !m.done; m = l.next()) {
k.put(1, m.value);
}
}), 16);
@@ -3461,7 +3463,7 @@ u.commit = function(a, b, c) {
break;
}
return E(h, d.transaction("tag", "readwrite", function(k) {
- for (var l = w(a.tag), m = l.next(), n = {}; !m.done; n = {X:void 0, ba:void 0}, m = l.next()) {
+ for (var l = x(a.tag), m = l.next(), n = {}; !m.done; n = {X:void 0, ba:void 0}, m = l.next()) {
m = m.value, n.ba = m[0], n.X = m[1], n.X.length && (k.get(n.ba).onsuccess = function(p) {
return function() {
var q = this.result;
@@ -3476,11 +3478,11 @@ u.commit = function(a, b, c) {
}
});
};
-function Yb(a, b, c) {
- for (var d = a.value, e, f, g = 0, h = 0, k; h < d.length; h++) {
+function Zb(a, b, c) {
+ for (var d = a.value, e, g, f = 0, h = 0, k; h < d.length; h++) {
if (k = c ? d : d[h]) {
for (var l = 0, m, n; l < b.length; l++) {
- if (n = b[l], m = k.indexOf(f ? parseInt(n, 10) : n), 0 > m && !f && "string" === typeof n && !isNaN(n) && (m = k.indexOf(parseInt(n, 10))) && (f = 1), 0 <= m) {
+ if (n = b[l], m = k.indexOf(g ? parseInt(n, 10) : n), 0 > m && !g && "string" === typeof n && !isNaN(n) && (m = k.indexOf(parseInt(n, 10))) && (g = 1), 0 <= m) {
if (e = 1, 1 < k.length) {
k.splice(m, 1);
} else {
@@ -3489,13 +3491,13 @@ function Yb(a, b, c) {
}
}
}
- g += k.length;
+ f += k.length;
}
if (c) {
break;
}
}
- g ? e && a.update(d) : a.delete();
+ f ? e && a.update(d) : a.delete();
a.continue();
}
u.remove = function(a) {
@@ -3503,17 +3505,17 @@ u.remove = function(a) {
return Promise.all([this.transaction("map", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
var c = this.result;
- c && Yb(c, a);
+ c && Zb(c, a);
};
}), this.transaction("ctx", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
var c = this.result;
- c && Yb(c, a);
+ c && Zb(c, a);
};
}), this.transaction("tag", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
var c = this.result;
- c && Yb(c, a, !0);
+ c && Zb(c, a, !0);
};
}), this.transaction("reg", "readwrite", function(b) {
for (var c = 0; c < a.length; c++) {
@@ -3521,7 +3523,7 @@ u.remove = function(a) {
}
})]);
};
-function Vb(a) {
+function Wb(a) {
return new Promise(function(b, c) {
a.onsuccess = function() {
b(this.result);
@@ -3533,8 +3535,8 @@ function Vb(a) {
a = null;
});
}
-;var Zb = {Index:S, Charset:Hb, Encoder:Ga, Document:W, Worker:Ra, Resolver:Y, IndexedDB:Ub, Language:{}}, $b = self, ac;
-(ac = $b.define) && ac.amd ? ac([], function() {
- return Zb;
-}) : "object" === typeof $b.exports ? $b.exports = Zb : $b.FlexSearch = Zb;
+;var $b = {Index:P, Charset:Ib, Encoder:Ga, Document:W, Worker:Sa, Resolver:Y, IndexedDB:Vb, Language:{}}, ac = self, bc;
+(bc = ac.define) && bc.amd ? bc([], function() {
+ return $b;
+}) : "object" === typeof ac.exports ? ac.exports = $b : ac.FlexSearch = $b;
}(this||self));
diff --git a/dist/flexsearch.es5.min.js b/dist/flexsearch.es5.min.js
index 42a924d..9e0748c 100644
--- a/dist/flexsearch.es5.min.js
+++ b/dist/flexsearch.es5.min.js
@@ -1,11 +1,11 @@
/**!
- * FlexSearch.js v0.8.123 (ES5)
+ * FlexSearch.js v0.8.132 (ES5)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
-(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;var u;function aa(a){var b=0;return function(){return bc&&(c=Math.max(c+e,0));c"a1a".split(c).length;
-this.numeric=H(a.numeric,e)}else{try{this.split=H(this.split,Ba)}catch(g){this.split=/\s+/}this.numeric=H(a.numeric,H(this.numeric,!0))}this.prepare=H(a.prepare,null,this.prepare);this.finalize=H(a.finalize,null,this.finalize);Fa||(this.mapper=new Map(Aa));this.rtl=H(a.rtl,!1,this.rtl);this.dedupe=H(a.dedupe,!1,this.dedupe);this.filter=H((c=a.filter)&&new Set(c),null,this.filter);this.matcher=H((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=H((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=
-H((c=a.stemmer)&&new Map(c),null,this.stemmer);this.replacer=H(a.replacer,null,this.replacer);this.minlength=H(a.minlength,1,this.minlength);this.maxlength=H(a.maxlength,0,this.maxlength);if(this.cache=c=H(a.cache,!0,this.cache))this.D=null,this.T="number"===typeof c?c:2E5,this.B=new Map,this.C=new Map,this.H=this.G=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(a=w(this.matcher.keys()),b=a.next();!b.done;b=a.next())this.h+=(this.h?"|":"")+b.value;if(this.stemmer)for(a=w(this.stemmer.keys()),
-b=a.next();!b.done;b=a.next())this.A+=(this.A?"|":"")+b.value;return this};u.addStemmer=function(a,b){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,b);this.A+=(this.A?"|":"")+a;this.N=null;this.cache&&N(this);return this};u.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&N(this);return this};
+this.numeric=H(a.numeric,e)}else{try{this.split=H(this.split,Ba)}catch(g){this.split=/\s+/}this.numeric=H(a.numeric,H(this.numeric,!0))}this.prepare=H(a.prepare,null,this.prepare);this.finalize=H(a.finalize,null,this.finalize);Fa||(this.mapper=new Map(Aa));c=a.filter;this.filter="function"===typeof c?c:H(c&&new Set(c),null,this.filter);this.dedupe=H(a.dedupe,!1,this.dedupe);this.matcher=H((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=H((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=
+H((c=a.stemmer)&&new Map(c),null,this.stemmer);this.replacer=H(a.replacer,null,this.replacer);this.minlength=H(a.minlength,1,this.minlength);this.maxlength=H(a.maxlength,0,this.maxlength);this.rtl=H(a.rtl,!1,this.rtl);if(this.cache=c=H(a.cache,!0,this.cache))this.D=null,this.T="number"===typeof c?c:2E5,this.B=new Map,this.C=new Map,this.H=this.G=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(a=x(this.matcher.keys()),b=a.next();!b.done;b=a.next())this.h+=(this.h?"|":"")+b.value;
+if(this.stemmer)for(a=x(this.stemmer.keys()),b=a.next();!b.done;b=a.next())this.A+=(this.A?"|":"")+b.value;return this};u.addStemmer=function(a,b){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,b);this.A+=(this.A?"|":"")+a;this.N=null;this.cache&&N(this);return this};u.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&N(this);return this};
u.addMapper=function(a,b){if("object"===typeof a)return this.addReplacer(a,b);if(1a.length&&(this.dedupe||this.mapper))return this.addMapper(a,b);this.matcher||(this.matcher=new Map);this.matcher.set(a,b);this.h+=(this.h?"|":"")+a;this.M=null;this.cache&&N(this);return this};
u.addReplacer=function(a,b){if("string"===typeof a)return this.addMatcher(a,b);this.replacer||(this.replacer=[]);this.replacer.push(a,b);this.cache&&N(this);return this};
u.encode=function(a){var b=this;if(this.cache&&a.length<=this.G)if(this.D){if(this.B.has(a))return this.B.get(a)}else this.D=setTimeout(N,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=Fa?a.normalize("NFKD").replace(Fa,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3this.T&&(this.C.clear(),this.H=this.H/1.1|0));f&&d.push(f)}this.finalize&&(d=this.finalize(d)||d);this.cache&&a.length<=this.G&&(this.B.set(a,d),this.B.size>this.T&&(this.B.clear(),this.G=this.G/1.1|0));return d};function N(a){a.D=null;a.B.clear();a.C.clear()};var O,Ha;
+d=[],e=this.split||""===this.split?a.split(this.split):a,g=0,f=void 0,h=void 0;g=this.minlength&&("function"===typeof this.filter?!this.filter(f):this.filter.has(f))&&(f=""));if(f&&(this.mapper||this.dedupe&&1this.T&&(this.C.clear(),this.H=this.H/1.1|0));f&&d.push(f)}this.finalize&&(d=this.finalize(d)||d);this.cache&&a.length<=this.G&&(this.B.set(a,d),this.B.size>this.T&&(this.B.clear(),this.G=this.G/1.1|0));return d};function N(a){a.D=null;a.B.clear();a.C.clear()};var O,Ha;
function Ia(a){var b,c,d,e,g,f;return ta(function(h){switch(h.h){case 1:a=a.data;b=a.task;c=a.id;d=a.args;switch(b){case "init":Ha=a.options||{};(e=a.factory)?(Function("return "+e)()(self),O=new self.FlexSearch.Index(Ha),delete self.FlexSearch):O=new R(Ha);postMessage({id:c});break;default:h.h=2;return}h.h=0;break;case 2:"export"===b&&(d[1]?(d[0]=Ha.export,d[2]=0,d[3]=1):d=null);if("import"===b){if(!d[0]){h.h=5;break}return E(h,Ha.import.call(O,d[0]),9)}g=d&&O[b].apply(O,d);if(!g||!g.then){h.h=5;
break}return E(h,g,7);case 7:g=h.D;h.h=5;break;case 9:f=h.D,O.import(d[0],f);case 5:postMessage("search"===b?{id:c,msg:g}:{id:c}),h.h=0}})};function La(a){Ma.call(a,"add");Ma.call(a,"append");Ma.call(a,"search");Ma.call(a,"update");Ma.call(a,"remove")}var Na,Oa,Pa;function Qa(){Na=Pa=0}
-function Ma(a){this[a+"Async"]=function(){var b=arguments,c=b[b.length-1];if("function"===typeof c){var d=c;delete b[b.length-1]}Na?Pa||(Pa=Date.now()-Oa>=this.priority*this.priority*3):(Na=setTimeout(Qa,0),Oa=Date.now());if(Pa){var e=this;return new Promise(function(f){setTimeout(function(){f(e[a+"Async"].apply(e,b))},0)})}var g=this[a].apply(this,b);c=g.then?g:new Promise(function(f){return f(g)});d&&c.then(d);return c}};var S=0;
-function Ra(a){function b(f){function h(k){k=k.data||k;var l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=f;this.h=J();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++S]=function(){k(e);1E9=f.length)b-=f.length;else{b=f[d?"splice":"slice"](b,c);if(f=b.length)if(e=e.length?e.concat(b):b,c-=f,d&&(a.length-=f),!c)break;b=0}return e}
-function ab(a){if(!this)return new ab(a);this.index=a?[a]:[];this.length=a?a.length:0;var b=this;return new Proxy([],{get:function(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){for(var g=0,f=0,h,k;fc||d?k.slice(d,c+d):k;else{if(ac||d)k=k.slice(d,c+d)}else{e=[];for(g=0;gd)d-=f.length;
-else{if(f.length>c||d)f=f.slice(d,c+d),c-=f.length,d&&(d-=f.length);e.push(f);if(!c)break}k=1b?b?a.slice(c,c+b):a.slice(c):a,d?X.call(this,a):a;for(var e=[],g=0,f=void 0,h=void 0;g=h){c-=h;continue}cb&&(f=f.slice(0,b),h=b);if(!e.length&&h>=b)return d?X.call(this,f):f;e.push(f);b-=h;if(!b)break}e=1a.length?this.result=a[0]:(this.result=jb(a,c,d,!1,this.h),d=0));return g?this.resolve(c,d,e):this};Y.prototype.and=function(){var a=this.result.length;if(!a){var b=arguments[0];if(b){a=!!b.suggest;var c=b.resolve;var d=b.limit;var e=b.offset;var g=b.enrich&&c}}return a?(a=mb(this,"and",arguments),ob.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)):c?this.resolve(d,e,g):this};
-function ob(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;la.length)this.result=a[0];else{if(b=za(a))return this.result=ib(a,b,c,d,f,this.h,g),g?e?X.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(c,d,e):this};Y.prototype.xor=function(){var a=mb(this,"xor",arguments);return pb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)};
-function pb(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;la.length)this.result=a[0];else return this.result=qb.call(this,a,c,d,g,this.h),g?e?X.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(c,d,e):this}
-function qb(a,b,c,d,e){for(var g=[],f=J(),h=0,k=0,l;kc||d)a=a.slice(d,d+c);e&&(a=X.call(this,a));return a}}function X(a){if(!this||!this.store)return a;for(var b=Array(a.length),c=0,d;c=this.priority*this.priority*3):(Na=setTimeout(Qa,0),Oa=Date.now());if(Pa){var e=this;return new Promise(function(f){setTimeout(function(){f(e[a+"Async"].apply(e,b))},0)})}var g=this[a].apply(this,b);c=g.then?g:new Promise(function(f){return f(g)});d&&c.then(d);return c}};var Ra=0;
+function Sa(a){function b(f){function h(k){k=k.data||k;var l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=f;this.h=J();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++Ra]=function(){k(e);1E9=f.length)b-=f.length;else{b=f[d?"splice":"slice"](b,c);if(f=b.length)if(e=e.length?e.concat(b):b,c-=f,d&&(a.length-=f),!c)break;b=0}return e}
+function T(a){if(!this||this.constructor!==T)return new T(a);this.index=a?[a]:[];this.length=a?a.length:0;var b=this;return new Proxy([],{get:function(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){for(var g=0,f=0,h,k;fc||d?k.slice(d,c+d):k;else{if(ac||d)k=k.slice(d,c+d)}else{e=[];
+for(g=0;gd)d-=f.length;else{if(f.length>c||d)f=f.slice(d,c+d),c-=f.length,d&&(d-=f.length);e.push(f);if(!c)break}k=1b?b?a.slice(c,c+b):a.slice(c):a,d?X.call(this,a):a;for(var e=[],g=0,f=void 0,h=void 0;g=h){c-=h;continue}cb&&(f=f.slice(0,b),h=b);if(!e.length&&h>=b)return d?X.call(this,f):f;e.push(f);b-=h;if(!b)break}e=1a.length?this.result=a[0]:(this.result=kb(a,c,d,!1,this.h),d=0));return g?this.resolve(c,d,e):this};Y.prototype.and=function(){var a=this.result.length;if(!a){var b=arguments[0];if(b){a=!!b.suggest;var c=b.resolve;var d=b.limit;var e=b.offset;var g=b.enrich&&c}}return a?(a=nb(this,"and",arguments),pb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)):c?this.resolve(d,e,g):this};
+function pb(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;la.length)this.result=a[0];else{if(b=za(a))return this.result=jb(a,b,c,d,f,this.h,g),g?e?X.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(c,d,e):this};Y.prototype.xor=function(){var a=nb(this,"xor",arguments);return qb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)};
+function qb(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;la.length)this.result=a[0];else return this.result=rb.call(this,a,c,d,g,this.h),g?e?X.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(c,d,e):this}
+function rb(a,b,c,d,e){for(var g=[],f=J(),h=0,k=0,l;kc||d)a=a.slice(d,d+c);e&&(a=X.call(this,a));return a}}function X(a){if(!this||!this.store)return a;for(var b=Array(a.length),c=0,d;cthis.limit&&this.cache.delete(this.cache.keys().next().value)};
-Z.prototype.get=function(a){var b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Z.prototype.remove=function(a){for(var b=w(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};Z.prototype.clear=function(){this.cache.clear();this.h=""};var zb={normalize:function(a){return a.toLowerCase()}};var Ab=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);var Bb=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Cb=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];var Db={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};var Eb=/[\x00-\x7F]+/g;var Fb=/[\x00-\x7F]+/g;var Gb=/[\x00-\x7F]+/g;var Hb={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:zb,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ab},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ab,matcher:Bb,replacer:Cb},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ab,replacer:Cb.concat([/(?!^)[aeo]/g,""]),matcher:Bb},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(var b=0;bn;r--)p=l.substring(n,r),q=this.rtl?m-1-n:n,q=this.score?this.score(b,l,k,p,q):Jb(h,d,k,m,q),Kb(this,g,p,
-q,a,c);break}case "reverse":if(1p?0:1),d,k,r-1,q-1),t=this.bidirectional&&l>n;Kb(this,
-e,t?n:l,x,a,c,t?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.ca&&Lb(this));return this};
-function Kb(a,b,c,d,e,g,f){var h=f?a.ctx:a.map,k;if(!b[c]||f&&!(k=b[c])[f])if(f?(b=k||(b[c]=J()),b[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!g||!h.includes(e)){if(h.length===Math.pow(2,31)-1){b=new ab(h);if(a.fastupdate)for(c=w(a.reg.values()),g=c.next();!g.done;g=c.next())g=g.value,g.includes(h)&&(g[g.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}
-function Jb(a,b,c,d,e){return c&&1c)&&(k=c,c=b,b=k);if(a.db)return a.db.get(b,c,d,e,g,f,h);a=c?(a=a.ctx.get(c))&&a.get(b):a.map.get(b);return a};R.prototype.remove=function(a,b){var c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(var d=0,e;de.length)e.pop();else{var g=e.indexOf(a);g===c.length-1?e.pop():e.splice(g,1)}}else Qb(this.map,a),this.depth&&Qb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.ca&&Lb(this));this.cache&&this.cache.remove(a);return this};
-function Qb(a,b){var c=0;if(a.constructor===Array)for(var d=0,e=void 0,g;dthis.limit&&this.cache.delete(this.cache.keys().next().value)};
+Z.prototype.get=function(a){var b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Z.prototype.remove=function(a){for(var b=x(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};Z.prototype.clear=function(){this.cache.clear();this.h=""};var Ab={normalize:function(a){return a.toLowerCase()}};var Bb=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);var Cb=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Db=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];var Eb={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};var Fb=/[\x00-\x7F]+/g;var Gb=/[\x00-\x7F]+/g;var Hb=/[\x00-\x7F]+/g;var Ib={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Ab,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Bb},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Bb,matcher:Cb,replacer:Db},LatinExtra:{normalize:!0,dedupe:!0,mapper:Bb,replacer:Db.concat([/(?!^)[aeo]/g,""]),matcher:Cb},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(var b=0;bn;r--)p=l.substring(n,r),q=this.rtl?m-1-n:n,q=this.score?this.score(b,l,k,p,q):Kb(h,d,k,m,q),Lb(this,g,p,
+q,a,c);break}case "reverse":if(1p?0:1),d,k,r-1,q-1),t=this.bidirectional&&l>n;Lb(this,
+e,t?n:l,w,a,c,t?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.ca&&Mb(this));return this};
+function Lb(a,b,c,d,e,g,f){var h=f?a.ctx:a.map,k;if(!b[c]||f&&!(k=b[c])[f])if(f?(b=k||(b[c]=J()),b[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!g||!h.includes(e)){if(h.length===Math.pow(2,31)-1){b=new T(h);if(a.fastupdate)for(c=x(a.reg.values()),g=c.next();!g.done;g=c.next())g=g.value,g.includes(h)&&(g[g.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}
+function Kb(a,b,c,d,e){return c&&1c)&&(k=c,c=b,b=k);if(a.db)return a.db.get(b,c,d,e,g,f,h);a=c?(a=a.ctx.get(c))&&a.get(b):a.map.get(b);return a};R.prototype.remove=function(a,b){var c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(var d=0,e;de.length)e.pop();else{var g=e.indexOf(a);g===c.length-1?e.pop():e.splice(g,1)}}else Rb(this.map,a),this.depth&&Rb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.ca&&Mb(this));this.cache&&this.cache.remove(a);return this};
+function Rb(a,b){var c=0;if(a.constructor===Array)for(var d=0,e=void 0,g;d=m.length)d-=m.length;else{for(var n=c?d+Math.min(m.length-d,c):m.length,p=d;p=g.length)return[];if(!b&&!c)return g;g=g.slice(c,c+b);return d?e.enrich(g):g})};
-u.enrich=function(a){"object"!==typeof a&&(a=[a]);for(var b=this.db.transaction("reg","readonly").objectStore("reg"),c=[],d=0;d=m.length)d-=m.length;else{for(var n=c?d+Math.min(m.length-d,c):m.length,p=d;p=g.length)return[];if(!b&&!c)return g;g=g.slice(c,c+b);return d?e.enrich(g):g})};
+u.enrich=function(a){"object"!==typeof a&&(a=[a]);for(var b=this.db.transaction("reg","readonly").objectStore("reg"),c=[],d=0;dm&&!g&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(g=1),0<=m)if(e=1,1m&&!g&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(g=1),0<=m)if(e=1,1 this.stemmer.get(k)), e.length < this.minlength || this.filter && this.filter.has(e)) && (e = "");
+ this.stemmer && 2 < e.length && (this.u || (this.u = new RegExp("(?!^)(" + this.h + ")$")), d = e, e = e.replace(this.u, k => this.stemmer.get(k)), d !== e && this.filter && e.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(e) : this.filter.has(e)) && (e = ""));
if (e && (this.mapper || this.dedupe && 1 < e.length)) {
d = "";
for (let k = 0, n = "", m, v; k < e.length; k++) {
@@ -300,12 +300,12 @@ L.prototype.add = function(a, c, b, f) {
}
c = this.encoder.encode(c);
if (f = c.length) {
- const n = w(), m = w(), v = this.depth, C = this.resolution;
+ const n = w(), m = w(), v = this.depth, D = this.resolution;
for (let p = 0; p < f; p++) {
let l = c[this.rtl ? f - 1 - p : p];
var d = l.length;
if (d && (v || !m[l])) {
- var g = this.score ? this.score(c, l, p, null, 0) : M(C, f, p), e = "";
+ var g = this.score ? this.score(c, l, p, null, 0) : M(D, f, p), e = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
@@ -313,7 +313,7 @@ L.prototype.add = function(a, c, b, f) {
for (g = d; g > q; g--) {
e = l.substring(q, g);
t = this.rtl ? d - 1 - q : q;
- var h = this.score ? this.score(c, l, p, e, t) : M(C, f, p, d, t);
+ var h = this.score ? this.score(c, l, p, e, t) : M(D, f, p, d, t);
N(this, m, e, h, a, b);
}
}
@@ -323,7 +323,7 @@ L.prototype.add = function(a, c, b, f) {
if (1 < d) {
for (h = d - 1; 0 < h; h--) {
e = l[this.rtl ? d - 1 - h : h] + e;
- var k = this.score ? this.score(c, l, p, e, h) : M(C, f, p, d, h);
+ var k = this.score ? this.score(c, l, p, e, h) : M(D, f, p, d, h);
N(this, m, e, k, a, b);
}
e = "";
@@ -399,7 +399,7 @@ function M(a, c, b, f, d) {
l = O(this, q, m);
a: {
g = l;
- var v = f, C = e, p = k;
+ var v = f, D = e, p = k;
let t = [];
if (g && g.length) {
if (g.length <= p) {
@@ -407,9 +407,9 @@ function M(a, c, b, f, d) {
l = void 0;
break a;
}
- for (let x = 0, E; x < p; x++) {
- if (E = g[x]) {
- t[x] = E;
+ for (let x = 0, A; x < p; x++) {
+ if (A = g[x]) {
+ t[x] = A;
}
}
if (t.length) {
@@ -418,7 +418,7 @@ function M(a, c, b, f, d) {
break a;
}
}
- l = C ? void 0 : t;
+ l = D ? void 0 : t;
}
if (l) {
f = l;
@@ -438,11 +438,14 @@ function M(a, c, b, f, d) {
m = a.length;
e = [];
b = w();
- for (let l = 0, q, t, x, E; l < k; l++) {
+ for (let l = 0, q, t, x, A; l < k; l++) {
for (n = 0; n < m; n++) {
if (x = a[n], l < x.length && (q = x[l])) {
for (g = 0; g < q.length; g++) {
- t = q[g], (h = b[t]) ? b[t]++ : (h = 0, b[t] = 1), E = e[h] || (e[h] = []), E.push(t);
+ if (t = q[g], (h = b[t]) ? b[t]++ : (h = 0, b[t] = 1), A = e[h] || (e[h] = []), A.push(t), c && h === m - 1 && A.length - d === c) {
+ m = A;
+ break b;
+ }
}
}
}
@@ -557,11 +560,12 @@ function P(a, c) {
const f = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || J;
this.encoder = d.encode ? d : "object" === typeof d ? new F(d) : {encode:d};
this.resolution = a.resolution || 9;
- this.tokenize = (b = a.tokenize) && "default" !== b && b || "strict";
+ this.tokenize = b = (b = a.tokenize) && "default" !== b && b || "strict";
this.depth = "strict" === b && f.depth || 0;
this.bidirectional = !1 !== f.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
+ f && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
b = !1;
this.map = new Map();
this.ctx = new Map();
@@ -595,7 +599,7 @@ function Q(a) {
(f = a[b]) && (c += f.length);
}
} else {
- for (const b of a) {
+ for (const b of a.entries()) {
const f = b[0], d = Q(b[1]);
d ? c += d : a.delete(f);
}
diff --git a/dist/flexsearch.light.min.js b/dist/flexsearch.light.min.js
index 7667e11..381122f 100644
--- a/dist/flexsearch.light.min.js
+++ b/dist/flexsearch.light.min.js
@@ -1,27 +1,28 @@
/**!
- * FlexSearch.js v0.8.123 (Light)
+ * FlexSearch.js v0.8.132 (Light)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
-(function(self){'use strict';var r;function u(a,c,b){const f=typeof b,d=typeof a;if("undefined"!==f){if("undefined"!==d){if(b){if("function"===d&&f===d)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var e of a)g.set(e[0],e[1]);return g}if(c===Set){e=new Set(b);for(g of a.values())e.add(g);return e}}}return a}return b}return"undefined"===d?c:a}function w(){return Object.create(null)};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,A=/(\D)(\d{3})/g,B=/(\d{3})(\D)/g,D="".normalize&&/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a"a1a".split(b).length;
-this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,y)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);this.rtl=u(a.rtl,!1,this.rtl);this.dedupe=u(a.dedupe,!1,this.dedupe);this.filter=u((b=a.filter)&&new Set(b),null,this.filter);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
-null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,0,this.maxlength);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.g+=(this.g?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.h+=(this.h?"|":"")+d;return this};
-r.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&G(this);return this};r.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.g+=(this.g?"|":"")+a;this.s=null;this.cache&&G(this);return this};r.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&G(this);return this};
-r.encode=function(a){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=D?a.normalize("NFKD").replace(D,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3this.stemmer.get(k)),e.lengththis.matcher.get(k)));if(e&&this.replacer)for(d=0;e&&dthis.A&&
-(this.j.clear(),this.o=this.o/1.1|0));e&&b.push(e)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.m&&(this.i.set(a,b),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return b};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let f=[];for(let d=0,g,e;d=e){b-=e;continue}bc&&(g=g.slice(0,c),e=c);if(!f.length&&e>=c)return g;f.push(g);c-=e;if(!c)break}return f=1this.limit&&this.cache.delete(this.cache.keys().next().value)};I.prototype.get=function(a){const c=this.cache.get(a);c&&this.g!==a&&(this.cache.delete(a),this.cache.set(this.g=a,c));return c};I.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
-I.prototype.clear=function(){this.cache.clear();this.g=""};const J={normalize:function(a){return a.toLowerCase()}};const K={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};L.prototype.add=function(a,c,b,f){if(c&&(a||0===a)){if(!f&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(f=c.length){const n=w(),m=w(),v=this.depth,C=this.resolution;for(let p=0;pq;g--){e=l.substring(q,g);t=this.rtl?d-1-q:q;var h=this.score?this.score(c,l,p,e,t):M(C,f,p,d,t);N(this,
-m,e,h,a,b)}break}case "reverse":if(1e?0:1),f,p,h-1,k-1),t=this.bidirectional&&
+this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,y)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!1,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
+null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,0,this.maxlength);this.rtl=u(a.rtl,!1,this.rtl);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.g+=(this.g?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.h+=
+(this.h?"|":"")+d;return this};r.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&G(this);return this};
+r.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.g+=(this.g?"|":"")+a;this.s=null;this.cache&&G(this);return this};
+r.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&G(this);return this};
+r.encode=function(a){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3this.stemmer.get(k)),d!==e&&this.filter&&
+e.length>=this.minlength&&("function"===typeof this.filter?!this.filter(e):this.filter.has(e))&&(e=""));if(e&&(this.mapper||this.dedupe&&1this.matcher.get(k)));if(e&&this.replacer)for(d=0;e&&dthis.A&&(this.j.clear(),this.o=this.o/1.1|0));e&&b.push(e)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.m&&(this.i.set(a,b),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return b};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let f=[];for(let d=0,g,e;d=e){b-=e;continue}bc&&(g=g.slice(0,c),e=c);if(!f.length&&e>=c)return g;f.push(g);c-=e;if(!c)break}return f=1