1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-25 21:08:59 +02:00

worker index basic support export/import

This commit is contained in:
Thomas Wilkerling
2025-03-20 09:42:26 +01:00
parent b0311432fd
commit b2c79cfd0e
45 changed files with 3059 additions and 2281 deletions

View File

@@ -679,6 +679,7 @@ The `worker` inherits from type `Index` and does not inherit from type `Document
- [basic-resolver](example/nodejs-commonjs/basic-resolver)
- [basic-worker](example/nodejs-commonjs/basic-worker)
- [basic-worker-extern-config](example/nodejs-commonjs/basic-worker-extern-config)
- [basic-worker-export-import](example/nodejs-commonjs/basic-worker-export-import)
- [basic-export-import](example/nodejs-commonjs/basic-export-import)
- [document](example/nodejs-commonjs/document)
- [document-persistent](example/nodejs-commonjs/document-persistent)
@@ -693,6 +694,7 @@ The `worker` inherits from type `Index` and does not inherit from type `Document
- [basic-resolver](example/nodejs-esm/basic-resolver)
- [basic-worker](example/nodejs-esm/basic-worker)
- [basic-worker-extern-config](example/nodejs-esm/basic-worker-extern-config)
- [basic-worker-export-import](example/nodejs-esm/basic-worker-export-import)
- [basic-export-import](example/nodejs-esm/basic-export-import)
- [document](example/nodejs-esm/document)
- [document-persistent](example/nodejs-esm/document-persistent)

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.107 (Bundle)
* FlexSearch.js v0.8.108 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -21,72 +21,72 @@ t.addMatcher=function(a,b){if("object"===typeof a)return this.addReplacer(a,b);i
t.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.B.has(a))return this.B.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ja?a.normalize("NFKD").replace(ja,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let c=
[],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))if(b)c.push(g);else if(!this.filter||!this.filter.has(g)){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&c.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),g=g.replace(this.N,h=>this.stemmer.get(h)),g.length<this.minlength||this.filter&&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);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)));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.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 L(a){a.H=null;a.B.clear();a.G.clear()};async function ka(a){a=a.data;var b=self._index;const c=a.args;var e=a.task;switch(e){case "init":e=a.options||{};(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new M(e);postMessage({id:a.id});break;default:a=a.id,b=b[e].apply(b,c),postMessage("search"===e?{id:a,msg:b}:{id:a})}};let la=0;
function N(a={}){function b(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=B();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++la]=function(){h(d)};d.worker.postMessage({id:la,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this||this.constructor!==N)return new N(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=ma(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}O("add");O("append");O("search");O("update");O("remove");
function O(a){N.prototype[a]=N.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.splice(c.length-1,1));e=new Promise(function(f){b.h[++la]=f;b.worker.postMessage({task:a,id:la,args:c})});return d?(e.then(d),this):e}}
function ma(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="+ka.toString()],{type:"text/javascript"}))):new window.Worker(E(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 na(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let Q,oa;const pa={},R={};function qa(a){Q=0;pa[a]=R[a]}
function P(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]);Q||(Q=setTimeout(qa,0,a),oa=Date.now());R[a]||(R[a]=pa[a]=1E3);if(!--pa[a]){pa[a]=R[a]=R[a]*this.priority*this.priority*3/(Date.now()-oa)|0||1;Q=clearTimeout(Q);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}};function ra(a,b=0){let c=[],e=[];b&&(b=25E4/b*5E3|0);for(const d of a.entries())e.push(d),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}function sa(a,b){b||(b=new Map);for(let c=0,e;c<a.length;c++)e=a[c],b.set(e[0],e[1]);return b}function ta(a,b=0){let c=[],e=[];b&&(b=25E4/b*1E3|0);for(const d of a.entries())e.push([d[0],ra(d[1])[0]]),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}
function ua(a,b){b||(b=new Map);for(let c=0,e,d;c<a.length;c++)e=a[c],d=b.get(e[0]),b.set(e[0],sa(e[1],d));return b}function va(a){let b=[],c=[];for(const e of a.keys())c.push(e),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}function wa(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}
function xa(a,b,c,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,b,d,f+1);if((h=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return xa.call(l,a,b,c,k?e:null,d,f,g+1)})}return xa.call(this,a,b,c,k?e:null,d,f,g+1)};function ya(a,b,c,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=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}
this.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 L(a){a.H=null;a.B.clear();a.G.clear()};let M,N;async function ka(a){a=a.data;const b=a.task,c=a.id;let e=a.args;switch(b){case "init":N=a.options||{};(a=a.factory)?(Function("return "+a)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:c});break;default:let d;"export"===b&&(e=[N.export]);"import"===b?await N.import.call(M,M):d=M[b].apply(M,e);postMessage("search"===b?{id:c,msg:d}:{id:c})}};function la(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ma,na;const oa={},pa={};function qa(a){ma=0;oa[a]=pa[a]}
function P(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]);ma||(ma=setTimeout(qa,0,a),na=Date.now());pa[a]||(pa[a]=oa[a]=1E3);if(!--oa[a]){oa[a]=pa[a]=pa[a]*this.priority*this.priority*3/(Date.now()-na)|0||1;ma=clearTimeout(ma);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 ra=0;
function Q(a={}){function b(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=B();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++ra]=function(){h(d)};d.worker.postMessage({id:ra,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this||this.constructor!==Q)return new Q(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=sa(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");la(Q.prototype);
function R(a){Q.prototype[a]=async function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.splice(c.length-1,1));e=new Promise(function(f){b.h[++ra]=f;b.worker.postMessage({task:a,id:ra,args:c})});return d?(e.then(d),this):e}}
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="+ka.toString()],{type:"text/javascript"}))):new window.Worker(E(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=0){let c=[],e=[];b&&(b=25E4/b*5E3|0);for(const d of a.entries())e.push(d),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}function ua(a,b){b||(b=new Map);for(let c=0,e;c<a.length;c++)e=a[c],b.set(e[0],e[1]);return b}function va(a,b=0){let c=[],e=[];b&&(b=25E4/b*1E3|0);for(const d of a.entries())e.push([d[0],ta(d[1])[0]]),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}
function wa(a,b){b||(b=new Map);for(let c=0,e,d;c<a.length;c++)e=a[c],d=b.get(e[0]),b.set(e[0],ua(e[1],d));return b}function xa(a){let b=[],c=[];for(const e of a.keys())c.push(e),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}function ya(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}
function za(a,b,c,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,b,d,f+1);if((h=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return za.call(l,a,b,c,k?e:null,d,f,g+1)})}return za.call(this,a,b,c,k?e:null,d,f,g+1)};function Aa(a,b,c,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=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;g<b.index.length;g++){k=b.index[g];h=k.indexOf(d);if(0<=h)return f+h;f+=k.length}return-1};if("includes"===e)return function(d){for(let f=
0;f<b.index.length;f++)if(b.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return ya(b,d||0,f||b.length,!1)};if("splice"===e)return function(d,f){return ya(b,d||0,f||b.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(c=b.index[e/2**31|0])&&c[e]},set(c,e,d){c=e/2**31|0;(b.index[c]||(b.index[c]=[]))[e]=d;b.length++;return!0}})}S.prototype.clear=function(){this.index.length=0};S.prototype.destroy=function(){this.proxy=this.index=null};
S.prototype.push=function(){};function T(a=8){if(!this)return new T(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=za,this.A=BigInt(a)):(this.h=Aa,this.A=a)}T.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};T.prototype.set=function(a,b){var c=this.h(a);let e=this.index[c];e?(c=e.size,e.set(a,b),(c-=e.size)&&this.size++):(this.index[c]=e=new Map([[a,b]]),this.B.push(e))};
function U(a=8){if(!this)return new U(a);this.index=B();this.h=[];32<a?(this.B=za,this.A=BigInt(a)):(this.B=Aa,this.A=a)}U.prototype.add=function(a){var b=this.B(a);let 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))};t=T.prototype;t.has=U.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};t.delete=U.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
0;f<b.index.length;f++)if(b.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return Aa(b,d||0,f||b.length,!1)};if("splice"===e)return function(d,f){return Aa(b,d||0,f||b.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(c=b.index[e/2**31|0])&&c[e]},set(c,e,d){c=e/2**31|0;(b.index[c]||(b.index[c]=[]))[e]=d;b.length++;return!0}})}S.prototype.clear=function(){this.index.length=0};S.prototype.destroy=function(){this.proxy=this.index=null};
S.prototype.push=function(){};function T(a=8){if(!this)return new T(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=Ba,this.A=BigInt(a)):(this.h=Ca,this.A=a)}T.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};T.prototype.set=function(a,b){var c=this.h(a);let e=this.index[c];e?(c=e.size,e.set(a,b),(c-=e.size)&&this.size++):(this.index[c]=e=new Map([[a,b]]),this.B.push(e))};
function U(a=8){if(!this)return new U(a);this.index=B();this.h=[];32<a?(this.B=Ba,this.A=BigInt(a)):(this.B=Ca,this.A=a)}U.prototype.add=function(a){var b=this.B(a);let 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))};t=T.prototype;t.has=U.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};t.delete=U.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
t.clear=U.prototype.clear=function(){this.index=B();this.h=[];this.size=0};t.values=U.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};t.keys=U.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};t.entries=U.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function Aa(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,e=this.A+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.A?c+2**31:c}function za(a){let b=BigInt(2)**this.A-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};V.prototype.add=function(a,b,c){I(a)&&(b=a,a=ba(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let k=0,h;k<this.field.length;k++){h=this.D[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(b);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(b))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),Ba(b,h,this.J,0,e,a,h[0],c)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let k=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
function Ca(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,e=this.A+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.A?c+2**31:c}function Ba(a){let b=BigInt(2)**this.A-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};V.prototype.add=function(a,b,c){I(a)&&(b=a,a=ba(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let k=0,h;k<this.field.length;k++){h=this.D[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(b);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(b))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),Da(b,h,this.J,0,e,a,h[0],c)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let k=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.I;if(g&&!g(b))continue;f.constructor===String&&(f=""+f);f=ba(b,f)}if(d&&f){E(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)if(l=f[h],!k[l]&&(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new S(m);if(this.fastupdate)for(let n of this.reg.values())n.includes(m)&&(n[n.indexOf(m)]=g);d.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let k;if(this.C){k=B();for(let h=0,l;h<this.C.length;h++){l=
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ca(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}}return this};function Ca(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ca(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ca(a,b,c,e,d)}
function Ba(a,b,c,e,d,f,g,k){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Ba(a,b,c,e,d,f,g,k);else g=b[++e],Ba(a,b,c,e,d,f,g,k);else d.db&&d.remove(f)};function Da(a,b,c,e,d,f,g){const k=a.length;let h=[],l;var m;l=B();for(let n=0,p,q,r,u;n<b;n++)for(let v=0;v<k;v++)if(r=a[v],n<r.length&&(p=r[n]))for(let x=0;x<p.length;x++)q=p[x],(m=l[q])?l[q]++:(m=0,l[q]=1),u=h[m]||(h[m]=[]),g||(m=n+(v||!d?0:f||0),u=u[m]||(u[m]=[])),u.push(q);if(a=h.length)if(d)h=1<h.length?Ea(h,c,e,g,f):(h=h[0]).length>c||e?h.slice(e,c+e):h;else{if(a<k)return[];h=h[a-1];if(c||e)if(g){if(h.length>c||e)h=h.slice(e,c+e)}else{d=[];for(let n=0,p;n<h.length;n++)if(p=h[n],p.length>e)e-=
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ea(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}}return this};function Ea(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ea(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ea(a,b,c,e,d)}
function Da(a,b,c,e,d,f,g,k){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Da(a,b,c,e,d,f,g,k);else g=b[++e],Da(a,b,c,e,d,f,g,k);else d.db&&d.remove(f)};function Fa(a,b,c,e,d,f,g){const k=a.length;let h=[],l;var m;l=B();for(let n=0,p,q,r,u;n<b;n++)for(let v=0;v<k;v++)if(r=a[v],n<r.length&&(p=r[n]))for(let x=0;x<p.length;x++)q=p[x],(m=l[q])?l[q]++:(m=0,l[q]=1),u=h[m]||(h[m]=[]),g||(m=n+(v||!d?0:f||0),u=u[m]||(u[m]=[])),u.push(q);if(a=h.length)if(d)h=1<h.length?Ga(h,c,e,g,f):(h=h[0]).length>c||e?h.slice(e,c+e):h;else{if(a<k)return[];h=h[a-1];if(c||e)if(g){if(h.length>c||e)h=h.slice(e,c+e)}else{d=[];for(let n=0,p;n<h.length;n++)if(p=h[n],p.length>e)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}h=1<d.length?[].concat.apply([],d):d[0]}}return h}
function Ea(a,b,c,e,d){const f=[],g=B();let k;var h=a.length;let l;if(e)for(d=h-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(h=0;h<l;h++)if(k=e[h],!g[k])if(g[k]=1,c)c--;else if(f.push(k),f.length===b)return f}else for(let m=h-1,n,p=0;0<=m;m--){n=a[m];for(let q=0;q<n.length;q++)if(l=(e=n[q])&&e.length)for(let r=0;r<l;r++)if(k=e[r],!g[k])if(g[k]=1,c)c--;else{let u=(q+(m<h-1?d||0:0))/(m+1)|0;(f[u]||(f[u]=[])).push(k);if(++p===b)return f}}return f}
function Fa(a,b,c){const e=B(),d=[];for(let f=0,g;f<b.length;f++){g=b[f];for(let k=0;k<g.length;k++)e[g[k]]=1}if(c)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,k;f<a.result.length;f++)for(g=a.result[f],b=0;b<g.length;b++)k=g[b],e[k]&&((d[f]||(d[f]=[])).push(k),e[k]=0);return d};function Ga(a,b,c,e){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,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)){if(c){if(c>=k){c-=k;continue}c<k&&(g=b?g.slice(c,c+b):g.slice(c),k=g.length,c=0)}k>b&&(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=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ha(a,b,c){var e=c[0];if(e.then)return Promise.all(c).then(function(m){return a[b].apply(a,m)});if(e[0]&&e[0].index)return a[b].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<c.length;m++)if(n=c[m]){let p;if(n.constructor===X)p=n.result;else if(n.constructor===Array)p=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,p=n.index.search(n).result,n.resolve=h;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=a.xor(n.xor);
else if(n.not)p=a.not(n.not);else continue;if(p.then)d.push(p);else if(p.length)e[m]=p;else if(!l&&("and"===b||"xor"===b)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};X.prototype.or=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f}=Ha(this,"or",arguments);return Ia.call(this,a,b,c,e,d,f)};function Ia(a,b,c,e,d,f){if(b.length){const g=this;return Promise.all(b).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ia.call(g,a,[],c,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=Ea(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:m,suggest:n}=Ha(this,"and",arguments);return Ja.call(this,f,g,k,h,l,m,n)}return d?this.resolve(b,c,e):this};
function Ja(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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ja.call(k,a,[],c,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(b=ca(a))return this.result=Da(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}=Ha(this,"xor",arguments);return Ka.call(this,a,b,c,e,d,f,g)};
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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ka.call(k,a,[],c,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=La.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 La(a,b,c,e,d){const f=[],g=B();let k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let p=0,q;p<n.length;p++)q=n[p],g[q]=g[q]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,p;n<a.length;n++)if(p=a[n])if(l=p[h])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(f.push(r),f.length===b)return f}else{const u=h+(n?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++m===b)return f}return f};X.prototype.not=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f,suggest:g}=Ha(this,"not",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 k=this;return Promise.all(b).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ma.call(k,a,[],c,e,d,f,g)})}if(a.length&&this.result.length)this.result=Na.call(this,a,c,e,f);else if(f)return this.resolve(c,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Na(a,b,c,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=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))if(c)c--;else if(e){if(d.push(l),d.length===b)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===b)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])if(e.length<=a){if(b[c]=e,a-=e.length,!a)break}else{b[c]=e.slice(0,a);break}this.result=b}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])e.length<=a?a-=e.length:(b[c]=e.slice(a),a=0);this.result=b}return this};X.prototype.boost=function(a){this.h+=a;return this};X.prototype.resolve=function(a,b,c){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),Ga.call(d,e,a||100,b,c)):e};B();V.prototype.search=function(a,b,c,e){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let d=[],f=[],g;let k;let h;let l,m=0;let n;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;k=c.merge;h=g||c.field||(h=c.index)&&(h.index?null:h);var p=this.tag&&c.tag;var q=c.suggest;var r=!1!==c.resolve;r||g||!(h=h||this.field)||(E(h)?g=h:(h.constructor===Array&&1===h.length&&(h=h[0]),g=h.field||h.index));var u=this.store&&c.enrich&&r;n=c.highlight&&u;b=c.limit||b;l=c.offset||0;b||(b=100);if(p&&(!this.db||
!e)){p.constructor!==Array&&(p=[p]);var v=[];for(let z=0,w;z<p.length;z++)if(w=p[z],w.field&&w.tag){var x=w.tag;if(x.constructor===Array)for(var y=0;y<x.length;y++)v.push(w.field,x[y]);else v.push(w.field,x)}else{x=Object.keys(w);for(let D=0,G,C;D<x.length;D++)if(G=x[D],C=w[G],C.constructor===Array)for(y=0;y<C.length;y++)v.push(G,C[y]);else v.push(G,C)}p=v;if(!a){q=[];if(v.length)for(p=0;p<v.length;p+=2){if(this.db){r=this.index.get(v[p]);if(!r)continue;q.push(r=r.db.tag(v[p+1],b,l,u))}else r=Oa.call(this,
function Ga(a,b,c,e,d){const f=[],g=B();let k;var h=a.length;let l;if(e)for(d=h-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(h=0;h<l;h++)if(k=e[h],!g[k])if(g[k]=1,c)c--;else if(f.push(k),f.length===b)return f}else for(let m=h-1,n,p=0;0<=m;m--){n=a[m];for(let q=0;q<n.length;q++)if(l=(e=n[q])&&e.length)for(let r=0;r<l;r++)if(k=e[r],!g[k])if(g[k]=1,c)c--;else{let u=(q+(m<h-1?d||0:0))/(m+1)|0;(f[u]||(f[u]=[])).push(k);if(++p===b)return f}}return f}
function Ha(a,b,c){const e=B(),d=[];for(let f=0,g;f<b.length;f++){g=b[f];for(let k=0;k<g.length;k++)e[g[k]]=1}if(c)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,k;f<a.result.length;f++)for(g=a.result[f],b=0;b<g.length;b++)k=g[b],e[k]&&((d[f]||(d[f]=[])).push(k),e[k]=0);return d};function Ia(a,b,c,e){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,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)){if(c){if(c>=k){c-=k;continue}c<k&&(g=b?g.slice(c,c+b):g.slice(c),k=g.length,c=0)}k>b&&(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=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ja(a,b,c){var e=c[0];if(e.then)return Promise.all(c).then(function(m){return a[b].apply(a,m)});if(e[0]&&e[0].index)return a[b].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<c.length;m++)if(n=c[m]){let p;if(n.constructor===X)p=n.result;else if(n.constructor===Array)p=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,p=n.index.search(n).result,n.resolve=h;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=a.xor(n.xor);
else if(n.not)p=a.not(n.not);else continue;if(p.then)d.push(p);else if(p.length)e[m]=p;else if(!l&&("and"===b||"xor"===b)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};X.prototype.or=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f}=Ja(this,"or",arguments);return Ka.call(this,a,b,c,e,d,f)};function Ka(a,b,c,e,d,f){if(b.length){const g=this;return Promise.all(b).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ka.call(g,a,[],c,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.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:k,offset:h,enrich:l,resolve:m,suggest:n}=Ja(this,"and",arguments);return La.call(this,f,g,k,h,l,m,n)}return d?this.resolve(b,c,e):this};
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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return La.call(k,a,[],c,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.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 k=this;return Promise.all(b).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ma.call(k,a,[],c,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=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 k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let p=0,q;p<n.length;p++)q=n[p],g[q]=g[q]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,p;n<a.length;n++)if(p=a[n])if(l=p[h])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(f.push(r),f.length===b)return f}else{const u=h+(n?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++m===b)return f}return f};X.prototype.not=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f,suggest:g}=Ja(this,"not",arguments);return Oa.call(this,a,b,c,e,d,f,g)};function Oa(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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Oa.call(k,a,[],c,e,d,f,g)})}if(a.length&&this.result.length)this.result=Pa.call(this,a,c,e,f);else if(f)return this.resolve(c,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Pa(a,b,c,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=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))if(c)c--;else if(e){if(d.push(l),d.length===b)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===b)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])if(e.length<=a){if(b[c]=e,a-=e.length,!a)break}else{b[c]=e.slice(0,a);break}this.result=b}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])e.length<=a?a-=e.length:(b[c]=e.slice(a),a=0);this.result=b}return this};X.prototype.boost=function(a){this.h+=a;return this};X.prototype.resolve=function(a,b,c){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),Ia.call(d,e,a||100,b,c)):e};B();V.prototype.search=function(a,b,c,e){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let d=[],f=[],g;let k;let h;let l,m=0;let n;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;k=c.merge;h=g||c.field||(h=c.index)&&(h.index?null:h);var p=this.tag&&c.tag;var q=c.suggest;var r=!1!==c.resolve;r||g||!(h=h||this.field)||(E(h)?g=h:(h.constructor===Array&&1===h.length&&(h=h[0]),g=h.field||h.index));var u=this.store&&c.enrich&&r;n=c.highlight&&u;b=c.limit||b;l=c.offset||0;b||(b=100);if(p&&(!this.db||
!e)){p.constructor!==Array&&(p=[p]);var v=[];for(let z=0,w;z<p.length;z++)if(w=p[z],w.field&&w.tag){var x=w.tag;if(x.constructor===Array)for(var y=0;y<x.length;y++)v.push(w.field,x[y]);else v.push(w.field,x)}else{x=Object.keys(w);for(let D=0,G,C;D<x.length;D++)if(G=x[D],C=w[G],C.constructor===Array)for(y=0;y<C.length;y++)v.push(G,C[y]);else v.push(G,C)}p=v;if(!a){q=[];if(v.length)for(p=0;p<v.length;p+=2){if(this.db){r=this.index.get(v[p]);if(!r)continue;q.push(r=r.db.tag(v[p+1],b,l,u))}else r=Qa.call(this,
v[p],v[p+1],b,l,u);d.push({field:v[p],tag:v[p+1],result:r})}return q.length?Promise.all(q).then(function(z){for(let w=0;w<z.length;w++)d[w].result=z[w];return d}):d}}h&&h.constructor!==Array&&(h=[h])}h||(h=this.field);v=!e&&(this.worker||this.db)&&[];let F;for(let z=0,w,D,G;z<h.length;z++){D=h[z];if(this.db&&this.tag&&!this.D[z])continue;let C;E(D)||(C=D,D=C.field,a=C.query||a,b=C.limit||b,l=C.offset||l,q=C.suggest||q,u=this.store&&(C.enrich||u));if(e)w=e[z];else if(x=C||c,y=this.index.get(D),p&&
(this.db&&(x.tag=p,F=y.db.support_tag_search,x.field=h),F||(x.enrich=!1)),v){v[z]=y.search(a,b,x);x&&u&&(x.enrich=u);continue}else w=y.search(a,b,x),x&&u&&(x.enrich=u);G=w&&(r?w.length:w.result.length);if(p&&G){x=[];y=0;if(this.db&&e){if(!F)for(let H=h.length;H<e.length;H++){let K=e[H];if(K&&K.length)y++,x.push(K);else if(!q)return r?d:new X(d)}}else for(let H=0,K,ob;H<p.length;H+=2){K=this.tag.get(p[H]);if(!K)if(q)continue;else return r?d:new X(d);if(ob=(K=K&&K.get(p[H+1]))&&K.length)y++,x.push(K);
else if(!q)return r?d:new X(d)}if(y){w=Fa(w,x,r);G=w.length;if(!G&&!q)return r?w:new X(w);y--}}if(G)f[m]=D,d.push(w),m++;else if(1===h.length)return r?d:new X(d)}if(v){if(this.db&&p&&p.length&&!F)for(u=0;u<p.length;u+=2){e=this.index.get(p[u]);if(!e)if(q)continue;else return r?d:new X(d);v.push(e.db.tag(p[u+1],b,l,!1))}const z=this;return Promise.all(v).then(function(w){return w.length?z.search(a,b,c,w):w})}if(!m)return r?d:new X(d);if(g&&(!u||!this.store))return d[0];v=[];for(let z=0,w;z<f.length;z++){w=
d[z];u&&w.length&&!w[0].doc&&(this.db?v.push(w=this.index.get(this.field[0]).db.enrich(w)):w=W.call(this,w));if(g)return r?w:new X(w);d[z]={field:f[z],result:w}}if(u&&this.db&&v.length){const z=this;return Promise.all(v).then(function(w){for(let D=0;D<w.length;D++)d[D].result=w[D];return k?Pa(d,b):n?Qa(d,a,z.index,z.field,z.D,n):d})}return k?Pa(d,b):n?Qa(d,a,this.index,this.field,this.D,n):d};
function Qa(a,b,c,e,d,f){let g,k,h;for(let m=0,n,p,q,r,u;m<a.length;m++){n=a[m].result;p=a[m].field;r=c.get(p);q=r.encoder;h=r.tokenize;u=d[e.indexOf(p)];q!==g&&(g=q,k=g.encode(b));for(let v=0;v<n.length;v++){let x="";var l=ba(n[v].doc,u);let y=g.encode(l);l=l.split(g.split);for(let F=0,z,w;F<y.length;F++){z=y[F];w=l[F];let D;for(let G=0,C;G<k.length;G++)if(C=k[G],"strict"===h){if(z===C){x+=(x?" ":"")+f.replace("$1",w);D=!0;break}}else{const H=z.indexOf(C);if(-1<H){x+=(x?" ":"")+w.substring(0,H)+
f.replace("$1",w.substring(H,C.length))+w.substring(H+C.length);D=!0;break}}D||(x+=(x?" ":"")+l[F])}n[v].highlight=x}}return a}function Pa(a,b){const c=[],e=B();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],h=l.id,m=e[h])m.push(f.field);else{if(c.length===b)return c;l.field=e[h]=[f.field];c.push(l)}}return c}
function Oa(a,b,c,e,d){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-e)&&0<b){if(b>c||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;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store.get(e)};return b};function V(a){if(!this||this.constructor!==V)return new V(a);const b=a.document||a.doc||a;let c,e;this.D=[];this.field=[];this.J=[];this.key=(c=b.key||b.id)&&Ra(c,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.reg=(this.fastupdate=!!a.fastupdate)?e?new T(e):new Map:e?new U(e):new Set;this.C=(c=b.store||null)&&c&&!0!==c&&[];this.store=c&&(e?new T(e):new Map);this.cache=(c=a.cache||null)&&new Y(c);a.cache=!1;this.worker=a.worker;this.index=Sa.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===
typeof c&&(c=[c]),c.length){this.tag=new Map;this.F=[];this.R=[];for(let d=0,f,g;d<c.length;d++){f=c[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.F[d]=f.custom:(this.F[d]=Ra(g,this.J),f.filter&&("string"===typeof this.F[d]&&(this.F[d]=new String(this.F[d])),this.F[d].I=f.filter));this.R[d]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const d of this.index.values())d.then&&a.push(d);if(a.length){const d=this;return Promise.all(a).then(function(f){let g=
(this.db&&(x.tag=p,F=y.db.support_tag_search,x.field=h),F||(x.enrich=!1)),v){v[z]=y.search(a,b,x);x&&u&&(x.enrich=u);continue}else w=y.search(a,b,x),x&&u&&(x.enrich=u);G=w&&(r?w.length:w.result.length);if(p&&G){x=[];y=0;if(this.db&&e){if(!F)for(let H=h.length;H<e.length;H++){let K=e[H];if(K&&K.length)y++,x.push(K);else if(!q)return r?d:new X(d)}}else for(let H=0,K,qb;H<p.length;H+=2){K=this.tag.get(p[H]);if(!K)if(q)continue;else return r?d:new X(d);if(qb=(K=K&&K.get(p[H+1]))&&K.length)y++,x.push(K);
else if(!q)return r?d:new X(d)}if(y){w=Ha(w,x,r);G=w.length;if(!G&&!q)return r?w:new X(w);y--}}if(G)f[m]=D,d.push(w),m++;else if(1===h.length)return r?d:new X(d)}if(v){if(this.db&&p&&p.length&&!F)for(u=0;u<p.length;u+=2){e=this.index.get(p[u]);if(!e)if(q)continue;else return r?d:new X(d);v.push(e.db.tag(p[u+1],b,l,!1))}const z=this;return Promise.all(v).then(function(w){return w.length?z.search(a,b,c,w):w})}if(!m)return r?d:new X(d);if(g&&(!u||!this.store))return d[0];v=[];for(let z=0,w;z<f.length;z++){w=
d[z];u&&w.length&&!w[0].doc&&(this.db?v.push(w=this.index.get(this.field[0]).db.enrich(w)):w=W.call(this,w));if(g)return r?w:new X(w);d[z]={field:f[z],result:w}}if(u&&this.db&&v.length){const z=this;return Promise.all(v).then(function(w){for(let D=0;D<w.length;D++)d[D].result=w[D];return k?Ra(d,b):n?Sa(d,a,z.index,z.field,z.D,n):d})}return k?Ra(d,b):n?Sa(d,a,this.index,this.field,this.D,n):d};
function Sa(a,b,c,e,d,f){let g,k,h;for(let m=0,n,p,q,r,u;m<a.length;m++){n=a[m].result;p=a[m].field;r=c.get(p);q=r.encoder;h=r.tokenize;u=d[e.indexOf(p)];q!==g&&(g=q,k=g.encode(b));for(let v=0;v<n.length;v++){let x="";var l=ba(n[v].doc,u);let y=g.encode(l);l=l.split(g.split);for(let F=0,z,w;F<y.length;F++){z=y[F];w=l[F];let D;for(let G=0,C;G<k.length;G++)if(C=k[G],"strict"===h){if(z===C){x+=(x?" ":"")+f.replace("$1",w);D=!0;break}}else{const H=z.indexOf(C);if(-1<H){x+=(x?" ":"")+w.substring(0,H)+
f.replace("$1",w.substring(H,C.length))+w.substring(H+C.length);D=!0;break}}D||(x+=(x?" ":"")+l[F])}n[v].highlight=x}}return a}function Ra(a,b){const c=[],e=B();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],h=l.id,m=e[h])m.push(f.field);else{if(c.length===b)return c;l.field=e[h]=[f.field];c.push(l)}}return c}
function Qa(a,b,c,e,d){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-e)&&0<b){if(b>c||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;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store.get(e)};return b};function V(a){if(!this||this.constructor!==V)return new V(a);const b=a.document||a.doc||a;let c,e;this.D=[];this.field=[];this.J=[];this.key=(c=b.key||b.id)&&Ta(c,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.reg=(this.fastupdate=!!a.fastupdate)?e?new T(e):new Map:e?new U(e):new Set;this.C=(c=b.store||null)&&c&&!0!==c&&[];this.store=c&&(e?new T(e):new Map);this.cache=(c=a.cache||null)&&new Y(c);a.cache=!1;this.worker=a.worker;this.index=Ua.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===
typeof c&&(c=[c]),c.length){this.tag=new Map;this.F=[];this.R=[];for(let d=0,f,g;d<c.length;d++){f=c[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.F[d]=f.custom:(this.F[d]=Ta(g,this.J),f.filter&&("string"===typeof this.F[d]&&(this.F[d]=new String(this.F[d])),this.F[d].I=f.filter));this.R[d]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const d of this.index.values())d.then&&a.push(d);if(a.length){const d=this;return Promise.all(a).then(function(f){let g=
0;for(const k of d.index.entries()){const h=k[0];k[1].then&&d.index.set(h,f[g++])}return d})}}else a.db&&this.mount(a.db)}t=V.prototype;
t.mount=function(a){let b=this.field;if(this.tag)for(let d=0,f;d<this.R.length;d++){f=this.R[d];var c=void 0;this.index.set(f,c=new M({},this.reg));b===this.field&&(b=b.slice(0));b.push(f);c.tag=this.tag.get(f)}c=[];const e={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let d=0,f,g;d<b.length;d++){e.field=g=b[d];f=this.index.get(g);const k=new a.constructor(a.id,e);k.id=a.id;c[d]=k.mount(f);f.document=!0;d?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(c)};
t.mount=function(a){let b=this.field;if(this.tag)for(let d=0,f;d<this.R.length;d++){f=this.R[d];var c=void 0;this.index.set(f,c=new O({},this.reg));b===this.field&&(b=b.slice(0));b.push(f);c.tag=this.tag.get(f)}c=[];const e={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let d=0,f,g;d<b.length;d++){e.field=g=b[d];f=this.index.get(g);const k=new a.constructor(a.id,e);k.id=a.id;c[d]=k.mount(f);f.document=!0;d?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(c)};
t.commit=async function(a,b){const c=[];for(const e of this.index.values())c.push(e.db.commit(e,a,b));await Promise.all(c);this.reg.clear()};t.destroy=function(){const a=[];for(const b of this.index.values())a.push(b.destroy());return Promise.all(a)};
function Sa(a,b){const c=new Map;let e=b.index||b.field||b;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++){f=e[d];E(f)||(g=f,f=f.field);g=I(g)?Object.assign({},a,g):a;if(this.worker){const k=new N(g);c.set(f,k)}this.worker||c.set(f,new M(g,this.reg));g.custom?this.D[d]=g.custom:(this.D[d]=Ra(f,this.J),g.filter&&("string"===typeof this.D[d]&&(this.D[d]=new String(this.D[d])),this.D[d].I=g.filter));this.field[d]=f}if(this.C){a=b.store;E(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?
(this.C[d]=f.custom,f.custom.V=g):(this.C[d]=Ra(g,this.J),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=f.filter))}return c}function Ra(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]}t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)};
function Ua(a,b){const c=new Map;let e=b.index||b.field||b;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++){f=e[d];E(f)||(g=f,f=f.field);g=I(g)?Object.assign({},a,g):a;if(this.worker){const k=new Q(g);c.set(f,k)}this.worker||c.set(f,new O(g,this.reg));g.custom?this.D[d]=g.custom:(this.D[d]=Ta(f,this.J),g.filter&&("string"===typeof this.D[d]&&(this.D[d]=new String(this.D[d])),this.D[d].I=g.filter));this.field[d]=f}if(this.C){a=b.store;E(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?
(this.C[d]=f.custom,f.custom.V=g):(this.C[d]=Ta(g,this.J),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=f.filter))}return c}function Ta(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]}t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)};
t.remove=function(a){I(a)&&(a=ba(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let e of c){b=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):c.delete(b))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
t.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};t.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};t.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};t.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};
t.set=function(a,b){this.store.set(a,b);return this};t.searchCache=Ta;
t.export=function(a,b,c=0,e=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,e=1))&&b.then){const k=this;return b.then(function(){return k.export(a,g,c+1)})}return this.export(a,g,c+1)}let d,f;switch(e){case 0:d="reg";f=va(this.reg);b=null;break;case 1:d="tag";f=ta(this.tag,this.reg.size);b=null;break;case 2:d="doc";f=ra(this.store);b=null;break;case 3:d="cfg";b=f=null;break;default:return}return xa.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=wa(b,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=ua(b,this.tag);break;case "doc":this.store=sa(b,this.store)}}};na(V.prototype);function Ta(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.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 Ua={normalize:function(a){return a.toLowerCase()}};const Va=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 Wa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Xa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ya={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 Za=/[\x00-\x7F]+/g;const $a=/[\x00-\x7F]+/g;const ab=/[\x00-\x7F]+/g;var bb={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ua,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Va},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Va,matcher:Wa,replacer:Xa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Va,replacer:Xa.concat([/(?!^)[aeo]/g,""]),matcher:Wa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=Ya[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=Ya[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Za," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace($a,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ab," ")}}};const cb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};M.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const l=B(),m=B(),n=this.depth,p=this.resolution;for(let q=0;q<e;q++){let r=b[this.rtl?e-1-q:q];var d=r.length;if(d&&(n||!m[r])){var f=this.score?this.score(b,r,q,null,0):db(p,e,q),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=r.substring(f,k);var h=this.score?this.score(b,r,q,g,f):db(p,e,q,d,f);eb(this,m,g,h,a,c)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=r[k]+g,h=this.score?this.score(b,r,q,g,k):db(p,e,q,d,k),eb(this,m,g,h,a,c);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[k],eb(this,m,g,f,a,c);break}default:if(eb(this,m,r,f,a,c),n&&1<e&&q<e-1)for(d=B(),g=this.U,f=r,k=Math.min(n+1,e-q),d[f]=1,h=1;h<k;h++)if((r=b[this.rtl?e-1-q-h:q+h])&&!d[r]){d[r]=1;const u=this.score?this.score(b,f,q,r,h):db(g+(e/2>g?0:1),e,q,k-1,h-1),v=this.bidirectional&&r>f;eb(this,l,v?f:r,u,a,c,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.T&&fb(this));return this};function eb(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 db(a,b,c,e,d){return c&&1<a?b+(e||0)<=a?c+(d||0):(a-1)/(b+(e||0))*(c+(d||0))+1|0:0};M.prototype.search=function(a,b,c){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let e=[],d,f,g,k=0,h,l,m,n,p;c?(a=c.query||a,b=c.limit||b,k=c.offset||0,f=c.context,g=c.suggest,p=(h=!1!==c.resolve)&&c.enrich,m=c.boost,n=c.resolution,l=this.db&&c.tag):h=this.resolve;let q=this.encoder.encode(a);d=q.length;b=b||(h?100:0);if(1===d)return gb.call(this,q[0],"",b,k,h,p,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return gb.call(this,q[0],q[1],b,k,h,p,l);let r=B(),u=0,v;1<d&&f&&(v=q[0],u=1);n||0===n||(n=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,q,b,k,g,h,p,l),!1!==a))return a;const x=this;return async function(){for(let y,F;u<d;u++){if((F=q[u])&&!r[F]){r[F]=1;y=await hb(x,F,v,0,0,!1,!1);if(y=ib(y,e,g,n)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(v="",u=-1,r=B())}return jb(e,n,b,k,g,m,h)}()}for(let x,y;u<d;u++){if((y=q[u])&&!r[y]){r[y]=1;x=hb(this,y,v,0,0,!1,!1);if(x=ib(x,e,g,n)){e=x;break}v&&(g&&x&&e.length||(v=y))}g&&v&&u===d-1&&!e.length&&(v="",
u=-1,r=B())}return jb(e,n,b,k,g,m,h)};function jb(a,b,c,e,d,f,g){let k=a.length,h=a;if(1<k)h=Da(a,b,c,e,d,f,g);else if(1===k)return g?Ga.call(null,a[0],c,e):new X(a[0]);return g?h:new X(h)}function gb(a,b,c,e,d,f,g){a=hb(this,a,b,c,e,d,f,g);return this.db?a.then(function(k){return d?k||[]:new X(k)}):a&&a.length?d?Ga.call(this,a,c,e):new X(a):d?[]:new X}
function ib(a,b,c,e){let d=[];if(a&&a.length){if(a.length<=e){b.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){b.push(d);return}}if(!c)return d}function hb(a,b,c,e,d,f,g,k){let h;c&&(h=a.bidirectional&&b>c)&&(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};M.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;e<c.length;e++){if(d=c[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===c.length-1?d.pop():d.splice(f,1)}}else kb(this.map,a),this.depth&&kb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&fb(this));this.cache&&this.cache.remove(a);return this};
function kb(a,b){let c=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(b),0<=f){1<d.length?(d.splice(f,1),c++):delete a[e];break}else c++}else for(let e of a.entries()){const d=e[0],f=kb(e[1],b);f?c+=f:a.delete(d)}return c};function M(a,b){if(!this||this.constructor!==M)return new M(a);if(a){var c=E(a)?a:a.preset;c&&(a=Object.assign({},cb[c],a))}else a={};c=a.context;const e=!0===c?{depth:1}:c||{},d=E(a.encoder)?bb[a.encoder]:a.encode||a.encoder||Ua;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=c=a.tokenize||"strict";this.depth="strict"===c&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(c=a.keystore||
0)&&(this.keystore=c);this.map=c?new T(c):new Map;this.ctx=c?new T(c):new Map;this.reg=b||(this.fastupdate?c?new T(c):new Map:c?new U(c):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(c=a.cache||null)&&new Y(c);this.resolve=!1!==a.resolve;if(c=a.db)this.db=this.mount(c);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=M.prototype;t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
t.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function fb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
t.set=function(a,b){this.store.set(a,b);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,e=1))&&b.then){const k=this;return b.then(function(){return k.export(a,g,c+1)})}return this.export(a,g,c+1)}let d,f;switch(e){case 0:d="reg";f=xa(this.reg);b=null;break;case 1:d="tag";f=va(this.tag,this.reg.size);b=null;break;case 2:d="doc";f=ta(this.store);b=null;break;case 3:d="cfg";b=f=null;break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=wa(b,this.tag);break;case "doc":this.store=ua(b,this.store)}}};la(V.prototype);function Va(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.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"],["pf","f"]]),Za=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\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:{normalize:!1,dedupe:!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;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=$a[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=$a[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ab," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(bb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(cb," ")}}};const eb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const l=B(),m=B(),n=this.depth,p=this.resolution;for(let q=0;q<e;q++){let r=b[this.rtl?e-1-q:q];var d=r.length;if(d&&(n||!m[r])){var f=this.score?this.score(b,r,q,null,0):fb(p,e,q),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=r.substring(f,k);var h=this.score?this.score(b,r,q,g,f):fb(p,e,q,d,f);gb(this,m,g,h,a,c)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=r[k]+g,h=this.score?this.score(b,r,q,g,k):fb(p,e,q,d,k),gb(this,m,g,h,a,c);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[k],gb(this,m,g,f,a,c);break}default:if(gb(this,m,r,f,a,c),n&&1<e&&q<e-1)for(d=B(),g=this.U,f=r,k=Math.min(n+1,e-q),d[f]=1,h=1;h<k;h++)if((r=b[this.rtl?e-1-q-h:q+h])&&!d[r]){d[r]=1;const u=this.score?this.score(b,f,q,r,h):fb(g+(e/2>g?0:1),e,q,k-1,h-1),v=this.bidirectional&&r>f;gb(this,l,v?f:r,u,a,c,v?r: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 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 fb(a,b,c,e,d){return c&&1<a?b+(e||0)<=a?c+(d||0):(a-1)/(b+(e||0))*(c+(d||0))+1|0:0};O.prototype.search=function(a,b,c){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let e=[],d,f,g,k=0,h,l,m,n,p;c?(a=c.query||a,b=c.limit||b,k=c.offset||0,f=c.context,g=c.suggest,p=(h=!1!==c.resolve)&&c.enrich,m=c.boost,n=c.resolution,l=this.db&&c.tag):h=this.resolve;let q=this.encoder.encode(a);d=q.length;b=b||(h?100:0);if(1===d)return ib.call(this,q[0],"",b,k,h,p,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return ib.call(this,q[0],q[1],b,k,h,p,l);let r=B(),u=0,v;1<d&&f&&(v=q[0],u=1);n||0===n||(n=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,q,b,k,g,h,p,l),!1!==a))return a;const x=this;return async function(){for(let y,F;u<d;u++){if((F=q[u])&&!r[F]){r[F]=1;y=await jb(x,F,v,0,0,!1,!1);if(y=kb(y,e,g,n)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(v="",u=-1,r=B())}return lb(e,n,b,k,g,m,h)}()}for(let x,y;u<d;u++){if((y=q[u])&&!r[y]){r[y]=1;x=jb(this,y,v,0,0,!1,!1);if(x=kb(x,e,g,n)){e=x;break}v&&(g&&x&&e.length||(v=y))}g&&v&&u===d-1&&!e.length&&(v="",
u=-1,r=B())}return lb(e,n,b,k,g,m,h)};function lb(a,b,c,e,d,f,g){let k=a.length,h=a;if(1<k)h=Fa(a,b,c,e,d,f,g);else if(1===k)return g?Ia.call(null,a[0],c,e):new X(a[0]);return g?h:new X(h)}function ib(a,b,c,e,d,f,g){a=jb(this,a,b,c,e,d,f,g);return this.db?a.then(function(k){return d?k||[]:new X(k)}):a&&a.length?d?Ia.call(this,a,c,e):new X(a):d?[]:new X}
function kb(a,b,c,e){let d=[];if(a&&a.length){if(a.length<=e){b.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){b.push(d);return}}if(!c)return d}function jb(a,b,c,e,d,f,g,k){let h;c&&(h=a.bidirectional&&b>c)&&(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;e<c.length;e++){if(d=c[e])if(2>d.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;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(b),0<=f){1<d.length?(d.splice(f,1),c++):delete a[e];break}else c++}else for(let e of a.entries()){const d=e[0],f=mb(e[1],b);f?c+=f:a.delete(d)}return c};function O(a,b){if(!this||this.constructor!==O)return new O(a);if(a){var c=E(a)?a:a.preset;c&&(a=Object.assign({},eb[c],a))}else a={};c=a.context;const e=!0===c?{depth:1}:c||{},d=E(a.encoder)?db[a.encoder]:a.encode||a.encoder||Wa;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=c=a.tokenize||"strict";this.depth="strict"===c&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(c=a.keystore||
0)&&(this.keystore=c);this.map=c?new T(c):new Map;this.ctx=c?new T(c):new Map;this.reg=b||(this.fastupdate?c?new T(c):new Map:c?new U(c):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(c=a.cache||null)&&new Y(c);this.resolve=!1!==a.resolve;if(c=a.db)this.db=this.mount(c);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=O.prototype;t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
t.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function hb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();this.db&&(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[{clear:!0}]);return this};t.append=function(a,b){return this.add(a,b,!0)};t.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};t.update=function(a,b){const c=this,e=this.remove(a);return e&&e.then?e.then(()=>c.add(a,b)):this.add(a,b)};
function lb(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=lb(c[1]);d?b+=d:a.delete(e)}return b}t.cleanup=function(){if(!this.fastupdate)return this;lb(this.map);this.depth&&lb(this.ctx);return this};t.searchCache=Ta;
t.export=function(a,b,c=0,e=0){let d,f;switch(e){case 0:d="reg";f=va(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=ra(this.map,this.reg.size);break;case 3:d="ctx";f=ta(this.ctx,this.reg.size);break;default:return}return xa.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=wa(b,this.reg);break;case "map":this.map=sa(b,this.map);break;case "ctx":this.ctx=ua(b,this.ctx)}};
function nb(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=nb(c[1]);d?b+=d:a.delete(e)}return b}t.cleanup=function(){if(!this.fastupdate)return this;nb(this.map);this.depth&&nb(this.ctx);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){let d,f;switch(e){case 0:d="reg";f=xa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=ta(this.map,this.reg.size);break;case 3:d="ctx";f=va(this.ctx,this.reg.size);break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);break;case "map":this.map=ua(b,this.map);break;case "ctx":this.ctx=wa(b,this.ctx)}};
t.serialize=function(a=!0){if(!this.reg.size)return"";let b="",c="";for(var e of this.reg.keys())c||(c=typeof e),b+=(b?",":"")+("string"===c?'"'+e+'"':e);b="index.reg=new Set(["+b+"]);";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"===c?'"'+n[l]+'"':n[l]);h="["+h+"]";k+=(k?",":"")+h}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 p=0,q;p<k.length;p++){q=k[p]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+b+e+d+"}":b+e+d};na(M.prototype);const mb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),nb=["map","ctx","tag","reg","cfg"];
function pb(a,b={}){if(!this)return new pb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=pb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
t.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const e=mb.open(a.id+(a.field?":"+a.field:""),1);e.onupgradeneeded=function(){const d=a.db=this.result;nb.forEach(f=>{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.close();this.db=null};t.destroy=function(){const a=mb.deleteDatabase(this.id+(this.field?":"+this.field:""));return Z(a)};t.clear=function(){const a=this.db.transaction(nb,"readwrite");for(let b=0;b<nb.length;b++)a.objectStore(nb[b]).clear();return Z(a)};
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let p=0,q;p<k.length;p++){q=k[p]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+b+e+d+"}":b+e+d};la(O.prototype);const ob="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),pb=["map","ctx","tag","reg","cfg"];
function rb(a,b={}){if(!this)return new rb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=rb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
t.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const e=ob.open(a.id+(a.field?":"+a.field:""),1);e.onupgradeneeded=function(){const d=a.db=this.result;pb.forEach(f=>{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.close();this.db=null};t.destroy=function(){const a=ob.deleteDatabase(this.id+(this.field?":"+this.field:""));return Z(a)};t.clear=function(){const a=this.db.transaction(pb,"readwrite");for(let b=0;b<pb.length;b++)a.objectStore(pb[b]).clear();return Z(a)};
t.get=function(a,b,c=0,e=0,d=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Z(a).then(function(k){let h=[];if(!k||!k.length)return h;if(d){if(!c&&!e&&1===k.length)return k[0];for(let l=0,m;l<k.length;l++)if((m=k[l])&&m.length){if(e>=m.length){e-=m.length;continue}const n=c?e+Math.min(m.length-e,c):m.length;for(let p=e;p<n;p++)h.push(m[p]);e=0;if(h.length===c)break}return f?g.enrich(h):h}return k})};
t.tag=function(a,b=0,c=0,e=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const d=this;return Z(a).then(function(f){if(!f||!f.length||c>=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<a.length;e++)c[e]=Z(b.get(a[e]));return Promise.all(c).then(function(e){for(let d=0;d<e.length;d++)e[d]={id:a[d],doc:e[d]?JSON.parse(e[d]):null};return e})};t.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Z(a)};t.search=null;t.info=function(){};
@@ -95,6 +95,6 @@ t.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let
for(let m=0,n,p;m<l;m++)if((p=g[m])&&p.length){if((n=k[m])&&n.length)for(h=0;h<p.length;h++)n.push(p[h]);else k[m]=p;h=1}}else k=g,h=1;h&&e.put(k,f)})}}),await this.transaction("ctx","readwrite",function(e){for(const d of a.ctx){const f=d[0],g=d[1];for(const k of g){const h=k[0],l=k[1];l.length&&(b?e.put(l,f+":"+h):e.get(f+":"+h).onsuccess=function(){let m=this.result;var n;if(m&&m.length){const p=Math.max(m.length,l.length);for(let q=0,r,u;q<p;q++)if((u=l[q])&&u.length){if((r=m[q])&&r.length)for(n=
0;n<u.length;n++)r.push(u[n]);else m[q]=u;n=1}}else m=l,n=1;n&&e.put(m,f+":"+h)})}}}),a.store?await this.transaction("reg","readwrite",function(e){for(const d of a.store){const f=d[0],g=d[1];e.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.bypass||await this.transaction("reg","readwrite",function(e){for(const d of a.reg.keys())e.put(1,d)}),a.tag&&await this.transaction("tag","readwrite",function(e){for(const d of a.tag){const f=d[0],g=d[1];g.length&&(e.get(f).onsuccess=function(){let k=this.result;
k=k&&k.length?k.concat(g):g;e.put(k,f)})}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())};
function qb(a,b,c){const e=a.value;let d,f,g=0;for(let k=0,h;k<e.length;k++){if(h=c?e:e[k]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=h.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=h.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(d=1,1<h.length)h.splice(m,1);else{e[k]=[];break}g+=h.length}if(c)break}g?d&&a.update(e):a.delete();a.continue()}
t.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&qb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&qb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&qb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const rb={Index:M,Charset:bb,Encoder:J,Document:V,Worker:N,Resolver:X,IndexedDB:pb,Language:{}},sb=self;let tb;(tb=sb.define)&&tb.amd?tb([],function(){return rb}):"object"===typeof sb.exports?sb.exports=rb:sb.FlexSearch=rb;}(this||self));
function sb(a,b,c){const e=a.value;let d,f,g=0;for(let k=0,h;k<e.length;k++){if(h=c?e:e[k]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=h.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=h.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(d=1,1<h.length)h.splice(m,1);else{e[k]=[];break}g+=h.length}if(c)break}g?d&&a.update(e):a.delete();a.continue()}
t.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&sb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&sb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&sb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const tb={Index:O,Charset:db,Encoder:J,Document:V,Worker:Q,Resolver:X,IndexedDB:rb,Language:{}},ub="undefined"!==typeof self?self:"undefined"!==typeof global?global:"undefined"!==typeof window?window:{};let vb;(vb=ub.define)&&vb.amd?vb([],function(){return tb}):"object"===typeof ub.exports?ub.exports=tb:ub.FlexSearch=tb;}(this||self));

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.107 (Bundle/Module)
* FlexSearch.js v0.8.108 (Bundle/Module)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -21,72 +21,72 @@ t.addMatcher=function(a,b){if("object"===typeof a)return this.addReplacer(a,b);i
t.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.B.has(a))return this.B.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ja?a.normalize("NFKD").replace(ja,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let c=
[],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))if(b)c.push(g);else if(!this.filter||!this.filter.has(g)){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&c.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),g=g.replace(this.N,h=>this.stemmer.get(h)),g.length<this.minlength||this.filter&&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);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)));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.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 L(a){a.H=null;a.B.clear();a.G.clear()};async function ka(a){a=a.data;var b=self._index;const c=a.args;var e=a.task;switch(e){case "init":e=a.options||{};(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new M(e);postMessage({id:a.id});break;default:a=a.id,b=b[e].apply(b,c),postMessage("search"===e?{id:a,msg:b}:{id:a})}};let la=0;
function N(a={}){function b(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=B();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++la]=function(){h(d)};d.worker.postMessage({id:la,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this||this.constructor!==N)return new N(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=ma(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}O("add");O("append");O("search");O("update");O("remove");
function O(a){N.prototype[a]=N.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.splice(c.length-1,1));e=new Promise(function(f){b.h[++la]=f;b.worker.postMessage({task:a,id:la,args:c})});return d?(e.then(d),this):e}}
function ma(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"](import.meta.dirname + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ka.toString()],{type:"text/javascript"}))):new window.Worker(E(c)?c:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function na(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let Q,oa;const pa={},R={};function qa(a){Q=0;pa[a]=R[a]}
function P(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]);Q||(Q=setTimeout(qa,0,a),oa=Date.now());R[a]||(R[a]=pa[a]=1E3);if(!--pa[a]){pa[a]=R[a]=R[a]*this.priority*this.priority*3/(Date.now()-oa)|0||1;Q=clearTimeout(Q);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}};function ra(a,b=0){let c=[],e=[];b&&(b=25E4/b*5E3|0);for(const d of a.entries())e.push(d),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}function sa(a,b){b||(b=new Map);for(let c=0,e;c<a.length;c++)e=a[c],b.set(e[0],e[1]);return b}function ta(a,b=0){let c=[],e=[];b&&(b=25E4/b*1E3|0);for(const d of a.entries())e.push([d[0],ra(d[1])[0]]),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}
function ua(a,b){b||(b=new Map);for(let c=0,e,d;c<a.length;c++)e=a[c],d=b.get(e[0]),b.set(e[0],sa(e[1],d));return b}function va(a){let b=[],c=[];for(const e of a.keys())c.push(e),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}function wa(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}
function xa(a,b,c,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,b,d,f+1);if((h=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return xa.call(l,a,b,c,k?e:null,d,f,g+1)})}return xa.call(this,a,b,c,k?e:null,d,f,g+1)};function ya(a,b,c,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=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}
this.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 L(a){a.H=null;a.B.clear();a.G.clear()};let M,N;async function ka(a){a=a.data;const b=a.task,c=a.id;let e=a.args;switch(b){case "init":N=a.options||{};(a=a.factory)?(Function("return "+a)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:c});break;default:let d;"export"===b&&(e=[N.export]);"import"===b?await N.import.call(M,M):d=M[b].apply(M,e);postMessage("search"===b?{id:c,msg:d}:{id:c})}};function la(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ma,na;const oa={},pa={};function qa(a){ma=0;oa[a]=pa[a]}
function P(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]);ma||(ma=setTimeout(qa,0,a),na=Date.now());pa[a]||(pa[a]=oa[a]=1E3);if(!--oa[a]){oa[a]=pa[a]=pa[a]*this.priority*this.priority*3/(Date.now()-na)|0||1;ma=clearTimeout(ma);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 ra=0;
function Q(a={}){function b(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=B();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++ra]=function(){h(d)};d.worker.postMessage({id:ra,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this||this.constructor!==Q)return new Q(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=sa(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");la(Q.prototype);
function R(a){Q.prototype[a]=async function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.splice(c.length-1,1));e=new Promise(function(f){b.h[++ra]=f;b.worker.postMessage({task:a,id:ra,args:c})});return d?(e.then(d),this):e}}
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"](import.meta.dirname + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ka.toString()],{type:"text/javascript"}))):new window.Worker(E(c)?c: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=0){let c=[],e=[];b&&(b=25E4/b*5E3|0);for(const d of a.entries())e.push(d),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}function ua(a,b){b||(b=new Map);for(let c=0,e;c<a.length;c++)e=a[c],b.set(e[0],e[1]);return b}function va(a,b=0){let c=[],e=[];b&&(b=25E4/b*1E3|0);for(const d of a.entries())e.push([d[0],ta(d[1])[0]]),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}
function wa(a,b){b||(b=new Map);for(let c=0,e,d;c<a.length;c++)e=a[c],d=b.get(e[0]),b.set(e[0],ua(e[1],d));return b}function xa(a){let b=[],c=[];for(const e of a.keys())c.push(e),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}function ya(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}
function za(a,b,c,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,b,d,f+1);if((h=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return za.call(l,a,b,c,k?e:null,d,f,g+1)})}return za.call(this,a,b,c,k?e:null,d,f,g+1)};function Aa(a,b,c,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=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;g<b.index.length;g++){k=b.index[g];h=k.indexOf(d);if(0<=h)return f+h;f+=k.length}return-1};if("includes"===e)return function(d){for(let f=
0;f<b.index.length;f++)if(b.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return ya(b,d||0,f||b.length,!1)};if("splice"===e)return function(d,f){return ya(b,d||0,f||b.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(c=b.index[e/2**31|0])&&c[e]},set(c,e,d){c=e/2**31|0;(b.index[c]||(b.index[c]=[]))[e]=d;b.length++;return!0}})}S.prototype.clear=function(){this.index.length=0};S.prototype.destroy=function(){this.proxy=this.index=null};
S.prototype.push=function(){};function T(a=8){if(!this)return new T(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=za,this.A=BigInt(a)):(this.h=Aa,this.A=a)}T.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};T.prototype.set=function(a,b){var c=this.h(a);let e=this.index[c];e?(c=e.size,e.set(a,b),(c-=e.size)&&this.size++):(this.index[c]=e=new Map([[a,b]]),this.B.push(e))};
function U(a=8){if(!this)return new U(a);this.index=B();this.h=[];32<a?(this.B=za,this.A=BigInt(a)):(this.B=Aa,this.A=a)}U.prototype.add=function(a){var b=this.B(a);let 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))};t=T.prototype;t.has=U.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};t.delete=U.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
0;f<b.index.length;f++)if(b.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return Aa(b,d||0,f||b.length,!1)};if("splice"===e)return function(d,f){return Aa(b,d||0,f||b.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(c=b.index[e/2**31|0])&&c[e]},set(c,e,d){c=e/2**31|0;(b.index[c]||(b.index[c]=[]))[e]=d;b.length++;return!0}})}S.prototype.clear=function(){this.index.length=0};S.prototype.destroy=function(){this.proxy=this.index=null};
S.prototype.push=function(){};function T(a=8){if(!this)return new T(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=Ba,this.A=BigInt(a)):(this.h=Ca,this.A=a)}T.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};T.prototype.set=function(a,b){var c=this.h(a);let e=this.index[c];e?(c=e.size,e.set(a,b),(c-=e.size)&&this.size++):(this.index[c]=e=new Map([[a,b]]),this.B.push(e))};
function U(a=8){if(!this)return new U(a);this.index=B();this.h=[];32<a?(this.B=Ba,this.A=BigInt(a)):(this.B=Ca,this.A=a)}U.prototype.add=function(a){var b=this.B(a);let 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))};t=T.prototype;t.has=U.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};t.delete=U.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
t.clear=U.prototype.clear=function(){this.index=B();this.h=[];this.size=0};t.values=U.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};t.keys=U.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};t.entries=U.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function Aa(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,e=this.A+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.A?c+2**31:c}function za(a){let b=BigInt(2)**this.A-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};V.prototype.add=function(a,b,c){I(a)&&(b=a,a=ba(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let k=0,h;k<this.field.length;k++){h=this.D[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(b);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(b))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),Ba(b,h,this.J,0,e,a,h[0],c)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let k=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
function Ca(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,e=this.A+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.A?c+2**31:c}function Ba(a){let b=BigInt(2)**this.A-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};V.prototype.add=function(a,b,c){I(a)&&(b=a,a=ba(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let k=0,h;k<this.field.length;k++){h=this.D[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(b);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(b))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),Da(b,h,this.J,0,e,a,h[0],c)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let k=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.I;if(g&&!g(b))continue;f.constructor===String&&(f=""+f);f=ba(b,f)}if(d&&f){E(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)if(l=f[h],!k[l]&&(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new S(m);if(this.fastupdate)for(let n of this.reg.values())n.includes(m)&&(n[n.indexOf(m)]=g);d.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let k;if(this.C){k=B();for(let h=0,l;h<this.C.length;h++){l=
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ca(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}}return this};function Ca(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ca(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ca(a,b,c,e,d)}
function Ba(a,b,c,e,d,f,g,k){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Ba(a,b,c,e,d,f,g,k);else g=b[++e],Ba(a,b,c,e,d,f,g,k);else d.db&&d.remove(f)};function Da(a,b,c,e,d,f,g){const k=a.length;let h=[],l;var m;l=B();for(let n=0,p,q,r,u;n<b;n++)for(let v=0;v<k;v++)if(r=a[v],n<r.length&&(p=r[n]))for(let x=0;x<p.length;x++)q=p[x],(m=l[q])?l[q]++:(m=0,l[q]=1),u=h[m]||(h[m]=[]),g||(m=n+(v||!d?0:f||0),u=u[m]||(u[m]=[])),u.push(q);if(a=h.length)if(d)h=1<h.length?Ea(h,c,e,g,f):(h=h[0]).length>c||e?h.slice(e,c+e):h;else{if(a<k)return[];h=h[a-1];if(c||e)if(g){if(h.length>c||e)h=h.slice(e,c+e)}else{d=[];for(let n=0,p;n<h.length;n++)if(p=h[n],p.length>e)e-=
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ea(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}}return this};function Ea(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ea(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ea(a,b,c,e,d)}
function Da(a,b,c,e,d,f,g,k){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Da(a,b,c,e,d,f,g,k);else g=b[++e],Da(a,b,c,e,d,f,g,k);else d.db&&d.remove(f)};function Fa(a,b,c,e,d,f,g){const k=a.length;let h=[],l;var m;l=B();for(let n=0,p,q,r,u;n<b;n++)for(let v=0;v<k;v++)if(r=a[v],n<r.length&&(p=r[n]))for(let x=0;x<p.length;x++)q=p[x],(m=l[q])?l[q]++:(m=0,l[q]=1),u=h[m]||(h[m]=[]),g||(m=n+(v||!d?0:f||0),u=u[m]||(u[m]=[])),u.push(q);if(a=h.length)if(d)h=1<h.length?Ga(h,c,e,g,f):(h=h[0]).length>c||e?h.slice(e,c+e):h;else{if(a<k)return[];h=h[a-1];if(c||e)if(g){if(h.length>c||e)h=h.slice(e,c+e)}else{d=[];for(let n=0,p;n<h.length;n++)if(p=h[n],p.length>e)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}h=1<d.length?[].concat.apply([],d):d[0]}}return h}
function Ea(a,b,c,e,d){const f=[],g=B();let k;var h=a.length;let l;if(e)for(d=h-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(h=0;h<l;h++)if(k=e[h],!g[k])if(g[k]=1,c)c--;else if(f.push(k),f.length===b)return f}else for(let m=h-1,n,p=0;0<=m;m--){n=a[m];for(let q=0;q<n.length;q++)if(l=(e=n[q])&&e.length)for(let r=0;r<l;r++)if(k=e[r],!g[k])if(g[k]=1,c)c--;else{let u=(q+(m<h-1?d||0:0))/(m+1)|0;(f[u]||(f[u]=[])).push(k);if(++p===b)return f}}return f}
function Fa(a,b,c){const e=B(),d=[];for(let f=0,g;f<b.length;f++){g=b[f];for(let k=0;k<g.length;k++)e[g[k]]=1}if(c)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,k;f<a.result.length;f++)for(g=a.result[f],b=0;b<g.length;b++)k=g[b],e[k]&&((d[f]||(d[f]=[])).push(k),e[k]=0);return d};function Ga(a,b,c,e){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,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)){if(c){if(c>=k){c-=k;continue}c<k&&(g=b?g.slice(c,c+b):g.slice(c),k=g.length,c=0)}k>b&&(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=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ha(a,b,c){var e=c[0];if(e.then)return Promise.all(c).then(function(m){return a[b].apply(a,m)});if(e[0]&&e[0].index)return a[b].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<c.length;m++)if(n=c[m]){let p;if(n.constructor===X)p=n.result;else if(n.constructor===Array)p=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,p=n.index.search(n).result,n.resolve=h;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=a.xor(n.xor);
else if(n.not)p=a.not(n.not);else continue;if(p.then)d.push(p);else if(p.length)e[m]=p;else if(!l&&("and"===b||"xor"===b)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};X.prototype.or=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f}=Ha(this,"or",arguments);return Ia.call(this,a,b,c,e,d,f)};function Ia(a,b,c,e,d,f){if(b.length){const g=this;return Promise.all(b).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ia.call(g,a,[],c,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=Ea(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:m,suggest:n}=Ha(this,"and",arguments);return Ja.call(this,f,g,k,h,l,m,n)}return d?this.resolve(b,c,e):this};
function Ja(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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ja.call(k,a,[],c,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(b=ca(a))return this.result=Da(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}=Ha(this,"xor",arguments);return Ka.call(this,a,b,c,e,d,f,g)};
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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ka.call(k,a,[],c,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=La.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 La(a,b,c,e,d){const f=[],g=B();let k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let p=0,q;p<n.length;p++)q=n[p],g[q]=g[q]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,p;n<a.length;n++)if(p=a[n])if(l=p[h])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(f.push(r),f.length===b)return f}else{const u=h+(n?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++m===b)return f}return f};X.prototype.not=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f,suggest:g}=Ha(this,"not",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 k=this;return Promise.all(b).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ma.call(k,a,[],c,e,d,f,g)})}if(a.length&&this.result.length)this.result=Na.call(this,a,c,e,f);else if(f)return this.resolve(c,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Na(a,b,c,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=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))if(c)c--;else if(e){if(d.push(l),d.length===b)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===b)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])if(e.length<=a){if(b[c]=e,a-=e.length,!a)break}else{b[c]=e.slice(0,a);break}this.result=b}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])e.length<=a?a-=e.length:(b[c]=e.slice(a),a=0);this.result=b}return this};X.prototype.boost=function(a){this.h+=a;return this};X.prototype.resolve=function(a,b,c){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),Ga.call(d,e,a||100,b,c)):e};B();V.prototype.search=function(a,b,c,e){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let d=[],f=[],g;let k;let h;let l,m=0;let n;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;k=c.merge;h=g||c.field||(h=c.index)&&(h.index?null:h);var p=this.tag&&c.tag;var q=c.suggest;var r=!1!==c.resolve;r||g||!(h=h||this.field)||(E(h)?g=h:(h.constructor===Array&&1===h.length&&(h=h[0]),g=h.field||h.index));var u=this.store&&c.enrich&&r;n=c.highlight&&u;b=c.limit||b;l=c.offset||0;b||(b=100);if(p&&(!this.db||
!e)){p.constructor!==Array&&(p=[p]);var v=[];for(let z=0,w;z<p.length;z++)if(w=p[z],w.field&&w.tag){var x=w.tag;if(x.constructor===Array)for(var y=0;y<x.length;y++)v.push(w.field,x[y]);else v.push(w.field,x)}else{x=Object.keys(w);for(let D=0,G,C;D<x.length;D++)if(G=x[D],C=w[G],C.constructor===Array)for(y=0;y<C.length;y++)v.push(G,C[y]);else v.push(G,C)}p=v;if(!a){q=[];if(v.length)for(p=0;p<v.length;p+=2){if(this.db){r=this.index.get(v[p]);if(!r)continue;q.push(r=r.db.tag(v[p+1],b,l,u))}else r=Oa.call(this,
function Ga(a,b,c,e,d){const f=[],g=B();let k;var h=a.length;let l;if(e)for(d=h-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(h=0;h<l;h++)if(k=e[h],!g[k])if(g[k]=1,c)c--;else if(f.push(k),f.length===b)return f}else for(let m=h-1,n,p=0;0<=m;m--){n=a[m];for(let q=0;q<n.length;q++)if(l=(e=n[q])&&e.length)for(let r=0;r<l;r++)if(k=e[r],!g[k])if(g[k]=1,c)c--;else{let u=(q+(m<h-1?d||0:0))/(m+1)|0;(f[u]||(f[u]=[])).push(k);if(++p===b)return f}}return f}
function Ha(a,b,c){const e=B(),d=[];for(let f=0,g;f<b.length;f++){g=b[f];for(let k=0;k<g.length;k++)e[g[k]]=1}if(c)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,k;f<a.result.length;f++)for(g=a.result[f],b=0;b<g.length;b++)k=g[b],e[k]&&((d[f]||(d[f]=[])).push(k),e[k]=0);return d};function Ia(a,b,c,e){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,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)){if(c){if(c>=k){c-=k;continue}c<k&&(g=b?g.slice(c,c+b):g.slice(c),k=g.length,c=0)}k>b&&(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=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ja(a,b,c){var e=c[0];if(e.then)return Promise.all(c).then(function(m){return a[b].apply(a,m)});if(e[0]&&e[0].index)return a[b].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<c.length;m++)if(n=c[m]){let p;if(n.constructor===X)p=n.result;else if(n.constructor===Array)p=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,p=n.index.search(n).result,n.resolve=h;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=a.xor(n.xor);
else if(n.not)p=a.not(n.not);else continue;if(p.then)d.push(p);else if(p.length)e[m]=p;else if(!l&&("and"===b||"xor"===b)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};X.prototype.or=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f}=Ja(this,"or",arguments);return Ka.call(this,a,b,c,e,d,f)};function Ka(a,b,c,e,d,f){if(b.length){const g=this;return Promise.all(b).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ka.call(g,a,[],c,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.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:k,offset:h,enrich:l,resolve:m,suggest:n}=Ja(this,"and",arguments);return La.call(this,f,g,k,h,l,m,n)}return d?this.resolve(b,c,e):this};
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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return La.call(k,a,[],c,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.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 k=this;return Promise.all(b).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ma.call(k,a,[],c,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=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 k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let p=0,q;p<n.length;p++)q=n[p],g[q]=g[q]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,p;n<a.length;n++)if(p=a[n])if(l=p[h])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(f.push(r),f.length===b)return f}else{const u=h+(n?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++m===b)return f}return f};X.prototype.not=function(){const {O:a,P:b,limit:c,offset:e,enrich:d,resolve:f,suggest:g}=Ja(this,"not",arguments);return Oa.call(this,a,b,c,e,d,f,g)};function Oa(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,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Oa.call(k,a,[],c,e,d,f,g)})}if(a.length&&this.result.length)this.result=Pa.call(this,a,c,e,f);else if(f)return this.resolve(c,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Pa(a,b,c,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=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))if(c)c--;else if(e){if(d.push(l),d.length===b)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===b)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])if(e.length<=a){if(b[c]=e,a-=e.length,!a)break}else{b[c]=e.slice(0,a);break}this.result=b}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];for(let c=0,e;c<this.result.length;c++)if(e=this.result[c])e.length<=a?a-=e.length:(b[c]=e.slice(a),a=0);this.result=b}return this};X.prototype.boost=function(a){this.h+=a;return this};X.prototype.resolve=function(a,b,c){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),Ia.call(d,e,a||100,b,c)):e};B();V.prototype.search=function(a,b,c,e){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let d=[],f=[],g;let k;let h;let l,m=0;let n;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;k=c.merge;h=g||c.field||(h=c.index)&&(h.index?null:h);var p=this.tag&&c.tag;var q=c.suggest;var r=!1!==c.resolve;r||g||!(h=h||this.field)||(E(h)?g=h:(h.constructor===Array&&1===h.length&&(h=h[0]),g=h.field||h.index));var u=this.store&&c.enrich&&r;n=c.highlight&&u;b=c.limit||b;l=c.offset||0;b||(b=100);if(p&&(!this.db||
!e)){p.constructor!==Array&&(p=[p]);var v=[];for(let z=0,w;z<p.length;z++)if(w=p[z],w.field&&w.tag){var x=w.tag;if(x.constructor===Array)for(var y=0;y<x.length;y++)v.push(w.field,x[y]);else v.push(w.field,x)}else{x=Object.keys(w);for(let D=0,G,C;D<x.length;D++)if(G=x[D],C=w[G],C.constructor===Array)for(y=0;y<C.length;y++)v.push(G,C[y]);else v.push(G,C)}p=v;if(!a){q=[];if(v.length)for(p=0;p<v.length;p+=2){if(this.db){r=this.index.get(v[p]);if(!r)continue;q.push(r=r.db.tag(v[p+1],b,l,u))}else r=Qa.call(this,
v[p],v[p+1],b,l,u);d.push({field:v[p],tag:v[p+1],result:r})}return q.length?Promise.all(q).then(function(z){for(let w=0;w<z.length;w++)d[w].result=z[w];return d}):d}}h&&h.constructor!==Array&&(h=[h])}h||(h=this.field);v=!e&&(this.worker||this.db)&&[];let F;for(let z=0,w,D,G;z<h.length;z++){D=h[z];if(this.db&&this.tag&&!this.D[z])continue;let C;E(D)||(C=D,D=C.field,a=C.query||a,b=C.limit||b,l=C.offset||l,q=C.suggest||q,u=this.store&&(C.enrich||u));if(e)w=e[z];else if(x=C||c,y=this.index.get(D),p&&
(this.db&&(x.tag=p,F=y.db.support_tag_search,x.field=h),F||(x.enrich=!1)),v){v[z]=y.search(a,b,x);x&&u&&(x.enrich=u);continue}else w=y.search(a,b,x),x&&u&&(x.enrich=u);G=w&&(r?w.length:w.result.length);if(p&&G){x=[];y=0;if(this.db&&e){if(!F)for(let H=h.length;H<e.length;H++){let K=e[H];if(K&&K.length)y++,x.push(K);else if(!q)return r?d:new X(d)}}else for(let H=0,K,lb;H<p.length;H+=2){K=this.tag.get(p[H]);if(!K)if(q)continue;else return r?d:new X(d);if(lb=(K=K&&K.get(p[H+1]))&&K.length)y++,x.push(K);
else if(!q)return r?d:new X(d)}if(y){w=Fa(w,x,r);G=w.length;if(!G&&!q)return r?w:new X(w);y--}}if(G)f[m]=D,d.push(w),m++;else if(1===h.length)return r?d:new X(d)}if(v){if(this.db&&p&&p.length&&!F)for(u=0;u<p.length;u+=2){e=this.index.get(p[u]);if(!e)if(q)continue;else return r?d:new X(d);v.push(e.db.tag(p[u+1],b,l,!1))}const z=this;return Promise.all(v).then(function(w){return w.length?z.search(a,b,c,w):w})}if(!m)return r?d:new X(d);if(g&&(!u||!this.store))return d[0];v=[];for(let z=0,w;z<f.length;z++){w=
d[z];u&&w.length&&!w[0].doc&&(this.db?v.push(w=this.index.get(this.field[0]).db.enrich(w)):w=W.call(this,w));if(g)return r?w:new X(w);d[z]={field:f[z],result:w}}if(u&&this.db&&v.length){const z=this;return Promise.all(v).then(function(w){for(let D=0;D<w.length;D++)d[D].result=w[D];return k?Pa(d,b):n?Qa(d,a,z.index,z.field,z.D,n):d})}return k?Pa(d,b):n?Qa(d,a,this.index,this.field,this.D,n):d};
function Qa(a,b,c,e,d,f){let g,k,h;for(let m=0,n,p,q,r,u;m<a.length;m++){n=a[m].result;p=a[m].field;r=c.get(p);q=r.encoder;h=r.tokenize;u=d[e.indexOf(p)];q!==g&&(g=q,k=g.encode(b));for(let v=0;v<n.length;v++){let x="";var l=ba(n[v].doc,u);let y=g.encode(l);l=l.split(g.split);for(let F=0,z,w;F<y.length;F++){z=y[F];w=l[F];let D;for(let G=0,C;G<k.length;G++)if(C=k[G],"strict"===h){if(z===C){x+=(x?" ":"")+f.replace("$1",w);D=!0;break}}else{const H=z.indexOf(C);if(-1<H){x+=(x?" ":"")+w.substring(0,H)+
f.replace("$1",w.substring(H,C.length))+w.substring(H+C.length);D=!0;break}}D||(x+=(x?" ":"")+l[F])}n[v].highlight=x}}return a}function Pa(a,b){const c=[],e=B();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],h=l.id,m=e[h])m.push(f.field);else{if(c.length===b)return c;l.field=e[h]=[f.field];c.push(l)}}return c}
function Oa(a,b,c,e,d){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-e)&&0<b){if(b>c||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;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store.get(e)};return b};function V(a){if(!this||this.constructor!==V)return new V(a);const b=a.document||a.doc||a;let c,e;this.D=[];this.field=[];this.J=[];this.key=(c=b.key||b.id)&&Ra(c,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.reg=(this.fastupdate=!!a.fastupdate)?e?new T(e):new Map:e?new U(e):new Set;this.C=(c=b.store||null)&&c&&!0!==c&&[];this.store=c&&(e?new T(e):new Map);this.cache=(c=a.cache||null)&&new Y(c);a.cache=!1;this.worker=a.worker;this.index=Sa.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===
typeof c&&(c=[c]),c.length){this.tag=new Map;this.F=[];this.R=[];for(let d=0,f,g;d<c.length;d++){f=c[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.F[d]=f.custom:(this.F[d]=Ra(g,this.J),f.filter&&("string"===typeof this.F[d]&&(this.F[d]=new String(this.F[d])),this.F[d].I=f.filter));this.R[d]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const d of this.index.values())d.then&&a.push(d);if(a.length){const d=this;return Promise.all(a).then(function(f){let g=
(this.db&&(x.tag=p,F=y.db.support_tag_search,x.field=h),F||(x.enrich=!1)),v){v[z]=y.search(a,b,x);x&&u&&(x.enrich=u);continue}else w=y.search(a,b,x),x&&u&&(x.enrich=u);G=w&&(r?w.length:w.result.length);if(p&&G){x=[];y=0;if(this.db&&e){if(!F)for(let H=h.length;H<e.length;H++){let K=e[H];if(K&&K.length)y++,x.push(K);else if(!q)return r?d:new X(d)}}else for(let H=0,K,nb;H<p.length;H+=2){K=this.tag.get(p[H]);if(!K)if(q)continue;else return r?d:new X(d);if(nb=(K=K&&K.get(p[H+1]))&&K.length)y++,x.push(K);
else if(!q)return r?d:new X(d)}if(y){w=Ha(w,x,r);G=w.length;if(!G&&!q)return r?w:new X(w);y--}}if(G)f[m]=D,d.push(w),m++;else if(1===h.length)return r?d:new X(d)}if(v){if(this.db&&p&&p.length&&!F)for(u=0;u<p.length;u+=2){e=this.index.get(p[u]);if(!e)if(q)continue;else return r?d:new X(d);v.push(e.db.tag(p[u+1],b,l,!1))}const z=this;return Promise.all(v).then(function(w){return w.length?z.search(a,b,c,w):w})}if(!m)return r?d:new X(d);if(g&&(!u||!this.store))return d[0];v=[];for(let z=0,w;z<f.length;z++){w=
d[z];u&&w.length&&!w[0].doc&&(this.db?v.push(w=this.index.get(this.field[0]).db.enrich(w)):w=W.call(this,w));if(g)return r?w:new X(w);d[z]={field:f[z],result:w}}if(u&&this.db&&v.length){const z=this;return Promise.all(v).then(function(w){for(let D=0;D<w.length;D++)d[D].result=w[D];return k?Ra(d,b):n?Sa(d,a,z.index,z.field,z.D,n):d})}return k?Ra(d,b):n?Sa(d,a,this.index,this.field,this.D,n):d};
function Sa(a,b,c,e,d,f){let g,k,h;for(let m=0,n,p,q,r,u;m<a.length;m++){n=a[m].result;p=a[m].field;r=c.get(p);q=r.encoder;h=r.tokenize;u=d[e.indexOf(p)];q!==g&&(g=q,k=g.encode(b));for(let v=0;v<n.length;v++){let x="";var l=ba(n[v].doc,u);let y=g.encode(l);l=l.split(g.split);for(let F=0,z,w;F<y.length;F++){z=y[F];w=l[F];let D;for(let G=0,C;G<k.length;G++)if(C=k[G],"strict"===h){if(z===C){x+=(x?" ":"")+f.replace("$1",w);D=!0;break}}else{const H=z.indexOf(C);if(-1<H){x+=(x?" ":"")+w.substring(0,H)+
f.replace("$1",w.substring(H,C.length))+w.substring(H+C.length);D=!0;break}}D||(x+=(x?" ":"")+l[F])}n[v].highlight=x}}return a}function Ra(a,b){const c=[],e=B();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],h=l.id,m=e[h])m.push(f.field);else{if(c.length===b)return c;l.field=e[h]=[f.field];c.push(l)}}return c}
function Qa(a,b,c,e,d){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-e)&&0<b){if(b>c||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;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store.get(e)};return b};function V(a){if(!this||this.constructor!==V)return new V(a);const b=a.document||a.doc||a;let c,e;this.D=[];this.field=[];this.J=[];this.key=(c=b.key||b.id)&&Ta(c,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.reg=(this.fastupdate=!!a.fastupdate)?e?new T(e):new Map:e?new U(e):new Set;this.C=(c=b.store||null)&&c&&!0!==c&&[];this.store=c&&(e?new T(e):new Map);this.cache=(c=a.cache||null)&&new Y(c);a.cache=!1;this.worker=a.worker;this.index=Ua.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===
typeof c&&(c=[c]),c.length){this.tag=new Map;this.F=[];this.R=[];for(let d=0,f,g;d<c.length;d++){f=c[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.F[d]=f.custom:(this.F[d]=Ta(g,this.J),f.filter&&("string"===typeof this.F[d]&&(this.F[d]=new String(this.F[d])),this.F[d].I=f.filter));this.R[d]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const d of this.index.values())d.then&&a.push(d);if(a.length){const d=this;return Promise.all(a).then(function(f){let g=
0;for(const k of d.index.entries()){const h=k[0];k[1].then&&d.index.set(h,f[g++])}return d})}}else a.db&&this.mount(a.db)}t=V.prototype;
t.mount=function(a){let b=this.field;if(this.tag)for(let d=0,f;d<this.R.length;d++){f=this.R[d];var c=void 0;this.index.set(f,c=new M({},this.reg));b===this.field&&(b=b.slice(0));b.push(f);c.tag=this.tag.get(f)}c=[];const e={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let d=0,f,g;d<b.length;d++){e.field=g=b[d];f=this.index.get(g);const k=new a.constructor(a.id,e);k.id=a.id;c[d]=k.mount(f);f.document=!0;d?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(c)};
t.mount=function(a){let b=this.field;if(this.tag)for(let d=0,f;d<this.R.length;d++){f=this.R[d];var c=void 0;this.index.set(f,c=new O({},this.reg));b===this.field&&(b=b.slice(0));b.push(f);c.tag=this.tag.get(f)}c=[];const e={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let d=0,f,g;d<b.length;d++){e.field=g=b[d];f=this.index.get(g);const k=new a.constructor(a.id,e);k.id=a.id;c[d]=k.mount(f);f.document=!0;d?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(c)};
t.commit=async function(a,b){const c=[];for(const e of this.index.values())c.push(e.db.commit(e,a,b));await Promise.all(c);this.reg.clear()};t.destroy=function(){const a=[];for(const b of this.index.values())a.push(b.destroy());return Promise.all(a)};
function Sa(a,b){const c=new Map;let e=b.index||b.field||b;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++){f=e[d];E(f)||(g=f,f=f.field);g=I(g)?Object.assign({},a,g):a;if(this.worker){const k=new N(g);c.set(f,k)}this.worker||c.set(f,new M(g,this.reg));g.custom?this.D[d]=g.custom:(this.D[d]=Ra(f,this.J),g.filter&&("string"===typeof this.D[d]&&(this.D[d]=new String(this.D[d])),this.D[d].I=g.filter));this.field[d]=f}if(this.C){a=b.store;E(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?
(this.C[d]=f.custom,f.custom.V=g):(this.C[d]=Ra(g,this.J),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=f.filter))}return c}function Ra(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]}t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)};
function Ua(a,b){const c=new Map;let e=b.index||b.field||b;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++){f=e[d];E(f)||(g=f,f=f.field);g=I(g)?Object.assign({},a,g):a;if(this.worker){const k=new Q(g);c.set(f,k)}this.worker||c.set(f,new O(g,this.reg));g.custom?this.D[d]=g.custom:(this.D[d]=Ta(f,this.J),g.filter&&("string"===typeof this.D[d]&&(this.D[d]=new String(this.D[d])),this.D[d].I=g.filter));this.field[d]=f}if(this.C){a=b.store;E(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?
(this.C[d]=f.custom,f.custom.V=g):(this.C[d]=Ta(g,this.J),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=f.filter))}return c}function Ta(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]}t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)};
t.remove=function(a){I(a)&&(a=ba(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let e of c){b=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):c.delete(b))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
t.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};t.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};t.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};t.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};
t.set=function(a,b){this.store.set(a,b);return this};t.searchCache=Ta;
t.export=function(a,b,c=0,e=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,e=1))&&b.then){const k=this;return b.then(function(){return k.export(a,g,c+1)})}return this.export(a,g,c+1)}let d,f;switch(e){case 0:d="reg";f=va(this.reg);b=null;break;case 1:d="tag";f=ta(this.tag,this.reg.size);b=null;break;case 2:d="doc";f=ra(this.store);b=null;break;case 3:d="cfg";b=f=null;break;default:return}return xa.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=wa(b,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=ua(b,this.tag);break;case "doc":this.store=sa(b,this.store)}}};na(V.prototype);function Ta(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.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 Ua={normalize:function(a){return a.toLowerCase()}};const Va=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 Wa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Xa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ya={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 Za=/[\x00-\x7F]+/g;const $a=/[\x00-\x7F]+/g;const ab=/[\x00-\x7F]+/g;var bb={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ua,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Va},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Va,matcher:Wa,replacer:Xa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Va,replacer:Xa.concat([/(?!^)[aeo]/g,""]),matcher:Wa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=Ya[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=Ya[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Za," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace($a,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ab," ")}}};const cb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};M.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const l=B(),m=B(),n=this.depth,p=this.resolution;for(let q=0;q<e;q++){let r=b[this.rtl?e-1-q:q];var d=r.length;if(d&&(n||!m[r])){var f=this.score?this.score(b,r,q,null,0):db(p,e,q),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=r.substring(f,k);var h=this.score?this.score(b,r,q,g,f):db(p,e,q,d,f);eb(this,m,g,h,a,c)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=r[k]+g,h=this.score?this.score(b,r,q,g,k):db(p,e,q,d,k),eb(this,m,g,h,a,c);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[k],eb(this,m,g,f,a,c);break}default:if(eb(this,m,r,f,a,c),n&&1<e&&q<e-1)for(d=B(),g=this.U,f=r,k=Math.min(n+1,e-q),d[f]=1,h=1;h<k;h++)if((r=b[this.rtl?e-1-q-h:q+h])&&!d[r]){d[r]=1;const u=this.score?this.score(b,f,q,r,h):db(g+(e/2>g?0:1),e,q,k-1,h-1),v=this.bidirectional&&r>f;eb(this,l,v?f:r,u,a,c,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.T&&fb(this));return this};function eb(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 db(a,b,c,e,d){return c&&1<a?b+(e||0)<=a?c+(d||0):(a-1)/(b+(e||0))*(c+(d||0))+1|0:0};M.prototype.search=function(a,b,c){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let e=[],d,f,g,k=0,h,l,m,n,p;c?(a=c.query||a,b=c.limit||b,k=c.offset||0,f=c.context,g=c.suggest,p=(h=!1!==c.resolve)&&c.enrich,m=c.boost,n=c.resolution,l=this.db&&c.tag):h=this.resolve;let q=this.encoder.encode(a);d=q.length;b=b||(h?100:0);if(1===d)return gb.call(this,q[0],"",b,k,h,p,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return gb.call(this,q[0],q[1],b,k,h,p,l);let r=B(),u=0,v;1<d&&f&&(v=q[0],u=1);n||0===n||(n=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,q,b,k,g,h,p,l),!1!==a))return a;const x=this;return async function(){for(let y,F;u<d;u++){if((F=q[u])&&!r[F]){r[F]=1;y=await hb(x,F,v,0,0,!1,!1);if(y=ib(y,e,g,n)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(v="",u=-1,r=B())}return jb(e,n,b,k,g,m,h)}()}for(let x,y;u<d;u++){if((y=q[u])&&!r[y]){r[y]=1;x=hb(this,y,v,0,0,!1,!1);if(x=ib(x,e,g,n)){e=x;break}v&&(g&&x&&e.length||(v=y))}g&&v&&u===d-1&&!e.length&&(v="",
u=-1,r=B())}return jb(e,n,b,k,g,m,h)};function jb(a,b,c,e,d,f,g){let k=a.length,h=a;if(1<k)h=Da(a,b,c,e,d,f,g);else if(1===k)return g?Ga.call(null,a[0],c,e):new X(a[0]);return g?h:new X(h)}function gb(a,b,c,e,d,f,g){a=hb(this,a,b,c,e,d,f,g);return this.db?a.then(function(k){return d?k||[]:new X(k)}):a&&a.length?d?Ga.call(this,a,c,e):new X(a):d?[]:new X}
function ib(a,b,c,e){let d=[];if(a&&a.length){if(a.length<=e){b.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){b.push(d);return}}if(!c)return d}function hb(a,b,c,e,d,f,g,k){let h;c&&(h=a.bidirectional&&b>c)&&(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};M.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;e<c.length;e++){if(d=c[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===c.length-1?d.pop():d.splice(f,1)}}else kb(this.map,a),this.depth&&kb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&fb(this));this.cache&&this.cache.remove(a);return this};
function kb(a,b){let c=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(b),0<=f){1<d.length?(d.splice(f,1),c++):delete a[e];break}else c++}else for(let e of a.entries()){const d=e[0],f=kb(e[1],b);f?c+=f:a.delete(d)}return c};function M(a,b){if(!this||this.constructor!==M)return new M(a);if(a){var c=E(a)?a:a.preset;c&&(a=Object.assign({},cb[c],a))}else a={};c=a.context;const e=!0===c?{depth:1}:c||{},d=E(a.encoder)?bb[a.encoder]:a.encode||a.encoder||Ua;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=c=a.tokenize||"strict";this.depth="strict"===c&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(c=a.keystore||
0)&&(this.keystore=c);this.map=c?new T(c):new Map;this.ctx=c?new T(c):new Map;this.reg=b||(this.fastupdate?c?new T(c):new Map:c?new U(c):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(c=a.cache||null)&&new Y(c);this.resolve=!1!==a.resolve;if(c=a.db)this.db=this.mount(c);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=M.prototype;t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
t.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function fb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
t.set=function(a,b){this.store.set(a,b);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,e=1))&&b.then){const k=this;return b.then(function(){return k.export(a,g,c+1)})}return this.export(a,g,c+1)}let d,f;switch(e){case 0:d="reg";f=xa(this.reg);b=null;break;case 1:d="tag";f=va(this.tag,this.reg.size);b=null;break;case 2:d="doc";f=ta(this.store);b=null;break;case 3:d="cfg";b=f=null;break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=wa(b,this.tag);break;case "doc":this.store=ua(b,this.store)}}};la(V.prototype);function Va(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.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"],["pf","f"]]),Za=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\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:{normalize:!1,dedupe:!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;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=$a[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=$a[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ab," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(bb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(cb," ")}}};const eb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const l=B(),m=B(),n=this.depth,p=this.resolution;for(let q=0;q<e;q++){let r=b[this.rtl?e-1-q:q];var d=r.length;if(d&&(n||!m[r])){var f=this.score?this.score(b,r,q,null,0):fb(p,e,q),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=r.substring(f,k);var h=this.score?this.score(b,r,q,g,f):fb(p,e,q,d,f);gb(this,m,g,h,a,c)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=r[k]+g,h=this.score?this.score(b,r,q,g,k):fb(p,e,q,d,k),gb(this,m,g,h,a,c);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[k],gb(this,m,g,f,a,c);break}default:if(gb(this,m,r,f,a,c),n&&1<e&&q<e-1)for(d=B(),g=this.U,f=r,k=Math.min(n+1,e-q),d[f]=1,h=1;h<k;h++)if((r=b[this.rtl?e-1-q-h:q+h])&&!d[r]){d[r]=1;const u=this.score?this.score(b,f,q,r,h):fb(g+(e/2>g?0:1),e,q,k-1,h-1),v=this.bidirectional&&r>f;gb(this,l,v?f:r,u,a,c,v?r: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 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 fb(a,b,c,e,d){return c&&1<a?b+(e||0)<=a?c+(d||0):(a-1)/(b+(e||0))*(c+(d||0))+1|0:0};O.prototype.search=function(a,b,c){c||(!b&&I(a)?(c=a,a=""):I(b)&&(c=b,b=0));let e=[],d,f,g,k=0,h,l,m,n,p;c?(a=c.query||a,b=c.limit||b,k=c.offset||0,f=c.context,g=c.suggest,p=(h=!1!==c.resolve)&&c.enrich,m=c.boost,n=c.resolution,l=this.db&&c.tag):h=this.resolve;let q=this.encoder.encode(a);d=q.length;b=b||(h?100:0);if(1===d)return ib.call(this,q[0],"",b,k,h,p,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return ib.call(this,q[0],q[1],b,k,h,p,l);let r=B(),u=0,v;1<d&&f&&(v=q[0],u=1);n||0===n||(n=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,q,b,k,g,h,p,l),!1!==a))return a;const x=this;return async function(){for(let y,F;u<d;u++){if((F=q[u])&&!r[F]){r[F]=1;y=await jb(x,F,v,0,0,!1,!1);if(y=kb(y,e,g,n)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(v="",u=-1,r=B())}return lb(e,n,b,k,g,m,h)}()}for(let x,y;u<d;u++){if((y=q[u])&&!r[y]){r[y]=1;x=jb(this,y,v,0,0,!1,!1);if(x=kb(x,e,g,n)){e=x;break}v&&(g&&x&&e.length||(v=y))}g&&v&&u===d-1&&!e.length&&(v="",
u=-1,r=B())}return lb(e,n,b,k,g,m,h)};function lb(a,b,c,e,d,f,g){let k=a.length,h=a;if(1<k)h=Fa(a,b,c,e,d,f,g);else if(1===k)return g?Ia.call(null,a[0],c,e):new X(a[0]);return g?h:new X(h)}function ib(a,b,c,e,d,f,g){a=jb(this,a,b,c,e,d,f,g);return this.db?a.then(function(k){return d?k||[]:new X(k)}):a&&a.length?d?Ia.call(this,a,c,e):new X(a):d?[]:new X}
function kb(a,b,c,e){let d=[];if(a&&a.length){if(a.length<=e){b.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){b.push(d);return}}if(!c)return d}function jb(a,b,c,e,d,f,g,k){let h;c&&(h=a.bidirectional&&b>c)&&(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;e<c.length;e++){if(d=c[e])if(2>d.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;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(b),0<=f){1<d.length?(d.splice(f,1),c++):delete a[e];break}else c++}else for(let e of a.entries()){const d=e[0],f=mb(e[1],b);f?c+=f:a.delete(d)}return c};function O(a,b){if(!this||this.constructor!==O)return new O(a);if(a){var c=E(a)?a:a.preset;c&&(a=Object.assign({},eb[c],a))}else a={};c=a.context;const e=!0===c?{depth:1}:c||{},d=E(a.encoder)?db[a.encoder]:a.encode||a.encoder||Wa;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=c=a.tokenize||"strict";this.depth="strict"===c&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(c=a.keystore||
0)&&(this.keystore=c);this.map=c?new T(c):new Map;this.ctx=c?new T(c):new Map;this.reg=b||(this.fastupdate?c?new T(c):new Map:c?new U(c):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(c=a.cache||null)&&new Y(c);this.resolve=!1!==a.resolve;if(c=a.db)this.db=this.mount(c);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=O.prototype;t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
t.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function hb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();this.db&&(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[{clear:!0}]);return this};t.append=function(a,b){return this.add(a,b,!0)};t.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};t.update=function(a,b){const c=this,e=this.remove(a);return e&&e.then?e.then(()=>c.add(a,b)):this.add(a,b)};
function mb(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=mb(c[1]);d?b+=d:a.delete(e)}return b}t.cleanup=function(){if(!this.fastupdate)return this;mb(this.map);this.depth&&mb(this.ctx);return this};t.searchCache=Ta;
t.export=function(a,b,c=0,e=0){let d,f;switch(e){case 0:d="reg";f=va(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=ra(this.map,this.reg.size);break;case 3:d="ctx";f=ta(this.ctx,this.reg.size);break;default:return}return xa.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=wa(b,this.reg);break;case "map":this.map=sa(b,this.map);break;case "ctx":this.ctx=ua(b,this.ctx)}};
function ob(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=ob(c[1]);d?b+=d:a.delete(e)}return b}t.cleanup=function(){if(!this.fastupdate)return this;ob(this.map);this.depth&&ob(this.ctx);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){let d,f;switch(e){case 0:d="reg";f=xa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=ta(this.map,this.reg.size);break;case 3:d="ctx";f=va(this.ctx,this.reg.size);break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);break;case "map":this.map=ua(b,this.map);break;case "ctx":this.ctx=wa(b,this.ctx)}};
t.serialize=function(a=!0){if(!this.reg.size)return"";let b="",c="";for(var e of this.reg.keys())c||(c=typeof e),b+=(b?",":"")+("string"===c?'"'+e+'"':e);b="index.reg=new Set(["+b+"]);";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"===c?'"'+n[l]+'"':n[l]);h="["+h+"]";k+=(k?",":"")+h}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 p=0,q;p<k.length;p++){q=k[p]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+b+e+d+"}":b+e+d};na(M.prototype);const nb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),ob=["map","ctx","tag","reg","cfg"];
function pb(a,b={}){if(!this)return new pb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=pb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
t.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const e=nb.open(a.id+(a.field?":"+a.field:""),1);e.onupgradeneeded=function(){const d=a.db=this.result;ob.forEach(f=>{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.close();this.db=null};t.destroy=function(){const a=nb.deleteDatabase(this.id+(this.field?":"+this.field:""));return Z(a)};t.clear=function(){const a=this.db.transaction(ob,"readwrite");for(let b=0;b<ob.length;b++)a.objectStore(ob[b]).clear();return Z(a)};
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let p=0,q;p<k.length;p++){q=k[p]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+b+e+d+"}":b+e+d};la(O.prototype);const pb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),qb=["map","ctx","tag","reg","cfg"];
function rb(a,b={}){if(!this)return new rb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=rb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
t.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const e=pb.open(a.id+(a.field?":"+a.field:""),1);e.onupgradeneeded=function(){const d=a.db=this.result;qb.forEach(f=>{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.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<qb.length;b++)a.objectStore(qb[b]).clear();return Z(a)};
t.get=function(a,b,c=0,e=0,d=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Z(a).then(function(k){let h=[];if(!k||!k.length)return h;if(d){if(!c&&!e&&1===k.length)return k[0];for(let l=0,m;l<k.length;l++)if((m=k[l])&&m.length){if(e>=m.length){e-=m.length;continue}const n=c?e+Math.min(m.length-e,c):m.length;for(let p=e;p<n;p++)h.push(m[p]);e=0;if(h.length===c)break}return f?g.enrich(h):h}return k})};
t.tag=function(a,b=0,c=0,e=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const d=this;return Z(a).then(function(f){if(!f||!f.length||c>=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<a.length;e++)c[e]=Z(b.get(a[e]));return Promise.all(c).then(function(e){for(let d=0;d<e.length;d++)e[d]={id:a[d],doc:e[d]?JSON.parse(e[d]):null};return e})};t.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Z(a)};t.search=null;t.info=function(){};
@@ -95,7 +95,7 @@ t.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let
for(let m=0,n,p;m<l;m++)if((p=g[m])&&p.length){if((n=k[m])&&n.length)for(h=0;h<p.length;h++)n.push(p[h]);else k[m]=p;h=1}}else k=g,h=1;h&&e.put(k,f)})}}),await this.transaction("ctx","readwrite",function(e){for(const d of a.ctx){const f=d[0],g=d[1];for(const k of g){const h=k[0],l=k[1];l.length&&(b?e.put(l,f+":"+h):e.get(f+":"+h).onsuccess=function(){let m=this.result;var n;if(m&&m.length){const p=Math.max(m.length,l.length);for(let q=0,r,u;q<p;q++)if((u=l[q])&&u.length){if((r=m[q])&&r.length)for(n=
0;n<u.length;n++)r.push(u[n]);else m[q]=u;n=1}}else m=l,n=1;n&&e.put(m,f+":"+h)})}}}),a.store?await this.transaction("reg","readwrite",function(e){for(const d of a.store){const f=d[0],g=d[1];e.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.bypass||await this.transaction("reg","readwrite",function(e){for(const d of a.reg.keys())e.put(1,d)}),a.tag&&await this.transaction("tag","readwrite",function(e){for(const d of a.tag){const f=d[0],g=d[1];g.length&&(e.get(f).onsuccess=function(){let k=this.result;
k=k&&k.length?k.concat(g):g;e.put(k,f)})}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())};
function qb(a,b,c){const e=a.value;let d,f,g=0;for(let k=0,h;k<e.length;k++){if(h=c?e:e[k]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=h.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=h.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(d=1,1<h.length)h.splice(m,1);else{e[k]=[];break}g+=h.length}if(c)break}g?d&&a.update(e):a.delete();a.continue()}
t.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&qb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&qb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&qb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};export default {Index:M,Charset:bb,Encoder:J,Document:V,Worker:N,Resolver:X,IndexedDB:pb,Language:{}};
export const Index=M;export const Charset=bb;export const Encoder=J;export const Document=V;export const Worker=N;export const Resolver=X;export const IndexedDB=pb;export const Language={};
function sb(a,b,c){const e=a.value;let d,f,g=0;for(let k=0,h;k<e.length;k++){if(h=c?e:e[k]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=h.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=h.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(d=1,1<h.length)h.splice(m,1);else{e[k]=[];break}g+=h.length}if(c)break}g?d&&a.update(e):a.delete();a.continue()}
t.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&sb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&sb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&sb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{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={};

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
/**!
* FlexSearch.js v0.8.107 (Bundle)
* FlexSearch.js v0.8.108 (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 v;function A(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 E(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function J(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
(function(self){'use strict';var v;function A(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<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
"u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133","ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],
["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0",
"i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205","e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215",
@@ -21,45 +21,50 @@ v.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);i
v.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&&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,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.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&b.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.D+")$")),g=g.replace(this.N,k=>this.stemmer.get(k)),g.length<this.minlength||this.filter&&this.filter.has(g))&&(g=
"");if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";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,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&&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)}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()};function ia(a){M.call(a,"add");M.call(a,"append");M.call(a,"search");M.call(a,"update");M.call(a,"remove")}let N,ja;const O={},P={};function ka(a){N=0;O[a]=P[a]}
function M(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]);N||(N=setTimeout(ka,0,a),ja=Date.now());P[a]||(P[a]=O[a]=1E3);if(!--O[a]){O[a]=P[a]=P[a]*this.priority*this.priority*3/(Date.now()-ja)|0||1;N=clearTimeout(N);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}};function la(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function ma(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function na(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],la(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function oa(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],ma(e[1],d));return c}function pa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function qa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function Q(a,c,b,e,d,f,g=0){const h=e&&e.constructor===Array;var k=h?e.shift():e;if(!k)return this.export(a,c,d,f+1);if((k=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(k)))&&k.then){const l=this;return k.then(function(){return Q.call(l,a,c,b,h?e:null,d,f,g+1)})}return Q.call(this,a,c,b,h?e:null,d,f,g+1)};R.prototype.add=function(a,c,b){H(a)&&(c=a,a=J(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,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=k.I,!d||d(c))k.constructor===String?k=[""+k]:E(k)&&(k=[k]),ra(c,k,this.J,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let h=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=J(c,f)}if(d&&f){E(f)&&(f=[f]);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]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.A){h=C();for(let k=0,l;k<this.A.length;k++){l=this.A[k];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(E(l)||l.constructor===
String){h[l]=c[l];continue}sa(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};function sa(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++)sa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],sa(a,c,b,e,d)}
function ra(a,c,b,e,d,f,g,h){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)ra(a,c,b,e,d,f,g,h);else g=c[++e],ra(a,c,b,e,d,f,g,h)};function ta(a,c,b,e,d){const f=a.length;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 y=0;y<m.length;y++)n=m[y],(k=h[n])?h[n]++:(k=0,h[n]=1),p=g[k]||(g[k]=[]),p.push(n);if(a=g.length)if(d)g=1<g.length?ua(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;else{if(a<f)return[];g=g[a-1];if(b||e)if(g.length>b||e)g=g.slice(e,b+e)}return g}
function ua(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;l<h;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}
function va(a,c,b){const e=C(),d=[];for(let f=0,g;f<c.length;f++){g=c[f];for(let h=0;h<g.length;h++)e[g[h]]=1}if(b)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,h;f<a.result.length;f++)for(g=a.result[f],c=0;c<g.length;c++)h=g[c],e[h]&&((d[f]||(d[f]=[])).push(h),e[h]=0);return d};function wa(a,c,b,e){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,e?S.call(this,a):a;let d=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(b){if(b>=h){b-=h;continue}b<h&&(g=c?g.slice(b,b+c):g.slice(b),h=g.length,b=0)}h>c&&(g=g.slice(0,c),h=c);if(!d.length&&h>=c)return e?S.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?S.call(this,d):d};function T(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===U)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=k;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:h,resolve:k,suggest:l}};U.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=T(this,"or",arguments);return xa.call(this,a,c,b,e,d,f)};function xa(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);return xa.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=ua(a,b,e),e=0));return f?this.resolve(b,e,d):this};U.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}=T(this,"and",arguments);return ya.call(this,f,g,h,k,l,m,n)}return d?this.resolve(c,b,e):this};
function ya(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return ya.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{if(c=aa(a))return this.result=ta(a,c,b,e,g),f?d?S.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};U.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=T(this,"xor",arguments);return za.call(this,a,c,b,e,d,f,g)};
function za(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return za.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=Aa.call(this,a,b,e,f,this.h),f?d?S.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Aa(a,c,b,e,d){const f=[],g=C();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++)p=n[t],g[p]=g[p]?2:1}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[k])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=k+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};U.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=T(this,"not",arguments);return Ba.call(this,a,c,b,e,d,f,g)};function Ba(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return Ba.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ca.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?S.call(this.index,this.result):this.result:this}
function Ca(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++h===c)return d;return d};function U(a){if(!this||this.constructor!==U)return new U(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}U.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
U.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};U.prototype.boost=function(a){this.h+=a;return this};U.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),wa.call(d,e,a||100,c,b)):e};C();R.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,h,k,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;h=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;k=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let D=0,F,B;D<u.length;D++)if(F=u[D],B=r[F],B.constructor===Array)for(z=0;z<B.length;z++)w.push(F,B[z]);else w.push(F,B)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Da.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,D,F;x<l.length;x++){D=l[x];let B;E(D)||(B=D,D=B.field,a=B.query||a,c=B.limit||c,n=B.offset||n,k=B.suggest||k,g=this.store&&(B.enrich||g));if(e)r=e[x];else if(u=B||b,z=this.index.get(D),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let I=0,G,Sa;I<m.length;I+=2){G=this.tag.get(m[I]);if(!G)if(k)continue;else return p?d:new U(d);if(Sa=(G=G&&G.get(m[I+1]))&&
G.length)z++,u.push(G);else if(!k)return p?d:new U(d)}if(z){r=va(r,u,p);F=r.length;if(!F&&!k)return p?r:new U(r);z--}}if(F)f[t]=D,d.push(r),t++;else if(1===l.length)return p?d:new U(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new U(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=S.call(this,r));if(y)return p?r:new U(r);d[x]={field:f[x],result:r}}return h?Ea(d,c):q?Fa(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;const c=a.task,b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(a=a.factory)?(Function("return "+a)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e=[N.export]);"import"===c?await N.import.call(M,M):d=M[c].apply(M,e);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 Q,ka;const R={},S={};function la(a){Q=0;R[a]=S[a]}
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]);Q||(Q=setTimeout(la,0,a),ka=Date.now());S[a]||(S[a]=R[a]=1E3);if(!--R[a]){R[a]=S[a]=S[a]*this.priority*this.priority*3/(Date.now()-ka)|0||1;Q=clearTimeout(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 T=0;
function ma(a={}){function c(g){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",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){d.h[++T]=function(){k(d)};d.worker.postMessage({id:T,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});return this}}if(!this||this.constructor!==ma)return new ma(a);let b="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=na(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}U("add");U("append");U("search");U("update");U("remove");U("clear");U("export");U("import");ja(ma.prototype);
function U(a){ma.prototype[a]=async function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.splice(b.length-1,1));e=new Promise(function(f){c.h[++T]=f;c.worker.postMessage({task:a,id:T,args:b})});return d?(e.then(d),this):e}}
function na(a,c,b){return c?"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(D(b)?b:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function oa(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function pa(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function qa(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],oa(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function ra(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],pa(e[1],d));return c}function sa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function ta(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function ua(a,c,b,e,d,f,g=0){const h=e&&e.constructor===Array;var k=h?e.shift():e;if(!k)return this.export(a,c,d,f+1);if((k=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(k)))&&k.then){const l=this;return k.then(function(){return ua.call(l,a,c,b,h?e:null,d,f,g+1)})}return ua.call(this,a,c,b,h?e:null,d,f,g+1)};V.prototype.add=function(a,c,b){H(a)&&(c=a,a=I(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,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=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)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let h=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=I(c,f)}if(d&&f){D(f)&&(f=[f]);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]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.A){h=C();for(let k=0,l;k<this.A.length;k++){l=this.A[k];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(D(l)||l.constructor===
String){h[l]=c[l];continue}wa(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};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++)wa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],wa(a,c,b,e,d)}
function va(a,c,b,e,d,f,g,h){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)va(a,c,b,e,d,f,g,h);else g=c[++e],va(a,c,b,e,d,f,g,h)};function xa(a,c,b,e,d){const f=a.length;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 y=0;y<m.length;y++)n=m[y],(k=h[n])?h[n]++:(k=0,h[n]=1),p=g[k]||(g[k]=[]),p.push(n);if(a=g.length)if(d)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[];g=g[a-1];if(b||e)if(g.length>b||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;l<h;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}
function za(a,c,b){const e=C(),d=[];for(let f=0,g;f<c.length;f++){g=c[f];for(let h=0;h<g.length;h++)e[g[h]]=1}if(b)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,h;f<a.result.length;f++)for(g=a.result[f],c=0;c<g.length;c++)h=g[c],e[h]&&((d[f]||(d[f]=[])).push(h),e[h]=0);return d};function Aa(a,c,b,e){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,e?W.call(this,a):a;let d=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(b){if(b>=h){b-=h;continue}b<h&&(g=c?g.slice(b,b+c):g.slice(b),h=g.length,b=0)}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-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ba(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===X)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=k;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}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}=Ba(this,"or",arguments);return Ca.call(this,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(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);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=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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return Da.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{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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);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=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;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++)p=n[t],g[p]=g[p]?2:1}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[k])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=k+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};X.prototype.not=function(){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 Ga(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return Ga.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)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 Ha(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++h===c)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
X.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};X.prototype.boost=function(a){this.h+=a;return this};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),Aa.call(d,e,a||100,c,b)):e};C();V.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,h,k,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;h=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;k=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let E=0,F,B;E<u.length;E++)if(F=u[E],B=r[F],B.constructor===Array)for(z=0;z<B.length;z++)w.push(F,B[z]);else w.push(F,B)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Ia.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,E,F;x<l.length;x++){E=l[x];let B;D(E)||(B=E,E=B.field,a=B.query||a,c=B.limit||c,n=B.offset||n,k=B.suggest||k,g=this.store&&(B.enrich||g));if(e)r=e[x];else if(u=B||b,z=this.index.get(E),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let J=0,G,Za;J<m.length;J+=2){G=this.tag.get(m[J]);if(!G)if(k)continue;else return p?d:new X(d);if(Za=(G=G&&G.get(m[J+1]))&&
G.length)z++,u.push(G);else if(!k)return p?d:new X(d)}if(z){r=za(r,u,p);F=r.length;if(!F&&!k)return p?r:new X(r);z--}}if(F)f[t]=E,d.push(r),t++;else if(1===l.length)return p?d:new X(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new X(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=W.call(this,r));if(y)return p?r:new X(r);d[x]={field:f[x],result:r}}return h?Ja(d,c):q?Ka(d,
a,this.index,this.field,this.C,q):d};
function Fa(a,c,b,e,d,f){let g,h,k;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;k=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,h=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=J(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,D;x<z.length;x++){r=z[x];D=l[x];let F;for(let B=0,I;B<h.length;B++)if(I=h[B],"strict"===k){if(r===I){u+=(u?" ":"")+f.replace("$1",D);F=!0;break}}else{const G=r.indexOf(I);if(-1<G){u+=(u?" ":"")+D.substring(0,G)+f.replace("$1",
D.substring(G,I.length))+D.substring(G+I.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}function Ea(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=e[k])m.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}function Da(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||e)a=a.slice(e,e+b);d&&(a=S.call(this,a));return a}}
function S(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function R(a){if(!this||this.constructor!==R)return new R(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&V(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;this.cache=(b=a.cache||null)&&new W(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],E(f)||(g=f,f=f.field),g=H(g)?Object.assign({},a,g):a,b.set(f,new X(g,
this.reg)),g.custom?this.C[d]=g.custom:(this.C[d]=V(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;E(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]=V(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;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.B[d]=f.custom:(this.B[d]=V(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 V(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=R.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=J(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Ga;
v.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 h=this;return c.then(function(){return h.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=pa(this.reg);c=null;break;case 1:d="tag";f=na(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=la(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c){"string"===typeof c&&(c=JSON.parse(c));a=a.split(".");"json"===a[a.length-1]&&a.pop();var b=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(b)return this.index.get(b).import(a,c);switch(a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=oa(c,this.tag);break;case "doc":this.store=ma(c,this.store)}}};ia(R.prototype);function Ga(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new W);let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function W(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}W.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
W.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};W.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};W.prototype.clear=function(){this.cache.clear();this.h=""};const Ha={normalize:function(a){return a.toLowerCase()}};const Ia=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 Ja=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ka=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const La={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 Ma=/[\x00-\x7F]+/g;const Na=/[\x00-\x7F]+/g;const Oa=/[\x00-\x7F]+/g;var Pa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ha,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ia},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ia,matcher:Ja,replacer:Ka},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ia,replacer:Ka.concat([/(?!^)[aeo]/g,""]),matcher:Ja},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=La[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=La[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ma," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Na,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Oa," ")}}};const Qa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};X.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){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):Y(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--){g=q.substring(f,h);var k=this.score?this.score(c,q,p,g,f):Y(t,e,p,d,f);Z(this,m,g,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)g=q[h]+g,k=this.score?this.score(c,q,p,g,h):Y(t,e,p,d,h),Z(this,m,g,k,a,b);g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=q[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,h=Math.min(n+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 y=this.score?this.score(c,f,p,q,k):Y(g+(e/2>g?0:1),e,p,h-1,k-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?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 Y(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};X.prototype.search=function(a,c,b){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return Ra.call(this,b[0],"",c,d,h);f=this.depth&&!1!==f;if(2===a&&f&&!g)return Ra.call(this,b[0],b[1],c,d,h);h=C();let l=0;if(1<a&&f){var m=b[0];l=1}k||0===k||(k=m?this.S:this.resolution);for(let q,y;l<a;l++){if((y=b[l])&&!h[y]){h[y]=1;
q=Ta(this,y,m);a:{f=q;var n=e,t=g,p=k;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===a-1&&!e.length&&(m="",l=-1,h=C())}a:{m=e.length;a=e;if(1<m)a=ta(e,k,c,d,g);else if(1===m){g=wa.call(null,e[0],c,d);break a}g=a}return g};function Ra(a,c,b,e,d){a=Ta(this,a,c);d=!0;return a&&a.length?d?wa.call(this,a,b,e):new U(a):d?[]:new U}
function Ta(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);return a};X.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;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else Ua(this.map,a),this.depth&&Ua(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Ua(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=Ua(e[1],c);f?b+=f:a.delete(d)}return b};function X(a,c){if(!this||this.constructor!==X)return new X(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},Qa[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?Pa[a.encoder]:a.encode||a.encoder||Ha;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=a.tokenize||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=
new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new W(b);this.priority=a.priority||4}v=X.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.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 Va(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=Va(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;Va(this.map);this.depth&&Va(this.ctx);return this};v.searchCache=Ga;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=pa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=la(this.map,this.reg.size);break;case 3:d="ctx";f=na(this.ctx,this.reg.size);break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);break;case "map":this.map=ma(c,this.map);break;case "ctx":this.ctx=oa(c,this.ctx)}};
function Ka(a,c,b,e,d,f){let g,h,k;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;k=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,h=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=I(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,E;x<z.length;x++){r=z[x];E=l[x];let F;for(let B=0,J;B<h.length;B++)if(J=h[B],"strict"===k){if(r===J){u+=(u?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=r.indexOf(J);if(-1<G){u+=(u?" ":"")+E.substring(0,G)+f.replace("$1",
E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}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 h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=e[k])m.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}function Ia(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||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;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function V(a){if(!this||this.constructor!==V)return new V(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];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;this.cache=(b=a.cache||null)&&new Y(b);a.cache=!1;b=new Map;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=H(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]=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;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");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 La(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=V.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=I(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Ma;
v.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 h=this;return c.then(function(){return h.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=sa(this.reg);c=null;break;case 1:d="tag";f=qa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=oa(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c){"string"===typeof c&&(c=JSON.parse(c));a=a.split(".");"json"===a[a.length-1]&&a.pop();var b=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(b)return this.index.get(b).import(a,c);switch(a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=ra(c,this.tag);break;case "doc":this.store=pa(c,this.store)}}};ja(V.prototype);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);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.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"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\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:{normalize:!1,dedupe:!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=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:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Sa," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ta,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ua," ")}}};const Wa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){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="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--){g=q.substring(f,h);var k=this.score?this.score(c,q,p,g,f):Xa(t,e,p,d,f);Z(this,m,g,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)g=q[h]+g,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(h=0;h<d;h++)g+=q[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,h=Math.min(n+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 y=this.score?this.score(c,f,p,q,k):Xa(g+(e/2>g?0:1),e,p,h-1,k-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?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&&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){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return Ya.call(this,b[0],"",c,d,h);f=this.depth&&!1!==f;if(2===a&&f&&!g)return Ya.call(this,b[0],b[1],c,d,h);h=C();let l=0;if(1<a&&f){var m=b[0];l=1}k||0===k||(k=m?this.S:this.resolution);for(let q,y;l<a;l++){if((y=b[l])&&!h[y]){h[y]=1;
q=$a(this,y,m);a:{f=q;var n=e,t=g,p=k;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===a-1&&!e.length&&(m="",l=-1,h=C())}a:{m=e.length;a=e;if(1<m)a=xa(e,k,c,d,g);else if(1===m){g=Aa.call(null,e[0],c,d);break a}g=a}return g};function Ya(a,c,b,e,d){a=$a(this,a,c);d=!0;return a&&a.length?d?Aa.call(this,a,b,e):new X(a):d?[]:new X}
function $a(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);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;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else ab(this.map,a),this.depth&&ab(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function ab(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=ab(e[1],c);f?b+=f:a.delete(d)}return b};function O(a,c){if(!this||this.constructor!==O)return new O(a);if(a){var b=D(a)?a:a.preset;b&&(a=Object.assign({},Wa[b],a))}else a={};b=a.context;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||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=
new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new Y(b);this.priority=a.priority||4}v=O.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.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 bb(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=bb(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;bb(this.map);this.depth&&bb(this.ctx);return this};v.searchCache=Ma;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=sa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=oa(this.map,this.reg.size);break;case 3:d="ctx";f=qa(this.ctx,this.reg.size);break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);break;case "map":this.map=pa(c,this.map);break;case "ctx":this.ctx=ra(c,this.ctx)}};
v.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],h="";for(let m=0,n;m<g.length;m++){n=g[m]||[""];var k="";for(var l=0;l<n.length;l++)k+=(k?",":"")+("string"===b?'"'+n[l]+'"':n[l]);k="["+k+"]";h+=(h?",":"")+k}h='["'+f+'",['+h+"]]";e+=(e?",":"")+h}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];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(X.prototype);const Wa={Index:X,Charset:Pa,Encoder:K,Document:R,Worker:null,Resolver:null,IndexedDB:null,Language:{}},Xa=self;let Ya;(Ya=Xa.define)&&Ya.amd?Ya([],function(){return Wa}):"object"===typeof Xa.exports?Xa.exports=Wa:Xa.FlexSearch=Wa;}(this||self));
m[0];g=m[1];for(const n of g.entries()){g=n[0];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ja(O.prototype);const cb={Index:O,Charset:Va,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}},db="undefined"!==typeof self?self:"undefined"!==typeof global?global:"undefined"!==typeof window?window:{};let eb;(eb=db.define)&&eb.amd?eb([],function(){return cb}):"object"===typeof db.exports?db.exports=cb:db.FlexSearch=cb;}(this||self));

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
/**!
* FlexSearch.js v0.8.107 (Bundle)
* FlexSearch.js v0.8.108 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var v;function A(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 E(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function J(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
var v;function A(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<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
"u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133","ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],
["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0",
"i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205","e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215",
@@ -21,46 +21,51 @@ v.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);i
v.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&&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,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.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&b.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.D+")$")),g=g.replace(this.N,k=>this.stemmer.get(k)),g.length<this.minlength||this.filter&&this.filter.has(g))&&(g=
"");if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";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,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&&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)}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()};function ia(a){M.call(a,"add");M.call(a,"append");M.call(a,"search");M.call(a,"update");M.call(a,"remove")}let N,ja;const O={},P={};function ka(a){N=0;O[a]=P[a]}
function M(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]);N||(N=setTimeout(ka,0,a),ja=Date.now());P[a]||(P[a]=O[a]=1E3);if(!--O[a]){O[a]=P[a]=P[a]*this.priority*this.priority*3/(Date.now()-ja)|0||1;N=clearTimeout(N);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}};function la(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function ma(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function na(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],la(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function oa(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],ma(e[1],d));return c}function pa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function qa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function Q(a,c,b,e,d,f,g=0){const h=e&&e.constructor===Array;var k=h?e.shift():e;if(!k)return this.export(a,c,d,f+1);if((k=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(k)))&&k.then){const l=this;return k.then(function(){return Q.call(l,a,c,b,h?e:null,d,f,g+1)})}return Q.call(this,a,c,b,h?e:null,d,f,g+1)};R.prototype.add=function(a,c,b){H(a)&&(c=a,a=J(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,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=k.I,!d||d(c))k.constructor===String?k=[""+k]:E(k)&&(k=[k]),ra(c,k,this.J,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let h=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=J(c,f)}if(d&&f){E(f)&&(f=[f]);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]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.A){h=C();for(let k=0,l;k<this.A.length;k++){l=this.A[k];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(E(l)||l.constructor===
String){h[l]=c[l];continue}sa(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};function sa(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++)sa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],sa(a,c,b,e,d)}
function ra(a,c,b,e,d,f,g,h){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)ra(a,c,b,e,d,f,g,h);else g=c[++e],ra(a,c,b,e,d,f,g,h)};function ta(a,c,b,e,d){const f=a.length;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 y=0;y<m.length;y++)n=m[y],(k=h[n])?h[n]++:(k=0,h[n]=1),p=g[k]||(g[k]=[]),p.push(n);if(a=g.length)if(d)g=1<g.length?ua(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;else{if(a<f)return[];g=g[a-1];if(b||e)if(g.length>b||e)g=g.slice(e,b+e)}return g}
function ua(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;l<h;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}
function va(a,c,b){const e=C(),d=[];for(let f=0,g;f<c.length;f++){g=c[f];for(let h=0;h<g.length;h++)e[g[h]]=1}if(b)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,h;f<a.result.length;f++)for(g=a.result[f],c=0;c<g.length;c++)h=g[c],e[h]&&((d[f]||(d[f]=[])).push(h),e[h]=0);return d};function wa(a,c,b,e){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,e?S.call(this,a):a;let d=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(b){if(b>=h){b-=h;continue}b<h&&(g=c?g.slice(b,b+c):g.slice(b),h=g.length,b=0)}h>c&&(g=g.slice(0,c),h=c);if(!d.length&&h>=c)return e?S.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?S.call(this,d):d};function T(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===U)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=k;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:h,resolve:k,suggest:l}};U.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=T(this,"or",arguments);return xa.call(this,a,c,b,e,d,f)};function xa(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);return xa.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=ua(a,b,e),e=0));return f?this.resolve(b,e,d):this};U.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}=T(this,"and",arguments);return ya.call(this,f,g,h,k,l,m,n)}return d?this.resolve(c,b,e):this};
function ya(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return ya.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{if(c=aa(a))return this.result=ta(a,c,b,e,g),f?d?S.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};U.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=T(this,"xor",arguments);return za.call(this,a,c,b,e,d,f,g)};
function za(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return za.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=Aa.call(this,a,b,e,f,this.h),f?d?S.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Aa(a,c,b,e,d){const f=[],g=C();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++)p=n[t],g[p]=g[p]?2:1}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[k])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=k+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};U.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=T(this,"not",arguments);return Ba.call(this,a,c,b,e,d,f,g)};function Ba(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return Ba.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ca.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?S.call(this.index,this.result):this.result:this}
function Ca(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++h===c)return d;return d};function U(a){if(!this||this.constructor!==U)return new U(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}U.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
U.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};U.prototype.boost=function(a){this.h+=a;return this};U.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),wa.call(d,e,a||100,c,b)):e};C();R.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,h,k,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;h=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;k=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let D=0,F,B;D<u.length;D++)if(F=u[D],B=r[F],B.constructor===Array)for(z=0;z<B.length;z++)w.push(F,B[z]);else w.push(F,B)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Da.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,D,F;x<l.length;x++){D=l[x];let B;E(D)||(B=D,D=B.field,a=B.query||a,c=B.limit||c,n=B.offset||n,k=B.suggest||k,g=this.store&&(B.enrich||g));if(e)r=e[x];else if(u=B||b,z=this.index.get(D),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let I=0,G,Pa;I<m.length;I+=2){G=this.tag.get(m[I]);if(!G)if(k)continue;else return p?d:new U(d);if(Pa=(G=G&&G.get(m[I+1]))&&
G.length)z++,u.push(G);else if(!k)return p?d:new U(d)}if(z){r=va(r,u,p);F=r.length;if(!F&&!k)return p?r:new U(r);z--}}if(F)f[t]=D,d.push(r),t++;else if(1===l.length)return p?d:new U(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new U(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=S.call(this,r));if(y)return p?r:new U(r);d[x]={field:f[x],result:r}}return h?Ea(d,c):q?Fa(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;const c=a.task,b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(a=a.factory)?(Function("return "+a)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e=[N.export]);"import"===c?await N.import.call(M,M):d=M[c].apply(M,e);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 Q,ka;const R={},S={};function la(a){Q=0;R[a]=S[a]}
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]);Q||(Q=setTimeout(la,0,a),ka=Date.now());S[a]||(S[a]=R[a]=1E3);if(!--R[a]){R[a]=S[a]=S[a]*this.priority*this.priority*3/(Date.now()-ka)|0||1;Q=clearTimeout(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 T=0;
function ma(a={}){function c(g){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",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){d.h[++T]=function(){k(d)};d.worker.postMessage({id:T,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});return this}}if(!this||this.constructor!==ma)return new ma(a);let b="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=na(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}U("add");U("append");U("search");U("update");U("remove");U("clear");U("export");U("import");ja(ma.prototype);
function U(a){ma.prototype[a]=async function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.splice(b.length-1,1));e=new Promise(function(f){c.h[++T]=f;c.worker.postMessage({task:a,id:T,args:b})});return d?(e.then(d),this):e}}
function na(a,c,b){return c?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ia.toString()],{type:"text/javascript"}))):new window.Worker(D(b)?b:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function oa(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function pa(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function qa(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],oa(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function ra(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],pa(e[1],d));return c}function sa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function ta(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function ua(a,c,b,e,d,f,g=0){const h=e&&e.constructor===Array;var k=h?e.shift():e;if(!k)return this.export(a,c,d,f+1);if((k=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(k)))&&k.then){const l=this;return k.then(function(){return ua.call(l,a,c,b,h?e:null,d,f,g+1)})}return ua.call(this,a,c,b,h?e:null,d,f,g+1)};V.prototype.add=function(a,c,b){H(a)&&(c=a,a=I(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,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=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)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let h=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=I(c,f)}if(d&&f){D(f)&&(f=[f]);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]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.A){h=C();for(let k=0,l;k<this.A.length;k++){l=this.A[k];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(D(l)||l.constructor===
String){h[l]=c[l];continue}wa(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};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++)wa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],wa(a,c,b,e,d)}
function va(a,c,b,e,d,f,g,h){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)va(a,c,b,e,d,f,g,h);else g=c[++e],va(a,c,b,e,d,f,g,h)};function xa(a,c,b,e,d){const f=a.length;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 y=0;y<m.length;y++)n=m[y],(k=h[n])?h[n]++:(k=0,h[n]=1),p=g[k]||(g[k]=[]),p.push(n);if(a=g.length)if(d)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[];g=g[a-1];if(b||e)if(g.length>b||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;l<h;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}
function za(a,c,b){const e=C(),d=[];for(let f=0,g;f<c.length;f++){g=c[f];for(let h=0;h<g.length;h++)e[g[h]]=1}if(b)for(let f=0,g;f<a.length;f++)g=a[f],e[g]&&(d.push(g),e[g]=0);else for(let f=0,g,h;f<a.result.length;f++)for(g=a.result[f],c=0;c<g.length;c++)h=g[c],e[h]&&((d[f]||(d[f]=[])).push(h),e[h]=0);return d};function Aa(a,c,b,e){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,e?W.call(this,a):a;let d=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(b){if(b>=h){b-=h;continue}b<h&&(g=c?g.slice(b,b+c):g.slice(b),h=g.length,b=0)}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-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ba(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===X)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=k;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}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}=Ba(this,"or",arguments);return Ca.call(this,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(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);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=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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return Da.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{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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);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=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;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++)p=n[t],g[p]=g[p]?2:1}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[k])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=k+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};X.prototype.not=function(){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 Ga(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return Ga.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)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 Ha(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++h===c)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
X.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};X.prototype.boost=function(a){this.h+=a;return this};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),Aa.call(d,e,a||100,c,b)):e};C();V.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,h,k,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;h=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;k=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let E=0,F,B;E<u.length;E++)if(F=u[E],B=r[F],B.constructor===Array)for(z=0;z<B.length;z++)w.push(F,B[z]);else w.push(F,B)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Ia.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,E,F;x<l.length;x++){E=l[x];let B;D(E)||(B=E,E=B.field,a=B.query||a,c=B.limit||c,n=B.offset||n,k=B.suggest||k,g=this.store&&(B.enrich||g));if(e)r=e[x];else if(u=B||b,z=this.index.get(E),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let J=0,G,Wa;J<m.length;J+=2){G=this.tag.get(m[J]);if(!G)if(k)continue;else return p?d:new X(d);if(Wa=(G=G&&G.get(m[J+1]))&&
G.length)z++,u.push(G);else if(!k)return p?d:new X(d)}if(z){r=za(r,u,p);F=r.length;if(!F&&!k)return p?r:new X(r);z--}}if(F)f[t]=E,d.push(r),t++;else if(1===l.length)return p?d:new X(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new X(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=W.call(this,r));if(y)return p?r:new X(r);d[x]={field:f[x],result:r}}return h?Ja(d,c):q?Ka(d,
a,this.index,this.field,this.C,q):d};
function Fa(a,c,b,e,d,f){let g,h,k;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;k=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,h=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=J(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,D;x<z.length;x++){r=z[x];D=l[x];let F;for(let B=0,I;B<h.length;B++)if(I=h[B],"strict"===k){if(r===I){u+=(u?" ":"")+f.replace("$1",D);F=!0;break}}else{const G=r.indexOf(I);if(-1<G){u+=(u?" ":"")+D.substring(0,G)+f.replace("$1",
D.substring(G,I.length))+D.substring(G+I.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}function Ea(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=e[k])m.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}function Da(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||e)a=a.slice(e,e+b);d&&(a=S.call(this,a));return a}}
function S(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function R(a){if(!this||this.constructor!==R)return new R(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&V(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;this.cache=(b=a.cache||null)&&new W(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],E(f)||(g=f,f=f.field),g=H(g)?Object.assign({},a,g):a,b.set(f,new X(g,
this.reg)),g.custom?this.C[d]=g.custom:(this.C[d]=V(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;E(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]=V(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;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.B[d]=f.custom:(this.B[d]=V(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 V(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=R.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=J(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Ga;
v.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 h=this;return c.then(function(){return h.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=pa(this.reg);c=null;break;case 1:d="tag";f=na(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=la(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c){"string"===typeof c&&(c=JSON.parse(c));a=a.split(".");"json"===a[a.length-1]&&a.pop();var b=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(b)return this.index.get(b).import(a,c);switch(a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=oa(c,this.tag);break;case "doc":this.store=ma(c,this.store)}}};ia(R.prototype);function Ga(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new W);let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function W(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}W.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
W.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};W.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};W.prototype.clear=function(){this.cache.clear();this.h=""};const Ha={normalize:function(a){return a.toLowerCase()}};const Ia=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 Ja=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ka=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const La={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 Ma=/[\x00-\x7F]+/g;const Na=/[\x00-\x7F]+/g;const Oa=/[\x00-\x7F]+/g;var Qa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ha,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ia},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ia,matcher:Ja,replacer:Ka},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ia,replacer:Ka.concat([/(?!^)[aeo]/g,""]),matcher:Ja},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=La[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=La[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ma," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Na,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Oa," ")}}};const Ra={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};X.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){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):Y(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--){g=q.substring(f,h);var k=this.score?this.score(c,q,p,g,f):Y(t,e,p,d,f);Z(this,m,g,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)g=q[h]+g,k=this.score?this.score(c,q,p,g,h):Y(t,e,p,d,h),Z(this,m,g,k,a,b);g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=q[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,h=Math.min(n+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 y=this.score?this.score(c,f,p,q,k):Y(g+(e/2>g?0:1),e,p,h-1,k-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?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 Y(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};X.prototype.search=function(a,c,b){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return Sa.call(this,b[0],"",c,d,h);f=this.depth&&!1!==f;if(2===a&&f&&!g)return Sa.call(this,b[0],b[1],c,d,h);h=C();let l=0;if(1<a&&f){var m=b[0];l=1}k||0===k||(k=m?this.S:this.resolution);for(let q,y;l<a;l++){if((y=b[l])&&!h[y]){h[y]=1;
q=Ta(this,y,m);a:{f=q;var n=e,t=g,p=k;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===a-1&&!e.length&&(m="",l=-1,h=C())}a:{m=e.length;a=e;if(1<m)a=ta(e,k,c,d,g);else if(1===m){g=wa.call(null,e[0],c,d);break a}g=a}return g};function Sa(a,c,b,e,d){a=Ta(this,a,c);d=!0;return a&&a.length?d?wa.call(this,a,b,e):new U(a):d?[]:new U}
function Ta(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);return a};X.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;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else Ua(this.map,a),this.depth&&Ua(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Ua(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=Ua(e[1],c);f?b+=f:a.delete(d)}return b};function X(a,c){if(!this||this.constructor!==X)return new X(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},Ra[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?Qa[a.encoder]:a.encode||a.encoder||Ha;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=a.tokenize||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=
new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new W(b);this.priority=a.priority||4}v=X.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.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 Va(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=Va(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;Va(this.map);this.depth&&Va(this.ctx);return this};v.searchCache=Ga;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=pa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=la(this.map,this.reg.size);break;case 3:d="ctx";f=na(this.ctx,this.reg.size);break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);break;case "map":this.map=ma(c,this.map);break;case "ctx":this.ctx=oa(c,this.ctx)}};
function Ka(a,c,b,e,d,f){let g,h,k;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;k=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,h=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=I(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,E;x<z.length;x++){r=z[x];E=l[x];let F;for(let B=0,J;B<h.length;B++)if(J=h[B],"strict"===k){if(r===J){u+=(u?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=r.indexOf(J);if(-1<G){u+=(u?" ":"")+E.substring(0,G)+f.replace("$1",
E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}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 h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=e[k])m.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}function Ia(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||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;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function V(a){if(!this||this.constructor!==V)return new V(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];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;this.cache=(b=a.cache||null)&&new Y(b);a.cache=!1;b=new Map;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=H(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]=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;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");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 La(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=V.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=I(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Ma;
v.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 h=this;return c.then(function(){return h.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=sa(this.reg);c=null;break;case 1:d="tag";f=qa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=oa(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c){"string"===typeof c&&(c=JSON.parse(c));a=a.split(".");"json"===a[a.length-1]&&a.pop();var b=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(b)return this.index.get(b).import(a,c);switch(a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=ra(c,this.tag);break;case "doc":this.store=pa(c,this.store)}}};ja(V.prototype);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);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.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"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\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:{normalize:!1,dedupe:!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=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:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Sa," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ta,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ua," ")}}};const Xa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){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):Ya(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--){g=q.substring(f,h);var k=this.score?this.score(c,q,p,g,f):Ya(t,e,p,d,f);Z(this,m,g,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)g=q[h]+g,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(h=0;h<d;h++)g+=q[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,h=Math.min(n+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 y=this.score?this.score(c,f,p,q,k):Ya(g+(e/2>g?0:1),e,p,h-1,k-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?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&&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){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return Za.call(this,b[0],"",c,d,h);f=this.depth&&!1!==f;if(2===a&&f&&!g)return Za.call(this,b[0],b[1],c,d,h);h=C();let l=0;if(1<a&&f){var m=b[0];l=1}k||0===k||(k=m?this.S:this.resolution);for(let q,y;l<a;l++){if((y=b[l])&&!h[y]){h[y]=1;
q=$a(this,y,m);a:{f=q;var n=e,t=g,p=k;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===a-1&&!e.length&&(m="",l=-1,h=C())}a:{m=e.length;a=e;if(1<m)a=xa(e,k,c,d,g);else if(1===m){g=Aa.call(null,e[0],c,d);break a}g=a}return g};function Za(a,c,b,e,d){a=$a(this,a,c);d=!0;return a&&a.length?d?Aa.call(this,a,b,e):new X(a):d?[]:new X}
function $a(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);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;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else ab(this.map,a),this.depth&&ab(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function ab(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=ab(e[1],c);f?b+=f:a.delete(d)}return b};function O(a,c){if(!this||this.constructor!==O)return new O(a);if(a){var b=D(a)?a:a.preset;b&&(a=Object.assign({},Xa[b],a))}else a={};b=a.context;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||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=
new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new Y(b);this.priority=a.priority||4}v=O.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.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 bb(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=bb(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;bb(this.map);this.depth&&bb(this.ctx);return this};v.searchCache=Ma;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=sa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=oa(this.map,this.reg.size);break;case 3:d="ctx";f=qa(this.ctx,this.reg.size);break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);break;case "map":this.map=pa(c,this.map);break;case "ctx":this.ctx=ra(c,this.ctx)}};
v.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],h="";for(let m=0,n;m<g.length;m++){n=g[m]||[""];var k="";for(var l=0;l<n.length;l++)k+=(k?",":"")+("string"===b?'"'+n[l]+'"':n[l]);k="["+k+"]";h+=(h?",":"")+k}h='["'+f+'",['+h+"]]";e+=(e?",":"")+h}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];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(X.prototype);export default {Index:X,Charset:Qa,Encoder:K,Document:R,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=X;export const Charset=Qa;export const Encoder=K;export const Document=R;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
m[0];g=m[1];for(const n of g.entries()){g=n[0];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ja(O.prototype);export default {Index:O,Charset:Va,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
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={};

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.107 (ES5)
* FlexSearch.js v0.8.108 (ES5)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -51,85 +51,85 @@ u.addReplacer=function(a,b){if("string"===typeof a)return this.addMatcher(a,b);t
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&&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,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(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.H)if(this.D){var k=this.C.get(f);if(k||""===k){k&&d.push(k);continue}}else this.D=setTimeout(N,50,this);this.stemmer&&2<f.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),f=f.replace(this.N,function(q){return b.stemmer.get(q)}),f.length<this.minlength||this.filter&&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<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);f=k}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(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,f),this.C.size>this.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()};function Ja(a){var b,c,d,e,g,f,h;return ta(function(k){a=a.data;b=self._index;c=a.args;d=a.task;switch(d){case "init":e=a.options||{};(g=a.factory)?(Function("return "+g)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new O(e);postMessage({id:a.id});break;default:f=a.id,h=b[d].apply(b,c),postMessage("search"===d?{id:f,msg:h}:{id:f})}k.h=0})};var Ka=0;
function R(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=I();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++Ka]=function(){k(e)};e.worker.postMessage({id:Ka,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}a=void 0===a?{}:a;if(!this||this.constructor!==R)return new R(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,g=La(c,d,a.worker);return g.then?g.then(function(f){return b.call(e,f)}):b.call(this,g)}Ma("add");Ma("append");Ma("search");Ma("update");Ma("remove");
function Ma(a){R.prototype[a]=R.prototype[a+"Async"]=function(){var b=this,c=arguments,d,e,g,f,h;return ta(function(k){d=b;e=[].slice.call(c);g=e[e.length-1];"function"===typeof g&&(f=g,e.splice(e.length-1,1));h=new Promise(function(l){d.h[++Ka]=l;d.worker.postMessage({task:a,id:Ka,args:e})});return f?(h.then(f),k.return(b)):k.return(h)})}}
function La(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="+Ja.toString()],{type:"text/javascript"}))):new window.Worker(K(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 Na(a){Oa.call(a,"add");Oa.call(a,"append");Oa.call(a,"search");Oa.call(a,"update");Oa.call(a,"remove")}var Pa,Qa,Ra={},Sa={};function Ta(a){Pa=0;Ra[a]=Sa[a]}
function Oa(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]}Pa||(Pa=setTimeout(Ta,0,a),Qa=Date.now());Sa[a]||(Sa[a]=Ra[a]=1E3);if(!--Ra[a]){Ra[a]=Sa[a]=Sa[a]*this.priority*this.priority*3/(Date.now()-Qa)|0||1;Pa=clearTimeout(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}};function Ua(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*5E3|0);a=w(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 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}
(this.C.set(h,f),this.C.size>this.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;return ta(function(f){if(1==f.h)switch(a=a.data,b=a.task,c=a.id,d=a.args,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:f.h=2;return}else{if(4!=f.h){"export"===b&&(d=[Ha.export]);if("import"!==b){g=O[b].apply(O,d);f.h=4;return}return E(f,Ha.import.call(O,O),4)}postMessage("search"===b?{id:c,msg:g}:{id:c})}f.h=0})};function Ja(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={},Qa={};function Ra(a){Na=0;Pa[a]=Qa[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]}Na||(Na=setTimeout(Ra,0,a),Oa=Date.now());Qa[a]||(Qa[a]=Pa[a]=1E3);if(!--Pa[a]){Pa[a]=Qa[a]=Qa[a]*this.priority*this.priority*3/(Date.now()-Oa)|0||1;Na=clearTimeout(Na);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 Sa=0;
function S(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=I();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++Sa]=function(){k(e)};e.worker.postMessage({id:Sa,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}a=void 0===a?{}:a;if(!this||this.constructor!==S)return new S(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,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");Ja(S.prototype);
function T(a){S.prototype[a]=function(){var b=this,c=arguments,d,e,g,f,h;return ta(function(k){d=b;e=[].slice.call(c);g=e[e.length-1];"function"===typeof g&&(f=g,e.splice(e.length-1,1));h=new Promise(function(l){d.h[++Sa]=l;d.worker.postMessage({task:a,id:Sa,args:e})});return f?(h.then(f),k.return(b)):k.return(h)})}}
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(K(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 Ua(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*5E3|0);a=w(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 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 Wa(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*1E3|0);a=w(a.entries());for(var e=a.next();!e.done;e=a.next())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 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],Va(d[1],e));return b}function Ya(a){var b=[],c=[];a=w(a.keys());for(var d=a.next();!d.done;d=a.next())c.push(d.value),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}
function Za(a,b){b||(b=new Set);for(var c=0;c<a.length;c++)b.add(a[c]);return b}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,g+1);if((k=a((b?b+".":"")+(f+1)+"."+c,JSON.stringify(k)))&&k.then){var l=this;return k.then(function(){return $a.call(l,a,b,c,h?d:null,e,g,f+1)})}return $a.call(this,a,b,c,h?d:null,e,g,f+1)};function ab(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=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 S(a){if(!this)return new S(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;f<b.index.length;f++){h=b.index[f];k=h.indexOf(e);if(0<=k)return g+k;g+=h.length}return-1};if("includes"===
d)return function(e){for(var g=0;g<b.index.length;g++)if(b.index[g].includes(e))return!0;return!1};if("slice"===d)return function(e,g){return ab(b,e||0,g||b.length,!1)};if("splice"===d)return function(e,g){return ab(b,e||0,g||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/Math.pow(2,31)|0])&&c[d]},set:function(c,d,e){c=d/Math.pow(2,31)|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}S.prototype.clear=function(){this.index.length=0};
S.prototype.destroy=function(){this.proxy=this.index=null};S.prototype.push=function(){};function T(a){a=void 0===a?8:a;if(!this)return new T(a);this.index=I();this.B=[];this.size=0;32<a?(this.h=bb,this.A=BigInt(a)):(this.h=cb,this.A=a)}T.prototype.get=function(a){var b=this.h(a);return(b=this.index[b])&&b.get(a)};T.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))};
function U(a){a=void 0===a?8:a;if(!this)return new U(a);this.index=I();this.h=[];32<a?(this.B=bb,this.A=BigInt(a)):(this.B=cb,this.A=a)}U.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))};u=T.prototype;u.has=U.prototype.has=function(a){var b=this.B(a);return(b=this.index[b])&&b.has(a)};u.delete=U.prototype.delete=function(a){var b=this.B(a);(b=this.index[b])&&b.delete(a)&&this.size--};
u.clear=U.prototype.clear=function(){this.index=I();this.h=[];this.size=0};u.values=U.prototype.values=function db(){var b,c=this,d,e,g;return ra(db,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=w(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};
u.keys=U.prototype.keys=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)){f.h=0;break}d=w(c.h[b].keys());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};
u.entries=U.prototype.entries=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)){f.h=0;break}d=w(c.h[b].entries());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};function cb(a){var b=Math.pow(2,this.A)-1;if("number"==typeof a)return a&b;for(var c=0,d=this.A+1,e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+Math.pow(2,31):c}
function bb(){throw Error("The keystore is limited to 32 for EcmaScript5");};V.prototype.add=function(a,b,c){M(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 g=this.index.get(this.field[d]);if("function"===typeof e)(e=e(b))&&g.add(a,e,!1,!0);else{var f=e.R;if(!f||f(b))e.constructor===String?e=[""+e]:K(e)&&(e=[e]),gb(b,e,this.S,0,g,a,e[0],c)}}if(this.tag)for(d=0;d<this.L.length;d++){f=this.L[d];g=this.tag.get(this.aa[d]);e=I();if("function"===typeof f){if(f=f(b),!f)continue}else{var h=
f.R;if(h&&!h(b))continue;f.constructor===String&&(f=""+f);f=ya(b,f)}if(g&&f){K(f)&&(f=[f]);h=0;for(var k,l=void 0;h<f.length;h++)if(k=f[h],!e[k]){e[k]=1;var m;(m=g.get(k))?l=m:g.set(k,l=[]);if(!c||!l.includes(a)){if(l.length===Math.pow(2,31)-1){m=new S(l);if(this.fastupdate)for(var n=w(this.reg.values()),p=n.next();!p.done;p=n.next())p=p.value,p.includes(l)&&(p[p.indexOf(l)]=m);g.set(k,l=m)}l.push(a);this.fastupdate&&((k=this.reg.get(a))?k.push(l):this.reg.set(a,[l]))}}}}if(this.store&&(!c||!this.store.has(a))){if(this.I){var q=
I();for(c=0;c<this.I.length;c++)if(d=this.I[c],g=d.R,!g||g(b)){g=void 0;if("function"===typeof d){g=d(b);if(!g)continue;d=[d.ja]}else if(K(d)||d.constructor===String){q[d]=b[d];continue}hb(b,q,d,0,d[0],g)}}this.store.set(a,q||b)}}return this};function hb(a,b,c,d,e,g){a=a[e];if(d===c.length-1)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);else b=b[e]||(b[e]=I()),e=c[++d],hb(a,b,c,d,e)}
function gb(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(g,a[b],!0,!0);return}a=a.join(" ")}e.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)gb(a,b,c,d,e,g,f,h);else f=b[++d],gb(a,b,c,d,e,g,f,h);else e.db&&e.remove(g)};function ib(a,b,c,d,e,g,f){var h=a.length,k=[],l;var m=I();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(!f){var t=n+(r||!e?0:g||0);l=l[t]||(l[t]=[])}l.push(q)}if(a=k.length)if(e)k=1<k.length?jb(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(f){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(g=0;g<k.length;g++)if(f=k[g],f.length>d)d-=f.length;
function bb(a){if(!this)return new bb(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;f<b.index.length;f++){h=b.index[f];k=h.indexOf(e);if(0<=k)return g+k;g+=h.length}return-1};if("includes"===
d)return function(e){for(var g=0;g<b.index.length;g++)if(b.index[g].includes(e))return!0;return!1};if("slice"===d)return function(e,g){return ab(b,e||0,g||b.length,!1)};if("splice"===d)return function(e,g){return ab(b,e||0,g||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/Math.pow(2,31)|0])&&c[d]},set:function(c,d,e){c=d/Math.pow(2,31)|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}bb.prototype.clear=function(){this.index.length=0};
bb.prototype.destroy=function(){this.proxy=this.index=null};bb.prototype.push=function(){};function U(a){a=void 0===a?8:a;if(!this)return new U(a);this.index=I();this.B=[];this.size=0;32<a?(this.h=cb,this.A=BigInt(a)):(this.h=db,this.A=a)}U.prototype.get=function(a){var b=this.h(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))};
function V(a){a=void 0===a?8:a;if(!this)return new V(a);this.index=I();this.h=[];32<a?(this.B=cb,this.A=BigInt(a)):(this.B=db,this.A=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))};u=U.prototype;u.has=V.prototype.has=function(a){var b=this.B(a);return(b=this.index[b])&&b.has(a)};u.delete=V.prototype.delete=function(a){var b=this.B(a);(b=this.index[b])&&b.delete(a)&&this.size--};
u.clear=V.prototype.clear=function(){this.index=I();this.h=[];this.size=0};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)){f.h=0;break}d=w(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};
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)){f.h=0;break}d=w(c.h[b].keys());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};
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)){f.h=0;break}d=w(c.h[b].entries());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};function db(a){var b=Math.pow(2,this.A)-1;if("number"==typeof a)return a&b;for(var c=0,d=this.A+1,e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+Math.pow(2,31):c}
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));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 g=this.index.get(this.field[d]);if("function"===typeof e)(e=e(b))&&g.add(a,e,!1,!0);else{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++){f=this.L[d];g=this.tag.get(this.aa[d]);e=I();if("function"===typeof f){if(f=f(b),!f)continue}else{var h=
f.R;if(h&&!h(b))continue;f.constructor===String&&(f=""+f);f=ya(b,f)}if(g&&f){K(f)&&(f=[f]);h=0;for(var k,l=void 0;h<f.length;h++)if(k=f[h],!e[k]){e[k]=1;var m;(m=g.get(k))?l=m:g.set(k,l=[]);if(!c||!l.includes(a)){if(l.length===Math.pow(2,31)-1){m=new bb(l);if(this.fastupdate)for(var n=w(this.reg.values()),p=n.next();!p.done;p=n.next())p=p.value,p.includes(l)&&(p[p.indexOf(l)]=m);g.set(k,l=m)}l.push(a);this.fastupdate&&((k=this.reg.get(a))?k.push(l):this.reg.set(a,[l]))}}}}if(this.store&&(!c||!this.store.has(a))){if(this.I){var q=
I();for(c=0;c<this.I.length;c++)if(d=this.I[c],g=d.R,!g||g(b)){g=void 0;if("function"===typeof d){g=d(b);if(!g)continue;d=[d.ja]}else if(K(d)||d.constructor===String){q[d]=b[d];continue}ib(b,q,d,0,d[0],g)}}this.store.set(a,q||b)}}return this};function ib(a,b,c,d,e,g){a=a[e];if(d===c.length-1)b[e]=g||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)ib(a,b,c,d,e);else b=b[e]||(b[e]=I()),e=c[++d],ib(a,b,c,d,e)}
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(g,a[b],!0,!0);return}a=a.join(" ")}e.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)hb(a,b,c,d,e,g,f,h);else f=b[++d],hb(a,b,c,d,e,g,f,h);else e.db&&e.remove(g)};function jb(a,b,c,d,e,g,f){var h=a.length,k=[],l;var m=I();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(!f){var t=n+(r||!e?0:g||0);l=l[t]||(l[t]=[])}l.push(q)}if(a=k.length)if(e)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(f){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(g=0;g<k.length;g++)if(f=k[g],f.length>d)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=1<e.length?[].concat.apply([],e):e[0]}}return k}
function jb(a,b,c,d,e){var g=[],f=I(),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(!f[l])if(f[l]=1,c)c--;else if(g.push(l),g.length===b)return g}}else for(var m=h-1,n,p=0;0<=m;m--){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],!f[l])if(f[l]=1,c)c--;else{var x=(q+(m<h-1?e||0:0))/(m+1)|0;(g[x]||(g[x]=[])).push(l);if(++p===b)return g}}return g}
function kb(a,b,c){for(var d=I(),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)for(b=0;b<a.length;b++)c=a[b],d[c]&&(e.push(c),d[c]=0);else for(b=0;b<a.result.length;b++)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){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?W.call(this,a):a;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&&(f=b?f.slice(c,c+b):f.slice(c),h=f.length,c=0)}h>b&&(f=f.slice(0,b),h=b);if(!e.length&&h>=b)return d?W.call(this,f):f;e.push(f);b-=h;if(!b)break}e=1<e.length?[].concat.apply([],e):e[0];return d?W.call(this,e):e};function mb(a,b,c){var d=c[0];if(d.then)return Promise.all(c).then(function(q){return a[b].apply(a,q)});if(d[0]&&d[0].index)return a[b].apply(a,d);d=[];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===X)p=n.result;else if(n.constructor===Array)p=n;else if(g=n.limit||0,f=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,p=n.index.search(n).result,n.resolve=k;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=
a.xor(n.xor);else if(n.not)p=a.not(n.not);else continue;if(p.then)e.push(p);else if(p.length)d[m]=p;else if(!l&&("and"===b||"xor"===b)){d=[];break}}return{W:d,$:e,limit:g,offset:f,enrich:h,resolve:k,suggest:l}};X.prototype.or=function(){var a=mb(this,"or",arguments);return nb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve)};function nb(a,b,c,d,e,g){if(b.length){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(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 g?this.resolve(c,d,e):this};X.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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return ob.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{if(b=za(a))return this.result=ib(a,b,c,d,f,this.h,g),g?e?W.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(c,d,e):this};X.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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return pb.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,g,this.h),g?e?W.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=I(),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],f[q]=f[q]?2:1}for(l=k=0;k<h;k++)for(m=0;m<a.length;m++)if(n=a[m])if(n=n[k])for(p=0;p<n.length;p++)if(q=n[p],1===f[q])if(c)c--;else if(d){if(g.push(q),g.length===b)return g}else{var r=k+(m?e:0);g[r]||(g[r]=[]);g[r].push(q);if(++l===b)return g}return g};X.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)};function rb(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return rb.call(h,a,[],c,d,e,g,f)})}if(a.length&&this.result.length)this.result=sb.call(this,a,c,d,g);else if(g)return this.resolve(c,d,e);return g?e?W.call(this.index,this.result):this.result:this}
function sb(a,b,c,d){var e=[];a=new Set(a.flat().flat());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 if(d){if(e.push(l),e.length===b)return e}else if(e[g]||(e[g]=[]),e[g].push(l),++h===b)return e;return e};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){for(var b=[],c=0,d;c<this.result.length;c++)if(d=this.result[c])if(d.length<=a){if(b[c]=d,a-=d.length,!a)break}else{b[c]=d.slice(0,a);break}this.result=b}return this};
X.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d;c<this.result.length;c++)if(d=this.result[c])d.length<=a?a-=d.length:(b[c]=d.slice(a),a=0);this.result=b}return this};X.prototype.boost=function(a){this.h+=a;return this};X.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};I();V.prototype.search=function(a,b,c,d){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var e=[],g=[],f=0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var h=c.pluck;var k=c.merge;var l=h||c.field||(l=c.index)&&(l.index?null:l);var m=this.tag&&c.tag;var n=c.suggest;var p=!1!==c.resolve;p||h||!(l=l||this.field)||(K(l)?h=l:(l.constructor===Array&&1===l.length&&(l=l[0]),h=l.field||l.index));var q=this.store&&c.enrich&&p;var r=c.highlight&&q;b=c.limit||b;var x=c.offset||0;b||(b=100);if(m&&(!this.db||
function kb(a,b,c,d,e){var g=[],f=I(),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(!f[l])if(f[l]=1,c)c--;else if(g.push(l),g.length===b)return g}}else for(var m=h-1,n,p=0;0<=m;m--){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],!f[l])if(f[l]=1,c)c--;else{var x=(q+(m<h-1?e||0:0))/(m+1)|0;(g[x]||(g[x]=[])).push(l);if(++p===b)return g}}return g}
function lb(a,b,c){for(var d=I(),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)for(b=0;b<a.length;b++)c=a[b],d[c]&&(e.push(c),d[c]=0);else for(b=0;b<a.result.length;b++)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 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=[],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&&(f=b?f.slice(c,c+b):f.slice(c),h=f.length,c=0)}h>b&&(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=1<e.length?[].concat.apply([],e):e[0];return d?X.call(this,e):e};function nb(a,b,c){var d=c[0];if(d.then)return Promise.all(c).then(function(q){return a[b].apply(a,q)});if(d[0]&&d[0].index)return a[b].apply(a,d);d=[];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)p=n.result;else if(n.constructor===Array)p=n;else if(g=n.limit||0,f=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,p=n.index.search(n).result,n.resolve=k;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=
a.xor(n.xor);else if(n.not)p=a.not(n.not);else continue;if(p.then)e.push(p);else if(p.length)d[m]=p;else if(!l&&("and"===b||"xor"===b)){d=[];break}}return{W:d,$:e,limit:g,offset:f,enrich:h,resolve:k,suggest:l}};Y.prototype.or=function(){var a=nb(this,"or",arguments);return ob.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve)};function ob(a,b,c,d,e,g){if(b.length){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 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=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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return pb.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{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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);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=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=I(),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],f[q]=f[q]?2:1}for(l=k=0;k<h;k++)for(m=0;m<a.length;m++)if(n=a[m])if(n=n[k])for(p=0;p<n.length;p++)if(q=n[p],1===f[q])if(c)c--;else if(d){if(g.push(q),g.length===b)return g}else{var r=k+(m?e:0);g[r]||(g[r]=[]);g[r].push(q);if(++l===b)return g}return g};Y.prototype.not=function(){var a=nb(this,"not",arguments);return sb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)};function sb(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;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return sb.call(h,a,[],c,d,e,g,f)})}if(a.length&&this.result.length)this.result=tb.call(this,a,c,d,g);else if(g)return this.resolve(c,d,e);return g?e?X.call(this.index,this.result):this.result:this}
function tb(a,b,c,d){var e=[];a=new Set(a.flat().flat());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 if(d){if(e.push(l),e.length===b)return e}else if(e[g]||(e[g]=[]),e[g].push(l),++h===b)return e;return e};function Y(a){if(!this||this.constructor!==Y)return new Y(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}Y.prototype.limit=function(a){if(this.result.length){for(var b=[],c=0,d;c<this.result.length;c++)if(d=this.result[c])if(d.length<=a){if(b[c]=d,a-=d.length,!a)break}else{b[c]=d.slice(0,a);break}this.result=b}return this};
Y.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d;c<this.result.length;c++)if(d=this.result[c])d.length<=a?a-=d.length:(b[c]=d.slice(a),a=0);this.result=b}return this};Y.prototype.boost=function(a){this.h+=a;return this};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),mb.call(e,d,a||100,b,c)):d};I();W.prototype.search=function(a,b,c,d){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var e=[],g=[],f=0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var h=c.pluck;var k=c.merge;var l=h||c.field||(l=c.index)&&(l.index?null:l);var m=this.tag&&c.tag;var n=c.suggest;var p=!1!==c.resolve;p||h||!(l=l||this.field)||(K(l)?h=l:(l.constructor===Array&&1===l.length&&(l=l[0]),h=l.field||l.index));var q=this.store&&c.enrich&&p;var r=c.highlight&&q;b=c.limit||b;var x=c.offset||0;b||(b=100);if(m&&(!this.db||
!d)){m.constructor!==Array&&(m=[m]);for(var t=[],A=0,z=void 0;A<m.length;A++)if(z=m[A],z.field&&z.tag){var v=z.tag;if(v.constructor===Array)for(var y=0;y<v.length;y++)t.push(z.field,v[y]);else t.push(z.field,v)}else{v=Object.keys(z);y=0;for(var D=void 0,F=void 0;y<v.length;y++)if(D=v[y],F=z[D],F.constructor===Array)for(var J=0;J<F.length;J++)t.push(D,F[J]);else t.push(D,F)}m=t;if(!a){p=[];if(t.length)for(g=0;g<t.length;g+=2){h=void 0;if(this.db){h=this.index.get(t[g]);if(!h)continue;p.push(h=h.db.tag(t[g+
1],b,x,q))}else h=tb.call(this,t[g],t[g+1],b,x,q);e.push({field:t[g],tag:t[g+1],result:h})}return p.length?Promise.all(p).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return e}):e}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);t=!d&&(this.worker||this.db)&&[];A=0;for(y=z=v=void 0;A<l.length;A++)if(z=l[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,n=v.suggest||n,q=this.store&&(v.enrich||q));if(d)v=d[A];else{y=v||c;v=this.index.get(z);
if(m){if(this.db){y.tag=m;var Ha=v.db.support_tag_search;y.field=l}Ha||(y.enrich=!1)}if(t){t[A]=v.search(a,b,y);y&&q&&(y.enrich=q);continue}else v=v.search(a,b,y),y&&q&&(y.enrich=q)}y=v&&(p?v.length:v.result.length);if(m&&y){D=[];F=0;if(this.db&&d){if(!Ha)for(J=l.length;J<d.length;J++){var L=d[J];if(L&&L.length)F++,D.push(L);else if(!n)return p?e:new X(e)}}else{J=0;for(var Ub=L=void 0;J<m.length;J+=2){L=this.tag.get(m[J]);if(!L)if(n)continue;else return p?e:new X(e);if(Ub=(L=L&&L.get(m[J+1]))&&L.length)F++,
D.push(L);else if(!n)return p?e:new X(e)}}if(F){v=kb(v,D,p);y=v.length;if(!y&&!n)return p?v:new X(v);F--}}if(y)g[f]=z,e.push(v),f++;else if(1===l.length)return p?e:new X(e)}if(t){if(this.db&&m&&m.length&&!Ha)for(q=0;q<m.length;q+=2){g=this.index.get(m[q]);if(!g)if(n)continue;else return p?e:new X(e);t.push(g.db.tag(m[q+1],b,x,!1))}var Vb=this;return Promise.all(t).then(function(P){return P.length?Vb.search(a,b,c,P):P})}if(!f)return p?e:new X(e);if(h&&(!q||!this.store))return e[0];t=[];x=0;for(n=void 0;x<
g.length;x++){n=e[x];q&&n.length&&!n[0].doc&&(this.db?t.push(n=this.index.get(this.field[0]).db.enrich(n)):n=W.call(this,n));if(h)return p?n:new X(n);e[x]={field:g[x],result:n}}if(q&&this.db&&t.length){var Ia=this;return Promise.all(t).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return k?ub(e,b):r?vb(e,a,Ia.index,Ia.field,Ia.J,r):e})}return k?ub(e,b):r?vb(e,a,this.index,this.field,this.J,r):e};
function vb(a,b,c,d,e,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="",r=ya(m[p].doc,n),x=f.encode(r);r=r.split(f.split);for(var t=0,A,z;t<x.length;t++){A=x[t];z=r[t];for(var v=void 0,y=0,D;y<h.length;y++)if(D=h[y],"strict"===k){if(A===D){q+=(q?" ":"")+g.replace("$1",z);v=!0;break}}else{var F=A.indexOf(D);if(-1<F){q+=(q?" ":"")+z.substring(0,F)+g.replace("$1",z.substring(F,
D.length))+z.substring(F+D.length);v=!0;break}}v||(q+=(q?" ":"")+r[t])}m[p].highlight=q}return a}function ub(a,b){for(var c=[],d=I(),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],k=l.id,m=d[k])m.push(g.field);else{if(c.length===b)return c;l.field=d[k]=[g.field];c.push(l)}}return c}function tb(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=W.call(this,a));return a}}
function W(a){if(!this||!this.store)return a;for(var b=Array(a.length),c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function V(a){if(!this||this.constructor!==V)return new V(a);var b=a.document||a.doc||a,c,d;this.J=[];this.field=[];this.S=[];this.key=(c=b.key||b.id)&&wb(c,this.S)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new T(d):new Map:d?new U(d):new Set;this.I=(c=b.store||null)&&c&&!0!==c&&[];this.store=c&&(d?new T(d):new Map);this.cache=(c=a.cache||null)&&new Y(c);a.cache=!1;this.worker=a.worker;this.index=xb.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===
typeof c&&(c=[c]),c.length){this.tag=new Map;this.L=[];this.aa=[];b=0;for(var e=d=void 0;b<c.length;b++){d=c[b];e=d.field||d;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));this.aa[b]=e;this.tag.set(e,new Map)}}if(this.worker){a=[];c=w(this.index.values());for(b=c.next();!b.done;b=c.next())b=b.value,b.then&&a.push(b);if(a.length){var g=
this;return Promise.all(a).then(function(f){for(var h=0,k=w(g.index.entries()),l=k.next();!l.done;l=k.next()){l=l.value;var m=l[0];l[1].then&&g.index.set(m,f[h++])}return g})}}else a.db&&this.mount(a.db)}u=V.prototype;
u.mount=function(a){var b=this.field;if(this.tag)for(var c=0,d;c<this.aa.length;c++){d=this.aa[c];var e;this.index.set(d,e=new O({},this.reg));b===this.field&&(b=b.slice(0));b.push(d);e.tag=this.tag.get(d)}c=[];d={db:a.db,type:a.type,fastupdate:a.fastupdate};e=0;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)};
1],b,x,q))}else h=ub.call(this,t[g],t[g+1],b,x,q);e.push({field:t[g],tag:t[g+1],result:h})}return p.length?Promise.all(p).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return e}):e}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);t=!d&&(this.worker||this.db)&&[];A=0;for(y=z=v=void 0;A<l.length;A++)if(z=l[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,n=v.suggest||n,q=this.store&&(v.enrich||q));if(d)v=d[A];else{y=v||c;v=this.index.get(z);
if(m){if(this.db){y.tag=m;var Ka=v.db.support_tag_search;y.field=l}Ka||(y.enrich=!1)}if(t){t[A]=v.search(a,b,y);y&&q&&(y.enrich=q);continue}else v=v.search(a,b,y),y&&q&&(y.enrich=q)}y=v&&(p?v.length:v.result.length);if(m&&y){D=[];F=0;if(this.db&&d){if(!Ka)for(J=l.length;J<d.length;J++){var L=d[J];if(L&&L.length)F++,D.push(L);else if(!n)return p?e:new Y(e)}}else{J=0;for(var Wb=L=void 0;J<m.length;J+=2){L=this.tag.get(m[J]);if(!L)if(n)continue;else return p?e:new Y(e);if(Wb=(L=L&&L.get(m[J+1]))&&L.length)F++,
D.push(L);else if(!n)return p?e:new Y(e)}}if(F){v=lb(v,D,p);y=v.length;if(!y&&!n)return p?v:new Y(v);F--}}if(y)g[f]=z,e.push(v),f++;else if(1===l.length)return p?e:new Y(e)}if(t){if(this.db&&m&&m.length&&!Ka)for(q=0;q<m.length;q+=2){g=this.index.get(m[q]);if(!g)if(n)continue;else return p?e:new Y(e);t.push(g.db.tag(m[q+1],b,x,!1))}var Xb=this;return Promise.all(t).then(function(P){return P.length?Xb.search(a,b,c,P):P})}if(!f)return p?e:new Y(e);if(h&&(!q||!this.store))return e[0];t=[];x=0;for(n=void 0;x<
g.length;x++){n=e[x];q&&n.length&&!n[0].doc&&(this.db?t.push(n=this.index.get(this.field[0]).db.enrich(n)):n=X.call(this,n));if(h)return p?n:new Y(n);e[x]={field:g[x],result:n}}if(q&&this.db&&t.length){var La=this;return Promise.all(t).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return k?vb(e,b):r?wb(e,a,La.index,La.field,La.J,r):e})}return k?vb(e,b):r?wb(e,a,this.index,this.field,this.J,r):e};
function wb(a,b,c,d,e,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="",r=ya(m[p].doc,n),x=f.encode(r);r=r.split(f.split);for(var t=0,A,z;t<x.length;t++){A=x[t];z=r[t];for(var v=void 0,y=0,D;y<h.length;y++)if(D=h[y],"strict"===k){if(A===D){q+=(q?" ":"")+g.replace("$1",z);v=!0;break}}else{var F=A.indexOf(D);if(-1<F){q+=(q?" ":"")+z.substring(0,F)+g.replace("$1",z.substring(F,
D.length))+z.substring(F+D.length);v=!0;break}}v||(q+=(q?" ":"")+r[t])}m[p].highlight=q}return a}function vb(a,b){for(var c=[],d=I(),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],k=l.id,m=d[k])m.push(g.field);else{if(c.length===b)return c;l.field=d[k]=[g.field];c.push(l)}}return c}function ub(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||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<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function W(a){if(!this||this.constructor!==W)return new W(a);var b=a.document||a.doc||a,c,d;this.J=[];this.field=[];this.S=[];this.key=(c=b.key||b.id)&&xb(c,this.S)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new U(d):new Map:d?new V(d):new Set;this.I=(c=b.store||null)&&c&&!0!==c&&[];this.store=c&&(d?new U(d):new Map);this.cache=(c=a.cache||null)&&new Z(c);a.cache=!1;this.worker=a.worker;this.index=yb.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===
typeof c&&(c=[c]),c.length){this.tag=new Map;this.L=[];this.aa=[];b=0;for(var e=d=void 0;b<c.length;b++){d=c[b];e=d.field||d;if(!e)throw Error("The tag field from the document descriptor is undefined.");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)}}if(this.worker){a=[];c=w(this.index.values());for(b=c.next();!b.done;b=c.next())b=b.value,b.then&&a.push(b);if(a.length){var g=
this;return Promise.all(a).then(function(f){for(var h=0,k=w(g.index.entries()),l=k.next();!l.done;l=k.next()){l=l.value;var m=l[0];l[1].then&&g.index.set(m,f[h++])}return g})}}else a.db&&this.mount(a.db)}u=W.prototype;
u.mount=function(a){var b=this.field;if(this.tag)for(var c=0,d;c<this.aa.length;c++){d=this.aa[c];var e;this.index.set(d,e=new R({},this.reg));b===this.field&&(b=b.slice(0));b.push(d);e.tag=this.tag.get(d)}c=[];d={db:a.db,type:a.type,fastupdate:a.fastupdate};e=0;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,g,f;return ta(function(h){if(1==h.h){d=[];e=w(c.index.values());for(g=e.next();!g.done;g=e.next())f=g.value,d.push(f.db.commit(f,a,b));return E(h,Promise.all(d),2)}c.reg.clear();h.h=0})};u.destroy=function(){for(var a=[],b=w(this.index.values()),c=b.next();!c.done;c=b.next())a.push(c.value.destroy());return Promise.all(a)};
function xb(a,b){var c=new Map,d=b.index||b.field||b;K(d)&&(d=[d]);for(var e=0,g,f=void 0;e<d.length;e++){g=d[e];K(g)||(f=g,g=g.field);f=M(f)?Object.assign({},a,f):a;if(this.worker){var h=new R(f);c.set(g,h)}this.worker||c.set(g,new O(f,this.reg));f.custom?this.J[e]=f.custom:(this.J[e]=wb(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));return c}function wb(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);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)};
function yb(a,b){var c=new Map,d=b.index||b.field||b;K(d)&&(d=[d]);for(var e=0,g,f=void 0;e<d.length;e++){g=d[e];K(g)||(f=g,g=g.field);f=M(f)?Object.assign({},a,f):a;if(this.worker){var h=new S(f);c.set(g,h)}this.worker||c.set(g,new R(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]=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 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);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};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())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()){c=c.value;for(var d=w(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))}}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
u.clear=function(){for(var a=w(this.index.values()),b=a.next();!b.done;b=a.next())b.value.clear();if(this.tag)for(a=w(this.tag.values()),b=a.next();!b.done;b=a.next())b.value.clear();this.store&&this.store.clear();return 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())b.value.cleanup();return this};
u.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};u.set=function(a,b){this.store.set(a,b);return this};u.searchCache=yb;
u.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};u.set=function(a,b){this.store.set(a,b);return this};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 g=this;return b.then(function(){return g.export(a,e,c+1)})}return this.export(a,e,c+1)}switch(d){case 0:var f="reg";var h=Ya(this.reg);b=null;break;case 1:f="tag";h=Wa(this.tag,this.reg.size);b=null;break;case 2:f="doc";h=Ua(this.store);b=null;break;case 3:f="cfg";b=h=null;break;default:return}return $a.call(this,a,b,f,h,c,d)};
u.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);for(b=0;b<this.field.length;b++)c=this.index.get(this.field[b]),c.fastupdate=!1,c.reg=this.reg;break;case "tag":this.tag=Xa(b,this.tag);break;case "doc":this.store=Va(b,this.store)}}};Na(V.prototype);function yb(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);var d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){var e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
Y.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};Y.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)}};Y.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"],["pf","f"]]),Cb=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\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:{normalize:!1,dedupe:!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;b<a.length;b++){for(var c=a[b],d=c.charAt(0),e=Db[d],g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||"w"===
f||!(f=Db[f])||f===e||(d+=f,e=f,4!==d.length));g++);a[b]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Eb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Fb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Gb," ")}}};var Ib={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.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=I(),g=I(),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&&(f||!g[l])){var n=this.score?this.score(b,l,k,null,0):Jb(h,d,k),p="";switch(this.tokenize){case "full":if(2<m){for(n=0;n<m;n++)for(var q=m;q>n;q--){p=l.substring(n,q);var r=this.score?this.score(b,l,k,p,n):Jb(h,d,k,m,n);Kb(this,g,p,r,a,c)}break}case "reverse":if(1<
m){for(q=m-1;0<q;q--)p=l[q]+p,r=this.score?this.score(b,l,k,p,q):Jb(h,d,k,m,q),Kb(this,g,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],Kb(this,g,p,n,a,c);break}default:if(Kb(this,g,l,n,a,c),f&&1<d&&k<d-1)for(m=I(),p=this.da,n=l,q=Math.min(f+1,d-k),r=m[n]=1;r<q;r++)if((l=b[this.rtl?d-1-k-r:k+r])&&!m[l]){m[l]=1;var x=this.score?this.score(b,n,k,l,r):Jb(p+(d/2>p?0:1),d,k,q-1,r-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]=I()),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 S(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&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};O.prototype.search=function(a,b,c){c||(!b&&M(a)?(c=a,a=""):M(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 f=c.context;var h=c.suggest;var k=(g=!1!==c.resolve)&&c.enrich;var l=c.boost;var m=c.resolution;var n=this.db&&c.tag}else g=this.resolve;var p=this.encoder.encode(a);var q=p.length;b=b||(g?100:0);if(1===q)return Mb.call(this,p[0],"",b,e,g,k,n);f=this.depth&&!1!==f;if(2===q&&f&&!h)return Mb.call(this,p[0],p[1],b,e,g,k,n);var r=I(),x=0;if(1<q&&f){var t=p[0];x=
1}m||0===m||(m=t?this.da:this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,b,e,h,g,k,n),!1!==a))return a;var A=this;return function(){var z,v;return ta(function(y){switch(y.h){case 1:v=z=void 0;case 2:if(!(x<q)){y.h=4;break}v=p[x];if(!v||r[v]){y.h=5;break}r[v]=1;return E(y,Nb(A,v,t,0,0,!1,!1),6);case 6:z=y.G;if(z=Ob(z,d,h,m)){d=z;y.h=4;break}t&&(h&&z&&d.length||(t=v));case 5:h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=I());x++;y.h=2;break;case 4:return y.return(Pb(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)){d=a;break}t&&(h&&a&&d.length||(t=c))}h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=I())}return Pb(d,m,b,e,h,l,g)};function Pb(a,b,c,d,e,g,f){var h=a.length,k=a;if(1<h)k=ib(a,b,c,d,e,g,f);else if(1===h)return f?lb.call(null,a[0],c,d):new X(a[0]);return f?k:new X(k)}
function Mb(a,b,c,d,e,g,f){a=Nb(this,a,b,c,d,e,g,f);return this.db?a.then(function(h){return e?h||[]:new X(h)}):a&&a.length?e?lb.call(this,a,c,d):new X(a):e?[]:new X}function Ob(a,b,c,d){var e=[];if(a&&a.length){if(a.length<=d){b.push(a);return}for(var g=0,f;g<d;g++)if(f=a[g])e[g]=f;if(e.length){b.push(e);return}}if(!c)return e}function Nb(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,g,f,h);a=c?(a=a.ctx.get(c))&&a.get(b):a.map.get(b);return a};O.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;d<c.length;d++){if(e=c[d])if(2>e.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;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(b),0<=g){1<e.length?(e.splice(g,1),c++):delete a[d];break}else c++}else for(d=w(a.entries()),e=d.next();!e.done;e=d.next())g=e.value,e=g[0],(g=Qb(g[1],b))?c+=g:a.delete(e);return c};function O(a,b){if(!this||this.constructor!==O)return new O(a);if(a){var c=K(a)?a:a.preset;c&&(a=Object.assign({},Ib[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;this.encoder=e.encode?e:"object"===typeof e?new Ga(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=c=a.tokenize||"strict";this.depth="strict"===c&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(c=a.keystore||
0)&&(this.keystore=c);this.map=c?new T(c):new Map;this.ctx=c?new T(c):new Map;this.reg=b||(this.fastupdate?c?new T(c):new Map:c?new U(c):new Set);this.da=d.resolution||3;this.rtl=e.rtl||a.rtl||!1;this.cache=(c=a.cache||null)&&new Y(c);this.resolve=!1!==a.resolve;if(c=a.db)this.db=this.mount(c);this.ca=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}u=O.prototype;u.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
u.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};u.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function Lb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
u.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);for(b=0;b<this.field.length;b++)c=this.index.get(this.field[b]),c.fastupdate=!1,c.reg=this.reg;break;case "tag":this.tag=Xa(b,this.tag);break;case "doc":this.store=Va(b,this.store)}}};Ja(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);if(!d){d=this.search(a,b,c);if(d.then){var e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d}function Z(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Z.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.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 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"],["pf","f"]]),Db=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\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:{normalize:!1,dedupe:!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=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:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Fb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Gb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Hb," ")}}};var Jb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};R.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=I(),g=I(),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&&(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){for(n=0;n<m;n++)for(var q=m;q>n;q--){p=l.substring(n,q);var r=this.score?this.score(b,l,k,p,n):Kb(h,d,k,m,n);Lb(this,g,p,r,a,c)}break}case "reverse":if(1<
m){for(q=m-1;0<q;q--)p=l[q]+p,r=this.score?this.score(b,l,k,p,q):Kb(h,d,k,m,q),Lb(this,g,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],Lb(this,g,p,n,a,c);break}default:if(Lb(this,g,l,n,a,c),f&&1<d&&k<d-1)for(m=I(),p=this.da,n=l,q=Math.min(f+1,d-k),r=m[n]=1;r<q;r++)if((l=b[this.rtl?d-1-k-r:k+r])&&!m[l]){m[l]=1;var x=this.score?this.score(b,n,k,l,r):Kb(p+(d/2>p?0:1),d,k,q-1,r-1),t=this.bidirectional&&l>n;Lb(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&&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]=I()),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 bb(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 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};R.prototype.search=function(a,b,c){c||(!b&&M(a)?(c=a,a=""):M(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 f=c.context;var h=c.suggest;var k=(g=!1!==c.resolve)&&c.enrich;var l=c.boost;var m=c.resolution;var n=this.db&&c.tag}else g=this.resolve;var p=this.encoder.encode(a);var q=p.length;b=b||(g?100:0);if(1===q)return Nb.call(this,p[0],"",b,e,g,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=I(),x=0;if(1<q&&f){var t=p[0];x=
1}m||0===m||(m=t?this.da:this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,b,e,h,g,k,n),!1!==a))return a;var A=this;return function(){var z,v;return ta(function(y){switch(y.h){case 1:v=z=void 0;case 2:if(!(x<q)){y.h=4;break}v=p[x];if(!v||r[v]){y.h=5;break}r[v]=1;return E(y,Ob(A,v,t,0,0,!1,!1),6);case 6:z=y.G;if(z=Pb(z,d,h,m)){d=z;y.h=4;break}t&&(h&&z&&d.length||(t=v));case 5:h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=I());x++;y.h=2;break;case 4: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=Ob(this,c,t,0,0,!1,!1);if(a=Pb(a,d,h,m)){d=a;break}t&&(h&&a&&d.length||(t=c))}h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=I())}return Qb(d,m,b,e,h,l,g)};function Qb(a,b,c,d,e,g,f){var h=a.length,k=a;if(1<h)k=jb(a,b,c,d,e,g,f);else if(1===h)return f?mb.call(null,a[0],c,d):new Y(a[0]);return f?k:new Y(k)}
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?mb.call(this,a,c,d):new Y(a):e?[]:new Y}function Pb(a,b,c,d){var e=[];if(a&&a.length){if(a.length<=d){b.push(a);return}for(var g=0,f;g<d;g++)if(f=a[g])e[g]=f;if(e.length){b.push(e);return}}if(!c)return e}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,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;d<c.length;d++){if(e=c[d])if(2>e.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<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(b),0<=g){1<e.length?(e.splice(g,1),c++):delete a[d];break}else c++}else for(d=w(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 R(a,b){if(!this||this.constructor!==R)return new R(a);if(a){var c=K(a)?a:a.preset;c&&(a=Object.assign({},Jb[c],a))}else a={};c=a.context;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||"strict";this.depth="strict"===c&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(c=a.keystore||
0)&&(this.keystore=c);this.map=c?new U(c):new Map;this.ctx=c?new U(c):new Map;this.reg=b||(this.fastupdate?c?new U(c):new Map:c?new V(c):new Set);this.da=d.resolution||3;this.rtl=e.rtl||a.rtl||!1;this.cache=(c=a.cache||null)&&new Z(c);this.resolve=!1!==a.resolve;if(c=a.db)this.db=this.mount(c);this.ca=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}u=R.prototype;u.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
u.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};u.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function Mb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
u.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();this.db&&(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[{clear:!0}]);return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};u.update=function(a,b){var c=this,d=this.remove(a);return d&&d.then?d.then(function(){return c.add(a,b)}):this.add(a,b)};
function Rb(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()){var e=d.value;d=e[0];(e=Rb(e[1]))?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Rb(this.map);this.depth&&Rb(this.ctx);return this};u.searchCache=yb;
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()){var e=d.value;d=e[0];(e=Sb(e[1]))?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Sb(this.map);this.depth&&Sb(this.ctx);return this};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 g=Ya(this.reg);break;case 1:e="cfg";g=null;break;case 2:e="map";g=Ua(this.map,this.reg.size);break;case 3:e="ctx";g=Wa(this.ctx,this.reg.size);break;default:return}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(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);break;case "map":this.map=Va(b,this.map);break;case "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 g=e.next();!g.done;g=e.next()){var f=g.value;g=f[0];f=f[1];for(var h="",k=0,l;k<f.length;k++){l=f[k]||[""];for(var m="",n=0;n<l.length;n++)m+=(m?",":"")+("string"===c?'"'+l[n]+'"':l[n]);m="["+m+"]";h+=(h?",":"")+m}h='["'+g+'",['+
h+"]]";d+=(d?",":"")+h}d="index.map=new Map(["+d+"]);";e="";g=w(this.ctx.entries());for(f=g.next();!f.done;f=g.next())for(h=f.value,f=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='["'+f+'",'+m+"]";e+=(e?",":"")+m}e="index.ctx=new Map(["+e+"]);";return a?"function inject(index){"+
b+d+e+"}":b+d+e};Na(O.prototype);var Sb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Tb=["map","ctx","tag","reg","cfg"];
function Wb(a,b){b=void 0===b?{}:b;if(!this)return new Wb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}u=Wb.prototype;u.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
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);d.onupgradeneeded=function(){var e=a.db=this.result;Tb.forEach(function(g){e.objectStoreNames.contains(g)||e.createObjectStore(g)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.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(){var a=Sb.deleteDatabase(this.id+(this.field?":"+this.field:""));return Z(a)};u.clear=function(){for(var a=this.db.transaction(Tb,"readwrite"),b=0;b<Tb.length;b++)a.objectStore(Tb[b]).clear();return Z(a)};
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;g=void 0===g?!1:g;a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);var f=this;return Z(a).then(function(h){var k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(var l=0,m=void 0;l<h.length;l++)if((m=h[l])&&m.length)if(d>=m.length)d-=m.length;else{for(var n=c?d+Math.min(m.length-d,c):m.length,p=d;p<n;p++)k.push(m[p]);d=0;if(k.length===c)break}return g?
f.enrich(k):k}return h})};u.tag=function(a,b,c,d){b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?!1:d;a=this.db.transaction("tag","readonly").objectStore("tag").get(a);var e=this;return Z(a).then(function(g){if(!g||!g.length||c>=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<a.length;d++)c[d]=Z(b.get(a[d]));return Promise.all(c).then(function(e){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 Z(a)};u.search=null;u.info=function(){};
b+d+e+"}":b+d+e};Ja(R.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 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.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}u=Vb.prototype;u.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
u.open=function(){var a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){var d=Tb.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){var e=a.db=this.result;Ub.forEach(function(g){e.objectStoreNames.contains(g)||e.createObjectStore(g)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.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(){var a=Tb.deleteDatabase(this.id+(this.field?":"+this.field:""));return Yb(a)};u.clear=function(){for(var a=this.db.transaction(Ub,"readwrite"),b=0;b<Ub.length;b++)a.objectStore(Ub[b]).clear();return Yb(a)};
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;g=void 0===g?!1:g;a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);var f=this;return Yb(a).then(function(h){var k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(var l=0,m=void 0;l<h.length;l++)if((m=h[l])&&m.length)if(d>=m.length)d-=m.length;else{for(var n=c?d+Math.min(m.length-d,c):m.length,p=d;p<n;p++)k.push(m[p]);d=0;if(k.length===c)break}return g?
f.enrich(k):k}return h})};u.tag=function(a,b,c,d){b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?!1:d;a=this.db.transaction("tag","readonly").objectStore("tag").get(a);var e=this;return Yb(a).then(function(g){if(!g||!g.length||c>=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<a.length;d++)c[d]=Yb(b.get(a[d]));return Promise.all(c).then(function(e){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 Yb(a)};u.search=null;u.info=function(){};
u.transaction=function(a,b,c){var d=this,e=this.h[a+":"+b];if(e)return c.call(this,e);var g=this.db.transaction(a,b);this.h[a+":"+b]=e=g.objectStore(a);return new Promise(function(f,h){g.onerror=function(k){d.h[a+":"+b]=null;g.abort();g=e=null;h(k)};g.oncomplete=function(k){g=e=d.h[a+":"+b]=null;f(k||!0)};return c.call(d,e)})};
u.commit=function(a,b,c){var d=this,e,g,f;return ta(function(h){switch(h.h){case 1:if(b)return E(h,d.clear(),12);e=a.commit_task;a.commit_task=[];g=0;f=void 0;case 4:if(!(g<e.length)){h.h=6;break}f=e[g];if(!f.clear){e[g]=f.ma;h.h=5;break}return E(h,d.clear(),8);case 8:b=!0;h.h=6;break;case 5:g++;h.h=4;break;case 6:if(b){h.h=3;break}c||(e=e.concat(xa(a.reg)));if(!e.length){h.h=10;break}return E(h,d.remove(e),11);case 11:case 10:h.h=3;break;case 12: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,Z:void 0},m=l.next())m=m.value,n.Z=m[0],n.O=m[1],n.O.length&&(b?k.put(n.O,n.Z):k.get(n.Z).onsuccess=function(p){return function(){var q=this.result,r;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 z=0;z<A.length;z++)r.push(A[z]);else q[t]=A;r=1}}else q=p.O,r=1;r&&k.put(q,p.Z)}}(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()){m=m.value;n.V=m[0];m=w(m[1]);for(var p=m.next(),q={};!p.done;q={P:void 0,Y:void 0},p=m.next())p=p.value,q.Y=p[0],q.P=p[1],q.P.length&&(b?k.put(q.P,n.V+":"+q.Y):k.get(n.V+":"+q.Y).onsuccess=function(r,x){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)for(var D=0;D<y.length;D++)A.push(y[D]);else t[v]=y;A=1}}else t=
r.P,A=1;A&&k.put(t,x.V+":"+r.Y)}}(q,n))}}),14);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()){var n=m.value;m=n[0];n=n[1];k.put("object"===typeof n?JSON.stringify(n):1,m)}}),16);if(a.bypass){h.h=16;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())k.put(1,m.value)}),16);case 16:if(!a.tag){h.h=20;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())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;q=q&&q.length?q.concat(p.X):p.X;k.put(q,p.ba)}}(n))}),20);case 20:a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear(),h.h=0}})};
function Xb(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(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{d[h]=[];break}f+=k.length}if(c)break}f?e&&a.update(d):a.delete();a.continue()}
u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Xb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Xb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Xb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise(function(b,c){a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};var Yb={Index:O,Charset:Hb,Encoder:Ga,Document:V,Worker:R,Resolver:X,IndexedDB:Wb,Language:{}},Zb=self,$b;($b=Zb.define)&&$b.amd?$b([],function(){return Yb}):"object"===typeof Zb.exports?Zb.exports=Yb:Zb.FlexSearch=Yb;}(this||self));
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(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{d[h]=[];break}f+=k.length}if(c)break}f?e&&a.update(d):a.delete();a.continue()}
u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Zb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Zb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Zb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])};
function Yb(a){return new Promise(function(b,c){a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};var $b={Index:R,Charset:Ib,Encoder:Ga,Document:W,Worker:S,Resolver:Y,IndexedDB:Vb,Language:{}},ac="undefined"!==typeof self?self:"undefined"!==typeof global?global:"undefined"!==typeof window?window:{},bc;(bc=ac.define)&&bc.amd?bc([],function(){return $b}):"object"===typeof ac.exports?ac.exports=$b:ac.FlexSearch=$b;}(this||self));

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.107 (Light/Debug)
* FlexSearch.js v0.8.108 (Light/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -47,23 +47,23 @@ function u(a, c, b) {
function w() {
return Object.create(null);
}
function x(a) {
function aa(a) {
let c = 0;
for (let b = 0, d; b < a.length; b++) {
(d = a[b]) && c < d.length && (c = d.length);
}
return c;
}
;const aa = /[^\p{L}\p{N}]+/u, ba = /(\d{3})/g, ca = /(\D)(\d{3})/g, da = /(\d{3})(\D)/g, y = "".normalize && /[\u0300-\u036f]/g;
function z(a) {
if (!this || this.constructor !== z) {
return new z(...arguments);
;const ba = /[^\p{L}\p{N}]+/u, ca = /(\d{3})/g, da = /(\D)(\d{3})/g, ea = /(\d{3})(\D)/g, x = "".normalize && /[\u0300-\u036f]/g;
function y(a) {
if (!this || this.constructor !== y) {
return new y(...arguments);
}
for (let c = 0; c < arguments.length; c++) {
this.assign(arguments[c]);
}
}
t = z.prototype;
t = y.prototype;
t.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split, d;
@@ -91,7 +91,7 @@ t.assign = function(a) {
this.numeric = u(a.numeric, d);
} else {
try {
this.split = u(this.split, aa);
this.split = u(this.split, ba);
} catch (e) {
console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
@@ -132,13 +132,13 @@ t.addStemmer = function(a, c) {
this.stemmer.set(a, c);
this.h += (this.h ? "|" : "") + a;
this.A = null;
this.cache && B(this);
this.cache && z(this);
return this;
};
t.addFilter = function(a) {
this.filter || (this.filter = new Set());
this.filter.add(a);
this.cache && B(this);
this.cache && z(this);
return this;
};
t.addMapper = function(a, c) {
@@ -150,7 +150,7 @@ t.addMapper = function(a, c) {
}
this.mapper || (this.mapper = new Map());
this.mapper.set(a, c);
this.cache && B(this);
this.cache && z(this);
return this;
};
t.addMatcher = function(a, c) {
@@ -164,7 +164,7 @@ t.addMatcher = function(a, c) {
this.matcher.set(a, c);
this.g += (this.g ? "|" : "") + a;
this.v = null;
this.cache && B(this);
this.cache && z(this);
return this;
};
t.addReplacer = function(a, c) {
@@ -173,7 +173,7 @@ t.addReplacer = function(a, c) {
}
this.replacer || (this.replacer = []);
this.replacer.push(a, c);
this.cache && B(this);
this.cache && z(this);
return this;
};
t.encode = function(a) {
@@ -183,12 +183,12 @@ t.encode = function(a) {
return this.i.get(a);
}
} else {
this.l = setTimeout(B, 50, this);
this.l = setTimeout(z, 50, this);
}
}
this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = y ? a.normalize("NFKD").replace(y, "").toLowerCase() : a.toLowerCase());
this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = x ? a.normalize("NFKD").replace(x, "").toLowerCase() : a.toLowerCase());
this.prepare && (a = this.prepare(a));
this.numeric && 3 < a.length && (a = a.replace(ca, "$1 $2").replace(da, "$1 $2").replace(ba, "$1 "));
this.numeric && 3 < a.length && (a = a.replace(da, "$1 $2").replace(ea, "$1 $2").replace(ca, "$1 "));
const c = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
let b = [], d = this.split || "" === this.split ? a.split(this.split) : a;
for (let g = 0, f, h; g < d.length; g++) {
@@ -205,7 +205,7 @@ t.encode = function(a) {
continue;
}
} else {
this.l = setTimeout(B, 50, this);
this.l = setTimeout(z, 50, this);
}
}
this.stemmer && 2 < f.length && (this.A || (this.A = new RegExp("(?!^)(" + this.h + ")$")), f = f.replace(this.A, k => this.stemmer.get(k)), f.length < this.minlength || this.filter && this.filter.has(f)) && (f = "");
@@ -232,12 +232,125 @@ t.encode = function(a) {
this.cache && a.length <= this.o && (this.i.set(a, b), this.i.size > this.C && (this.i.clear(), this.o = this.o / 1.1 | 0));
return b;
};
function B(a) {
function z(a) {
a.l = null;
a.i.clear();
a.j.clear();
}
;function C(a, c, b, d, e) {
;let A, C;
async function fa(a) {
a = a.data;
const c = a.task, b = a.id;
let d = a.args;
switch(c) {
case "init":
C = a.options || {};
(a = a.factory) ? (Function("return " + a)()(self), A = new self.FlexSearch.Index(C), delete self.FlexSearch) : A = new D(C);
postMessage({id:b});
break;
default:
let e;
"export" === c && (d = [C.export]);
"import" === c ? await C.import.call(A, A) : e = A[c].apply(A, d);
postMessage("search" === c ? {id:b, msg:e} : {id:b});
}
}
;let E, F;
const G = {}, H = {};
function ha(a) {
E = 0;
G[a] = H[a];
}
function I(a) {
this[a + "Async"] = function() {
const c = arguments;
var b = c[c.length - 1];
let d;
"function" === typeof b && (d = b, delete c[c.length - 1]);
E || (E = setTimeout(ha, 0, a), F = Date.now());
H[a] || (H[a] = G[a] = 1000);
if (!--G[a]) {
G[a] = H[a] = H[a] * this.priority * this.priority * 3 / (Date.now() - F) | 0 || 1;
E = clearTimeout(E);
const g = this;
return new Promise(f => {
setTimeout(function() {
f(g[a + "Async"].apply(g, c));
}, 0);
});
}
const e = this[a].apply(this, c);
b = e.then ? e : new Promise(g => g(e));
d && b.then(d);
return b;
};
}
;let J = 0;
function K(a = {}) {
function c(f) {
function h(k) {
k = k.data || k;
const l = k.id, n = l && e.g[l];
n && (n(k.msg), delete e.g[l]);
}
this.worker = f;
this.g = w();
if (this.worker) {
d ? this.worker.on("message", h) : this.worker.onmessage = h;
if (a.config) {
return new Promise(function(k) {
e.g[++J] = function() {
k(e);
};
e.worker.postMessage({id:J, task:"init", factory:b, options:a});
});
}
this.worker.postMessage({task:"init", factory:b, options:a});
return this;
}
}
if (!this || this.constructor !== K) {
return new K(a);
}
let b = "undefined" !== typeof self ? self._factory : "undefined" !== typeof window ? window._factory : null;
b && (b = b.toString());
const d = "undefined" === typeof window, e = this, g = ia(b, d, a.worker);
return g.then ? g.then(function(f) {
return c.call(e, f);
}) : c.call(this, g);
}
L("add");
L("append");
L("search");
L("update");
L("remove");
L("clear");
L("export");
L("import");
var M = K.prototype;
I.call(M, "add");
I.call(M, "append");
I.call(M, "search");
I.call(M, "update");
I.call(M, "remove");
function L(a) {
K.prototype[a] = async function() {
const c = this, b = [].slice.call(arguments);
var d = b[b.length - 1];
let e;
"function" === typeof d && (e = d, b.splice(b.length - 1, 1));
d = new Promise(function(g) {
c.g[++J] = g;
c.worker.postMessage({task:a, id:J, args:b});
});
return e ? (d.then(e), this) : d;
};
}
function ia(a, c, b) {
return c ? "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=" + fa.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof b ? b : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"), {type:"module"});
}
;function ja(a, c, b, d, e) {
const g = a.length;
let f = [], h, k;
h = w();
@@ -252,7 +365,7 @@ function B(a) {
}
if (a = f.length) {
if (e) {
f = 1 < f.length ? D(f, b, d) : (f = f[0]).length > b || d ? f.slice(d, b + d) : f;
f = 1 < f.length ? la(f, b, d) : (f = f[0]).length > b || d ? f.slice(d, b + d) : f;
} else {
if (a < g) {
return [];
@@ -267,7 +380,7 @@ function B(a) {
}
return f;
}
function D(a, c, b) {
function la(a, c, b) {
const d = [], e = w();
let g;
var f = a.length;
@@ -289,12 +402,12 @@ function D(a, c, b) {
}
return d;
}
;function E(a, c, b, d) {
;function N(a, c, b, d) {
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, d ? F.call(this, a) : a;
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a, d ? O.call(this, a) : a;
}
let e = [];
for (let g = 0, f, h; g < a.length; g++) {
@@ -308,7 +421,7 @@ function D(a, c, b) {
}
h > c && (f = f.slice(0, c), h = c);
if (!e.length && h >= c) {
return d ? F.call(this, f) : f;
return d ? O.call(this, f) : f;
}
e.push(f);
c -= h;
@@ -318,9 +431,9 @@ function D(a, c, b) {
}
}
e = 1 < e.length ? [].concat.apply([], e) : e[0];
return d ? F.call(this, e) : e;
return d ? O.call(this, e) : e;
}
;function G(a, c, b) {
;function P(a, c, b) {
var d = b[0];
if (d.then) {
return Promise.all(b).then(function(n) {
@@ -335,7 +448,7 @@ function D(a, c, b) {
for (let n = 0, m; n < b.length; n++) {
if (m = b[n]) {
let r;
if (m.constructor === I) {
if (m.constructor === Q) {
r = m.result;
} else if (m.constructor === Array) {
r = m;
@@ -366,11 +479,11 @@ function D(a, c, b) {
}
return {m:d, u:e, limit:g, offset:f, enrich:h, resolve:k, suggest:l};
}
;I.prototype.or = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g} = G(this, "or", arguments);
return J.call(this, a, c, b, d, e, g);
;Q.prototype.or = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g} = P(this, "or", arguments);
return ma.call(this, a, c, b, d, e, g);
};
function J(a, c, b, d, e, g) {
function ma(a, c, b, d, e, g) {
if (c.length) {
const f = this;
return Promise.all(c).then(function(h) {
@@ -378,25 +491,25 @@ function J(a, c, b, d, e, g) {
for (let k = 0, l; k < h.length; k++) {
(l = h[k]).length && (a[k] = l);
}
return J.call(f, a, [], b, d, e, g);
return ma.call(f, a, [], b, d, e, g);
});
}
a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = D(a, b, d), d = 0));
a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = la(a, b, d), d = 0));
return g ? this.resolve(b, d, e) : this;
}
;I.prototype.and = function() {
;Q.prototype.and = function() {
let a = this.result.length, c, b, d, e;
if (!a) {
const g = arguments[0];
g && (a = !!g.suggest, e = g.resolve, c = g.limit, b = g.offset, d = g.enrich && e);
}
if (a) {
const {m:g, u:f, limit:h, offset:k, enrich:l, resolve:n, suggest:m} = G(this, "and", arguments);
return K.call(this, g, f, h, k, l, n, m);
const {m:g, u:f, limit:h, offset:k, enrich:l, resolve:n, suggest:m} = P(this, "and", arguments);
return na.call(this, g, f, h, k, l, n, m);
}
return e ? this.resolve(c, b, d) : this;
};
function K(a, c, b, d, e, g, f) {
function na(a, c, b, d, e, g, f) {
if (c.length) {
const h = this;
return Promise.all(c).then(function(k) {
@@ -404,15 +517,15 @@ function K(a, c, b, d, e, g, f) {
for (let l = 0, n; l < k.length; l++) {
(n = k[l]).length && (a[l] = n);
}
return K.call(h, a, [], b, d, e, g, f);
return na.call(h, a, [], b, d, e, g, f);
});
}
if (a.length) {
if (this.result.length && a.unshift(this.result), 2 > a.length) {
this.result = a[0];
} else {
if (c = x(a)) {
return this.result = C(a, c, b, d, f), g ? e ? F.call(this.index, this.result) : this.result : this;
if (c = aa(a)) {
return this.result = ja(a, c, b, d, f), g ? e ? O.call(this.index, this.result) : this.result : this;
}
this.result = [];
}
@@ -421,11 +534,11 @@ function K(a, c, b, d, e, g, f) {
}
return g ? this.resolve(b, d, e) : this;
}
;I.prototype.xor = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = G(this, "xor", arguments);
return L.call(this, a, c, b, d, e, g, f);
;Q.prototype.xor = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = P(this, "xor", arguments);
return oa.call(this, a, c, b, d, e, g, f);
};
function L(a, c, b, d, e, g, f) {
function oa(a, c, b, d, e, g, f) {
if (c.length) {
const h = this;
return Promise.all(c).then(function(k) {
@@ -433,21 +546,21 @@ function L(a, c, b, d, e, g, f) {
for (let l = 0, n; l < k.length; l++) {
(n = k[l]).length && (a[l] = n);
}
return L.call(h, a, [], b, d, e, g, f);
return oa.call(h, a, [], b, 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 = ea.call(this, a, b, d, g, this.g), g ? e ? F.call(this.index, this.result) : this.result : this;
return this.result = pa.call(this, a, b, d, g, this.g), g ? e ? O.call(this.index, this.result) : this.result : this;
}
} else {
f || (this.result = a);
}
return g ? this.resolve(b, d, e) : this;
}
function ea(a, c, b, d, e) {
function pa(a, c, b, d, e) {
const g = [], f = w();
let h = 0;
for (let k = 0, l; k < a.length; k++) {
@@ -492,11 +605,11 @@ function ea(a, c, b, d, e) {
}
return g;
}
;I.prototype.not = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = G(this, "not", arguments);
return M.call(this, a, c, b, d, e, g, f);
;Q.prototype.not = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = P(this, "not", arguments);
return qa.call(this, a, c, b, d, e, g, f);
};
function M(a, c, b, d, e, g, f) {
function qa(a, c, b, d, e, g, f) {
if (c.length) {
const h = this;
return Promise.all(c).then(function(k) {
@@ -504,17 +617,17 @@ function M(a, c, b, d, e, g, f) {
for (let l = 0, n; l < k.length; l++) {
(n = k[l]).length && (a[l] = n);
}
return M.call(h, a, [], b, d, e, g, f);
return qa.call(h, a, [], b, d, e, g, f);
});
}
if (a.length && this.result.length) {
this.result = fa.call(this, a, b, d, g);
this.result = ra.call(this, a, b, d, g);
} else if (g) {
return this.resolve(b, d, e);
}
return g ? e ? F.call(this.index, this.result) : this.result : this;
return g ? e ? O.call(this.index, this.result) : this.result : this;
}
function fa(a, c, b, d) {
function ra(a, c, b, d) {
const e = [];
a = new Set(a.flat().flat());
for (let g = 0, f, h = 0; g < this.result.length; g++) {
@@ -540,9 +653,9 @@ function fa(a, c, b, d) {
}
return e;
}
;function I(a) {
if (!this || this.constructor !== I) {
return new I(a);
;function Q(a) {
if (!this || this.constructor !== Q) {
return new Q(a);
}
if (a && a.index) {
return a.resolve = !1, this.index = a.index, this.g = a.boost || 0, this.result = a.index.search(a).result, this;
@@ -551,7 +664,7 @@ function fa(a, c, b, d) {
this.result = a || [];
this.g = 0;
}
I.prototype.limit = function(a) {
Q.prototype.limit = function(a) {
if (this.result.length) {
const c = [];
for (let b = 0, d; b < this.result.length; b++) {
@@ -570,7 +683,7 @@ I.prototype.limit = function(a) {
}
return this;
};
I.prototype.offset = function(a) {
Q.prototype.offset = function(a) {
if (this.result.length) {
const c = [];
for (let b = 0, d; b < this.result.length; b++) {
@@ -582,17 +695,17 @@ I.prototype.offset = function(a) {
}
return this;
};
I.prototype.boost = function(a) {
Q.prototype.boost = function(a) {
this.g += a;
return this;
};
I.prototype.resolve = function(a, c, b) {
Q.prototype.resolve = function(a, c, b) {
const d = this.result, e = this.index;
this.result = this.index = null;
return d.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), E.call(e, d, a || 100, c, b)) : d;
return d.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), N.call(e, d, a || 100, c, b)) : d;
};
w();
function F(a) {
function O(a) {
if (!this || !this.store) {
return a;
}
@@ -602,35 +715,35 @@ function F(a) {
}
return c;
}
;function N(a) {
;function S(a) {
this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map();
this.g = "";
}
N.prototype.set = function(a, c) {
S.prototype.set = function(a, c) {
this.cache.set(this.g = a, c);
this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value);
};
N.prototype.get = function(a) {
S.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;
};
N.prototype.remove = function(a) {
S.prototype.remove = function(a) {
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
N.prototype.clear = function() {
S.prototype.clear = function() {
this.cache.clear();
this.g = "";
};
const ha = {normalize:function(a) {
const sa = {normalize:function(a) {
return a.toLowerCase();
}};
const O = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
P.prototype.add = function(a, c, b, d) {
const ta = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
D.prototype.add = function(a, c, b, d) {
if (c && (a || 0 === a)) {
if (!d && !b && this.reg.has(a)) {
return this.update(a, c);
@@ -642,15 +755,15 @@ P.prototype.add = function(a, c, b, d) {
let p = c[this.rtl ? d - 1 - q : q];
var e = p.length;
if (e && (m || !n[p])) {
var g = this.score ? this.score(c, p, q, null, 0) : Q(r, d, q), f = "";
var g = this.score ? this.score(c, p, q, null, 0) : T(r, d, q), f = "";
switch(this.tokenize) {
case "full":
if (2 < e) {
for (g = 0; g < e; g++) {
for (var h = e; h > g; h--) {
f = p.substring(g, h);
var k = this.score ? this.score(c, p, q, f, g) : Q(r, d, q, e, g);
R(this, n, f, k, a, b);
var k = this.score ? this.score(c, p, q, f, g) : T(r, d, q, e, g);
U(this, n, f, k, a, b);
}
}
break;
@@ -658,24 +771,24 @@ P.prototype.add = function(a, c, b, d) {
case "reverse":
if (1 < e) {
for (h = e - 1; 0 < h; h--) {
f = p[h] + f, k = this.score ? this.score(c, p, q, f, h) : Q(r, d, q, e, h), R(this, n, f, k, a, b);
f = p[h] + f, k = this.score ? this.score(c, p, q, f, h) : T(r, d, q, e, h), U(this, n, f, k, a, b);
}
f = "";
}
case "forward":
if (1 < e) {
for (h = 0; h < e; h++) {
f += p[h], R(this, n, f, g, a, b);
f += p[h], U(this, n, f, g, a, b);
}
break;
}
default:
if (R(this, n, p, g, a, b), m && 1 < d && q < d - 1) {
if (U(this, n, p, g, a, b), m && 1 < d && q < d - 1) {
for (e = w(), f = this.B, g = p, h = Math.min(m + 1, d - q), e[g] = 1, k = 1; k < h; k++) {
if ((p = c[this.rtl ? d - 1 - q - k : q + k]) && !e[p]) {
e[p] = 1;
const v = this.score ? this.score(c, g, q, p, k) : Q(f + (d / 2 > f ? 0 : 1), d, q, h - 1, k - 1), A = this.bidirectional && p > g;
R(this, l, A ? g : p, v, a, b, A ? p : g);
const v = this.score ? this.score(c, g, q, p, k) : T(f + (d / 2 > f ? 0 : 1), d, q, h - 1, k - 1), B = this.bidirectional && p > g;
U(this, l, B ? g : p, v, a, b, B ? p : g);
}
}
}
@@ -687,16 +800,16 @@ P.prototype.add = function(a, c, b, d) {
}
return this;
};
function R(a, c, b, d, e, g, f) {
function U(a, c, b, d, e, g, f) {
let h = f ? a.ctx : a.map, k;
if (!c[b] || f && !(k = c[b])[f]) {
f ? (c = k || (c[b] = w()), c[f] = 1, (k = h.get(f)) ? h = k : h.set(f, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[d] || (h[d] = []), g && h.includes(e) || (h.push(e), a.fastupdate && ((c = a.reg.get(e)) ? c.push(h) : a.reg.set(e, [h])));
}
}
function Q(a, c, b, d, e) {
function T(a, c, b, d, e) {
return b && 1 < a ? c + (d || 0) <= a ? b + (e || 0) : (a - 1) / (c + (d || 0)) * (b + (e || 0)) + 1 | 0 : 0;
}
;P.prototype.search = function(a, c, b) {
;D.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
var d = [], e = 0;
if (b) {
@@ -714,11 +827,11 @@ function Q(a, c, b, d, e) {
a = b.length;
c = c || (h ? 100 : 0);
if (1 === a) {
return S.call(this, b[0], "", c, e, h);
return ua.call(this, b[0], "", c, e, h);
}
g = this.depth && !1 !== g;
if (2 === a && g && !f) {
return S.call(this, b[0], b[1], c, e, h);
return ua.call(this, b[0], b[1], c, e, h);
}
h = w();
let l = 0;
@@ -730,29 +843,29 @@ function Q(a, c, b, d, e) {
for (let p, v; l < a; l++) {
if ((v = b[l]) && !h[v]) {
h[v] = 1;
p = T(this, v, n);
p = va(this, v, n);
a: {
g = p;
var m = d, r = f, q = k;
let A = [];
let B = [];
if (g && g.length) {
if (g.length <= q) {
m.push(g);
p = void 0;
break a;
}
for (let H = 0, Y; H < q; H++) {
if (Y = g[H]) {
A[H] = Y;
for (let R = 0, ka; R < q; R++) {
if (ka = g[R]) {
B[R] = ka;
}
}
if (A.length) {
m.push(A);
if (B.length) {
m.push(B);
p = void 0;
break a;
}
}
p = r ? void 0 : A;
p = r ? void 0 : B;
}
if (p) {
d = p;
@@ -766,27 +879,27 @@ function Q(a, c, b, d, e) {
n = d.length;
a = d;
if (1 < n) {
a = C(d, k, c, e, f);
a = ja(d, k, c, e, f);
} else if (1 === n) {
f = E.call(null, d[0], c, e);
f = N.call(null, d[0], c, e);
break a;
}
f = a;
}
return f;
};
function S(a, c, b, d, e) {
a = T(this, a, c);
function ua(a, c, b, d, e) {
a = va(this, a, c);
e = !0;
return a && a.length ? e ? E.call(this, a, b, d) : new I(a) : e ? [] : new I();
return a && a.length ? e ? N.call(this, a, b, d) : new Q(a) : e ? [] : new Q();
}
function T(a, c, b) {
function va(a, c, b) {
let d;
b && (d = a.bidirectional && c > b) && (d = b, b = c, c = d);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
return a;
}
;P.prototype.remove = function(a, c) {
;D.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) {
@@ -801,14 +914,14 @@ function T(a, c, b) {
}
}
} else {
U(this.map, a), this.depth && U(this.ctx, a);
V(this.map, a), this.depth && V(this.ctx, a);
}
c || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function U(a, c) {
function V(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let d = 0, e, g; d < a.length; d++) {
@@ -823,25 +936,25 @@ function U(a, c) {
}
} else {
for (let d of a.entries()) {
const e = d[0], g = U(d[1], c);
const e = d[0], g = V(d[1], c);
g ? b += g : a.delete(e);
}
}
return b;
}
;function P(a, c) {
if (!this || this.constructor !== P) {
return new P(a);
;function D(a, c) {
if (!this || this.constructor !== D) {
return new D(a);
}
if (a) {
var b = "string" === typeof a ? a : a.preset;
b && (O[b] || console.warn("Preset not found: " + b), a = Object.assign({}, O[b], a));
b && (ta[b] || console.warn("Preset not found: " + b), a = Object.assign({}, ta[b], a));
} else {
a = {};
}
b = a.context;
const d = !0 === b ? {depth:1} : b || {}, e = a.encode || a.encoder || ha;
this.encoder = e.encode ? e : "object" === typeof e ? new z(e) : {encode:e};
const d = !0 === b ? {depth:1} : b || {}, e = a.encode || a.encoder || sa;
this.encoder = e.encode ? e : "object" === typeof e ? new y(e) : {encode:e};
this.resolution = a.resolution || 9;
this.tokenize = b = a.tokenize || "strict";
this.depth = "strict" === b && d.depth || 0;
@@ -854,9 +967,9 @@ function U(a, c) {
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.B = d.resolution || 3;
this.rtl = e.rtl || a.rtl || !1;
this.cache = (b = a.cache || null) && new N(b);
this.cache = (b = a.cache || null) && new S(b);
}
t = P.prototype;
t = D.prototype;
t.clear = function() {
this.map.clear();
this.ctx.clear();
@@ -874,7 +987,7 @@ t.update = function(a, c) {
const b = this, d = this.remove(a);
return d && d.then ? d.then(() => b.add(a, c)) : this.add(a, c);
};
function V(a) {
function W(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, d; b < a.length; b++) {
@@ -882,7 +995,7 @@ function V(a) {
}
} else {
for (const b of a) {
const d = b[0], e = V(b[1]);
const d = b[0], e = W(b[1]);
e ? c += e : a.delete(d);
}
}
@@ -892,13 +1005,13 @@ t.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
V(this.map);
this.depth && V(this.ctx);
W(this.map);
this.depth && W(this.ctx);
return this;
};
t.searchCache = function(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new N());
this.cache || (this.cache = new S());
let d = this.cache.get(a);
if (!d) {
d = this.search(a, c, b);
@@ -913,9 +1026,9 @@ t.searchCache = function(a, c, b) {
}
return d;
};
const W = {Index:P, Charset:null, Encoder:z, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, X = self;
const X = {Index:D, Charset:null, Encoder:y, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, Y = "undefined" !== typeof self ? self : "undefined" !== typeof global ? global : "undefined" !== typeof window ? window : {};
let Z;
(Z = X.define) && Z.amd ? Z([], function() {
return W;
}) : "object" === typeof X.exports ? X.exports = W : X.FlexSearch = W;
(Z = Y.define) && Z.amd ? Z([], function() {
return X;
}) : "object" === typeof Y.exports ? Y.exports = X : Y.FlexSearch = X;
}(this||self));

View File

@@ -1,34 +1,40 @@
/**!
* FlexSearch.js v0.8.107 (Light)
* FlexSearch.js v0.8.108 (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 t;function u(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)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 f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function w(){return Object.create(null)}
function x(a){let c=0;for(let b=0,d;b<a.length;b++)(d=a[b])&&c<d.length&&(c=d.length);return c};const y=/[^\p{L}\p{N}]+/u,aa=/(\d{3})/g,ba=/(\D)(\d{3})/g,ca=/(\d{3})(\D)/g,z="".normalize&&/[\u0300-\u036f]/g;function B(a){if(!this||this.constructor!==B)return new B(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}t=B.prototype;
function aa(a){let c=0;for(let b=0,d;b<a.length;b++)(d=a[b])&&c<d.length&&(c=d.length);return c};const ba=/[^\p{L}\p{N}]+/u,ca=/(\d{3})/g,da=/(\D)(\d{3})/g,ea=/(\d{3})(\D)/g,x="".normalize&&/[\u0300-\u036f]/g;function y(a){if(!this||this.constructor!==y)return new y(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}t=y.prototype;
t.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,d;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let e="";d=!c;c||(e+="\\p{Z}");b.letter&&(e+="\\p{L}");b.number&&(e+="\\p{N}",d=!!c);b.symbol&&(e+="\\p{S}");b.punctuation&&(e+="\\p{P}");b.control&&(e+="\\p{C}");if(b=b.char)e+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+e+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,d=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,d)}else{try{this.split=u(this.split,y)}catch(e){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),
this.numeric=u(a.numeric,d)}else{try{this.split=u(this.split,ba)}catch(e){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.C="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.s=this.o=128;this.g="";this.v=null;this.h="";this.A=null;if(this.matcher)for(const e of this.matcher.keys())this.g+=(this.g?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.h+=(this.h?"|":"")+e;return this};
t.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.A=null;this.cache&&C(this);return this};t.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&C(this);return this};t.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&C(this);return this};
t.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(2>a.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.v=null;this.cache&&C(this);return this};t.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&C(this);return this};
t.encode=function(a){if(this.cache&&a.length<=this.o)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(C,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=z?a.normalize("NFKD").replace(z,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(ba,"$1 $2").replace(ca,"$1 $2").replace(aa,"$1 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=[],
d=this.split||""===this.split?a.split(this.split):a;for(let g=0,f,h;g<d.length;g++)if((f=h=d[g])&&!(f.length<this.minlength))if(c)b.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.s)if(this.l){var e=this.j.get(f);if(e||""===e){e&&b.push(e);continue}}else this.l=setTimeout(C,50,this);this.stemmer&&2<f.length&&(this.A||(this.A=new RegExp("(?!^)("+this.h+")$")),f=f.replace(this.A,k=>this.stemmer.get(k)),f.length<this.minlength||this.filter&&this.filter.has(f))&&(f="");
t.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.A=null;this.cache&&z(this);return this};t.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&z(this);return this};t.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&z(this);return this};
t.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(2>a.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.v=null;this.cache&&z(this);return this};t.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&z(this);return this};
t.encode=function(a){if(this.cache&&a.length<=this.o)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(z,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=x?a.normalize("NFKD").replace(x,"").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 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=[],
d=this.split||""===this.split?a.split(this.split):a;for(let g=0,f,h;g<d.length;g++)if((f=h=d[g])&&!(f.length<this.minlength))if(c)b.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.s)if(this.l){var e=this.j.get(f);if(e||""===e){e&&b.push(e);continue}}else this.l=setTimeout(z,50,this);this.stemmer&&2<f.length&&(this.A||(this.A=new RegExp("(?!^)("+this.h+")$")),f=f.replace(this.A,k=>this.stemmer.get(k)),f.length<this.minlength||this.filter&&this.filter.has(f))&&(f="");
if(f&&(this.mapper||this.dedupe&&1<f.length)){e="";for(let k=0,l="",n,m;k<f.length;k++)n=f.charAt(k),n===l&&this.dedupe||((m=this.mapper&&this.mapper.get(n))||""===m?m===l&&this.dedupe||!(l=m)||(e+=m):e+=l=n);f=e}this.matcher&&1<f.length&&(this.v||(this.v=new RegExp("("+this.g+")","g")),f=f.replace(this.v,k=>this.matcher.get(k)));if(f&&this.replacer)for(e=0;f&&e<this.replacer.length;e+=2)f=f.replace(this.replacer[e],this.replacer[e+1]);this.cache&&h.length<=this.s&&(this.j.set(h,f),this.j.size>this.C&&
(this.j.clear(),this.s=this.s/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.o&&(this.i.set(a,b),this.i.size>this.C&&(this.i.clear(),this.o=this.o/1.1|0));return b};function C(a){a.l=null;a.i.clear();a.j.clear()};function D(a,c,b,d,e){const g=a.length;let f=[],h,k;h=w();for(let l=0,n,m,r,q;l<c;l++)for(let p=0;p<g;p++)if(r=a[p],l<r.length&&(n=r[l]))for(let v=0;v<n.length;v++)m=n[v],(k=h[m])?h[m]++:(k=0,h[m]=1),q=f[k]||(f[k]=[]),q.push(m);if(a=f.length)if(e)f=1<f.length?E(f,b,d):(f=f[0]).length>b||d?f.slice(d,b+d):f;else{if(a<g)return[];f=f[a-1];if(b||d)if(f.length>b||d)f=f.slice(d,b+d)}return f}
function E(a,c,b){const d=[],e=w();let g;var f=a.length;let h;for(let k=f-1;0<=k;k--)if(h=(f=a[k])&&f.length)for(let l=0;l<h;l++)if(g=f[l],!e[g])if(e[g]=1,b)b--;else if(d.push(g),d.length===c)return d;return d};function F(a,c,b,d){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,d?G.call(this,a):a;let e=[];for(let g=0,f,h;g<a.length;g++)if((f=a[g])&&(h=f.length)){if(b){if(b>=h){b-=h;continue}b<h&&(f=c?f.slice(b,b+c):f.slice(b),h=f.length,b=0)}h>c&&(f=f.slice(0,c),h=c);if(!e.length&&h>=c)return d?G.call(this,f):f;e.push(f);c-=h;if(!c)break}e=1<e.length?[].concat.apply([],e):e[0];return d?G.call(this,e):e};function I(a,c,b){var d=b[0];if(d.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(d[0]&&d[0].index)return a[c].apply(a,d);d=[];let e=[],g=0,f=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let r;if(m.constructor===J)r=m.result;else if(m.constructor===Array)r=m;else if(g=m.limit||0,f=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,r=m.index.search(m).result,m.resolve=k;else if(m.and)r=a.and(m.and);else if(m.or)r=a.or(m.or);else if(m.xor)r=a.xor(m.xor);
else if(m.not)r=a.not(m.not);else continue;if(r.then)e.push(r);else if(r.length)d[n]=r;else if(!l&&("and"===c||"xor"===c)){d=[];break}}return{m:d,u:e,limit:g,offset:f,enrich:h,resolve:k,suggest:l}};J.prototype.or=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g}=I(this,"or",arguments);return K.call(this,a,c,b,d,e,g)};function K(a,c,b,d,e,g){if(c.length){const f=this;return Promise.all(c).then(function(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);return K.call(f,a,[],b,d,e,g)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=E(a,b,d),d=0));return g?this.resolve(b,d,e):this};J.prototype.and=function(){let a=this.result.length,c,b,d,e;if(!a){const g=arguments[0];g&&(a=!!g.suggest,e=g.resolve,c=g.limit,b=g.offset,d=g.enrich&&e)}if(a){const {m:g,u:f,limit:h,offset:k,enrich:l,resolve:n,suggest:m}=I(this,"and",arguments);return L.call(this,g,f,h,k,l,n,m)}return e?this.resolve(c,b,d):this};
function L(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return L.call(h,a,[],b,d,e,g,f)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=x(a))return this.result=D(a,c,b,d,f),g?e?G.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(b,d,e):this};J.prototype.xor=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=I(this,"xor",arguments);return M.call(this,a,c,b,d,e,g,f)};
function M(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return M.call(h,a,[],b,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=da.call(this,a,b,d,g,this.g),g?e?G.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(b,d,e):this}
function da(a,c,b,d,e){const g=[],f=w();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k]){h<l.length&&(h=l.length);for(let n=0,m;n<l.length;n++)if(m=l[n])for(let r=0,q;r<m.length;r++)q=m[r],f[q]=f[q]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,r;m<a.length;m++)if(r=a[m])if(l=r[k])for(let q=0,p;q<l.length;q++)if(p=l[q],1===f[p])if(b)b--;else if(d){if(g.push(p),g.length===c)return g}else{const v=k+(m?e:0);g[v]||(g[v]=[]);g[v].push(p);if(++n===c)return g}return g};J.prototype.not=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=I(this,"not",arguments);return N.call(this,a,c,b,d,e,g,f)};function N(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return N.call(h,a,[],b,d,e,g,f)})}if(a.length&&this.result.length)this.result=ea.call(this,a,b,d,g);else if(g)return this.resolve(b,d,e);return g?e?G.call(this.index,this.result):this.result:this}
function ea(a,c,b,d){const e=[];a=new Set(a.flat().flat());for(let g=0,f,h=0;g<this.result.length;g++)if(f=this.result[g])for(let k=0,l;k<f.length;k++)if(l=f[k],!a.has(l))if(b)b--;else if(d){if(e.push(l),e.length===c)return e}else if(e[g]||(e[g]=[]),e[g].push(l),++h===c)return e;return e};function J(a){if(!this||this.constructor!==J)return new J(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.g=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.g=0}J.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])if(d.length<=a){if(c[b]=d,a-=d.length,!a)break}else{c[b]=d.slice(0,a);break}this.result=c}return this};
J.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])d.length<=a?a-=d.length:(c[b]=d.slice(a),a=0);this.result=c}return this};J.prototype.boost=function(a){this.g+=a;return this};J.prototype.resolve=function(a,c,b){const d=this.result,e=this.index;this.result=this.index=null;return d.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),F.call(e,d,a||100,c,b)):d};w();function G(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,d;b<a.length;b++)d=a[b],c[b]={id:d,doc:this.store.get(d)};return c};function O(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}O.prototype.set=function(a,c){this.cache.set(this.g=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};O.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};O.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
O.prototype.clear=function(){this.cache.clear();this.g=""};const fa={normalize:function(a){return a.toLowerCase()}};const ha={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};P.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const l=w(),n=w(),m=this.depth,r=this.resolution;for(let q=0;q<d;q++){let p=c[this.rtl?d-1-q:q];var e=p.length;if(e&&(m||!n[p])){var g=this.score?this.score(c,p,q,null,0):Q(r,d,q),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=p.substring(g,h);var k=this.score?this.score(c,p,q,f,g):Q(r,d,q,e,g);R(this,n,f,k,a,b)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)f=p[h]+f,k=this.score?this.score(c,p,q,f,h):Q(r,d,q,e,h),R(this,n,f,k,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=p[h],R(this,n,f,g,a,b);break}default:if(R(this,n,p,g,a,b),m&&1<d&&q<d-1)for(e=w(),f=this.B,g=p,h=Math.min(m+1,d-q),e[g]=1,k=1;k<h;k++)if((p=c[this.rtl?d-1-q-k:q+k])&&!e[p]){e[p]=1;const v=this.score?this.score(c,g,q,p,k):Q(f+(d/2>f?0:1),d,q,h-1,k-1),A=this.bidirectional&&p>g;R(this,l,A?g:p,v,a,b,A?p:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function R(a,c,b,d,e,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=w()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.reg.get(e))?c.push(h):a.reg.set(e,[h])))}function Q(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};P.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var d=[],e=0;if(b){a=b.query||a;c=b.limit||c;e=b.offset||0;var g=b.context;var f=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return S.call(this,b[0],"",c,e,h);g=this.depth&&!1!==g;if(2===a&&g&&!f)return S.call(this,b[0],b[1],c,e,h);h=w();let l=0;if(1<a&&g){var n=b[0];l=1}k||0===k||(k=n?this.B:this.resolution);for(let p,v;l<a;l++){if((v=
b[l])&&!h[v]){h[v]=1;p=T(this,v,n);a:{g=p;var m=d,r=f,q=k;let A=[];if(g&&g.length){if(g.length<=q){m.push(g);p=void 0;break a}for(let H=0,X;H<q;H++)if(X=g[H])A[H]=X;if(A.length){m.push(A);p=void 0;break a}}p=r?void 0:A}if(p){d=p;break}n&&(f&&p&&d.length||(n=v))}f&&n&&l===a-1&&!d.length&&(n="",l=-1,h=w())}a:{n=d.length;a=d;if(1<n)a=D(d,k,c,e,f);else if(1===n){f=F.call(null,d[0],c,e);break a}f=a}return f};
function S(a,c,b,d,e){a=T(this,a,c);e=!0;return a&&a.length?e?F.call(this,a,b,d):new J(a):e?[]:new J}function T(a,c,b){let d;b&&(d=a.bidirectional&&c>b)&&(d=b,b=c,c=d);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};P.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 d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else U(this.map,a),this.depth&&U(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function U(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){const e=d[0],g=U(d[1],c);g?b+=g:a.delete(e)}return b};function P(a,c){if(!this||this.constructor!==P)return new P(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},ha[b],a))}else a={};b=a.context;const d=!0===b?{depth:1}:b||{},e=a.encode||a.encoder||fa;this.encoder=e.encode?e:"object"===typeof e?new B(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=b=a.tokenize||"strict";this.depth="strict"===b&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=new Map;
this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.B=d.resolution||3;this.rtl=e.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new O(b)}t=P.prototype;t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};t.append=function(a,c){return this.add(a,c,!0)};t.contain=function(a){return this.reg.has(a)};t.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
function V(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=V(b[1]);e?c+=e:a.delete(d)}return c}t.cleanup=function(){if(!this.fastupdate)return this;V(this.map);this.depth&&V(this.ctx);return this};
t.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new O);let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d.then){const e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d};const W={Index:P,Charset:null,Encoder:B,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}},Y=self;let Z;(Z=Y.define)&&Z.amd?Z([],function(){return W}):"object"===typeof Y.exports?Y.exports=W:Y.FlexSearch=W;}(this||self));
(this.j.clear(),this.s=this.s/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.o&&(this.i.set(a,b),this.i.size>this.C&&(this.i.clear(),this.o=this.o/1.1|0));return b};function z(a){a.l=null;a.i.clear();a.j.clear()};let A,C;async function fa(a){a=a.data;const c=a.task,b=a.id;let d=a.args;switch(c){case "init":C=a.options||{};(a=a.factory)?(Function("return "+a)()(self),A=new self.FlexSearch.Index(C),delete self.FlexSearch):A=new D(C);postMessage({id:b});break;default:let e;"export"===c&&(d=[C.export]);"import"===c?await C.import.call(A,A):e=A[c].apply(A,d);postMessage("search"===c?{id:b,msg:e}:{id:b})}};let E,F;const G={},H={};function ha(a){E=0;G[a]=H[a]}
function I(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let d;"function"===typeof b&&(d=b,delete c[c.length-1]);E||(E=setTimeout(ha,0,a),F=Date.now());H[a]||(H[a]=G[a]=1E3);if(!--G[a]){G[a]=H[a]=H[a]*this.priority*this.priority*3/(Date.now()-F)|0||1;E=clearTimeout(E);const g=this;return new Promise(f=>{setTimeout(function(){f(g[a+"Async"].apply(g,c))},0)})}const e=this[a].apply(this,c);b=e.then?e:new Promise(g=>g(e));d&&b.then(d);return b}};let J=0;
function K(a={}){function c(f){function h(k){k=k.data||k;const l=k.id,n=l&&e.g[l];n&&(n(k.msg),delete e.g[l])}this.worker=f;this.g=w();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.g[++J]=function(){k(e)};e.worker.postMessage({id:J,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});return this}}if(!this||this.constructor!==K)return new K(a);let b="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;b&&(b=b.toString());const d="undefined"===typeof window,e=this,g=ia(b,d,a.worker);return g.then?g.then(function(f){return c.call(e,f)}):c.call(this,g)}L("add");L("append");L("search");L("update");L("remove");L("clear");L("export");L("import");var M=K.prototype;I.call(M,"add");I.call(M,"append");I.call(M,"search");I.call(M,"update");I.call(M,"remove");
function L(a){K.prototype[a]=async function(){const c=this,b=[].slice.call(arguments);var d=b[b.length-1];let e;"function"===typeof d&&(e=d,b.splice(b.length-1,1));d=new Promise(function(g){c.g[++J]=g;c.worker.postMessage({task:a,id:J,args:b})});return e?(d.then(e),this):d}}
function ia(a,c,b){return c?"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="+fa.toString()],{type:"text/javascript"}))):new window.Worker("string"===typeof b?b:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function ka(a,c,b,d,e){const g=a.length;let f=[],h,k;h=w();for(let l=0,n,m,r,q;l<c;l++)for(let p=0;p<g;p++)if(r=a[p],l<r.length&&(n=r[l]))for(let v=0;v<n.length;v++)m=n[v],(k=h[m])?h[m]++:(k=0,h[m]=1),q=f[k]||(f[k]=[]),q.push(m);if(a=f.length)if(e)f=1<f.length?la(f,b,d):(f=f[0]).length>b||d?f.slice(d,b+d):f;else{if(a<g)return[];f=f[a-1];if(b||d)if(f.length>b||d)f=f.slice(d,b+d)}return f}
function la(a,c,b){const d=[],e=w();let g;var f=a.length;let h;for(let k=f-1;0<=k;k--)if(h=(f=a[k])&&f.length)for(let l=0;l<h;l++)if(g=f[l],!e[g])if(e[g]=1,b)b--;else if(d.push(g),d.length===c)return d;return d};function N(a,c,b,d){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,d?O.call(this,a):a;let e=[];for(let g=0,f,h;g<a.length;g++)if((f=a[g])&&(h=f.length)){if(b){if(b>=h){b-=h;continue}b<h&&(f=c?f.slice(b,b+c):f.slice(b),h=f.length,b=0)}h>c&&(f=f.slice(0,c),h=c);if(!e.length&&h>=c)return d?O.call(this,f):f;e.push(f);c-=h;if(!c)break}e=1<e.length?[].concat.apply([],e):e[0];return d?O.call(this,e):e};function P(a,c,b){var d=b[0];if(d.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(d[0]&&d[0].index)return a[c].apply(a,d);d=[];let e=[],g=0,f=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let r;if(m.constructor===Q)r=m.result;else if(m.constructor===Array)r=m;else if(g=m.limit||0,f=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,r=m.index.search(m).result,m.resolve=k;else if(m.and)r=a.and(m.and);else if(m.or)r=a.or(m.or);else if(m.xor)r=a.xor(m.xor);
else if(m.not)r=a.not(m.not);else continue;if(r.then)e.push(r);else if(r.length)d[n]=r;else if(!l&&("and"===c||"xor"===c)){d=[];break}}return{m:d,u:e,limit:g,offset:f,enrich:h,resolve:k,suggest:l}};Q.prototype.or=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g}=P(this,"or",arguments);return ma.call(this,a,c,b,d,e,g)};function ma(a,c,b,d,e,g){if(c.length){const f=this;return Promise.all(c).then(function(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);return ma.call(f,a,[],b,d,e,g)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=la(a,b,d),d=0));return g?this.resolve(b,d,e):this};Q.prototype.and=function(){let a=this.result.length,c,b,d,e;if(!a){const g=arguments[0];g&&(a=!!g.suggest,e=g.resolve,c=g.limit,b=g.offset,d=g.enrich&&e)}if(a){const {m:g,u:f,limit:h,offset:k,enrich:l,resolve:n,suggest:m}=P(this,"and",arguments);return na.call(this,g,f,h,k,l,n,m)}return e?this.resolve(c,b,d):this};
function na(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return na.call(h,a,[],b,d,e,g,f)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=aa(a))return this.result=ka(a,c,b,d,f),g?e?O.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(b,d,e):this};Q.prototype.xor=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=P(this,"xor",arguments);return oa.call(this,a,c,b,d,e,g,f)};
function oa(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return oa.call(h,a,[],b,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=pa.call(this,a,b,d,g,this.g),g?e?O.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(b,d,e):this}
function pa(a,c,b,d,e){const g=[],f=w();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k]){h<l.length&&(h=l.length);for(let n=0,m;n<l.length;n++)if(m=l[n])for(let r=0,q;r<m.length;r++)q=m[r],f[q]=f[q]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,r;m<a.length;m++)if(r=a[m])if(l=r[k])for(let q=0,p;q<l.length;q++)if(p=l[q],1===f[p])if(b)b--;else if(d){if(g.push(p),g.length===c)return g}else{const v=k+(m?e:0);g[v]||(g[v]=[]);g[v].push(p);if(++n===c)return g}return g};Q.prototype.not=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=P(this,"not",arguments);return qa.call(this,a,c,b,d,e,g,f)};function qa(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return qa.call(h,a,[],b,d,e,g,f)})}if(a.length&&this.result.length)this.result=ra.call(this,a,b,d,g);else if(g)return this.resolve(b,d,e);return g?e?O.call(this.index,this.result):this.result:this}
function ra(a,c,b,d){const e=[];a=new Set(a.flat().flat());for(let g=0,f,h=0;g<this.result.length;g++)if(f=this.result[g])for(let k=0,l;k<f.length;k++)if(l=f[k],!a.has(l))if(b)b--;else if(d){if(e.push(l),e.length===c)return e}else if(e[g]||(e[g]=[]),e[g].push(l),++h===c)return e;return e};function Q(a){if(!this||this.constructor!==Q)return new Q(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.g=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.g=0}Q.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])if(d.length<=a){if(c[b]=d,a-=d.length,!a)break}else{c[b]=d.slice(0,a);break}this.result=c}return this};
Q.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])d.length<=a?a-=d.length:(c[b]=d.slice(a),a=0);this.result=c}return this};Q.prototype.boost=function(a){this.g+=a;return this};Q.prototype.resolve=function(a,c,b){const d=this.result,e=this.index;this.result=this.index=null;return d.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),N.call(e,d,a||100,c,b)):d};w();function O(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,d;b<a.length;b++)d=a[b],c[b]={id:d,doc:this.store.get(d)};return c};function S(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}S.prototype.set=function(a,c){this.cache.set(this.g=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};S.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};S.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
S.prototype.clear=function(){this.cache.clear();this.g=""};const sa={normalize:function(a){return a.toLowerCase()}};const ta={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};D.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const l=w(),n=w(),m=this.depth,r=this.resolution;for(let q=0;q<d;q++){let p=c[this.rtl?d-1-q:q];var e=p.length;if(e&&(m||!n[p])){var g=this.score?this.score(c,p,q,null,0):T(r,d,q),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=p.substring(g,h);var k=this.score?this.score(c,p,q,f,g):T(r,d,q,e,g);U(this,n,f,k,a,b)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)f=p[h]+f,k=this.score?this.score(c,p,q,f,h):T(r,d,q,e,h),U(this,n,f,k,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=p[h],U(this,n,f,g,a,b);break}default:if(U(this,n,p,g,a,b),m&&1<d&&q<d-1)for(e=w(),f=this.B,g=p,h=Math.min(m+1,d-q),e[g]=1,k=1;k<h;k++)if((p=c[this.rtl?d-1-q-k:q+k])&&!e[p]){e[p]=1;const v=this.score?this.score(c,g,q,p,k):T(f+(d/2>f?0:1),d,q,h-1,k-1),B=this.bidirectional&&p>g;U(this,l,B?g:p,v,a,b,B?p:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function U(a,c,b,d,e,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=w()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.reg.get(e))?c.push(h):a.reg.set(e,[h])))}function T(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};D.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var d=[],e=0;if(b){a=b.query||a;c=b.limit||c;e=b.offset||0;var g=b.context;var f=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return ua.call(this,b[0],"",c,e,h);g=this.depth&&!1!==g;if(2===a&&g&&!f)return ua.call(this,b[0],b[1],c,e,h);h=w();let l=0;if(1<a&&g){var n=b[0];l=1}k||0===k||(k=n?this.B:this.resolution);for(let p,v;l<a;l++){if((v=
b[l])&&!h[v]){h[v]=1;p=va(this,v,n);a:{g=p;var m=d,r=f,q=k;let B=[];if(g&&g.length){if(g.length<=q){m.push(g);p=void 0;break a}for(let R=0,ja;R<q;R++)if(ja=g[R])B[R]=ja;if(B.length){m.push(B);p=void 0;break a}}p=r?void 0:B}if(p){d=p;break}n&&(f&&p&&d.length||(n=v))}f&&n&&l===a-1&&!d.length&&(n="",l=-1,h=w())}a:{n=d.length;a=d;if(1<n)a=ka(d,k,c,e,f);else if(1===n){f=N.call(null,d[0],c,e);break a}f=a}return f};
function ua(a,c,b,d,e){a=va(this,a,c);e=!0;return a&&a.length?e?N.call(this,a,b,d):new Q(a):e?[]:new Q}function va(a,c,b){let d;b&&(d=a.bidirectional&&c>b)&&(d=b,b=c,c=d);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};D.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 d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else V(this.map,a),this.depth&&V(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function V(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){const e=d[0],g=V(d[1],c);g?b+=g:a.delete(e)}return b};function D(a,c){if(!this||this.constructor!==D)return new D(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},ta[b],a))}else a={};b=a.context;const d=!0===b?{depth:1}:b||{},e=a.encode||a.encoder||sa;this.encoder=e.encode?e:"object"===typeof e?new y(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=b=a.tokenize||"strict";this.depth="strict"===b&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=new Map;
this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.B=d.resolution||3;this.rtl=e.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new S(b)}t=D.prototype;t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};t.append=function(a,c){return this.add(a,c,!0)};t.contain=function(a){return this.reg.has(a)};t.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
function W(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=W(b[1]);e?c+=e:a.delete(d)}return c}t.cleanup=function(){if(!this.fastupdate)return this;W(this.map);this.depth&&W(this.ctx);return this};
t.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new S);let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d.then){const e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d};const X={Index:D,Charset:null,Encoder:y,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}},Y="undefined"!==typeof self?self:"undefined"!==typeof global?global:"undefined"!==typeof window?window:{};let Z;(Z=Y.define)&&Z.amd?Z([],function(){return X}):"object"===typeof Y.exports?Y.exports=X:Y.FlexSearch=X;}(this||self));

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.107 (Bundle/Debug)
* FlexSearch.js v0.8.108 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -46,23 +46,23 @@ function u(a, c, b) {
function w() {
return Object.create(null);
}
function x(a) {
function aa(a) {
let c = 0;
for (let b = 0, d; b < a.length; b++) {
(d = a[b]) && c < d.length && (c = d.length);
}
return c;
}
;const y = /[^\p{L}\p{N}]+/u, z = /(\d{3})/g, B = /(\D)(\d{3})/g, aa = /(\d{3})(\D)/g, C = "".normalize && /[\u0300-\u036f]/g;
function D(a) {
if (!this || this.constructor !== D) {
return new D(...arguments);
;const ba = /[^\p{L}\p{N}]+/u, ca = /(\d{3})/g, da = /(\D)(\d{3})/g, ea = /(\d{3})(\D)/g, x = "".normalize && /[\u0300-\u036f]/g;
function y(a) {
if (!this || this.constructor !== y) {
return new y(...arguments);
}
for (let c = 0; c < arguments.length; c++) {
this.assign(arguments[c]);
}
}
t = D.prototype;
t = y.prototype;
t.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split, d;
@@ -90,7 +90,7 @@ t.assign = function(a) {
this.numeric = u(a.numeric, d);
} else {
try {
this.split = u(this.split, y);
this.split = u(this.split, ba);
} catch (e) {
console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
@@ -131,13 +131,13 @@ t.addStemmer = function(a, c) {
this.stemmer.set(a, c);
this.h += (this.h ? "|" : "") + a;
this.A = null;
this.cache && E(this);
this.cache && z(this);
return this;
};
t.addFilter = function(a) {
this.filter || (this.filter = new Set());
this.filter.add(a);
this.cache && E(this);
this.cache && z(this);
return this;
};
t.addMapper = function(a, c) {
@@ -149,7 +149,7 @@ t.addMapper = function(a, c) {
}
this.mapper || (this.mapper = new Map());
this.mapper.set(a, c);
this.cache && E(this);
this.cache && z(this);
return this;
};
t.addMatcher = function(a, c) {
@@ -163,7 +163,7 @@ t.addMatcher = function(a, c) {
this.matcher.set(a, c);
this.g += (this.g ? "|" : "") + a;
this.v = null;
this.cache && E(this);
this.cache && z(this);
return this;
};
t.addReplacer = function(a, c) {
@@ -172,7 +172,7 @@ t.addReplacer = function(a, c) {
}
this.replacer || (this.replacer = []);
this.replacer.push(a, c);
this.cache && E(this);
this.cache && z(this);
return this;
};
t.encode = function(a) {
@@ -182,12 +182,12 @@ t.encode = function(a) {
return this.i.get(a);
}
} else {
this.l = setTimeout(E, 50, this);
this.l = setTimeout(z, 50, this);
}
}
this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = C ? a.normalize("NFKD").replace(C, "").toLowerCase() : a.toLowerCase());
this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = x ? a.normalize("NFKD").replace(x, "").toLowerCase() : a.toLowerCase());
this.prepare && (a = this.prepare(a));
this.numeric && 3 < a.length && (a = a.replace(B, "$1 $2").replace(aa, "$1 $2").replace(z, "$1 "));
this.numeric && 3 < a.length && (a = a.replace(da, "$1 $2").replace(ea, "$1 $2").replace(ca, "$1 "));
const c = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
let b = [], d = this.split || "" === this.split ? a.split(this.split) : a;
for (let g = 0, f, h; g < d.length; g++) {
@@ -204,7 +204,7 @@ t.encode = function(a) {
continue;
}
} else {
this.l = setTimeout(E, 50, this);
this.l = setTimeout(z, 50, this);
}
}
this.stemmer && 2 < f.length && (this.A || (this.A = new RegExp("(?!^)(" + this.h + ")$")), f = f.replace(this.A, k => this.stemmer.get(k)), f.length < this.minlength || this.filter && this.filter.has(f)) && (f = "");
@@ -231,12 +231,125 @@ t.encode = function(a) {
this.cache && a.length <= this.o && (this.i.set(a, b), this.i.size > this.C && (this.i.clear(), this.o = this.o / 1.1 | 0));
return b;
};
function E(a) {
function z(a) {
a.l = null;
a.i.clear();
a.j.clear();
}
;function F(a, c, b, d, e) {
;let A, C;
async function fa(a) {
a = a.data;
const c = a.task, b = a.id;
let d = a.args;
switch(c) {
case "init":
C = a.options || {};
(a = a.factory) ? (Function("return " + a)()(self), A = new self.FlexSearch.Index(C), delete self.FlexSearch) : A = new D(C);
postMessage({id:b});
break;
default:
let e;
"export" === c && (d = [C.export]);
"import" === c ? await C.import.call(A, A) : e = A[c].apply(A, d);
postMessage("search" === c ? {id:b, msg:e} : {id:b});
}
}
;let E, F;
const G = {}, H = {};
function ia(a) {
E = 0;
G[a] = H[a];
}
function I(a) {
this[a + "Async"] = function() {
const c = arguments;
var b = c[c.length - 1];
let d;
"function" === typeof b && (d = b, delete c[c.length - 1]);
E || (E = setTimeout(ia, 0, a), F = Date.now());
H[a] || (H[a] = G[a] = 1000);
if (!--G[a]) {
G[a] = H[a] = H[a] * this.priority * this.priority * 3 / (Date.now() - F) | 0 || 1;
E = clearTimeout(E);
const g = this;
return new Promise(f => {
setTimeout(function() {
f(g[a + "Async"].apply(g, c));
}, 0);
});
}
const e = this[a].apply(this, c);
b = e.then ? e : new Promise(g => g(e));
d && b.then(d);
return b;
};
}
;let J = 0;
function K(a = {}) {
function c(f) {
function h(k) {
k = k.data || k;
const l = k.id, n = l && e.g[l];
n && (n(k.msg), delete e.g[l]);
}
this.worker = f;
this.g = w();
if (this.worker) {
d ? this.worker.on("message", h) : this.worker.onmessage = h;
if (a.config) {
return new Promise(function(k) {
e.g[++J] = function() {
k(e);
};
e.worker.postMessage({id:J, task:"init", factory:b, options:a});
});
}
this.worker.postMessage({task:"init", factory:b, options:a});
return this;
}
}
if (!this || this.constructor !== K) {
return new K(a);
}
let b = "undefined" !== typeof self ? self._factory : "undefined" !== typeof window ? window._factory : null;
b && (b = b.toString());
const d = "undefined" === typeof window, e = this, g = ja(b, d, a.worker);
return g.then ? g.then(function(f) {
return c.call(e, f);
}) : c.call(this, g);
}
L("add");
L("append");
L("search");
L("update");
L("remove");
L("clear");
L("export");
L("import");
var M = K.prototype;
I.call(M, "add");
I.call(M, "append");
I.call(M, "search");
I.call(M, "update");
I.call(M, "remove");
function L(a) {
K.prototype[a] = async function() {
const c = this, b = [].slice.call(arguments);
var d = b[b.length - 1];
let e;
"function" === typeof d && (e = d, b.splice(b.length - 1, 1));
d = new Promise(function(g) {
c.g[++J] = g;
c.worker.postMessage({task:a, id:J, args:b});
});
return e ? (d.then(e), this) : d;
};
}
function ja(a, c, b) {
return c ? "undefined" !== typeof module ? new (require("worker_threads")["Worker"])(__dirname + "/node/node.js") : import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/node/node.mjs"); }) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + fa.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof b ? b : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"), {type:"module"});
}
;function N(a, c, b, d, e) {
const g = a.length;
let f = [], h, k;
h = w();
@@ -251,7 +364,7 @@ function E(a) {
}
if (a = f.length) {
if (e) {
f = 1 < f.length ? G(f, b, d) : (f = f[0]).length > b || d ? f.slice(d, b + d) : f;
f = 1 < f.length ? O(f, b, d) : (f = f[0]).length > b || d ? f.slice(d, b + d) : f;
} else {
if (a < g) {
return [];
@@ -266,7 +379,7 @@ function E(a) {
}
return f;
}
function G(a, c, b) {
function O(a, c, b) {
const d = [], e = w();
let g;
var f = a.length;
@@ -288,12 +401,12 @@ function G(a, c, b) {
}
return d;
}
;function I(a, c, b, d) {
;function P(a, c, b, d) {
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, d ? J.call(this, a) : a;
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a, d ? Q.call(this, a) : a;
}
let e = [];
for (let g = 0, f, h; g < a.length; g++) {
@@ -307,7 +420,7 @@ function G(a, c, b) {
}
h > c && (f = f.slice(0, c), h = c);
if (!e.length && h >= c) {
return d ? J.call(this, f) : f;
return d ? Q.call(this, f) : f;
}
e.push(f);
c -= h;
@@ -317,9 +430,9 @@ function G(a, c, b) {
}
}
e = 1 < e.length ? [].concat.apply([], e) : e[0];
return d ? J.call(this, e) : e;
return d ? Q.call(this, e) : e;
}
;function K(a, c, b) {
;function S(a, c, b) {
var d = b[0];
if (d.then) {
return Promise.all(b).then(function(n) {
@@ -334,7 +447,7 @@ function G(a, c, b) {
for (let n = 0, m; n < b.length; n++) {
if (m = b[n]) {
let r;
if (m.constructor === L) {
if (m.constructor === T) {
r = m.result;
} else if (m.constructor === Array) {
r = m;
@@ -365,11 +478,11 @@ function G(a, c, b) {
}
return {m:d, u:e, limit:g, offset:f, enrich:h, resolve:k, suggest:l};
}
;L.prototype.or = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g} = K(this, "or", arguments);
return M.call(this, a, c, b, d, e, g);
;T.prototype.or = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g} = S(this, "or", arguments);
return U.call(this, a, c, b, d, e, g);
};
function M(a, c, b, d, e, g) {
function U(a, c, b, d, e, g) {
if (c.length) {
const f = this;
return Promise.all(c).then(function(h) {
@@ -377,25 +490,25 @@ function M(a, c, b, d, e, g) {
for (let k = 0, l; k < h.length; k++) {
(l = h[k]).length && (a[k] = l);
}
return M.call(f, a, [], b, d, e, g);
return U.call(f, a, [], b, d, e, g);
});
}
a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = G(a, b, d), d = 0));
a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = O(a, b, d), d = 0));
return g ? this.resolve(b, d, e) : this;
}
;L.prototype.and = function() {
;T.prototype.and = function() {
let a = this.result.length, c, b, d, e;
if (!a) {
const g = arguments[0];
g && (a = !!g.suggest, e = g.resolve, c = g.limit, b = g.offset, d = g.enrich && e);
}
if (a) {
const {m:g, u:f, limit:h, offset:k, enrich:l, resolve:n, suggest:m} = K(this, "and", arguments);
return N.call(this, g, f, h, k, l, n, m);
const {m:g, u:f, limit:h, offset:k, enrich:l, resolve:n, suggest:m} = S(this, "and", arguments);
return ka.call(this, g, f, h, k, l, n, m);
}
return e ? this.resolve(c, b, d) : this;
};
function N(a, c, b, d, e, g, f) {
function ka(a, c, b, d, e, g, f) {
if (c.length) {
const h = this;
return Promise.all(c).then(function(k) {
@@ -403,15 +516,15 @@ function N(a, c, b, d, e, g, f) {
for (let l = 0, n; l < k.length; l++) {
(n = k[l]).length && (a[l] = n);
}
return N.call(h, a, [], b, d, e, g, f);
return ka.call(h, a, [], b, d, e, g, f);
});
}
if (a.length) {
if (this.result.length && a.unshift(this.result), 2 > a.length) {
this.result = a[0];
} else {
if (c = x(a)) {
return this.result = F(a, c, b, d, f), g ? e ? J.call(this.index, this.result) : this.result : this;
if (c = aa(a)) {
return this.result = N(a, c, b, d, f), g ? e ? Q.call(this.index, this.result) : this.result : this;
}
this.result = [];
}
@@ -420,11 +533,11 @@ function N(a, c, b, d, e, g, f) {
}
return g ? this.resolve(b, d, e) : this;
}
;L.prototype.xor = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = K(this, "xor", arguments);
return O.call(this, a, c, b, d, e, g, f);
;T.prototype.xor = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = S(this, "xor", arguments);
return la.call(this, a, c, b, d, e, g, f);
};
function O(a, c, b, d, e, g, f) {
function la(a, c, b, d, e, g, f) {
if (c.length) {
const h = this;
return Promise.all(c).then(function(k) {
@@ -432,21 +545,21 @@ function O(a, c, b, d, e, g, f) {
for (let l = 0, n; l < k.length; l++) {
(n = k[l]).length && (a[l] = n);
}
return O.call(h, a, [], b, d, e, g, f);
return la.call(h, a, [], b, 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 = ba.call(this, a, b, d, g, this.g), g ? e ? J.call(this.index, this.result) : this.result : this;
return this.result = ma.call(this, a, b, d, g, this.g), g ? e ? Q.call(this.index, this.result) : this.result : this;
}
} else {
f || (this.result = a);
}
return g ? this.resolve(b, d, e) : this;
}
function ba(a, c, b, d, e) {
function ma(a, c, b, d, e) {
const g = [], f = w();
let h = 0;
for (let k = 0, l; k < a.length; k++) {
@@ -491,11 +604,11 @@ function ba(a, c, b, d, e) {
}
return g;
}
;L.prototype.not = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = K(this, "not", arguments);
return P.call(this, a, c, b, d, e, g, f);
;T.prototype.not = function() {
const {m:a, u:c, limit:b, offset:d, enrich:e, resolve:g, suggest:f} = S(this, "not", arguments);
return na.call(this, a, c, b, d, e, g, f);
};
function P(a, c, b, d, e, g, f) {
function na(a, c, b, d, e, g, f) {
if (c.length) {
const h = this;
return Promise.all(c).then(function(k) {
@@ -503,17 +616,17 @@ function P(a, c, b, d, e, g, f) {
for (let l = 0, n; l < k.length; l++) {
(n = k[l]).length && (a[l] = n);
}
return P.call(h, a, [], b, d, e, g, f);
return na.call(h, a, [], b, d, e, g, f);
});
}
if (a.length && this.result.length) {
this.result = ca.call(this, a, b, d, g);
this.result = oa.call(this, a, b, d, g);
} else if (g) {
return this.resolve(b, d, e);
}
return g ? e ? J.call(this.index, this.result) : this.result : this;
return g ? e ? Q.call(this.index, this.result) : this.result : this;
}
function ca(a, c, b, d) {
function oa(a, c, b, d) {
const e = [];
a = new Set(a.flat().flat());
for (let g = 0, f, h = 0; g < this.result.length; g++) {
@@ -539,9 +652,9 @@ function ca(a, c, b, d) {
}
return e;
}
;function L(a) {
if (!this || this.constructor !== L) {
return new L(a);
;function T(a) {
if (!this || this.constructor !== T) {
return new T(a);
}
if (a && a.index) {
return a.resolve = !1, this.index = a.index, this.g = a.boost || 0, this.result = a.index.search(a).result, this;
@@ -550,7 +663,7 @@ function ca(a, c, b, d) {
this.result = a || [];
this.g = 0;
}
L.prototype.limit = function(a) {
T.prototype.limit = function(a) {
if (this.result.length) {
const c = [];
for (let b = 0, d; b < this.result.length; b++) {
@@ -569,7 +682,7 @@ L.prototype.limit = function(a) {
}
return this;
};
L.prototype.offset = function(a) {
T.prototype.offset = function(a) {
if (this.result.length) {
const c = [];
for (let b = 0, d; b < this.result.length; b++) {
@@ -581,17 +694,17 @@ L.prototype.offset = function(a) {
}
return this;
};
L.prototype.boost = function(a) {
T.prototype.boost = function(a) {
this.g += a;
return this;
};
L.prototype.resolve = function(a, c, b) {
T.prototype.resolve = function(a, c, b) {
const d = this.result, e = this.index;
this.result = this.index = null;
return d.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), I.call(e, d, a || 100, c, b)) : d;
return d.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), P.call(e, d, a || 100, c, b)) : d;
};
w();
function J(a) {
function Q(a) {
if (!this || !this.store) {
return a;
}
@@ -601,35 +714,35 @@ function J(a) {
}
return c;
}
;function Q(a) {
;function V(a) {
this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map();
this.g = "";
}
Q.prototype.set = function(a, c) {
V.prototype.set = function(a, c) {
this.cache.set(this.g = a, c);
this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value);
};
Q.prototype.get = function(a) {
V.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;
};
Q.prototype.remove = function(a) {
V.prototype.remove = function(a) {
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
Q.prototype.clear = function() {
V.prototype.clear = function() {
this.cache.clear();
this.g = "";
};
const da = {normalize:function(a) {
const pa = {normalize:function(a) {
return a.toLowerCase();
}};
const R = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
S.prototype.add = function(a, c, b, d) {
const qa = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
D.prototype.add = function(a, c, b, d) {
if (c && (a || 0 === a)) {
if (!d && !b && this.reg.has(a)) {
return this.update(a, c);
@@ -641,15 +754,15 @@ S.prototype.add = function(a, c, b, d) {
let p = c[this.rtl ? d - 1 - q : q];
var e = p.length;
if (e && (m || !n[p])) {
var g = this.score ? this.score(c, p, q, null, 0) : T(r, d, q), f = "";
var g = this.score ? this.score(c, p, q, null, 0) : W(r, d, q), f = "";
switch(this.tokenize) {
case "full":
if (2 < e) {
for (g = 0; g < e; g++) {
for (var h = e; h > g; h--) {
f = p.substring(g, h);
var k = this.score ? this.score(c, p, q, f, g) : T(r, d, q, e, g);
U(this, n, f, k, a, b);
var k = this.score ? this.score(c, p, q, f, g) : W(r, d, q, e, g);
X(this, n, f, k, a, b);
}
}
break;
@@ -657,24 +770,24 @@ S.prototype.add = function(a, c, b, d) {
case "reverse":
if (1 < e) {
for (h = e - 1; 0 < h; h--) {
f = p[h] + f, k = this.score ? this.score(c, p, q, f, h) : T(r, d, q, e, h), U(this, n, f, k, a, b);
f = p[h] + f, k = this.score ? this.score(c, p, q, f, h) : W(r, d, q, e, h), X(this, n, f, k, a, b);
}
f = "";
}
case "forward":
if (1 < e) {
for (h = 0; h < e; h++) {
f += p[h], U(this, n, f, g, a, b);
f += p[h], X(this, n, f, g, a, b);
}
break;
}
default:
if (U(this, n, p, g, a, b), m && 1 < d && q < d - 1) {
if (X(this, n, p, g, a, b), m && 1 < d && q < d - 1) {
for (e = w(), f = this.B, g = p, h = Math.min(m + 1, d - q), e[g] = 1, k = 1; k < h; k++) {
if ((p = c[this.rtl ? d - 1 - q - k : q + k]) && !e[p]) {
e[p] = 1;
const v = this.score ? this.score(c, g, q, p, k) : T(f + (d / 2 > f ? 0 : 1), d, q, h - 1, k - 1), A = this.bidirectional && p > g;
U(this, l, A ? g : p, v, a, b, A ? p : g);
const v = this.score ? this.score(c, g, q, p, k) : W(f + (d / 2 > f ? 0 : 1), d, q, h - 1, k - 1), B = this.bidirectional && p > g;
X(this, l, B ? g : p, v, a, b, B ? p : g);
}
}
}
@@ -686,16 +799,16 @@ S.prototype.add = function(a, c, b, d) {
}
return this;
};
function U(a, c, b, d, e, g, f) {
function X(a, c, b, d, e, g, f) {
let h = f ? a.ctx : a.map, k;
if (!c[b] || f && !(k = c[b])[f]) {
f ? (c = k || (c[b] = w()), c[f] = 1, (k = h.get(f)) ? h = k : h.set(f, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[d] || (h[d] = []), g && h.includes(e) || (h.push(e), a.fastupdate && ((c = a.reg.get(e)) ? c.push(h) : a.reg.set(e, [h])));
}
}
function T(a, c, b, d, e) {
function W(a, c, b, d, e) {
return b && 1 < a ? c + (d || 0) <= a ? b + (e || 0) : (a - 1) / (c + (d || 0)) * (b + (e || 0)) + 1 | 0 : 0;
}
;S.prototype.search = function(a, c, b) {
;D.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
var d = [], e = 0;
if (b) {
@@ -713,11 +826,11 @@ function T(a, c, b, d, e) {
a = b.length;
c = c || (h ? 100 : 0);
if (1 === a) {
return W.call(this, b[0], "", c, e, h);
return ra.call(this, b[0], "", c, e, h);
}
g = this.depth && !1 !== g;
if (2 === a && g && !f) {
return W.call(this, b[0], b[1], c, e, h);
return ra.call(this, b[0], b[1], c, e, h);
}
h = w();
let l = 0;
@@ -729,29 +842,29 @@ function T(a, c, b, d, e) {
for (let p, v; l < a; l++) {
if ((v = b[l]) && !h[v]) {
h[v] = 1;
p = X(this, v, n);
p = sa(this, v, n);
a: {
g = p;
var m = d, r = f, q = k;
let A = [];
let B = [];
if (g && g.length) {
if (g.length <= q) {
m.push(g);
p = void 0;
break a;
}
for (let H = 0, V; H < q; H++) {
if (V = g[H]) {
A[H] = V;
for (let R = 0, ha; R < q; R++) {
if (ha = g[R]) {
B[R] = ha;
}
}
if (A.length) {
m.push(A);
if (B.length) {
m.push(B);
p = void 0;
break a;
}
}
p = r ? void 0 : A;
p = r ? void 0 : B;
}
if (p) {
d = p;
@@ -765,27 +878,27 @@ function T(a, c, b, d, e) {
n = d.length;
a = d;
if (1 < n) {
a = F(d, k, c, e, f);
a = N(d, k, c, e, f);
} else if (1 === n) {
f = I.call(null, d[0], c, e);
f = P.call(null, d[0], c, e);
break a;
}
f = a;
}
return f;
};
function W(a, c, b, d, e) {
a = X(this, a, c);
function ra(a, c, b, d, e) {
a = sa(this, a, c);
e = !0;
return a && a.length ? e ? I.call(this, a, b, d) : new L(a) : e ? [] : new L();
return a && a.length ? e ? P.call(this, a, b, d) : new T(a) : e ? [] : new T();
}
function X(a, c, b) {
function sa(a, c, b) {
let d;
b && (d = a.bidirectional && c > b) && (d = b, b = c, c = d);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
return a;
}
;S.prototype.remove = function(a, c) {
;D.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) {
@@ -828,19 +941,19 @@ function Y(a, c) {
}
return b;
}
;function S(a, c) {
if (!this || this.constructor !== S) {
return new S(a);
;function D(a, c) {
if (!this || this.constructor !== D) {
return new D(a);
}
if (a) {
var b = "string" === typeof a ? a : a.preset;
b && (R[b] || console.warn("Preset not found: " + b), a = Object.assign({}, R[b], a));
b && (qa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, qa[b], a));
} else {
a = {};
}
b = a.context;
const d = !0 === b ? {depth:1} : b || {}, e = a.encode || a.encoder || da;
this.encoder = e.encode ? e : "object" === typeof e ? new D(e) : {encode:e};
const d = !0 === b ? {depth:1} : b || {}, e = a.encode || a.encoder || pa;
this.encoder = e.encode ? e : "object" === typeof e ? new y(e) : {encode:e};
this.resolution = a.resolution || 9;
this.tokenize = b = a.tokenize || "strict";
this.depth = "strict" === b && d.depth || 0;
@@ -853,9 +966,9 @@ function Y(a, c) {
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.B = d.resolution || 3;
this.rtl = e.rtl || a.rtl || !1;
this.cache = (b = a.cache || null) && new Q(b);
this.cache = (b = a.cache || null) && new V(b);
}
t = S.prototype;
t = D.prototype;
t.clear = function() {
this.map.clear();
this.ctx.clear();
@@ -897,7 +1010,7 @@ t.cleanup = function() {
};
t.searchCache = function(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new Q());
this.cache || (this.cache = new V());
let d = this.cache.get(a);
if (!d) {
d = this.search(a, c, b);
@@ -912,6 +1025,6 @@ t.searchCache = function(a, c, b) {
}
return d;
};
export default {Index:S, Charset:null, Encoder:D, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
export default {Index:D, Charset:null, Encoder:y, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
export const Index=S;export const Charset=null;export const Encoder=D;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
export const Index=D;export const Charset=null;export const Encoder=y;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -1,35 +1,41 @@
/**!
* FlexSearch.js v0.8.107 (Bundle)
* FlexSearch.js v0.8.108 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var t;function u(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)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 f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function w(){return Object.create(null)}
function x(a){let c=0;for(let b=0,d;b<a.length;b++)(d=a[b])&&c<d.length&&(c=d.length);return c};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,B=/(\D)(\d{3})/g,C=/(\d{3})(\D)/g,D="".normalize&&/[\u0300-\u036f]/g;function E(a){if(!this||this.constructor!==E)return new E(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}t=E.prototype;
function aa(a){let c=0;for(let b=0,d;b<a.length;b++)(d=a[b])&&c<d.length&&(c=d.length);return c};const ba=/[^\p{L}\p{N}]+/u,ca=/(\d{3})/g,da=/(\D)(\d{3})/g,ea=/(\d{3})(\D)/g,x="".normalize&&/[\u0300-\u036f]/g;function y(a){if(!this||this.constructor!==y)return new y(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}t=y.prototype;
t.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,d;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let e="";d=!c;c||(e+="\\p{Z}");b.letter&&(e+="\\p{L}");b.number&&(e+="\\p{N}",d=!!c);b.symbol&&(e+="\\p{S}");b.punctuation&&(e+="\\p{P}");b.control&&(e+="\\p{C}");if(b=b.char)e+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+e+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,d=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,d)}else{try{this.split=u(this.split,y)}catch(e){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),
this.numeric=u(a.numeric,d)}else{try{this.split=u(this.split,ba)}catch(e){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.C="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.s=this.o=128;this.g="";this.v=null;this.h="";this.A=null;if(this.matcher)for(const e of this.matcher.keys())this.g+=(this.g?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.h+=(this.h?"|":"")+e;return this};
t.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.A=null;this.cache&&F(this);return this};t.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&F(this);return this};t.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&F(this);return this};
t.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(2>a.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.v=null;this.cache&&F(this);return this};t.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&F(this);return this};
t.encode=function(a){if(this.cache&&a.length<=this.o)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(F,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&&3<a.length&&(a=a.replace(B,"$1 $2").replace(C,"$1 $2").replace(z,"$1 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=[],d=
this.split||""===this.split?a.split(this.split):a;for(let g=0,f,h;g<d.length;g++)if((f=h=d[g])&&!(f.length<this.minlength))if(c)b.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.s)if(this.l){var e=this.j.get(f);if(e||""===e){e&&b.push(e);continue}}else this.l=setTimeout(F,50,this);this.stemmer&&2<f.length&&(this.A||(this.A=new RegExp("(?!^)("+this.h+")$")),f=f.replace(this.A,k=>this.stemmer.get(k)),f.length<this.minlength||this.filter&&this.filter.has(f))&&(f="");
t.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.A=null;this.cache&&z(this);return this};t.addFilter=function(a){this.filter||(this.filter=new Set);this.filter.add(a);this.cache&&z(this);return this};t.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&z(this);return this};
t.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(2>a.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.v=null;this.cache&&z(this);return this};t.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&z(this);return this};
t.encode=function(a){if(this.cache&&a.length<=this.o)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(z,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=x?a.normalize("NFKD").replace(x,"").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 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=[],
d=this.split||""===this.split?a.split(this.split):a;for(let g=0,f,h;g<d.length;g++)if((f=h=d[g])&&!(f.length<this.minlength))if(c)b.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.s)if(this.l){var e=this.j.get(f);if(e||""===e){e&&b.push(e);continue}}else this.l=setTimeout(z,50,this);this.stemmer&&2<f.length&&(this.A||(this.A=new RegExp("(?!^)("+this.h+")$")),f=f.replace(this.A,k=>this.stemmer.get(k)),f.length<this.minlength||this.filter&&this.filter.has(f))&&(f="");
if(f&&(this.mapper||this.dedupe&&1<f.length)){e="";for(let k=0,l="",n,m;k<f.length;k++)n=f.charAt(k),n===l&&this.dedupe||((m=this.mapper&&this.mapper.get(n))||""===m?m===l&&this.dedupe||!(l=m)||(e+=m):e+=l=n);f=e}this.matcher&&1<f.length&&(this.v||(this.v=new RegExp("("+this.g+")","g")),f=f.replace(this.v,k=>this.matcher.get(k)));if(f&&this.replacer)for(e=0;f&&e<this.replacer.length;e+=2)f=f.replace(this.replacer[e],this.replacer[e+1]);this.cache&&h.length<=this.s&&(this.j.set(h,f),this.j.size>this.C&&
(this.j.clear(),this.s=this.s/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.o&&(this.i.set(a,b),this.i.size>this.C&&(this.i.clear(),this.o=this.o/1.1|0));return b};function F(a){a.l=null;a.i.clear();a.j.clear()};function G(a,c,b,d,e){const g=a.length;let f=[],h,k;h=w();for(let l=0,n,m,r,q;l<c;l++)for(let p=0;p<g;p++)if(r=a[p],l<r.length&&(n=r[l]))for(let v=0;v<n.length;v++)m=n[v],(k=h[m])?h[m]++:(k=0,h[m]=1),q=f[k]||(f[k]=[]),q.push(m);if(a=f.length)if(e)f=1<f.length?I(f,b,d):(f=f[0]).length>b||d?f.slice(d,b+d):f;else{if(a<g)return[];f=f[a-1];if(b||d)if(f.length>b||d)f=f.slice(d,b+d)}return f}
function I(a,c,b){const d=[],e=w();let g;var f=a.length;let h;for(let k=f-1;0<=k;k--)if(h=(f=a[k])&&f.length)for(let l=0;l<h;l++)if(g=f[l],!e[g])if(e[g]=1,b)b--;else if(d.push(g),d.length===c)return d;return d};function J(a,c,b,d){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,d?K.call(this,a):a;let e=[];for(let g=0,f,h;g<a.length;g++)if((f=a[g])&&(h=f.length)){if(b){if(b>=h){b-=h;continue}b<h&&(f=c?f.slice(b,b+c):f.slice(b),h=f.length,b=0)}h>c&&(f=f.slice(0,c),h=c);if(!e.length&&h>=c)return d?K.call(this,f):f;e.push(f);c-=h;if(!c)break}e=1<e.length?[].concat.apply([],e):e[0];return d?K.call(this,e):e};function L(a,c,b){var d=b[0];if(d.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(d[0]&&d[0].index)return a[c].apply(a,d);d=[];let e=[],g=0,f=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let r;if(m.constructor===M)r=m.result;else if(m.constructor===Array)r=m;else if(g=m.limit||0,f=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,r=m.index.search(m).result,m.resolve=k;else if(m.and)r=a.and(m.and);else if(m.or)r=a.or(m.or);else if(m.xor)r=a.xor(m.xor);
else if(m.not)r=a.not(m.not);else continue;if(r.then)e.push(r);else if(r.length)d[n]=r;else if(!l&&("and"===c||"xor"===c)){d=[];break}}return{m:d,u:e,limit:g,offset:f,enrich:h,resolve:k,suggest:l}};M.prototype.or=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g}=L(this,"or",arguments);return N.call(this,a,c,b,d,e,g)};function N(a,c,b,d,e,g){if(c.length){const f=this;return Promise.all(c).then(function(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);return N.call(f,a,[],b,d,e,g)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=I(a,b,d),d=0));return g?this.resolve(b,d,e):this};M.prototype.and=function(){let a=this.result.length,c,b,d,e;if(!a){const g=arguments[0];g&&(a=!!g.suggest,e=g.resolve,c=g.limit,b=g.offset,d=g.enrich&&e)}if(a){const {m:g,u:f,limit:h,offset:k,enrich:l,resolve:n,suggest:m}=L(this,"and",arguments);return O.call(this,g,f,h,k,l,n,m)}return e?this.resolve(c,b,d):this};
function O(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return O.call(h,a,[],b,d,e,g,f)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=x(a))return this.result=G(a,c,b,d,f),g?e?K.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(b,d,e):this};M.prototype.xor=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=L(this,"xor",arguments);return P.call(this,a,c,b,d,e,g,f)};
function P(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return P.call(h,a,[],b,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=aa.call(this,a,b,d,g,this.g),g?e?K.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(b,d,e):this}
function aa(a,c,b,d,e){const g=[],f=w();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k]){h<l.length&&(h=l.length);for(let n=0,m;n<l.length;n++)if(m=l[n])for(let r=0,q;r<m.length;r++)q=m[r],f[q]=f[q]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,r;m<a.length;m++)if(r=a[m])if(l=r[k])for(let q=0,p;q<l.length;q++)if(p=l[q],1===f[p])if(b)b--;else if(d){if(g.push(p),g.length===c)return g}else{const v=k+(m?e:0);g[v]||(g[v]=[]);g[v].push(p);if(++n===c)return g}return g};M.prototype.not=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=L(this,"not",arguments);return Q.call(this,a,c,b,d,e,g,f)};function Q(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Q.call(h,a,[],b,d,e,g,f)})}if(a.length&&this.result.length)this.result=ba.call(this,a,b,d,g);else if(g)return this.resolve(b,d,e);return g?e?K.call(this.index,this.result):this.result:this}
function ba(a,c,b,d){const e=[];a=new Set(a.flat().flat());for(let g=0,f,h=0;g<this.result.length;g++)if(f=this.result[g])for(let k=0,l;k<f.length;k++)if(l=f[k],!a.has(l))if(b)b--;else if(d){if(e.push(l),e.length===c)return e}else if(e[g]||(e[g]=[]),e[g].push(l),++h===c)return e;return e};function M(a){if(!this||this.constructor!==M)return new M(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.g=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.g=0}M.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])if(d.length<=a){if(c[b]=d,a-=d.length,!a)break}else{c[b]=d.slice(0,a);break}this.result=c}return this};
M.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])d.length<=a?a-=d.length:(c[b]=d.slice(a),a=0);this.result=c}return this};M.prototype.boost=function(a){this.g+=a;return this};M.prototype.resolve=function(a,c,b){const d=this.result,e=this.index;this.result=this.index=null;return d.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),J.call(e,d,a||100,c,b)):d};w();function K(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,d;b<a.length;b++)d=a[b],c[b]={id:d,doc:this.store.get(d)};return c};function R(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}R.prototype.set=function(a,c){this.cache.set(this.g=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};R.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};R.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
R.prototype.clear=function(){this.cache.clear();this.g=""};const ca={normalize:function(a){return a.toLowerCase()}};const da={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};S.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const l=w(),n=w(),m=this.depth,r=this.resolution;for(let q=0;q<d;q++){let p=c[this.rtl?d-1-q:q];var e=p.length;if(e&&(m||!n[p])){var g=this.score?this.score(c,p,q,null,0):T(r,d,q),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=p.substring(g,h);var k=this.score?this.score(c,p,q,f,g):T(r,d,q,e,g);V(this,n,f,k,a,b)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)f=p[h]+f,k=this.score?this.score(c,p,q,f,h):T(r,d,q,e,h),V(this,n,f,k,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=p[h],V(this,n,f,g,a,b);break}default:if(V(this,n,p,g,a,b),m&&1<d&&q<d-1)for(e=w(),f=this.B,g=p,h=Math.min(m+1,d-q),e[g]=1,k=1;k<h;k++)if((p=c[this.rtl?d-1-q-k:q+k])&&!e[p]){e[p]=1;const v=this.score?this.score(c,g,q,p,k):T(f+(d/2>f?0:1),d,q,h-1,k-1),A=this.bidirectional&&p>g;V(this,l,A?g:p,v,a,b,A?p:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function V(a,c,b,d,e,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=w()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.reg.get(e))?c.push(h):a.reg.set(e,[h])))}function T(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};S.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var d=[],e=0;if(b){a=b.query||a;c=b.limit||c;e=b.offset||0;var g=b.context;var f=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return W.call(this,b[0],"",c,e,h);g=this.depth&&!1!==g;if(2===a&&g&&!f)return W.call(this,b[0],b[1],c,e,h);h=w();let l=0;if(1<a&&g){var n=b[0];l=1}k||0===k||(k=n?this.B:this.resolution);for(let p,v;l<a;l++){if((v=
b[l])&&!h[v]){h[v]=1;p=X(this,v,n);a:{g=p;var m=d,r=f,q=k;let A=[];if(g&&g.length){if(g.length<=q){m.push(g);p=void 0;break a}for(let H=0,U;H<q;H++)if(U=g[H])A[H]=U;if(A.length){m.push(A);p=void 0;break a}}p=r?void 0:A}if(p){d=p;break}n&&(f&&p&&d.length||(n=v))}f&&n&&l===a-1&&!d.length&&(n="",l=-1,h=w())}a:{n=d.length;a=d;if(1<n)a=G(d,k,c,e,f);else if(1===n){f=J.call(null,d[0],c,e);break a}f=a}return f};
function W(a,c,b,d,e){a=X(this,a,c);e=!0;return a&&a.length?e?J.call(this,a,b,d):new M(a):e?[]:new M}function X(a,c,b){let d;b&&(d=a.bidirectional&&c>b)&&(d=b,b=c,c=d);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};S.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 d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else Y(this.map,a),this.depth&&Y(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Y(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){const e=d[0],g=Y(d[1],c);g?b+=g:a.delete(e)}return b};function S(a,c){if(!this||this.constructor!==S)return new S(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},da[b],a))}else a={};b=a.context;const d=!0===b?{depth:1}:b||{},e=a.encode||a.encoder||ca;this.encoder=e.encode?e:"object"===typeof e?new E(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=b=a.tokenize||"strict";this.depth="strict"===b&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=new Map;
this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.B=d.resolution||3;this.rtl=e.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new R(b)}t=S.prototype;t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};t.append=function(a,c){return this.add(a,c,!0)};t.contain=function(a){return this.reg.has(a)};t.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
(this.j.clear(),this.s=this.s/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.o&&(this.i.set(a,b),this.i.size>this.C&&(this.i.clear(),this.o=this.o/1.1|0));return b};function z(a){a.l=null;a.i.clear();a.j.clear()};let A,C;async function ha(a){a=a.data;const c=a.task,b=a.id;let d=a.args;switch(c){case "init":C=a.options||{};(a=a.factory)?(Function("return "+a)()(self),A=new self.FlexSearch.Index(C),delete self.FlexSearch):A=new D(C);postMessage({id:b});break;default:let e;"export"===c&&(d=[C.export]);"import"===c?await C.import.call(A,A):e=A[c].apply(A,d);postMessage("search"===c?{id:b,msg:e}:{id:b})}};let E,F;const G={},H={};function ia(a){E=0;G[a]=H[a]}
function I(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let d;"function"===typeof b&&(d=b,delete c[c.length-1]);E||(E=setTimeout(ia,0,a),F=Date.now());H[a]||(H[a]=G[a]=1E3);if(!--G[a]){G[a]=H[a]=H[a]*this.priority*this.priority*3/(Date.now()-F)|0||1;E=clearTimeout(E);const g=this;return new Promise(f=>{setTimeout(function(){f(g[a+"Async"].apply(g,c))},0)})}const e=this[a].apply(this,c);b=e.then?e:new Promise(g=>g(e));d&&b.then(d);return b}};let J=0;
function K(a={}){function c(f){function h(k){k=k.data||k;const l=k.id,n=l&&e.g[l];n&&(n(k.msg),delete e.g[l])}this.worker=f;this.g=w();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.g[++J]=function(){k(e)};e.worker.postMessage({id:J,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});return this}}if(!this||this.constructor!==K)return new K(a);let b="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;b&&(b=b.toString());const d="undefined"===typeof window,e=this,g=ja(b,d,a.worker);return g.then?g.then(function(f){return c.call(e,f)}):c.call(this,g)}L("add");L("append");L("search");L("update");L("remove");L("clear");L("export");L("import");var M=K.prototype;I.call(M,"add");I.call(M,"append");I.call(M,"search");I.call(M,"update");I.call(M,"remove");
function L(a){K.prototype[a]=async function(){const c=this,b=[].slice.call(arguments);var d=b[b.length-1];let e;"function"===typeof d&&(e=d,b.splice(b.length-1,1));d=new Promise(function(g){c.g[++J]=g;c.worker.postMessage({task:a,id:J,args:b})});return e?(d.then(e),this):d}}
function ja(a,c,b){return c?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"](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 b?b:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function N(a,c,b,d,e){const g=a.length;let f=[],h,k;h=w();for(let l=0,n,m,r,q;l<c;l++)for(let p=0;p<g;p++)if(r=a[p],l<r.length&&(n=r[l]))for(let v=0;v<n.length;v++)m=n[v],(k=h[m])?h[m]++:(k=0,h[m]=1),q=f[k]||(f[k]=[]),q.push(m);if(a=f.length)if(e)f=1<f.length?O(f,b,d):(f=f[0]).length>b||d?f.slice(d,b+d):f;else{if(a<g)return[];f=f[a-1];if(b||d)if(f.length>b||d)f=f.slice(d,b+d)}return f}
function O(a,c,b){const d=[],e=w();let g;var f=a.length;let h;for(let k=f-1;0<=k;k--)if(h=(f=a[k])&&f.length)for(let l=0;l<h;l++)if(g=f[l],!e[g])if(e[g]=1,b)b--;else if(d.push(g),d.length===c)return d;return d};function P(a,c,b,d){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,d?Q.call(this,a):a;let e=[];for(let g=0,f,h;g<a.length;g++)if((f=a[g])&&(h=f.length)){if(b){if(b>=h){b-=h;continue}b<h&&(f=c?f.slice(b,b+c):f.slice(b),h=f.length,b=0)}h>c&&(f=f.slice(0,c),h=c);if(!e.length&&h>=c)return d?Q.call(this,f):f;e.push(f);c-=h;if(!c)break}e=1<e.length?[].concat.apply([],e):e[0];return d?Q.call(this,e):e};function S(a,c,b){var d=b[0];if(d.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(d[0]&&d[0].index)return a[c].apply(a,d);d=[];let e=[],g=0,f=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let r;if(m.constructor===T)r=m.result;else if(m.constructor===Array)r=m;else if(g=m.limit||0,f=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,r=m.index.search(m).result,m.resolve=k;else if(m.and)r=a.and(m.and);else if(m.or)r=a.or(m.or);else if(m.xor)r=a.xor(m.xor);
else if(m.not)r=a.not(m.not);else continue;if(r.then)e.push(r);else if(r.length)d[n]=r;else if(!l&&("and"===c||"xor"===c)){d=[];break}}return{m:d,u:e,limit:g,offset:f,enrich:h,resolve:k,suggest:l}};T.prototype.or=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g}=S(this,"or",arguments);return U.call(this,a,c,b,d,e,g)};function U(a,c,b,d,e,g){if(c.length){const f=this;return Promise.all(c).then(function(h){a=[];for(let k=0,l;k<h.length;k++)(l=h[k]).length&&(a[k]=l);return U.call(f,a,[],b,d,e,g)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=O(a,b,d),d=0));return g?this.resolve(b,d,e):this};T.prototype.and=function(){let a=this.result.length,c,b,d,e;if(!a){const g=arguments[0];g&&(a=!!g.suggest,e=g.resolve,c=g.limit,b=g.offset,d=g.enrich&&e)}if(a){const {m:g,u:f,limit:h,offset:k,enrich:l,resolve:n,suggest:m}=S(this,"and",arguments);return ka.call(this,g,f,h,k,l,n,m)}return e?this.resolve(c,b,d):this};
function ka(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return ka.call(h,a,[],b,d,e,g,f)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=aa(a))return this.result=N(a,c,b,d,f),g?e?Q.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(b,d,e):this};T.prototype.xor=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=S(this,"xor",arguments);return la.call(this,a,c,b,d,e,g,f)};
function la(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return la.call(h,a,[],b,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=ma.call(this,a,b,d,g,this.g),g?e?Q.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(b,d,e):this}
function ma(a,c,b,d,e){const g=[],f=w();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k]){h<l.length&&(h=l.length);for(let n=0,m;n<l.length;n++)if(m=l[n])for(let r=0,q;r<m.length;r++)q=m[r],f[q]=f[q]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,r;m<a.length;m++)if(r=a[m])if(l=r[k])for(let q=0,p;q<l.length;q++)if(p=l[q],1===f[p])if(b)b--;else if(d){if(g.push(p),g.length===c)return g}else{const v=k+(m?e:0);g[v]||(g[v]=[]);g[v].push(p);if(++n===c)return g}return g};T.prototype.not=function(){const {m:a,u:c,limit:b,offset:d,enrich:e,resolve:g,suggest:f}=S(this,"not",arguments);return na.call(this,a,c,b,d,e,g,f)};function na(a,c,b,d,e,g,f){if(c.length){const h=this;return Promise.all(c).then(function(k){a=[];for(let l=0,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return na.call(h,a,[],b,d,e,g,f)})}if(a.length&&this.result.length)this.result=oa.call(this,a,b,d,g);else if(g)return this.resolve(b,d,e);return g?e?Q.call(this.index,this.result):this.result:this}
function oa(a,c,b,d){const e=[];a=new Set(a.flat().flat());for(let g=0,f,h=0;g<this.result.length;g++)if(f=this.result[g])for(let k=0,l;k<f.length;k++)if(l=f[k],!a.has(l))if(b)b--;else if(d){if(e.push(l),e.length===c)return e}else if(e[g]||(e[g]=[]),e[g].push(l),++h===c)return e;return e};function T(a){if(!this||this.constructor!==T)return new T(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.g=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.g=0}T.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])if(d.length<=a){if(c[b]=d,a-=d.length,!a)break}else{c[b]=d.slice(0,a);break}this.result=c}return this};
T.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,d;b<this.result.length;b++)if(d=this.result[b])d.length<=a?a-=d.length:(c[b]=d.slice(a),a=0);this.result=c}return this};T.prototype.boost=function(a){this.g+=a;return this};T.prototype.resolve=function(a,c,b){const d=this.result,e=this.index;this.result=this.index=null;return d.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),P.call(e,d,a||100,c,b)):d};w();function Q(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,d;b<a.length;b++)d=a[b],c[b]={id:d,doc:this.store.get(d)};return c};function V(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}V.prototype.set=function(a,c){this.cache.set(this.g=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};V.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};V.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
V.prototype.clear=function(){this.cache.clear();this.g=""};const pa={normalize:function(a){return a.toLowerCase()}};const qa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};D.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const l=w(),n=w(),m=this.depth,r=this.resolution;for(let q=0;q<d;q++){let p=c[this.rtl?d-1-q:q];var e=p.length;if(e&&(m||!n[p])){var g=this.score?this.score(c,p,q,null,0):W(r,d,q),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=p.substring(g,h);var k=this.score?this.score(c,p,q,f,g):W(r,d,q,e,g);X(this,n,f,k,a,b)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)f=p[h]+f,k=this.score?this.score(c,p,q,f,h):W(r,d,q,e,h),X(this,n,f,k,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=p[h],X(this,n,f,g,a,b);break}default:if(X(this,n,p,g,a,b),m&&1<d&&q<d-1)for(e=w(),f=this.B,g=p,h=Math.min(m+1,d-q),e[g]=1,k=1;k<h;k++)if((p=c[this.rtl?d-1-q-k:q+k])&&!e[p]){e[p]=1;const v=this.score?this.score(c,g,q,p,k):W(f+(d/2>f?0:1),d,q,h-1,k-1),B=this.bidirectional&&p>g;X(this,l,B?g:p,v,a,b,B?p:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function X(a,c,b,d,e,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=w()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.reg.get(e))?c.push(h):a.reg.set(e,[h])))}function W(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};D.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var d=[],e=0;if(b){a=b.query||a;c=b.limit||c;e=b.offset||0;var g=b.context;var f=b.suggest;var h=!0;var k=b.resolution}else h=!0;b=this.encoder.encode(a);a=b.length;c=c||(h?100:0);if(1===a)return ra.call(this,b[0],"",c,e,h);g=this.depth&&!1!==g;if(2===a&&g&&!f)return ra.call(this,b[0],b[1],c,e,h);h=w();let l=0;if(1<a&&g){var n=b[0];l=1}k||0===k||(k=n?this.B:this.resolution);for(let p,v;l<a;l++){if((v=
b[l])&&!h[v]){h[v]=1;p=sa(this,v,n);a:{g=p;var m=d,r=f,q=k;let B=[];if(g&&g.length){if(g.length<=q){m.push(g);p=void 0;break a}for(let R=0,fa;R<q;R++)if(fa=g[R])B[R]=fa;if(B.length){m.push(B);p=void 0;break a}}p=r?void 0:B}if(p){d=p;break}n&&(f&&p&&d.length||(n=v))}f&&n&&l===a-1&&!d.length&&(n="",l=-1,h=w())}a:{n=d.length;a=d;if(1<n)a=N(d,k,c,e,f);else if(1===n){f=P.call(null,d[0],c,e);break a}f=a}return f};
function ra(a,c,b,d,e){a=sa(this,a,c);e=!0;return a&&a.length?e?P.call(this,a,b,d):new T(a):e?[]:new T}function sa(a,c,b){let d;b&&(d=a.bidirectional&&c>b)&&(d=b,b=c,c=d);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};D.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 d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else Y(this.map,a),this.depth&&Y(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Y(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){const e=d[0],g=Y(d[1],c);g?b+=g:a.delete(e)}return b};function D(a,c){if(!this||this.constructor!==D)return new D(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},qa[b],a))}else a={};b=a.context;const d=!0===b?{depth:1}:b||{},e=a.encode||a.encoder||pa;this.encoder=e.encode?e:"object"===typeof e?new y(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=b=a.tokenize||"strict";this.depth="strict"===b&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;b=!1;this.map=new Map;
this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.B=d.resolution||3;this.rtl=e.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new V(b)}t=D.prototype;t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};t.append=function(a,c){return this.add(a,c,!0)};t.contain=function(a){return this.reg.has(a)};t.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
function Z(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=Z(b[1]);e?c+=e:a.delete(d)}return c}t.cleanup=function(){if(!this.fastupdate)return this;Z(this.map);this.depth&&Z(this.ctx);return this};
t.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new R);let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d.then){const e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d};export default {Index:S,Charset:null,Encoder:E,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=S;export const Charset=null;export const Encoder=E;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
t.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new V);let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d.then){const e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d};export default {Index:D,Charset:null,Encoder:y,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=D;export const Charset=null;export const Encoder=y;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -276,7 +276,7 @@ const FlexSearch = {
FlexSearch.Language = {};
const root = self;
const root = "undefined" != typeof self ? self : "undefined" != typeof global ? global : "undefined" != typeof window ? window : {};
let prop;
// AMD (RequireJS)

View File

@@ -1,6 +1,7 @@
import { IndexOptions } from "./type.js";
import { create_object, is_function, is_object, is_string } from "./common.js";
import handler from "./worker/handler.js";
import apply_async from "./async.js";
let pid = 0;
@@ -90,10 +91,16 @@ register("append");
register("search");
register("update");
register("remove");
register("clear");
register("export");
register("import");
apply_async(WorkerIndex.prototype);
function register(key) {
WorkerIndex.prototype[key] = WorkerIndex.prototype[key + "Async"] = async function () {
WorkerIndex.prototype[key] =
/*WorkerIndex.prototype[key + "Async"] =*/async function () {
const self = this,
args = [].slice.call(arguments),
arg = args[args.length - 1];

View File

@@ -1,24 +1,25 @@
import Index from "../index.js";
import { IndexOptions } from "../type.js";
/** @type Index */
let index, options;
/** @type {IndexOptions} */
export default (async function (data) {
data = data.data;
/** @type Index */
const index = self._index,
args = data.args,
task = data.task;
const task = data.task,
id = data.id;
let args = data.args;
switch (task) {
case "init":
/** @type {IndexOptions} */
let options = data.options || {},
filepath = options.config;
options = data.options || {};
let filepath = options.config;
if (filepath) {
options = options;
// will be replaced after build with the line below because
@@ -33,22 +34,31 @@ export default (async function (data) {
// export the FlexSearch global payload to "self"
Function("return " + factory)()(self);
/** @type Index */
self._index = new self.FlexSearch.Index(options);
index = new self.FlexSearch.Index(options);
// destroy the exported payload
delete self.FlexSearch;
} else {
self._index = new Index(options);
index = new Index(options);
}
postMessage({ id: data.id });
postMessage({ id: id });
break;
default:
const id = data.id,
let message;
if ("export" === task) {
args = [options.export];
}
if ("import" === task) {
await options.import.call(index, index);
//args = [options.import];
} else {
message = index[task].apply(index, args);
}
postMessage("search" === task ? { id: id, msg: message } : { id: id });
}

View File

@@ -1,27 +1,27 @@
const { parentPort } = require("worker_threads"),
{ join } = require("path"),
{ Index } = require("../flexsearch.bundle.min.js");
{ Index } = require("flexsearch");
//const { join } = require("path");
// Test Path
//const { Index } = require("../../dist/flexsearch.bundle.min.js");
let index;
/** @type Index */
let index, options;
/** @type {IndexOptions} */
parentPort.on("message", async function (data) {
/** @type Index */
const args = data.args,
task = data.task,
const task = data.task,
id = data.id;
let args = data.args;
switch (task) {
case "init":
let options = data.options || {},
filepath = options.config;
// load extern field configuration
options = data.options || {};
// load extern field configuration
let filepath = options.config;
if (filepath) {
options = Object.assign({}, options, require(filepath));
delete options.worker;
@@ -35,7 +35,18 @@ parentPort.on("message", async function (data) {
default:
const message = index[task].apply(index, args);
let message;
if ("export" === task) {
args = [options.export];
}
if ("import" === task) {
await options.import.call(index, index);
//args = [options.import];
} else {
message = index[task].apply(index, args);
}
parentPort.postMessage("search" === task ? { id: id, msg: message } : { id: id });
}
});

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{IndexOptions}from"./type.js";import{create_object,is_function,is_object,is_string}from"./common.js";import handler from"./worker/handler.js";let pid=0;export default function WorkerIndex(a={}){function b(b){function f(a){a=a.data||a;const b=a.id,c=b&&e.resolver[b];c&&(c(a.msg),delete e.resolver[b])}if(this.worker=b,this.resolver=create_object(),!!this.worker)return(d?this.worker.on("message",f):this.worker.onmessage=f,a.config)?new Promise(function(b){e.resolver[++pid]=function(){b(e)},e.worker.postMessage({id:pid,task:"init",factory:c,options:a})}):(this.worker.postMessage({task:"init",factory:c,options:a}),this)}if(!this||this.constructor!==WorkerIndex)return new WorkerIndex(a);let c="undefined"==typeof self?"undefined"==typeof window?null:window._factory:self._factory;c&&(c=c.toString());const d="undefined"==typeof window,e=this,f=create(c,d,a.worker);return f.then?f.then(function(a){return b.call(e,a)}):b.call(this,f)}register("add"),register("append"),register("search"),register("update"),register("remove");function register(a){WorkerIndex.prototype[a]=WorkerIndex.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments),d=c[c.length-1];let e;is_function(d)&&(e=d,c.splice(c.length-1,1));const f=new Promise(function(d){b.resolver[++pid]=d,b.worker.postMessage({task:a,id:pid,args:c})});return e?(f.then(e),this):f}}function create(a,b,c){let d;return d=b?"undefined"==typeof module?(0,eval)("import(\"worker_threads\").then(function(worker){ return new worker[\"Worker\"]((1,eval)(\"import.meta.dirname\") + \"/node/node.mjs\"); })"):(0,eval)("new (require(\"worker_threads\")[\"Worker\"])(__dirname + \"/node/node.js\")"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+handler.toString()],{type:"text/javascript"}))):new window.Worker(is_string(c)?c:(1,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"}),d}
import{IndexOptions}from"./type.js";import{create_object,is_function,is_object,is_string}from"./common.js";import handler from"./worker/handler.js";import apply_async from"./async.js";let pid=0;export default function WorkerIndex(a={}){function b(b){function f(a){a=a.data||a;const b=a.id,c=b&&e.resolver[b];c&&(c(a.msg),delete e.resolver[b])}if(this.worker=b,this.resolver=create_object(),!!this.worker)return(d?this.worker.on("message",f):this.worker.onmessage=f,a.config)?new Promise(function(b){e.resolver[++pid]=function(){b(e)},e.worker.postMessage({id:pid,task:"init",factory:c,options:a})}):(this.worker.postMessage({task:"init",factory:c,options:a}),this)}if(!this||this.constructor!==WorkerIndex)return new WorkerIndex(a);let c="undefined"==typeof self?"undefined"==typeof window?null:window._factory:self._factory;c&&(c=c.toString());const d="undefined"==typeof window,e=this,f=create(c,d,a.worker);return f.then?f.then(function(a){return b.call(e,a)}):b.call(this,f)}register("add"),register("append"),register("search"),register("update"),register("remove"),register("clear"),register("export"),register("import"),apply_async(WorkerIndex.prototype);function register(a){WorkerIndex.prototype[a]=async function(){const b=this,c=[].slice.call(arguments),d=c[c.length-1];let e;is_function(d)&&(e=d,c.splice(c.length-1,1));const f=new Promise(function(d){b.resolver[++pid]=d,b.worker.postMessage({task:a,id:pid,args:c})});return e?(f.then(e),this):f}}function create(a,b,c){let d;return d=b?"undefined"==typeof module?(0,eval)("import(\"worker_threads\").then(function(worker){ return new worker[\"Worker\"]((1,eval)(\"import.meta.dirname\") + \"/node/node.mjs\"); })"):(0,eval)("new (require(\"worker_threads\")[\"Worker\"])(__dirname + \"/node/node.js\")"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+handler.toString()],{type:"text/javascript"}))):new window.Worker(is_string(c)?c:(1,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"}),d}

View File

@@ -1 +1 @@
import Index from"../index.js";import{IndexOptions}from"../type.js";export default(async function(a){a=a.data;const b=self._index,c=a.args,d=a.task;switch(d){case"init":let e=a.options||{},f=e.config;f&&(e=e);const g=a.factory;g?(Function("return "+g)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new Index(e),postMessage({id:a.id});break;default:const h=a.id,i=b[d].apply(b,c);postMessage("search"===d?{id:h,msg:i}:{id:h});}});
import Index from"../index.js";import{IndexOptions}from"../type.js";let index,options;export default(async function(a){a=a.data;const b=a.task,c=a.id;let d=a.args;switch(b){case"init":options=a.options||{};let e=options.config;e&&(options=options);const f=a.factory;f?(Function("return "+f)()(self),index=new self.FlexSearch.Index(options),delete self.FlexSearch):index=new Index(options),postMessage({id:c});break;default:let g;"export"===b&&(d=[options.export]),"import"===b?await options.import.call(index,index):g=index[b].apply(index,d),postMessage("search"===b?{id:c,msg:g}:{id:c});}});

View File

@@ -1 +1 @@
const{parentPort}=require("worker_threads"),{join}=require("path"),{Index}=require("../flexsearch.bundle.min.js");let index;parentPort.on("message",async function(a){const b=a.args,c=a.task,d=a.id;switch(c){case"init":let e=a.options||{},f=e.config;f&&(e=Object.assign({},e,require(f)),delete e.worker),index=new Index(e),parentPort.postMessage({id:d});break;default:const g=index[c].apply(index,b);parentPort.postMessage("search"===c?{id:d,msg:g}:{id:d});}});
const{parentPort}=require("worker_threads"),{Index}=require("flexsearch");let index,options;parentPort.on("message",async function(a){const b=a.task,c=a.id;let d=a.args;switch(b){case"init":options=a.options||{};let e=options.config;e&&(options=Object.assign({},options,require(e)),delete options.worker),index=new Index(options),parentPort.postMessage({id:c});break;default:let f;"export"===b&&(d=[options.export]),"import"===b?await options.import.call(index,index):f=index[b].apply(index,d),parentPort.postMessage("search"===b?{id:c,msg:f}:{id:c});}});

View File

@@ -276,7 +276,7 @@ const FlexSearch = {
FlexSearch.Language = {};
const root = self;
const root = "undefined" != typeof self ? self : "undefined" != typeof global ? global : "undefined" != typeof window ? window : {};
let prop;
// AMD (RequireJS)

View File

@@ -1,6 +1,7 @@
import { IndexOptions } from "./type.js";
import { create_object, is_function, is_object, is_string } from "./common.js";
import handler from "./worker/handler.js";
import apply_async from "./async.js";
let pid = 0;
@@ -90,10 +91,16 @@ register("append");
register("search");
register("update");
register("remove");
register("clear");
register("export");
register("import");
apply_async(WorkerIndex.prototype);
function register(key) {
WorkerIndex.prototype[key] = WorkerIndex.prototype[key + "Async"] = async function () {
WorkerIndex.prototype[key] =
/*WorkerIndex.prototype[key + "Async"] =*/async function () {
const self = this,
args = [].slice.call(arguments),
arg = args[args.length - 1];

View File

@@ -1,24 +1,25 @@
import Index from "../index.js";
import { IndexOptions } from "../type.js";
/** @type Index */
let index, options;
/** @type {IndexOptions} */
export default (async function (data) {
data = data.data;
/** @type Index */
const index = self._index,
args = data.args,
task = data.task;
const task = data.task,
id = data.id;
let args = data.args;
switch (task) {
case "init":
/** @type {IndexOptions} */
let options = data.options || {},
filepath = options.config;
options = data.options || {};
let filepath = options.config;
if (filepath) {
options = options;
// will be replaced after build with the line below because
@@ -33,22 +34,31 @@ export default (async function (data) {
// export the FlexSearch global payload to "self"
Function("return " + factory)()(self);
/** @type Index */
self._index = new self.FlexSearch.Index(options);
index = new self.FlexSearch.Index(options);
// destroy the exported payload
delete self.FlexSearch;
} else {
self._index = new Index(options);
index = new Index(options);
}
postMessage({ id: data.id });
postMessage({ id: id });
break;
default:
const id = data.id,
let message;
if ("export" === task) {
args = [options.export];
}
if ("import" === task) {
await options.import.call(index, index);
//args = [options.import];
} else {
message = index[task].apply(index, args);
}
postMessage("search" === task ? { id: id, msg: message } : { id: id });
}

View File

@@ -1,27 +1,27 @@
const { parentPort } = require("worker_threads"),
{ join } = require("path"),
{ Index } = require("../flexsearch.bundle.min.js");
{ Index } = require("flexsearch");
//const { join } = require("path");
// Test Path
//const { Index } = require("../../dist/flexsearch.bundle.min.js");
let index;
/** @type Index */
let index, options;
/** @type {IndexOptions} */
parentPort.on("message", async function (data) {
/** @type Index */
const args = data.args,
task = data.task,
const task = data.task,
id = data.id;
let args = data.args;
switch (task) {
case "init":
let options = data.options || {},
filepath = options.config;
// load extern field configuration
options = data.options || {};
// load extern field configuration
let filepath = options.config;
if (filepath) {
options = Object.assign({}, options, require(filepath));
delete options.worker;
@@ -35,7 +35,18 @@ parentPort.on("message", async function (data) {
default:
const message = index[task].apply(index, args);
let message;
if ("export" === task) {
args = [options.export];
}
if ("import" === task) {
await options.import.call(index, index);
//args = [options.import];
} else {
message = index[task].apply(index, args);
}
parentPort.postMessage("search" === task ? { id: id, msg: message } : { id: id });
}
});

26
dist/node/node.js vendored
View File

@@ -1,23 +1,25 @@
const { parentPort } = require("worker_threads");
const { join } = require("path");
//const { join } = require("path");
// Test Path
//const { Index } = require("../../dist/flexsearch.bundle.min.js");
const { Index } = require("../flexsearch.bundle.min.js");
const { Index } = require("flexsearch");
/** @type Index */
let index;
/** @type {IndexOptions} */
let options;
parentPort.on("message", async function(data){
/** @type Index */
const args = data["args"];
const task = data["task"];
const id = data["id"];
let args = data["args"];
switch(task){
case "init":
let options = data["options"] || {};
options = data["options"] || {};
// load extern field configuration
let filepath = options["config"];
if(filepath){
@@ -33,7 +35,19 @@ parentPort.on("message", async function(data){
default:
const message = index[task].apply(index, args);
let message;
if(task === "export"){
args = [options.export];
}
if(task === "import"){
await options.import.call(index, index);
//args = [options.import];
}
else{
message = index[task].apply(index, args);
}
parentPort.postMessage(
task === "search"
? { "id": id, "msg": message }

24
dist/node/node.mjs vendored
View File

@@ -3,22 +3,24 @@ import { join } from "path";
// Test Path
//import Index from "../../src/index.js";
//import { Index } from "../../dist/flexsearch.bundle.module.min.js";
import { Index } from "../flexsearch.bundle.module.min.js";
import { Index } from "flexsearch/esm";
/** @type Index */
let index;
/** @type {IndexOptions} */
let options;
parentPort.on("message", async function(data){
/** @type Index */
const args = data["args"];
const task = data["task"];
const id = data["id"];
let args = data["args"];
switch(task){
case "init":
let options = data["options"] || {};
options = data["options"] || {};
// load extern field configuration
let filepath = options["config"];
if(filepath){
@@ -35,7 +37,19 @@ parentPort.on("message", async function(data){
default:
const message = index[task].apply(index, args);
let message;
if(task === "export"){
args = [options.export];
}
if(task === "import"){
await options.import.call(index, index);
//args = [options.import];
}
else{
message = index[task].apply(index, args);
}
parentPort.postMessage(
task === "search"
? { "id": id, "msg": message }

View File

@@ -1,7 +1,7 @@
# FlexSearch v0.8 (Preview)
```bash
npm install git+https://github.com/nextapps-de/flexsearch/tree/master
npm install flexsearch@latest
```
## What's New
@@ -1845,13 +1845,13 @@ for(let i = 0; i < files.length; i++){
- Instead of e.g. "latin:simple" the Charset collection is exported as a module and has to be imported by e.g. `import LatinSimple from "./charset.js"` and then assigned to an existing Encoder by `encoder.assign(LatinSimple)` or by creation `encoder = new Encoder(LatinSimple)`
- You can import language packs by `dist/module/lang/*` when using ESM and by `const EnglishPreset = require("flexsearch/lang/en");` when using CommonJS (Node.js)
- The method `index.append()` is now deprecated and will be removed in the near future, because it isn't consistent and leads into unexpected behavior when not used properly. You should only use `index.add()` to push contents to the index.
- Using the `async` variants like `.searchAsync` is now deprecated (but still works), asynchronous responses will always return from Worker-Index and from Persistent-Index, everything else will return a non-promised result. Having both types of methods looks like the developers can choose between them, but they can't.
- ~~Using the `async` variants like `.searchAsync` is now deprecated (but still works), asynchronous responses will always return from Worker-Index and from Persistent-Index, everything else will return a non-promised result. Having both types of methods looks like the developers can choose between them, but they can't.~~
- Any of your exports from versions below v0.8 are not compatible to import into v0.8
## What's next?
Unfortunately, not everything could be finished and needs to be done in the upcoming version.
- The `Resolver` currently does not support Document-Indexes, there is still some work to do.
- ~~The `Resolver` currently does not support Document-Indexes, there is still some work to do.~~
- Config serialization for persistent indexes (store configuration, check migrations, import and restore field configurations)
- Tooling for persistent indexes (list all tables, remove tables)

View File

@@ -36,6 +36,7 @@ const { Index } = require("flexsearch");
console.log(data[i]);
});
// -----------------------
// EXPORT
// -----------------------
@@ -46,6 +47,7 @@ const { Index } = require("flexsearch");
await fs.writeFile("./export/" + key, data, "utf8");
});
// -----------------------
// IMPORT
// -----------------------

View File

@@ -0,0 +1,29 @@
const { Encoder } = require("flexsearch");
const fs = require("fs").promises;
(async function(){
await fs.mkdir("./export/").catch(e => {});
}());
module.exports = {
tokenize: "forward",
encoder: new Encoder({
normalize: function(str){
return str.toLowerCase();
}
}),
export: async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(index){
let files = await fs.readdir("./export/");
files = await Promise.all(files);
for(let i = 0; i < files.length; i++){
const data = await fs.readFile("./export/" + files[i], "utf8");
index.import(files[i], data);
}
}
};

View File

@@ -0,0 +1,68 @@
const { Worker: WorkerIndex } = require("flexsearch");
(async function(){
// create a simple index which can store id-content-pairs
// and await (!) for the worker response
let index = await new WorkerIndex({
tokenize: "forward",
config: __dirname + "/config.js"
});
// some test data
const data = [
'cats abcd efgh ijkl mnop qrst uvwx cute',
'cats abcd efgh ijkl mnop qrst cute',
'cats abcd efgh ijkl mnop cute',
'cats abcd efgh ijkl cute',
'cats abcd efgh cute',
'cats abcd cute',
'cats cute'
];
// add test data
data.forEach((item, id) => {
index.add(id, item);
});
// perform query
let result = await index.search({
query: "cute cat",
});
// display results
result.forEach(i => {
console.log(data[i]);
});
// -----------------------
// EXPORT
// -----------------------
await index.export(function(){
// do nothing here
});
index = await new WorkerIndex({
tokenize: "forward",
config: __dirname + "/config.js"
});
// -----------------------
// IMPORT
// -----------------------
await index.import();
// perform query
result = await index.search({
query: "cute cat",
});
// display results
console.log("-------------------------------------");
result.forEach(i => {
console.log(data[i]);
});
}());

View File

@@ -0,0 +1,6 @@
{
"name": "nodejs-commonjs-basic-worker-extern-config",
"dependencies": {
"flexsearch": "^0.8.105"
}
}

View File

@@ -1,6 +1,6 @@
import { Encoder } from "flexsearch/esm";
const { Encoder } = require("flexsearch");
export default {
module.exports = {
tokenize: "forward",
encoder: new Encoder({
normalize: function(str){

View File

@@ -0,0 +1,29 @@
import { Encoder } from "flexsearch/esm";
import { promises as fs } from "fs";
(async function(){
await fs.mkdir("./export/").catch(e => {});
}());
export default {
tokenize: "forward",
encoder: new Encoder({
normalize: function(str){
return str.toLowerCase();
}
}),
export: async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(index){
let files = await fs.readdir("./export/");
files = await Promise.all(files);
for(let i = 0; i < files.length; i++){
const data = await fs.readFile("./export/" + files[i], "utf8");
index.import(files[i], data);
}
}
};

View File

@@ -0,0 +1,69 @@
import { Worker as WorkerIndex } from "flexsearch/esm";
const dirname = import.meta.dirname;
(async function(){
// create a simple index which can store id-content-pairs
// and await (!) for the worker response
let index = await new WorkerIndex({
tokenize: "forward",
config: dirname + "/config.js"
});
// some test data
const data = [
'cats abcd efgh ijkl mnop qrst uvwx cute',
'cats abcd efgh ijkl mnop qrst cute',
'cats abcd efgh ijkl mnop cute',
'cats abcd efgh ijkl cute',
'cats abcd efgh cute',
'cats abcd cute',
'cats cute'
];
// add test data
data.forEach((item, id) => {
index.add(id, item);
});
// perform query
let result = await index.search({
query: "cute cat",
});
// display results
result.forEach(i => {
console.log(data[i]);
});
// -----------------------
// EXPORT
// -----------------------
await index.export(function(){
// do nothing here
});
index = await new WorkerIndex({
tokenize: "forward",
config: dirname + "/config.js"
});
// -----------------------
// IMPORT
// -----------------------
await index.import();
// perform query
result = await index.search({
query: "cute cat",
});
// display results
console.log("-------------------------------------");
result.forEach(i => {
console.log(data[i]);
});
}());

View File

@@ -0,0 +1,7 @@
{
"name": "nodejs-esm-basic-worker-extern-config",
"type": "module",
"dependencies": {
"flexsearch": "^0.8.105"
}
}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "flexsearch",
"version": "0.8.107",
"version": "0.8.108",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "flexsearch",
"version": "0.8.107",
"version": "0.8.108",
"funding": [
{
"type": "github",

View File

@@ -2,7 +2,7 @@
"public": true,
"preferGlobal": false,
"name": "flexsearch",
"version": "0.8.107",
"version": "0.8.108",
"description": "Next-Generation full-text search library for Browser and Node.js",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",

View File

@@ -310,7 +310,9 @@ if(RELEASE !== "bundle.module" &&
FlexSearch["Language"] = {};
const root = self;
const root = typeof self !== "undefined" ? self :
typeof global !== "undefined" ? global :
typeof window !== "undefined" ? window : {};
let prop;
// AMD (RequireJS)

View File

@@ -1,6 +1,7 @@
import { IndexOptions } from "./type.js";
import { create_object, is_function, is_object, is_string } from "./common.js";
import handler from "./worker/handler.js";
import apply_async from "./async.js";
let pid = 0;
@@ -97,11 +98,16 @@ register("append");
register("search");
register("update");
register("remove");
register("clear");
register("export");
register("import");
apply_async(WorkerIndex.prototype);
function register(key){
WorkerIndex.prototype[key] =
WorkerIndex.prototype[key + "Async"] = async function(){
/*WorkerIndex.prototype[key + "Async"] =*/ async function(){
const self = this;
const args = [].slice.call(arguments);

View File

@@ -1,21 +1,24 @@
import Index from "../index.js";
import { IndexOptions } from "../type.js";
/** @type Index */
let index;
/** @type {IndexOptions} */
let options;
export default async function(data) {
data = data["data"];
/** @type Index */
const index = self["_index"];
const args = data["args"];
const task = data["task"];
const id = data["id"];
let args = data["args"];
switch(task){
case "init":
/** @type {IndexOptions} */
let options = data["options"] || {};
options = data["options"] || {};
let filepath = options.config;
if(filepath){
options = options;
@@ -31,24 +34,34 @@ export default async function(data) {
// export the FlexSearch global payload to "self"
Function("return " + factory)()(self);
/** @type Index */
self["_index"] = new self["FlexSearch"]["Index"](options);
index = new self["FlexSearch"]["Index"](options);
// destroy the exported payload
delete self["FlexSearch"];
}
else{
self["_index"] = new Index(options);
index = new Index(options);
}
postMessage({ "id": data["id"] });
postMessage({ "id": id });
break;
default:
const id = data["id"];
const message = index[task].apply(index, args);
let message;
if(task === "export"){
args = [options.export];
}
if(task === "import"){
await options.import.call(index, index);
//args = [options.import];
}
else{
message = index[task].apply(index, args);
}
postMessage(
task === "search"
? { "id": id, "msg": message }

View File

@@ -1,23 +1,25 @@
const { parentPort } = require("worker_threads");
const { join } = require("path");
//const { join } = require("path");
// Test Path
//const { Index } = require("../../dist/flexsearch.bundle.min.js");
const { Index } = require("../flexsearch.bundle.min.js");
const { Index } = require("flexsearch");
/** @type Index */
let index;
/** @type {IndexOptions} */
let options;
parentPort.on("message", async function(data){
/** @type Index */
const args = data["args"];
const task = data["task"];
const id = data["id"];
let args = data["args"];
switch(task){
case "init":
let options = data["options"] || {};
options = data["options"] || {};
// load extern field configuration
let filepath = options["config"];
if(filepath){
@@ -33,7 +35,19 @@ parentPort.on("message", async function(data){
default:
const message = index[task].apply(index, args);
let message;
if(task === "export"){
args = [options.export];
}
if(task === "import"){
await options.import.call(index, index);
//args = [options.import];
}
else{
message = index[task].apply(index, args);
}
parentPort.postMessage(
task === "search"
? { "id": id, "msg": message }

View File

@@ -3,22 +3,24 @@ import { join } from "path";
// Test Path
//import Index from "../../src/index.js";
//import { Index } from "../../dist/flexsearch.bundle.module.min.js";
import { Index } from "../flexsearch.bundle.module.min.js";
import { Index } from "flexsearch/esm";
/** @type Index */
let index;
/** @type {IndexOptions} */
let options;
parentPort.on("message", async function(data){
/** @type Index */
const args = data["args"];
const task = data["task"];
const id = data["id"];
let args = data["args"];
switch(task){
case "init":
let options = data["options"] || {};
options = data["options"] || {};
// load extern field configuration
let filepath = options["config"];
if(filepath){
@@ -35,7 +37,19 @@ parentPort.on("message", async function(data){
default:
const message = index[task].apply(index, args);
let message;
if(task === "export"){
args = [options.export];
}
if(task === "import"){
await options.import.call(index, index);
//args = [options.import];
}
else{
message = index[task].apply(index, args);
}
parentPort.postMessage(
task === "search"
? { "id": id, "msg": message }