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

universal charset presets, fix #483

This commit is contained in:
Thomas Wilkerling
2025-03-27 18:16:37 +01:00
parent 98c6039a0a
commit 5abd01a3c5
56 changed files with 1858 additions and 2256 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
### Current Version
- Use multi-language charset normalization as the default `Encoder`
- Simplified charset support for CJK, Arabic, Cyrillic, Hindi, ... no extra charset definition required, the default encoder can handle them all
- Charset renamed `LatinExact` => `Exact`, `LatinDefault` => `Default` and `LatinSimple` => `Normalize`, these are universal charset presets for any languages
- Charset `CjkDefault`, `ArabicDefault` and `CyrillicDefault` was removed, they are fully covered by the default universal charset presets
### v0.8.1
- Resolver Support for Documents

File diff suppressed because it is too large Load Diff

View File

@@ -1,95 +1,89 @@
/**!
* FlexSearch.js v0.8.142 (Bundle)
* FlexSearch.js v0.8.143 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;var t;function z(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 B(){return Object.create(null)}function E(a){return"string"===typeof a}
function I(a){return"object"===typeof a}function aa(a){const c=[];for(const b of a.keys())c.push(b);return c}function ba(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 ca(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 da=[["\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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g;function J(a={}){if(!this||this.constructor!==J)return new J(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}t=J.prototype;
function I(a){return"object"===typeof a}function aa(a){const c=[];for(const b of a.keys())c.push(b);return c}function ba(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 ca(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};const da=/[^\p{L}\p{N}]+/u,ea=/(\d{3})/g,fa=/(\D)(\d{3})/g,ha=/(\d{3})(\D)/g,ia=/[\u0300-\u036f]/g;function J(a={}){if(!this||this.constructor!==J)return new J(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}t=J.prototype;
t.assign=function(a){this.normalize=z(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,e;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";e=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(f){this.split=/\s+/}}else this.split=b,e=!1===b||2>"a1a".split(b).length;
this.numeric=z(a.numeric,e)}else{try{this.split=z(this.split,ea)}catch(d){this.split=/\s+/}this.numeric=z(a.numeric,z(this.numeric,!0))}this.prepare=z(a.prepare,null,this.prepare);this.finalize=z(a.finalize,null,this.finalize);ja||(this.mapper=new Map(da));b=a.filter;this.filter="function"===typeof b?b:z(b&&new Set(b),null,this.filter);this.dedupe=z(a.dedupe,!1,this.dedupe);this.matcher=z((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=z((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
z((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=z(a.replacer,null,this.replacer);this.minlength=z(a.minlength,1,this.minlength);this.maxlength=z(a.maxlength,0,this.maxlength);this.rtl=z(a.rtl,!1,this.rtl);if(this.cache=b=z(a.cache,!0,this.cache))this.H=null,this.S="number"===typeof b?b:2E5,this.B=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.A+=
this.numeric=z(a.numeric,e)}else{try{this.split=z(this.split,da)}catch(d){this.split=/\s+/}this.numeric=z(a.numeric,z(this.numeric,!0))}this.prepare=z(a.prepare,null,this.prepare);this.finalize=z(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:z(b&&new Set(b),null,this.filter);this.dedupe=z(a.dedupe,!1,this.dedupe);this.matcher=z((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=z((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=z((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=z(a.replacer,null,this.replacer);this.minlength=z(a.minlength,1,this.minlength);this.maxlength=z(a.maxlength,0,this.maxlength);this.rtl=z(a.rtl,!1,this.rtl);if(this.cache=b=z(a.cache,!0,this.cache))this.H=null,this.S="number"===typeof b?b:2E5,this.B=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.A+=
(this.A?"|":"")+d;return this};t.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.A+=(this.A?"|":"")+a;this.N=null;this.cache&&K(this);return this};t.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&K(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&&K(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.h+=(this.h?"|":"")+a;this.M=null;this.cache&&K(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&&K(this);return this};
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(K,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 c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=
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(K,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ia?a.normalize("NFKD").replace(ia,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(fa,"$1 $2").replace(ha,"$1 $2").replace(ea,"$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||("function"===typeof this.filter?this.filter(g):!this.filter.has(g))){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&b.push(d);continue}}else this.H=setTimeout(K,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),d=g,g=g.replace(this.N,k=>this.stemmer.get(k)),d!==g&&this.filter&&
g.length>=this.minlength&&("function"===typeof this.filter?!this.filter(g):this.filter.has(g))&&(g=""));if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let k=0,l="",n,m;k<g.length;k++)n=g.charAt(k),n===l&&this.dedupe||((m=this.mapper&&this.mapper.get(n))||""===m?m===l&&this.dedupe||!(l=m)||(d+=m):d+=l=n);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.S&&(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.B.set(a,b),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return b};function K(a){a.H=null;a.B.clear();a.G.clear()};let M,ka;async function la(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":ka=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(ka),delete self.FlexSearch):M=new N(ka);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=ka.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await ka.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ma(a){na.call(a,"add");na.call(a,"append");na.call(a,"search");na.call(a,"update");na.call(a,"remove")}let oa,pa,qa;function ra(){oa=qa=0}
function na(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]);oa?qa||(qa=Date.now()-pa>=this.priority*this.priority*3):(oa=setTimeout(ra,0),pa=Date.now());if(qa){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 O=0;
this.replacer[d+1]);this.cache&&h.length<=this.L&&(this.G.set(h,g),this.G.size>this.S&&(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.B.set(a,b),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return b};function K(a){a.H=null;a.B.clear();a.G.clear()};let M,ja;async function ka(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":ja=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(ja),delete self.FlexSearch):M=new N(ja);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=ja.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await ja.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function la(a){ma.call(a,"add");ma.call(a,"append");ma.call(a,"search");ma.call(a,"update");ma.call(a,"remove")}let na,oa,pa;function qa(){na=pa=0}
function ma(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);na?pa||(pa=Date.now()-oa>=this.priority*this.priority*3):(na=setTimeout(qa,0),oa=Date.now());if(pa){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,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 O=0;
function P(a={}){function c(g){function h(k){k=k.data||k;const l=k.id,n=l&&d.h[l];n&&(n(k.msg),delete d.h[l])}this.worker=g;this.h=B();if(this.worker){e?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){d.h[++O]=function(){k(d);1E9<O&&(O=0)};d.worker.postMessage({id:O,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});this.priority=a.priority||4;return this}}if(!this||this.constructor!==P)return new P(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=sa(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}Q("add");Q("append");Q("search");Q("update");Q("remove");Q("clear");Q("export");Q("import");ma(P.prototype);
"undefined"!==typeof self?self._factory:"undefined"!==typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=ra(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}Q("add");Q("append");Q("search");Q("update");Q("remove");Q("clear");Q("export");Q("import");la(P.prototype);
function Q(a){P.prototype[a]=function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.pop());e=new Promise(function(f){"export"===a&&"function"===typeof b[0]&&(b[0]=null);c.h[++O]=f;c.worker.postMessage({task:a,id:O,args:b})});return d?(e.then(d),this):e}}
function sa(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="+la.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 ta(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 ua(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 va(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],ta(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function wa(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],ua(e[1],d));return c}function xa(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 ya(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function za(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 za.call(l,a,c,b,h?e:null,d,f,g+1)})}return za.call(this,a,c,b,h?e:null,d,f,g+1)}
function Aa(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,h;g<d.length;g++){h=d[g]||[""];let k="";for(let l=0;l<h.length;l++)k+=(k?",":"")+("string"===c?'"'+h[l]+'"':h[l]);k="["+k+"]";f+=(f?",":"")+k}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};function Ba(a,c,b,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],c>=g.length)c-=g.length;else{c=g[e?"splice":"slice"](c,b);const h=c.length;if(h&&(d=d.length?d.concat(c):c,b-=h,e&&(a.length-=h),!b))break;c=0}return d}
function ra(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="+ka.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 sa(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 ta(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 ua(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],sa(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function va(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],ta(e[1],d));return c}function wa(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 xa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function ya(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 ya.call(l,a,c,b,h?e:null,d,f,g+1)})}return ya.call(this,a,c,b,h?e:null,d,f,g+1)}
function za(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,h;g<d.length;g++){h=d[g]||[""];let k="";for(let l=0;l<h.length;l++)k+=(k?",":"")+("string"===c?'"'+h[l]+'"':h[l]);k="["+k+"]";f+=(f?",":"")+k}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};function Aa(a,c,b,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],c>=g.length)c-=g.length;else{c=g[e?"splice":"slice"](c,b);const h=c.length;if(h&&(d=d.length?d.concat(c):c,b-=h,e&&(a.length-=h),!b))break;c=0}return d}
function R(a){if(!this||this.constructor!==R)return new R(a);this.index=a?[a]:[];this.length=a?a.length:0;const c=this;return new Proxy([],{get(b,e){if("length"===e)return c.length;if("push"===e)return function(d){c.index[c.index.length-1].push(d);c.length++};if("pop"===e)return function(){if(c.length)return c.length--,c.index[c.index.length-1].pop()};if("indexOf"===e)return function(d){let f=0;for(let g=0,h,k;g<c.index.length;g++){h=c.index[g];k=h.indexOf(d);if(0<=k)return f+k;f+=h.length}return-1};
if("includes"===e)return function(d){for(let f=0;f<c.index.length;f++)if(c.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return Ba(c,d||0,f||c.length,!1)};if("splice"===e)return function(d,f){return Ba(c,d||0,f||c.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(b=c.index[e/2**31|0])&&b[e]},set(b,e,d){b=e/2**31|0;(c.index[b]||(c.index[b]=[]))[e]=d;c.length++;return!0}})}R.prototype.clear=function(){this.index.length=0};
R.prototype.destroy=function(){this.proxy=this.index=null};R.prototype.push=function(){};function S(a=8){if(!this||this.constructor!==S)return new S(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ca,this.A=BigInt(a)):(this.B=Da,this.A=a)}S.prototype.get=function(a){const c=this.index[this.B(a)];return c&&c.get(a)};S.prototype.set=function(a,c){var b=this.B(a);let e=this.index[b];e?(b=e.size,e.set(a,c),(b-=e.size)&&this.size++):(this.index[b]=e=new Map([[a,c]]),this.h.push(e),this.size++)};
function T(a=8){if(!this||this.constructor!==T)return new T(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ca,this.A=BigInt(a)):(this.B=Da,this.A=a)}T.prototype.add=function(a){var c=this.B(a);let b=this.index[c];b?(c=b.size,b.add(a),(c-=b.size)&&this.size++):(this.index[c]=b=new Set([a]),this.h.push(b),this.size++)};t=S.prototype;t.has=T.prototype.has=function(a){const c=this.index[this.B(a)];return c&&c.has(a)};
if("includes"===e)return function(d){for(let f=0;f<c.index.length;f++)if(c.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return Aa(c,d||0,f||c.length,!1)};if("splice"===e)return function(d,f){return Aa(c,d||0,f||c.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(b=c.index[e/2**31|0])&&b[e]},set(b,e,d){b=e/2**31|0;(c.index[b]||(c.index[b]=[]))[e]=d;c.length++;return!0}})}R.prototype.clear=function(){this.index.length=0};
R.prototype.destroy=function(){this.proxy=this.index=null};R.prototype.push=function(){};function S(a=8){if(!this||this.constructor!==S)return new S(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ba,this.A=BigInt(a)):(this.B=Ca,this.A=a)}S.prototype.get=function(a){const c=this.index[this.B(a)];return c&&c.get(a)};S.prototype.set=function(a,c){var b=this.B(a);let e=this.index[b];e?(b=e.size,e.set(a,c),(b-=e.size)&&this.size++):(this.index[b]=e=new Map([[a,c]]),this.h.push(e),this.size++)};
function T(a=8){if(!this||this.constructor!==T)return new T(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ba,this.A=BigInt(a)):(this.B=Ca,this.A=a)}T.prototype.add=function(a){var c=this.B(a);let b=this.index[c];b?(c=b.size,b.add(a),(c-=b.size)&&this.size++):(this.index[c]=b=new Set([a]),this.h.push(b),this.size++)};t=S.prototype;t.has=T.prototype.has=function(a){const c=this.index[this.B(a)];return c&&c.has(a)};
t.delete=T.prototype.delete=function(a){const c=this.index[this.B(a)];c&&c.delete(a)&&this.size--};t.clear=T.prototype.clear=function(){this.index=B();this.h=[];this.size=0};t.values=T.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let c of this.h[a].values())yield c};t.keys=T.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let c of this.h[a].keys())yield c};t.entries=T.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let c of this.h[a].entries())yield c};
function Da(a){let c=2**this.A-1;if("number"==typeof a)return a&c;let b=0,e=this.A+1;for(let d=0;d<a.length;d++)b=(b*e^a.charCodeAt(d))&c;return 32===this.A?b+2**31:b}function Ca(a){let c=BigInt(2)**this.A-BigInt(1);var b=typeof a;if("bigint"===b)return a&c;if("number"===b)return BigInt(a)&c;b=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)b=(b*e^BigInt(a.charCodeAt(d)))&c;return b};U.prototype.add=function(a,c,b){I(a)&&(c=a,a=ba(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.D[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]),Ea(c,k,this.J,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let h=B();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
function Ca(a){let c=2**this.A-1;if("number"==typeof a)return a&c;let b=0,e=this.A+1;for(let d=0;d<a.length;d++)b=(b*e^a.charCodeAt(d))&c;return 32===this.A?b+2**31:b}function Ba(a){let c=BigInt(2)**this.A-BigInt(1);var b=typeof a;if("bigint"===b)return a&c;if("number"===b)return BigInt(a)&c;b=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)b=(b*e^BigInt(a.charCodeAt(d)))&c;return b};U.prototype.add=function(a,c,b){I(a)&&(c=a,a=ba(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.D[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]),Da(c,k,this.J,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let h=B();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=ba(c,f)}if(d&&f){E(f)&&(f=[f]);for(let k=0,l,n;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=d.get(l))?n=g:d.set(l,n=[]),!b||!n.includes(a))){if(n.length===2**31-1){g=new R(n);if(this.fastupdate)for(let m of this.reg.values())m.includes(n)&&(m[m.indexOf(n)]=g);d.set(l,n=g)}n.push(a);this.fastupdate&&((g=this.reg.get(a))?g.push(n):this.reg.set(a,[n]))}}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.C){h=B();for(let k=0,l;k<this.C.length;k++){l=
this.C[k];if((b=l.I)&&!b(c))continue;let n;if("function"===typeof l){n=l(c);if(!n)continue;l=[l.V]}else if(E(l)||l.constructor===String){h[l]=c[l];continue}Fa(c,h,l,0,l[0],n)}}this.store.set(a,h||c)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function Fa(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++)Fa(a,c,b,e,d);else c=c[d]||(c[d]=B()),d=b[++e],Fa(a,c,b,e,d)}
function Ea(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++)Ea(a,c,b,e,d,f,g,h);else g=c[++e],Ea(a,c,b,e,d,f,g,h);else d.db&&d.remove(f)};function Ga(a,c,b,e,d,f,g){const h=a.length;let k=[],l,n;l=B();for(let m=0,q,p,r,u;m<c;m++)for(let v=0;v<h;v++)if(r=a[v],m<r.length&&(q=r[m]))for(let w=0;w<q.length;w++){p=q[w];(n=l[p])?l[p]++:(n=0,l[p]=1);u=k[n]||(k[n]=[]);if(!g){let y=m+(v||!d?0:f||0);u=u[y]||(u[y]=[])}u.push(p);if(g&&b&&n===h-1&&u.length-e===b)return u}if(a=k.length)if(d)k=1<k.length?Ha(k,b,e,g,f):(k=k[0]).length>b||e?k.slice(e,b+e):k;else{if(a<h)return[];k=k[a-1];if(b||e)if(g){if(k.length>b||e)k=k.slice(e,b+e)}else{d=[];for(let m=
this.C[k];if((b=l.I)&&!b(c))continue;let n;if("function"===typeof l){n=l(c);if(!n)continue;l=[l.V]}else if(E(l)||l.constructor===String){h[l]=c[l];continue}Ea(c,h,l,0,l[0],n)}}this.store.set(a,h||c)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function Ea(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++)Ea(a,c,b,e,d);else c=c[d]||(c[d]=B()),d=b[++e],Ea(a,c,b,e,d)}
function Da(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++)Da(a,c,b,e,d,f,g,h);else g=c[++e],Da(a,c,b,e,d,f,g,h);else d.db&&d.remove(f)};function Fa(a,c,b,e,d,f,g){const h=a.length;let k=[],l,n;l=B();for(let m=0,q,p,r,u;m<c;m++)for(let v=0;v<h;v++)if(r=a[v],m<r.length&&(q=r[m]))for(let w=0;w<q.length;w++){p=q[w];(n=l[p])?l[p]++:(n=0,l[p]=1);u=k[n]||(k[n]=[]);if(!g){let y=m+(v||!d?0:f||0);u=u[y]||(u[y]=[])}u.push(p);if(g&&b&&n===h-1&&u.length-e===b)return u}if(a=k.length)if(d)k=1<k.length?Ga(k,b,e,g,f):(k=k[0]).length>b||e?k.slice(e,b+e):k;else{if(a<h)return[];k=k[a-1];if(b||e)if(g){if(k.length>b||e)k=k.slice(e,b+e)}else{d=[];for(let m=
0,q;m<k.length;m++)if(q=k[m],q.length>e)e-=q.length;else{if(q.length>b||e)q=q.slice(e,b+e),b-=q.length,e&&(e-=q.length);d.push(q);if(!b)break}k=1<d.length?[].concat.apply([],d):d[0]}}return k}
function Ha(a,c,b,e,d){const f=[],g=B();let h;var k=a.length;let l;if(e)for(d=k-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(k=0;k<l;k++)if(h=e[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else for(let n=k-1,m,q=0;0<=n;n--){m=a[n];for(let p=0;p<m.length;p++)if(l=(e=m[p])&&e.length)for(let r=0;r<l;r++)if(h=e[r],!g[h])if(g[h]=1,b)b--;else{let u=(p+(n<k-1?d||0:0))/(n+1)|0;(f[u]||(f[u]=[])).push(h);if(++q===c)return f}}return f}
function Ia(a,c,b){const e=B(),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 Ja(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?V.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?V.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?V.call(this,d):d};function Ka(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let q;if(m.constructor===W)q=m.result;else if(m.constructor===Array)q=m;else if(f=m.limit||0,g=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,q=m.index.search(m).result,m.resolve=k;else if(m.and)q=a.and(m.and);else if(m.or)q=a.or(m.or);else if(m.xor)q=a.xor(m.xor);
else if(m.not)q=a.not(m.not);else continue;if(q.then)d.push(q);else if(q.length)e[n]=q;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:h,resolve:k,suggest:l}};W.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=Ka(this,"or",arguments);return La.call(this,a,c,b,e,d,f)};function La(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 La.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=Ha(a,b,e,!1,this.h),e=0));return f?this.resolve(b,e,d):this};W.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:n,suggest:m}=Ka(this,"and",arguments);return Ma.call(this,f,g,h,k,l,n,m)}return d?this.resolve(c,b,e):this};
function Ma(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Ma.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=ca(a))return this.result=Ga(a,c,b,e,g,this.h,f),f?d?V.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};W.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ka(this,"xor",arguments);return Na.call(this,a,c,b,e,d,f,g)};
function Na(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Na.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=Oa.call(this,a,b,e,f,this.h),f?d?V.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Oa(a,c,b,e,d){const f=[],g=B();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 q=0,p;q<m.length;q++)p=m[q],g[p]=g[p]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,q;m<a.length;m++)if(q=a[m])if(l=q[k])for(let p=0,r;p<l.length;p++)if(r=l[p],1===g[r])if(b)b--;else if(e){if(f.push(r),f.length===c)return f}else{const u=k+(m?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++n===c)return f}return f};W.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ka(this,"not",arguments);return Pa.call(this,a,c,b,e,d,f,g)};function Pa(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Pa.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Qa.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?V.call(this.index,this.result):this.result:this}
function Qa(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 W(a){if(!this||this.constructor!==W)return new W(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}W.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};
W.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};W.prototype.boost=function(a){this.h+=a;return this};W.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),Ja.call(d,e,a||100,c,b)):e};B();U.prototype.search=function(a,c,b,e){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let d=[];var f=[],g;let h;let k,l;let n=0;var m=!0;let q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;h=b.merge;k=p||b.field||(k=b.index)&&(k.index?null:k);l=this.tag&&b.tag;var r=b.suggest;m=!1!==b.resolve;m||p||!(k=k||this.field)||(E(k)?p=k:(k.constructor===Array&&1===k.length&&(k=k[0]),p=k.field||k.index));q=(g=this.store&&b.enrich&&m)&&b.highlight;c=b.limit||c;var u=b.offset||0;c||(c=100);if(l&&
function Ga(a,c,b,e,d){const f=[],g=B();let h;var k=a.length;let l;if(e)for(d=k-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(k=0;k<l;k++)if(h=e[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else for(let n=k-1,m,q=0;0<=n;n--){m=a[n];for(let p=0;p<m.length;p++)if(l=(e=m[p])&&e.length)for(let r=0;r<l;r++)if(h=e[r],!g[h])if(g[h]=1,b)b--;else{let u=(p+(n<k-1?d||0:0))/(n+1)|0;(f[u]||(f[u]=[])).push(h);if(++q===c)return f}}return f}
function Ha(a,c,b){const e=B(),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 Ia(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?V.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?V.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?V.call(this,d):d};function Ja(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let q;if(m.constructor===W)q=m.result;else if(m.constructor===Array)q=m;else if(f=m.limit||0,g=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,q=m.index.search(m).result,m.resolve=k;else if(m.and)q=a.and(m.and);else if(m.or)q=a.or(m.or);else if(m.xor)q=a.xor(m.xor);
else if(m.not)q=a.not(m.not);else continue;if(q.then)d.push(q);else if(q.length)e[n]=q;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:h,resolve:k,suggest:l}};W.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=Ja(this,"or",arguments);return Ka.call(this,a,c,b,e,d,f)};function Ka(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 Ka.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=Ga(a,b,e,!1,this.h),e=0));return f?this.resolve(b,e,d):this};W.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:n,suggest:m}=Ja(this,"and",arguments);return La.call(this,f,g,h,k,l,n,m)}return d?this.resolve(c,b,e):this};
function La(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return La.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=ca(a))return this.result=Fa(a,c,b,e,g,this.h,f),f?d?V.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};W.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ja(this,"xor",arguments);return Ma.call(this,a,c,b,e,d,f,g)};
function Ma(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Ma.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=Na.call(this,a,b,e,f,this.h),f?d?V.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Na(a,c,b,e,d){const f=[],g=B();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 q=0,p;q<m.length;q++)p=m[q],g[p]=g[p]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,q;m<a.length;m++)if(q=a[m])if(l=q[k])for(let p=0,r;p<l.length;p++)if(r=l[p],1===g[r])if(b)b--;else if(e){if(f.push(r),f.length===c)return f}else{const u=k+(m?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++n===c)return f}return f};W.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ja(this,"not",arguments);return Oa.call(this,a,c,b,e,d,f,g)};function Oa(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Oa.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Pa.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?V.call(this.index,this.result):this.result:this}
function Pa(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 W(a){if(!this||this.constructor!==W)return new W(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}W.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};
W.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};W.prototype.boost=function(a){this.h+=a;return this};W.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),Ia.call(d,e,a||100,c,b)):e};B();U.prototype.search=function(a,c,b,e){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let d=[];var f=[],g;let h;let k,l;let n=0;var m=!0;let q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;h=b.merge;k=p||b.field||(k=b.index)&&(k.index?null:k);l=this.tag&&b.tag;var r=b.suggest;m=!1!==b.resolve;m||p||!(k=k||this.field)||(E(k)?p=k:(k.constructor===Array&&1===k.length&&(k=k[0]),p=k.field||k.index));q=(g=this.store&&b.enrich&&m)&&b.highlight;c=b.limit||c;var u=b.offset||0;c||(c=100);if(l&&
(!this.db||!e)){l.constructor!==Array&&(l=[l]);var v=[];for(let A=0,x;A<l.length;A++)if(x=l[A],x.field&&x.tag){var w=x.tag;if(w.constructor===Array)for(var y=0;y<w.length;y++)v.push(x.field,w[y]);else v.push(x.field,w)}else{w=Object.keys(x);for(let D=0,G,C;D<w.length;D++)if(G=w[D],C=x[G],C.constructor===Array)for(y=0;y<C.length;y++)v.push(G,C[y]);else v.push(G,C)}l=v;if(!a){m=[];if(v.length)for(f=0;f<v.length;f+=2){if(this.db){p=this.index.get(v[f]);if(!p)continue;m.push(p=p.db.tag(v[f+1],c,u,g))}else p=
Ra.call(this,v[f],v[f+1],c,u,g);d.push({field:v[f],tag:v[f+1],result:p})}return m.length?Promise.all(m).then(function(A){for(let x=0;x<A.length;x++)d[x].result=A[x];return d}):d}}k&&k.constructor!==Array&&(k=[k])}k||(k=this.field);v=!e&&(this.worker||this.db)&&[];let F;for(let A=0,x,D,G;A<k.length;A++){D=k[A];if(this.db&&this.tag&&!this.D[A])continue;let C;E(D)||(C=D,D=C.field,a=C.query||a,c=C.limit||c,u=C.offset||u,r=C.suggest||r,g=this.store&&(C.enrich||g));if(e)x=e[A];else if(w=C||b,y=this.index.get(D),
l&&(this.db&&(w.tag=l,F=y.db.support_tag_search,w.field=k),F||(w.enrich=!1)),v){v[A]=y.search(a,c,w);w&&g&&(w.enrich=g);continue}else x=y.search(a,c,w),w&&g&&(w.enrich=g);G=x&&(m?x.length:x.result.length);if(l&&G){w=[];y=0;if(this.db&&e){if(!F)for(let H=k.length;H<e.length;H++){let L=e[H];if(L&&L.length)y++,w.push(L);else if(!r)return m?d:new W(d)}}else for(let H=0,L,rb;H<l.length;H+=2){L=this.tag.get(l[H]);if(!L)if(r)continue;else return m?d:new W(d);if(rb=(L=L&&L.get(l[H+1]))&&L.length)y++,w.push(L);
else if(!r)return m?d:new W(d)}if(y){x=Ia(x,w,m);G=x.length;if(!G&&!r)return m?x:new W(x);y--}}if(G)f[n]=D,d.push(x),n++;else if(1===k.length)return m?d:new W(d)}if(v){if(this.db&&l&&l.length&&!F)for(g=0;g<l.length;g+=2){f=this.index.get(l[g]);if(!f)if(r)continue;else return m?d:new W(d);v.push(f.db.tag(l[g+1],c,u,!1))}const A=this;return Promise.all(v).then(function(x){return x.length?A.search(a,c,b,x):x})}if(!n)return m?d:new W(d);if(p&&(!g||!this.store))return d[0];v=[];for(u=0;u<f.length;u++){r=
d[u];g&&r.length&&"undefined"===typeof r[0].doc&&(this.db?v.push(r=this.index.get(this.field[0]).db.enrich(r)):r=V.call(this,r));if(p)return m?r:new W(r);d[u]={field:f[u],result:r}}if(g&&this.db&&v.length){const A=this;return Promise.all(v).then(function(x){for(let D=0;D<x.length;D++)d[D].result=x[D];return h?Sa(d,c):q?Ta(d,a,A.index,A.field,A.D,q):d})}return h?Sa(d,c):q?Ta(d,a,this.index,this.field,this.D,q):d};
function Ta(a,c,b,e,d,f){let g,h,k;for(let n=0,m,q,p,r;n<a.length;n++){let u=a[n].result;m=a[n].field;p=b.get(m);q=p.encoder;k=p.tokenize;r=d[e.indexOf(m)];q!==g&&(g=q,h=g.encode(c));for(let v=0;v<u.length;v++){let w="";var l=ba(u[v].doc,r);let y=g.encode(l);l=l.split(g.split);for(let F=0,A,x;F<y.length;F++){A=y[F];x=l[F];if(!A||!x)continue;let D;for(let G=0,C;G<h.length;G++)if(C=h[G],"strict"===k){if(A===C){w+=(w?" ":"")+f.replace("$1",x);D=!0;break}}else{const H=A.indexOf(C);if(-1<H){w+=(w?" ":
"")+x.substring(0,H)+f.replace("$1",x.substring(H,C.length))+x.substring(H+C.length);D=!0;break}}D||(w+=(w?" ":"")+l[F])}u[v].highlight=w}}return a}function Sa(a,c){const b=[],e=B();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,l,n;h<g.length;h++)if(l=g[h],"object"!==typeof l&&(l={id:l}),k=l.id,n=e[k])n.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}
function Ra(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=V.call(this,a));return a}}function V(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 U(a){if(!this||this.constructor!==U)return new U(a);const c=a.document||a.doc||a;let b,e;this.D=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&Ua(b,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.fastupdate=!!a.fastupdate;this.reg=!this.fastupdate||a.worker||a.db?e?new T(e):new Set:e?new S(e):new Map;this.C=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&(e?new S(e):new Map);this.cache=(b=a.cache||null)&&new X(b);a.cache=!1;this.worker=a.worker;this.priority=a.priority||4;this.index=
Va.call(this,a,c);this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=new Map;this.F=[];this.R=[];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.F[d]=f.custom:(this.F[d]=Ua(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){this.fastupdate=!1;a=[];for(const d of this.index.values())d.then&&
Qa.call(this,v[f],v[f+1],c,u,g);d.push({field:v[f],tag:v[f+1],result:p})}return m.length?Promise.all(m).then(function(A){for(let x=0;x<A.length;x++)d[x].result=A[x];return d}):d}}k&&k.constructor!==Array&&(k=[k])}k||(k=this.field);v=!e&&(this.worker||this.db)&&[];let F;for(let A=0,x,D,G;A<k.length;A++){D=k[A];if(this.db&&this.tag&&!this.D[A])continue;let C;E(D)||(C=D,D=C.field,a=C.query||a,c=C.limit||c,u=C.offset||u,r=C.suggest||r,g=this.store&&(C.enrich||g));if(e)x=e[A];else if(w=C||b,y=this.index.get(D),
l&&(this.db&&(w.tag=l,F=y.db.support_tag_search,w.field=k),F||(w.enrich=!1)),v){v[A]=y.search(a,c,w);w&&g&&(w.enrich=g);continue}else x=y.search(a,c,w),w&&g&&(w.enrich=g);G=x&&(m?x.length:x.result.length);if(l&&G){w=[];y=0;if(this.db&&e){if(!F)for(let H=k.length;H<e.length;H++){let L=e[H];if(L&&L.length)y++,w.push(L);else if(!r)return m?d:new W(d)}}else for(let H=0,L,sb;H<l.length;H+=2){L=this.tag.get(l[H]);if(!L)if(r)continue;else return m?d:new W(d);if(sb=(L=L&&L.get(l[H+1]))&&L.length)y++,w.push(L);
else if(!r)return m?d:new W(d)}if(y){x=Ha(x,w,m);G=x.length;if(!G&&!r)return m?x:new W(x);y--}}if(G)f[n]=D,d.push(x),n++;else if(1===k.length)return m?d:new W(d)}if(v){if(this.db&&l&&l.length&&!F)for(g=0;g<l.length;g+=2){f=this.index.get(l[g]);if(!f)if(r)continue;else return m?d:new W(d);v.push(f.db.tag(l[g+1],c,u,!1))}const A=this;return Promise.all(v).then(function(x){return x.length?A.search(a,c,b,x):x})}if(!n)return m?d:new W(d);if(p&&(!g||!this.store))return d[0];v=[];for(u=0;u<f.length;u++){r=
d[u];g&&r.length&&"undefined"===typeof r[0].doc&&(this.db?v.push(r=this.index.get(this.field[0]).db.enrich(r)):r=V.call(this,r));if(p)return m?r:new W(r);d[u]={field:f[u],result:r}}if(g&&this.db&&v.length){const A=this;return Promise.all(v).then(function(x){for(let D=0;D<x.length;D++)d[D].result=x[D];return h?Ra(d,c):q?Sa(d,a,A.index,A.field,A.D,q):d})}return h?Ra(d,c):q?Sa(d,a,this.index,this.field,this.D,q):d};
function Sa(a,c,b,e,d,f){let g,h,k;for(let n=0,m,q,p,r;n<a.length;n++){let u=a[n].result;m=a[n].field;p=b.get(m);q=p.encoder;k=p.tokenize;r=d[e.indexOf(m)];q!==g&&(g=q,h=g.encode(c));for(let v=0;v<u.length;v++){let w="";var l=ba(u[v].doc,r);let y=g.encode(l);l=l.split(g.split);for(let F=0,A,x;F<y.length;F++){A=y[F];x=l[F];if(!A||!x)continue;let D;for(let G=0,C;G<h.length;G++)if(C=h[G],"strict"===k){if(A===C){w+=(w?" ":"")+f.replace("$1",x);D=!0;break}}else{const H=A.indexOf(C);if(-1<H){w+=(w?" ":
"")+x.substring(0,H)+f.replace("$1",x.substring(H,C.length))+x.substring(H+C.length);D=!0;break}}D||(w+=(w?" ":"")+l[F])}u[v].highlight=w}}return a}function Ra(a,c){const b=[],e=B();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,l,n;h<g.length;h++)if(l=g[h],"object"!==typeof l&&(l={id:l}),k=l.id,n=e[k])n.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}
function Qa(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=V.call(this,a));return a}}function V(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 U(a){if(!this||this.constructor!==U)return new U(a);const c=a.document||a.doc||a;let b,e;this.D=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&Ta(b,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.fastupdate=!!a.fastupdate;this.reg=!this.fastupdate||a.worker||a.db?e?new T(e):new Set:e?new S(e):new Map;this.C=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&(e?new S(e):new Map);this.cache=(b=a.cache||null)&&new X(b);a.cache=!1;this.worker=a.worker;this.priority=a.priority||4;this.index=
Ua.call(this,a,c);this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=new Map;this.F=[];this.R=[];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.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){this.fastupdate=!1;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 h of d.index.entries()){const k=h[0];h[1].then&&d.index.set(k,f[g++])}return d})}}else a.db&&(this.fastupdate=!1,this.mount(a.db))}t=U.prototype;
t.mount=function(a){let c=this.field;if(this.tag)for(let d=0,f;d<this.R.length;d++){f=this.R[d];var b=void 0;this.index.set(f,b=new N({},this.reg));c===this.field&&(c=c.slice(0));c.push(f);b.tag=this.tag.get(f)}b=[];const e={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let d=0,f,g;d<c.length;d++){e.field=g=c[d];f=this.index.get(g);const h=new a.constructor(a.id,e);h.id=a.id;b[d]=h.mount(f);f.document=!0;d?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(b)};
t.commit=async function(a,c){const b=[];for(const e of this.index.values())b.push(e.commit(a,c));await Promise.all(b);this.reg.clear()};t.destroy=function(){const a=[];for(const c of this.index.values())a.push(c.destroy());return Promise.all(a)};
function Va(a,c){const 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=I(g)?Object.assign({},a,g):a;if(this.worker){const h=new P(g);b.set(f,h)}this.worker||b.set(f,new N(g,this.reg));g.custom?this.D[d]=g.custom:(this.D[d]=Ua(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=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.C[d]=f.custom,f.custom.V=g):(this.C[d]=Ua(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 b}function Ua(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]}t.append=function(a,c){return this.add(a,c,!0)};t.update=function(a,c){return this.remove(a).add(a,c)};
function Ua(a,c){const 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=I(g)?Object.assign({},a,g):a;if(this.worker){const h=new P(g);b.set(f,h)}this.worker||b.set(f,new N(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=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.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 b}function Ta(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]}t.append=function(a,c){return this.add(a,c,!0)};t.update=function(a,c){return this.remove(a).add(a,c)};
t.remove=function(a){I(a)&&(a=ba(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};
t.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clear();b.then&&a.push(b)}if(this.tag)for(const c of this.tag.values())c.clear();this.store&&this.store.clear();this.cache&&this.cache.clear();return a.length?Promise.all(a):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(c){return c[0]&&c[0].doc}):this.store.get(a)};t.set=function(a,c){this.store.set(a,c);return this};t.searchCache=Wa;
t.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=xa(this.reg);c=null;break;case 1:d="tag";f=this.tag&&va(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&ta(this.store);c=null;break;default:return}return za.call(this,a,c,d,f,b,e)};
t.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();const e=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(this.worker&&e)return this.index.get(e).import(a);if(c){"string"===typeof c&&(c=JSON.parse(c));if(e)return this.index.get(e).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=ya(c,this.reg);for(let d=0,f;d<this.field.length;d++)f=this.index.get(this.field[d]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){c=[];for(const d of this.index.values())c.push(d.import(a));
return Promise.all(c)}break;case "tag":this.tag=wa(c,this.tag);break;case "doc":this.store=ua(c,this.store)}}};ma(U.prototype);function Wa(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new X);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 X(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}X.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)};
X.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};X.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};X.prototype.clear=function(){this.cache.clear();this.h=""};const Xa={normalize:function(a){return a.toLowerCase()}};const Ya=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 Za=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),$a=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const ab={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 bb=/[\x00-\x7F]+/g;const cb=/[\x00-\x7F]+/g;const db=/[\x00-\x7F]+/g;var eb={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Xa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ya},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ya,matcher:Za,replacer:$a},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ya,replacer:$a.concat([/(?!^)[aeo]/g,""]),matcher:Za},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=ab[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=ab[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(bb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(cb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(db," ")}}};const fb={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};N.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=B(),n=B(),m=this.depth,q=this.resolution;for(let p=0;p<e;p++){let r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(m||!n[r])){var f=this.score?this.score(c,r,p,null,0):gb(q,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let u=0,v;u<d;u++)for(f=d;f>u;f--){g=r.substring(u,f);v=this.rtl?d-1-u:u;var h=this.score?this.score(c,r,p,g,v):gb(q,e,p,d,v);
hb(this,n,g,h,a,b)}break}case "reverse":if(1<d){for(h=d-1;0<h;h--){g=r[this.rtl?d-1-h:h]+g;var k=this.score?this.score(c,r,p,g,h):gb(q,e,p,d,h);hb(this,n,g,k,a,b)}g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=r[this.rtl?d-1-h:h],hb(this,n,g,f,a,b);break}default:if(hb(this,n,r,f,a,b),m&&1<e&&p<e-1)for(d=B(),g=this.U,f=r,h=Math.min(m+1,this.rtl?p+1:e-p),d[f]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const u=this.score?this.score(c,f,p,r,k-1):gb(g+(e/2>g?0:1),e,p,h-1,k-1),v=this.bidirectional&&
r>f;hb(this,l,v?f:r,u,a,b,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else c=""}this.db&&(c||this.commit_task.push({del:a}),this.T&&ib(this));return this};
function hb(a,c,b,e,d,f,g){let h=g?a.ctx:a.map,k;if(!c[b]||g&&!(k=c[b])[g])if(g?(c=k||(c[b]=B()),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=k=[]),h=h[e]||(h[e]=[]),!f||!h.includes(d)){if(h.length===2**31-1){c=new R(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.indexOf(h)]=c);k[e]=h=c}h.push(d);a.fastupdate&&((e=a.reg.get(d))?e.push(h):a.reg.set(d,[h]))}}
function gb(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};N.prototype.search=function(a,c,b){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let e=[],d,f,g,h=0,k,l,n,m,q;b?(a=b.query||a,c=b.limit||c,h=b.offset||0,f=b.context,g=b.suggest,q=(k=!1!==b.resolve)&&b.enrich,n=b.boost,m=b.resolution,l=this.db&&b.tag):k=this.resolve;let p=this.encoder.encode(a);d=p.length;c=c||(k?100:0);if(1===d)return jb.call(this,p[0],"",c,h,k,q,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return jb.call(this,p[0],p[1],c,h,k,q,l);let r=B(),u=0,v;1<d&&f&&(v=p[0],u=1);m||0===m||(m=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,c,h,g,k,q,l),!1!==a))return a;const w=this;return async function(){for(let y,F;u<d;u++){if((F=p[u])&&!r[F]){r[F]=1;y=await kb(w,F,v,0,0,!1,!1);if(y=lb(y,e,g,m)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(m=w.resolution,v="",u=-1,r=B())}return mb(e,m,c,h,g,n,k)}()}for(let w,y;u<d;u++){if((y=p[u])&&!r[y]){r[y]=1;w=kb(this,y,v,0,0,!1,!1);if(w=lb(w,e,g,m)){e=w;break}v&&(g&&w&&e.length||(v=y))}g&&v&&u===d-1&&
!e.length&&(m=this.resolution,v="",u=-1,r=B())}return mb(e,m,c,h,g,n,k)};function mb(a,c,b,e,d,f,g){let h=a.length,k=a;if(1<h)k=Ga(a,c,b,e,d,f,g);else if(1===h)return g?Ja.call(null,a[0],b,e):new W(a[0]);return g?k:new W(k)}function jb(a,c,b,e,d,f,g){a=kb(this,a,c,b,e,d,f,g);return this.db?a.then(function(h){return d?h||[]:new W(h)}):a&&a.length?d?Ja.call(this,a,b,e):new W(a):d?[]:new W}
function lb(a,c,b,e){let d=[];if(a&&a.length){if(a.length<=e){c.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){c.push(d);return}}if(!b)return d}function kb(a,c,b,e,d,f,g,h){let k;b&&(k=a.bidirectional&&c>b)&&(k=b,b=c,c=k);if(a.db)return a.db.get(c,b,e,d,f,g,h);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};N.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 nb(this.map,a),this.depth&&nb(this.ctx,a);c||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&ib(this));this.cache&&this.cache.remove(a);return this};
function nb(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=nb(e[1],c);f?b+=f:a.delete(d)}return b};function N(a,c){if(!this||this.constructor!==N)return new N(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},fb[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?eb[a.encoder]:a.encode||a.encoder||Xa;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;(b=a.keystore||0)&&(this.keystore=b);this.map=b?new S(b):new Map;this.ctx=b?new S(b):new Map;this.reg=c||(this.fastupdate?b?new S(b):new Map:b?new T(b):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new X(b);this.resolve=!1!==a.resolve;if(b=a.db)this.db=this.mount(b);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=N.prototype;
t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};t.commit=function(a,c){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,c)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function ib(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},1))}
t.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(c){return c[0]&&c[0].doc}):this.store.get(a)};t.set=function(a,c){this.store.set(a,c);return this};t.searchCache=Va;
t.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=wa(this.reg);c=null;break;case 1:d="tag";f=this.tag&&ua(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&sa(this.store);c=null;break;default:return}return ya.call(this,a,c,d,f,b,e)};
t.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();const e=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(this.worker&&e)return this.index.get(e).import(a);if(c){"string"===typeof c&&(c=JSON.parse(c));if(e)return this.index.get(e).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=xa(c,this.reg);for(let d=0,f;d<this.field.length;d++)f=this.index.get(this.field[d]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){c=[];for(const d of this.index.values())c.push(d.import(a));
return Promise.all(c)}break;case "tag":this.tag=va(c,this.tag);break;case "doc":this.store=ta(c,this.store)}}};la(U.prototype);function Va(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new X);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 X(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}X.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)};
X.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};X.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};X.prototype.clear=function(){this.cache.clear();this.h=""};const Wa={normalize:!1,numeric:!1,split:/\s+/};const Xa={normalize:!0};const Ya={normalize:!0,dedupe:!0};const Za=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 $a=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),ab=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const bb={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 cb={X:Wa,W:Xa,Y:Ya,LatinBalance:{normalize:!0,dedupe:!0,mapper:Za},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Za,matcher:$a,replacer:ab},LatinExtra:{normalize:!0,dedupe:!0,mapper:Za,replacer:ab.concat([/(?!^)[aeo]/g,""]),matcher:$a},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=bb[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===g||"w"===g||!(g=bb[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},LatinExact:Wa,
LatinDefault:Xa,LatinSimple:Ya};const db={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};N.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=B(),n=B(),m=this.depth,q=this.resolution;for(let p=0;p<e;p++){let r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(m||!n[r])){var f=this.score?this.score(c,r,p,null,0):eb(q,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let u=0,v;u<d;u++)for(f=d;f>u;f--){g=r.substring(u,f);v=this.rtl?d-1-u:u;var h=this.score?this.score(c,r,p,g,v):eb(q,e,p,d,v);
fb(this,n,g,h,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(h=d-1;0<h;h--){g=r[this.rtl?d-1-h:h]+g;var k=this.score?this.score(c,r,p,g,h):eb(q,e,p,d,h);fb(this,n,g,k,a,b)}g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=r[this.rtl?d-1-h:h],fb(this,n,g,f,a,b);break}default:if(fb(this,n,r,f,a,b),m&&1<e&&p<e-1)for(d=B(),g=this.U,f=r,h=Math.min(m+1,this.rtl?p+1:e-p),d[f]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const u=this.score?this.score(c,f,p,r,k-1):eb(g+(e/2>g?0:1),
e,p,h-1,k-1),v=this.bidirectional&&r>f;fb(this,l,v?f:r,u,a,b,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else c=""}this.db&&(c||this.commit_task.push({del:a}),this.T&&gb(this));return this};
function fb(a,c,b,e,d,f,g){let h=g?a.ctx:a.map,k;if(!c[b]||g&&!(k=c[b])[g])if(g?(c=k||(c[b]=B()),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=k=[]),h=h[e]||(h[e]=[]),!f||!h.includes(d)){if(h.length===2**31-1){c=new R(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.indexOf(h)]=c);k[e]=h=c}h.push(d);a.fastupdate&&((e=a.reg.get(d))?e.push(h):a.reg.set(d,[h]))}}
function eb(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};N.prototype.search=function(a,c,b){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let e=[],d,f,g,h=0,k,l,n,m,q;b?(a=b.query||a,c=b.limit||c,h=b.offset||0,f=b.context,g=b.suggest,q=(k=!1!==b.resolve)&&b.enrich,n=b.boost,m=b.resolution,l=this.db&&b.tag):k=this.resolve;let p=this.encoder.encode(a);d=p.length;c=c||(k?100:0);if(1===d)return hb.call(this,p[0],"",c,h,k,q,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return hb.call(this,p[0],p[1],c,h,k,q,l);let r=B(),u=0,v;1<d&&f&&(v=p[0],u=1);m||0===m||(m=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,c,h,g,k,q,l),!1!==a))return a;const w=this;return async function(){for(let y,F;u<d;u++){if((F=p[u])&&!r[F]){r[F]=1;y=await ib(w,F,v,0,0,!1,!1);if(y=jb(y,e,g,m)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(m=w.resolution,v="",u=-1,r=B())}return kb(e,m,c,h,g,n,k)}()}for(let w,y;u<d;u++){if((y=p[u])&&!r[y]){r[y]=1;w=ib(this,y,v,0,0,!1,!1);if(w=jb(w,e,g,m)){e=w;break}v&&(g&&w&&e.length||(v=y))}g&&v&&u===d-1&&
!e.length&&(m=this.resolution,v="",u=-1,r=B())}return kb(e,m,c,h,g,n,k)};function kb(a,c,b,e,d,f,g){let h=a.length,k=a;if(1<h)k=Fa(a,c,b,e,d,f,g);else if(1===h)return g?Ia.call(null,a[0],b,e):new W(a[0]);return g?k:new W(k)}function hb(a,c,b,e,d,f,g){a=ib(this,a,c,b,e,d,f,g);return this.db?a.then(function(h){return d?h||[]:new W(h)}):a&&a.length?d?Ia.call(this,a,b,e):new W(a):d?[]:new W}
function jb(a,c,b,e){let d=[];if(a&&a.length){if(a.length<=e){c.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){c.push(d);return}}if(!b)return d}function ib(a,c,b,e,d,f,g,h){let k;b&&(k=a.bidirectional&&c>b)&&(k=b,b=c,c=k);if(a.db)return a.db.get(c,b,e,d,f,g,h);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};N.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 lb(this.map,a),this.depth&&lb(this.ctx,a);c||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&gb(this));this.cache&&this.cache.remove(a);return this};
function lb(a,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=lb(e[1],c);f?b+=f:a.delete(d)}return b};function N(a,c){if(!this||this.constructor!==N)return new N(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},db[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?cb[a.encoder]:a.encode||a.encoder||Xa;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;
this.score=a.score||null;(b=a.keystore||0)&&(this.keystore=b);this.map=b?new S(b):new Map;this.ctx=b?new S(b):new Map;this.reg=c||(this.fastupdate?b?new S(b):new Map:b?new T(b):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new X(b);this.resolve=!1!==a.resolve;if(b=a.db)this.db=this.mount(b);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=N.prototype;
t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};t.commit=function(a,c){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,c)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function gb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},1))}
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,c){return this.add(a,c,!0)};t.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};t.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 ob(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.entries()){const e=b[0],d=ob(b[1]);d?c+=d:a.delete(e)}return c}t.cleanup=function(){if(!this.fastupdate)return this;ob(this.map);this.depth&&ob(this.ctx);return this};t.searchCache=Wa;
t.export=function(a,c,b=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,c,d,f,b,e)};
t.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(c,this.reg);break;case "map":this.map=ua(c,this.map);break;case "ctx":this.ctx=wa(c,this.ctx)}};
t.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=Aa(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let h=Aa(g[1],f);h="new Map(["+h+"])";h='["'+d+'",'+h+"]";e+=(e?",":"")+h}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};ma(N.prototype);const pb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),qb=["map","ctx","tag","reg","cfg"],Y=B();
function sb(a,c={}){if(!this)return new sb(a,c);"object"===typeof a&&(c=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=c.field?c.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=c.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=sb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
t.open=function(){if(this.db)return this.db;let a=this;navigator.storage&&navigator.storage.persist();Y[a.id]||(Y[a.id]=[]);Y[a.id].push(a.field);const c=pb.open(a.id,1);c.onupgradeneeded=function(){const b=a.db=this.result;for(let e=0,d;e<qb.length;e++){d=qb[e];for(let f=0,g;f<Y[a.id].length;f++)g=Y[a.id][f],b.objectStoreNames.contains(d+("reg"!==d?g?":"+g:"":""))||b.createObjectStore(d+("reg"!==d?g?":"+g:"":""))}};return a.db=Z(c,function(b){a.db=b;a.db.onversionchange=function(){a.close()}})};
t.close=function(){this.db&&this.db.close();this.db=null};t.destroy=function(){const a=pb.deleteDatabase(this.id);return Z(a)};t.clear=function(){const a=[];for(let b=0,e;b<qb.length;b++){e=qb[b];for(let d=0,f;d<Y[this.id].length;d++)f=Y[this.id][d],a.push(e+("reg"!==e?f?":"+f:"":""))}const c=this.db.transaction(a,"readwrite");for(let b=0;b<a.length;b++)c.objectStore(a[b]).clear();return Z(c)};
function mb(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.entries()){const e=b[0],d=mb(b[1]);d?c+=d:a.delete(e)}return c}t.cleanup=function(){if(!this.fastupdate)return this;mb(this.map);this.depth&&mb(this.ctx);return this};t.searchCache=Va;
t.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=wa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=sa(this.map,this.reg.size);break;case 3:d="ctx";f=ua(this.ctx,this.reg.size);break;default:return}return ya.call(this,a,c,d,f,b,e)};
t.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=xa(c,this.reg);break;case "map":this.map=ta(c,this.map);break;case "ctx":this.ctx=va(c,this.ctx)}};
t.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=za(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let h=za(g[1],f);h="new Map(["+h+"])";h='["'+d+'",'+h+"]";e+=(e?",":"")+h}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};la(N.prototype);const nb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),ob=["map","ctx","tag","reg","cfg"],Y=B();
function pb(a,c={}){if(!this)return new pb(a,c);"object"===typeof a&&(c=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=c.field?c.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=c.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(){if(this.db)return this.db;let a=this;navigator.storage&&navigator.storage.persist();Y[a.id]||(Y[a.id]=[]);Y[a.id].push(a.field);const c=nb.open(a.id,1);c.onupgradeneeded=function(){const b=a.db=this.result;for(let e=0,d;e<ob.length;e++){d=ob[e];for(let f=0,g;f<Y[a.id].length;f++)g=Y[a.id][f],b.objectStoreNames.contains(d+("reg"!==d?g?":"+g:"":""))||b.createObjectStore(d+("reg"!==d?g?":"+g:"":""))}};return a.db=Z(c,function(b){a.db=b;a.db.onversionchange=function(){a.close()}})};
t.close=function(){this.db&&this.db.close();this.db=null};t.destroy=function(){const a=nb.deleteDatabase(this.id);return Z(a)};t.clear=function(){const a=[];for(let b=0,e;b<ob.length;b++){e=ob[b];for(let d=0,f;d<Y[this.id].length;d++)f=Y[this.id][d],a.push(e+("reg"!==e?f?":"+f:"":""))}const c=this.db.transaction(a,"readwrite");for(let b=0;b<a.length;b++)c.objectStore(a[b]).clear();return Z(c)};
t.get=function(a,c,b=0,e=0,d=!0,f=!1){a=this.db.transaction((c?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((c?"ctx":"map")+(this.field?":"+this.field:"")).get(c?c+":"+a:a);const g=this;return Z(a).then(function(h){let k=[];if(!h||!h.length)return k;if(d){if(!b&&!e&&1===h.length)return h[0];for(let l=0,n;l<h.length;l++)if((n=h[l])&&n.length){if(e>=n.length){e-=n.length;continue}const m=b?e+Math.min(n.length-e,b):n.length;for(let q=e;q<m;q++)k.push(n[q]);e=0;if(k.length===b)break}return f?
g.enrich(k):k}return h})};t.tag=function(a,c=0,b=0,e=!1){a=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(a);const d=this;return Z(a).then(function(f){if(!f||!f.length||b>=f.length)return[];if(!c&&!b)return f;f=f.slice(b,b+c);return e?d.enrich(f):f})};
t.enrich=function(a){"object"!==typeof a&&(a=[a]);const c=this.db.transaction("reg","readonly").objectStore("reg"),b=[];for(let e=0;e<a.length;e++)b[e]=Z(c.get(a[e]));return Promise.all(b).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).then(function(c){return!!c})};t.search=null;t.info=function(){};
@@ -97,6 +91,6 @@ t.transaction=function(a,c,b){a+="reg"!==a?this.field?":"+this.field:"":"";let e
t.commit=async function(a,c,b){if(c)await this.clear(),a.commit_task=[];else{let e=a.commit_task;a.commit_task=[];for(let d=0,f;d<e.length;d++)if(f=e[d],f.clear){await this.clear();c=!0;break}else e[d]=f.del;c||(b||(e=e.concat(aa(a.reg))),e.length&&await this.remove(e))}a.reg.size&&(await this.transaction("map","readwrite",function(e){for(const d of a.map){const f=d[0],g=d[1];g.length&&(c?e.put(g,f):e.get(f).onsuccess=function(){let h=this.result;var k;if(h&&h.length){const l=Math.max(h.length,g.length);
for(let n=0,m,q;n<l;n++)if((q=g[n])&&q.length){if((m=h[n])&&m.length)for(k=0;k<q.length;k++)m.push(q[k]);else h[n]=q;k=1}}else h=g,k=1;k&&e.put(h,f)})}}),await this.transaction("ctx","readwrite",function(e){for(const d of a.ctx){const f=d[0],g=d[1];for(const h of g){const k=h[0],l=h[1];l.length&&(c?e.put(l,f+":"+k):e.get(f+":"+k).onsuccess=function(){let n=this.result;var m;if(n&&n.length){const q=Math.max(n.length,l.length);for(let p=0,r,u;p<q;p++)if((u=l[p])&&u.length){if((r=n[p])&&r.length)for(m=
0;m<u.length;m++)r.push(u[m]);else n[p]=u;m=1}}else n=l,m=1;m&&e.put(n,f+":"+k)})}}}),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 h=this.result;
h=h&&h.length?h.concat(g):g;e.put(h,f)})}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())};function tb(a,c,b){const e=a.value;let d,f=0;for(let g=0,h;g<e.length;g++){if(h=b?e:e[g]){for(let k=0,l,n;k<c.length;k++)if(n=c[k],l=h.indexOf(n),0<=l)if(d=1,1<h.length)h.splice(l,1);else{e[g]=[];break}f+=h.length}if(b)break}f?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(c){c.openCursor().onsuccess=function(){const b=this.result;b&&tb(b,a)}}),this.transaction("ctx","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&tb(b,a)}}),this.transaction("tag","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&tb(b,a,!0)}}),this.transaction("reg","readwrite",function(c){for(let b=0;b<a.length;b++)c.delete(a[b])})])};
function Z(a,c){return new Promise((b,e)=>{a.onsuccess=a.oncomplete=function(){c&&c(this.result);c=null;b(this.result)};a.onerror=a.onblocked=e;a=null})};const ub={Index:N,Charset:eb,Encoder:J,Document:U,Worker:P,Resolver:W,IndexedDB:sb,Language:{}},vb="undefined"!==typeof self?self:"undefined"!==typeof global?global:self;let wb;(wb=vb.define)&&wb.amd?wb([],function(){return ub}):"object"===typeof vb.exports?vb.exports=ub:vb.FlexSearch=ub;}(this||self));
h=h&&h.length?h.concat(g):g;e.put(h,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,c,b){const e=a.value;let d,f=0;for(let g=0,h;g<e.length;g++){if(h=b?e:e[g]){for(let k=0,l,n;k<c.length;k++)if(n=c[k],l=h.indexOf(n),0<=l)if(d=1,1<h.length)h.splice(l,1);else{e[g]=[];break}f+=h.length}if(b)break}f?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(c){c.openCursor().onsuccess=function(){const b=this.result;b&&qb(b,a)}}),this.transaction("ctx","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&qb(b,a)}}),this.transaction("tag","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&qb(b,a,!0)}}),this.transaction("reg","readwrite",function(c){for(let b=0;b<a.length;b++)c.delete(a[b])})])};
function Z(a,c){return new Promise((b,e)=>{a.onsuccess=a.oncomplete=function(){c&&c(this.result);c=null;b(this.result)};a.onerror=a.onblocked=e;a=null})};const rb={Index:N,Charset:cb,Encoder:J,Document:U,Worker:P,Resolver:W,IndexedDB:pb,Language:{}},tb="undefined"!==typeof self?self:"undefined"!==typeof global?global:self;let ub;(ub=tb.define)&&ub.amd?ub([],function(){return rb}):"object"===typeof tb.exports?tb.exports=rb:tb.FlexSearch=rb;}(this||self));

File diff suppressed because it is too large Load Diff

View File

@@ -1,95 +1,89 @@
/**!
* FlexSearch.js v0.8.142 (Bundle/Module)
* FlexSearch.js v0.8.143 (Bundle/Module)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var t;function z(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 B(){return Object.create(null)}function E(a){return"string"===typeof a}
function I(a){return"object"===typeof a}function aa(a){const c=[];for(const b of a.keys())c.push(b);return c}function ba(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 ca(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 da=[["\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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g;function J(a={}){if(!this||this.constructor!==J)return new J(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}t=J.prototype;
function I(a){return"object"===typeof a}function aa(a){const c=[];for(const b of a.keys())c.push(b);return c}function ba(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 ca(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};const da=/[^\p{L}\p{N}]+/u,ea=/(\d{3})/g,fa=/(\D)(\d{3})/g,ha=/(\d{3})(\D)/g,ia=/[\u0300-\u036f]/g;function J(a={}){if(!this||this.constructor!==J)return new J(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}t=J.prototype;
t.assign=function(a){this.normalize=z(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,e;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";e=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(f){this.split=/\s+/}}else this.split=b,e=!1===b||2>"a1a".split(b).length;
this.numeric=z(a.numeric,e)}else{try{this.split=z(this.split,ea)}catch(d){this.split=/\s+/}this.numeric=z(a.numeric,z(this.numeric,!0))}this.prepare=z(a.prepare,null,this.prepare);this.finalize=z(a.finalize,null,this.finalize);ja||(this.mapper=new Map(da));b=a.filter;this.filter="function"===typeof b?b:z(b&&new Set(b),null,this.filter);this.dedupe=z(a.dedupe,!1,this.dedupe);this.matcher=z((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=z((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
z((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=z(a.replacer,null,this.replacer);this.minlength=z(a.minlength,1,this.minlength);this.maxlength=z(a.maxlength,0,this.maxlength);this.rtl=z(a.rtl,!1,this.rtl);if(this.cache=b=z(a.cache,!0,this.cache))this.H=null,this.S="number"===typeof b?b:2E5,this.B=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.A+=
this.numeric=z(a.numeric,e)}else{try{this.split=z(this.split,da)}catch(d){this.split=/\s+/}this.numeric=z(a.numeric,z(this.numeric,!0))}this.prepare=z(a.prepare,null,this.prepare);this.finalize=z(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:z(b&&new Set(b),null,this.filter);this.dedupe=z(a.dedupe,!1,this.dedupe);this.matcher=z((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=z((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=z((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=z(a.replacer,null,this.replacer);this.minlength=z(a.minlength,1,this.minlength);this.maxlength=z(a.maxlength,0,this.maxlength);this.rtl=z(a.rtl,!1,this.rtl);if(this.cache=b=z(a.cache,!0,this.cache))this.H=null,this.S="number"===typeof b?b:2E5,this.B=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.A+=
(this.A?"|":"")+d;return this};t.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.A+=(this.A?"|":"")+a;this.N=null;this.cache&&K(this);return this};t.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&K(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&&K(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.h+=(this.h?"|":"")+a;this.M=null;this.cache&&K(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&&K(this);return this};
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(K,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 c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=
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(K,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ia?a.normalize("NFKD").replace(ia,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(fa,"$1 $2").replace(ha,"$1 $2").replace(ea,"$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||("function"===typeof this.filter?this.filter(g):!this.filter.has(g))){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&b.push(d);continue}}else this.H=setTimeout(K,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),d=g,g=g.replace(this.N,k=>this.stemmer.get(k)),d!==g&&this.filter&&
g.length>=this.minlength&&("function"===typeof this.filter?!this.filter(g):this.filter.has(g))&&(g=""));if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let k=0,l="",n,m;k<g.length;k++)n=g.charAt(k),n===l&&this.dedupe||((m=this.mapper&&this.mapper.get(n))||""===m?m===l&&this.dedupe||!(l=m)||(d+=m):d+=l=n);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.S&&(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.B.set(a,b),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return b};function K(a){a.H=null;a.B.clear();a.G.clear()};let M,ka;async function la(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":ka=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(ka),delete self.FlexSearch):M=new N(ka);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=ka.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await ka.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ma(a){na.call(a,"add");na.call(a,"append");na.call(a,"search");na.call(a,"update");na.call(a,"remove")}let oa,pa,qa;function ra(){oa=qa=0}
function na(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]);oa?qa||(qa=Date.now()-pa>=this.priority*this.priority*3):(oa=setTimeout(ra,0),pa=Date.now());if(qa){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 O=0;
this.replacer[d+1]);this.cache&&h.length<=this.L&&(this.G.set(h,g),this.G.size>this.S&&(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.B.set(a,b),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return b};function K(a){a.H=null;a.B.clear();a.G.clear()};let M,ja;async function ka(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":ja=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(ja),delete self.FlexSearch):M=new N(ja);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=ja.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await ja.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function la(a){ma.call(a,"add");ma.call(a,"append");ma.call(a,"search");ma.call(a,"update");ma.call(a,"remove")}let na,oa,pa;function qa(){na=pa=0}
function ma(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);na?pa||(pa=Date.now()-oa>=this.priority*this.priority*3):(na=setTimeout(qa,0),oa=Date.now());if(pa){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,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 O=0;
function P(a={}){function c(g){function h(k){k=k.data||k;const l=k.id,n=l&&d.h[l];n&&(n(k.msg),delete d.h[l])}this.worker=g;this.h=B();if(this.worker){e?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){d.h[++O]=function(){k(d);1E9<O&&(O=0)};d.worker.postMessage({id:O,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});this.priority=a.priority||4;return this}}if(!this||this.constructor!==P)return new P(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=sa(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}Q("add");Q("append");Q("search");Q("update");Q("remove");Q("clear");Q("export");Q("import");ma(P.prototype);
"undefined"!==typeof self?self._factory:"undefined"!==typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=ra(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}Q("add");Q("append");Q("search");Q("update");Q("remove");Q("clear");Q("export");Q("import");la(P.prototype);
function Q(a){P.prototype[a]=function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.pop());e=new Promise(function(f){"export"===a&&"function"===typeof b[0]&&(b[0]=null);c.h[++O]=f;c.worker.postMessage({task:a,id:O,args:b})});return d?(e.then(d),this):e}}
function sa(a,c,b){return c?"undefined"!==typeof module?new(require("worker_threads")["Worker"])(__dirname+"/worker/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="+la.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 ta(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 ua(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 va(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],ta(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function wa(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],ua(e[1],d));return c}function xa(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 ya(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function za(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 za.call(l,a,c,b,h?e:null,d,f,g+1)})}return za.call(this,a,c,b,h?e:null,d,f,g+1)}
function Aa(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,h;g<d.length;g++){h=d[g]||[""];let k="";for(let l=0;l<h.length;l++)k+=(k?",":"")+("string"===c?'"'+h[l]+'"':h[l]);k="["+k+"]";f+=(f?",":"")+k}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};function Ba(a,c,b,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],c>=g.length)c-=g.length;else{c=g[e?"splice":"slice"](c,b);const h=c.length;if(h&&(d=d.length?d.concat(c):c,b-=h,e&&(a.length-=h),!b))break;c=0}return d}
function ra(a,c,b){return c?"undefined"!==typeof module?new(require("worker_threads")["Worker"])(__dirname+"/worker/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("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 sa(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 ta(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 ua(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],sa(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function va(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],ta(e[1],d));return c}function wa(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 xa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function ya(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 ya.call(l,a,c,b,h?e:null,d,f,g+1)})}return ya.call(this,a,c,b,h?e:null,d,f,g+1)}
function za(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,h;g<d.length;g++){h=d[g]||[""];let k="";for(let l=0;l<h.length;l++)k+=(k?",":"")+("string"===c?'"'+h[l]+'"':h[l]);k="["+k+"]";f+=(f?",":"")+k}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};function Aa(a,c,b,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],c>=g.length)c-=g.length;else{c=g[e?"splice":"slice"](c,b);const h=c.length;if(h&&(d=d.length?d.concat(c):c,b-=h,e&&(a.length-=h),!b))break;c=0}return d}
function R(a){if(!this||this.constructor!==R)return new R(a);this.index=a?[a]:[];this.length=a?a.length:0;const c=this;return new Proxy([],{get(b,e){if("length"===e)return c.length;if("push"===e)return function(d){c.index[c.index.length-1].push(d);c.length++};if("pop"===e)return function(){if(c.length)return c.length--,c.index[c.index.length-1].pop()};if("indexOf"===e)return function(d){let f=0;for(let g=0,h,k;g<c.index.length;g++){h=c.index[g];k=h.indexOf(d);if(0<=k)return f+k;f+=h.length}return-1};
if("includes"===e)return function(d){for(let f=0;f<c.index.length;f++)if(c.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return Ba(c,d||0,f||c.length,!1)};if("splice"===e)return function(d,f){return Ba(c,d||0,f||c.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(b=c.index[e/2**31|0])&&b[e]},set(b,e,d){b=e/2**31|0;(c.index[b]||(c.index[b]=[]))[e]=d;c.length++;return!0}})}R.prototype.clear=function(){this.index.length=0};
R.prototype.destroy=function(){this.proxy=this.index=null};R.prototype.push=function(){};function S(a=8){if(!this||this.constructor!==S)return new S(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ca,this.A=BigInt(a)):(this.B=Da,this.A=a)}S.prototype.get=function(a){const c=this.index[this.B(a)];return c&&c.get(a)};S.prototype.set=function(a,c){var b=this.B(a);let e=this.index[b];e?(b=e.size,e.set(a,c),(b-=e.size)&&this.size++):(this.index[b]=e=new Map([[a,c]]),this.h.push(e),this.size++)};
function T(a=8){if(!this||this.constructor!==T)return new T(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ca,this.A=BigInt(a)):(this.B=Da,this.A=a)}T.prototype.add=function(a){var c=this.B(a);let b=this.index[c];b?(c=b.size,b.add(a),(c-=b.size)&&this.size++):(this.index[c]=b=new Set([a]),this.h.push(b),this.size++)};t=S.prototype;t.has=T.prototype.has=function(a){const c=this.index[this.B(a)];return c&&c.has(a)};
if("includes"===e)return function(d){for(let f=0;f<c.index.length;f++)if(c.index[f].includes(d))return!0;return!1};if("slice"===e)return function(d,f){return Aa(c,d||0,f||c.length,!1)};if("splice"===e)return function(d,f){return Aa(c,d||0,f||c.length,!0)};if("constructor"===e)return Array;if("symbol"!==typeof e)return(b=c.index[e/2**31|0])&&b[e]},set(b,e,d){b=e/2**31|0;(c.index[b]||(c.index[b]=[]))[e]=d;c.length++;return!0}})}R.prototype.clear=function(){this.index.length=0};
R.prototype.destroy=function(){this.proxy=this.index=null};R.prototype.push=function(){};function S(a=8){if(!this||this.constructor!==S)return new S(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ba,this.A=BigInt(a)):(this.B=Ca,this.A=a)}S.prototype.get=function(a){const c=this.index[this.B(a)];return c&&c.get(a)};S.prototype.set=function(a,c){var b=this.B(a);let e=this.index[b];e?(b=e.size,e.set(a,c),(b-=e.size)&&this.size++):(this.index[b]=e=new Map([[a,c]]),this.h.push(e),this.size++)};
function T(a=8){if(!this||this.constructor!==T)return new T(a);this.index=B();this.h=[];this.size=0;32<a?(this.B=Ba,this.A=BigInt(a)):(this.B=Ca,this.A=a)}T.prototype.add=function(a){var c=this.B(a);let b=this.index[c];b?(c=b.size,b.add(a),(c-=b.size)&&this.size++):(this.index[c]=b=new Set([a]),this.h.push(b),this.size++)};t=S.prototype;t.has=T.prototype.has=function(a){const c=this.index[this.B(a)];return c&&c.has(a)};
t.delete=T.prototype.delete=function(a){const c=this.index[this.B(a)];c&&c.delete(a)&&this.size--};t.clear=T.prototype.clear=function(){this.index=B();this.h=[];this.size=0};t.values=T.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let c of this.h[a].values())yield c};t.keys=T.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let c of this.h[a].keys())yield c};t.entries=T.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let c of this.h[a].entries())yield c};
function Da(a){let c=2**this.A-1;if("number"==typeof a)return a&c;let b=0,e=this.A+1;for(let d=0;d<a.length;d++)b=(b*e^a.charCodeAt(d))&c;return 32===this.A?b+2**31:b}function Ca(a){let c=BigInt(2)**this.A-BigInt(1);var b=typeof a;if("bigint"===b)return a&c;if("number"===b)return BigInt(a)&c;b=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)b=(b*e^BigInt(a.charCodeAt(d)))&c;return b};U.prototype.add=function(a,c,b){I(a)&&(c=a,a=ba(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.D[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]),Ea(c,k,this.J,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let h=B();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
function Ca(a){let c=2**this.A-1;if("number"==typeof a)return a&c;let b=0,e=this.A+1;for(let d=0;d<a.length;d++)b=(b*e^a.charCodeAt(d))&c;return 32===this.A?b+2**31:b}function Ba(a){let c=BigInt(2)**this.A-BigInt(1);var b=typeof a;if("bigint"===b)return a&c;if("number"===b)return BigInt(a)&c;b=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)b=(b*e^BigInt(a.charCodeAt(d)))&c;return b};U.prototype.add=function(a,c,b){I(a)&&(c=a,a=ba(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.D[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]),Da(c,k,this.J,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let h=B();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=ba(c,f)}if(d&&f){E(f)&&(f=[f]);for(let k=0,l,n;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=d.get(l))?n=g:d.set(l,n=[]),!b||!n.includes(a))){if(n.length===2**31-1){g=new R(n);if(this.fastupdate)for(let m of this.reg.values())m.includes(n)&&(m[m.indexOf(n)]=g);d.set(l,n=g)}n.push(a);this.fastupdate&&((g=this.reg.get(a))?g.push(n):this.reg.set(a,[n]))}}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.C){h=B();for(let k=0,l;k<this.C.length;k++){l=
this.C[k];if((b=l.I)&&!b(c))continue;let n;if("function"===typeof l){n=l(c);if(!n)continue;l=[l.V]}else if(E(l)||l.constructor===String){h[l]=c[l];continue}Fa(c,h,l,0,l[0],n)}}this.store.set(a,h||c)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function Fa(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++)Fa(a,c,b,e,d);else c=c[d]||(c[d]=B()),d=b[++e],Fa(a,c,b,e,d)}
function Ea(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++)Ea(a,c,b,e,d,f,g,h);else g=c[++e],Ea(a,c,b,e,d,f,g,h);else d.db&&d.remove(f)};function Ga(a,c,b,e,d,f,g){const h=a.length;let k=[],l,n;l=B();for(let m=0,q,p,r,u;m<c;m++)for(let v=0;v<h;v++)if(r=a[v],m<r.length&&(q=r[m]))for(let w=0;w<q.length;w++){p=q[w];(n=l[p])?l[p]++:(n=0,l[p]=1);u=k[n]||(k[n]=[]);if(!g){let y=m+(v||!d?0:f||0);u=u[y]||(u[y]=[])}u.push(p);if(g&&b&&n===h-1&&u.length-e===b)return u}if(a=k.length)if(d)k=1<k.length?Ha(k,b,e,g,f):(k=k[0]).length>b||e?k.slice(e,b+e):k;else{if(a<h)return[];k=k[a-1];if(b||e)if(g){if(k.length>b||e)k=k.slice(e,b+e)}else{d=[];for(let m=
this.C[k];if((b=l.I)&&!b(c))continue;let n;if("function"===typeof l){n=l(c);if(!n)continue;l=[l.V]}else if(E(l)||l.constructor===String){h[l]=c[l];continue}Ea(c,h,l,0,l[0],n)}}this.store.set(a,h||c)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function Ea(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++)Ea(a,c,b,e,d);else c=c[d]||(c[d]=B()),d=b[++e],Ea(a,c,b,e,d)}
function Da(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++)Da(a,c,b,e,d,f,g,h);else g=c[++e],Da(a,c,b,e,d,f,g,h);else d.db&&d.remove(f)};function Fa(a,c,b,e,d,f,g){const h=a.length;let k=[],l,n;l=B();for(let m=0,q,p,r,u;m<c;m++)for(let v=0;v<h;v++)if(r=a[v],m<r.length&&(q=r[m]))for(let w=0;w<q.length;w++){p=q[w];(n=l[p])?l[p]++:(n=0,l[p]=1);u=k[n]||(k[n]=[]);if(!g){let y=m+(v||!d?0:f||0);u=u[y]||(u[y]=[])}u.push(p);if(g&&b&&n===h-1&&u.length-e===b)return u}if(a=k.length)if(d)k=1<k.length?Ga(k,b,e,g,f):(k=k[0]).length>b||e?k.slice(e,b+e):k;else{if(a<h)return[];k=k[a-1];if(b||e)if(g){if(k.length>b||e)k=k.slice(e,b+e)}else{d=[];for(let m=
0,q;m<k.length;m++)if(q=k[m],q.length>e)e-=q.length;else{if(q.length>b||e)q=q.slice(e,b+e),b-=q.length,e&&(e-=q.length);d.push(q);if(!b)break}k=1<d.length?[].concat.apply([],d):d[0]}}return k}
function Ha(a,c,b,e,d){const f=[],g=B();let h;var k=a.length;let l;if(e)for(d=k-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(k=0;k<l;k++)if(h=e[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else for(let n=k-1,m,q=0;0<=n;n--){m=a[n];for(let p=0;p<m.length;p++)if(l=(e=m[p])&&e.length)for(let r=0;r<l;r++)if(h=e[r],!g[h])if(g[h]=1,b)b--;else{let u=(p+(n<k-1?d||0:0))/(n+1)|0;(f[u]||(f[u]=[])).push(h);if(++q===c)return f}}return f}
function Ia(a,c,b){const e=B(),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 Ja(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?V.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?V.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?V.call(this,d):d};function Ka(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let q;if(m.constructor===W)q=m.result;else if(m.constructor===Array)q=m;else if(f=m.limit||0,g=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,q=m.index.search(m).result,m.resolve=k;else if(m.and)q=a.and(m.and);else if(m.or)q=a.or(m.or);else if(m.xor)q=a.xor(m.xor);
else if(m.not)q=a.not(m.not);else continue;if(q.then)d.push(q);else if(q.length)e[n]=q;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:h,resolve:k,suggest:l}};W.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=Ka(this,"or",arguments);return La.call(this,a,c,b,e,d,f)};function La(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 La.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=Ha(a,b,e,!1,this.h),e=0));return f?this.resolve(b,e,d):this};W.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:n,suggest:m}=Ka(this,"and",arguments);return Ma.call(this,f,g,h,k,l,n,m)}return d?this.resolve(c,b,e):this};
function Ma(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Ma.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=ca(a))return this.result=Ga(a,c,b,e,g,this.h,f),f?d?V.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};W.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ka(this,"xor",arguments);return Na.call(this,a,c,b,e,d,f,g)};
function Na(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Na.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=Oa.call(this,a,b,e,f,this.h),f?d?V.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Oa(a,c,b,e,d){const f=[],g=B();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 q=0,p;q<m.length;q++)p=m[q],g[p]=g[p]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,q;m<a.length;m++)if(q=a[m])if(l=q[k])for(let p=0,r;p<l.length;p++)if(r=l[p],1===g[r])if(b)b--;else if(e){if(f.push(r),f.length===c)return f}else{const u=k+(m?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++n===c)return f}return f};W.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ka(this,"not",arguments);return Pa.call(this,a,c,b,e,d,f,g)};function Pa(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Pa.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Qa.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?V.call(this.index,this.result):this.result:this}
function Qa(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 W(a){if(!this||this.constructor!==W)return new W(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}W.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};
W.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};W.prototype.boost=function(a){this.h+=a;return this};W.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),Ja.call(d,e,a||100,c,b)):e};B();U.prototype.search=function(a,c,b,e){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let d=[];var f=[],g;let h;let k,l;let n=0;var m=!0;let q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;h=b.merge;k=p||b.field||(k=b.index)&&(k.index?null:k);l=this.tag&&b.tag;var r=b.suggest;m=!1!==b.resolve;m||p||!(k=k||this.field)||(E(k)?p=k:(k.constructor===Array&&1===k.length&&(k=k[0]),p=k.field||k.index));q=(g=this.store&&b.enrich&&m)&&b.highlight;c=b.limit||c;var u=b.offset||0;c||(c=100);if(l&&
function Ga(a,c,b,e,d){const f=[],g=B();let h;var k=a.length;let l;if(e)for(d=k-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(k=0;k<l;k++)if(h=e[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else for(let n=k-1,m,q=0;0<=n;n--){m=a[n];for(let p=0;p<m.length;p++)if(l=(e=m[p])&&e.length)for(let r=0;r<l;r++)if(h=e[r],!g[h])if(g[h]=1,b)b--;else{let u=(p+(n<k-1?d||0:0))/(n+1)|0;(f[u]||(f[u]=[])).push(h);if(++q===c)return f}}return f}
function Ha(a,c,b){const e=B(),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 Ia(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?V.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?V.call(this,g):g;d.push(g);c-=h;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?V.call(this,d):d};function Ja(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(n){return a[c].apply(a,n)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,h,k,l;for(let n=0,m;n<b.length;n++)if(m=b[n]){let q;if(m.constructor===W)q=m.result;else if(m.constructor===Array)q=m;else if(f=m.limit||0,g=m.offset||0,l=m.suggest,k=m.resolve,h=m.enrich&&k,m.index)m.resolve=!1,q=m.index.search(m).result,m.resolve=k;else if(m.and)q=a.and(m.and);else if(m.or)q=a.or(m.or);else if(m.xor)q=a.xor(m.xor);
else if(m.not)q=a.not(m.not);else continue;if(q.then)d.push(q);else if(q.length)e[n]=q;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:h,resolve:k,suggest:l}};W.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=Ja(this,"or",arguments);return Ka.call(this,a,c,b,e,d,f)};function Ka(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 Ka.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=Ga(a,b,e,!1,this.h),e=0));return f?this.resolve(b,e,d):this};W.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:n,suggest:m}=Ja(this,"and",arguments);return La.call(this,f,g,h,k,l,n,m)}return d?this.resolve(c,b,e):this};
function La(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return La.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=ca(a))return this.result=Fa(a,c,b,e,g,this.h,f),f?d?V.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};W.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ja(this,"xor",arguments);return Ma.call(this,a,c,b,e,d,f,g)};
function Ma(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Ma.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=Na.call(this,a,b,e,f,this.h),f?d?V.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Na(a,c,b,e,d){const f=[],g=B();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 q=0,p;q<m.length;q++)p=m[q],g[p]=g[p]?2:1}for(let k=0,l,n=0;k<h;k++)for(let m=0,q;m<a.length;m++)if(q=a[m])if(l=q[k])for(let p=0,r;p<l.length;p++)if(r=l[p],1===g[r])if(b)b--;else if(e){if(f.push(r),f.length===c)return f}else{const u=k+(m?d:0);f[u]||(f[u]=[]);f[u].push(r);if(++n===c)return f}return f};W.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ja(this,"not",arguments);return Oa.call(this,a,c,b,e,d,f,g)};function Oa(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,n;l<k.length;l++)(n=k[l]).length&&(a[l]=n);return Oa.call(h,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Pa.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?V.call(this.index,this.result):this.result:this}
function Pa(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 W(a){if(!this||this.constructor!==W)return new W(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}W.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};
W.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};W.prototype.boost=function(a){this.h+=a;return this};W.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),Ia.call(d,e,a||100,c,b)):e};B();U.prototype.search=function(a,c,b,e){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let d=[];var f=[],g;let h;let k,l;let n=0;var m=!0;let q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;h=b.merge;k=p||b.field||(k=b.index)&&(k.index?null:k);l=this.tag&&b.tag;var r=b.suggest;m=!1!==b.resolve;m||p||!(k=k||this.field)||(E(k)?p=k:(k.constructor===Array&&1===k.length&&(k=k[0]),p=k.field||k.index));q=(g=this.store&&b.enrich&&m)&&b.highlight;c=b.limit||c;var u=b.offset||0;c||(c=100);if(l&&
(!this.db||!e)){l.constructor!==Array&&(l=[l]);var v=[];for(let A=0,x;A<l.length;A++)if(x=l[A],x.field&&x.tag){var w=x.tag;if(w.constructor===Array)for(var y=0;y<w.length;y++)v.push(x.field,w[y]);else v.push(x.field,w)}else{w=Object.keys(x);for(let D=0,G,C;D<w.length;D++)if(G=w[D],C=x[G],C.constructor===Array)for(y=0;y<C.length;y++)v.push(G,C[y]);else v.push(G,C)}l=v;if(!a){m=[];if(v.length)for(f=0;f<v.length;f+=2){if(this.db){p=this.index.get(v[f]);if(!p)continue;m.push(p=p.db.tag(v[f+1],c,u,g))}else p=
Ra.call(this,v[f],v[f+1],c,u,g);d.push({field:v[f],tag:v[f+1],result:p})}return m.length?Promise.all(m).then(function(A){for(let x=0;x<A.length;x++)d[x].result=A[x];return d}):d}}k&&k.constructor!==Array&&(k=[k])}k||(k=this.field);v=!e&&(this.worker||this.db)&&[];let F;for(let A=0,x,D,G;A<k.length;A++){D=k[A];if(this.db&&this.tag&&!this.D[A])continue;let C;E(D)||(C=D,D=C.field,a=C.query||a,c=C.limit||c,u=C.offset||u,r=C.suggest||r,g=this.store&&(C.enrich||g));if(e)x=e[A];else if(w=C||b,y=this.index.get(D),
l&&(this.db&&(w.tag=l,F=y.db.support_tag_search,w.field=k),F||(w.enrich=!1)),v){v[A]=y.search(a,c,w);w&&g&&(w.enrich=g);continue}else x=y.search(a,c,w),w&&g&&(w.enrich=g);G=x&&(m?x.length:x.result.length);if(l&&G){w=[];y=0;if(this.db&&e){if(!F)for(let H=k.length;H<e.length;H++){let L=e[H];if(L&&L.length)y++,w.push(L);else if(!r)return m?d:new W(d)}}else for(let H=0,L,ob;H<l.length;H+=2){L=this.tag.get(l[H]);if(!L)if(r)continue;else return m?d:new W(d);if(ob=(L=L&&L.get(l[H+1]))&&L.length)y++,w.push(L);
else if(!r)return m?d:new W(d)}if(y){x=Ia(x,w,m);G=x.length;if(!G&&!r)return m?x:new W(x);y--}}if(G)f[n]=D,d.push(x),n++;else if(1===k.length)return m?d:new W(d)}if(v){if(this.db&&l&&l.length&&!F)for(g=0;g<l.length;g+=2){f=this.index.get(l[g]);if(!f)if(r)continue;else return m?d:new W(d);v.push(f.db.tag(l[g+1],c,u,!1))}const A=this;return Promise.all(v).then(function(x){return x.length?A.search(a,c,b,x):x})}if(!n)return m?d:new W(d);if(p&&(!g||!this.store))return d[0];v=[];for(u=0;u<f.length;u++){r=
d[u];g&&r.length&&"undefined"===typeof r[0].doc&&(this.db?v.push(r=this.index.get(this.field[0]).db.enrich(r)):r=V.call(this,r));if(p)return m?r:new W(r);d[u]={field:f[u],result:r}}if(g&&this.db&&v.length){const A=this;return Promise.all(v).then(function(x){for(let D=0;D<x.length;D++)d[D].result=x[D];return h?Sa(d,c):q?Ta(d,a,A.index,A.field,A.D,q):d})}return h?Sa(d,c):q?Ta(d,a,this.index,this.field,this.D,q):d};
function Ta(a,c,b,e,d,f){let g,h,k;for(let n=0,m,q,p,r;n<a.length;n++){let u=a[n].result;m=a[n].field;p=b.get(m);q=p.encoder;k=p.tokenize;r=d[e.indexOf(m)];q!==g&&(g=q,h=g.encode(c));for(let v=0;v<u.length;v++){let w="";var l=ba(u[v].doc,r);let y=g.encode(l);l=l.split(g.split);for(let F=0,A,x;F<y.length;F++){A=y[F];x=l[F];if(!A||!x)continue;let D;for(let G=0,C;G<h.length;G++)if(C=h[G],"strict"===k){if(A===C){w+=(w?" ":"")+f.replace("$1",x);D=!0;break}}else{const H=A.indexOf(C);if(-1<H){w+=(w?" ":
"")+x.substring(0,H)+f.replace("$1",x.substring(H,C.length))+x.substring(H+C.length);D=!0;break}}D||(w+=(w?" ":"")+l[F])}u[v].highlight=w}}return a}function Sa(a,c){const b=[],e=B();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,l,n;h<g.length;h++)if(l=g[h],"object"!==typeof l&&(l={id:l}),k=l.id,n=e[k])n.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}
function Ra(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=V.call(this,a));return a}}function V(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 U(a){if(!this||this.constructor!==U)return new U(a);const c=a.document||a.doc||a;let b,e;this.D=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&Ua(b,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.fastupdate=!!a.fastupdate;this.reg=!this.fastupdate||a.worker||a.db?e?new T(e):new Set:e?new S(e):new Map;this.C=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&(e?new S(e):new Map);this.cache=(b=a.cache||null)&&new X(b);a.cache=!1;this.worker=a.worker;this.priority=a.priority||4;this.index=
Va.call(this,a,c);this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=new Map;this.F=[];this.R=[];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.F[d]=f.custom:(this.F[d]=Ua(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){this.fastupdate=!1;a=[];for(const d of this.index.values())d.then&&
Qa.call(this,v[f],v[f+1],c,u,g);d.push({field:v[f],tag:v[f+1],result:p})}return m.length?Promise.all(m).then(function(A){for(let x=0;x<A.length;x++)d[x].result=A[x];return d}):d}}k&&k.constructor!==Array&&(k=[k])}k||(k=this.field);v=!e&&(this.worker||this.db)&&[];let F;for(let A=0,x,D,G;A<k.length;A++){D=k[A];if(this.db&&this.tag&&!this.D[A])continue;let C;E(D)||(C=D,D=C.field,a=C.query||a,c=C.limit||c,u=C.offset||u,r=C.suggest||r,g=this.store&&(C.enrich||g));if(e)x=e[A];else if(w=C||b,y=this.index.get(D),
l&&(this.db&&(w.tag=l,F=y.db.support_tag_search,w.field=k),F||(w.enrich=!1)),v){v[A]=y.search(a,c,w);w&&g&&(w.enrich=g);continue}else x=y.search(a,c,w),w&&g&&(w.enrich=g);G=x&&(m?x.length:x.result.length);if(l&&G){w=[];y=0;if(this.db&&e){if(!F)for(let H=k.length;H<e.length;H++){let L=e[H];if(L&&L.length)y++,w.push(L);else if(!r)return m?d:new W(d)}}else for(let H=0,L,pb;H<l.length;H+=2){L=this.tag.get(l[H]);if(!L)if(r)continue;else return m?d:new W(d);if(pb=(L=L&&L.get(l[H+1]))&&L.length)y++,w.push(L);
else if(!r)return m?d:new W(d)}if(y){x=Ha(x,w,m);G=x.length;if(!G&&!r)return m?x:new W(x);y--}}if(G)f[n]=D,d.push(x),n++;else if(1===k.length)return m?d:new W(d)}if(v){if(this.db&&l&&l.length&&!F)for(g=0;g<l.length;g+=2){f=this.index.get(l[g]);if(!f)if(r)continue;else return m?d:new W(d);v.push(f.db.tag(l[g+1],c,u,!1))}const A=this;return Promise.all(v).then(function(x){return x.length?A.search(a,c,b,x):x})}if(!n)return m?d:new W(d);if(p&&(!g||!this.store))return d[0];v=[];for(u=0;u<f.length;u++){r=
d[u];g&&r.length&&"undefined"===typeof r[0].doc&&(this.db?v.push(r=this.index.get(this.field[0]).db.enrich(r)):r=V.call(this,r));if(p)return m?r:new W(r);d[u]={field:f[u],result:r}}if(g&&this.db&&v.length){const A=this;return Promise.all(v).then(function(x){for(let D=0;D<x.length;D++)d[D].result=x[D];return h?Ra(d,c):q?Sa(d,a,A.index,A.field,A.D,q):d})}return h?Ra(d,c):q?Sa(d,a,this.index,this.field,this.D,q):d};
function Sa(a,c,b,e,d,f){let g,h,k;for(let n=0,m,q,p,r;n<a.length;n++){let u=a[n].result;m=a[n].field;p=b.get(m);q=p.encoder;k=p.tokenize;r=d[e.indexOf(m)];q!==g&&(g=q,h=g.encode(c));for(let v=0;v<u.length;v++){let w="";var l=ba(u[v].doc,r);let y=g.encode(l);l=l.split(g.split);for(let F=0,A,x;F<y.length;F++){A=y[F];x=l[F];if(!A||!x)continue;let D;for(let G=0,C;G<h.length;G++)if(C=h[G],"strict"===k){if(A===C){w+=(w?" ":"")+f.replace("$1",x);D=!0;break}}else{const H=A.indexOf(C);if(-1<H){w+=(w?" ":
"")+x.substring(0,H)+f.replace("$1",x.substring(H,C.length))+x.substring(H+C.length);D=!0;break}}D||(w+=(w?" ":"")+l[F])}u[v].highlight=w}}return a}function Ra(a,c){const b=[],e=B();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,l,n;h<g.length;h++)if(l=g[h],"object"!==typeof l&&(l={id:l}),k=l.id,n=e[k])n.push(f.field);else{if(b.length===c)return b;l.field=e[k]=[f.field];b.push(l)}}return b}
function Qa(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=V.call(this,a));return a}}function V(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 U(a){if(!this||this.constructor!==U)return new U(a);const c=a.document||a.doc||a;let b,e;this.D=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&Ta(b,this.J)||"id";(e=a.keystore||0)&&(this.keystore=e);this.fastupdate=!!a.fastupdate;this.reg=!this.fastupdate||a.worker||a.db?e?new T(e):new Set:e?new S(e):new Map;this.C=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&(e?new S(e):new Map);this.cache=(b=a.cache||null)&&new X(b);a.cache=!1;this.worker=a.worker;this.priority=a.priority||4;this.index=
Ua.call(this,a,c);this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=new Map;this.F=[];this.R=[];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.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){this.fastupdate=!1;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 h of d.index.entries()){const k=h[0];h[1].then&&d.index.set(k,f[g++])}return d})}}else a.db&&(this.fastupdate=!1,this.mount(a.db))}t=U.prototype;
t.mount=function(a){let c=this.field;if(this.tag)for(let d=0,f;d<this.R.length;d++){f=this.R[d];var b=void 0;this.index.set(f,b=new N({},this.reg));c===this.field&&(c=c.slice(0));c.push(f);b.tag=this.tag.get(f)}b=[];const e={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let d=0,f,g;d<c.length;d++){e.field=g=c[d];f=this.index.get(g);const h=new a.constructor(a.id,e);h.id=a.id;b[d]=h.mount(f);f.document=!0;d?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(b)};
t.commit=async function(a,c){const b=[];for(const e of this.index.values())b.push(e.commit(a,c));await Promise.all(b);this.reg.clear()};t.destroy=function(){const a=[];for(const c of this.index.values())a.push(c.destroy());return Promise.all(a)};
function Va(a,c){const 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=I(g)?Object.assign({},a,g):a;if(this.worker){const h=new P(g);b.set(f,h)}this.worker||b.set(f,new N(g,this.reg));g.custom?this.D[d]=g.custom:(this.D[d]=Ua(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=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.C[d]=f.custom,f.custom.V=g):(this.C[d]=Ua(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 b}function Ua(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]}t.append=function(a,c){return this.add(a,c,!0)};t.update=function(a,c){return this.remove(a).add(a,c)};
function Ua(a,c){const 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=I(g)?Object.assign({},a,g):a;if(this.worker){const h=new P(g);b.set(f,h)}this.worker||b.set(f,new N(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=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.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 b}function Ta(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]}t.append=function(a,c){return this.add(a,c,!0)};t.update=function(a,c){return this.remove(a).add(a,c)};
t.remove=function(a){I(a)&&(a=ba(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};
t.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clear();b.then&&a.push(b)}if(this.tag)for(const c of this.tag.values())c.clear();this.store&&this.store.clear();this.cache&&this.cache.clear();return a.length?Promise.all(a):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(c){return c[0]&&c[0].doc}):this.store.get(a)};t.set=function(a,c){this.store.set(a,c);return this};t.searchCache=Wa;
t.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=xa(this.reg);c=null;break;case 1:d="tag";f=this.tag&&va(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&ta(this.store);c=null;break;default:return}return za.call(this,a,c,d,f,b,e)};
t.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();const e=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(this.worker&&e)return this.index.get(e).import(a);if(c){"string"===typeof c&&(c=JSON.parse(c));if(e)return this.index.get(e).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=ya(c,this.reg);for(let d=0,f;d<this.field.length;d++)f=this.index.get(this.field[d]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){c=[];for(const d of this.index.values())c.push(d.import(a));
return Promise.all(c)}break;case "tag":this.tag=wa(c,this.tag);break;case "doc":this.store=ua(c,this.store)}}};ma(U.prototype);function Wa(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new X);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 X(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}X.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)};
X.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};X.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};X.prototype.clear=function(){this.cache.clear();this.h=""};const Xa={normalize:function(a){return a.toLowerCase()}};const Ya=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 Za=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),$a=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const ab={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 bb=/[\x00-\x7F]+/g;const cb=/[\x00-\x7F]+/g;const db=/[\x00-\x7F]+/g;var eb={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Xa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ya},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ya,matcher:Za,replacer:$a},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ya,replacer:$a.concat([/(?!^)[aeo]/g,""]),matcher:Za},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=ab[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=ab[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(bb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(cb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(db," ")}}};const fb={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};N.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=B(),n=B(),m=this.depth,q=this.resolution;for(let p=0;p<e;p++){let r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(m||!n[r])){var f=this.score?this.score(c,r,p,null,0):gb(q,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let u=0,v;u<d;u++)for(f=d;f>u;f--){g=r.substring(u,f);v=this.rtl?d-1-u:u;var h=this.score?this.score(c,r,p,g,v):gb(q,e,p,d,v);
hb(this,n,g,h,a,b)}break}case "reverse":if(1<d){for(h=d-1;0<h;h--){g=r[this.rtl?d-1-h:h]+g;var k=this.score?this.score(c,r,p,g,h):gb(q,e,p,d,h);hb(this,n,g,k,a,b)}g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=r[this.rtl?d-1-h:h],hb(this,n,g,f,a,b);break}default:if(hb(this,n,r,f,a,b),m&&1<e&&p<e-1)for(d=B(),g=this.U,f=r,h=Math.min(m+1,this.rtl?p+1:e-p),d[f]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const u=this.score?this.score(c,f,p,r,k-1):gb(g+(e/2>g?0:1),e,p,h-1,k-1),v=this.bidirectional&&
r>f;hb(this,l,v?f:r,u,a,b,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else c=""}this.db&&(c||this.commit_task.push({del:a}),this.T&&ib(this));return this};
function hb(a,c,b,e,d,f,g){let h=g?a.ctx:a.map,k;if(!c[b]||g&&!(k=c[b])[g])if(g?(c=k||(c[b]=B()),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=k=[]),h=h[e]||(h[e]=[]),!f||!h.includes(d)){if(h.length===2**31-1){c=new R(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.indexOf(h)]=c);k[e]=h=c}h.push(d);a.fastupdate&&((e=a.reg.get(d))?e.push(h):a.reg.set(d,[h]))}}
function gb(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};N.prototype.search=function(a,c,b){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let e=[],d,f,g,h=0,k,l,n,m,q;b?(a=b.query||a,c=b.limit||c,h=b.offset||0,f=b.context,g=b.suggest,q=(k=!1!==b.resolve)&&b.enrich,n=b.boost,m=b.resolution,l=this.db&&b.tag):k=this.resolve;let p=this.encoder.encode(a);d=p.length;c=c||(k?100:0);if(1===d)return jb.call(this,p[0],"",c,h,k,q,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return jb.call(this,p[0],p[1],c,h,k,q,l);let r=B(),u=0,v;1<d&&f&&(v=p[0],u=1);m||0===m||(m=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,c,h,g,k,q,l),!1!==a))return a;const w=this;return async function(){for(let y,F;u<d;u++){if((F=p[u])&&!r[F]){r[F]=1;y=await kb(w,F,v,0,0,!1,!1);if(y=lb(y,e,g,m)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(m=w.resolution,v="",u=-1,r=B())}return mb(e,m,c,h,g,n,k)}()}for(let w,y;u<d;u++){if((y=p[u])&&!r[y]){r[y]=1;w=kb(this,y,v,0,0,!1,!1);if(w=lb(w,e,g,m)){e=w;break}v&&(g&&w&&e.length||(v=y))}g&&v&&u===d-1&&
!e.length&&(m=this.resolution,v="",u=-1,r=B())}return mb(e,m,c,h,g,n,k)};function mb(a,c,b,e,d,f,g){let h=a.length,k=a;if(1<h)k=Ga(a,c,b,e,d,f,g);else if(1===h)return g?Ja.call(null,a[0],b,e):new W(a[0]);return g?k:new W(k)}function jb(a,c,b,e,d,f,g){a=kb(this,a,c,b,e,d,f,g);return this.db?a.then(function(h){return d?h||[]:new W(h)}):a&&a.length?d?Ja.call(this,a,b,e):new W(a):d?[]:new W}
function lb(a,c,b,e){let d=[];if(a&&a.length){if(a.length<=e){c.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){c.push(d);return}}if(!b)return d}function kb(a,c,b,e,d,f,g,h){let k;b&&(k=a.bidirectional&&c>b)&&(k=b,b=c,c=k);if(a.db)return a.db.get(c,b,e,d,f,g,h);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};N.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 nb(this.map,a),this.depth&&nb(this.ctx,a);c||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&ib(this));this.cache&&this.cache.remove(a);return this};
function nb(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=nb(e[1],c);f?b+=f:a.delete(d)}return b};function N(a,c){if(!this||this.constructor!==N)return new N(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},fb[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?eb[a.encoder]:a.encode||a.encoder||Xa;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;(b=a.keystore||0)&&(this.keystore=b);this.map=b?new S(b):new Map;this.ctx=b?new S(b):new Map;this.reg=c||(this.fastupdate?b?new S(b):new Map:b?new T(b):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new X(b);this.resolve=!1!==a.resolve;if(b=a.db)this.db=this.mount(b);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=N.prototype;
t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};t.commit=function(a,c){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,c)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function ib(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},1))}
t.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(c){return c[0]&&c[0].doc}):this.store.get(a)};t.set=function(a,c){this.store.set(a,c);return this};t.searchCache=Va;
t.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=wa(this.reg);c=null;break;case 1:d="tag";f=this.tag&&ua(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&sa(this.store);c=null;break;default:return}return ya.call(this,a,c,d,f,b,e)};
t.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();const e=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(this.worker&&e)return this.index.get(e).import(a);if(c){"string"===typeof c&&(c=JSON.parse(c));if(e)return this.index.get(e).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=xa(c,this.reg);for(let d=0,f;d<this.field.length;d++)f=this.index.get(this.field[d]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){c=[];for(const d of this.index.values())c.push(d.import(a));
return Promise.all(c)}break;case "tag":this.tag=va(c,this.tag);break;case "doc":this.store=ta(c,this.store)}}};la(U.prototype);function Va(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new X);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 X(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}X.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)};
X.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};X.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};X.prototype.clear=function(){this.cache.clear();this.h=""};const Wa={normalize:!1,numeric:!1,split:/\s+/};const Xa={normalize:!0};const Ya={normalize:!0,dedupe:!0};const Za=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 $a=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),ab=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const bb={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 cb={X:Wa,W:Xa,Y:Ya,LatinBalance:{normalize:!0,dedupe:!0,mapper:Za},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Za,matcher:$a,replacer:ab},LatinExtra:{normalize:!0,dedupe:!0,mapper:Za,replacer:ab.concat([/(?!^)[aeo]/g,""]),matcher:$a},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=bb[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===g||"w"===g||!(g=bb[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},LatinExact:Wa,
LatinDefault:Xa,LatinSimple:Ya};const db={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};N.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=B(),n=B(),m=this.depth,q=this.resolution;for(let p=0;p<e;p++){let r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(m||!n[r])){var f=this.score?this.score(c,r,p,null,0):eb(q,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let u=0,v;u<d;u++)for(f=d;f>u;f--){g=r.substring(u,f);v=this.rtl?d-1-u:u;var h=this.score?this.score(c,r,p,g,v):eb(q,e,p,d,v);
fb(this,n,g,h,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(h=d-1;0<h;h--){g=r[this.rtl?d-1-h:h]+g;var k=this.score?this.score(c,r,p,g,h):eb(q,e,p,d,h);fb(this,n,g,k,a,b)}g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=r[this.rtl?d-1-h:h],fb(this,n,g,f,a,b);break}default:if(fb(this,n,r,f,a,b),m&&1<e&&p<e-1)for(d=B(),g=this.U,f=r,h=Math.min(m+1,this.rtl?p+1:e-p),d[f]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const u=this.score?this.score(c,f,p,r,k-1):eb(g+(e/2>g?0:1),
e,p,h-1,k-1),v=this.bidirectional&&r>f;fb(this,l,v?f:r,u,a,b,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else c=""}this.db&&(c||this.commit_task.push({del:a}),this.T&&gb(this));return this};
function fb(a,c,b,e,d,f,g){let h=g?a.ctx:a.map,k;if(!c[b]||g&&!(k=c[b])[g])if(g?(c=k||(c[b]=B()),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=k=[]),h=h[e]||(h[e]=[]),!f||!h.includes(d)){if(h.length===2**31-1){c=new R(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.indexOf(h)]=c);k[e]=h=c}h.push(d);a.fastupdate&&((e=a.reg.get(d))?e.push(h):a.reg.set(d,[h]))}}
function eb(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};N.prototype.search=function(a,c,b){b||(!c&&I(a)?(b=a,a=""):I(c)&&(b=c,c=0));let e=[],d,f,g,h=0,k,l,n,m,q;b?(a=b.query||a,c=b.limit||c,h=b.offset||0,f=b.context,g=b.suggest,q=(k=!1!==b.resolve)&&b.enrich,n=b.boost,m=b.resolution,l=this.db&&b.tag):k=this.resolve;let p=this.encoder.encode(a);d=p.length;c=c||(k?100:0);if(1===d)return hb.call(this,p[0],"",c,h,k,q,l);f=this.depth&&!1!==f;if(2===d&&f&&!g)return hb.call(this,p[0],p[1],c,h,k,q,l);let r=B(),u=0,v;1<d&&f&&(v=p[0],u=1);m||0===m||(m=v?this.U:
this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,c,h,g,k,q,l),!1!==a))return a;const w=this;return async function(){for(let y,F;u<d;u++){if((F=p[u])&&!r[F]){r[F]=1;y=await ib(w,F,v,0,0,!1,!1);if(y=jb(y,e,g,m)){e=y;break}v&&(g&&y&&e.length||(v=F))}g&&v&&u===d-1&&!e.length&&(m=w.resolution,v="",u=-1,r=B())}return kb(e,m,c,h,g,n,k)}()}for(let w,y;u<d;u++){if((y=p[u])&&!r[y]){r[y]=1;w=ib(this,y,v,0,0,!1,!1);if(w=jb(w,e,g,m)){e=w;break}v&&(g&&w&&e.length||(v=y))}g&&v&&u===d-1&&
!e.length&&(m=this.resolution,v="",u=-1,r=B())}return kb(e,m,c,h,g,n,k)};function kb(a,c,b,e,d,f,g){let h=a.length,k=a;if(1<h)k=Fa(a,c,b,e,d,f,g);else if(1===h)return g?Ia.call(null,a[0],b,e):new W(a[0]);return g?k:new W(k)}function hb(a,c,b,e,d,f,g){a=ib(this,a,c,b,e,d,f,g);return this.db?a.then(function(h){return d?h||[]:new W(h)}):a&&a.length?d?Ia.call(this,a,b,e):new W(a):d?[]:new W}
function jb(a,c,b,e){let d=[];if(a&&a.length){if(a.length<=e){c.push(a);return}for(let f=0,g;f<e;f++)if(g=a[f])d[f]=g;if(d.length){c.push(d);return}}if(!b)return d}function ib(a,c,b,e,d,f,g,h){let k;b&&(k=a.bidirectional&&c>b)&&(k=b,b=c,c=k);if(a.db)return a.db.get(c,b,e,d,f,g,h);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};N.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 lb(this.map,a),this.depth&&lb(this.ctx,a);c||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&gb(this));this.cache&&this.cache.remove(a);return this};
function lb(a,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=lb(e[1],c);f?b+=f:a.delete(d)}return b};function N(a,c){if(!this||this.constructor!==N)return new N(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},db[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?cb[a.encoder]:a.encode||a.encoder||Xa;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;
this.score=a.score||null;(b=a.keystore||0)&&(this.keystore=b);this.map=b?new S(b):new Map;this.ctx=b?new S(b):new Map;this.reg=c||(this.fastupdate?b?new S(b):new Map:b?new T(b):new Set);this.U=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new X(b);this.resolve=!1!==a.resolve;if(b=a.db)this.db=this.mount(b);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}t=N.prototype;
t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};t.commit=function(a,c){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,c)};t.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function gb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},1))}
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,c){return this.add(a,c,!0)};t.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};t.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 pb(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.entries()){const e=b[0],d=pb(b[1]);d?c+=d:a.delete(e)}return c}t.cleanup=function(){if(!this.fastupdate)return this;pb(this.map);this.depth&&pb(this.ctx);return this};t.searchCache=Wa;
t.export=function(a,c,b=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,c,d,f,b,e)};
t.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(c,this.reg);break;case "map":this.map=ua(c,this.map);break;case "ctx":this.ctx=wa(c,this.ctx)}};
t.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=Aa(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let h=Aa(g[1],f);h="new Map(["+h+"])";h='["'+d+'",'+h+"]";e+=(e?",":"")+h}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};ma(N.prototype);const qb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),rb=["map","ctx","tag","reg","cfg"],Y=B();
function sb(a,c={}){if(!this)return new sb(a,c);"object"===typeof a&&(c=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=c.field?c.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=c.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=sb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
t.open=function(){if(this.db)return this.db;let a=this;navigator.storage&&navigator.storage.persist();Y[a.id]||(Y[a.id]=[]);Y[a.id].push(a.field);const c=qb.open(a.id,1);c.onupgradeneeded=function(){const b=a.db=this.result;for(let e=0,d;e<rb.length;e++){d=rb[e];for(let f=0,g;f<Y[a.id].length;f++)g=Y[a.id][f],b.objectStoreNames.contains(d+("reg"!==d?g?":"+g:"":""))||b.createObjectStore(d+("reg"!==d?g?":"+g:"":""))}};return a.db=Z(c,function(b){a.db=b;a.db.onversionchange=function(){a.close()}})};
t.close=function(){this.db&&this.db.close();this.db=null};t.destroy=function(){const a=qb.deleteDatabase(this.id);return Z(a)};t.clear=function(){const a=[];for(let b=0,e;b<rb.length;b++){e=rb[b];for(let d=0,f;d<Y[this.id].length;d++)f=Y[this.id][d],a.push(e+("reg"!==e?f?":"+f:"":""))}const c=this.db.transaction(a,"readwrite");for(let b=0;b<a.length;b++)c.objectStore(a[b]).clear();return Z(c)};
function mb(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.entries()){const e=b[0],d=mb(b[1]);d?c+=d:a.delete(e)}return c}t.cleanup=function(){if(!this.fastupdate)return this;mb(this.map);this.depth&&mb(this.ctx);return this};t.searchCache=Va;
t.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=wa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=sa(this.map,this.reg.size);break;case 3:d="ctx";f=ua(this.ctx,this.reg.size);break;default:return}return ya.call(this,a,c,d,f,b,e)};
t.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=xa(c,this.reg);break;case "map":this.map=ta(c,this.map);break;case "ctx":this.ctx=va(c,this.ctx)}};
t.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=za(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let h=za(g[1],f);h="new Map(["+h+"])";h='["'+d+'",'+h+"]";e+=(e?",":"")+h}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};la(N.prototype);const nb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),ob=["map","ctx","tag","reg","cfg"],Y=B();
function qb(a,c={}){if(!this)return new qb(a,c);"object"===typeof a&&(c=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=c.field?c.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=c.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=qb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
t.open=function(){if(this.db)return this.db;let a=this;navigator.storage&&navigator.storage.persist();Y[a.id]||(Y[a.id]=[]);Y[a.id].push(a.field);const c=nb.open(a.id,1);c.onupgradeneeded=function(){const b=a.db=this.result;for(let e=0,d;e<ob.length;e++){d=ob[e];for(let f=0,g;f<Y[a.id].length;f++)g=Y[a.id][f],b.objectStoreNames.contains(d+("reg"!==d?g?":"+g:"":""))||b.createObjectStore(d+("reg"!==d?g?":"+g:"":""))}};return a.db=Z(c,function(b){a.db=b;a.db.onversionchange=function(){a.close()}})};
t.close=function(){this.db&&this.db.close();this.db=null};t.destroy=function(){const a=nb.deleteDatabase(this.id);return Z(a)};t.clear=function(){const a=[];for(let b=0,e;b<ob.length;b++){e=ob[b];for(let d=0,f;d<Y[this.id].length;d++)f=Y[this.id][d],a.push(e+("reg"!==e?f?":"+f:"":""))}const c=this.db.transaction(a,"readwrite");for(let b=0;b<a.length;b++)c.objectStore(a[b]).clear();return Z(c)};
t.get=function(a,c,b=0,e=0,d=!0,f=!1){a=this.db.transaction((c?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((c?"ctx":"map")+(this.field?":"+this.field:"")).get(c?c+":"+a:a);const g=this;return Z(a).then(function(h){let k=[];if(!h||!h.length)return k;if(d){if(!b&&!e&&1===h.length)return h[0];for(let l=0,n;l<h.length;l++)if((n=h[l])&&n.length){if(e>=n.length){e-=n.length;continue}const m=b?e+Math.min(n.length-e,b):n.length;for(let q=e;q<m;q++)k.push(n[q]);e=0;if(k.length===b)break}return f?
g.enrich(k):k}return h})};t.tag=function(a,c=0,b=0,e=!1){a=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(a);const d=this;return Z(a).then(function(f){if(!f||!f.length||b>=f.length)return[];if(!c&&!b)return f;f=f.slice(b,b+c);return e?d.enrich(f):f})};
t.enrich=function(a){"object"!==typeof a&&(a=[a]);const c=this.db.transaction("reg","readonly").objectStore("reg"),b=[];for(let e=0;e<a.length;e++)b[e]=Z(c.get(a[e]));return Promise.all(b).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).then(function(c){return!!c})};t.search=null;t.info=function(){};
@@ -97,7 +91,7 @@ t.transaction=function(a,c,b){a+="reg"!==a?this.field?":"+this.field:"":"";let e
t.commit=async function(a,c,b){if(c)await this.clear(),a.commit_task=[];else{let e=a.commit_task;a.commit_task=[];for(let d=0,f;d<e.length;d++)if(f=e[d],f.clear){await this.clear();c=!0;break}else e[d]=f.del;c||(b||(e=e.concat(aa(a.reg))),e.length&&await this.remove(e))}a.reg.size&&(await this.transaction("map","readwrite",function(e){for(const d of a.map){const f=d[0],g=d[1];g.length&&(c?e.put(g,f):e.get(f).onsuccess=function(){let h=this.result;var k;if(h&&h.length){const l=Math.max(h.length,g.length);
for(let n=0,m,q;n<l;n++)if((q=g[n])&&q.length){if((m=h[n])&&m.length)for(k=0;k<q.length;k++)m.push(q[k]);else h[n]=q;k=1}}else h=g,k=1;k&&e.put(h,f)})}}),await this.transaction("ctx","readwrite",function(e){for(const d of a.ctx){const f=d[0],g=d[1];for(const h of g){const k=h[0],l=h[1];l.length&&(c?e.put(l,f+":"+k):e.get(f+":"+k).onsuccess=function(){let n=this.result;var m;if(n&&n.length){const q=Math.max(n.length,l.length);for(let p=0,r,u;p<q;p++)if((u=l[p])&&u.length){if((r=n[p])&&r.length)for(m=
0;m<u.length;m++)r.push(u[m]);else n[p]=u;m=1}}else n=l,m=1;m&&e.put(n,f+":"+k)})}}}),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 h=this.result;
h=h&&h.length?h.concat(g):g;e.put(h,f)})}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())};function tb(a,c,b){const e=a.value;let d,f=0;for(let g=0,h;g<e.length;g++){if(h=b?e:e[g]){for(let k=0,l,n;k<c.length;k++)if(n=c[k],l=h.indexOf(n),0<=l)if(d=1,1<h.length)h.splice(l,1);else{e[g]=[];break}f+=h.length}if(b)break}f?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(c){c.openCursor().onsuccess=function(){const b=this.result;b&&tb(b,a)}}),this.transaction("ctx","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&tb(b,a)}}),this.transaction("tag","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&tb(b,a,!0)}}),this.transaction("reg","readwrite",function(c){for(let b=0;b<a.length;b++)c.delete(a[b])})])};
function Z(a,c){return new Promise((b,e)=>{a.onsuccess=a.oncomplete=function(){c&&c(this.result);c=null;b(this.result)};a.onerror=a.onblocked=e;a=null})};export default {Index:N,Charset:eb,Encoder:J,Document:U,Worker:P,Resolver:W,IndexedDB:sb,Language:{}};
export const Index=N;export const Charset=eb;export const Encoder=J;export const Document=U;export const Worker=P;export const Resolver=W;export const IndexedDB=sb;export const Language={};
h=h&&h.length?h.concat(g):g;e.put(h,f)})}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())};function rb(a,c,b){const e=a.value;let d,f=0;for(let g=0,h;g<e.length;g++){if(h=b?e:e[g]){for(let k=0,l,n;k<c.length;k++)if(n=c[k],l=h.indexOf(n),0<=l)if(d=1,1<h.length)h.splice(l,1);else{e[g]=[];break}f+=h.length}if(b)break}f?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(c){c.openCursor().onsuccess=function(){const b=this.result;b&&rb(b,a)}}),this.transaction("ctx","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&rb(b,a)}}),this.transaction("tag","readwrite",function(c){c.openCursor().onsuccess=function(){const b=this.result;b&&rb(b,a,!0)}}),this.transaction("reg","readwrite",function(c){for(let b=0;b<a.length;b++)c.delete(a[b])})])};
function Z(a,c){return new Promise((b,e)=>{a.onsuccess=a.oncomplete=function(){c&&c(this.result);c=null;b(this.result)};a.onerror=a.onblocked=e;a=null})};export default {Index:N,Charset:cb,Encoder:J,Document:U,Worker:P,Resolver:W,IndexedDB:qb,Language:{}};
export const Index=N;export const Charset=cb;export const Encoder=J;export const Document=U;export const Worker=P;export const Resolver=W;export const IndexedDB=qb;export const Language={};

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.142 (Bundle/Debug)
* FlexSearch.js v0.8.143 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -70,15 +70,7 @@ function aa(a) {
}
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", "u"], ["\u0217", "u"], ["\u0219", "s"], ["\u021b", "t"], ["\u021f", "h"], ["\u0227", "a"], ["\u0229", "e"], ["\u022b", "o"], ["\u022d", "o"], ["\u022f", "o"], ["\u0231", "o"], ["\u0233", "y"], ["\u02b0", "h"], ["\u02b1", "h"], ["\u0266", "h"],
["\u02b2", "j"], ["\u02b3", "r"], ["\u02b4", "\u0279"], ["\u02b5", "\u027b"], ["\u02b6", "\u0281"], ["\u02b7", "w"], ["\u02b8", "y"], ["\u02e0", "\u0263"], ["\u02e1", "l"], ["\u02e2", "s"], ["\u02e3", "x"], ["\u02e4", "\u0295"], ["\u0390", "\u03b9"], ["\u03ac", "\u03b1"], ["\u03ad", "\u03b5"], ["\u03ae", "\u03b7"], ["\u03af", "\u03b9"], ["\u03b0", "\u03c5"], ["\u03ca", "\u03b9"], ["\u03cb", "\u03c5"], ["\u03cc", "\u03bf"], ["\u03cd", "\u03c5"], ["\u03ce", "\u03c9"], ["\u03d0", "\u03b2"], ["\u03d1",
"\u03b8"], ["\u03d2", "\u03a5"], ["\u03d3", "\u03a5"], ["\u03d4", "\u03a5"], ["\u03d5", "\u03c6"], ["\u03d6", "\u03c0"], ["\u03f0", "\u03ba"], ["\u03f1", "\u03c1"], ["\u03f2", "\u03c2"], ["\u03f5", "\u03b5"], ["\u0439", "\u0438"], ["\u0450", "\u0435"], ["\u0451", "\u0435"], ["\u0453", "\u0433"], ["\u0457", "\u0456"], ["\u045c", "\u043a"], ["\u045d", "\u0438"], ["\u045e", "\u0443"], ["\u0477", "\u0475"], ["\u04c2", "\u0436"], ["\u04d1", "\u0430"], ["\u04d3", "\u0430"], ["\u04d7", "\u0435"], ["\u04db",
"\u04d9"], ["\u04dd", "\u0436"], ["\u04df", "\u0437"], ["\u04e3", "\u0438"], ["\u04e5", "\u0438"], ["\u04e7", "\u043e"], ["\u04eb", "\u04e9"], ["\u04ed", "\u044d"], ["\u04ef", "\u0443"], ["\u04f1", "\u0443"], ["\u04f3", "\u0443"], ["\u04f5", "\u0447"]];
const ca = /[^\p{L}\p{N}]+/u, da = /(\d{3})/g, ea = /(\D)(\d{3})/g, fa = /(\d{3})(\D)/g, ha = "".normalize && /[\u0300-\u036f]/g;
;const ba = /[^\p{L}\p{N}]+/u, ca = /(\d{3})/g, da = /(\D)(\d{3})/g, ea = /(\d{3})(\D)/g, fa = /[\u0300-\u036f]/g;
function K(a = {}) {
if (!this || this.constructor !== K) {
return new K(...arguments);
@@ -119,7 +111,7 @@ x.assign = function(a) {
this.numeric = B(a.numeric, e);
} else {
try {
this.split = B(this.split, ca);
this.split = B(this.split, ba);
} catch (d) {
console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
@@ -127,7 +119,6 @@ x.assign = function(a) {
}
this.prepare = B(a.prepare, null, this.prepare);
this.finalize = B(a.finalize, null, this.finalize);
ha || (this.mapper = new Map(ba));
b = a.filter;
this.filter = "function" === typeof b ? b : B(b && new Set(b), null, this.filter);
this.dedupe = B(a.dedupe, !1, this.dedupe);
@@ -215,9 +206,9 @@ x.encode = function(a) {
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.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(ea, "$1 $2").replace(fa, "$1 $2").replace(da, "$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 = [], e = this.split || "" === this.split ? a.split(this.split) : a;
for (let f = 0, g, k; f < e.length; f++) {
@@ -267,7 +258,7 @@ function L(a) {
a.G.clear();
}
;let M, N;
async function ia(a) {
async function ha(a) {
a = a.data;
var c = a.task;
const b = a.id;
@@ -297,16 +288,16 @@ async function ia(a) {
postMessage("search" === c ? {id:b, msg:d} : {id:b});
}
}
;function ja(a) {
;function ia(a) {
P.call(a, "add");
P.call(a, "append");
P.call(a, "search");
P.call(a, "update");
P.call(a, "remove");
}
let ka, la, Q;
function ma() {
ka = Q = 0;
let ja, ka, Q;
function la() {
ja = Q = 0;
}
function P(a) {
this[a + "Async"] = function() {
@@ -314,7 +305,7 @@ function P(a) {
var b = c[c.length - 1];
let e;
"function" === typeof b && (e = b, delete c[c.length - 1]);
ka ? Q || (Q = Date.now() - la >= this.priority * this.priority * 3) : (ka = setTimeout(ma, 0), la = Date.now());
ja ? Q || (Q = Date.now() - ka >= this.priority * this.priority * 3) : (ja = setTimeout(la, 0), ka = Date.now());
if (Q) {
const f = this;
return new Promise(g => {
@@ -360,7 +351,7 @@ function S(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);
const e = "undefined" === typeof window, d = this, f = ma(b, e, a.worker);
return f.then ? f.then(function(g) {
return c.call(d, g);
}) : c.call(this, f);
@@ -373,7 +364,7 @@ T("remove");
T("clear");
T("export");
T("import");
ja(S.prototype);
ia(S.prototype);
function T(a) {
S.prototype[a] = function() {
const c = this, b = [].slice.call(arguments);
@@ -388,11 +379,11 @@ function T(a) {
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("string" === typeof b ? b : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
function ma(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=" + ha.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 oa(a, c = 0) {
;function na(a, c = 0) {
let b = [], e = [];
c && (c = 250000 / c * 5000 | 0);
for (const d of a.entries()) {
@@ -401,30 +392,30 @@ function na(a, c, b) {
e.length && b.push(e);
return b;
}
function pa(a, c) {
function oa(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) {
function pa(a, c = 0) {
let b = [], e = [];
c && (c = 250000 / c * 1000 | 0);
for (const d of a.entries()) {
e.push([d[0], oa(d[1])[0]]), e.length === c && (b.push(e), e = []);
e.push([d[0], na(d[1])[0]]), e.length === c && (b.push(e), e = []);
}
e.length && b.push(e);
return b;
}
function ra(a, c) {
function qa(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));
e = a[b], d = c.get(e[0]), c.set(e[0], oa(e[1], d));
}
return c;
}
function sa(a) {
function ra(a) {
let c = [], b = [];
for (const e of a.keys()) {
b.push(e), 250000 === b.length && (c.push(b), b = []);
@@ -432,7 +423,7 @@ function sa(a) {
b.length && c.push(b);
return c;
}
function ta(a, c) {
function sa(a, c) {
c || (c = new Set());
for (let b = 0; b < a.length; b++) {
c.add(a[b]);
@@ -453,7 +444,7 @@ function U(a, c, b, e, d, f, g = 0) {
}
return U.call(this, a, c, b, k ? e : null, d, f, g + 1);
}
function ua(a, c) {
function ta(a, c) {
let b = "";
for (const e of a.entries()) {
a = e[0];
@@ -487,7 +478,7 @@ function ua(a, c) {
d && e.add(a, d, !1, !0);
} else {
if (d = h.I, !d || d(c)) {
h.constructor === String ? h = ["" + h] : D(h) && (h = [h]), va(c, h, this.J, 0, e, a, h[0], b);
h.constructor === String ? h = ["" + h] : D(h) && (h = [h]), ua(c, h, this.J, 0, e, a, h[0], b);
}
}
}
@@ -538,7 +529,7 @@ function ua(a, c) {
k[l] = c[l];
continue;
}
wa(c, k, l, 0, l[0], m);
va(c, k, l, 0, l[0], m);
}
}
this.store.set(a, k || c);
@@ -546,21 +537,21 @@ function ua(a, c) {
}
return this;
};
function wa(a, c, b, e, d, f) {
function va(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);
va(a, c, b, e, d);
}
} else {
c = c[d] || (c[d] = C()), d = b[++e], wa(a, c, b, e, d);
c = c[d] || (c[d] = C()), d = b[++e], va(a, c, b, e, d);
}
}
}
function va(a, c, b, e, d, f, g, k) {
function ua(a, c, b, e, d, f, g, k) {
if (a = a[g]) {
if (e === c.length - 1) {
if (a.constructor === Array) {
@@ -576,15 +567,15 @@ function va(a, c, b, e, d, f, g, k) {
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
va(a, c, b, e, d, f, g, k);
ua(a, c, b, e, d, f, g, k);
}
} else {
g = c[++e], va(a, c, b, e, d, f, g, k);
g = c[++e], ua(a, c, b, e, d, f, g, k);
}
}
}
}
;function xa(a, c, b, e, d) {
;function wa(a, c, b, e, d) {
const f = a.length;
let g = [], k, h;
k = C();
@@ -601,7 +592,7 @@ function va(a, c, b, e, d, f, g, k) {
}
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;
g = 1 < g.length ? xa(g, b, e) : (g = g[0]).length > b || e ? g.slice(e, b + e) : g;
} else {
if (a < f) {
return [];
@@ -616,7 +607,7 @@ function va(a, c, b, e, d, f, g, k) {
}
return g;
}
function ya(a, c, b) {
function xa(a, c, b) {
const e = [], d = C();
let f;
var g = a.length;
@@ -638,7 +629,7 @@ function ya(a, c, b) {
}
return e;
}
function za(a, c) {
function ya(a, c) {
const b = C(), e = [];
for (let d = 0, f; d < c.length; d++) {
f = c[d];
@@ -651,7 +642,7 @@ function za(a, c) {
}
return e;
}
;function Aa(a, c, b, e) {
;function za(a, c, b, e) {
if (!a.length) {
return a;
}
@@ -682,7 +673,7 @@ function za(a, c) {
d = 1 < d.length ? [].concat.apply([], d) : d[0];
return e ? W.call(this, d) : d;
}
;function Ba(a, c, b) {
;function Aa(a, c, b) {
var e = b[0];
if (e.then) {
return Promise.all(b).then(function(m) {
@@ -729,10 +720,10 @@ function za(a, c) {
return {O:e, P:d, limit:f, offset:g, enrich:k, resolve:h, 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);
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f} = Aa(this, "or", arguments);
return Ba.call(this, a, c, b, e, d, f);
};
function Ca(a, c, b, e, d, f) {
function Ba(a, c, b, e, d, f) {
if (c.length) {
const g = this;
return Promise.all(c).then(function(k) {
@@ -740,10 +731,10 @@ function Ca(a, c, b, e, d, f) {
for (let h = 0, l; h < k.length; h++) {
(l = k[h]).length && (a[h] = l);
}
return Ca.call(g, a, [], b, e, d, f);
return Ba.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));
a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = xa(a, b, e), e = 0));
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.and = function() {
@@ -753,11 +744,40 @@ function Ca(a, c, b, e, d, f) {
f && (a = !!f.suggest, d = f.resolve, c = f.limit, b = f.offset, e = f.enrich && d);
}
if (a) {
const {O:f, P:g, limit:k, offset:h, enrich:l, resolve:m, suggest:n} = Ba(this, "and", arguments);
return Da.call(this, f, g, k, h, l, m, n);
const {O:f, P:g, limit:k, offset:h, enrich:l, resolve:m, suggest:n} = Aa(this, "and", arguments);
return Ca.call(this, f, g, k, h, l, m, n);
}
return d ? this.resolve(c, b, e) : this;
};
function Ca(a, c, b, e, d, f, g) {
if (c.length) {
const k = this;
return Promise.all(c).then(function(h) {
a = [];
for (let l = 0, m; l < h.length; l++) {
(m = h[l]).length && (a[l] = m);
}
return Ca.call(k, 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 = wa(a, c, b, e, g), f ? d ? W.call(this.index, this.result) : this.result : this;
}
this.result = [];
}
} else {
g || (this.result = a);
}
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.xor = function() {
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "xor", arguments);
return Da.call(this, a, c, b, e, d, f, g);
};
function Da(a, c, b, e, d, f, g) {
if (c.length) {
const k = this;
@@ -773,43 +793,14 @@ function Da(a, c, b, e, d, f, g) {
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 = [];
return this.result = Ea.call(this, a, b, e, f, this.h), f ? d ? W.call(this.index, this.result) : this.result : this;
}
} else {
g || (this.result = a);
}
return f ? this.resolve(b, e, d) : this;
}
;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 k = this;
return Promise.all(c).then(function(h) {
a = [];
for (let l = 0, m; l < h.length; l++) {
(m = h[l]).length && (a[l] = m);
}
return Ea.call(k, 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) {
function Ea(a, c, b, e, d) {
const f = [], g = C();
let k = 0;
for (let h = 0, l; h < a.length; h++) {
@@ -855,10 +846,10 @@ function Fa(a, c, b, e, d) {
return f;
}
;X.prototype.not = function() {
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ba(this, "not", arguments);
return Ga.call(this, a, c, b, e, d, f, g);
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "not", arguments);
return Fa.call(this, a, c, b, e, d, f, g);
};
function Ga(a, c, b, e, d, f, g) {
function Fa(a, c, b, e, d, f, g) {
if (c.length) {
const k = this;
return Promise.all(c).then(function(h) {
@@ -866,17 +857,17 @@ function Ga(a, c, b, e, d, f, g) {
for (let l = 0, m; l < h.length; l++) {
(m = h[l]).length && (a[l] = m);
}
return Ga.call(k, a, [], b, e, d, f, g);
return Fa.call(k, a, [], b, e, d, f, g);
});
}
if (a.length && this.result.length) {
this.result = Ha.call(this, a, b, e, f);
this.result = Ga.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) {
function Ga(a, c, b, e) {
const d = [];
a = new Set(a.flat().flat());
for (let f = 0, g, k = 0; f < this.result.length; f++) {
@@ -951,7 +942,7 @@ X.prototype.boost = function(a) {
X.prototype.resolve = function(a, c, b) {
const e = this.result, d = this.index;
this.result = this.index = null;
return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), Aa.call(d, e, a || 100, c, b)) : e;
return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), za.call(d, e, a || 100, c, b)) : e;
};
C();
V.prototype.search = function(a, c, b, e) {
@@ -1013,7 +1004,7 @@ V.prototype.search = function(a, c, b, e) {
f = [];
if (u.length) {
for (p = 0; p < u.length; p += 2) {
q = Ia.call(this, u[p], u[p + 1], c, t, g), d.push({field:u[p], tag:u[p + 1], result:q});
q = Ha.call(this, u[p], u[p + 1], c, t, g), d.push({field:u[p], tag:u[p + 1], result:q});
}
}
return f.length ? Promise.all(f).then(function(y) {
@@ -1047,7 +1038,7 @@ V.prototype.search = function(a, c, b, e) {
if (l && F) {
w = [];
z = 0;
for (let G = 0, H, Za; G < l.length; G += 2) {
for (let G = 0, H, $a; G < l.length; G += 2) {
H = this.tag.get(l[G]);
if (!H) {
if (console.warn("Tag '" + l[G] + ":" + l[G + 1] + "' will be skipped because there is no field '" + l[G] + "'."), k) {
@@ -1056,14 +1047,14 @@ V.prototype.search = function(a, c, b, e) {
return n ? d : new X(d);
}
}
if (Za = (H = H && H.get(l[G + 1])) && H.length) {
if ($a = (H = H && H.get(l[G + 1])) && H.length) {
z++, w.push(H);
} else if (!k) {
return n ? d : new X(d);
}
}
if (z) {
v = za(v, w);
v = ya(v, w);
F = v.length;
if (!F && !k) {
return n ? v : new X(v);
@@ -1098,9 +1089,9 @@ V.prototype.search = function(a, c, b, e) {
}
d[t] = {field:f[t], result:e};
}
return q ? Ja(d, c) : r ? Ka(d, a, this.index, this.field, this.C, r) : d;
return q ? Ia(d, c) : r ? Ja(d, a, this.index, this.field, this.C, r) : d;
};
function Ka(a, c, b, e, d, f) {
function Ja(a, c, b, e, d, f) {
let g, k, h;
for (let m = 0, n, r, p, q; m < a.length; m++) {
let t = a[m].result;
@@ -1145,7 +1136,7 @@ function Ka(a, c, b, e, d, f) {
}
return a;
}
function Ja(a, c) {
function Ia(a, c) {
const b = [], e = C();
for (let d = 0, f, g; d < a.length; d++) {
f = a[d];
@@ -1164,7 +1155,7 @@ function Ja(a, c) {
}
return b;
}
function Ia(a, c, b, e, d) {
function Ha(a, c, b, e, d) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -1196,7 +1187,7 @@ function W(a) {
this.C = [];
this.field = [];
this.J = [];
this.key = (b = c.key || c.id) && La(b, this.J) || "id";
this.key = (b = c.key || c.id) && Ka(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();
@@ -1207,13 +1198,13 @@ function W(a) {
let e = c.index || c.field || c;
D(e) && (e = [e]);
for (let d = 0, f, g; d < e.length; d++) {
f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = 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;
f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = Ka(f, this.J), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].I = g.filter)), this.field[d] = f;
}
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));
f = a[d], g = f.field || f, f.custom ? (this.A[d] = f.custom, f.custom.U = g) : (this.A[d] = Ka(g, this.J), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].I = f.filter));
}
}
this.index = b;
@@ -1229,14 +1220,14 @@ function W(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
f.custom ? this.B[d] = f.custom : (this.B[d] = 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));
f.custom ? this.B[d] = f.custom : (this.B[d] = Ka(g, this.J), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].I = f.filter));
this.T[d] = g;
this.tag.set(g, new Map());
}
}
}
}
function La(a, c) {
function Ka(a, c) {
const b = a.split(":");
let e = 0;
for (let d = 0; d < b.length; d++) {
@@ -1304,7 +1295,7 @@ x.set = function(a, c) {
this.store.set(a, c);
return this;
};
x.searchCache = Ma;
x.searchCache = La;
x.export = function(a, c, b = 0, e = 0) {
if (b < this.field.length) {
const g = this.field[b];
@@ -1320,17 +1311,17 @@ x.export = function(a, c, b = 0, e = 0) {
switch(e) {
case 0:
d = "reg";
f = sa(this.reg);
f = ra(this.reg);
c = null;
break;
case 1:
d = "tag";
f = this.tag && qa(this.tag, this.reg.size);
f = this.tag && pa(this.tag, this.reg.size);
c = null;
break;
case 2:
d = "doc";
f = this.store && oa(this.store);
f = this.store && na(this.store);
c = null;
break;
default:
@@ -1351,21 +1342,21 @@ x.import = function(a, c) {
switch(b) {
case "reg":
this.fastupdate = !1;
this.reg = ta(c, this.reg);
this.reg = sa(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);
this.tag = qa(c, this.tag);
break;
case "doc":
this.store = pa(c, this.store);
this.store = oa(c, this.store);
}
}
};
ja(V.prototype);
function Ma(a, c, b) {
ia(V.prototype);
function La(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new Y());
let e = this.cache.get(a);
@@ -1406,31 +1397,22 @@ Y.prototype.clear = function() {
this.cache.clear();
this.h = "";
};
const Na = {normalize:function(a) {
return a.toLowerCase();
}};
const Oa = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
const Pa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Qa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
const Ra = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
const Sa = /[\x00-\x7F]+/g;
const Ta = /[\x00-\x7F]+/g;
const Ua = /[\x00-\x7F]+/g;
var Va = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:Na, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Oa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Oa, matcher:Pa, replacer:Qa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Oa, replacer:Qa.concat([/(?!^)[aeo]/g, ""]), matcher:Pa}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
const Ma = {normalize:!1, numeric:!1, split:/\s+/};
const Na = {normalize:!0};
const Oa = {normalize:!0, dedupe:!0};
const Pa = 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 Qa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Ra = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
const Sa = {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 Ta = {W:Ma, V:Na, X:Oa, LatinBalance:{normalize:!0, dedupe:!0, mapper:Pa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Pa, matcher:Qa, replacer:Ra}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Pa, replacer:Ra.concat([/(?!^)[aeo]/g, ""]), matcher:Qa}, 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++) {
let e = c.charAt(0), d = Sa[e];
for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = Sa[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
}
a[b] = e;
}
}}, ArabicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(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:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
}}, LatinExact:Ma, LatinDefault:Na, LatinSimple:Oa};
const Ua = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
O.prototype.add = function(a, c, b, e) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
@@ -1443,7 +1425,7 @@ O.prototype.add = function(a, c, b, e) {
let q = c[this.rtl ? e - 1 - p : p];
var d = q.length;
if (d && (n || !m[q])) {
var f = this.score ? this.score(c, q, p, null, 0) : Xa(r, e, p), g = "";
var f = this.score ? this.score(c, q, p, null, 0) : Va(r, e, p), g = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
@@ -1451,17 +1433,18 @@ O.prototype.add = function(a, c, b, e) {
for (f = d; f > t; f--) {
g = q.substring(t, f);
u = this.rtl ? d - 1 - t : t;
var k = this.score ? this.score(c, q, p, g, u) : Xa(r, e, p, d, u);
var k = this.score ? this.score(c, q, p, g, u) : Va(r, e, p, d, u);
Z(this, m, g, k, a, b);
}
}
break;
}
case "bidirectional":
case "reverse":
if (1 < d) {
for (k = d - 1; 0 < k; k--) {
g = q[this.rtl ? d - 1 - k : k] + g;
var h = this.score ? this.score(c, q, p, g, k) : Xa(r, e, p, d, k);
var h = this.score ? this.score(c, q, p, g, k) : Va(r, e, p, d, k);
Z(this, m, g, h, a, b);
}
g = "";
@@ -1478,7 +1461,7 @@ O.prototype.add = function(a, c, b, e) {
for (d = C(), g = this.S, f = q, k = Math.min(n + 1, this.rtl ? p + 1 : e - p), d[f] = 1, h = 1; h < k; h++) {
if ((q = c[this.rtl ? e - 1 - p - h : p + h]) && !d[q]) {
d[q] = 1;
const t = this.score ? this.score(c, f, p, q, h - 1) : Xa(g + (e / 2 > g ? 0 : 1), e, p, k - 1, h - 1), u = this.bidirectional && q > f;
const t = this.score ? this.score(c, f, p, q, h - 1) : Va(g + (e / 2 > g ? 0 : 1), e, p, k - 1, h - 1), u = this.bidirectional && q > f;
Z(this, l, u ? f : q, t, a, b, u ? q : f);
}
}
@@ -1497,7 +1480,7 @@ function Z(a, c, b, e, d, f, g) {
g ? (c = h || (c[b] = C()), c[g] = 1, (h = k.get(g)) ? k = h : k.set(g, k = new Map())) : c[b] = 1, (h = k.get(b)) ? k = h : k.set(b, k = []), k = k[e] || (k[e] = []), f && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
}
}
function Xa(a, c, b, e, d) {
function Va(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) {
@@ -1518,11 +1501,11 @@ function Xa(a, c, b, e, d) {
b = a.length;
c = c || (k ? 100 : 0);
if (1 === b) {
return g = c, (c = Ya(this, a[0], "")) && c.length ? Aa.call(this, c, g, d) : [];
return g = c, (c = Wa(this, a[0], "")) && c.length ? za.call(this, c, g, d) : [];
}
f = this.depth && !1 !== f;
if (2 === b && f && !g) {
return g = c, (c = Ya(this, a[0], a[1])) && c.length ? Aa.call(this, c, g, d) : [];
return g = c, (c = Wa(this, a[0], a[1])) && c.length ? za.call(this, c, g, d) : [];
}
k = C();
let l = 0;
@@ -1534,7 +1517,7 @@ function Xa(a, c, b, e, d) {
for (let q, t; l < b; l++) {
if ((t = a[l]) && !k[t]) {
k[t] = 1;
q = Ya(this, t, m);
q = Wa(this, t, m);
a: {
f = q;
var n = e, r = g, p = h;
@@ -1571,16 +1554,16 @@ function Xa(a, c, b, e, d) {
e = a.length;
m = a;
if (1 < e) {
m = xa(a, h, c, d, g);
m = wa(a, h, c, d, g);
} else if (1 === e) {
g = Aa.call(null, a[0], c, d);
g = za.call(null, a[0], c, d);
break a;
}
g = m;
}
return g;
};
function Ya(a, c, b) {
function Wa(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);
@@ -1601,14 +1584,14 @@ function Ya(a, c, b) {
}
}
} else {
$a(this.map, a), this.depth && $a(this.ctx, a);
Xa(this.map, a), this.depth && Xa(this.ctx, a);
}
c || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function $a(a, c) {
function Xa(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let e = 0, d, f; e < a.length; e++) {
@@ -1623,7 +1606,7 @@ function $a(a, c) {
}
} else {
for (let e of a.entries()) {
const d = e[0], f = $a(e[1], c);
const d = e[0], f = Xa(e[1], c);
f ? b += f : a.delete(d);
}
}
@@ -1635,15 +1618,15 @@ function $a(a, c) {
}
if (a) {
var b = D(a) ? a : a.preset;
b && (Wa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Wa[b], a));
b && (Ua[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Ua[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;
const e = !0 === b ? {depth:1} : b || {}, d = D(a.encoder) ? Ta[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 = (b = a.tokenize) && "default" !== b && b || "strict";
this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict";
this.depth = "strict" === b && e.depth || 0;
this.bidirectional = !1 !== e.bidirectional;
this.fastupdate = !!a.fastupdate;
@@ -1676,7 +1659,7 @@ x.update = function(a, c) {
const b = this, e = this.remove(a);
return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c);
};
function ab(a) {
function Ya(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, e; b < a.length; b++) {
@@ -1684,7 +1667,7 @@ function ab(a) {
}
} else {
for (const b of a.entries()) {
const e = b[0], d = ab(b[1]);
const e = b[0], d = Ya(b[1]);
d ? c += d : a.delete(e);
}
}
@@ -1694,17 +1677,17 @@ x.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
ab(this.map);
this.depth && ab(this.ctx);
Ya(this.map);
this.depth && Ya(this.ctx);
return this;
};
x.searchCache = Ma;
x.searchCache = La;
x.export = function(a, c, b = 0, e = 0) {
let d, f;
switch(e) {
case 0:
d = "reg";
f = sa(this.reg);
f = ra(this.reg);
break;
case 1:
d = "cfg";
@@ -1712,11 +1695,11 @@ x.export = function(a, c, b = 0, e = 0) {
break;
case 2:
d = "map";
f = oa(this.map, this.reg.size);
f = na(this.map, this.reg.size);
break;
case 3:
d = "ctx";
f = qa(this.ctx, this.reg.size);
f = pa(this.ctx, this.reg.size);
break;
default:
return;
@@ -1728,13 +1711,13 @@ x.import = function(a, c) {
switch("string" === typeof c && (c = JSON.parse(c)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), 3 === a.length && a.shift(), a = 1 < a.length ? a[1] : a[0], a) {
case "reg":
this.fastupdate = !1;
this.reg = ta(c, this.reg);
this.reg = sa(c, this.reg);
break;
case "map":
this.map = pa(c, this.map);
this.map = oa(c, this.map);
break;
case "ctx":
this.ctx = ra(c, this.ctx);
this.ctx = qa(c, this.ctx);
}
}
};
@@ -1746,11 +1729,11 @@ x.serialize = function(a = !0) {
f || (f = typeof d), c += (c ? "," : "") + ("string" === f ? '"' + d + '"' : d);
}
c = "index.reg=new Set([" + c + "]);";
b = ua(this.map, f);
b = ta(this.map, f);
b = "index.map=new Map([" + b + "]);";
for (const g of this.ctx.entries()) {
d = g[0];
let k = ua(g[1], f);
let k = ta(g[1], f);
k = "new Map([" + k + "])";
k = '["' + d + '",' + k + "]";
e += (e ? "," : "") + k;
@@ -1759,11 +1742,11 @@ x.serialize = function(a = !0) {
}
return a ? "function inject(index){" + c + b + e + "}" : c + b + e;
};
ja(O.prototype);
ia(O.prototype);
C();
const bb = {Index:O, Charset:Va, Encoder:K, Document:V, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, cb = "undefined" !== typeof self ? self : "undefined" !== typeof global ? global : self;
let db;
(db = cb.define) && db.amd ? db([], function() {
return bb;
}) : "object" === typeof cb.exports ? cb.exports = bb : cb.FlexSearch = bb;
const Za = {Index:O, Charset:Ta, Encoder:K, Document:V, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, ab = "undefined" !== typeof self ? self : "undefined" !== typeof global ? global : self;
let bb;
(bb = ab.define) && bb.amd ? bb([], function() {
return Za;
}) : "object" === typeof ab.exports ? ab.exports = Za : ab.FlexSearch = Za;
}(this||self));

View File

@@ -1,70 +1,64 @@
/**!
* FlexSearch.js v0.8.142 (Bundle)
* FlexSearch.js v0.8.143 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function(self){'use strict';var x;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
function 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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ca=/[^\p{L}\p{N}]+/u,da=/(\d{3})/g,ea=/(\D)(\d{3})/g,fa=/(\d{3})(\D)/g,ha="".normalize&&/[\u0300-\u036f]/g;function K(a={}){if(!this||this.constructor!==K)return new K(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}x=K.prototype;
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};const ba=/[^\p{L}\p{N}]+/u,ca=/(\d{3})/g,da=/(\D)(\d{3})/g,ea=/(\d{3})(\D)/g,fa=/[\u0300-\u036f]/g;function K(a={}){if(!this||this.constructor!==K)return new K(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}x=K.prototype;
x.assign=function(a){this.normalize=B(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,e;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";e=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(f){this.split=/\s+/}}else this.split=b,e=!1===b||2>"a1a".split(b).length;
this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ca)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);ha||(this.mapper=new Map(ba));b=a.filter;this.filter="function"===typeof b?b:B(b&&new Set(b),null,this.filter);this.dedupe=B(a.dedupe,!1,this.dedupe);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);this.rtl=B(a.rtl,!1,this.rtl);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ba)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:B(b&&new Set(b),null,this.filter);this.dedupe=B(a.dedupe,!1,this.dedupe);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=B((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);this.rtl=B(a.rtl,!1,this.rtl);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
(this.D?"|":"")+d;return this};x.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.D+=(this.D?"|":"")+a;this.N=null;this.cache&&L(this);return this};x.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&L(this);return this};
x.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&L(this);return this};x.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.h+=(this.h?"|":"")+a;this.M=null;this.cache&&L(this);return this};
x.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&L(this);return this};
x.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ha?a.normalize("NFKD").replace(ha,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&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=
x.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=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 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=
[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,k;f<e.length;f++)if((g=k=e[f])&&!(g.length<this.minlength))if(c)b.push(g);else if(!this.filter||("function"===typeof this.filter?this.filter(g):!this.filter.has(g))){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);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+")$")),d=g,g=g.replace(this.N,h=>this.stemmer.get(h)),d!==g&&this.filter&&
g.length>=this.minlength&&("function"===typeof this.filter?!this.filter(g):this.filter.has(g))&&(g=""));if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let h=0,l="",m,n;h<g.length;h++)m=g.charAt(h),m===l&&this.dedupe||((n=this.mapper&&this.mapper.get(m))||""===n?n===l&&this.dedupe||!(l=n)||(d+=n):d+=l=m);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.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ka,la,Q;function ma(){ka=Q=0}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);ka?Q||(Q=Date.now()-la>=this.priority*this.priority*3):(ka=setTimeout(ma,0),la=Date.now());if(Q){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let R=0;
this.replacer[d+1]);this.cache&&k.length<=this.L&&(this.G.set(k,g),this.G.size>this.R&&(this.G.clear(),this.L=this.L/1.1|0));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 ha(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ia(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ja,ka,Q;function la(){ja=Q=0}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);ja?Q||(Q=Date.now()-ka>=this.priority*this.priority*3):(ja=setTimeout(la,0),ka=Date.now());if(Q){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let R=0;
function S(a={}){function c(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=C();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++R]=function(){h(d);1E9<R&&(R=0)};d.worker.postMessage({id:R,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});this.priority=a.priority||4;return this}}if(!this||this.constructor!==S)return new S(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)}T("add");T("append");T("search");T("update");T("remove");T("clear");T("export");T("import");ja(S.prototype);
"undefined"!==typeof self?self._factory:"undefined"!==typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=ma(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}T("add");T("append");T("search");T("update");T("remove");T("clear");T("export");T("import");ia(S.prototype);
function T(a){S.prototype[a]=function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.pop());e=new Promise(function(f){"export"===a&&"function"===typeof b[0]&&(b[0]=null);c.h[++R]=f;c.worker.postMessage({task:a,id:R,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("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 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 ma(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="+ha.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 na(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 oa(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 pa(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],na(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function qa(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],oa(e[1],d));return c}function ra(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 sa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function U(a,c,b,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,c,d,f+1);if((h=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return U.call(l,a,c,b,k?e:null,d,f,g+1)})}return U.call(this,a,c,b,k?e:null,d,f,g+1)}
function ua(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,k;g<d.length;g++){k=d[g]||[""];let h="";for(let l=0;l<k.length;l++)h+=(h?",":"")+("string"===c?'"'+k[l]+'"':k[l]);h="["+h+"]";f+=(f?",":"")+h}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};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 k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:D(h)&&(h=[h]),va(c,h,this.J,0,e,a,h[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 k=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
function ta(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,k;g<d.length;g++){k=d[g]||[""];let h="";for(let l=0;l<k.length;l++)h+=(h?",":"")+("string"===c?'"'+k[l]+'"':k[l]);h="["+h+"]";f+=(f?",":"")+h}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};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 k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:D(h)&&(h=[h]),ua(c,h,this.J,0,e,a,h[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let k=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 h=0,l,m;h<f.length;h++)l=f[h],k[l]||(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let k;if(this.A){k=C();for(let h=0,l;h<this.A.length;h++){l=this.A[h];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){k[l]=c[l];continue}wa(c,k,l,0,l[0],m)}}this.store.set(a,k||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,k){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,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)va(a,c,b,e,d,f,g,k);else g=c[++e],va(a,c,b,e,d,f,g,k)};function xa(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,r,p;l<c;l++)for(let q=0;q<f;q++)if(r=a[q],l<r.length&&(m=r[l]))for(let t=0;t<m.length;t++)if(n=m[t],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n),b&&h===f-1&&p.length-e===b)return p;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 k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;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){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};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,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=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,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let r;if(n.constructor===X)r=n.result;else if(n.constructor===Array)r=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,r=n.index.search(n).result,n.resolve=h;else if(n.and)r=a.and(n.and);else if(n.or)r=a.or(n.or);else if(n.xor)r=a.xor(n.xor);
else if(n.not)r=a.not(n.not);else continue;if(r.then)d.push(r);else if(r.length)e[m]=r;else if(!l&&("and"===c||"xor"===c)){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: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(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=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:k,offset:h,enrich:l,resolve:m,suggest:n}=Ba(this,"and",arguments);return Da.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Da.call(k,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 k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ea.call(k,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 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 r=0,p;r<n.length;r++)p=n[r],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,r;n<a.length;n++)if(r=a[n])if(l=r[h])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 t=h+(n?d:0);f[t]||(f[t]=[]);f[t].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 k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ga.call(k,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,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(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===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;let k,h,l;let m=0,n=!0,r;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;var q=b.merge;h=p||b.field||(h=b.index)&&(h.index?null:h);l=this.tag&&b.tag;k=b.suggest;n=!0;r=(g=this.store&&b.enrich&&n)&&b.highlight;c=b.limit||c;var t=b.offset||0;c||(c=100);if(l){l.constructor!==Array&&(l=[l]);var u=[];for(let y=0,v;y<l.length;y++)if(v=l[y],v.field&&v.tag){var w=v.tag;if(w.constructor===
Array)for(var z=0;z<w.length;z++)u.push(v.field,w[z]);else u.push(v.field,w)}else{w=Object.keys(v);for(let E=0,F,A;E<w.length;E++)if(F=w[E],A=v[F],A.constructor===Array)for(z=0;z<A.length;z++)u.push(F,A[z]);else u.push(F,A)}l=u;if(!a){f=[];if(u.length)for(p=0;p<u.length;p+=2)q=Ia.call(this,u[p],u[p+1],c,t,g),d.push({field:u[p],tag:u[p+1],result:q});return f.length?Promise.all(f).then(function(y){for(let v=0;v<y.length;v++)d[v].result=y[v];return d}):d}}h&&h.constructor!==Array&&(h=[h])}h||(h=this.field);
u=!e&&(this.worker||this.db)&&[];for(let y=0,v,E,F;y<h.length;y++){E=h[y];let A;D(E)||(A=E,E=A.field,a=A.query||a,c=A.limit||c,t=A.offset||t,k=A.suggest||k,g=this.store&&(A.enrich||g));if(e)v=e[y];else if(w=A||b,z=this.index.get(E),l&&(w.enrich=!1),u){u[y]=z.search(a,c,w);w&&g&&(w.enrich=g);continue}else v=z.search(a,c,w),w&&g&&(w.enrich=g);F=v&&(n?v.length:v.result.length);if(l&&F){w=[];z=0;for(let J=0,G,Ya;J<l.length;J+=2){G=this.tag.get(l[J]);if(!G)if(k)continue;else return n?d:new X(d);if(Ya=
(G=G&&G.get(l[J+1]))&&G.length)z++,w.push(G);else if(!k)return n?d:new X(d)}if(z){v=za(v,w);F=v.length;if(!F&&!k)return n?v:new X(v);z--}}if(F)f[m]=E,d.push(v),m++;else if(1===h.length)return n?d:new X(d)}if(u){const y=this;return Promise.all(u).then(function(v){return v.length?y.search(a,c,b,v):v})}if(!m)return n?d:new X(d);if(p&&(!g||!this.store))return d[0];u=[];for(t=0;t<f.length;t++){e=d[t];g&&e.length&&"undefined"===typeof e[0].doc&&(e=W.call(this,e));if(p)return n?e:new X(e);d[t]={field:f[t],
result:e}}return q?Ja(d,c):r?Ka(d,a,this.index,this.field,this.C,r):d};
function Ka(a,c,b,e,d,f){let g,k,h;for(let m=0,n,r,p,q;m<a.length;m++){let t=a[m].result;n=a[m].field;p=b.get(n);r=p.encoder;h=p.tokenize;q=d[e.indexOf(n)];r!==g&&(g=r,k=g.encode(c));for(let u=0;u<t.length;u++){let w="";var l=I(t[u].doc,q);let z=g.encode(l);l=l.split(g.split);for(let y=0,v,E;y<z.length;y++){v=z[y];E=l[y];if(!v||!E)continue;let F;for(let A=0,J;A<k.length;A++)if(J=k[A],"strict"===h){if(v===J){w+=(w?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=v.indexOf(J);if(-1<G){w+=(w?" ":"")+
E.substring(0,G)+f.replace("$1",E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(w+=(w?" ":"")+l[y])}t[u].highlight=w}}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 k=0,h,l,m;k<g.length;k++)if(l=g[k],"object"!==typeof l&&(l={id:l}),h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[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;this.priority=a.priority||4;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]}x=V.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
String){k[l]=c[l];continue}va(c,k,l,0,l[0],m)}}this.store.set(a,k||c)}}return this};function va(a,c,b,e,d,f){a=a[d];if(e===b.length-1)c[d]=f||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)va(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],va(a,c,b,e,d)}
function ua(a,c,b,e,d,f,g,k){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,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)ua(a,c,b,e,d,f,g,k);else g=c[++e],ua(a,c,b,e,d,f,g,k)};function wa(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,r,p;l<c;l++)for(let q=0;q<f;q++)if(r=a[q],l<r.length&&(m=r[l]))for(let t=0;t<m.length;t++)if(n=m[t],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n),b&&h===f-1&&p.length-e===b)return p;if(a=g.length)if(d)g=1<g.length?xa(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;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 xa(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;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 ya(a,c){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};function za(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,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Aa(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,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let r;if(n.constructor===X)r=n.result;else if(n.constructor===Array)r=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,r=n.index.search(n).result,n.resolve=h;else if(n.and)r=a.and(n.and);else if(n.or)r=a.or(n.or);else if(n.xor)r=a.xor(n.xor);
else if(n.not)r=a.not(n.not);else continue;if(r.then)d.push(r);else if(r.length)e[m]=r;else if(!l&&("and"===c||"xor"===c)){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:c,limit:b,offset:e,enrich:d,resolve:f}=Aa(this,"or",arguments);return Ba.call(this,a,c,b,e,d,f)};function Ba(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ba.call(g,a,[],b,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=xa(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=Aa(this,"and",arguments);return Ca.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function Ca(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ca.call(k,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=wa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Aa(this,"xor",arguments);return Da.call(this,a,c,b,e,d,f,g)};
function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Da.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=Ea.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Ea(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;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 r=0,p;r<n.length;r++)p=n[r],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,r;n<a.length;n++)if(r=a[n])if(l=r[h])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 t=h+(n?d:0);f[t]||(f[t]=[]);f[t].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}=Aa(this,"not",arguments);return Fa.call(this,a,c,b,e,d,f,g)};function Fa(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Fa.call(k,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ga.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Ga(a,c,b,e){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(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===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),za.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;let k,h,l;let m=0,n=!0,r;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;var q=b.merge;h=p||b.field||(h=b.index)&&(h.index?null:h);l=this.tag&&b.tag;k=b.suggest;n=!0;r=(g=this.store&&b.enrich&&n)&&b.highlight;c=b.limit||c;var t=b.offset||0;c||(c=100);if(l){l.constructor!==Array&&(l=[l]);var u=[];for(let y=0,v;y<l.length;y++)if(v=l[y],v.field&&v.tag){var w=v.tag;if(w.constructor===
Array)for(var z=0;z<w.length;z++)u.push(v.field,w[z]);else u.push(v.field,w)}else{w=Object.keys(v);for(let E=0,F,A;E<w.length;E++)if(F=w[E],A=v[F],A.constructor===Array)for(z=0;z<A.length;z++)u.push(F,A[z]);else u.push(F,A)}l=u;if(!a){f=[];if(u.length)for(p=0;p<u.length;p+=2)q=Ha.call(this,u[p],u[p+1],c,t,g),d.push({field:u[p],tag:u[p+1],result:q});return f.length?Promise.all(f).then(function(y){for(let v=0;v<y.length;v++)d[v].result=y[v];return d}):d}}h&&h.constructor!==Array&&(h=[h])}h||(h=this.field);
u=!e&&(this.worker||this.db)&&[];for(let y=0,v,E,F;y<h.length;y++){E=h[y];let A;D(E)||(A=E,E=A.field,a=A.query||a,c=A.limit||c,t=A.offset||t,k=A.suggest||k,g=this.store&&(A.enrich||g));if(e)v=e[y];else if(w=A||b,z=this.index.get(E),l&&(w.enrich=!1),u){u[y]=z.search(a,c,w);w&&g&&(w.enrich=g);continue}else v=z.search(a,c,w),w&&g&&(w.enrich=g);F=v&&(n?v.length:v.result.length);if(l&&F){w=[];z=0;for(let J=0,G,Za;J<l.length;J+=2){G=this.tag.get(l[J]);if(!G)if(k)continue;else return n?d:new X(d);if(Za=
(G=G&&G.get(l[J+1]))&&G.length)z++,w.push(G);else if(!k)return n?d:new X(d)}if(z){v=ya(v,w);F=v.length;if(!F&&!k)return n?v:new X(v);z--}}if(F)f[m]=E,d.push(v),m++;else if(1===h.length)return n?d:new X(d)}if(u){const y=this;return Promise.all(u).then(function(v){return v.length?y.search(a,c,b,v):v})}if(!m)return n?d:new X(d);if(p&&(!g||!this.store))return d[0];u=[];for(t=0;t<f.length;t++){e=d[t];g&&e.length&&"undefined"===typeof e[0].doc&&(e=W.call(this,e));if(p)return n?e:new X(e);d[t]={field:f[t],
result:e}}return q?Ia(d,c):r?Ja(d,a,this.index,this.field,this.C,r):d};
function Ja(a,c,b,e,d,f){let g,k,h;for(let m=0,n,r,p,q;m<a.length;m++){let t=a[m].result;n=a[m].field;p=b.get(n);r=p.encoder;h=p.tokenize;q=d[e.indexOf(n)];r!==g&&(g=r,k=g.encode(c));for(let u=0;u<t.length;u++){let w="";var l=I(t[u].doc,q);let z=g.encode(l);l=l.split(g.split);for(let y=0,v,E;y<z.length;y++){v=z[y];E=l[y];if(!v||!E)continue;let F;for(let A=0,J;A<k.length;A++)if(J=k[A],"strict"===h){if(v===J){w+=(w?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=v.indexOf(J);if(-1<G){w+=(w?" ":"")+
E.substring(0,G)+f.replace("$1",E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(w+=(w?" ":"")+l[y])}t[u].highlight=w}}return a}function Ia(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let k=0,h,l,m;k<g.length;k++)if(l=g[k],"object"!==typeof l&&(l={id:l}),h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[f.field];b.push(l)}}return b}
function Ha(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)&&Ka(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;this.priority=a.priority||4;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]=Ka(f,this.J),g.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=g.filter)),this.field[d]=f;if(this.A){a=c.store;D(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?(this.A[d]=f.custom,f.custom.U=g):(this.A[d]=Ka(g,this.J),f.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].I=f.filter))}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]=Ka(g,this.J),f.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].I=f.filter));this.T[d]=g;this.tag.set(g,new Map)}}}
function Ka(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]}x=V.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
x.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};
x.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clear();b.then&&a.push(b)}if(this.tag)for(const c of this.tag.values())c.clear();this.store&&this.store.clear();this.cache&&this.cache.clear();return a.length?Promise.all(a):this};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=Ma;
x.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.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=this.tag&&qa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&oa(this.store);c=null;break;default:return}return U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){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"],["ph","f"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Ra={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;const Ua=/[\x00-\x7F]+/g;var Va={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Na,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Oa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Oa,matcher:Pa,replacer:Qa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Oa,replacer:Qa.concat([/(?!^)[aeo]/g,""]),matcher:Pa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;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:{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:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,r=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(r,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let t=0,u;t<d;t++)for(f=d;f>t;f--){g=q.substring(t,f);u=this.rtl?d-1-t:t;var k=this.score?this.score(c,q,p,g,u):Xa(r,e,p,d,u);
Z(this,m,g,k,a,b)}break}case "reverse":if(1<d){for(k=d-1;0<k;k--){g=q[this.rtl?d-1-k:k]+g;var h=this.score?this.score(c,q,p,g,k):Xa(r,e,p,d,k);Z(this,m,g,h,a,b)}g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[this.rtl?d-1-k:k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,this.rtl?p+1:e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const t=this.score?this.score(c,f,p,q,h-1):Xa(g+(e/2>g?0:1),e,p,k-1,h-1),u=this.bidirectional&&
q>f;Z(this,l,u?f:q,t,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Xa(a,c,b,e,d){return b&&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 k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Za(this,a[0],""))&&c.length?Aa.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Za(this,a[0],a[1]))&&c.length?Aa.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,t;l<b;l++){if((t=a[l])&&!k[t]){k[t]=1;q=Za(this,t,m);a:{f=q;var n=e,r=g,p=h;let u=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let w=0,z;w<p;w++)if(z=f[w])u[w]=z;if(u.length){n.push(u);q=void 0;break a}}q=r?void 0:u}if(q){e=q;break}m&&(g&&q&&e.length||(m=t))}g&&m&&l===b-1&&!e.length&&(h=this.resolution,m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=xa(a,h,c,d,g);else if(1===e){g=Aa.call(null,a[0],c,d);break a}g=m}return g};
function Za(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);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 $a(this.map,a),this.depth&&$a(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function $a(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;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=$a(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=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;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}x=O.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};
x.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function ab(a){let c=0;if(a.constructor===Array)for(let b=0,e;b<a.length;b++)(e=a[b])&&(c+=e.length);else for(const b of a.entries()){const e=b[0],d=ab(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;ab(this.map);this.depth&&ab(this.ctx);return this};x.searchCache=Ma;
x.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 U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);break;case "map":this.map=pa(c,this.map);break;case "ctx":this.ctx=ra(c,this.ctx)}};
x.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=ua(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let k=ua(g[1],f);k="new Map(["+k+"])";k='["'+d+'",'+k+"]";e+=(e?",":"")+k}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};ja(O.prototype);C();const bb={Index:O,Charset:Va,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}},cb="undefined"!==typeof self?self:"undefined"!==typeof global?global:self;let db;(db=cb.define)&&db.amd?db([],function(){return bb}):"object"===typeof cb.exports?cb.exports=bb:cb.FlexSearch=bb;}(this||self));
x.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clear();b.then&&a.push(b)}if(this.tag)for(const c of this.tag.values())c.clear();this.store&&this.store.clear();this.cache&&this.cache.clear();return a.length?Promise.all(a):this};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=La;
x.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=ra(this.reg);c=null;break;case 1:d="tag";f=this.tag&&pa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&na(this.store);c=null;break;default:return}return U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=sa(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=qa(c,this.tag);break;case "doc":this.store=oa(c,this.store)}}};ia(V.prototype);function La(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 Ma={normalize:!1,numeric:!1,split:/\s+/};const Na={normalize:!0};const Oa={normalize:!0,dedupe:!0};const Pa=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 Qa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Ra=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Sa={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 Ta={W:Ma,V:Na,X:Oa,LatinBalance:{normalize:!0,dedupe:!0,mapper:Pa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Pa,matcher:Qa,replacer:Ra},LatinExtra:{normalize:!0,dedupe:!0,mapper:Pa,replacer:Ra.concat([/(?!^)[aeo]/g,""]),matcher:Qa},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=Sa[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===g||"w"===g||!(g=Sa[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},LatinExact:Ma,
LatinDefault:Na,LatinSimple:Oa};const Ua={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,r=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):Va(r,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let t=0,u;t<d;t++)for(f=d;f>t;f--){g=q.substring(t,f);u=this.rtl?d-1-t:t;var k=this.score?this.score(c,q,p,g,u):Va(r,e,p,d,u);
Z(this,m,g,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){g=q[this.rtl?d-1-k:k]+g;var h=this.score?this.score(c,q,p,g,k):Va(r,e,p,d,k);Z(this,m,g,h,a,b)}g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[this.rtl?d-1-k:k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,this.rtl?p+1:e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const t=this.score?this.score(c,f,p,q,h-1):Va(g+(e/2>g?0:1),e,p,
k-1,h-1),u=this.bidirectional&&q>f;Z(this,l,u?f:q,t,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Va(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 k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Wa(this,a[0],""))&&c.length?za.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Wa(this,a[0],a[1]))&&c.length?za.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,t;l<b;l++){if((t=a[l])&&!k[t]){k[t]=1;q=Wa(this,t,m);a:{f=q;var n=e,r=g,p=h;let u=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let w=0,z;w<p;w++)if(z=f[w])u[w]=z;if(u.length){n.push(u);q=void 0;break a}}q=r?void 0:u}if(q){e=q;break}m&&(g&&q&&e.length||(m=t))}g&&m&&l===b-1&&!e.length&&(h=this.resolution,m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=wa(a,h,c,d,g);else if(1===e){g=za.call(null,a[0],c,d);break a}g=m}return g};
function Wa(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 Xa(this.map,a),this.depth&&Xa(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Xa(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=Xa(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({},Ua[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=D(a.encoder)?Ta[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=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"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}x=O.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};
x.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function Ya(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.entries()){const e=b[0],d=Ya(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;Ya(this.map);this.depth&&Ya(this.ctx);return this};x.searchCache=La;
x.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=ra(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=na(this.map,this.reg.size);break;case 3:d="ctx";f=pa(this.ctx,this.reg.size);break;default:return}return U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=sa(c,this.reg);break;case "map":this.map=oa(c,this.map);break;case "ctx":this.ctx=qa(c,this.ctx)}};
x.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=ta(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let k=ta(g[1],f);k="new Map(["+k+"])";k='["'+d+'",'+k+"]";e+=(e?",":"")+k}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};ia(O.prototype);C();const $a={Index:O,Charset:Ta,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}},ab="undefined"!==typeof self?self:"undefined"!==typeof global?global:self;let bb;(bb=ab.define)&&bb.amd?bb([],function(){return $a}):"object"===typeof ab.exports?ab.exports=$a:ab.FlexSearch=$a;}(this||self));

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.142 (Bundle/Debug)
* FlexSearch.js v0.8.143 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -69,15 +69,7 @@ function aa(a) {
}
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", "u"], ["\u0217", "u"], ["\u0219", "s"], ["\u021b", "t"], ["\u021f", "h"], ["\u0227", "a"], ["\u0229", "e"], ["\u022b", "o"], ["\u022d", "o"], ["\u022f", "o"], ["\u0231", "o"], ["\u0233", "y"], ["\u02b0", "h"], ["\u02b1", "h"], ["\u0266", "h"],
["\u02b2", "j"], ["\u02b3", "r"], ["\u02b4", "\u0279"], ["\u02b5", "\u027b"], ["\u02b6", "\u0281"], ["\u02b7", "w"], ["\u02b8", "y"], ["\u02e0", "\u0263"], ["\u02e1", "l"], ["\u02e2", "s"], ["\u02e3", "x"], ["\u02e4", "\u0295"], ["\u0390", "\u03b9"], ["\u03ac", "\u03b1"], ["\u03ad", "\u03b5"], ["\u03ae", "\u03b7"], ["\u03af", "\u03b9"], ["\u03b0", "\u03c5"], ["\u03ca", "\u03b9"], ["\u03cb", "\u03c5"], ["\u03cc", "\u03bf"], ["\u03cd", "\u03c5"], ["\u03ce", "\u03c9"], ["\u03d0", "\u03b2"], ["\u03d1",
"\u03b8"], ["\u03d2", "\u03a5"], ["\u03d3", "\u03a5"], ["\u03d4", "\u03a5"], ["\u03d5", "\u03c6"], ["\u03d6", "\u03c0"], ["\u03f0", "\u03ba"], ["\u03f1", "\u03c1"], ["\u03f2", "\u03c2"], ["\u03f5", "\u03b5"], ["\u0439", "\u0438"], ["\u0450", "\u0435"], ["\u0451", "\u0435"], ["\u0453", "\u0433"], ["\u0457", "\u0456"], ["\u045c", "\u043a"], ["\u045d", "\u0438"], ["\u045e", "\u0443"], ["\u0477", "\u0475"], ["\u04c2", "\u0436"], ["\u04d1", "\u0430"], ["\u04d3", "\u0430"], ["\u04d7", "\u0435"], ["\u04db",
"\u04d9"], ["\u04dd", "\u0436"], ["\u04df", "\u0437"], ["\u04e3", "\u0438"], ["\u04e5", "\u0438"], ["\u04e7", "\u043e"], ["\u04eb", "\u04e9"], ["\u04ed", "\u044d"], ["\u04ef", "\u0443"], ["\u04f1", "\u0443"], ["\u04f3", "\u0443"], ["\u04f5", "\u0447"]];
const ca = /[^\p{L}\p{N}]+/u, da = /(\d{3})/g, ea = /(\D)(\d{3})/g, fa = /(\d{3})(\D)/g, ha = "".normalize && /[\u0300-\u036f]/g;
;const ba = /[^\p{L}\p{N}]+/u, ca = /(\d{3})/g, da = /(\D)(\d{3})/g, ea = /(\d{3})(\D)/g, fa = /[\u0300-\u036f]/g;
function K(a = {}) {
if (!this || this.constructor !== K) {
return new K(...arguments);
@@ -118,7 +110,7 @@ x.assign = function(a) {
this.numeric = B(a.numeric, e);
} else {
try {
this.split = B(this.split, ca);
this.split = B(this.split, ba);
} catch (d) {
console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
@@ -126,7 +118,6 @@ x.assign = function(a) {
}
this.prepare = B(a.prepare, null, this.prepare);
this.finalize = B(a.finalize, null, this.finalize);
ha || (this.mapper = new Map(ba));
b = a.filter;
this.filter = "function" === typeof b ? b : B(b && new Set(b), null, this.filter);
this.dedupe = B(a.dedupe, !1, this.dedupe);
@@ -214,9 +205,9 @@ x.encode = function(a) {
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.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(ea, "$1 $2").replace(fa, "$1 $2").replace(da, "$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 = [], e = this.split || "" === this.split ? a.split(this.split) : a;
for (let f = 0, g, k; f < e.length; f++) {
@@ -266,7 +257,7 @@ function L(a) {
a.G.clear();
}
;let M, N;
async function ia(a) {
async function ha(a) {
a = a.data;
var c = a.task;
const b = a.id;
@@ -296,16 +287,16 @@ async function ia(a) {
postMessage("search" === c ? {id:b, msg:d} : {id:b});
}
}
;function ja(a) {
;function ia(a) {
P.call(a, "add");
P.call(a, "append");
P.call(a, "search");
P.call(a, "update");
P.call(a, "remove");
}
let ka, la, Q;
function ma() {
ka = Q = 0;
let ja, ka, Q;
function la() {
ja = Q = 0;
}
function P(a) {
this[a + "Async"] = function() {
@@ -313,7 +304,7 @@ function P(a) {
var b = c[c.length - 1];
let e;
"function" === typeof b && (e = b, delete c[c.length - 1]);
ka ? Q || (Q = Date.now() - la >= this.priority * this.priority * 3) : (ka = setTimeout(ma, 0), la = Date.now());
ja ? Q || (Q = Date.now() - ka >= this.priority * this.priority * 3) : (ja = setTimeout(la, 0), ka = Date.now());
if (Q) {
const f = this;
return new Promise(g => {
@@ -359,7 +350,7 @@ function S(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);
const e = "undefined" === typeof window, d = this, f = ma(b, e, a.worker);
return f.then ? f.then(function(g) {
return c.call(d, g);
}) : c.call(this, f);
@@ -372,7 +363,7 @@ T("remove");
T("clear");
T("export");
T("import");
ja(S.prototype);
ia(S.prototype);
function T(a) {
S.prototype[a] = function() {
const c = this, b = [].slice.call(arguments);
@@ -387,11 +378,11 @@ function T(a) {
return d ? (e.then(d), this) : e;
};
}
function na(a, c, b) {
return c ? "undefined" !== typeof module ? new(require("worker_threads")["Worker"])(__dirname+"/worker/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("string" === typeof b ? b : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
function ma(a, c, b) {
return c ? "undefined" !== typeof module ? new(require("worker_threads")["Worker"])(__dirname+"/worker/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 oa(a, c = 0) {
;function na(a, c = 0) {
let b = [], e = [];
c && (c = 250000 / c * 5000 | 0);
for (const d of a.entries()) {
@@ -400,30 +391,30 @@ function na(a, c, b) {
e.length && b.push(e);
return b;
}
function pa(a, c) {
function oa(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) {
function pa(a, c = 0) {
let b = [], e = [];
c && (c = 250000 / c * 1000 | 0);
for (const d of a.entries()) {
e.push([d[0], oa(d[1])[0]]), e.length === c && (b.push(e), e = []);
e.push([d[0], na(d[1])[0]]), e.length === c && (b.push(e), e = []);
}
e.length && b.push(e);
return b;
}
function ra(a, c) {
function qa(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));
e = a[b], d = c.get(e[0]), c.set(e[0], oa(e[1], d));
}
return c;
}
function sa(a) {
function ra(a) {
let c = [], b = [];
for (const e of a.keys()) {
b.push(e), 250000 === b.length && (c.push(b), b = []);
@@ -431,7 +422,7 @@ function sa(a) {
b.length && c.push(b);
return c;
}
function ta(a, c) {
function sa(a, c) {
c || (c = new Set());
for (let b = 0; b < a.length; b++) {
c.add(a[b]);
@@ -452,7 +443,7 @@ function U(a, c, b, e, d, f, g = 0) {
}
return U.call(this, a, c, b, k ? e : null, d, f, g + 1);
}
function ua(a, c) {
function ta(a, c) {
let b = "";
for (const e of a.entries()) {
a = e[0];
@@ -486,7 +477,7 @@ function ua(a, c) {
d && e.add(a, d, !1, !0);
} else {
if (d = h.I, !d || d(c)) {
h.constructor === String ? h = ["" + h] : D(h) && (h = [h]), va(c, h, this.J, 0, e, a, h[0], b);
h.constructor === String ? h = ["" + h] : D(h) && (h = [h]), ua(c, h, this.J, 0, e, a, h[0], b);
}
}
}
@@ -537,7 +528,7 @@ function ua(a, c) {
k[l] = c[l];
continue;
}
wa(c, k, l, 0, l[0], m);
va(c, k, l, 0, l[0], m);
}
}
this.store.set(a, k || c);
@@ -545,21 +536,21 @@ function ua(a, c) {
}
return this;
};
function wa(a, c, b, e, d, f) {
function va(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);
va(a, c, b, e, d);
}
} else {
c = c[d] || (c[d] = C()), d = b[++e], wa(a, c, b, e, d);
c = c[d] || (c[d] = C()), d = b[++e], va(a, c, b, e, d);
}
}
}
function va(a, c, b, e, d, f, g, k) {
function ua(a, c, b, e, d, f, g, k) {
if (a = a[g]) {
if (e === c.length - 1) {
if (a.constructor === Array) {
@@ -575,15 +566,15 @@ function va(a, c, b, e, d, f, g, k) {
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
va(a, c, b, e, d, f, g, k);
ua(a, c, b, e, d, f, g, k);
}
} else {
g = c[++e], va(a, c, b, e, d, f, g, k);
g = c[++e], ua(a, c, b, e, d, f, g, k);
}
}
}
}
;function xa(a, c, b, e, d) {
;function wa(a, c, b, e, d) {
const f = a.length;
let g = [], k, h;
k = C();
@@ -600,7 +591,7 @@ function va(a, c, b, e, d, f, g, k) {
}
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;
g = 1 < g.length ? xa(g, b, e) : (g = g[0]).length > b || e ? g.slice(e, b + e) : g;
} else {
if (a < f) {
return [];
@@ -615,7 +606,7 @@ function va(a, c, b, e, d, f, g, k) {
}
return g;
}
function ya(a, c, b) {
function xa(a, c, b) {
const e = [], d = C();
let f;
var g = a.length;
@@ -637,7 +628,7 @@ function ya(a, c, b) {
}
return e;
}
function za(a, c) {
function ya(a, c) {
const b = C(), e = [];
for (let d = 0, f; d < c.length; d++) {
f = c[d];
@@ -650,7 +641,7 @@ function za(a, c) {
}
return e;
}
;function Aa(a, c, b, e) {
;function za(a, c, b, e) {
if (!a.length) {
return a;
}
@@ -681,7 +672,7 @@ function za(a, c) {
d = 1 < d.length ? [].concat.apply([], d) : d[0];
return e ? W.call(this, d) : d;
}
;function Ba(a, c, b) {
;function Aa(a, c, b) {
var e = b[0];
if (e.then) {
return Promise.all(b).then(function(m) {
@@ -728,10 +719,10 @@ function za(a, c) {
return {O:e, P:d, limit:f, offset:g, enrich:k, resolve:h, 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);
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f} = Aa(this, "or", arguments);
return Ba.call(this, a, c, b, e, d, f);
};
function Ca(a, c, b, e, d, f) {
function Ba(a, c, b, e, d, f) {
if (c.length) {
const g = this;
return Promise.all(c).then(function(k) {
@@ -739,10 +730,10 @@ function Ca(a, c, b, e, d, f) {
for (let h = 0, l; h < k.length; h++) {
(l = k[h]).length && (a[h] = l);
}
return Ca.call(g, a, [], b, e, d, f);
return Ba.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));
a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = xa(a, b, e), e = 0));
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.and = function() {
@@ -752,11 +743,40 @@ function Ca(a, c, b, e, d, f) {
f && (a = !!f.suggest, d = f.resolve, c = f.limit, b = f.offset, e = f.enrich && d);
}
if (a) {
const {O:f, P:g, limit:k, offset:h, enrich:l, resolve:m, suggest:n} = Ba(this, "and", arguments);
return Da.call(this, f, g, k, h, l, m, n);
const {O:f, P:g, limit:k, offset:h, enrich:l, resolve:m, suggest:n} = Aa(this, "and", arguments);
return Ca.call(this, f, g, k, h, l, m, n);
}
return d ? this.resolve(c, b, e) : this;
};
function Ca(a, c, b, e, d, f, g) {
if (c.length) {
const k = this;
return Promise.all(c).then(function(h) {
a = [];
for (let l = 0, m; l < h.length; l++) {
(m = h[l]).length && (a[l] = m);
}
return Ca.call(k, 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 = wa(a, c, b, e, g), f ? d ? W.call(this.index, this.result) : this.result : this;
}
this.result = [];
}
} else {
g || (this.result = a);
}
return f ? this.resolve(b, e, d) : this;
}
;X.prototype.xor = function() {
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "xor", arguments);
return Da.call(this, a, c, b, e, d, f, g);
};
function Da(a, c, b, e, d, f, g) {
if (c.length) {
const k = this;
@@ -772,43 +792,14 @@ function Da(a, c, b, e, d, f, g) {
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 = [];
return this.result = Ea.call(this, a, b, e, f, this.h), f ? d ? W.call(this.index, this.result) : this.result : this;
}
} else {
g || (this.result = a);
}
return f ? this.resolve(b, e, d) : this;
}
;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 k = this;
return Promise.all(c).then(function(h) {
a = [];
for (let l = 0, m; l < h.length; l++) {
(m = h[l]).length && (a[l] = m);
}
return Ea.call(k, 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) {
function Ea(a, c, b, e, d) {
const f = [], g = C();
let k = 0;
for (let h = 0, l; h < a.length; h++) {
@@ -854,10 +845,10 @@ function Fa(a, c, b, e, d) {
return f;
}
;X.prototype.not = function() {
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ba(this, "not", arguments);
return Ga.call(this, a, c, b, e, d, f, g);
const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Aa(this, "not", arguments);
return Fa.call(this, a, c, b, e, d, f, g);
};
function Ga(a, c, b, e, d, f, g) {
function Fa(a, c, b, e, d, f, g) {
if (c.length) {
const k = this;
return Promise.all(c).then(function(h) {
@@ -865,17 +856,17 @@ function Ga(a, c, b, e, d, f, g) {
for (let l = 0, m; l < h.length; l++) {
(m = h[l]).length && (a[l] = m);
}
return Ga.call(k, a, [], b, e, d, f, g);
return Fa.call(k, a, [], b, e, d, f, g);
});
}
if (a.length && this.result.length) {
this.result = Ha.call(this, a, b, e, f);
this.result = Ga.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) {
function Ga(a, c, b, e) {
const d = [];
a = new Set(a.flat().flat());
for (let f = 0, g, k = 0; f < this.result.length; f++) {
@@ -950,7 +941,7 @@ X.prototype.boost = function(a) {
X.prototype.resolve = function(a, c, b) {
const e = this.result, d = this.index;
this.result = this.index = null;
return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), Aa.call(d, e, a || 100, c, b)) : e;
return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), za.call(d, e, a || 100, c, b)) : e;
};
C();
V.prototype.search = function(a, c, b, e) {
@@ -1012,7 +1003,7 @@ V.prototype.search = function(a, c, b, e) {
f = [];
if (u.length) {
for (p = 0; p < u.length; p += 2) {
q = Ia.call(this, u[p], u[p + 1], c, t, g), d.push({field:u[p], tag:u[p + 1], result:q});
q = Ha.call(this, u[p], u[p + 1], c, t, g), d.push({field:u[p], tag:u[p + 1], result:q});
}
}
return f.length ? Promise.all(f).then(function(y) {
@@ -1046,7 +1037,7 @@ V.prototype.search = function(a, c, b, e) {
if (l && F) {
w = [];
z = 0;
for (let G = 0, H, Wa; G < l.length; G += 2) {
for (let G = 0, H, Xa; G < l.length; G += 2) {
H = this.tag.get(l[G]);
if (!H) {
if (console.warn("Tag '" + l[G] + ":" + l[G + 1] + "' will be skipped because there is no field '" + l[G] + "'."), k) {
@@ -1055,14 +1046,14 @@ V.prototype.search = function(a, c, b, e) {
return n ? d : new X(d);
}
}
if (Wa = (H = H && H.get(l[G + 1])) && H.length) {
if (Xa = (H = H && H.get(l[G + 1])) && H.length) {
z++, w.push(H);
} else if (!k) {
return n ? d : new X(d);
}
}
if (z) {
v = za(v, w);
v = ya(v, w);
F = v.length;
if (!F && !k) {
return n ? v : new X(v);
@@ -1097,9 +1088,9 @@ V.prototype.search = function(a, c, b, e) {
}
d[t] = {field:f[t], result:e};
}
return q ? Ja(d, c) : r ? Ka(d, a, this.index, this.field, this.C, r) : d;
return q ? Ia(d, c) : r ? Ja(d, a, this.index, this.field, this.C, r) : d;
};
function Ka(a, c, b, e, d, f) {
function Ja(a, c, b, e, d, f) {
let g, k, h;
for (let m = 0, n, r, p, q; m < a.length; m++) {
let t = a[m].result;
@@ -1144,7 +1135,7 @@ function Ka(a, c, b, e, d, f) {
}
return a;
}
function Ja(a, c) {
function Ia(a, c) {
const b = [], e = C();
for (let d = 0, f, g; d < a.length; d++) {
f = a[d];
@@ -1163,7 +1154,7 @@ function Ja(a, c) {
}
return b;
}
function Ia(a, c, b, e, d) {
function Ha(a, c, b, e, d) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -1195,7 +1186,7 @@ function W(a) {
this.C = [];
this.field = [];
this.J = [];
this.key = (b = c.key || c.id) && La(b, this.J) || "id";
this.key = (b = c.key || c.id) && Ka(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();
@@ -1206,13 +1197,13 @@ function W(a) {
let e = c.index || c.field || c;
D(e) && (e = [e]);
for (let d = 0, f, g; d < e.length; d++) {
f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = 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;
f = e[d], D(f) || (g = f, f = f.field), g = I(g) ? Object.assign({}, a, g) : a, b.set(f, new O(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = Ka(f, this.J), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].I = g.filter)), this.field[d] = f;
}
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));
f = a[d], g = f.field || f, f.custom ? (this.A[d] = f.custom, f.custom.U = g) : (this.A[d] = Ka(g, this.J), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].I = f.filter));
}
}
this.index = b;
@@ -1228,14 +1219,14 @@ function W(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
f.custom ? this.B[d] = f.custom : (this.B[d] = 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));
f.custom ? this.B[d] = f.custom : (this.B[d] = Ka(g, this.J), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].I = f.filter));
this.T[d] = g;
this.tag.set(g, new Map());
}
}
}
}
function La(a, c) {
function Ka(a, c) {
const b = a.split(":");
let e = 0;
for (let d = 0; d < b.length; d++) {
@@ -1303,7 +1294,7 @@ x.set = function(a, c) {
this.store.set(a, c);
return this;
};
x.searchCache = Ma;
x.searchCache = La;
x.export = function(a, c, b = 0, e = 0) {
if (b < this.field.length) {
const g = this.field[b];
@@ -1319,17 +1310,17 @@ x.export = function(a, c, b = 0, e = 0) {
switch(e) {
case 0:
d = "reg";
f = sa(this.reg);
f = ra(this.reg);
c = null;
break;
case 1:
d = "tag";
f = this.tag && qa(this.tag, this.reg.size);
f = this.tag && pa(this.tag, this.reg.size);
c = null;
break;
case 2:
d = "doc";
f = this.store && oa(this.store);
f = this.store && na(this.store);
c = null;
break;
default:
@@ -1350,21 +1341,21 @@ x.import = function(a, c) {
switch(b) {
case "reg":
this.fastupdate = !1;
this.reg = ta(c, this.reg);
this.reg = sa(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);
this.tag = qa(c, this.tag);
break;
case "doc":
this.store = pa(c, this.store);
this.store = oa(c, this.store);
}
}
};
ja(V.prototype);
function Ma(a, c, b) {
ia(V.prototype);
function La(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new Y());
let e = this.cache.get(a);
@@ -1405,31 +1396,22 @@ Y.prototype.clear = function() {
this.cache.clear();
this.h = "";
};
const Na = {normalize:function(a) {
return a.toLowerCase();
}};
const Oa = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
const Pa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Qa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
const Ra = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
const Sa = /[\x00-\x7F]+/g;
const Ta = /[\x00-\x7F]+/g;
const Ua = /[\x00-\x7F]+/g;
var Va = {LatinExact:{split:/\s+/, normalize:!1}, LatinDefault:Na, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Oa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Oa, matcher:Pa, replacer:Qa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Oa, replacer:Qa.concat([/(?!^)[aeo]/g, ""]), matcher:Pa}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
const Ma = {normalize:!1, numeric:!1, split:/\s+/};
const Na = {normalize:!0};
const Oa = {normalize:!0, dedupe:!0};
const Pa = 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 Qa = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Ra = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"];
const Sa = {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 Ta = {W:Ma, V:Na, X:Oa, LatinBalance:{normalize:!0, dedupe:!0, mapper:Pa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Pa, matcher:Qa, replacer:Ra}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Pa, replacer:Ra.concat([/(?!^)[aeo]/g, ""]), matcher:Qa}, 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++) {
let e = c.charAt(0), d = Sa[e];
for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = Sa[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
}
a[b] = e;
}
}}, ArabicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(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:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
}}, LatinExact:Ma, LatinDefault:Na, LatinSimple:Oa};
const Ua = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
O.prototype.add = function(a, c, b, e) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
@@ -1442,7 +1424,7 @@ O.prototype.add = function(a, c, b, e) {
let q = c[this.rtl ? e - 1 - p : p];
var d = q.length;
if (d && (n || !m[q])) {
var f = this.score ? this.score(c, q, p, null, 0) : Ya(r, e, p), g = "";
var f = this.score ? this.score(c, q, p, null, 0) : Va(r, e, p), g = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
@@ -1450,17 +1432,18 @@ O.prototype.add = function(a, c, b, e) {
for (f = d; f > t; f--) {
g = q.substring(t, f);
u = this.rtl ? d - 1 - t : t;
var k = this.score ? this.score(c, q, p, g, u) : Ya(r, e, p, d, u);
var k = this.score ? this.score(c, q, p, g, u) : Va(r, e, p, d, u);
Z(this, m, g, k, a, b);
}
}
break;
}
case "bidirectional":
case "reverse":
if (1 < d) {
for (k = d - 1; 0 < k; k--) {
g = q[this.rtl ? d - 1 - k : k] + g;
var h = this.score ? this.score(c, q, p, g, k) : Ya(r, e, p, d, k);
var h = this.score ? this.score(c, q, p, g, k) : Va(r, e, p, d, k);
Z(this, m, g, h, a, b);
}
g = "";
@@ -1477,7 +1460,7 @@ O.prototype.add = function(a, c, b, e) {
for (d = C(), g = this.S, f = q, k = Math.min(n + 1, this.rtl ? p + 1 : e - p), d[f] = 1, h = 1; h < k; h++) {
if ((q = c[this.rtl ? e - 1 - p - h : p + h]) && !d[q]) {
d[q] = 1;
const t = this.score ? this.score(c, f, p, q, h - 1) : Ya(g + (e / 2 > g ? 0 : 1), e, p, k - 1, h - 1), u = this.bidirectional && q > f;
const t = this.score ? this.score(c, f, p, q, h - 1) : Va(g + (e / 2 > g ? 0 : 1), e, p, k - 1, h - 1), u = this.bidirectional && q > f;
Z(this, l, u ? f : q, t, a, b, u ? q : f);
}
}
@@ -1496,7 +1479,7 @@ function Z(a, c, b, e, d, f, g) {
g ? (c = h || (c[b] = C()), c[g] = 1, (h = k.get(g)) ? k = h : k.set(g, k = new Map())) : c[b] = 1, (h = k.get(b)) ? k = h : k.set(b, k = []), k = k[e] || (k[e] = []), f && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
}
}
function Ya(a, c, b, e, d) {
function Va(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) {
@@ -1517,11 +1500,11 @@ function Ya(a, c, b, e, d) {
b = a.length;
c = c || (k ? 100 : 0);
if (1 === b) {
return g = c, (c = Za(this, a[0], "")) && c.length ? Aa.call(this, c, g, d) : [];
return g = c, (c = Wa(this, a[0], "")) && c.length ? za.call(this, c, g, d) : [];
}
f = this.depth && !1 !== f;
if (2 === b && f && !g) {
return g = c, (c = Za(this, a[0], a[1])) && c.length ? Aa.call(this, c, g, d) : [];
return g = c, (c = Wa(this, a[0], a[1])) && c.length ? za.call(this, c, g, d) : [];
}
k = C();
let l = 0;
@@ -1533,7 +1516,7 @@ function Ya(a, c, b, e, d) {
for (let q, t; l < b; l++) {
if ((t = a[l]) && !k[t]) {
k[t] = 1;
q = Za(this, t, m);
q = Wa(this, t, m);
a: {
f = q;
var n = e, r = g, p = h;
@@ -1570,16 +1553,16 @@ function Ya(a, c, b, e, d) {
e = a.length;
m = a;
if (1 < e) {
m = xa(a, h, c, d, g);
m = wa(a, h, c, d, g);
} else if (1 === e) {
g = Aa.call(null, a[0], c, d);
g = za.call(null, a[0], c, d);
break a;
}
g = m;
}
return g;
};
function Za(a, c, b) {
function Wa(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);
@@ -1600,14 +1583,14 @@ function Za(a, c, b) {
}
}
} else {
$a(this.map, a), this.depth && $a(this.ctx, a);
Ya(this.map, a), this.depth && Ya(this.ctx, a);
}
c || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function $a(a, c) {
function Ya(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let e = 0, d, f; e < a.length; e++) {
@@ -1622,7 +1605,7 @@ function $a(a, c) {
}
} else {
for (let e of a.entries()) {
const d = e[0], f = $a(e[1], c);
const d = e[0], f = Ya(e[1], c);
f ? b += f : a.delete(d);
}
}
@@ -1634,15 +1617,15 @@ function $a(a, c) {
}
if (a) {
var b = D(a) ? a : a.preset;
b && (Xa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Xa[b], a));
b && (Ua[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Ua[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;
const e = !0 === b ? {depth:1} : b || {}, d = D(a.encoder) ? Ta[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 = (b = a.tokenize) && "default" !== b && b || "strict";
this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict";
this.depth = "strict" === b && e.depth || 0;
this.bidirectional = !1 !== e.bidirectional;
this.fastupdate = !!a.fastupdate;
@@ -1675,7 +1658,7 @@ x.update = function(a, c) {
const b = this, e = this.remove(a);
return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c);
};
function ab(a) {
function Za(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, e; b < a.length; b++) {
@@ -1683,7 +1666,7 @@ function ab(a) {
}
} else {
for (const b of a.entries()) {
const e = b[0], d = ab(b[1]);
const e = b[0], d = Za(b[1]);
d ? c += d : a.delete(e);
}
}
@@ -1693,17 +1676,17 @@ x.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
ab(this.map);
this.depth && ab(this.ctx);
Za(this.map);
this.depth && Za(this.ctx);
return this;
};
x.searchCache = Ma;
x.searchCache = La;
x.export = function(a, c, b = 0, e = 0) {
let d, f;
switch(e) {
case 0:
d = "reg";
f = sa(this.reg);
f = ra(this.reg);
break;
case 1:
d = "cfg";
@@ -1711,11 +1694,11 @@ x.export = function(a, c, b = 0, e = 0) {
break;
case 2:
d = "map";
f = oa(this.map, this.reg.size);
f = na(this.map, this.reg.size);
break;
case 3:
d = "ctx";
f = qa(this.ctx, this.reg.size);
f = pa(this.ctx, this.reg.size);
break;
default:
return;
@@ -1727,13 +1710,13 @@ x.import = function(a, c) {
switch("string" === typeof c && (c = JSON.parse(c)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), 3 === a.length && a.shift(), a = 1 < a.length ? a[1] : a[0], a) {
case "reg":
this.fastupdate = !1;
this.reg = ta(c, this.reg);
this.reg = sa(c, this.reg);
break;
case "map":
this.map = pa(c, this.map);
this.map = oa(c, this.map);
break;
case "ctx":
this.ctx = ra(c, this.ctx);
this.ctx = qa(c, this.ctx);
}
}
};
@@ -1745,11 +1728,11 @@ x.serialize = function(a = !0) {
f || (f = typeof d), c += (c ? "," : "") + ("string" === f ? '"' + d + '"' : d);
}
c = "index.reg=new Set([" + c + "]);";
b = ua(this.map, f);
b = ta(this.map, f);
b = "index.map=new Map([" + b + "]);";
for (const g of this.ctx.entries()) {
d = g[0];
let k = ua(g[1], f);
let k = ta(g[1], f);
k = "new Map([" + k + "])";
k = '["' + d + '",' + k + "]";
e += (e ? "," : "") + k;
@@ -1758,8 +1741,8 @@ x.serialize = function(a = !0) {
}
return a ? "function inject(index){" + c + b + e + "}" : c + b + e;
};
ja(O.prototype);
ia(O.prototype);
C();
export default {Index:O, Charset:Va, Encoder:K, Document:V, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
export default {Index:O, Charset:Ta, 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={};
export const Index=O;export const Charset=Ta;export const Encoder=K;export const Document=V;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -1,71 +1,65 @@
/**!
* FlexSearch.js v0.8.142 (Bundle)
* FlexSearch.js v0.8.143 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var x;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ca=/[^\p{L}\p{N}]+/u,da=/(\d{3})/g,ea=/(\D)(\d{3})/g,fa=/(\d{3})(\D)/g,ha="".normalize&&/[\u0300-\u036f]/g;function K(a={}){if(!this||this.constructor!==K)return new K(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}x=K.prototype;
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};const ba=/[^\p{L}\p{N}]+/u,ca=/(\d{3})/g,da=/(\D)(\d{3})/g,ea=/(\d{3})(\D)/g,fa=/[\u0300-\u036f]/g;function K(a={}){if(!this||this.constructor!==K)return new K(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}x=K.prototype;
x.assign=function(a){this.normalize=B(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,e;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";e=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(f){this.split=/\s+/}}else this.split=b,e=!1===b||2>"a1a".split(b).length;
this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ca)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);ha||(this.mapper=new Map(ba));b=a.filter;this.filter="function"===typeof b?b:B(b&&new Set(b),null,this.filter);this.dedupe=B(a.dedupe,!1,this.dedupe);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=
B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);this.rtl=B(a.rtl,!1,this.rtl);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
this.numeric=B(a.numeric,e)}else{try{this.split=B(this.split,ba)}catch(d){this.split=/\s+/}this.numeric=B(a.numeric,B(this.numeric,!0))}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:B(b&&new Set(b),null,this.filter);this.dedupe=B(a.dedupe,!1,this.dedupe);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=B((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);this.rtl=B(a.rtl,!1,this.rtl);if(this.cache=b=B(a.cache,!0,this.cache))this.H=null,this.R="number"===typeof b?b:2E5,this.F=new Map,this.G=new Map,this.L=this.K=128;this.h="";this.M=null;this.D="";this.N=null;if(this.matcher)for(const d of this.matcher.keys())this.h+=(this.h?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.D+=
(this.D?"|":"")+d;return this};x.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.D+=(this.D?"|":"")+a;this.N=null;this.cache&&L(this);return this};x.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&L(this);return this};
x.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&L(this);return this};x.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.h+=(this.h?"|":"")+a;this.M=null;this.cache&&L(this);return this};
x.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&L(this);return this};
x.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ha?a.normalize("NFKD").replace(ha,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&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=
x.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=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 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=
[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,k;f<e.length;f++)if((g=k=e[f])&&!(g.length<this.minlength))if(c)b.push(g);else if(!this.filter||("function"===typeof this.filter?this.filter(g):!this.filter.has(g))){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);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+")$")),d=g,g=g.replace(this.N,h=>this.stemmer.get(h)),d!==g&&this.filter&&
g.length>=this.minlength&&("function"===typeof this.filter?!this.filter(g):this.filter.has(g))&&(g=""));if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let h=0,l="",m,n;h<g.length;h++)m=g.charAt(h),m===l&&this.dedupe||((n=this.mapper&&this.mapper.get(m))||""===n?n===l&&this.dedupe||!(l=n)||(d+=n):d+=l=m);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.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ka,la,Q;function ma(){ka=Q=0}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);ka?Q||(Q=Date.now()-la>=this.priority*this.priority*3):(ka=setTimeout(ma,0),la=Date.now());if(Q){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let R=0;
this.replacer[d+1]);this.cache&&k.length<=this.L&&(this.G.set(k,g),this.G.size>this.R&&(this.G.clear(),this.L=this.L/1.1|0));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 ha(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ia(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ja,ka,Q;function la(){ja=Q=0}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);ja?Q||(Q=Date.now()-ka>=this.priority*this.priority*3):(ja=setTimeout(la,0),ka=Date.now());if(Q){const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let R=0;
function S(a={}){function c(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=C();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++R]=function(){h(d);1E9<R&&(R=0)};d.worker.postMessage({id:R,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});this.priority=a.priority||4;return this}}if(!this||this.constructor!==S)return new S(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)}T("add");T("append");T("search");T("update");T("remove");T("clear");T("export");T("import");ja(S.prototype);
"undefined"!==typeof self?self._factory:"undefined"!==typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=ma(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}T("add");T("append");T("search");T("update");T("remove");T("clear");T("export");T("import");ia(S.prototype);
function T(a){S.prototype[a]=function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.pop());e=new Promise(function(f){"export"===a&&"function"===typeof b[0]&&(b[0]=null);c.h[++R]=f;c.worker.postMessage({task:a,id:R,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+"/worker/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("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 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 ma(a,c,b){return c?"undefined"!==typeof module?new(require("worker_threads")["Worker"])(__dirname+"/worker/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 na(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 oa(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 pa(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],na(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function qa(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],oa(e[1],d));return c}function ra(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 sa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function U(a,c,b,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,c,d,f+1);if((h=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return U.call(l,a,c,b,k?e:null,d,f,g+1)})}return U.call(this,a,c,b,k?e:null,d,f,g+1)}
function ua(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,k;g<d.length;g++){k=d[g]||[""];let h="";for(let l=0;l<k.length;l++)h+=(h?",":"")+("string"===c?'"'+k[l]+'"':k[l]);h="["+h+"]";f+=(f?",":"")+h}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};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 k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:D(h)&&(h=[h]),va(c,h,this.J,0,e,a,h[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 k=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
function ta(a,c){let b="";for(const e of a.entries()){a=e[0];const d=e[1];let f="";for(let g=0,k;g<d.length;g++){k=d[g]||[""];let h="";for(let l=0;l<k.length;l++)h+=(h?",":"")+("string"===c?'"'+k[l]+'"':k[l]);h="["+h+"]";f+=(f?",":"")+h}f='["'+a+'",['+f+"]]";b+=(b?",":"")+f}return b};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 k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:D(h)&&(h=[h]),ua(c,h,this.J,0,e,a,h[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let k=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 h=0,l,m;h<f.length;h++)l=f[h],k[l]||(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let k;if(this.A){k=C();for(let h=0,l;h<this.A.length;h++){l=this.A[h];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){k[l]=c[l];continue}wa(c,k,l,0,l[0],m)}}this.store.set(a,k||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,k){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,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)va(a,c,b,e,d,f,g,k);else g=c[++e],va(a,c,b,e,d,f,g,k)};function xa(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,r,p;l<c;l++)for(let q=0;q<f;q++)if(r=a[q],l<r.length&&(m=r[l]))for(let t=0;t<m.length;t++)if(n=m[t],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n),b&&h===f-1&&p.length-e===b)return p;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 k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;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){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};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,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=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,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let r;if(n.constructor===X)r=n.result;else if(n.constructor===Array)r=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,r=n.index.search(n).result,n.resolve=h;else if(n.and)r=a.and(n.and);else if(n.or)r=a.or(n.or);else if(n.xor)r=a.xor(n.xor);
else if(n.not)r=a.not(n.not);else continue;if(r.then)d.push(r);else if(r.length)e[m]=r;else if(!l&&("and"===c||"xor"===c)){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: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(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=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:k,offset:h,enrich:l,resolve:m,suggest:n}=Ba(this,"and",arguments);return Da.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Da.call(k,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 k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ea.call(k,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 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 r=0,p;r<n.length;r++)p=n[r],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,r;n<a.length;n++)if(r=a[n])if(l=r[h])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 t=h+(n?d:0);f[t]||(f[t]=[]);f[t].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 k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ga.call(k,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,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(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===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;let k,h,l;let m=0,n=!0,r;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;var q=b.merge;h=p||b.field||(h=b.index)&&(h.index?null:h);l=this.tag&&b.tag;k=b.suggest;n=!0;r=(g=this.store&&b.enrich&&n)&&b.highlight;c=b.limit||c;var t=b.offset||0;c||(c=100);if(l){l.constructor!==Array&&(l=[l]);var u=[];for(let y=0,v;y<l.length;y++)if(v=l[y],v.field&&v.tag){var w=v.tag;if(w.constructor===
Array)for(var z=0;z<w.length;z++)u.push(v.field,w[z]);else u.push(v.field,w)}else{w=Object.keys(v);for(let E=0,F,A;E<w.length;E++)if(F=w[E],A=v[F],A.constructor===Array)for(z=0;z<A.length;z++)u.push(F,A[z]);else u.push(F,A)}l=u;if(!a){f=[];if(u.length)for(p=0;p<u.length;p+=2)q=Ia.call(this,u[p],u[p+1],c,t,g),d.push({field:u[p],tag:u[p+1],result:q});return f.length?Promise.all(f).then(function(y){for(let v=0;v<y.length;v++)d[v].result=y[v];return d}):d}}h&&h.constructor!==Array&&(h=[h])}h||(h=this.field);
u=!e&&(this.worker||this.db)&&[];for(let y=0,v,E,F;y<h.length;y++){E=h[y];let A;D(E)||(A=E,E=A.field,a=A.query||a,c=A.limit||c,t=A.offset||t,k=A.suggest||k,g=this.store&&(A.enrich||g));if(e)v=e[y];else if(w=A||b,z=this.index.get(E),l&&(w.enrich=!1),u){u[y]=z.search(a,c,w);w&&g&&(w.enrich=g);continue}else v=z.search(a,c,w),w&&g&&(w.enrich=g);F=v&&(n?v.length:v.result.length);if(l&&F){w=[];z=0;for(let J=0,G,Va;J<l.length;J+=2){G=this.tag.get(l[J]);if(!G)if(k)continue;else return n?d:new X(d);if(Va=
(G=G&&G.get(l[J+1]))&&G.length)z++,w.push(G);else if(!k)return n?d:new X(d)}if(z){v=za(v,w);F=v.length;if(!F&&!k)return n?v:new X(v);z--}}if(F)f[m]=E,d.push(v),m++;else if(1===h.length)return n?d:new X(d)}if(u){const y=this;return Promise.all(u).then(function(v){return v.length?y.search(a,c,b,v):v})}if(!m)return n?d:new X(d);if(p&&(!g||!this.store))return d[0];u=[];for(t=0;t<f.length;t++){e=d[t];g&&e.length&&"undefined"===typeof e[0].doc&&(e=W.call(this,e));if(p)return n?e:new X(e);d[t]={field:f[t],
result:e}}return q?Ja(d,c):r?Ka(d,a,this.index,this.field,this.C,r):d};
function Ka(a,c,b,e,d,f){let g,k,h;for(let m=0,n,r,p,q;m<a.length;m++){let t=a[m].result;n=a[m].field;p=b.get(n);r=p.encoder;h=p.tokenize;q=d[e.indexOf(n)];r!==g&&(g=r,k=g.encode(c));for(let u=0;u<t.length;u++){let w="";var l=I(t[u].doc,q);let z=g.encode(l);l=l.split(g.split);for(let y=0,v,E;y<z.length;y++){v=z[y];E=l[y];if(!v||!E)continue;let F;for(let A=0,J;A<k.length;A++)if(J=k[A],"strict"===h){if(v===J){w+=(w?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=v.indexOf(J);if(-1<G){w+=(w?" ":"")+
E.substring(0,G)+f.replace("$1",E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(w+=(w?" ":"")+l[y])}t[u].highlight=w}}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 k=0,h,l,m;k<g.length;k++)if(l=g[k],"object"!==typeof l&&(l={id:l}),h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[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;this.priority=a.priority||4;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]}x=V.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
String){k[l]=c[l];continue}va(c,k,l,0,l[0],m)}}this.store.set(a,k||c)}}return this};function va(a,c,b,e,d,f){a=a[d];if(e===b.length-1)c[d]=f||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)va(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],va(a,c,b,e,d)}
function ua(a,c,b,e,d,f,g,k){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,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)ua(a,c,b,e,d,f,g,k);else g=c[++e],ua(a,c,b,e,d,f,g,k)};function wa(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,r,p;l<c;l++)for(let q=0;q<f;q++)if(r=a[q],l<r.length&&(m=r[l]))for(let t=0;t<m.length;t++)if(n=m[t],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n),b&&h===f-1&&p.length-e===b)return p;if(a=g.length)if(d)g=1<g.length?xa(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;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 xa(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;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 ya(a,c){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};function za(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,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Aa(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,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let r;if(n.constructor===X)r=n.result;else if(n.constructor===Array)r=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,r=n.index.search(n).result,n.resolve=h;else if(n.and)r=a.and(n.and);else if(n.or)r=a.or(n.or);else if(n.xor)r=a.xor(n.xor);
else if(n.not)r=a.not(n.not);else continue;if(r.then)d.push(r);else if(r.length)e[m]=r;else if(!l&&("and"===c||"xor"===c)){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:c,limit:b,offset:e,enrich:d,resolve:f}=Aa(this,"or",arguments);return Ba.call(this,a,c,b,e,d,f)};function Ba(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ba.call(g,a,[],b,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=xa(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=Aa(this,"and",arguments);return Ca.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function Ca(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ca.call(k,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=wa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Aa(this,"xor",arguments);return Da.call(this,a,c,b,e,d,f,g)};
function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Da.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=Ea.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Ea(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;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 r=0,p;r<n.length;r++)p=n[r],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,r;n<a.length;n++)if(r=a[n])if(l=r[h])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 t=h+(n?d:0);f[t]||(f[t]=[]);f[t].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}=Aa(this,"not",arguments);return Fa.call(this,a,c,b,e,d,f,g)};function Fa(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Fa.call(k,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ga.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Ga(a,c,b,e){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(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===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),za.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;let k,h,l;let m=0,n=!0,r;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var p=b.pluck;var q=b.merge;h=p||b.field||(h=b.index)&&(h.index?null:h);l=this.tag&&b.tag;k=b.suggest;n=!0;r=(g=this.store&&b.enrich&&n)&&b.highlight;c=b.limit||c;var t=b.offset||0;c||(c=100);if(l){l.constructor!==Array&&(l=[l]);var u=[];for(let y=0,v;y<l.length;y++)if(v=l[y],v.field&&v.tag){var w=v.tag;if(w.constructor===
Array)for(var z=0;z<w.length;z++)u.push(v.field,w[z]);else u.push(v.field,w)}else{w=Object.keys(v);for(let E=0,F,A;E<w.length;E++)if(F=w[E],A=v[F],A.constructor===Array)for(z=0;z<A.length;z++)u.push(F,A[z]);else u.push(F,A)}l=u;if(!a){f=[];if(u.length)for(p=0;p<u.length;p+=2)q=Ha.call(this,u[p],u[p+1],c,t,g),d.push({field:u[p],tag:u[p+1],result:q});return f.length?Promise.all(f).then(function(y){for(let v=0;v<y.length;v++)d[v].result=y[v];return d}):d}}h&&h.constructor!==Array&&(h=[h])}h||(h=this.field);
u=!e&&(this.worker||this.db)&&[];for(let y=0,v,E,F;y<h.length;y++){E=h[y];let A;D(E)||(A=E,E=A.field,a=A.query||a,c=A.limit||c,t=A.offset||t,k=A.suggest||k,g=this.store&&(A.enrich||g));if(e)v=e[y];else if(w=A||b,z=this.index.get(E),l&&(w.enrich=!1),u){u[y]=z.search(a,c,w);w&&g&&(w.enrich=g);continue}else v=z.search(a,c,w),w&&g&&(w.enrich=g);F=v&&(n?v.length:v.result.length);if(l&&F){w=[];z=0;for(let J=0,G,Wa;J<l.length;J+=2){G=this.tag.get(l[J]);if(!G)if(k)continue;else return n?d:new X(d);if(Wa=
(G=G&&G.get(l[J+1]))&&G.length)z++,w.push(G);else if(!k)return n?d:new X(d)}if(z){v=ya(v,w);F=v.length;if(!F&&!k)return n?v:new X(v);z--}}if(F)f[m]=E,d.push(v),m++;else if(1===h.length)return n?d:new X(d)}if(u){const y=this;return Promise.all(u).then(function(v){return v.length?y.search(a,c,b,v):v})}if(!m)return n?d:new X(d);if(p&&(!g||!this.store))return d[0];u=[];for(t=0;t<f.length;t++){e=d[t];g&&e.length&&"undefined"===typeof e[0].doc&&(e=W.call(this,e));if(p)return n?e:new X(e);d[t]={field:f[t],
result:e}}return q?Ia(d,c):r?Ja(d,a,this.index,this.field,this.C,r):d};
function Ja(a,c,b,e,d,f){let g,k,h;for(let m=0,n,r,p,q;m<a.length;m++){let t=a[m].result;n=a[m].field;p=b.get(n);r=p.encoder;h=p.tokenize;q=d[e.indexOf(n)];r!==g&&(g=r,k=g.encode(c));for(let u=0;u<t.length;u++){let w="";var l=I(t[u].doc,q);let z=g.encode(l);l=l.split(g.split);for(let y=0,v,E;y<z.length;y++){v=z[y];E=l[y];if(!v||!E)continue;let F;for(let A=0,J;A<k.length;A++)if(J=k[A],"strict"===h){if(v===J){w+=(w?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=v.indexOf(J);if(-1<G){w+=(w?" ":"")+
E.substring(0,G)+f.replace("$1",E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(w+=(w?" ":"")+l[y])}t[u].highlight=w}}return a}function Ia(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let k=0,h,l,m;k<g.length;k++)if(l=g[k],"object"!==typeof l&&(l={id:l}),h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[f.field];b.push(l)}}return b}
function Ha(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)&&Ka(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;this.priority=a.priority||4;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]=Ka(f,this.J),g.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=g.filter)),this.field[d]=f;if(this.A){a=c.store;D(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?(this.A[d]=f.custom,f.custom.U=g):(this.A[d]=Ka(g,this.J),f.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].I=f.filter))}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]=Ka(g,this.J),f.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].I=f.filter));this.T[d]=g;this.tag.set(g,new Map)}}}
function Ka(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]}x=V.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
x.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};
x.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clear();b.then&&a.push(b)}if(this.tag)for(const c of this.tag.values())c.clear();this.store&&this.store.clear();this.cache&&this.cache.clear();return a.length?Promise.all(a):this};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=Ma;
x.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.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=this.tag&&qa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&oa(this.store);c=null;break;default:return}return U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){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"],["ph","f"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Ra={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;const Ua=/[\x00-\x7F]+/g;var Wa={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Na,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Oa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Oa,matcher:Pa,replacer:Qa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Oa,replacer:Qa.concat([/(?!^)[aeo]/g,""]),matcher:Pa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;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:{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:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,r=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(r,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let t=0,u;t<d;t++)for(f=d;f>t;f--){g=q.substring(t,f);u=this.rtl?d-1-t:t;var k=this.score?this.score(c,q,p,g,u):Ya(r,e,p,d,u);
Z(this,m,g,k,a,b)}break}case "reverse":if(1<d){for(k=d-1;0<k;k--){g=q[this.rtl?d-1-k:k]+g;var h=this.score?this.score(c,q,p,g,k):Ya(r,e,p,d,k);Z(this,m,g,h,a,b)}g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[this.rtl?d-1-k:k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,this.rtl?p+1:e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const t=this.score?this.score(c,f,p,q,h-1):Ya(g+(e/2>g?0:1),e,p,k-1,h-1),u=this.bidirectional&&
q>f;Z(this,l,u?f:q,t,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function 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 k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Za(this,a[0],""))&&c.length?Aa.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Za(this,a[0],a[1]))&&c.length?Aa.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,t;l<b;l++){if((t=a[l])&&!k[t]){k[t]=1;q=Za(this,t,m);a:{f=q;var n=e,r=g,p=h;let u=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let w=0,z;w<p;w++)if(z=f[w])u[w]=z;if(u.length){n.push(u);q=void 0;break a}}q=r?void 0:u}if(q){e=q;break}m&&(g&&q&&e.length||(m=t))}g&&m&&l===b-1&&!e.length&&(h=this.resolution,m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=xa(a,h,c,d,g);else if(1===e){g=Aa.call(null,a[0],c,d);break a}g=m}return g};
function Za(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);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 $a(this.map,a),this.depth&&$a(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function $a(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;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=$a(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)?Wa[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=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;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}x=O.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};
x.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function ab(a){let c=0;if(a.constructor===Array)for(let b=0,e;b<a.length;b++)(e=a[b])&&(c+=e.length);else for(const b of a.entries()){const e=b[0],d=ab(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;ab(this.map);this.depth&&ab(this.ctx);return this};x.searchCache=Ma;
x.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 U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);break;case "map":this.map=pa(c,this.map);break;case "ctx":this.ctx=ra(c,this.ctx)}};
x.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=ua(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let k=ua(g[1],f);k="new Map(["+k+"])";k='["'+d+'",'+k+"]";e+=(e?",":"")+k}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};ja(O.prototype);C();export default {Index:O,Charset:Wa,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=O;export const Charset=Wa;export const Encoder=K;export const Document=V;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
x.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clear();b.then&&a.push(b)}if(this.tag)for(const c of this.tag.values())c.clear();this.store&&this.store.clear();this.cache&&this.cache.clear();return a.length?Promise.all(a):this};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=La;
x.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=ra(this.reg);c=null;break;case 1:d="tag";f=this.tag&&pa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&na(this.store);c=null;break;default:return}return U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=sa(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=qa(c,this.tag);break;case "doc":this.store=oa(c,this.store)}}};ia(V.prototype);function La(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 Ma={normalize:!1,numeric:!1,split:/\s+/};const Na={normalize:!0};const Oa={normalize:!0,dedupe:!0};const Pa=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 Qa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Ra=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];const Sa={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 Ta={W:Ma,V:Na,X:Oa,LatinBalance:{normalize:!0,dedupe:!0,mapper:Pa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Pa,matcher:Qa,replacer:Ra},LatinExtra:{normalize:!0,dedupe:!0,mapper:Pa,replacer:Ra.concat([/(?!^)[aeo]/g,""]),matcher:Qa},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=Sa[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===g||"w"===g||!(g=Sa[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},LatinExact:Ma,
LatinDefault:Na,LatinSimple:Oa};const Ua={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,r=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):Va(r,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(let t=0,u;t<d;t++)for(f=d;f>t;f--){g=q.substring(t,f);u=this.rtl?d-1-t:t;var k=this.score?this.score(c,q,p,g,u):Va(r,e,p,d,u);
Z(this,m,g,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){g=q[this.rtl?d-1-k:k]+g;var h=this.score?this.score(c,q,p,g,k):Va(r,e,p,d,k);Z(this,m,g,h,a,b)}g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[this.rtl?d-1-k:k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,this.rtl?p+1:e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const t=this.score?this.score(c,f,p,q,h-1):Va(g+(e/2>g?0:1),e,p,
k-1,h-1),u=this.bidirectional&&q>f;Z(this,l,u?f:q,t,a,b,u?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Va(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 k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Xa(this,a[0],""))&&c.length?za.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Xa(this,a[0],a[1]))&&c.length?za.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,t;l<b;l++){if((t=a[l])&&!k[t]){k[t]=1;q=Xa(this,t,m);a:{f=q;var n=e,r=g,p=h;let u=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let w=0,z;w<p;w++)if(z=f[w])u[w]=z;if(u.length){n.push(u);q=void 0;break a}}q=r?void 0:u}if(q){e=q;break}m&&(g&&q&&e.length||(m=t))}g&&m&&l===b-1&&!e.length&&(h=this.resolution,m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=wa(a,h,c,d,g);else if(1===e){g=za.call(null,a[0],c,d);break a}g=m}return g};
function Xa(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 Ya(this.map,a),this.depth&&Ya(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Ya(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=Ya(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({},Ua[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=D(a.encoder)?Ta[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=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"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}x=O.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};
x.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function Za(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.entries()){const e=b[0],d=Za(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;Za(this.map);this.depth&&Za(this.ctx);return this};x.searchCache=La;
x.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=ra(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=na(this.map,this.reg.size);break;case 3:d="ctx";f=pa(this.ctx,this.reg.size);break;default:return}return U.call(this,a,c,d,f,b,e)};
x.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=sa(c,this.reg);break;case "map":this.map=oa(c,this.map);break;case "ctx":this.ctx=qa(c,this.ctx)}};
x.serialize=function(a=!0){let c="",b="",e="";if(this.reg.size){let f;for(var d of this.reg.keys())f||(f=typeof d),c+=(c?",":"")+("string"===f?'"'+d+'"':d);c="index.reg=new Set(["+c+"]);";b=ta(this.map,f);b="index.map=new Map(["+b+"]);";for(const g of this.ctx.entries()){d=g[0];let k=ta(g[1],f);k="new Map(["+k+"])";k='["'+d+'",'+k+"]";e+=(e?",":"")+k}e="index.ctx=new Map(["+e+"]);"}return a?"function inject(index){"+c+b+e+"}":c+b+e};ia(O.prototype);C();export default {Index:O,Charset:Ta,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=O;export const Charset=Ta;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.142 (ES5)
* FlexSearch.js v0.8.143 (ES5)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -37,96 +37,90 @@ C("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d i
C("String.prototype.includes",function(a){return a?a:function(b,c){if(null==this)throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");return-1!==this.indexOf(b,c||0)}});
C("Array.prototype.flat",function(a){return a?a:function(b){b=void 0===b?1:b;var c=[];Array.prototype.forEach.call(this,function(d){Array.isArray(d)&&0<b?(d=Array.prototype.flat.call(d,b-1),c.push.apply(c,d)):c.push(d)});return c}});var wa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)F(d,e)&&(a[e]=d[e])}return a};C("Object.assign",function(a){return a||wa});
C("Promise.prototype.finally",function(a){return a?a:function(b){return this.then(function(c){return Promise.resolve(b()).then(function(){return c})},function(c){return Promise.resolve(b()).then(function(){throw c;})})}});function G(a,b,c){var d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(g){return a(c(g))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){b=new Map(c);d=x(a);for(e=d.next();!e.done;e=d.next())e=e.value,b.set(e[0],e[1]);return b}if(b===Set){b=new Set(c);d=x(a.values());for(e=d.next();!e.done;e=d.next())b.add(e.value);return b}}}return a}return c}return"undefined"===e?b:a}
function J(){return Object.create(null)}function K(a){return"string"===typeof a}function L(a){return"object"===typeof a}function xa(a){var b=[];a=x(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function ya(a,b){if(K(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function za(a){for(var b=0,c=0,d=void 0;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};var Aa=[["\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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];var Ba=/[^\p{L}\p{N}]+/u,Ca=/(\d{3})/g,Da=/(\D)(\d{3})/g,Ea=/(\d{3})(\D)/g,Fa="".normalize&&/[\u0300-\u036f]/g;function Ga(a){a=void 0===a?{}:a;if(!this||this.constructor!==Ga){var b=Function.prototype.bind,c=b.apply,d=[null],e=d.concat;if(arguments instanceof Array)var g=arguments;else{g=x(arguments);for(var f,h=[];!(f=g.next()).done;)h.push(f.value);g=h}return new (c.call(b,Ga,e.call(d,g)))}if(arguments.length)for(b=0;b<arguments.length;b++)this.assign(arguments[b]);else this.assign(a)}u=Ga.prototype;
function J(){return Object.create(null)}function K(a){return"string"===typeof a}function L(a){return"object"===typeof a}function xa(a){var b=[];a=x(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function ya(a,b){if(K(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function za(a){for(var b=0,c=0,d=void 0;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};var Aa=/[^\p{L}\p{N}]+/u,Ba=/(\d{3})/g,Ca=/(\D)(\d{3})/g,Da=/(\d{3})(\D)/g,Ea=/[\u0300-\u036f]/g;function Fa(a){a=void 0===a?{}:a;if(!this||this.constructor!==Fa){var b=Function.prototype.bind,c=b.apply,d=[null],e=d.concat;if(arguments instanceof Array)var g=arguments;else{g=x(arguments);for(var f,h=[];!(f=g.next()).done;)h.push(f.value);g=h}return new (c.call(b,Fa,e.call(d,g)))}if(arguments.length)for(b=0;b<arguments.length;b++)this.assign(arguments[b]);else this.assign(a)}u=Fa.prototype;
u.assign=function(a){this.normalize=G(a.normalize,!0,this.normalize);var b=a.include,c=b||a.exclude||a.split;if(c||""===c){if("object"===typeof c&&c.constructor!==RegExp){var d="";var e=!b;b||(d+="\\p{Z}");c.letter&&(d+="\\p{L}");c.number&&(d+="\\p{N}",e=!!b);c.symbol&&(d+="\\p{S}");c.punctuation&&(d+="\\p{P}");c.control&&(d+="\\p{C}");if(c=c.char)d+="object"===typeof c?c.join(""):c;try{this.split=new RegExp("["+(b?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}}else this.split=c,e=!1===c||2>"a1a".split(c).length;
this.numeric=G(a.numeric,e)}else{try{this.split=G(this.split,Ba)}catch(g){this.split=/\s+/}this.numeric=G(a.numeric,G(this.numeric,!0))}this.prepare=G(a.prepare,null,this.prepare);this.finalize=G(a.finalize,null,this.finalize);Fa||(this.mapper=new Map(Aa));c=a.filter;this.filter="function"===typeof c?c:G(c&&new Set(c),null,this.filter);this.dedupe=G(a.dedupe,!1,this.dedupe);this.matcher=G((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=G((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=
G((c=a.stemmer)&&new Map(c),null,this.stemmer);this.replacer=G(a.replacer,null,this.replacer);this.minlength=G(a.minlength,1,this.minlength);this.maxlength=G(a.maxlength,0,this.maxlength);this.rtl=G(a.rtl,!1,this.rtl);if(this.cache=c=G(a.cache,!0,this.cache))this.D=null,this.T="number"===typeof c?c:2E5,this.B=new Map,this.C=new Map,this.H=this.G=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(a=x(this.matcher.keys()),b=a.next();!b.done;b=a.next())this.h+=(this.h?"|":"")+b.value;
if(this.stemmer)for(a=x(this.stemmer.keys()),b=a.next();!b.done;b=a.next())this.A+=(this.A?"|":"")+b.value;return this};u.addStemmer=function(a,b){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,b);this.A+=(this.A?"|":"")+a;this.N=null;this.cache&&N(this);return this};u.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&N(this);return this};
this.numeric=G(a.numeric,e)}else{try{this.split=G(this.split,Aa)}catch(g){this.split=/\s+/}this.numeric=G(a.numeric,G(this.numeric,!0))}this.prepare=G(a.prepare,null,this.prepare);this.finalize=G(a.finalize,null,this.finalize);c=a.filter;this.filter="function"===typeof c?c:G(c&&new Set(c),null,this.filter);this.dedupe=G(a.dedupe,!1,this.dedupe);this.matcher=G((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=G((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=G((c=a.stemmer)&&new Map(c),
null,this.stemmer);this.replacer=G(a.replacer,null,this.replacer);this.minlength=G(a.minlength,1,this.minlength);this.maxlength=G(a.maxlength,0,this.maxlength);this.rtl=G(a.rtl,!1,this.rtl);if(this.cache=c=G(a.cache,!0,this.cache))this.D=null,this.T="number"===typeof c?c:2E5,this.B=new Map,this.C=new Map,this.H=this.G=128;this.h="";this.M=null;this.A="";this.N=null;if(this.matcher)for(a=x(this.matcher.keys()),b=a.next();!b.done;b=a.next())this.h+=(this.h?"|":"")+b.value;if(this.stemmer)for(a=x(this.stemmer.keys()),
b=a.next();!b.done;b=a.next())this.A+=(this.A?"|":"")+b.value;return this};u.addStemmer=function(a,b){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,b);this.A+=(this.A?"|":"")+a;this.N=null;this.cache&&N(this);return this};u.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&N(this);return this};
u.addMapper=function(a,b){if("object"===typeof a)return this.addReplacer(a,b);if(1<a.length)return this.addMatcher(a,b);this.mapper||(this.mapper=new Map);this.mapper.set(a,b);this.cache&&N(this);return this};u.addMatcher=function(a,b){if("object"===typeof a)return this.addReplacer(a,b);if(2>a.length&&(this.dedupe||this.mapper))return this.addMapper(a,b);this.matcher||(this.matcher=new Map);this.matcher.set(a,b);this.h+=(this.h?"|":"")+a;this.M=null;this.cache&&N(this);return this};
u.addReplacer=function(a,b){if("string"===typeof a)return this.addMatcher(a,b);this.replacer||(this.replacer=[]);this.replacer.push(a,b);this.cache&&N(this);return this};
u.encode=function(a){var b=this;if(this.cache&&a.length<=this.G)if(this.D){if(this.B.has(a))return this.B.get(a)}else this.D=setTimeout(N,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=Fa?a.normalize("NFKD").replace(Fa,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&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),
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=Ea?a.normalize("NFKD").replace(Ea,"").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 "));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||("function"===typeof this.filter?this.filter(f):!this.filter.has(f))){if(this.cache&&f.length<=this.H)if(this.D){var k=this.C.get(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+")$")),k=f,f=f.replace(this.N,function(q){return b.stemmer.get(q)}),
k!==f&&this.filter&&f.length>=this.minlength&&("function"===typeof this.filter?!this.filter(f):this.filter.has(f))&&(f=""));if(f&&(this.mapper||this.dedupe&&1<f.length)){k="";for(var l=0,m="",n=void 0,p=void 0;l<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()};var Ha,Ia;
function Ja(a){var b,c,d,e,g,f;return ta(function(h){switch(h.h){case 1:a=a.data;b=a.task;c=a.id;d=a.args;switch(b){case "init":Ia=a.options||{};(e=a.factory)?(Function("return "+e)()(self),Ha=new self.FlexSearch.Index(Ia),delete self.FlexSearch):Ha=new O(Ia);postMessage({id:c});break;default:h.h=2;return}h.h=0;break;case 2:"export"===b&&(d[1]?(d[0]=Ia.export,d[2]=0,d[3]=1):d=null);if("import"===b){if(!d[0]){h.h=5;break}return E(h,Ia.import.call(Ha,d[0]),9)}g=d&&Ha[b].apply(Ha,d);if(!g||!g.then){h.h=
5;break}return E(h,g,7);case 7:g=h.D;h.h=5;break;case 9:f=h.D,Ha.import(d[0],f);case 5:postMessage("search"===b?{id:c,msg:g}:{id:c}),h.h=0}})};function Ma(a){Na.call(a,"add");Na.call(a,"append");Na.call(a,"search");Na.call(a,"update");Na.call(a,"remove")}var Oa,Pa,Qa;function Ra(){Oa=Qa=0}
function Na(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]}Oa?Qa||(Qa=Date.now()-Pa>=this.priority*this.priority*3):(Oa=setTimeout(Ra,0),Pa=Date.now());if(Qa){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 Ta(a){function b(f){function h(k){k=k.data||k;var l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=f;this.h=J();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++Sa]=function(){k(e);1E9<Sa&&(Sa=0)};e.worker.postMessage({id:Sa,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});this.priority=a.priority||4;return this}}a=void 0===a?{}:a;if(!this||this.constructor!==Ta)return new Ta(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=Ua(c,d,a.worker);return g.then?g.then(function(f){return b.call(e,f)}):b.call(this,g)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");Ma(Ta.prototype);
function R(a){Ta.prototype[a]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if("function"===typeof d){var e=d;c.pop()}d=new Promise(function(g){"export"===a&&"function"===typeof c[0]&&(c[0]=null);b.h[++Sa]=g;b.worker.postMessage({task:a,id:Sa,args:c})});return e?(d.then(e),this):d}}
function Ua(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("string"===typeof c?c:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function Va(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*5E3|0);a=x(a.entries());for(var e=a.next();!e.done;e=a.next())d.push(e.value),d.length===b&&(c.push(d),d=[]);d.length&&c.push(d);return c}function Wa(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 Xa(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*1E3|0);a=x(a.entries());for(var e=a.next();!e.done;e=a.next())e=e.value,d.push([e[0],Va(e[1])[0]]),d.length===b&&(c.push(d),d=[]);d.length&&c.push(d);return c}function Ya(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],Wa(d[1],e));return b}function Za(a){var b=[],c=[];a=x(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 $a(a,b){b||(b=new Set);for(var c=0;c<a.length;c++)b.add(a[c]);return b}function ab(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 ab.call(l,a,b,c,h?d:null,e,g,f+1)})}return ab.call(this,a,b,c,h?d:null,e,g,f+1)}
function bb(a,b){var c="";a=x(a.entries());for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e[0];e=e[1];for(var g="",f=0,h;f<e.length;f++){h=e[f]||[""];for(var k="",l=0;l<h.length;l++)k+=(k?",":"")+("string"===b?'"'+h[l]+'"':h[l]);k="["+k+"]";g+=(g?",":"")+k}g='["'+d+'",['+g+"]]";c+=(c?",":"")+g}return c};function cb(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}
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()};var Ga,Ha;
function Ia(a){var b,c,d,e,g,f;return ta(function(h){switch(h.h){case 1:a=a.data;b=a.task;c=a.id;d=a.args;switch(b){case "init":Ha=a.options||{};(e=a.factory)?(Function("return "+e)()(self),Ga=new self.FlexSearch.Index(Ha),delete self.FlexSearch):Ga=new O(Ha);postMessage({id:c});break;default:h.h=2;return}h.h=0;break;case 2:"export"===b&&(d[1]?(d[0]=Ha.export,d[2]=0,d[3]=1):d=null);if("import"===b){if(!d[0]){h.h=5;break}return E(h,Ha.import.call(Ga,d[0]),9)}g=d&&Ga[b].apply(Ga,d);if(!g||!g.then){h.h=
5;break}return E(h,g,7);case 7:g=h.D;h.h=5;break;case 9:f=h.D,Ga.import(d[0],f);case 5:postMessage("search"===b?{id:c,msg:g}:{id:c}),h.h=0}})};function La(a){Ma.call(a,"add");Ma.call(a,"append");Ma.call(a,"search");Ma.call(a,"update");Ma.call(a,"remove")}var Na,Oa,Pa;function Qa(){Na=Pa=0}
function Ma(a){this[a+"Async"]=function(){var b=arguments,c=b[b.length-1];if("function"===typeof c){var d=c;delete b[b.length-1]}Na?Pa||(Pa=Date.now()-Oa>=this.priority*this.priority*3):(Na=setTimeout(Qa,0),Oa=Date.now());if(Pa){var e=this;return new Promise(function(f){setTimeout(function(){f(e[a+"Async"].apply(e,b))},0)})}var g=this[a].apply(this,b);c=g.then?g:new Promise(function(f){return f(g)});d&&c.then(d);return c}};var Ra=0;
function Sa(a){function b(f){function h(k){k=k.data||k;var l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=f;this.h=J();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++Ra]=function(){k(e);1E9<Ra&&(Ra=0)};e.worker.postMessage({id:Ra,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});this.priority=a.priority||4;return this}}a=void 0===a?{}:a;if(!this||this.constructor!==Sa)return new Sa(a);
var c="undefined"!==typeof self?self._factory:"undefined"!==typeof window?window._factory:null;c&&(c=c.toString());var d="undefined"===typeof window,e=this,g=Ta(c,d,a.worker);return g.then?g.then(function(f){return b.call(e,f)}):b.call(this,g)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");La(Sa.prototype);
function R(a){Sa.prototype[a]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if("function"===typeof d){var e=d;c.pop()}d=new Promise(function(g){"export"===a&&"function"===typeof c[0]&&(c[0]=null);b.h[++Ra]=g;b.worker.postMessage({task:a,id:Ra,args:c})});return e?(d.then(e),this):d}}
function Ta(a,b,c){return b?"undefined"!==typeof module?new(require("worker_threads")["Worker"])(__dirname+"/node/node.js"):import("worker_threads").then(function(worker){return new worker["Worker"]((1,eval)("import.meta.dirname")+"/node/node.mjs")}):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Ia.toString()],{type:"text/javascript"}))):new window.Worker("string"===typeof c?c:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function Ua(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*5E3|0);a=x(a.entries());for(var e=a.next();!e.done;e=a.next())d.push(e.value),d.length===b&&(c.push(d),d=[]);d.length&&c.push(d);return c}function 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=x(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=x(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){var c="";a=x(a.entries());for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e[0];e=e[1];for(var g="",f=0,h;f<e.length;f++){h=e[f]||[""];for(var k="",l=0;l<h.length;l++)k+=(k?",":"")+("string"===b?'"'+h[l]+'"':h[l]);k="["+k+"]";g+=(g?",":"")+k}g='["'+d+'",['+g+"]]";c+=(c?",":"")+g}return c};function bb(a,b,c,d){for(var e=[],g=0,f;g<a.index.length;g++)if(f=a.index[g],b>=f.length)b-=f.length;else{b=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||this.constructor!==S)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 cb(b,e||0,g||b.length,!1)};if("splice"===d)return function(e,g){return cb(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||this.constructor!==T)return new T(a);this.index=J();this.h=[];this.size=0;32<a?(this.A=db,this.B=BigInt(a)):(this.A=eb,this.B=a)}T.prototype.get=function(a){var b=this.A(a);return(b=this.index[b])&&b.get(a)};
T.prototype.set=function(a,b){var c=this.A(a),d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.h.push(d),this.size++)};function U(a){a=void 0===a?8:a;if(!this||this.constructor!==U)return new U(a);this.index=J();this.h=[];this.size=0;32<a?(this.A=db,this.B=BigInt(a)):(this.A=eb,this.B=a)}U.prototype.add=function(a){var b=this.A(a),c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c),this.size++)};
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 bb(b,e||0,g||b.length,!1)};if("splice"===d)return function(e,g){return bb(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||this.constructor!==T)return new T(a);this.index=J();this.h=[];this.size=0;32<a?(this.A=cb,this.B=BigInt(a)):(this.A=db,this.B=a)}T.prototype.get=function(a){var b=this.A(a);return(b=this.index[b])&&b.get(a)};
T.prototype.set=function(a,b){var c=this.A(a),d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.h.push(d),this.size++)};function U(a){a=void 0===a?8:a;if(!this||this.constructor!==U)return new U(a);this.index=J();this.h=[];this.size=0;32<a?(this.A=cb,this.B=BigInt(a)):(this.A=db,this.B=a)}U.prototype.add=function(a){var b=this.A(a),c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c),this.size++)};
u=T.prototype;u.has=U.prototype.has=function(a){var b=this.A(a);return(b=this.index[b])&&b.has(a)};u.delete=U.prototype.delete=function(a){var b=this.A(a);(b=this.index[b])&&b.delete(a)&&this.size--};u.clear=U.prototype.clear=function(){this.index=J();this.h=[];this.size=0};
u.values=U.prototype.values=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=x(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 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=x(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 hb(){var b,c=this,d,e,g;return ra(hb,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=x(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 eb(a){var b=Math.pow(2,this.B)-1;if("number"==typeof a)return a&b;for(var c=0,d=this.B+1,e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.B?c+Math.pow(2,31):c}
function db(){throw Error("The keystore is limited to 32 for EcmaScript5");};V.prototype.add=function(a,b,c){L(a)&&(b=a,a=ya(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(var d=0,e;d<this.field.length;d++){e=this.J[d];var 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]),ib(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=J();if("function"===typeof f){if(f=f(b),!f)continue}else{var h=
u.values=U.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=x(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 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=x(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 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=x(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.B)-1;if("number"==typeof a)return a&b;for(var c=0,d=this.B+1,e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.B?c+Math.pow(2,31):c}
function cb(){throw Error("The keystore is limited to 32 for EcmaScript5");};V.prototype.add=function(a,b,c){L(a)&&(b=a,a=ya(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(var d=0,e;d<this.field.length;d++){e=this.J[d];var 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=J();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=x(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=
J();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}jb(b,q,d,0,d[0],g)}}this.store.set(a,q||b)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function jb(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++)jb(a,b,c,d,e);else b=b[e]||(b[e]=J()),e=c[++d],jb(a,b,c,d,e)}
function ib(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++)ib(a,b,c,d,e,g,f,h);else f=b[++d],ib(a,b,c,d,e,g,f,h);else e.db&&e.remove(g)};function kb(a,b,c,d,e,g,f){var h=a.length,k=[];var l=J();for(var m=0,n=void 0,p,q;m<b;m++)for(var r=0;r<h;r++){var w=a[r];if(m<w.length&&(n=w[m]))for(var t=0;t<n.length;t++){p=n[t];(w=l[p])?l[p]++:(w=0,l[p]=1);q=k[w]||(k[w]=[]);if(!f){var A=m+(r||!e?0:g||0);q=q[A]||(q[A]=[])}q.push(p);if(f&&c&&w===h-1&&q.length-d===c)return q}}if(a=k.length)if(e)k=1<k.length?lb(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=[];
J();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)}this.worker&&(this.fastupdate||this.reg.add(a))}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]=J()),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=[];var l=J();for(var m=0,n=void 0,p,q;m<b;m++)for(var r=0;r<h;r++){var w=a[r];if(m<w.length&&(n=w[m]))for(var t=0;t<n.length;t++){p=n[t];(w=l[p])?l[p]++:(w=0,l[p]=1);q=k[w]||(k[w]=[]);if(!f){var A=m+(r||!e?0:g||0);q=q[A]||(q[A]=[])}q.push(p);if(f&&c&&w===h-1&&q.length-d===c)return 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 lb(a,b,c,d,e){var g=[],f=J(),h=a.length,k;if(d)for(e=h-1;0<=e;e--){if(k=(d=a[e])&&d.length)for(h=0;h<k;h++){var l=d[h];if(!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 w=(q+(m<h-1?e||0:0))/(m+1)|0;(g[w]||(g[w]=[])).push(l);if(++p===b)return g}}return g}
function mb(a,b,c){for(var d=J(),e=[],g=0,f;g<b.length;g++){f=b[g];for(var h=0;h<f.length;h++)d[f[h]]=1}if(c)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 nb(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 ob(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=ob(this,"or",arguments);return pb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve)};function pb(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 pb.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=lb(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=ob(this,"and",arguments),qb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)):c?this.resolve(d,e,g):this};
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{if(b=za(a))return this.result=kb(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=ob(this,"xor",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)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=sb.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 sb(a,b,c,d,e){for(var g=[],f=J(),h=0,k=0,l;k<a.length;k++)if(l=a[k]){h<l.length&&(h=l.length);for(var m=0,n;m<l.length;m++)if(n=l[m])for(var p=0,q;p<n.length;p++)q=n[p],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=ob(this,"not",arguments);return tb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)};function tb(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 tb.call(h,a,[],c,d,e,g,f)})}if(a.length&&this.result.length)this.result=ub.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 ub(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),nb.call(e,d,a||100,b,c)):d};J();V.prototype.search=function(a,b,c,d){c||(!b&&L(a)?(c=a,a=""):L(b)&&(c=b,b=0));var e=[],g=[],f,h=0,k=!0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var l=c.pluck;var m=c.merge;var n=l||c.field||(n=c.index)&&(n.index?null:n);var p=this.tag&&c.tag;var q=c.suggest;k=!1!==c.resolve;k||l||!(n=n||this.field)||(K(n)?l=n:(n.constructor===Array&&1===n.length&&(n=n[0]),l=n.field||n.index));var r=(f=this.store&&c.enrich&&k)&&c.highlight;b=c.limit||b;var w=c.offset||0;b||(b=100);if(p&&(!this.db||!d)){p.constructor!==
function kb(a,b,c,d,e){var g=[],f=J(),h=a.length,k;if(d)for(e=h-1;0<=e;e--){if(k=(d=a[e])&&d.length)for(h=0;h<k;h++){var l=d[h];if(!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 w=(q+(m<h-1?e||0:0))/(m+1)|0;(g[w]||(g[w]=[])).push(l);if(++p===b)return g}}return g}
function lb(a,b,c){for(var d=J(),e=[],g=0,f;g<b.length;g++){f=b[g];for(var h=0;h<f.length;h++)d[f[h]]=1}if(c)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?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 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===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=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};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=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?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=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?W.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(c,d,e):this}
function rb(a,b,c,d,e){for(var g=[],f=J(),h=0,k=0,l;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=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?W.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 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),mb.call(e,d,a||100,b,c)):d};J();V.prototype.search=function(a,b,c,d){c||(!b&&L(a)?(c=a,a=""):L(b)&&(c=b,b=0));var e=[],g=[],f,h=0,k=!0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var l=c.pluck;var m=c.merge;var n=l||c.field||(n=c.index)&&(n.index?null:n);var p=this.tag&&c.tag;var q=c.suggest;k=!1!==c.resolve;k||l||!(n=n||this.field)||(K(n)?l=n:(n.constructor===Array&&1===n.length&&(n=n[0]),l=n.field||n.index));var r=(f=this.store&&c.enrich&&k)&&c.highlight;b=c.limit||b;var w=c.offset||0;b||(b=100);if(p&&(!this.db||!d)){p.constructor!==
Array&&(p=[p]);for(var t=[],A=0,z=void 0;A<p.length;A++)if(z=p[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,H=void 0;y<v.length;y++)if(D=v[y],H=z[D],H.constructor===Array)for(var I=0;I<H.length;I++)t.push(D,H[I]);else t.push(D,H)}p=t;if(!a){k=[];if(t.length)for(g=0;g<t.length;g+=2){l=void 0;if(this.db){l=this.index.get(t[g]);if(!l)continue;k.push(l=l.db.tag(t[g+1],b,w,f))}else l=
vb.call(this,t[g],t[g+1],b,w,f);e.push({field:t[g],tag:t[g+1],result:l})}return k.length?Promise.all(k).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return e}):e}}n&&n.constructor!==Array&&(n=[n])}n||(n=this.field);t=!d&&(this.worker||this.db)&&[];A=0;for(y=z=v=void 0;A<n.length;A++)if(z=n[A],!this.db||!this.tag||this.J[A]){v=void 0;K(z)||(v=z,z=v.field,a=v.query||a,b=v.limit||b,w=v.offset||w,q=v.suggest||q,f=this.store&&(v.enrich||f));if(d)v=d[A];else{y=v||c;v=this.index.get(z);if(p){if(this.db){y.tag=
p;var Ka=v.db.support_tag_search;y.field=n}Ka||(y.enrich=!1)}if(t){t[A]=v.search(a,b,y);y&&f&&(y.enrich=f);continue}else v=v.search(a,b,y),y&&f&&(y.enrich=f)}y=v&&(k?v.length:v.result.length);if(p&&y){D=[];H=0;if(this.db&&d){if(!Ka)for(I=n.length;I<d.length;I++){var M=d[I];if(M&&M.length)H++,D.push(M);else if(!q)return k?e:new X(e)}}else{I=0;for(var Xb=M=void 0;I<p.length;I+=2){M=this.tag.get(p[I]);if(!M)if(q)continue;else return k?e:new X(e);if(Xb=(M=M&&M.get(p[I+1]))&&M.length)H++,D.push(M);else if(!q)return k?
e:new X(e)}}if(H){v=mb(v,D,k);y=v.length;if(!y&&!q)return k?v:new X(v);H--}}if(y)g[h]=z,e.push(v),h++;else if(1===n.length)return k?e:new X(e)}if(t){if(this.db&&p&&p.length&&!Ka)for(f=0;f<p.length;f+=2){g=this.index.get(p[f]);if(!g)if(q)continue;else return k?e:new X(e);t.push(g.db.tag(p[f+1],b,w,!1))}var Yb=this;return Promise.all(t).then(function(P){return P.length?Yb.search(a,b,c,P):P})}if(!h)return k?e:new X(e);if(l&&(!f||!this.store))return e[0];t=[];for(w=0;w<g.length;w++){q=e[w];f&&q.length&&
"undefined"===typeof q[0].doc&&(this.db?t.push(q=this.index.get(this.field[0]).db.enrich(q)):q=W.call(this,q));if(l)return k?q:new X(q);e[w]={field:g[w],result:q}}if(f&&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 m?wb(e,b):r?xb(e,a,La.index,La.field,La.J,r):e})}return m?wb(e,b):r?xb(e,a,this.index,this.field,this.J,r):e};
function xb(a,b,c,d,e,g){for(var f,h,k,l=0,m,n;l<a.length;l++){var p=a[l].result;m=a[l].field;k=c.get(m);n=k.encoder;k=k.tokenize;m=e[d.indexOf(m)];n!==f&&(f=n,h=f.encode(b));for(n=0;n<p.length;n++){var q="",r=ya(p[n].doc,m),w=f.encode(r);r=r.split(f.split);for(var t=0,A,z;t<w.length;t++)if(A=w[t],z=r[t],A&&z){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 H=A.indexOf(D);if(-1<H){q+=(q?" ":"")+z.substring(0,H)+g.replace("$1",
z.substring(H,D.length))+z.substring(H+D.length);v=!0;break}}v||(q+=(q?" ":"")+r[t])}p[n].highlight=q}}return a}function wb(a,b){for(var c=[],d=J(),e=0,g,f;e<a.length;e++){g=a[e];f=g.result;for(var h=0,k,l,m;h<f.length;h++)if(l=f[h],"object"!==typeof l&&(l={id:l}),k=l.id,m=d[k])m.push(g.field);else{if(c.length===b)return c;l.field=d[k]=[g.field];c.push(l)}}return c}
function vb(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)&&yb(c,this.S)||"id";(d=a.keystore||0)&&(this.keystore=d);this.fastupdate=!!a.fastupdate;this.reg=!this.fastupdate||a.worker||a.db?d?new U(d):new Set:d?new T(d):new Map;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.priority=a.priority||4;this.index=
zb.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]=yb(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){this.fastupdate=!1;a=[];c=x(this.index.values());
ub.call(this,t[g],t[g+1],b,w,f);e.push({field:t[g],tag:t[g+1],result:l})}return k.length?Promise.all(k).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return e}):e}}n&&n.constructor!==Array&&(n=[n])}n||(n=this.field);t=!d&&(this.worker||this.db)&&[];A=0;for(y=z=v=void 0;A<n.length;A++)if(z=n[A],!this.db||!this.tag||this.J[A]){v=void 0;K(z)||(v=z,z=v.field,a=v.query||a,b=v.limit||b,w=v.offset||w,q=v.suggest||q,f=this.store&&(v.enrich||f));if(d)v=d[A];else{y=v||c;v=this.index.get(z);if(p){if(this.db){y.tag=
p;var Ja=v.db.support_tag_search;y.field=n}Ja||(y.enrich=!1)}if(t){t[A]=v.search(a,b,y);y&&f&&(y.enrich=f);continue}else v=v.search(a,b,y),y&&f&&(y.enrich=f)}y=v&&(k?v.length:v.result.length);if(p&&y){D=[];H=0;if(this.db&&d){if(!Ja)for(I=n.length;I<d.length;I++){var M=d[I];if(M&&M.length)H++,D.push(M);else if(!q)return k?e:new X(e)}}else{I=0;for(var Yb=M=void 0;I<p.length;I+=2){M=this.tag.get(p[I]);if(!M)if(q)continue;else return k?e:new X(e);if(Yb=(M=M&&M.get(p[I+1]))&&M.length)H++,D.push(M);else if(!q)return k?
e:new X(e)}}if(H){v=lb(v,D,k);y=v.length;if(!y&&!q)return k?v:new X(v);H--}}if(y)g[h]=z,e.push(v),h++;else if(1===n.length)return k?e:new X(e)}if(t){if(this.db&&p&&p.length&&!Ja)for(f=0;f<p.length;f+=2){g=this.index.get(p[f]);if(!g)if(q)continue;else return k?e:new X(e);t.push(g.db.tag(p[f+1],b,w,!1))}var Zb=this;return Promise.all(t).then(function(P){return P.length?Zb.search(a,b,c,P):P})}if(!h)return k?e:new X(e);if(l&&(!f||!this.store))return e[0];t=[];for(w=0;w<g.length;w++){q=e[w];f&&q.length&&
"undefined"===typeof q[0].doc&&(this.db?t.push(q=this.index.get(this.field[0]).db.enrich(q)):q=W.call(this,q));if(l)return k?q:new X(q);e[w]={field:g[w],result:q}}if(f&&this.db&&t.length){var Ka=this;return Promise.all(t).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return m?vb(e,b):r?wb(e,a,Ka.index,Ka.field,Ka.J,r):e})}return m?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;l<a.length;l++){var p=a[l].result;m=a[l].field;k=c.get(m);n=k.encoder;k=k.tokenize;m=e[d.indexOf(m)];n!==f&&(f=n,h=f.encode(b));for(n=0;n<p.length;n++){var q="",r=ya(p[n].doc,m),w=f.encode(r);r=r.split(f.split);for(var t=0,A,z;t<w.length;t++)if(A=w[t],z=r[t],A&&z){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 H=A.indexOf(D);if(-1<H){q+=(q?" ":"")+z.substring(0,H)+g.replace("$1",
z.substring(H,D.length))+z.substring(H+D.length);v=!0;break}}v||(q+=(q?" ":"")+r[t])}p[n].highlight=q}}return a}function vb(a,b){for(var c=[],d=J(),e=0,g,f;e<a.length;e++){g=a[e];f=g.result;for(var h=0,k,l,m;h<f.length;h++)if(l=f[h],"object"!==typeof l&&(l={id:l}),k=l.id,m=d[k])m.push(g.field);else{if(c.length===b)return c;l.field=d[k]=[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=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)&&xb(c,this.S)||"id";(d=a.keystore||0)&&(this.keystore=d);this.fastupdate=!!a.fastupdate;this.reg=!this.fastupdate||a.worker||a.db?d?new U(d):new Set:d?new T(d):new Map;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.priority=a.priority||4;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){this.fastupdate=!1;a=[];c=x(this.index.values());
for(b=c.next();!b.done;b=c.next())b=b.value,b.then&&a.push(b);if(a.length){var g=this;return Promise.all(a).then(function(f){for(var h=0,k=x(g.index.entries()),l=k.next();!l.done;l=k.next()){l=l.value;var m=l[0];l[1].then&&g.index.set(m,f[h++])}return g})}}else a.db&&(this.fastupdate=!1,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)};
u.commit=function(a,b){var c=this,d,e,g,f;return ta(function(h){if(1==h.h){d=[];e=x(c.index.values());for(g=e.next();!g.done;g=e.next())f=g.value,d.push(f.commit(a,b));return E(h,Promise.all(d),2)}c.reg.clear();h.h=0})};u.destroy=function(){for(var a=[],b=x(this.index.values()),c=b.next();!c.done;c=b.next())a.push(c.value.destroy());return Promise.all(a)};
function zb(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=L(f)?Object.assign({},a,f):a;if(this.worker){var h=new Ta(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]=yb(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]=yb(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 yb(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=L(f)?Object.assign({},a,f):a;if(this.worker){var h=new Sa(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]=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){L(a)&&(a=ya(a,this.key));for(var b=x(this.index.values()),c=b.next();!c.done;c=b.next())c.value.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(b=x(this.tag.values()),c=b.next();!c.done;c=b.next()){c=c.value;for(var d=x(c),e=d.next();!e.done;e=d.next()){var g=e.value;e=g[0];g=g[1];var f=g.indexOf(a);-1<f&&(1<g.length?g.splice(f,1):c.delete(e))}}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
u.clear=function(){for(var a=[],b=x(this.index.values()),c=b.next();!c.done;c=b.next())c=c.value.clear(),c.then&&a.push(c);if(this.tag)for(b=x(this.tag.values()),c=b.next();!c.done;c=b.next())c.value.clear();this.store&&this.store.clear();this.cache&&this.cache.clear();return a.length?Promise.all(a):this};u.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};
u.cleanup=function(){for(var a=x(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=Ab;
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=Za(this.reg);b=null;break;case 1:f="tag";h=this.tag&&Xa(this.tag,this.reg.size);b=null;break;case 2:f="doc";h=this.store&&Va(this.store);b=null;break;default:return}return ab.call(this,a,b,f,h,c,d)};
u.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();var d=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&d)return this.index.get(d).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(d)return this.index.get(d).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=$a(b,this.reg);for(b=0;b<this.field.length;b++)d=this.index.get(this.field[b]),d.fastupdate=!1,d.reg=this.reg;if(this.worker){b=[];d=x(this.index.values());for(c=d.next();!c.done;c=d.next())b.push(c.value.import(a));
return Promise.all(b)}break;case "tag":this.tag=Ya(b,this.tag);break;case "doc":this.store=Wa(b,this.store)}}};Ma(V.prototype);function Ab(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=x(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};var Bb={normalize:function(a){return a.toLowerCase()}};var Cb=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 Db=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Eb=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];var Fb={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 Gb=/[\x00-\x7F]+/g;var Hb=/[\x00-\x7F]+/g;var Ib=/[\x00-\x7F]+/g;var Jb={LatinExact:{split:/\s+/,normalize:!1},LatinDefault:Bb,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Cb},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Cb,matcher:Db,replacer:Eb},LatinExtra:{normalize:!0,dedupe:!0,mapper:Cb,replacer:Eb.concat([/(?!^)[aeo]/g,""]),matcher:Db},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=Fb[d],g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||"w"===
f||!(f=Fb[f])||f===e||(d+=f,e=f,4!==d.length));g++);a[b]=d}}},ArabicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Gb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Hb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ib," ")}}};var Kb={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){for(var e=J(),g=J(),f=this.depth,h=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(f||!g[l])){var n=this.score?this.score(b,l,k,null,0):Lb(h,d,k),p="";switch(this.tokenize){case "full":if(2<m){n=0;for(var q;n<m;n++)for(var r=m;r>n;r--)p=l.substring(n,r),q=this.rtl?m-1-n:n,q=this.score?this.score(b,l,k,p,q):Lb(h,d,k,m,q),Mb(this,g,p,
q,a,c);break}case "reverse":if(1<m){for(r=m-1;0<r;r--)p=l[this.rtl?m-1-r:r]+p,q=this.score?this.score(b,l,k,p,r):Lb(h,d,k,m,r),Mb(this,g,p,q,a,c);p=""}case "forward":if(1<m){for(r=0;r<m;r++)p+=l[this.rtl?m-1-r:r],Mb(this,g,p,n,a,c);break}default:if(Mb(this,g,l,n,a,c),f&&1<d&&k<d-1)for(m=J(),p=this.da,n=l,r=Math.min(f+1,this.rtl?k+1:d-k),q=m[n]=1;q<r;q++)if((l=b[this.rtl?d-1-k-q:k+q])&&!m[l]){m[l]=1;var w=this.score?this.score(b,n,k,l,q-1):Lb(p+(d/2>p?0:1),d,k,r-1,q-1),t=this.bidirectional&&l>n;Mb(this,
e,t?n:l,w,a,c,t?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.ca&&Nb(this));return this};
function Mb(a,b,c,d,e,g,f){var h=f?a.ctx:a.map,k;if(!b[c]||f&&!(k=b[c])[f])if(f?(b=k||(b[c]=J()),b[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!g||!h.includes(e)){if(h.length===Math.pow(2,31)-1){b=new S(h);if(a.fastupdate)for(c=x(a.reg.values()),g=c.next();!g.done;g=c.next())g=g.value,g.includes(h)&&(g[g.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}
function Lb(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&&L(a)?(c=a,a=""):L(b)&&(c=b,b=0));var d=[],e=0,g;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var 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 Ob.call(this,p[0],"",b,e,g,k,n);f=this.depth&&!1!==f;if(2===q&&f&&!h)return Ob.call(this,p[0],p[1],b,e,g,k,n);var r=J(),w=0;if(1<q&&f){var t=p[0];w=
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(!(w<q)){y.h=4;break}v=p[w];if(!v||r[v]){y.h=5;break}r[v]=1;return E(y,Pb(A,v,t,0,0,!1,!1),6);case 6:z=y.D;if(z=Qb(z,d,h,m)){d=z;y.h=4;break}t&&(h&&z&&d.length||(t=v));case 5:h&&t&&w===q-1&&!d.length&&(m=A.resolution,t="",w=-1,r=J());w++;y.h=2;break;case 4:return y.return(Rb(d,
m,b,e,h,l,g))}})}()}for(c=a=void 0;w<q;w++){if((c=p[w])&&!r[c]){r[c]=1;a=Pb(this,c,t,0,0,!1,!1);if(a=Qb(a,d,h,m)){d=a;break}t&&(h&&a&&d.length||(t=c))}h&&t&&w===q-1&&!d.length&&(m=this.resolution,t="",w=-1,r=J())}return Rb(d,m,b,e,h,l,g)};function Rb(a,b,c,d,e,g,f){var h=a.length,k=a;if(1<h)k=kb(a,b,c,d,e,g,f);else if(1===h)return f?nb.call(null,a[0],c,d):new X(a[0]);return f?k:new X(k)}
function Ob(a,b,c,d,e,g,f){a=Pb(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?nb.call(this,a,c,d):new X(a):e?[]:new X}function Qb(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 Pb(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 Sb(this.map,a),this.depth&&Sb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.ca&&Nb(this));this.cache&&this.cache.remove(a);return this};
function Sb(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=x(a.entries()),e=d.next();!e.done;e=d.next())g=e.value,e=g[0],(g=Sb(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({},Kb[c],a))}else a={};c=a.context;var d=!0===c?{depth:1}:c||{},e=K(a.encoder)?Jb[a.encoder]:a.encode||a.encoder||Bb;this.encoder=e.encode?e:"object"===typeof e?new Ga(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=c=(c=a.tokenize)&&"default"!==c&&c||"strict";this.depth="strict"===c&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;(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 Nb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},1))}
u.cleanup=function(){for(var a=x(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=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=this.tag&&Wa(this.tag,this.reg.size);b=null;break;case 2:f="doc";h=this.store&&Ua(this.store);b=null;break;default:return}return $a.call(this,a,b,f,h,c,d)};
u.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();var d=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&d)return this.index.get(d).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(d)return this.index.get(d).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);for(b=0;b<this.field.length;b++)d=this.index.get(this.field[b]),d.fastupdate=!1,d.reg=this.reg;if(this.worker){b=[];d=x(this.index.values());for(c=d.next();!c.done;c=d.next())b.push(c.value.import(a));
return Promise.all(b)}break;case "tag":this.tag=Xa(b,this.tag);break;case "doc":this.store=Va(b,this.store)}}};La(V.prototype);function zb(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=x(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};var Ab={normalize:!1,numeric:!1,split:/\s+/};var Bb={normalize:!0};var Cb={normalize:!0,dedupe:!0};var Db=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 Eb=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Fb=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"];var Gb={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 Hb={na:Ab,ma:Bb,oa:Cb,LatinBalance:{normalize:!0,dedupe:!0,mapper:Db},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Db,matcher:Eb,replacer:Fb},LatinExtra:{normalize:!0,dedupe:!0,mapper:Db,replacer:Fb.concat([/(?!^)[aeo]/g,""]),matcher:Eb},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=Gb[d],g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||"w"===f||!(f=Gb[f])||f===e||(d+=f,e=f,4!==d.length));g++);a[b]=d}}},LatinExact:Ab,
LatinDefault:Bb,LatinSimple:Cb};var Ib={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};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=J(),g=J(),f=this.depth,h=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(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){n=0;for(var q;n<m;n++)for(var r=m;r>n;r--)p=l.substring(n,r),q=this.rtl?m-1-n:n,q=this.score?this.score(b,l,k,p,q):Jb(h,d,k,m,q),Kb(this,g,p,
q,a,c);break}case "bidirectional":case "reverse":if(1<m){for(r=m-1;0<r;r--)p=l[this.rtl?m-1-r:r]+p,q=this.score?this.score(b,l,k,p,r):Jb(h,d,k,m,r),Kb(this,g,p,q,a,c);p=""}case "forward":if(1<m){for(r=0;r<m;r++)p+=l[this.rtl?m-1-r:r],Kb(this,g,p,n,a,c);break}default:if(Kb(this,g,l,n,a,c),f&&1<d&&k<d-1)for(m=J(),p=this.da,n=l,r=Math.min(f+1,this.rtl?k+1:d-k),q=m[n]=1;q<r;q++)if((l=b[this.rtl?d-1-k-q:k+q])&&!m[l]){m[l]=1;var w=this.score?this.score(b,n,k,l,q-1):Jb(p+(d/2>p?0:1),d,k,r-1,q-1),t=this.bidirectional&&
l>n;Kb(this,e,t?n:l,w,a,c,t?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.ca&&Lb(this));return this};
function Kb(a,b,c,d,e,g,f){var h=f?a.ctx:a.map,k;if(!b[c]||f&&!(k=b[c])[f])if(f?(b=k||(b[c]=J()),b[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!g||!h.includes(e)){if(h.length===Math.pow(2,31)-1){b=new S(h);if(a.fastupdate)for(c=x(a.reg.values()),g=c.next();!g.done;g=c.next())g=g.value,g.includes(h)&&(g[g.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}
function 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&&L(a)?(c=a,a=""):L(b)&&(c=b,b=0));var d=[],e=0,g;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var 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=J(),w=0;if(1<q&&f){var t=p[0];w=
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(!(w<q)){y.h=4;break}v=p[w];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.D;if(z=Ob(z,d,h,m)){d=z;y.h=4;break}t&&(h&&z&&d.length||(t=v));case 5:h&&t&&w===q-1&&!d.length&&(m=A.resolution,t="",w=-1,r=J());w++;y.h=2;break;case 4:return y.return(Pb(d,
m,b,e,h,l,g))}})}()}for(c=a=void 0;w<q;w++){if((c=p[w])&&!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&&w===q-1&&!d.length&&(m=this.resolution,t="",w=-1,r=J())}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=jb(a,b,c,d,e,g,f);else if(1===h)return f?mb.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?mb.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=x(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||Bb;this.encoder=e.encode?e:"object"===typeof e?new Fa(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=c=(c=a.tokenize)&&"default"!==c&&"exact"!==c&&c||"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)},1))}
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 Tb(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=x(a.entries()),d=c.next();!d.done;d=c.next()){var e=d.value;d=e[0];(e=Tb(e[1]))?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Tb(this.map);this.depth&&Tb(this.ctx);return this};u.searchCache=Ab;
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=Za(this.reg);break;case 1:e="cfg";g=null;break;case 2:e="map";g=Va(this.map,this.reg.size);break;case 3:e="ctx";g=Xa(this.ctx,this.reg.size);break;default:return}return ab.call(this,a,b,e,g,c,d)};
u.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=$a(b,this.reg);break;case "map":this.map=Wa(b,this.map);break;case "ctx":this.ctx=Ya(b,this.ctx)}};
u.serialize=function(a){a=void 0===a?!0:a;var b="",c="",d="";if(this.reg.size){var e;c=x(this.reg.keys());for(var g=c.next();!g.done;g=c.next())g=g.value,e||(e=typeof g),b+=(b?",":"")+("string"===e?'"'+g+'"':g);b="index.reg=new Set(["+b+"]);";c=bb(this.map,e);c="index.map=new Map(["+c+"]);";g=x(this.ctx.entries());for(var f=g.next();!f.done;f=g.next()){var h=f.value;f=h[0];h=bb(h[1],e);h="new Map(["+h+"])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}d="index.ctx=new Map(["+d+"]);"}return a?"function inject(index){"+
b+c+d+"}":b+c+d};Ma(O.prototype);var Ub="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Vb=["map","ctx","tag","reg","cfg"],Wb=J();
function Zb(a,b){b=void 0===b?{}:b;if(!this)return new Zb(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=Zb.prototype;u.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
u.open=function(){if(this.db)return this.db;var a=this;navigator.storage&&navigator.storage.persist();Wb[a.id]||(Wb[a.id]=[]);Wb[a.id].push(a.field);var b=Ub.open(a.id,1);b.onupgradeneeded=function(){for(var c=a.db=this.result,d=0,e;d<Vb.length;d++){e=Vb[d];for(var g=0,f;g<Wb[a.id].length;g++)f=Wb[a.id][g],c.objectStoreNames.contains(e+("reg"!==e?f?":"+f:"":""))||c.createObjectStore(e+("reg"!==e?f?":"+f:"":""))}};return a.db=Z(b,function(c){a.db=c;a.db.onversionchange=function(){a.close()}})};
u.close=function(){this.db&&this.db.close();this.db=null};u.destroy=function(){var a=Ub.deleteDatabase(this.id);return Z(a)};u.clear=function(){for(var a=[],b=0,c;b<Vb.length;b++){c=Vb[b];for(var d=0,e;d<Wb[this.id].length;d++)e=Wb[this.id][d],a.push(c+("reg"!==c?e?":"+e:"":""))}b=this.db.transaction(a,"readwrite");for(c=0;c<a.length;c++)b.objectStore(a[c]).clear();return Z(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=x(a.entries()),d=c.next();!d.done;d=c.next()){var e=d.value;d=e[0];(e=Rb(e[1]))?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Rb(this.map);this.depth&&Rb(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(),3===a.length&&a.shift(),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;var b="",c="",d="";if(this.reg.size){var e;c=x(this.reg.keys());for(var g=c.next();!g.done;g=c.next())g=g.value,e||(e=typeof g),b+=(b?",":"")+("string"===e?'"'+g+'"':g);b="index.reg=new Set(["+b+"]);";c=ab(this.map,e);c="index.map=new Map(["+c+"]);";g=x(this.ctx.entries());for(var f=g.next();!f.done;f=g.next()){var h=f.value;f=h[0];h=ab(h[1],e);h="new Map(["+h+"])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}d="index.ctx=new Map(["+d+"]);"}return a?"function inject(index){"+
b+c+d+"}":b+c+d};La(O.prototype);var Sb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Tb=["map","ctx","tag","reg","cfg"],Ub=J();
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(){if(this.db)return this.db;var a=this;navigator.storage&&navigator.storage.persist();Ub[a.id]||(Ub[a.id]=[]);Ub[a.id].push(a.field);var b=Sb.open(a.id,1);b.onupgradeneeded=function(){for(var c=a.db=this.result,d=0,e;d<Tb.length;d++){e=Tb[d];for(var g=0,f;g<Ub[a.id].length;g++)f=Ub[a.id][g],c.objectStoreNames.contains(e+("reg"!==e?f?":"+f:"":""))||c.createObjectStore(e+("reg"!==e?f?":"+f:"":""))}};return a.db=Z(b,function(c){a.db=c;a.db.onversionchange=function(){a.close()}})};
u.close=function(){this.db&&this.db.close();this.db=null};u.destroy=function(){var a=Sb.deleteDatabase(this.id);return Z(a)};u.clear=function(){for(var a=[],b=0,c;b<Tb.length;b++){c=Tb[b];for(var d=0,e;d<Ub[this.id].length;d++)e=Ub[this.id][d],a.push(c+("reg"!==c?e?":"+e:"":""))}b=this.db.transaction(a,"readwrite");for(c=0;c<a.length;c++)b.objectStore(a[c]).clear();return Z(b)};
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")+(this.field?":"+this.field:""),"readonly").objectStore((b?"ctx":"map")+(this.field?":"+this.field:"")).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"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).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).then(function(b){return!!b})};u.search=null;u.info=function(){};
@@ -136,6 +130,6 @@ u.commit=function(a,b,c){var d=this,e,g,f;return ta(function(h){switch(h.h){case
function(k){for(var l=x(a.ctx),m=l.next(),n={};!m.done;n={V:void 0},m=l.next()){m=m.value;n.V=m[0];m=x(m[1]);for(var p=m.next(),q={};!p.done;q={P:void 0,Z:void 0},p=m.next())p=p.value,q.Z=p[0],q.P=p[1],q.P.length&&(b?k.put(q.P,n.V+":"+q.Z):k.get(n.V+":"+q.Z).onsuccess=function(r,w){return function(){var t=this.result,A;if(t&&t.length)for(var z=Math.max(t.length,r.P.length),v=0,y;v<z;v++){if((y=r.P[v])&&y.length){if((A=t[v])&&A.length)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,w.V+":"+r.Z)}}(q,n))}}),14);case 14:if(a.store)return E(h,d.transaction("reg","readwrite",function(k){for(var l=x(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=x(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=
x(a.tag),m=l.next(),n={};!m.done;n={X:void 0,ba:void 0},m=l.next())m=m.value,n.ba=m[0],n.X=m[1],n.X.length&&(k.get(n.ba).onsuccess=function(p){return function(){var q=this.result;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 $b(a,b,c){for(var d=a.value,e,g=0,f=0,h;f<d.length;f++){if(h=c?d:d[f]){for(var k=0,l;k<b.length;k++)if(l=b[k],l=h.indexOf(l),0<=l)if(e=1,1<h.length)h.splice(l,1);else{d[f]=[];break}g+=h.length}if(c)break}g?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&&$b(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&$b(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&$b(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a,b){return new Promise(function(c,d){a.onsuccess=a.oncomplete=function(){b&&b(this.result);b=null;c(this.result)};a.onerror=a.onblocked=d;a=null})};var ac={Index:O,Charset:Jb,Encoder:Ga,Document:V,Worker:Ta,Resolver:X,IndexedDB:Zb,Language:{}},bc="undefined"!==typeof self?self:"undefined"!==typeof global?global:self,cc;(cc=bc.define)&&cc.amd?cc([],function(){return ac}):"object"===typeof bc.exports?bc.exports=ac:bc.FlexSearch=ac;}(this||self));
function Wb(a,b,c){for(var d=a.value,e,g=0,f=0,h;f<d.length;f++){if(h=c?d:d[f]){for(var k=0,l;k<b.length;k++)if(l=b[k],l=h.indexOf(l),0<=l)if(e=1,1<h.length)h.splice(l,1);else{d[f]=[];break}g+=h.length}if(c)break}g?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&&Wb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Wb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Wb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a,b){return new Promise(function(c,d){a.onsuccess=a.oncomplete=function(){b&&b(this.result);b=null;c(this.result)};a.onerror=a.onblocked=d;a=null})};var Xb={Index:O,Charset:Hb,Encoder:Fa,Document:V,Worker:Sa,Resolver:X,IndexedDB:Vb,Language:{}},$b="undefined"!==typeof self?self:"undefined"!==typeof global?global:self,ac;(ac=$b.define)&&ac.amd?ac([],function(){return Xb}):"object"===typeof $b.exports?$b.exports=Xb:$b.FlexSearch=Xb;}(this||self));

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.142 (Light/Debug)
* FlexSearch.js v0.8.143 (Light/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -7,29 +7,29 @@
*/
(function(self){'use strict';
var r;
function u(a, c, b) {
const f = typeof b, d = typeof a;
function u(a, d, b) {
const f = typeof b, c = typeof a;
if ("undefined" !== f) {
if ("undefined" !== d) {
if ("undefined" !== c) {
if (b) {
if ("function" === d && f === d) {
if ("function" === c && f === c) {
return function(h) {
return a(b(h));
};
}
c = a.constructor;
if (c === b.constructor) {
if (c === Array) {
d = a.constructor;
if (d === b.constructor) {
if (d === Array) {
return b.concat(a);
}
if (c === Map) {
if (d === Map) {
var g = new Map(b);
for (var e of a) {
g.set(e[0], e[1]);
}
return g;
}
if (c === Set) {
if (d === Set) {
e = new Set(b);
for (g of a.values()) {
e.add(g);
@@ -42,12 +42,12 @@ function u(a, c, b) {
}
return b;
}
return "undefined" === d ? c : a;
return "undefined" === c ? d : a;
}
function w() {
return Object.create(null);
}
;const y = /[^\p{L}\p{N}]+/u, z = /(\d{3})/g, B = /(\D)(\d{3})/g, C = /(\d{3})(\D)/g, E = "".normalize && /[\u0300-\u036f]/g;
;const y = /[^\p{L}\p{N}]+/u, z = /(\d{3})/g, B = /(\D)(\d{3})/g, D = /(\d{3})(\D)/g, E = /[\u0300-\u036f]/g;
function F(a = {}) {
if (!this || this.constructor !== F) {
return new F(...arguments);
@@ -63,22 +63,22 @@ function F(a = {}) {
r = F.prototype;
r.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split, f;
let d = a.include, b = d || a.exclude || a.split, f;
if (b || "" === b) {
if ("object" === typeof b && b.constructor !== RegExp) {
let d = "";
f = !c;
c || (d += "\\p{Z}");
b.letter && (d += "\\p{L}");
b.number && (d += "\\p{N}", f = !!c);
b.symbol && (d += "\\p{S}");
b.punctuation && (d += "\\p{P}");
b.control && (d += "\\p{C}");
let c = "";
f = !d;
d || (c += "\\p{Z}");
b.letter && (c += "\\p{L}");
b.number && (c += "\\p{N}", f = !!d);
b.symbol && (c += "\\p{S}");
b.punctuation && (c += "\\p{P}");
b.control && (c += "\\p{C}");
if (b = b.char) {
d += "object" === typeof b ? b.join("") : b;
c += "object" === typeof b ? b.join("") : b;
}
try {
this.split = new RegExp("[" + (c ? "^" : "") + d + "]+", "u");
this.split = new RegExp("[" + (d ? "^" : "") + c + "]+", "u");
} catch (g) {
console.error("Your split configuration:", b, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
@@ -89,7 +89,7 @@ r.assign = function(a) {
} else {
try {
this.split = u(this.split, y);
} catch (d) {
} catch (c) {
console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
this.numeric = u(a.numeric, u(this.numeric, !0));
@@ -114,20 +114,20 @@ r.assign = function(a) {
this.h = "";
this.u = null;
if (this.matcher) {
for (const d of this.matcher.keys()) {
this.g += (this.g ? "|" : "") + d;
for (const c of this.matcher.keys()) {
this.g += (this.g ? "|" : "") + c;
}
}
if (this.stemmer) {
for (const d of this.stemmer.keys()) {
this.h += (this.h ? "|" : "") + d;
for (const c of this.stemmer.keys()) {
this.h += (this.h ? "|" : "") + c;
}
}
return this;
};
r.addStemmer = function(a, c) {
r.addStemmer = function(a, d) {
this.stemmer || (this.stemmer = new Map());
this.stemmer.set(a, c);
this.stemmer.set(a, d);
this.h += (this.h ? "|" : "") + a;
this.u = null;
this.cache && G(this);
@@ -138,38 +138,38 @@ r.addFilter = function(a) {
this.cache && G(this);
return this;
};
r.addMapper = function(a, c) {
r.addMapper = function(a, d) {
if ("object" === typeof a) {
return this.addReplacer(a, c);
return this.addReplacer(a, d);
}
if (1 < a.length) {
return this.addMatcher(a, c);
return this.addMatcher(a, d);
}
this.mapper || (this.mapper = new Map());
this.mapper.set(a, c);
this.mapper.set(a, d);
this.cache && G(this);
return this;
};
r.addMatcher = function(a, c) {
r.addMatcher = function(a, d) {
if ("object" === typeof a) {
return this.addReplacer(a, c);
return this.addReplacer(a, d);
}
if (2 > a.length && (this.dedupe || this.mapper)) {
return this.addMapper(a, c);
return this.addMapper(a, d);
}
this.matcher || (this.matcher = new Map());
this.matcher.set(a, c);
this.matcher.set(a, d);
this.g += (this.g ? "|" : "") + a;
this.s = null;
this.cache && G(this);
return this;
};
r.addReplacer = function(a, c) {
r.addReplacer = function(a, d) {
if ("string" === typeof a) {
return this.addMatcher(a, c);
return this.addMatcher(a, d);
}
this.replacer || (this.replacer = []);
this.replacer.push(a, c);
this.replacer.push(a, d);
this.cache && G(this);
return this;
};
@@ -185,38 +185,38 @@ r.encode = function(a) {
}
this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = E ? a.normalize("NFKD").replace(E, "").toLowerCase() : a.toLowerCase());
this.prepare && (a = this.prepare(a));
this.numeric && 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);
this.numeric && 3 < a.length && (a = a.replace(B, "$1 $2").replace(D, "$1 $2").replace(z, "$1 "));
const d = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
let b = [], f = this.split || "" === this.split ? a.split(this.split) : a;
for (let g = 0, e, h; g < f.length; g++) {
if ((e = h = f[g]) && !(e.length < this.minlength)) {
if (c) {
if (d) {
b.push(e);
} else {
if (!this.filter || ("function" === typeof this.filter ? this.filter(e) : !this.filter.has(e))) {
if (this.cache && e.length <= this.o) {
if (this.l) {
var d = this.j.get(e);
if (d || "" === d) {
d && b.push(d);
var c = this.j.get(e);
if (c || "" === c) {
c && b.push(c);
continue;
}
} else {
this.l = setTimeout(G, 50, this);
}
}
this.stemmer && 2 < e.length && (this.u || (this.u = new RegExp("(?!^)(" + this.h + ")$")), d = e, e = e.replace(this.u, k => this.stemmer.get(k)), d !== e && this.filter && e.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(e) : this.filter.has(e)) && (e = ""));
this.stemmer && 2 < e.length && (this.u || (this.u = new RegExp("(?!^)(" + this.h + ")$")), c = e, e = e.replace(this.u, k => this.stemmer.get(k)), c !== e && this.filter && e.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(e) : this.filter.has(e)) && (e = ""));
if (e && (this.mapper || this.dedupe && 1 < e.length)) {
d = "";
c = "";
for (let k = 0, n = "", m, v; k < e.length; k++) {
m = e.charAt(k), m === n && this.dedupe || ((v = this.mapper && this.mapper.get(m)) || "" === v ? v === n && this.dedupe || !(n = v) || (d += v) : d += n = m);
m = e.charAt(k), m === n && this.dedupe || ((v = this.mapper && this.mapper.get(m)) || "" === v ? v === n && this.dedupe || !(n = v) || (c += v) : c += n = m);
}
e = d;
e = c;
}
this.matcher && 1 < e.length && (this.s || (this.s = new RegExp("(" + this.g + ")", "g")), e = e.replace(this.s, k => this.matcher.get(k)));
if (e && this.replacer) {
for (d = 0; e && d < this.replacer.length; d += 2) {
e = e.replace(this.replacer[d], this.replacer[d + 1]);
for (c = 0; e && c < this.replacer.length; c += 2) {
e = e.replace(this.replacer[c], this.replacer[c + 1]);
}
}
this.cache && h.length <= this.o && (this.j.set(h, e), this.j.size > this.A && (this.j.clear(), this.o = this.o / 1.1 | 0));
@@ -234,30 +234,30 @@ function G(a) {
a.i.clear();
a.j.clear();
}
;function H(a, c, b) {
;function H(a, d, b) {
if (!a.length) {
return a;
}
if (1 === a.length) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a;
return a = a[0], a = b || a.length > d ? d ? a.slice(b, b + d) : a.slice(b) : a;
}
let f = [];
for (let d = 0, g, e; d < a.length; d++) {
if ((g = a[d]) && (e = g.length)) {
for (let c = 0, g, e; c < a.length; c++) {
if ((g = a[c]) && (e = g.length)) {
if (b) {
if (b >= e) {
b -= e;
continue;
}
b < e && (g = c ? g.slice(b, b + c) : g.slice(b), e = g.length, b = 0);
b < e && (g = d ? g.slice(b, b + d) : g.slice(b), e = g.length, b = 0);
}
e > c && (g = g.slice(0, c), e = c);
if (!f.length && e >= c) {
e > d && (g = g.slice(0, d), e = d);
if (!f.length && e >= d) {
return g;
}
f.push(g);
c -= e;
if (!c) {
d -= e;
if (!d) {
break;
}
}
@@ -265,83 +265,58 @@ function G(a) {
return f = 1 < f.length ? [].concat.apply([], f) : f[0];
}
;w();
function I(a) {
this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map();
this.g = "";
}
I.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);
};
I.prototype.get = function(a) {
const c = this.cache.get(a);
c && this.g !== a && (this.cache.delete(a), this.cache.set(this.g = a, c));
return c;
};
I.prototype.remove = function(a) {
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
I.prototype.clear = function() {
this.cache.clear();
this.g = "";
};
const J = {normalize:function(a) {
return a.toLowerCase();
}};
const K = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
L.prototype.add = function(a, c, b, f) {
if (c && (a || 0 === a)) {
const I = {normalize:!0};
const J = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
K.prototype.add = function(a, d, b, f) {
if (d && (a || 0 === a)) {
if (!f && !b && this.reg.has(a)) {
return this.update(a, c);
return this.update(a, d);
}
c = this.encoder.encode(c);
if (f = c.length) {
const n = w(), m = w(), v = this.depth, D = this.resolution;
d = this.encoder.encode(d);
if (f = d.length) {
const n = w(), m = w(), v = this.depth, C = this.resolution;
for (let p = 0; p < f; p++) {
let l = c[this.rtl ? f - 1 - p : p];
var d = l.length;
if (d && (v || !m[l])) {
var g = this.score ? this.score(c, l, p, null, 0) : M(D, f, p), e = "";
let l = d[this.rtl ? f - 1 - p : p];
var c = l.length;
if (c && (v || !m[l])) {
var g = this.score ? this.score(d, l, p, null, 0) : L(C, f, p), e = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
for (let q = 0, t; q < d; q++) {
for (g = d; g > q; g--) {
if (2 < c) {
for (let q = 0, t; q < c; q++) {
for (g = c; g > q; g--) {
e = l.substring(q, g);
t = this.rtl ? d - 1 - q : q;
var h = this.score ? this.score(c, l, p, e, t) : M(D, f, p, d, t);
N(this, m, e, h, a, b);
t = this.rtl ? c - 1 - q : q;
var h = this.score ? this.score(d, l, p, e, t) : L(C, f, p, c, t);
M(this, m, e, h, a, b);
}
}
break;
}
case "bidirectional":
case "reverse":
if (1 < d) {
for (h = d - 1; 0 < h; h--) {
e = l[this.rtl ? d - 1 - h : h] + e;
var k = this.score ? this.score(c, l, p, e, h) : M(D, f, p, d, h);
N(this, m, e, k, a, b);
if (1 < c) {
for (h = c - 1; 0 < h; h--) {
e = l[this.rtl ? c - 1 - h : h] + e;
var k = this.score ? this.score(d, l, p, e, h) : L(C, f, p, c, h);
M(this, m, e, k, a, b);
}
e = "";
}
case "forward":
if (1 < d) {
for (h = 0; h < d; h++) {
e += l[this.rtl ? d - 1 - h : h], N(this, m, e, g, a, b);
if (1 < c) {
for (h = 0; h < c; h++) {
e += l[this.rtl ? c - 1 - h : h], M(this, m, e, g, a, b);
}
break;
}
default:
if (N(this, m, l, g, a, b), v && 1 < f && p < f - 1) {
for (d = w(), e = this.v, g = l, h = Math.min(v + 1, this.rtl ? p + 1 : f - p), d[g] = 1, k = 1; k < h; k++) {
if ((l = c[this.rtl ? f - 1 - p - k : p + k]) && !d[l]) {
d[l] = 1;
const q = this.score ? this.score(c, g, p, l, k - 1) : M(e + (f / 2 > e ? 0 : 1), f, p, h - 1, k - 1), t = this.bidirectional && l > g;
N(this, n, t ? g : l, q, a, b, t ? l : g);
if (M(this, m, l, g, a, b), v && 1 < f && p < f - 1) {
for (c = w(), e = this.v, g = l, h = Math.min(v + 1, this.rtl ? p + 1 : f - p), c[g] = 1, k = 1; k < h; k++) {
if ((l = d[this.rtl ? f - 1 - p - k : p + k]) && !c[l]) {
c[l] = 1;
const q = this.score ? this.score(d, g, p, l, k - 1) : L(e + (f / 2 > e ? 0 : 1), f, p, h - 1, k - 1), t = this.bidirectional && l > g;
M(this, n, t ? g : l, q, a, b, t ? l : g);
}
}
}
@@ -353,22 +328,22 @@ L.prototype.add = function(a, c, b, f) {
}
return this;
};
function N(a, c, b, f, d, g, e) {
function M(a, d, b, f, c, g, e) {
let h = e ? a.ctx : a.map, k;
if (!c[b] || e && !(k = c[b])[e]) {
e ? (c = k || (c[b] = w()), c[e] = 1, (k = h.get(e)) ? h = k : h.set(e, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[f] || (h[f] = []), g && h.includes(d) || (h.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(h) : a.reg.set(d, [h])));
if (!d[b] || e && !(k = d[b])[e]) {
e ? (d = k || (d[b] = w()), d[e] = 1, (k = h.get(e)) ? h = k : h.set(e, h = new Map())) : d[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[f] || (h[f] = []), g && h.includes(c) || (h.push(c), a.fastupdate && ((d = a.reg.get(c)) ? d.push(h) : a.reg.set(c, [h])));
}
}
function M(a, c, b, f, d) {
return b && 1 < a ? c + (f || 0) <= a ? b + (d || 0) : (a - 1) / (c + (f || 0)) * (b + (d || 0)) + 1 | 0 : 0;
function L(a, d, b, f, c) {
return b && 1 < a ? d + (f || 0) <= a ? b + (c || 0) : (a - 1) / (d + (f || 0)) * (b + (c || 0)) + 1 | 0 : 0;
}
;L.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
var f = [], d = 0;
;K.prototype.search = function(a, d, b) {
b || (d || "object" !== typeof a ? "object" === typeof d && (b = d, d = 0) : (b = a, a = ""));
var f = [], c = 0;
if (b) {
a = b.query || a;
c = b.limit || c;
d = b.offset || 0;
d = b.limit || d;
c = b.offset || 0;
var g = b.context;
var e = b.suggest;
var h = !0;
@@ -378,13 +353,13 @@ function M(a, c, b, f, d) {
}
a = this.encoder.encode(a);
b = a.length;
c = c || (h ? 100 : 0);
d = d || (h ? 100 : 0);
if (1 === b) {
return e = d, (d = O(this, a[0], "")) && d.length ? H.call(this, d, c, e) : [];
return e = c, (c = N(this, a[0], "")) && c.length ? H.call(this, c, d, e) : [];
}
g = this.depth && !1 !== g;
if (2 === b && g && !e) {
return e = d, (d = O(this, a[0], a[1])) && d.length ? H.call(this, d, c, e) : [];
return e = c, (c = N(this, a[0], a[1])) && c.length ? H.call(this, c, d, e) : [];
}
h = w();
var n = 0;
@@ -396,10 +371,10 @@ function M(a, c, b, f, d) {
for (let l, q; n < b; n++) {
if ((q = a[n]) && !h[q]) {
h[q] = 1;
l = O(this, q, m);
l = N(this, q, m);
a: {
g = l;
var v = f, D = e, p = k;
var v = f, C = e, p = k;
let t = [];
if (g && g.length) {
if (g.length <= p) {
@@ -418,7 +393,7 @@ function M(a, c, b, f, d) {
break a;
}
}
l = D ? void 0 : t;
l = C ? void 0 : t;
}
if (l) {
f = l;
@@ -442,7 +417,7 @@ function M(a, c, b, f, d) {
for (n = 0; n < m; n++) {
if (x = a[n], l < x.length && (q = x[l])) {
for (g = 0; g < q.length; g++) {
if (t = q[g], (h = b[t]) ? b[t]++ : (h = 0, b[t] = 1), A = e[h] || (e[h] = []), A.push(t), c && h === m - 1 && A.length - d === c) {
if (t = q[g], (h = b[t]) ? b[t]++ : (h = 0, b[t] = 1), A = e[h] || (e[h] = []), A.push(t), d && h === m - 1 && A.length - c === d) {
m = A;
break b;
}
@@ -458,10 +433,10 @@ function M(a, c, b, f, d) {
if (b = (f = e[h]) && f.length) {
for (n = 0; n < b; n++) {
if (m = f[n], !k[m]) {
if (k[m] = 1, d) {
d--;
if (k[m] = 1, c) {
c--;
} else {
if (a.push(m), a.length === c) {
if (a.push(m), a.length === d) {
break c;
}
}
@@ -471,7 +446,7 @@ function M(a, c, b, f, d) {
}
}
} else {
a = (e = e[0]).length > c || d ? e.slice(d, c + d) : e;
a = (e = e[0]).length > d || c ? e.slice(c, d + c) : e;
}
e = a;
} else {
@@ -480,9 +455,9 @@ function M(a, c, b, f, d) {
break b;
}
e = e[a - 1];
if (c || d) {
if (e.length > c || d) {
e = e.slice(d, c + d);
if (d || c) {
if (e.length > d || c) {
e = e.slice(c, d + c);
}
}
}
@@ -490,48 +465,47 @@ function M(a, c, b, f, d) {
m = e;
}
} else if (1 === f) {
c = H.call(null, a[0], c, d);
d = H.call(null, a[0], d, c);
break a;
}
c = m;
d = m;
}
return c;
return d;
};
function O(a, c, b) {
function N(a, d, b) {
let f;
b && (f = a.bidirectional && c > b) && (f = b, b = c, c = f);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
b && (f = a.bidirectional && d > b) && (f = b, b = d, d = f);
a = b ? (a = a.ctx.get(b)) && a.get(d) : a.map.get(d);
return a;
}
;L.prototype.remove = function(a, c) {
;K.prototype.remove = function(a, d) {
const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (b) {
if (this.fastupdate) {
for (let f = 0, d; f < b.length; f++) {
if (d = b[f]) {
if (2 > d.length) {
d.pop();
for (let f = 0, c; f < b.length; f++) {
if (c = b[f]) {
if (2 > c.length) {
c.pop();
} else {
const g = d.indexOf(a);
g === b.length - 1 ? d.pop() : d.splice(g, 1);
const g = c.indexOf(a);
g === b.length - 1 ? c.pop() : c.splice(g, 1);
}
}
}
} else {
P(this.map, a), this.depth && P(this.ctx, a);
O(this.map, a), this.depth && O(this.ctx, a);
}
c || this.reg.delete(a);
d || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function P(a, c) {
function O(a, d) {
let b = 0;
if (a.constructor === Array) {
for (let f = 0, d, g; f < a.length; f++) {
if ((d = a[f]) && d.length) {
if (g = d.indexOf(c), 0 <= g) {
1 < d.length ? (d.splice(g, 1), b++) : delete a[f];
for (let f = 0, c, g; f < a.length; f++) {
if ((c = a[f]) && c.length) {
if (g = c.indexOf(d), 0 <= g) {
1 < c.length ? (c.splice(g, 1), b++) : delete a[f];
break;
} else {
b++;
@@ -540,101 +514,81 @@ function P(a, c) {
}
} else {
for (let f of a.entries()) {
const d = f[0], g = P(f[1], c);
g ? b += g : a.delete(d);
const c = f[0], g = O(f[1], d);
g ? b += g : a.delete(c);
}
}
return b;
}
;function L(a, c) {
if (!this || this.constructor !== L) {
return new L(a);
;function K(a, d) {
if (!this || this.constructor !== K) {
return new K(a);
}
if (a) {
var b = "string" === typeof a ? a : a.preset;
b && (K[b] || console.warn("Preset not found: " + b), a = Object.assign({}, K[b], a));
b && (J[b] || console.warn("Preset not found: " + b), a = Object.assign({}, J[b], a));
} else {
a = {};
}
b = a.context;
const f = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || J;
this.encoder = d.encode ? d : "object" === typeof d ? new F(d) : {encode:d};
const f = !0 === b ? {depth:1} : b || {}, c = a.encode || a.encoder || I;
this.encoder = c.encode ? c : "object" === typeof c ? new F(c) : {encode:c};
this.resolution = a.resolution || 9;
this.tokenize = b = (b = a.tokenize) && "default" !== b && b || "strict";
this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict";
this.depth = "strict" === b && f.depth || 0;
this.bidirectional = !1 !== f.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
f && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
b = !1;
this.map = new Map();
this.ctx = new Map();
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.reg = d || (this.fastupdate ? new Map() : new Set());
this.v = f.resolution || 3;
this.rtl = d.rtl || a.rtl || !1;
this.cache = (b = a.cache || null) && new I(b);
this.rtl = c.rtl || a.rtl || !1;
}
r = L.prototype;
r = K.prototype;
r.clear = function() {
this.map.clear();
this.ctx.clear();
this.reg.clear();
this.cache && this.cache.clear();
return this;
};
r.append = function(a, c) {
return this.add(a, c, !0);
r.append = function(a, d) {
return this.add(a, d, !0);
};
r.contain = function(a) {
return this.reg.has(a);
};
r.update = function(a, c) {
r.update = function(a, d) {
const b = this, f = this.remove(a);
return f && f.then ? f.then(() => b.add(a, c)) : this.add(a, c);
return f && f.then ? f.then(() => b.add(a, d)) : this.add(a, d);
};
function Q(a) {
let c = 0;
function P(a) {
let d = 0;
if (a.constructor === Array) {
for (let b = 0, f; b < a.length; b++) {
(f = a[b]) && (c += f.length);
(f = a[b]) && (d += f.length);
}
} else {
for (const b of a.entries()) {
const f = b[0], d = Q(b[1]);
d ? c += d : a.delete(f);
const f = b[0], c = P(b[1]);
c ? d += c : a.delete(f);
}
}
return c;
return d;
}
r.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
Q(this.map);
this.depth && Q(this.ctx);
P(this.map);
this.depth && P(this.ctx);
return this;
};
r.searchCache = function(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new I());
let f = this.cache.get(a);
if (!f) {
f = this.search(a, c, b);
if (f.then) {
const d = this;
f.then(function(g) {
d.cache.set(a, g);
return g;
});
}
this.cache.set(a, f);
}
return f;
};
w();
const R = {Index:L, Charset:null, Encoder:F, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, S = "undefined" !== typeof self ? self : "undefined" !== typeof global ? global : self;
let T;
(T = S.define) && T.amd ? T([], function() {
return R;
}) : "object" === typeof S.exports ? S.exports = R : S.FlexSearch = R;
const Q = {Index:K, Charset:null, Encoder:F, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, R = "undefined" !== typeof self ? self : "undefined" !== typeof global ? global : self;
let S;
(S = R.define) && S.amd ? S([], function() {
return Q;
}) : "object" === typeof R.exports ? R.exports = Q : R.FlexSearch = Q;
}(this||self));

View File

@@ -1,28 +1,26 @@
/**!
* FlexSearch.js v0.8.142 (Light)
* FlexSearch.js v0.8.143 (Light)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function(self){'use strict';var r;function u(a,c,b){const f=typeof b,d=typeof a;if("undefined"!==f){if("undefined"!==d){if(b){if("function"===d&&f===d)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var e of a)g.set(e[0],e[1]);return g}if(c===Set){e=new Set(b);for(g of a.values())e.add(g);return e}}}return a}return b}return"undefined"===d?c:a}function w(){return Object.create(null)};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,B=/(\D)(\d{3})/g,C=/(\d{3})(\D)/g,E="".normalize&&/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,f;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";f=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",f=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,f=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,y)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!1,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,0,this.maxlength);this.rtl=u(a.rtl,!1,this.rtl);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.g+=(this.g?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.h+=
(this.h?"|":"")+d;return this};r.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&G(this);return this};
r.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&G(this);return this};r.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.s=null;this.cache&&G(this);return this};
r.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&G(this);return this};
r.encode=function(a){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&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=[],f=
this.split||""===this.split?a.split(this.split):a;for(let g=0,e,h;g<f.length;g++)if((e=h=f[g])&&!(e.length<this.minlength))if(c)b.push(e);else if(!this.filter||("function"===typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.o)if(this.l){var d=this.j.get(e);if(d||""===d){d&&b.push(d);continue}}else this.l=setTimeout(G,50,this);this.stemmer&&2<e.length&&(this.u||(this.u=new RegExp("(?!^)("+this.h+")$")),d=e,e=e.replace(this.u,k=>this.stemmer.get(k)),d!==e&&this.filter&&
e.length>=this.minlength&&("function"===typeof this.filter?!this.filter(e):this.filter.has(e))&&(e=""));if(e&&(this.mapper||this.dedupe&&1<e.length)){d="";for(let k=0,n="",m,v;k<e.length;k++)m=e.charAt(k),m===n&&this.dedupe||((v=this.mapper&&this.mapper.get(m))||""===v?v===n&&this.dedupe||!(n=v)||(d+=v):d+=n=m);e=d}this.matcher&&1<e.length&&(this.s||(this.s=new RegExp("("+this.g+")","g")),e=e.replace(this.s,k=>this.matcher.get(k)));if(e&&this.replacer)for(d=0;e&&d<this.replacer.length;d+=2)e=e.replace(this.replacer[d],
this.replacer[d+1]);this.cache&&h.length<=this.o&&(this.j.set(h,e),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));e&&b.push(e)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.m&&(this.i.set(a,b),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return b};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let f=[];for(let d=0,g,e;d<a.length;d++)if((g=a[d])&&(e=g.length)){if(b){if(b>=e){b-=e;continue}b<e&&(g=c?g.slice(b,b+c):g.slice(b),e=g.length,b=0)}e>c&&(g=g.slice(0,c),e=c);if(!f.length&&e>=c)return g;f.push(g);c-=e;if(!c)break}return f=1<f.length?[].concat.apply([],f):f[0]};w();function I(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}I.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)};I.prototype.get=function(a){const c=this.cache.get(a);c&&this.g!==a&&(this.cache.delete(a),this.cache.set(this.g=a,c));return c};I.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
I.prototype.clear=function(){this.cache.clear();this.g=""};const J={normalize:function(a){return a.toLowerCase()}};const K={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};L.prototype.add=function(a,c,b,f){if(c&&(a||0===a)){if(!f&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(f=c.length){const n=w(),m=w(),v=this.depth,D=this.resolution;for(let p=0;p<f;p++){let l=c[this.rtl?f-1-p:p];var d=l.length;if(d&&(v||!m[l])){var g=this.score?this.score(c,l,p,null,0):M(D,f,p),e="";switch(this.tokenize){case "full":if(2<d){for(let q=0,t;q<d;q++)for(g=d;g>q;g--){e=l.substring(q,g);t=this.rtl?d-1-q:q;var h=this.score?this.score(c,l,p,e,t):M(D,f,p,d,t);N(this,
m,e,h,a,b)}break}case "reverse":if(1<d){for(h=d-1;0<h;h--){e=l[this.rtl?d-1-h:h]+e;var k=this.score?this.score(c,l,p,e,h):M(D,f,p,d,h);N(this,m,e,k,a,b)}e=""}case "forward":if(1<d){for(h=0;h<d;h++)e+=l[this.rtl?d-1-h:h],N(this,m,e,g,a,b);break}default:if(N(this,m,l,g,a,b),v&&1<f&&p<f-1)for(d=w(),e=this.v,g=l,h=Math.min(v+1,this.rtl?p+1:f-p),d[g]=1,k=1;k<h;k++)if((l=c[this.rtl?f-1-p-k:p+k])&&!d[l]){d[l]=1;const q=this.score?this.score(c,g,p,l,k-1):M(e+(f/2>e?0:1),f,p,h-1,k-1),t=this.bidirectional&&
l>g;N(this,n,t?g:l,q,a,b,t?l:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function N(a,c,b,f,d,g,e){let h=e?a.ctx:a.map,k;if(!c[b]||e&&!(k=c[b])[e])e?(c=k||(c[b]=w()),c[e]=1,(k=h.get(e))?h=k:h.set(e,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[f]||(h[f]=[]),g&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function M(a,c,b,f,d){return b&&1<a?c+(f||0)<=a?b+(d||0):(a-1)/(c+(f||0))*(b+(d||0))+1|0:0};L.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var f=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var e=b.suggest;var h=!0;var k=b.resolution}else h=!0;a=this.encoder.encode(a);b=a.length;c=c||(h?100:0);if(1===b)return e=d,(d=O(this,a[0],""))&&d.length?H.call(this,d,c,e):[];g=this.depth&&!1!==g;if(2===b&&g&&!e)return e=d,(d=O(this,a[0],a[1]))&&d.length?H.call(this,d,c,e):[];h=w();var n=0;if(1<b&&g){var m=a[0];n=1}k||
0===k||(k=m?this.v:this.resolution);for(let l,q;n<b;n++){if((q=a[n])&&!h[q]){h[q]=1;l=O(this,q,m);a:{g=l;var v=f,D=e,p=k;let t=[];if(g&&g.length){if(g.length<=p){v.push(g);l=void 0;break a}for(let x=0,A;x<p;x++)if(A=g[x])t[x]=A;if(t.length){v.push(t);l=void 0;break a}}l=D?void 0:t}if(l){f=l;break}m&&(e&&l&&f.length||(m=q))}e&&m&&n===b-1&&!f.length&&(k=this.resolution,m="",n=-1,h=w())}a:{a=f;f=a.length;m=a;if(1<f)b:{f=e;m=a.length;e=[];b=w();for(let l=0,q,t,x,A;l<k;l++)for(n=0;n<m;n++)if(x=a[n],l<
x.length&&(q=x[l]))for(g=0;g<q.length;g++)if(t=q[g],(h=b[t])?b[t]++:(h=0,b[t]=1),A=e[h]||(e[h]=[]),A.push(t),c&&h===m-1&&A.length-d===c){m=A;break b}if(a=e.length)if(f){if(1<e.length)c:for(a=[],k=w(),f=e.length,h=f-1;0<=h;h--){if(b=(f=e[h])&&f.length)for(n=0;n<b;n++)if(m=f[n],!k[m])if(k[m]=1,d)d--;else if(a.push(m),a.length===c)break c}else a=(e=e[0]).length>c||d?e.slice(d,c+d):e;e=a}else{if(a<m){m=[];break b}e=e[a-1];if(c||d)if(e.length>c||d)e=e.slice(d,c+d)}m=e}else if(1===f){c=H.call(null,a[0],
c,d);break a}c=m}return c};function O(a,c,b){let f;b&&(f=a.bidirectional&&c>b)&&(f=b,b=c,c=f);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};L.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 f=0,d;f<b.length;f++){if(d=b[f])if(2>d.length)d.pop();else{const g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else P(this.map,a),this.depth&&P(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function P(a,c){let b=0;if(a.constructor===Array)for(let f=0,d,g;f<a.length;f++){if((d=a[f])&&d.length)if(g=d.indexOf(c),0<=g){1<d.length?(d.splice(g,1),b++):delete a[f];break}else b++}else for(let f of a.entries()){const d=f[0],g=P(f[1],c);g?b+=g:a.delete(d)}return b};function L(a,c){if(!this||this.constructor!==L)return new L(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},K[b],a))}else a={};b=a.context;const f=!0===b?{depth:1}:b||{},d=a.encode||a.encoder||J;this.encoder=d.encode?d:"object"===typeof d?new F(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&f.depth||0;this.bidirectional=!1!==f.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;
b=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.v=f.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new I(b)}r=L.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};r.append=function(a,c){return this.add(a,c,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,c){const b=this,f=this.remove(a);return f&&f.then?f.then(()=>b.add(a,c)):this.add(a,c)};
function Q(a){let c=0;if(a.constructor===Array)for(let b=0,f;b<a.length;b++)(f=a[b])&&(c+=f.length);else for(const b of a.entries()){const f=b[0],d=Q(b[1]);d?c+=d:a.delete(f)}return c}r.cleanup=function(){if(!this.fastupdate)return this;Q(this.map);this.depth&&Q(this.ctx);return this};
r.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new I);let f=this.cache.get(a);if(!f){f=this.search(a,c,b);if(f.then){const d=this;f.then(function(g){d.cache.set(a,g);return g})}this.cache.set(a,f)}return f};w();const R={Index:L,Charset:null,Encoder:F,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}},S="undefined"!==typeof self?self:"undefined"!==typeof global?global:self;let T;(T=S.define)&&T.amd?T([],function(){return R}):"object"===typeof S.exports?S.exports=R:S.FlexSearch=R;}(this||self));
(function(self){'use strict';var r;function u(a,d,b){const f=typeof b,c=typeof a;if("undefined"!==f){if("undefined"!==c){if(b){if("function"===c&&f===c)return function(h){return a(b(h))};d=a.constructor;if(d===b.constructor){if(d===Array)return b.concat(a);if(d===Map){var g=new Map(b);for(var e of a)g.set(e[0],e[1]);return g}if(d===Set){e=new Set(b);for(g of a.values())e.add(g);return e}}}return a}return b}return"undefined"===c?d:a}function w(){return Object.create(null)};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,B=/(\D)(\d{3})/g,D=/(\d{3})(\D)/g,E=/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let d=a.include,b=d||a.exclude||a.split,f;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let c="";f=!d;d||(c+="\\p{Z}");b.letter&&(c+="\\p{L}");b.number&&(c+="\\p{N}",f=!!d);b.symbol&&(c+="\\p{S}");b.punctuation&&(c+="\\p{P}");b.control&&(c+="\\p{C}");if(b=b.char)c+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(d?"^":"")+c+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,f=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,y)}catch(c){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!1,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,0,this.maxlength);this.rtl=u(a.rtl,!1,this.rtl);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const c of this.matcher.keys())this.g+=(this.g?"|":"")+c;if(this.stemmer)for(const c of this.stemmer.keys())this.h+=
(this.h?"|":"")+c;return this};r.addStemmer=function(a,d){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,d);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&G(this);return this};
r.addMapper=function(a,d){if("object"===typeof a)return this.addReplacer(a,d);if(1<a.length)return this.addMatcher(a,d);this.mapper||(this.mapper=new Map);this.mapper.set(a,d);this.cache&&G(this);return this};r.addMatcher=function(a,d){if("object"===typeof a)return this.addReplacer(a,d);if(2>a.length&&(this.dedupe||this.mapper))return this.addMapper(a,d);this.matcher||(this.matcher=new Map);this.matcher.set(a,d);this.g+=(this.g?"|":"")+a;this.s=null;this.cache&&G(this);return this};
r.addReplacer=function(a,d){if("string"===typeof a)return this.addMatcher(a,d);this.replacer||(this.replacer=[]);this.replacer.push(a,d);this.cache&&G(this);return this};
r.encode=function(a){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(B,"$1 $2").replace(D,"$1 $2").replace(z,"$1 "));const d=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=[],f=
this.split||""===this.split?a.split(this.split):a;for(let g=0,e,h;g<f.length;g++)if((e=h=f[g])&&!(e.length<this.minlength))if(d)b.push(e);else if(!this.filter||("function"===typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.o)if(this.l){var c=this.j.get(e);if(c||""===c){c&&b.push(c);continue}}else this.l=setTimeout(G,50,this);this.stemmer&&2<e.length&&(this.u||(this.u=new RegExp("(?!^)("+this.h+")$")),c=e,e=e.replace(this.u,k=>this.stemmer.get(k)),c!==e&&this.filter&&
e.length>=this.minlength&&("function"===typeof this.filter?!this.filter(e):this.filter.has(e))&&(e=""));if(e&&(this.mapper||this.dedupe&&1<e.length)){c="";for(let k=0,n="",m,v;k<e.length;k++)m=e.charAt(k),m===n&&this.dedupe||((v=this.mapper&&this.mapper.get(m))||""===v?v===n&&this.dedupe||!(n=v)||(c+=v):c+=n=m);e=c}this.matcher&&1<e.length&&(this.s||(this.s=new RegExp("("+this.g+")","g")),e=e.replace(this.s,k=>this.matcher.get(k)));if(e&&this.replacer)for(c=0;e&&c<this.replacer.length;c+=2)e=e.replace(this.replacer[c],
this.replacer[c+1]);this.cache&&h.length<=this.o&&(this.j.set(h,e),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));e&&b.push(e)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.m&&(this.i.set(a,b),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return b};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,d,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>d?d?a.slice(b,b+d):a.slice(b):a;let f=[];for(let c=0,g,e;c<a.length;c++)if((g=a[c])&&(e=g.length)){if(b){if(b>=e){b-=e;continue}b<e&&(g=d?g.slice(b,b+d):g.slice(b),e=g.length,b=0)}e>d&&(g=g.slice(0,d),e=d);if(!f.length&&e>=d)return g;f.push(g);d-=e;if(!d)break}return f=1<f.length?[].concat.apply([],f):f[0]};w();const I={normalize:!0};const J={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};K.prototype.add=function(a,d,b,f){if(d&&(a||0===a)){if(!f&&!b&&this.reg.has(a))return this.update(a,d);d=this.encoder.encode(d);if(f=d.length){const n=w(),m=w(),v=this.depth,C=this.resolution;for(let p=0;p<f;p++){let l=d[this.rtl?f-1-p:p];var c=l.length;if(c&&(v||!m[l])){var g=this.score?this.score(d,l,p,null,0):L(C,f,p),e="";switch(this.tokenize){case "full":if(2<c){for(let q=0,t;q<c;q++)for(g=c;g>q;g--){e=l.substring(q,g);t=this.rtl?c-1-q:q;var h=this.score?this.score(d,l,p,e,t):L(C,f,p,c,t);M(this,
m,e,h,a,b)}break}case "bidirectional":case "reverse":if(1<c){for(h=c-1;0<h;h--){e=l[this.rtl?c-1-h:h]+e;var k=this.score?this.score(d,l,p,e,h):L(C,f,p,c,h);M(this,m,e,k,a,b)}e=""}case "forward":if(1<c){for(h=0;h<c;h++)e+=l[this.rtl?c-1-h:h],M(this,m,e,g,a,b);break}default:if(M(this,m,l,g,a,b),v&&1<f&&p<f-1)for(c=w(),e=this.v,g=l,h=Math.min(v+1,this.rtl?p+1:f-p),c[g]=1,k=1;k<h;k++)if((l=d[this.rtl?f-1-p-k:p+k])&&!c[l]){c[l]=1;const q=this.score?this.score(d,g,p,l,k-1):L(e+(f/2>e?0:1),f,p,h-1,k-1),
t=this.bidirectional&&l>g;M(this,n,t?g:l,q,a,b,t?l:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function M(a,d,b,f,c,g,e){let h=e?a.ctx:a.map,k;if(!d[b]||e&&!(k=d[b])[e])e?(d=k||(d[b]=w()),d[e]=1,(k=h.get(e))?h=k:h.set(e,h=new Map)):d[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[f]||(h[f]=[]),g&&h.includes(c)||(h.push(c),a.fastupdate&&((d=a.reg.get(c))?d.push(h):a.reg.set(c,[h])))}function L(a,d,b,f,c){return b&&1<a?d+(f||0)<=a?b+(c||0):(a-1)/(d+(f||0))*(b+(c||0))+1|0:0};K.prototype.search=function(a,d,b){b||(d||"object"!==typeof a?"object"===typeof d&&(b=d,d=0):(b=a,a=""));var f=[],c=0;if(b){a=b.query||a;d=b.limit||d;c=b.offset||0;var g=b.context;var e=b.suggest;var h=!0;var k=b.resolution}else h=!0;a=this.encoder.encode(a);b=a.length;d=d||(h?100:0);if(1===b)return e=c,(c=N(this,a[0],""))&&c.length?H.call(this,c,d,e):[];g=this.depth&&!1!==g;if(2===b&&g&&!e)return e=c,(c=N(this,a[0],a[1]))&&c.length?H.call(this,c,d,e):[];h=w();var n=0;if(1<b&&g){var m=a[0];n=1}k||
0===k||(k=m?this.v:this.resolution);for(let l,q;n<b;n++){if((q=a[n])&&!h[q]){h[q]=1;l=N(this,q,m);a:{g=l;var v=f,C=e,p=k;let t=[];if(g&&g.length){if(g.length<=p){v.push(g);l=void 0;break a}for(let x=0,A;x<p;x++)if(A=g[x])t[x]=A;if(t.length){v.push(t);l=void 0;break a}}l=C?void 0:t}if(l){f=l;break}m&&(e&&l&&f.length||(m=q))}e&&m&&n===b-1&&!f.length&&(k=this.resolution,m="",n=-1,h=w())}a:{a=f;f=a.length;m=a;if(1<f)b:{f=e;m=a.length;e=[];b=w();for(let l=0,q,t,x,A;l<k;l++)for(n=0;n<m;n++)if(x=a[n],l<
x.length&&(q=x[l]))for(g=0;g<q.length;g++)if(t=q[g],(h=b[t])?b[t]++:(h=0,b[t]=1),A=e[h]||(e[h]=[]),A.push(t),d&&h===m-1&&A.length-c===d){m=A;break b}if(a=e.length)if(f){if(1<e.length)c:for(a=[],k=w(),f=e.length,h=f-1;0<=h;h--){if(b=(f=e[h])&&f.length)for(n=0;n<b;n++)if(m=f[n],!k[m])if(k[m]=1,c)c--;else if(a.push(m),a.length===d)break c}else a=(e=e[0]).length>d||c?e.slice(c,d+c):e;e=a}else{if(a<m){m=[];break b}e=e[a-1];if(d||c)if(e.length>d||c)e=e.slice(c,d+c)}m=e}else if(1===f){d=H.call(null,a[0],
d,c);break a}d=m}return d};function N(a,d,b){let f;b&&(f=a.bidirectional&&d>b)&&(f=b,b=d,d=f);a=b?(a=a.ctx.get(b))&&a.get(d):a.map.get(d);return a};K.prototype.remove=function(a,d){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let f=0,c;f<b.length;f++){if(c=b[f])if(2>c.length)c.pop();else{const g=c.indexOf(a);g===b.length-1?c.pop():c.splice(g,1)}}else O(this.map,a),this.depth&&O(this.ctx,a);d||this.reg.delete(a)}return this};
function O(a,d){let b=0;if(a.constructor===Array)for(let f=0,c,g;f<a.length;f++){if((c=a[f])&&c.length)if(g=c.indexOf(d),0<=g){1<c.length?(c.splice(g,1),b++):delete a[f];break}else b++}else for(let f of a.entries()){const c=f[0],g=O(f[1],d);g?b+=g:a.delete(c)}return b};function K(a,d){if(!this||this.constructor!==K)return new K(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},J[b],a))}else a={};b=a.context;const f=!0===b?{depth:1}:b||{},c=a.encode||a.encoder||I;this.encoder=c.encode?c:"object"===typeof c?new F(c):{encode:c};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&f.depth||0;this.bidirectional=!1!==f.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;this.map=new Map;this.ctx=new Map;this.reg=d||(this.fastupdate?new Map:new Set);this.v=f.resolution||3;this.rtl=c.rtl||a.rtl||!1}r=K.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();return this};r.append=function(a,d){return this.add(a,d,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,d){const b=this,f=this.remove(a);return f&&f.then?f.then(()=>b.add(a,d)):this.add(a,d)};
function P(a){let d=0;if(a.constructor===Array)for(let b=0,f;b<a.length;b++)(f=a[b])&&(d+=f.length);else for(const b of a.entries()){const f=b[0],c=P(b[1]);c?d+=c:a.delete(f)}return d}r.cleanup=function(){if(!this.fastupdate)return this;P(this.map);this.depth&&P(this.ctx);return this};w();const Q={Index:K,Charset:null,Encoder:F,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}},R="undefined"!==typeof self?self:"undefined"!==typeof global?global:self;let S;(S=R.define)&&S.amd?S([],function(){return Q}):"object"===typeof R.exports?R.exports=Q:R.FlexSearch=Q;}(this||self));

View File

@@ -1,34 +1,34 @@
/**!
* FlexSearch.js v0.8.142 (Bundle/Debug)
* FlexSearch.js v0.8.143 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var r;
function u(a, c, b) {
const f = typeof b, d = typeof a;
function u(a, d, b) {
const f = typeof b, c = typeof a;
if ("undefined" !== f) {
if ("undefined" !== d) {
if ("undefined" !== c) {
if (b) {
if ("function" === d && f === d) {
if ("function" === c && f === c) {
return function(h) {
return a(b(h));
};
}
c = a.constructor;
if (c === b.constructor) {
if (c === Array) {
d = a.constructor;
if (d === b.constructor) {
if (d === Array) {
return b.concat(a);
}
if (c === Map) {
if (d === Map) {
var g = new Map(b);
for (var e of a) {
g.set(e[0], e[1]);
}
return g;
}
if (c === Set) {
if (d === Set) {
e = new Set(b);
for (g of a.values()) {
e.add(g);
@@ -41,12 +41,12 @@ function u(a, c, b) {
}
return b;
}
return "undefined" === d ? c : a;
return "undefined" === c ? d : a;
}
function w() {
return Object.create(null);
}
;const y = /[^\p{L}\p{N}]+/u, z = /(\d{3})/g, B = /(\D)(\d{3})/g, C = /(\d{3})(\D)/g, E = "".normalize && /[\u0300-\u036f]/g;
;const y = /[^\p{L}\p{N}]+/u, z = /(\d{3})/g, B = /(\D)(\d{3})/g, D = /(\d{3})(\D)/g, E = /[\u0300-\u036f]/g;
function F(a = {}) {
if (!this || this.constructor !== F) {
return new F(...arguments);
@@ -62,22 +62,22 @@ function F(a = {}) {
r = F.prototype;
r.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split, f;
let d = a.include, b = d || a.exclude || a.split, f;
if (b || "" === b) {
if ("object" === typeof b && b.constructor !== RegExp) {
let d = "";
f = !c;
c || (d += "\\p{Z}");
b.letter && (d += "\\p{L}");
b.number && (d += "\\p{N}", f = !!c);
b.symbol && (d += "\\p{S}");
b.punctuation && (d += "\\p{P}");
b.control && (d += "\\p{C}");
let c = "";
f = !d;
d || (c += "\\p{Z}");
b.letter && (c += "\\p{L}");
b.number && (c += "\\p{N}", f = !!d);
b.symbol && (c += "\\p{S}");
b.punctuation && (c += "\\p{P}");
b.control && (c += "\\p{C}");
if (b = b.char) {
d += "object" === typeof b ? b.join("") : b;
c += "object" === typeof b ? b.join("") : b;
}
try {
this.split = new RegExp("[" + (c ? "^" : "") + d + "]+", "u");
this.split = new RegExp("[" + (d ? "^" : "") + c + "]+", "u");
} catch (g) {
console.error("Your split configuration:", b, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
@@ -88,7 +88,7 @@ r.assign = function(a) {
} else {
try {
this.split = u(this.split, y);
} catch (d) {
} catch (c) {
console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
this.numeric = u(a.numeric, u(this.numeric, !0));
@@ -113,20 +113,20 @@ r.assign = function(a) {
this.h = "";
this.u = null;
if (this.matcher) {
for (const d of this.matcher.keys()) {
this.g += (this.g ? "|" : "") + d;
for (const c of this.matcher.keys()) {
this.g += (this.g ? "|" : "") + c;
}
}
if (this.stemmer) {
for (const d of this.stemmer.keys()) {
this.h += (this.h ? "|" : "") + d;
for (const c of this.stemmer.keys()) {
this.h += (this.h ? "|" : "") + c;
}
}
return this;
};
r.addStemmer = function(a, c) {
r.addStemmer = function(a, d) {
this.stemmer || (this.stemmer = new Map());
this.stemmer.set(a, c);
this.stemmer.set(a, d);
this.h += (this.h ? "|" : "") + a;
this.u = null;
this.cache && G(this);
@@ -137,38 +137,38 @@ r.addFilter = function(a) {
this.cache && G(this);
return this;
};
r.addMapper = function(a, c) {
r.addMapper = function(a, d) {
if ("object" === typeof a) {
return this.addReplacer(a, c);
return this.addReplacer(a, d);
}
if (1 < a.length) {
return this.addMatcher(a, c);
return this.addMatcher(a, d);
}
this.mapper || (this.mapper = new Map());
this.mapper.set(a, c);
this.mapper.set(a, d);
this.cache && G(this);
return this;
};
r.addMatcher = function(a, c) {
r.addMatcher = function(a, d) {
if ("object" === typeof a) {
return this.addReplacer(a, c);
return this.addReplacer(a, d);
}
if (2 > a.length && (this.dedupe || this.mapper)) {
return this.addMapper(a, c);
return this.addMapper(a, d);
}
this.matcher || (this.matcher = new Map());
this.matcher.set(a, c);
this.matcher.set(a, d);
this.g += (this.g ? "|" : "") + a;
this.s = null;
this.cache && G(this);
return this;
};
r.addReplacer = function(a, c) {
r.addReplacer = function(a, d) {
if ("string" === typeof a) {
return this.addMatcher(a, c);
return this.addMatcher(a, d);
}
this.replacer || (this.replacer = []);
this.replacer.push(a, c);
this.replacer.push(a, d);
this.cache && G(this);
return this;
};
@@ -184,38 +184,38 @@ r.encode = function(a) {
}
this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = E ? a.normalize("NFKD").replace(E, "").toLowerCase() : a.toLowerCase());
this.prepare && (a = this.prepare(a));
this.numeric && 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);
this.numeric && 3 < a.length && (a = a.replace(B, "$1 $2").replace(D, "$1 $2").replace(z, "$1 "));
const d = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
let b = [], f = this.split || "" === this.split ? a.split(this.split) : a;
for (let g = 0, e, h; g < f.length; g++) {
if ((e = h = f[g]) && !(e.length < this.minlength)) {
if (c) {
if (d) {
b.push(e);
} else {
if (!this.filter || ("function" === typeof this.filter ? this.filter(e) : !this.filter.has(e))) {
if (this.cache && e.length <= this.o) {
if (this.l) {
var d = this.j.get(e);
if (d || "" === d) {
d && b.push(d);
var c = this.j.get(e);
if (c || "" === c) {
c && b.push(c);
continue;
}
} else {
this.l = setTimeout(G, 50, this);
}
}
this.stemmer && 2 < e.length && (this.u || (this.u = new RegExp("(?!^)(" + this.h + ")$")), d = e, e = e.replace(this.u, k => this.stemmer.get(k)), d !== e && this.filter && e.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(e) : this.filter.has(e)) && (e = ""));
this.stemmer && 2 < e.length && (this.u || (this.u = new RegExp("(?!^)(" + this.h + ")$")), c = e, e = e.replace(this.u, k => this.stemmer.get(k)), c !== e && this.filter && e.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(e) : this.filter.has(e)) && (e = ""));
if (e && (this.mapper || this.dedupe && 1 < e.length)) {
d = "";
c = "";
for (let k = 0, n = "", m, v; k < e.length; k++) {
m = e.charAt(k), m === n && this.dedupe || ((v = this.mapper && this.mapper.get(m)) || "" === v ? v === n && this.dedupe || !(n = v) || (d += v) : d += n = m);
m = e.charAt(k), m === n && this.dedupe || ((v = this.mapper && this.mapper.get(m)) || "" === v ? v === n && this.dedupe || !(n = v) || (c += v) : c += n = m);
}
e = d;
e = c;
}
this.matcher && 1 < e.length && (this.s || (this.s = new RegExp("(" + this.g + ")", "g")), e = e.replace(this.s, k => this.matcher.get(k)));
if (e && this.replacer) {
for (d = 0; e && d < this.replacer.length; d += 2) {
e = e.replace(this.replacer[d], this.replacer[d + 1]);
for (c = 0; e && c < this.replacer.length; c += 2) {
e = e.replace(this.replacer[c], this.replacer[c + 1]);
}
}
this.cache && h.length <= this.o && (this.j.set(h, e), this.j.size > this.A && (this.j.clear(), this.o = this.o / 1.1 | 0));
@@ -233,30 +233,30 @@ function G(a) {
a.i.clear();
a.j.clear();
}
;function H(a, c, b) {
;function H(a, d, b) {
if (!a.length) {
return a;
}
if (1 === a.length) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a;
return a = a[0], a = b || a.length > d ? d ? a.slice(b, b + d) : a.slice(b) : a;
}
let f = [];
for (let d = 0, g, e; d < a.length; d++) {
if ((g = a[d]) && (e = g.length)) {
for (let c = 0, g, e; c < a.length; c++) {
if ((g = a[c]) && (e = g.length)) {
if (b) {
if (b >= e) {
b -= e;
continue;
}
b < e && (g = c ? g.slice(b, b + c) : g.slice(b), e = g.length, b = 0);
b < e && (g = d ? g.slice(b, b + d) : g.slice(b), e = g.length, b = 0);
}
e > c && (g = g.slice(0, c), e = c);
if (!f.length && e >= c) {
e > d && (g = g.slice(0, d), e = d);
if (!f.length && e >= d) {
return g;
}
f.push(g);
c -= e;
if (!c) {
d -= e;
if (!d) {
break;
}
}
@@ -264,83 +264,58 @@ function G(a) {
return f = 1 < f.length ? [].concat.apply([], f) : f[0];
}
;w();
function I(a) {
this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map();
this.g = "";
}
I.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);
};
I.prototype.get = function(a) {
const c = this.cache.get(a);
c && this.g !== a && (this.cache.delete(a), this.cache.set(this.g = a, c));
return c;
};
I.prototype.remove = function(a) {
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
I.prototype.clear = function() {
this.cache.clear();
this.g = "";
};
const J = {normalize:function(a) {
return a.toLowerCase();
}};
const K = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
L.prototype.add = function(a, c, b, f) {
if (c && (a || 0 === a)) {
const I = {normalize:!0};
const J = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
K.prototype.add = function(a, d, b, f) {
if (d && (a || 0 === a)) {
if (!f && !b && this.reg.has(a)) {
return this.update(a, c);
return this.update(a, d);
}
c = this.encoder.encode(c);
if (f = c.length) {
const n = w(), m = w(), v = this.depth, D = this.resolution;
d = this.encoder.encode(d);
if (f = d.length) {
const n = w(), m = w(), v = this.depth, C = this.resolution;
for (let p = 0; p < f; p++) {
let l = c[this.rtl ? f - 1 - p : p];
var d = l.length;
if (d && (v || !m[l])) {
var g = this.score ? this.score(c, l, p, null, 0) : M(D, f, p), e = "";
let l = d[this.rtl ? f - 1 - p : p];
var c = l.length;
if (c && (v || !m[l])) {
var g = this.score ? this.score(d, l, p, null, 0) : L(C, f, p), e = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
for (let q = 0, t; q < d; q++) {
for (g = d; g > q; g--) {
if (2 < c) {
for (let q = 0, t; q < c; q++) {
for (g = c; g > q; g--) {
e = l.substring(q, g);
t = this.rtl ? d - 1 - q : q;
var h = this.score ? this.score(c, l, p, e, t) : M(D, f, p, d, t);
N(this, m, e, h, a, b);
t = this.rtl ? c - 1 - q : q;
var h = this.score ? this.score(d, l, p, e, t) : L(C, f, p, c, t);
M(this, m, e, h, a, b);
}
}
break;
}
case "bidirectional":
case "reverse":
if (1 < d) {
for (h = d - 1; 0 < h; h--) {
e = l[this.rtl ? d - 1 - h : h] + e;
var k = this.score ? this.score(c, l, p, e, h) : M(D, f, p, d, h);
N(this, m, e, k, a, b);
if (1 < c) {
for (h = c - 1; 0 < h; h--) {
e = l[this.rtl ? c - 1 - h : h] + e;
var k = this.score ? this.score(d, l, p, e, h) : L(C, f, p, c, h);
M(this, m, e, k, a, b);
}
e = "";
}
case "forward":
if (1 < d) {
for (h = 0; h < d; h++) {
e += l[this.rtl ? d - 1 - h : h], N(this, m, e, g, a, b);
if (1 < c) {
for (h = 0; h < c; h++) {
e += l[this.rtl ? c - 1 - h : h], M(this, m, e, g, a, b);
}
break;
}
default:
if (N(this, m, l, g, a, b), v && 1 < f && p < f - 1) {
for (d = w(), e = this.v, g = l, h = Math.min(v + 1, this.rtl ? p + 1 : f - p), d[g] = 1, k = 1; k < h; k++) {
if ((l = c[this.rtl ? f - 1 - p - k : p + k]) && !d[l]) {
d[l] = 1;
const q = this.score ? this.score(c, g, p, l, k - 1) : M(e + (f / 2 > e ? 0 : 1), f, p, h - 1, k - 1), t = this.bidirectional && l > g;
N(this, n, t ? g : l, q, a, b, t ? l : g);
if (M(this, m, l, g, a, b), v && 1 < f && p < f - 1) {
for (c = w(), e = this.v, g = l, h = Math.min(v + 1, this.rtl ? p + 1 : f - p), c[g] = 1, k = 1; k < h; k++) {
if ((l = d[this.rtl ? f - 1 - p - k : p + k]) && !c[l]) {
c[l] = 1;
const q = this.score ? this.score(d, g, p, l, k - 1) : L(e + (f / 2 > e ? 0 : 1), f, p, h - 1, k - 1), t = this.bidirectional && l > g;
M(this, n, t ? g : l, q, a, b, t ? l : g);
}
}
}
@@ -352,22 +327,22 @@ L.prototype.add = function(a, c, b, f) {
}
return this;
};
function N(a, c, b, f, d, g, e) {
function M(a, d, b, f, c, g, e) {
let h = e ? a.ctx : a.map, k;
if (!c[b] || e && !(k = c[b])[e]) {
e ? (c = k || (c[b] = w()), c[e] = 1, (k = h.get(e)) ? h = k : h.set(e, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[f] || (h[f] = []), g && h.includes(d) || (h.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(h) : a.reg.set(d, [h])));
if (!d[b] || e && !(k = d[b])[e]) {
e ? (d = k || (d[b] = w()), d[e] = 1, (k = h.get(e)) ? h = k : h.set(e, h = new Map())) : d[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[f] || (h[f] = []), g && h.includes(c) || (h.push(c), a.fastupdate && ((d = a.reg.get(c)) ? d.push(h) : a.reg.set(c, [h])));
}
}
function M(a, c, b, f, d) {
return b && 1 < a ? c + (f || 0) <= a ? b + (d || 0) : (a - 1) / (c + (f || 0)) * (b + (d || 0)) + 1 | 0 : 0;
function L(a, d, b, f, c) {
return b && 1 < a ? d + (f || 0) <= a ? b + (c || 0) : (a - 1) / (d + (f || 0)) * (b + (c || 0)) + 1 | 0 : 0;
}
;L.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
var f = [], d = 0;
;K.prototype.search = function(a, d, b) {
b || (d || "object" !== typeof a ? "object" === typeof d && (b = d, d = 0) : (b = a, a = ""));
var f = [], c = 0;
if (b) {
a = b.query || a;
c = b.limit || c;
d = b.offset || 0;
d = b.limit || d;
c = b.offset || 0;
var g = b.context;
var e = b.suggest;
var h = !0;
@@ -377,13 +352,13 @@ function M(a, c, b, f, d) {
}
a = this.encoder.encode(a);
b = a.length;
c = c || (h ? 100 : 0);
d = d || (h ? 100 : 0);
if (1 === b) {
return e = d, (d = O(this, a[0], "")) && d.length ? H.call(this, d, c, e) : [];
return e = c, (c = N(this, a[0], "")) && c.length ? H.call(this, c, d, e) : [];
}
g = this.depth && !1 !== g;
if (2 === b && g && !e) {
return e = d, (d = O(this, a[0], a[1])) && d.length ? H.call(this, d, c, e) : [];
return e = c, (c = N(this, a[0], a[1])) && c.length ? H.call(this, c, d, e) : [];
}
h = w();
var n = 0;
@@ -395,10 +370,10 @@ function M(a, c, b, f, d) {
for (let l, q; n < b; n++) {
if ((q = a[n]) && !h[q]) {
h[q] = 1;
l = O(this, q, m);
l = N(this, q, m);
a: {
g = l;
var v = f, D = e, p = k;
var v = f, C = e, p = k;
let t = [];
if (g && g.length) {
if (g.length <= p) {
@@ -417,7 +392,7 @@ function M(a, c, b, f, d) {
break a;
}
}
l = D ? void 0 : t;
l = C ? void 0 : t;
}
if (l) {
f = l;
@@ -441,7 +416,7 @@ function M(a, c, b, f, d) {
for (n = 0; n < m; n++) {
if (x = a[n], l < x.length && (q = x[l])) {
for (g = 0; g < q.length; g++) {
if (t = q[g], (h = b[t]) ? b[t]++ : (h = 0, b[t] = 1), A = e[h] || (e[h] = []), A.push(t), c && h === m - 1 && A.length - d === c) {
if (t = q[g], (h = b[t]) ? b[t]++ : (h = 0, b[t] = 1), A = e[h] || (e[h] = []), A.push(t), d && h === m - 1 && A.length - c === d) {
m = A;
break b;
}
@@ -457,10 +432,10 @@ function M(a, c, b, f, d) {
if (b = (f = e[h]) && f.length) {
for (n = 0; n < b; n++) {
if (m = f[n], !k[m]) {
if (k[m] = 1, d) {
d--;
if (k[m] = 1, c) {
c--;
} else {
if (a.push(m), a.length === c) {
if (a.push(m), a.length === d) {
break c;
}
}
@@ -470,7 +445,7 @@ function M(a, c, b, f, d) {
}
}
} else {
a = (e = e[0]).length > c || d ? e.slice(d, c + d) : e;
a = (e = e[0]).length > d || c ? e.slice(c, d + c) : e;
}
e = a;
} else {
@@ -479,9 +454,9 @@ function M(a, c, b, f, d) {
break b;
}
e = e[a - 1];
if (c || d) {
if (e.length > c || d) {
e = e.slice(d, c + d);
if (d || c) {
if (e.length > d || c) {
e = e.slice(c, d + c);
}
}
}
@@ -489,48 +464,47 @@ function M(a, c, b, f, d) {
m = e;
}
} else if (1 === f) {
c = H.call(null, a[0], c, d);
d = H.call(null, a[0], d, c);
break a;
}
c = m;
d = m;
}
return c;
return d;
};
function O(a, c, b) {
function N(a, d, b) {
let f;
b && (f = a.bidirectional && c > b) && (f = b, b = c, c = f);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
b && (f = a.bidirectional && d > b) && (f = b, b = d, d = f);
a = b ? (a = a.ctx.get(b)) && a.get(d) : a.map.get(d);
return a;
}
;L.prototype.remove = function(a, c) {
;K.prototype.remove = function(a, d) {
const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (b) {
if (this.fastupdate) {
for (let f = 0, d; f < b.length; f++) {
if (d = b[f]) {
if (2 > d.length) {
d.pop();
for (let f = 0, c; f < b.length; f++) {
if (c = b[f]) {
if (2 > c.length) {
c.pop();
} else {
const g = d.indexOf(a);
g === b.length - 1 ? d.pop() : d.splice(g, 1);
const g = c.indexOf(a);
g === b.length - 1 ? c.pop() : c.splice(g, 1);
}
}
}
} else {
P(this.map, a), this.depth && P(this.ctx, a);
O(this.map, a), this.depth && O(this.ctx, a);
}
c || this.reg.delete(a);
d || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function P(a, c) {
function O(a, d) {
let b = 0;
if (a.constructor === Array) {
for (let f = 0, d, g; f < a.length; f++) {
if ((d = a[f]) && d.length) {
if (g = d.indexOf(c), 0 <= g) {
1 < d.length ? (d.splice(g, 1), b++) : delete a[f];
for (let f = 0, c, g; f < a.length; f++) {
if ((c = a[f]) && c.length) {
if (g = c.indexOf(d), 0 <= g) {
1 < c.length ? (c.splice(g, 1), b++) : delete a[f];
break;
} else {
b++;
@@ -539,98 +513,78 @@ function P(a, c) {
}
} else {
for (let f of a.entries()) {
const d = f[0], g = P(f[1], c);
g ? b += g : a.delete(d);
const c = f[0], g = O(f[1], d);
g ? b += g : a.delete(c);
}
}
return b;
}
;function L(a, c) {
if (!this || this.constructor !== L) {
return new L(a);
;function K(a, d) {
if (!this || this.constructor !== K) {
return new K(a);
}
if (a) {
var b = "string" === typeof a ? a : a.preset;
b && (K[b] || console.warn("Preset not found: " + b), a = Object.assign({}, K[b], a));
b && (J[b] || console.warn("Preset not found: " + b), a = Object.assign({}, J[b], a));
} else {
a = {};
}
b = a.context;
const f = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || J;
this.encoder = d.encode ? d : "object" === typeof d ? new F(d) : {encode:d};
const f = !0 === b ? {depth:1} : b || {}, c = a.encode || a.encoder || I;
this.encoder = c.encode ? c : "object" === typeof c ? new F(c) : {encode:c};
this.resolution = a.resolution || 9;
this.tokenize = b = (b = a.tokenize) && "default" !== b && b || "strict";
this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict";
this.depth = "strict" === b && f.depth || 0;
this.bidirectional = !1 !== f.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
f && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
b = !1;
this.map = new Map();
this.ctx = new Map();
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.reg = d || (this.fastupdate ? new Map() : new Set());
this.v = f.resolution || 3;
this.rtl = d.rtl || a.rtl || !1;
this.cache = (b = a.cache || null) && new I(b);
this.rtl = c.rtl || a.rtl || !1;
}
r = L.prototype;
r = K.prototype;
r.clear = function() {
this.map.clear();
this.ctx.clear();
this.reg.clear();
this.cache && this.cache.clear();
return this;
};
r.append = function(a, c) {
return this.add(a, c, !0);
r.append = function(a, d) {
return this.add(a, d, !0);
};
r.contain = function(a) {
return this.reg.has(a);
};
r.update = function(a, c) {
r.update = function(a, d) {
const b = this, f = this.remove(a);
return f && f.then ? f.then(() => b.add(a, c)) : this.add(a, c);
return f && f.then ? f.then(() => b.add(a, d)) : this.add(a, d);
};
function Q(a) {
let c = 0;
function P(a) {
let d = 0;
if (a.constructor === Array) {
for (let b = 0, f; b < a.length; b++) {
(f = a[b]) && (c += f.length);
(f = a[b]) && (d += f.length);
}
} else {
for (const b of a.entries()) {
const f = b[0], d = Q(b[1]);
d ? c += d : a.delete(f);
const f = b[0], c = P(b[1]);
c ? d += c : a.delete(f);
}
}
return c;
return d;
}
r.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
Q(this.map);
this.depth && Q(this.ctx);
P(this.map);
this.depth && P(this.ctx);
return this;
};
r.searchCache = function(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
this.cache || (this.cache = new I());
let f = this.cache.get(a);
if (!f) {
f = this.search(a, c, b);
if (f.then) {
const d = this;
f.then(function(g) {
d.cache.set(a, g);
return g;
});
}
this.cache.set(a, f);
}
return f;
};
w();
export default {Index:L, Charset:null, Encoder:F, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
export default {Index:K, Charset:null, Encoder:F, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
export const Index=L;export const Charset=null;export const Encoder=F;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
export const Index=K;export const Charset=null;export const Encoder=F;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -1,29 +1,27 @@
/**!
* FlexSearch.js v0.8.142 (Bundle)
* FlexSearch.js v0.8.143 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var r;function u(a,c,b){const f=typeof b,d=typeof a;if("undefined"!==f){if("undefined"!==d){if(b){if("function"===d&&f===d)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var e of a)g.set(e[0],e[1]);return g}if(c===Set){e=new Set(b);for(g of a.values())e.add(g);return e}}}return a}return b}return"undefined"===d?c:a}function w(){return Object.create(null)};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,B=/(\D)(\d{3})/g,C=/(\d{3})(\D)/g,E="".normalize&&/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,f;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";f=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",f=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,f=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,y)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!1,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,0,this.maxlength);this.rtl=u(a.rtl,!1,this.rtl);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.g+=(this.g?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.h+=
(this.h?"|":"")+d;return this};r.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&G(this);return this};
r.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&G(this);return this};r.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.s=null;this.cache&&G(this);return this};
r.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&G(this);return this};
r.encode=function(a){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&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=[],f=
this.split||""===this.split?a.split(this.split):a;for(let g=0,e,h;g<f.length;g++)if((e=h=f[g])&&!(e.length<this.minlength))if(c)b.push(e);else if(!this.filter||("function"===typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.o)if(this.l){var d=this.j.get(e);if(d||""===d){d&&b.push(d);continue}}else this.l=setTimeout(G,50,this);this.stemmer&&2<e.length&&(this.u||(this.u=new RegExp("(?!^)("+this.h+")$")),d=e,e=e.replace(this.u,k=>this.stemmer.get(k)),d!==e&&this.filter&&
e.length>=this.minlength&&("function"===typeof this.filter?!this.filter(e):this.filter.has(e))&&(e=""));if(e&&(this.mapper||this.dedupe&&1<e.length)){d="";for(let k=0,n="",m,v;k<e.length;k++)m=e.charAt(k),m===n&&this.dedupe||((v=this.mapper&&this.mapper.get(m))||""===v?v===n&&this.dedupe||!(n=v)||(d+=v):d+=n=m);e=d}this.matcher&&1<e.length&&(this.s||(this.s=new RegExp("("+this.g+")","g")),e=e.replace(this.s,k=>this.matcher.get(k)));if(e&&this.replacer)for(d=0;e&&d<this.replacer.length;d+=2)e=e.replace(this.replacer[d],
this.replacer[d+1]);this.cache&&h.length<=this.o&&(this.j.set(h,e),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));e&&b.push(e)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.m&&(this.i.set(a,b),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return b};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let f=[];for(let d=0,g,e;d<a.length;d++)if((g=a[d])&&(e=g.length)){if(b){if(b>=e){b-=e;continue}b<e&&(g=c?g.slice(b,b+c):g.slice(b),e=g.length,b=0)}e>c&&(g=g.slice(0,c),e=c);if(!f.length&&e>=c)return g;f.push(g);c-=e;if(!c)break}return f=1<f.length?[].concat.apply([],f):f[0]};w();function I(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}I.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)};I.prototype.get=function(a){const c=this.cache.get(a);c&&this.g!==a&&(this.cache.delete(a),this.cache.set(this.g=a,c));return c};I.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
I.prototype.clear=function(){this.cache.clear();this.g=""};const J={normalize:function(a){return a.toLowerCase()}};const K={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};L.prototype.add=function(a,c,b,f){if(c&&(a||0===a)){if(!f&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(f=c.length){const n=w(),m=w(),v=this.depth,D=this.resolution;for(let p=0;p<f;p++){let l=c[this.rtl?f-1-p:p];var d=l.length;if(d&&(v||!m[l])){var g=this.score?this.score(c,l,p,null,0):M(D,f,p),e="";switch(this.tokenize){case "full":if(2<d){for(let q=0,t;q<d;q++)for(g=d;g>q;g--){e=l.substring(q,g);t=this.rtl?d-1-q:q;var h=this.score?this.score(c,l,p,e,t):M(D,f,p,d,t);N(this,
m,e,h,a,b)}break}case "reverse":if(1<d){for(h=d-1;0<h;h--){e=l[this.rtl?d-1-h:h]+e;var k=this.score?this.score(c,l,p,e,h):M(D,f,p,d,h);N(this,m,e,k,a,b)}e=""}case "forward":if(1<d){for(h=0;h<d;h++)e+=l[this.rtl?d-1-h:h],N(this,m,e,g,a,b);break}default:if(N(this,m,l,g,a,b),v&&1<f&&p<f-1)for(d=w(),e=this.v,g=l,h=Math.min(v+1,this.rtl?p+1:f-p),d[g]=1,k=1;k<h;k++)if((l=c[this.rtl?f-1-p-k:p+k])&&!d[l]){d[l]=1;const q=this.score?this.score(c,g,p,l,k-1):M(e+(f/2>e?0:1),f,p,h-1,k-1),t=this.bidirectional&&
l>g;N(this,n,t?g:l,q,a,b,t?l:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function N(a,c,b,f,d,g,e){let h=e?a.ctx:a.map,k;if(!c[b]||e&&!(k=c[b])[e])e?(c=k||(c[b]=w()),c[e]=1,(k=h.get(e))?h=k:h.set(e,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[f]||(h[f]=[]),g&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function M(a,c,b,f,d){return b&&1<a?c+(f||0)<=a?b+(d||0):(a-1)/(c+(f||0))*(b+(d||0))+1|0:0};L.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var f=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var e=b.suggest;var h=!0;var k=b.resolution}else h=!0;a=this.encoder.encode(a);b=a.length;c=c||(h?100:0);if(1===b)return e=d,(d=O(this,a[0],""))&&d.length?H.call(this,d,c,e):[];g=this.depth&&!1!==g;if(2===b&&g&&!e)return e=d,(d=O(this,a[0],a[1]))&&d.length?H.call(this,d,c,e):[];h=w();var n=0;if(1<b&&g){var m=a[0];n=1}k||
0===k||(k=m?this.v:this.resolution);for(let l,q;n<b;n++){if((q=a[n])&&!h[q]){h[q]=1;l=O(this,q,m);a:{g=l;var v=f,D=e,p=k;let t=[];if(g&&g.length){if(g.length<=p){v.push(g);l=void 0;break a}for(let x=0,A;x<p;x++)if(A=g[x])t[x]=A;if(t.length){v.push(t);l=void 0;break a}}l=D?void 0:t}if(l){f=l;break}m&&(e&&l&&f.length||(m=q))}e&&m&&n===b-1&&!f.length&&(k=this.resolution,m="",n=-1,h=w())}a:{a=f;f=a.length;m=a;if(1<f)b:{f=e;m=a.length;e=[];b=w();for(let l=0,q,t,x,A;l<k;l++)for(n=0;n<m;n++)if(x=a[n],l<
x.length&&(q=x[l]))for(g=0;g<q.length;g++)if(t=q[g],(h=b[t])?b[t]++:(h=0,b[t]=1),A=e[h]||(e[h]=[]),A.push(t),c&&h===m-1&&A.length-d===c){m=A;break b}if(a=e.length)if(f){if(1<e.length)c:for(a=[],k=w(),f=e.length,h=f-1;0<=h;h--){if(b=(f=e[h])&&f.length)for(n=0;n<b;n++)if(m=f[n],!k[m])if(k[m]=1,d)d--;else if(a.push(m),a.length===c)break c}else a=(e=e[0]).length>c||d?e.slice(d,c+d):e;e=a}else{if(a<m){m=[];break b}e=e[a-1];if(c||d)if(e.length>c||d)e=e.slice(d,c+d)}m=e}else if(1===f){c=H.call(null,a[0],
c,d);break a}c=m}return c};function O(a,c,b){let f;b&&(f=a.bidirectional&&c>b)&&(f=b,b=c,c=f);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};L.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 f=0,d;f<b.length;f++){if(d=b[f])if(2>d.length)d.pop();else{const g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else P(this.map,a),this.depth&&P(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function P(a,c){let b=0;if(a.constructor===Array)for(let f=0,d,g;f<a.length;f++){if((d=a[f])&&d.length)if(g=d.indexOf(c),0<=g){1<d.length?(d.splice(g,1),b++):delete a[f];break}else b++}else for(let f of a.entries()){const d=f[0],g=P(f[1],c);g?b+=g:a.delete(d)}return b};function L(a,c){if(!this||this.constructor!==L)return new L(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},K[b],a))}else a={};b=a.context;const f=!0===b?{depth:1}:b||{},d=a.encode||a.encoder||J;this.encoder=d.encode?d:"object"===typeof d?new F(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&f.depth||0;this.bidirectional=!1!==f.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;
b=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.v=f.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new I(b)}r=L.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};r.append=function(a,c){return this.add(a,c,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,c){const b=this,f=this.remove(a);return f&&f.then?f.then(()=>b.add(a,c)):this.add(a,c)};
function Q(a){let c=0;if(a.constructor===Array)for(let b=0,f;b<a.length;b++)(f=a[b])&&(c+=f.length);else for(const b of a.entries()){const f=b[0],d=Q(b[1]);d?c+=d:a.delete(f)}return c}r.cleanup=function(){if(!this.fastupdate)return this;Q(this.map);this.depth&&Q(this.ctx);return this};
r.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new I);let f=this.cache.get(a);if(!f){f=this.search(a,c,b);if(f.then){const d=this;f.then(function(g){d.cache.set(a,g);return g})}this.cache.set(a,f)}return f};w();export default {Index:L,Charset:null,Encoder:F,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=L;export const Charset=null;export const Encoder=F;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
var r;function u(a,d,b){const f=typeof b,c=typeof a;if("undefined"!==f){if("undefined"!==c){if(b){if("function"===c&&f===c)return function(h){return a(b(h))};d=a.constructor;if(d===b.constructor){if(d===Array)return b.concat(a);if(d===Map){var g=new Map(b);for(var e of a)g.set(e[0],e[1]);return g}if(d===Set){e=new Set(b);for(g of a.values())e.add(g);return e}}}return a}return b}return"undefined"===c?d:a}function w(){return Object.create(null)};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,B=/(\D)(\d{3})/g,D=/(\d{3})(\D)/g,E=/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let d=a.include,b=d||a.exclude||a.split,f;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let c="";f=!d;d||(c+="\\p{Z}");b.letter&&(c+="\\p{L}");b.number&&(c+="\\p{N}",f=!!d);b.symbol&&(c+="\\p{S}");b.punctuation&&(c+="\\p{P}");b.control&&(c+="\\p{C}");if(b=b.char)c+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(d?"^":"")+c+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,f=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,y)}catch(c){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!1,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,0,this.maxlength);this.rtl=u(a.rtl,!1,this.rtl);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const c of this.matcher.keys())this.g+=(this.g?"|":"")+c;if(this.stemmer)for(const c of this.stemmer.keys())this.h+=
(this.h?"|":"")+c;return this};r.addStemmer=function(a,d){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,d);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&G(this);return this};
r.addMapper=function(a,d){if("object"===typeof a)return this.addReplacer(a,d);if(1<a.length)return this.addMatcher(a,d);this.mapper||(this.mapper=new Map);this.mapper.set(a,d);this.cache&&G(this);return this};r.addMatcher=function(a,d){if("object"===typeof a)return this.addReplacer(a,d);if(2>a.length&&(this.dedupe||this.mapper))return this.addMapper(a,d);this.matcher||(this.matcher=new Map);this.matcher.set(a,d);this.g+=(this.g?"|":"")+a;this.s=null;this.cache&&G(this);return this};
r.addReplacer=function(a,d){if("string"===typeof a)return this.addMatcher(a,d);this.replacer||(this.replacer=[]);this.replacer.push(a,d);this.cache&&G(this);return this};
r.encode=function(a){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(B,"$1 $2").replace(D,"$1 $2").replace(z,"$1 "));const d=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=[],f=
this.split||""===this.split?a.split(this.split):a;for(let g=0,e,h;g<f.length;g++)if((e=h=f[g])&&!(e.length<this.minlength))if(d)b.push(e);else if(!this.filter||("function"===typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.o)if(this.l){var c=this.j.get(e);if(c||""===c){c&&b.push(c);continue}}else this.l=setTimeout(G,50,this);this.stemmer&&2<e.length&&(this.u||(this.u=new RegExp("(?!^)("+this.h+")$")),c=e,e=e.replace(this.u,k=>this.stemmer.get(k)),c!==e&&this.filter&&
e.length>=this.minlength&&("function"===typeof this.filter?!this.filter(e):this.filter.has(e))&&(e=""));if(e&&(this.mapper||this.dedupe&&1<e.length)){c="";for(let k=0,n="",m,v;k<e.length;k++)m=e.charAt(k),m===n&&this.dedupe||((v=this.mapper&&this.mapper.get(m))||""===v?v===n&&this.dedupe||!(n=v)||(c+=v):c+=n=m);e=c}this.matcher&&1<e.length&&(this.s||(this.s=new RegExp("("+this.g+")","g")),e=e.replace(this.s,k=>this.matcher.get(k)));if(e&&this.replacer)for(c=0;e&&c<this.replacer.length;c+=2)e=e.replace(this.replacer[c],
this.replacer[c+1]);this.cache&&h.length<=this.o&&(this.j.set(h,e),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));e&&b.push(e)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.m&&(this.i.set(a,b),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return b};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,d,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>d?d?a.slice(b,b+d):a.slice(b):a;let f=[];for(let c=0,g,e;c<a.length;c++)if((g=a[c])&&(e=g.length)){if(b){if(b>=e){b-=e;continue}b<e&&(g=d?g.slice(b,b+d):g.slice(b),e=g.length,b=0)}e>d&&(g=g.slice(0,d),e=d);if(!f.length&&e>=d)return g;f.push(g);d-=e;if(!d)break}return f=1<f.length?[].concat.apply([],f):f[0]};w();const I={normalize:!0};const J={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};K.prototype.add=function(a,d,b,f){if(d&&(a||0===a)){if(!f&&!b&&this.reg.has(a))return this.update(a,d);d=this.encoder.encode(d);if(f=d.length){const n=w(),m=w(),v=this.depth,C=this.resolution;for(let p=0;p<f;p++){let l=d[this.rtl?f-1-p:p];var c=l.length;if(c&&(v||!m[l])){var g=this.score?this.score(d,l,p,null,0):L(C,f,p),e="";switch(this.tokenize){case "full":if(2<c){for(let q=0,t;q<c;q++)for(g=c;g>q;g--){e=l.substring(q,g);t=this.rtl?c-1-q:q;var h=this.score?this.score(d,l,p,e,t):L(C,f,p,c,t);M(this,
m,e,h,a,b)}break}case "bidirectional":case "reverse":if(1<c){for(h=c-1;0<h;h--){e=l[this.rtl?c-1-h:h]+e;var k=this.score?this.score(d,l,p,e,h):L(C,f,p,c,h);M(this,m,e,k,a,b)}e=""}case "forward":if(1<c){for(h=0;h<c;h++)e+=l[this.rtl?c-1-h:h],M(this,m,e,g,a,b);break}default:if(M(this,m,l,g,a,b),v&&1<f&&p<f-1)for(c=w(),e=this.v,g=l,h=Math.min(v+1,this.rtl?p+1:f-p),c[g]=1,k=1;k<h;k++)if((l=d[this.rtl?f-1-p-k:p+k])&&!c[l]){c[l]=1;const q=this.score?this.score(d,g,p,l,k-1):L(e+(f/2>e?0:1),f,p,h-1,k-1),
t=this.bidirectional&&l>g;M(this,n,t?g:l,q,a,b,t?l:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function M(a,d,b,f,c,g,e){let h=e?a.ctx:a.map,k;if(!d[b]||e&&!(k=d[b])[e])e?(d=k||(d[b]=w()),d[e]=1,(k=h.get(e))?h=k:h.set(e,h=new Map)):d[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[f]||(h[f]=[]),g&&h.includes(c)||(h.push(c),a.fastupdate&&((d=a.reg.get(c))?d.push(h):a.reg.set(c,[h])))}function L(a,d,b,f,c){return b&&1<a?d+(f||0)<=a?b+(c||0):(a-1)/(d+(f||0))*(b+(c||0))+1|0:0};K.prototype.search=function(a,d,b){b||(d||"object"!==typeof a?"object"===typeof d&&(b=d,d=0):(b=a,a=""));var f=[],c=0;if(b){a=b.query||a;d=b.limit||d;c=b.offset||0;var g=b.context;var e=b.suggest;var h=!0;var k=b.resolution}else h=!0;a=this.encoder.encode(a);b=a.length;d=d||(h?100:0);if(1===b)return e=c,(c=N(this,a[0],""))&&c.length?H.call(this,c,d,e):[];g=this.depth&&!1!==g;if(2===b&&g&&!e)return e=c,(c=N(this,a[0],a[1]))&&c.length?H.call(this,c,d,e):[];h=w();var n=0;if(1<b&&g){var m=a[0];n=1}k||
0===k||(k=m?this.v:this.resolution);for(let l,q;n<b;n++){if((q=a[n])&&!h[q]){h[q]=1;l=N(this,q,m);a:{g=l;var v=f,C=e,p=k;let t=[];if(g&&g.length){if(g.length<=p){v.push(g);l=void 0;break a}for(let x=0,A;x<p;x++)if(A=g[x])t[x]=A;if(t.length){v.push(t);l=void 0;break a}}l=C?void 0:t}if(l){f=l;break}m&&(e&&l&&f.length||(m=q))}e&&m&&n===b-1&&!f.length&&(k=this.resolution,m="",n=-1,h=w())}a:{a=f;f=a.length;m=a;if(1<f)b:{f=e;m=a.length;e=[];b=w();for(let l=0,q,t,x,A;l<k;l++)for(n=0;n<m;n++)if(x=a[n],l<
x.length&&(q=x[l]))for(g=0;g<q.length;g++)if(t=q[g],(h=b[t])?b[t]++:(h=0,b[t]=1),A=e[h]||(e[h]=[]),A.push(t),d&&h===m-1&&A.length-c===d){m=A;break b}if(a=e.length)if(f){if(1<e.length)c:for(a=[],k=w(),f=e.length,h=f-1;0<=h;h--){if(b=(f=e[h])&&f.length)for(n=0;n<b;n++)if(m=f[n],!k[m])if(k[m]=1,c)c--;else if(a.push(m),a.length===d)break c}else a=(e=e[0]).length>d||c?e.slice(c,d+c):e;e=a}else{if(a<m){m=[];break b}e=e[a-1];if(d||c)if(e.length>d||c)e=e.slice(c,d+c)}m=e}else if(1===f){d=H.call(null,a[0],
d,c);break a}d=m}return d};function N(a,d,b){let f;b&&(f=a.bidirectional&&d>b)&&(f=b,b=d,d=f);a=b?(a=a.ctx.get(b))&&a.get(d):a.map.get(d);return a};K.prototype.remove=function(a,d){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let f=0,c;f<b.length;f++){if(c=b[f])if(2>c.length)c.pop();else{const g=c.indexOf(a);g===b.length-1?c.pop():c.splice(g,1)}}else O(this.map,a),this.depth&&O(this.ctx,a);d||this.reg.delete(a)}return this};
function O(a,d){let b=0;if(a.constructor===Array)for(let f=0,c,g;f<a.length;f++){if((c=a[f])&&c.length)if(g=c.indexOf(d),0<=g){1<c.length?(c.splice(g,1),b++):delete a[f];break}else b++}else for(let f of a.entries()){const c=f[0],g=O(f[1],d);g?b+=g:a.delete(c)}return b};function K(a,d){if(!this||this.constructor!==K)return new K(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},J[b],a))}else a={};b=a.context;const f=!0===b?{depth:1}:b||{},c=a.encode||a.encoder||I;this.encoder=c.encode?c:"object"===typeof c?new F(c):{encode:c};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&f.depth||0;this.bidirectional=!1!==f.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;this.map=new Map;this.ctx=new Map;this.reg=d||(this.fastupdate?new Map:new Set);this.v=f.resolution||3;this.rtl=c.rtl||a.rtl||!1}r=K.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();return this};r.append=function(a,d){return this.add(a,d,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,d){const b=this,f=this.remove(a);return f&&f.then?f.then(()=>b.add(a,d)):this.add(a,d)};
function P(a){let d=0;if(a.constructor===Array)for(let b=0,f;b<a.length;b++)(f=a[b])&&(d+=f.length);else for(const b of a.entries()){const f=b[0],c=P(b[1]);c?d+=c:a.delete(f)}return d}r.cleanup=function(){if(!this.fastupdate)return this;P(this.map);this.depth&&P(this.ctx);return this};w();export default {Index:K,Charset:null,Encoder:F,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=K;export const Charset=null;export const Encoder=F;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -5,60 +5,33 @@ import charset_latin_balance from "./charset/latin/balance.js";
import charset_latin_advanced from "./charset/latin/advanced.js";
import charset_latin_extra from "./charset/latin/extra.js";
import charset_latin_soundex from "./charset/latin/soundex.js";
import charset_arabic_default from "./charset/arabic/default.js";
import charset_cjk_default from "./charset/cjk/default.js";
import charset_cyrillic_default from "./charset/cyrillic/default.js";
export const LatinExact = charset_latin_exact;
export const LatinDefault = charset_latin_default;
export const LatinSimple = charset_latin_simple;
// all charset
export const Exact = charset_latin_exact;
export const Default = charset_latin_default;
export const Normalize = charset_latin_simple;
// latin charset
export const LatinBalance = charset_latin_balance;
export const LatinAdvanced = charset_latin_advanced;
export const LatinExtra = charset_latin_extra;
export const LatinSoundex = charset_latin_soundex;
export const ArabicDefault = charset_arabic_default;
export const CjkDefault = charset_cjk_default;
export const CyrillicDefault = charset_cyrillic_default;
// export const global_lang = create_object();
//export const global_charset = create_object();
// deprecated
export const LatinExact = charset_latin_exact;
export const LatinDefault = charset_latin_default;
export const LatinSimple = charset_latin_simple;
export default {
LatinExact: charset_latin_exact,
LatinDefault: charset_latin_default,
LatinSimple: charset_latin_simple,
LatinBalance: charset_latin_balance,
LatinAdvanced: charset_latin_advanced,
LatinExtra: charset_latin_extra,
LatinSoundex: charset_latin_soundex,
ArabicDefault: charset_arabic_default,
CjkDefault: charset_cjk_default,
CyrillicDefault: charset_cyrillic_default
};
// global_charset["latin:exact"] = charset_exact;
// global_charset["latin:default"] = charset_default;
// global_charset["latin:simple"] = charset_simple;
// global_charset["latin:balance"] = charset_balance;
// global_charset["latin:advanced"] = charset_advanced;
// global_charset["latin:extra"] = charset_extra;
// global_charset["latin:soundex"] = charset_soundex;
/**
* @param {!string} name
* @param {Object} charset
*/
// export function registerCharset(name, charset){
// global_charset[name] = charset;
// }
/**
* @param {!string} name
* @param {Object} lang
*/
// export function registerLanguage(name, lang){
// global_lang[name] = lang;
// }
// all charset
Exact: charset_latin_exact,
Default: charset_latin_default,
Normalize: charset_latin_simple,
// latin charset
LatinBalance: charset_latin_balance,
LatinAdvanced: charset_latin_advanced,
LatinExtra: charset_latin_extra,
LatinSoundex: charset_latin_soundex,
// deprecated
LatinExact: charset_latin_exact,
LatinDefault: charset_latin_default,
LatinSimple: charset_latin_simple
};

View File

@@ -1,17 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g,
split = /\s+/,
options = {
// the string is already encoded as RTL by default
//rtl: true,
normalize: !1,
dedupe: !0,
prepare: function (str) {
return ("" + str).replace(regex, " ");
}
};
/** @type EncoderOptions */
export default options;

View File

@@ -1,15 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g,
options = {
normalize: !1,
dedupe: !0,
split: "",
prepare: function (str) {
return ("" + str).replace(regex, "");
}
};
/** @type EncoderOptions */
export default options;

View File

@@ -1,14 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g,
options = {
normalize: !1,
dedupe: !0,
prepare: function (str) {
return ("" + str).replace(regex, " ");
}
};
/** @type EncoderOptions */
export default options;

View File

@@ -2,10 +2,10 @@ import { EncoderOptions } from "../../type.js";
/** @type EncoderOptions */
const options = {
normalize: function (str) {
return str.toLowerCase();
}
//numeric: false,
normalize: !0
// normalize: function(str){
// return str.toLowerCase();
// },
//dedupe: false
};
export default options;

View File

@@ -2,8 +2,10 @@ import { EncoderOptions } from "../../type.js";
/** @type EncoderOptions */
const options = {
split: /\s+/,
normalize: !1
normalize: !1,
numeric: !1,
split: /\s+/
//normalize: false,
//dedupe: false
};
export default options;

View File

@@ -49,7 +49,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
numeric_split_length = /(\d{3})/g,
numeric_split_prev_char = /(\D)(\d{3})/g,
numeric_split_next_char = /(\d{3})(\D)/g,
normalize = /[\u0300-\u036f]/g; // /[\p{Z}\p{S}\p{P}\p{C}]+/u;
normalize = /*"".normalize &&*//[\u0300-\u036f]/g; // /[\p{Z}\p{S}\p{P}\p{C}]+/u;
//const numeric_split = /(\d{3})/g;
//.replace(/(\d{3})/g, "$1 ")
@@ -178,10 +178,13 @@ Encoder.prototype.assign = function (options) {
this.finalize = /** @type {Function|null} */merge_option(options.finalize, null, this.finalize);
// assign the normalization fallback to the mapper
if (!normalize) {
this.mapper = new Map(
/** @type {Array<Array<string, string>>} */normalize_polyfill);
}
// if(SUPPORT_CHARSET && !normalize){
// this.mapper = new Map(
// /** @type {Array<Array<string, string>>} */ (
// normalize_polyfill
// )
// );
// }
tmp = options.filter;
this.filter = "function" == typeof tmp ? tmp : merge_option(tmp && new Set(tmp), null, this.filter);
@@ -195,6 +198,7 @@ Encoder.prototype.assign = function (options) {
this.rtl = merge_option(options.rtl, !1, this.rtl);
// auto-balanced cache
//if(SUPPORT_CACHE){
this.cache = tmp = merge_option(options.cache, !0, this.cache);
if (tmp) {
this.timer = null;
@@ -204,6 +208,7 @@ Encoder.prototype.assign = function (options) {
this.cache_enc_length = 128;
this.cache_term_length = 128;
}
//}
// regex temporary state
this.matcher_str = "";
@@ -249,7 +254,7 @@ Encoder.prototype.addStemmer = function (match, replace) {
this.stemmer.set(match, replace);
this.stemmer_str += (this.stemmer_str ? "|" : "") + match;
this.stemmer_test = null;
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -261,7 +266,7 @@ Encoder.prototype.addFilter = function (term) {
this.filter || (this.filter = new Set());
this.filter.add(term);
}
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -283,7 +288,7 @@ Encoder.prototype.addMapper = function (char_match, char_replace) {
}
this.mapper || (this.mapper = new Map());
this.mapper.set(char_match, char_replace);
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -308,7 +313,7 @@ Encoder.prototype.addMatcher = function (match, replace) {
this.matcher.set(match, replace);
this.matcher_str += (this.matcher_str ? "|" : "") + match;
this.matcher_test = null;
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -324,7 +329,7 @@ Encoder.prototype.addReplacer = function (regex, replace) {
}
this.replacer || (this.replacer = []);
this.replacer.push(regex, replace);
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -337,7 +342,7 @@ Encoder.prototype.encode = function (str) {
//if(!str) return str;
// todo remove dupe terms
if (this.cache && str.length <= this.cache_enc_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && str.length <= this.cache_enc_length) {
if (this.timer) {
if (this.cache_enc.has(str)) {
return this.cache_enc.get(str);
@@ -404,7 +409,7 @@ Encoder.prototype.encode = function (str) {
continue;
}
if (this.cache && word.length <= this.cache_term_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && word.length <= this.cache_term_length) {
if (this.timer) {
const tmp = this.cache_term.get(word);
if (tmp || "" === tmp) {
@@ -479,7 +484,7 @@ Encoder.prototype.encode = function (str) {
//word = word.replace(/(.)\1+/g, "$1");
//word = word.replace(/(?<=(.))\1+/g, "");
if (this.cache && base.length <= this.cache_term_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && base.length <= this.cache_term_length) {
this.cache_term.set(base, word);
if (this.cache_term.size > this.cache_size) {
this.cache_term.clear();
@@ -494,7 +499,7 @@ Encoder.prototype.encode = function (str) {
final = this.finalize(final) || final;
}
if (this.cache && str.length <= this.cache_enc_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && str.length <= this.cache_enc_length) {
this.cache_enc.set(str, final);
if (this.cache_enc.size > this.cache_size) {
this.cache_enc.clear();

View File

@@ -48,7 +48,7 @@ export default function Index(options, _register) {
this.resolution = options.resolution || 9;
this.tokenize = tmp = (tmp = options.tokenize) && "default" !== tmp && tmp || "strict";
this.tokenize = tmp = (tmp = options.tokenize) && "default" !== tmp && "exact" !== tmp && tmp || "strict";
this.depth = "strict" === tmp && context.depth || 0;
this.bidirectional = !1 !== context.bidirectional;
this.fastupdate = !!options.fastupdate;

View File

@@ -72,6 +72,7 @@ Index.prototype.add = function (id, content, _append, _skip_update) {
break;
}
// fallthrough to next case when term length < 3
case "bidirectional":
case "reverse":
// skip last round (this token exist already in "forward")
if (1 < term_length) {

View File

@@ -1 +1 @@
import charset_latin_exact from"./charset/latin/exact.js";import charset_latin_default from"./charset/latin/default.js";import charset_latin_simple from"./charset/latin/simple.js";import charset_latin_balance from"./charset/latin/balance.js";import charset_latin_advanced from"./charset/latin/advanced.js";import charset_latin_extra from"./charset/latin/extra.js";import charset_latin_soundex from"./charset/latin/soundex.js";import charset_arabic_default from"./charset/arabic/default.js";import charset_cjk_default from"./charset/cjk/default.js";import charset_cyrillic_default from"./charset/cyrillic/default.js";export const LatinExact=charset_latin_exact;export const LatinDefault=charset_latin_default;export const LatinSimple=charset_latin_simple;export const LatinBalance=charset_latin_balance;export const LatinAdvanced=charset_latin_advanced;export const LatinExtra=charset_latin_extra;export const LatinSoundex=charset_latin_soundex;export const ArabicDefault=charset_arabic_default;export const CjkDefault=charset_cjk_default;export const CyrillicDefault=charset_cyrillic_default;export default{LatinExact:charset_latin_exact,LatinDefault:charset_latin_default,LatinSimple:charset_latin_simple,LatinBalance:charset_latin_balance,LatinAdvanced:charset_latin_advanced,LatinExtra:charset_latin_extra,LatinSoundex:charset_latin_soundex,ArabicDefault:charset_arabic_default,CjkDefault:charset_cjk_default,CyrillicDefault:charset_cyrillic_default};
import charset_latin_exact from"./charset/latin/exact.js";import charset_latin_default from"./charset/latin/default.js";import charset_latin_simple from"./charset/latin/simple.js";import charset_latin_balance from"./charset/latin/balance.js";import charset_latin_advanced from"./charset/latin/advanced.js";import charset_latin_extra from"./charset/latin/extra.js";import charset_latin_soundex from"./charset/latin/soundex.js";export const Exact=charset_latin_exact;export const Default=charset_latin_default;export const Normalize=charset_latin_simple;export const LatinBalance=charset_latin_balance;export const LatinAdvanced=charset_latin_advanced;export const LatinExtra=charset_latin_extra;export const LatinSoundex=charset_latin_soundex;export const LatinExact=charset_latin_exact;export const LatinDefault=charset_latin_default;export const LatinSimple=charset_latin_simple;export default{Exact:charset_latin_exact,Default:charset_latin_default,Normalize:charset_latin_simple,LatinBalance:charset_latin_balance,LatinAdvanced:charset_latin_advanced,LatinExtra:charset_latin_extra,LatinSoundex:charset_latin_soundex,LatinExact:charset_latin_exact,LatinDefault:charset_latin_default,LatinSimple:charset_latin_simple};

View File

@@ -1 +0,0 @@
import{EncoderOptions}from"../../type.js";const regex=/[\x00-\x7F]+/g,split=/\s+/,options={normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(regex," ")}};export default options;

View File

@@ -1 +0,0 @@
import{EncoderOptions}from"../../type.js";const regex=/[\x00-\x7F]+/g,options={normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(regex,"")}};export default options;

View File

@@ -1 +0,0 @@
import{EncoderOptions}from"../../type.js";const regex=/[\x00-\x7F]+/g,options={normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(regex," ")}};export default options;

View File

@@ -1 +1 @@
import{EncoderOptions}from"../../type.js";const options={normalize:function(a){return a.toLowerCase()}};export default options;
import{EncoderOptions}from"../../type.js";const options={normalize:!0};export default options;

View File

@@ -1 +1 @@
import{EncoderOptions}from"../../type.js";const options={split:/\s+/,normalize:!1};export default options;
import{EncoderOptions}from"../../type.js";const options={normalize:!1,numeric:!1,split:/\s+/};export default options;

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{IndexOptions,ContextOptions,EncoderOptions}from"./type.js";import Encoder from"./encoder.js";import Cache,{searchCache}from"./cache.js";import Charset from"./charset.js";import{KeystoreMap,KeystoreSet}from"./keystore.js";import{is_array,is_string}from"./common.js";import{exportIndex,importIndex,serialize}from"./serialize.js";import default_encoder from"./charset/latin/default.js";import apply_preset from"./preset.js";import apply_async from"./async.js";import tick from"./profiler.js";import"./index/add.js";import"./index/search.js";import"./index/remove.js";export default function Index(a,b){if(!this||this.constructor!==Index)return new Index(a);!1,a=a?apply_preset(a):{};let c=a.context;const d=!0===c?{depth:1}:c||{},e=is_string(a.encoder)?Charset[a.encoder]:a.encode||a.encoder||default_encoder;this.encoder=e.encode?e:"object"==typeof e?new Encoder(e):{encode:e},this.compress=a.compress||a.compression||!1,this.resolution=a.resolution||9,this.tokenize=c=(c=a.tokenize)&&"default"!==c&&c||"strict",this.depth="strict"===c&&d.depth||0,this.bidirectional=!1!==d.bidirectional,this.fastupdate=!!a.fastupdate,this.score=a.score||null,!1,c=a.keystore||0,c&&(this.keystore=c),this.map=c&&!0?new KeystoreMap(c):new Map,this.ctx=c&&!0?new KeystoreMap(c):new Map,this.reg=b||(this.fastupdate?c&&!0?new KeystoreMap(c):new Map:c&&!0?new KeystoreSet(c):new Set),this.resolution_ctx=d.resolution||3,this.rtl=e.rtl||a.rtl||!1,this.cache=(c=a.cache||null)&&new Cache(c),this.resolve=!1!==a.resolve,(c=a.db)&&(this.db=this.mount(c)),this.commit_auto=!1!==a.commit,this.commit_task=[],this.commit_timer=null,this.priority=a.priority||4}Index.prototype.mount=function(a){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),a.mount(this)},Index.prototype.commit=function(a,b){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this,a,b)},Index.prototype.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};export function autoCommit(a,b,c){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null,a.db.commit(a,b,c)},1))}Index.prototype.clear=function(){return 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}]),this},Index.prototype.append=function(a,b){return this.add(a,b,!0)},Index.prototype.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)},Index.prototype.update=function(a,b){const c=this,d=this.remove(a);return d&&d.then?d.then(()=>c.add(a,b)):this.add(a,b)};function cleanup_index(a){let b=0;if(is_array(a))for(let c,d=0;d<a.length;d++)(c=a[d])&&(b+=c.length);else for(const c of a.entries()){const d=c[0],e=c[1],f=cleanup_index(e);f?b+=f:a.delete(d)}return b}Index.prototype.cleanup=function(){return this.fastupdate?(cleanup_index(this.map),this.depth&&cleanup_index(this.ctx),this):(!1,this)},Index.prototype.searchCache=searchCache,Index.prototype.export=exportIndex,Index.prototype.import=importIndex,Index.prototype.serialize=serialize,apply_async(Index.prototype);
import{IndexOptions,ContextOptions,EncoderOptions}from"./type.js";import Encoder from"./encoder.js";import Cache,{searchCache}from"./cache.js";import Charset from"./charset.js";import{KeystoreMap,KeystoreSet}from"./keystore.js";import{is_array,is_string}from"./common.js";import{exportIndex,importIndex,serialize}from"./serialize.js";import default_encoder from"./charset/latin/default.js";import apply_preset from"./preset.js";import apply_async from"./async.js";import tick from"./profiler.js";import"./index/add.js";import"./index/search.js";import"./index/remove.js";export default function Index(a,b){if(!this||this.constructor!==Index)return new Index(a);!1,a=a?apply_preset(a):{};let c=a.context;const d=!0===c?{depth:1}:c||{},e=is_string(a.encoder)?Charset[a.encoder]:a.encode||a.encoder||default_encoder;this.encoder=e.encode?e:"object"==typeof e?new Encoder(e):{encode:e},this.compress=a.compress||a.compression||!1,this.resolution=a.resolution||9,this.tokenize=c=(c=a.tokenize)&&"default"!==c&&"exact"!==c&&c||"strict",this.depth="strict"===c&&d.depth||0,this.bidirectional=!1!==d.bidirectional,this.fastupdate=!!a.fastupdate,this.score=a.score||null,!1,c=a.keystore||0,c&&(this.keystore=c),this.map=c&&!0?new KeystoreMap(c):new Map,this.ctx=c&&!0?new KeystoreMap(c):new Map,this.reg=b||(this.fastupdate?c&&!0?new KeystoreMap(c):new Map:c&&!0?new KeystoreSet(c):new Set),this.resolution_ctx=d.resolution||3,this.rtl=e.rtl||a.rtl||!1,this.cache=(c=a.cache||null)&&new Cache(c),this.resolve=!1!==a.resolve,(c=a.db)&&(this.db=this.mount(c)),this.commit_auto=!1!==a.commit,this.commit_task=[],this.commit_timer=null,this.priority=a.priority||4}Index.prototype.mount=function(a){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),a.mount(this)},Index.prototype.commit=function(a,b){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this,a,b)},Index.prototype.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};export function autoCommit(a,b,c){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null,a.db.commit(a,b,c)},1))}Index.prototype.clear=function(){return 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}]),this},Index.prototype.append=function(a,b){return this.add(a,b,!0)},Index.prototype.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)},Index.prototype.update=function(a,b){const c=this,d=this.remove(a);return d&&d.then?d.then(()=>c.add(a,b)):this.add(a,b)};function cleanup_index(a){let b=0;if(is_array(a))for(let c,d=0;d<a.length;d++)(c=a[d])&&(b+=c.length);else for(const c of a.entries()){const d=c[0],e=c[1],f=cleanup_index(e);f?b+=f:a.delete(d)}return b}Index.prototype.cleanup=function(){return this.fastupdate?(cleanup_index(this.map),this.depth&&cleanup_index(this.ctx),this):(!1,this)},Index.prototype.searchCache=searchCache,Index.prototype.export=exportIndex,Index.prototype.import=importIndex,Index.prototype.serialize=serialize,apply_async(Index.prototype);

View File

@@ -1 +1 @@
import{create_object}from"../common.js";import Index,{autoCommit}from"../index.js";import default_compress from"../compress.js";import{KeystoreArray}from"../keystore.js";Index.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);const e=b.length;if(e){const d=create_object(),f=create_object(),g=this.depth,h=this.resolution;for(let j=0;j<e;j++){let i=b[this.rtl?e-1-j:j],k=i.length;if(k&&(g||!f[i])){let l=this.score?this.score(b,i,j,null,0):get_score(h,e,j),m="";switch(this.tokenize){case"full":if(2<k){for(let d,g=0;g<k;g++)for(let l=k;l>g;l--){m=i.substring(g,l),d=this.rtl?k-1-g:g;const n=this.score?this.score(b,i,j,m,d):get_score(h,e,j,k,d);this.push_index(f,m,n,a,c)}break}case"reverse":if(1<k){for(let d=k-1;0<d;d--){m=i[this.rtl?k-1-d:d]+m;const g=this.score?this.score(b,i,j,m,d):get_score(h,e,j,k,d);this.push_index(f,m,g,a,c)}m=""}case"forward":if(1<k){for(let b=0;b<k;b++)m+=i[this.rtl?k-1-b:b],this.push_index(f,m,l,a,c);break}default:if(this.push_index(f,i,l,a,c),g&&1<e&&j<e-1){const f=create_object(),h=this.resolution_ctx,k=i,l=Math.min(g+1,this.rtl?j+1:e-j);f[k]=1;for(let g=1;g<l;g++)if(i=b[this.rtl?e-1-j-g:j+g],i&&!f[i]){f[i]=1;const m=this.score?this.score(b,k,j,i,g-1):get_score(h+(e/2>h?0:1),e,j,l-1,g-1),n=this.bidirectional&&i>k;this.push_index(d,n?k:i,m,a,c,n?i:k)}}}}}this.fastupdate||this.reg.add(a)}else b=""}return this.db&&(b||this.commit_task.push({del:a}),this.commit_auto&&autoCommit(this)),this},Index.prototype.push_index=function(a,b,c,d,e,f){let g,h=f?this.ctx:this.map;if((!a[b]||f&&!(g=a[b])[f])&&(f?(a=g||(a[b]=create_object()),a[f]=1,this.compress&&(f=default_compress(f)),g=h.get(f),g?h=g:h.set(f,h=new Map)):a[b]=1,this.compress&&(b=default_compress(b)),g=h.get(b),g?h=g:h.set(b,h=g=[]),h=h[c]||(h[c]=[]),!e||!h.includes(d))){if(2147483647===h.length){const a=new KeystoreArray(h);if(this.fastupdate)for(let b of this.reg.values())b.includes(h)&&(b[b.indexOf(h)]=a);g[c]=h=a}if(h.push(d),this.fastupdate){const a=this.reg.get(d);a?a.push(h):this.reg.set(d,[h])}}};function get_score(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):0|(a-1)/(b+(d||0))*(c+(e||0))+1:0}
import{create_object}from"../common.js";import Index,{autoCommit}from"../index.js";import default_compress from"../compress.js";import{KeystoreArray}from"../keystore.js";Index.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);const e=b.length;if(e){const d=create_object(),f=create_object(),g=this.depth,h=this.resolution;for(let j=0;j<e;j++){let i=b[this.rtl?e-1-j:j],k=i.length;if(k&&(g||!f[i])){let l=this.score?this.score(b,i,j,null,0):get_score(h,e,j),m="";switch(this.tokenize){case"full":if(2<k){for(let d,g=0;g<k;g++)for(let l=k;l>g;l--){m=i.substring(g,l),d=this.rtl?k-1-g:g;const n=this.score?this.score(b,i,j,m,d):get_score(h,e,j,k,d);this.push_index(f,m,n,a,c)}break}case"bidirectional":case"reverse":if(1<k){for(let d=k-1;0<d;d--){m=i[this.rtl?k-1-d:d]+m;const g=this.score?this.score(b,i,j,m,d):get_score(h,e,j,k,d);this.push_index(f,m,g,a,c)}m=""}case"forward":if(1<k){for(let b=0;b<k;b++)m+=i[this.rtl?k-1-b:b],this.push_index(f,m,l,a,c);break}default:if(this.push_index(f,i,l,a,c),g&&1<e&&j<e-1){const f=create_object(),h=this.resolution_ctx,k=i,l=Math.min(g+1,this.rtl?j+1:e-j);f[k]=1;for(let g=1;g<l;g++)if(i=b[this.rtl?e-1-j-g:j+g],i&&!f[i]){f[i]=1;const m=this.score?this.score(b,k,j,i,g-1):get_score(h+(e/2>h?0:1),e,j,l-1,g-1),n=this.bidirectional&&i>k;this.push_index(d,n?k:i,m,a,c,n?i:k)}}}}}this.fastupdate||this.reg.add(a)}else b=""}return this.db&&(b||this.commit_task.push({del:a}),this.commit_auto&&autoCommit(this)),this},Index.prototype.push_index=function(a,b,c,d,e,f){let g,h=f?this.ctx:this.map;if((!a[b]||f&&!(g=a[b])[f])&&(f?(a=g||(a[b]=create_object()),a[f]=1,this.compress&&(f=default_compress(f)),g=h.get(f),g?h=g:h.set(f,h=new Map)):a[b]=1,this.compress&&(b=default_compress(b)),g=h.get(b),g?h=g:h.set(b,h=g=[]),h=h[c]||(h[c]=[]),!e||!h.includes(d))){if(2147483647===h.length){const a=new KeystoreArray(h);if(this.fastupdate)for(let b of this.reg.values())b.includes(h)&&(b[b.indexOf(h)]=a);g[c]=h=a}if(h.push(d),this.fastupdate){const a=this.reg.get(d);a?a.push(h):this.reg.set(d,[h])}}};function get_score(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):0|(a-1)/(b+(d||0))*(c+(e||0))+1:0}

View File

@@ -5,60 +5,33 @@ import charset_latin_balance from "./charset/latin/balance.js";
import charset_latin_advanced from "./charset/latin/advanced.js";
import charset_latin_extra from "./charset/latin/extra.js";
import charset_latin_soundex from "./charset/latin/soundex.js";
import charset_arabic_default from "./charset/arabic/default.js";
import charset_cjk_default from "./charset/cjk/default.js";
import charset_cyrillic_default from "./charset/cyrillic/default.js";
export const LatinExact = charset_latin_exact;
export const LatinDefault = charset_latin_default;
export const LatinSimple = charset_latin_simple;
// all charset
export const Exact = charset_latin_exact;
export const Default = charset_latin_default;
export const Normalize = charset_latin_simple;
// latin charset
export const LatinBalance = charset_latin_balance;
export const LatinAdvanced = charset_latin_advanced;
export const LatinExtra = charset_latin_extra;
export const LatinSoundex = charset_latin_soundex;
export const ArabicDefault = charset_arabic_default;
export const CjkDefault = charset_cjk_default;
export const CyrillicDefault = charset_cyrillic_default;
// export const global_lang = create_object();
//export const global_charset = create_object();
// deprecated
export const LatinExact = charset_latin_exact;
export const LatinDefault = charset_latin_default;
export const LatinSimple = charset_latin_simple;
export default {
LatinExact: charset_latin_exact,
LatinDefault: charset_latin_default,
LatinSimple: charset_latin_simple,
LatinBalance: charset_latin_balance,
LatinAdvanced: charset_latin_advanced,
LatinExtra: charset_latin_extra,
LatinSoundex: charset_latin_soundex,
ArabicDefault: charset_arabic_default,
CjkDefault: charset_cjk_default,
CyrillicDefault: charset_cyrillic_default
};
// global_charset["latin:exact"] = charset_exact;
// global_charset["latin:default"] = charset_default;
// global_charset["latin:simple"] = charset_simple;
// global_charset["latin:balance"] = charset_balance;
// global_charset["latin:advanced"] = charset_advanced;
// global_charset["latin:extra"] = charset_extra;
// global_charset["latin:soundex"] = charset_soundex;
/**
* @param {!string} name
* @param {Object} charset
*/
// export function registerCharset(name, charset){
// global_charset[name] = charset;
// }
/**
* @param {!string} name
* @param {Object} lang
*/
// export function registerLanguage(name, lang){
// global_lang[name] = lang;
// }
// all charset
Exact: charset_latin_exact,
Default: charset_latin_default,
Normalize: charset_latin_simple,
// latin charset
LatinBalance: charset_latin_balance,
LatinAdvanced: charset_latin_advanced,
LatinExtra: charset_latin_extra,
LatinSoundex: charset_latin_soundex,
// deprecated
LatinExact: charset_latin_exact,
LatinDefault: charset_latin_default,
LatinSimple: charset_latin_simple
};

View File

@@ -1,17 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g,
split = /\s+/,
options = {
// the string is already encoded as RTL by default
//rtl: true,
normalize: !1,
dedupe: !0,
prepare: function (str) {
return ("" + str).replace(regex, " ");
}
};
/** @type EncoderOptions */
export default options;

View File

@@ -1,15 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g,
options = {
normalize: !1,
dedupe: !0,
split: "",
prepare: function (str) {
return ("" + str).replace(regex, "");
}
};
/** @type EncoderOptions */
export default options;

View File

@@ -1,14 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g,
options = {
normalize: !1,
dedupe: !0,
prepare: function (str) {
return ("" + str).replace(regex, " ");
}
};
/** @type EncoderOptions */
export default options;

View File

@@ -2,10 +2,10 @@ import { EncoderOptions } from "../../type.js";
/** @type EncoderOptions */
const options = {
normalize: function (str) {
return str.toLowerCase();
}
//numeric: false,
normalize: !0
// normalize: function(str){
// return str.toLowerCase();
// },
//dedupe: false
};
export default options;

View File

@@ -2,8 +2,10 @@ import { EncoderOptions } from "../../type.js";
/** @type EncoderOptions */
const options = {
split: /\s+/,
normalize: !1
normalize: !1,
numeric: !1,
split: /\s+/
//normalize: false,
//dedupe: false
};
export default options;

View File

@@ -49,7 +49,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
numeric_split_length = /(\d{3})/g,
numeric_split_prev_char = /(\D)(\d{3})/g,
numeric_split_next_char = /(\d{3})(\D)/g,
normalize = /[\u0300-\u036f]/g; // /[\p{Z}\p{S}\p{P}\p{C}]+/u;
normalize = /*"".normalize &&*//[\u0300-\u036f]/g; // /[\p{Z}\p{S}\p{P}\p{C}]+/u;
//const numeric_split = /(\d{3})/g;
//.replace(/(\d{3})/g, "$1 ")
@@ -176,10 +176,13 @@ Encoder.prototype.assign = function (options) {
this.finalize = /** @type {Function|null} */merge_option(options.finalize, null, this.finalize);
// assign the normalization fallback to the mapper
if (!normalize) {
this.mapper = new Map(
/** @type {Array<Array<string, string>>} */normalize_polyfill);
}
// if(SUPPORT_CHARSET && !normalize){
// this.mapper = new Map(
// /** @type {Array<Array<string, string>>} */ (
// normalize_polyfill
// )
// );
// }
tmp = options.filter;
this.filter = "function" == typeof tmp ? tmp : merge_option(tmp && new Set(tmp), null, this.filter);
@@ -193,6 +196,7 @@ Encoder.prototype.assign = function (options) {
this.rtl = merge_option(options.rtl, !1, this.rtl);
// auto-balanced cache
//if(SUPPORT_CACHE){
this.cache = tmp = merge_option(options.cache, !0, this.cache);
if (tmp) {
this.timer = null;
@@ -202,6 +206,7 @@ Encoder.prototype.assign = function (options) {
this.cache_enc_length = 128;
this.cache_term_length = 128;
}
//}
// regex temporary state
this.matcher_str = "";
@@ -247,7 +252,7 @@ Encoder.prototype.addStemmer = function (match, replace) {
this.stemmer.set(match, replace);
this.stemmer_str += (this.stemmer_str ? "|" : "") + match;
this.stemmer_test = null;
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -259,7 +264,7 @@ Encoder.prototype.addFilter = function (term) {
this.filter || (this.filter = new Set());
this.filter.add(term);
}
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -281,7 +286,7 @@ Encoder.prototype.addMapper = function (char_match, char_replace) {
}
this.mapper || (this.mapper = new Map());
this.mapper.set(char_match, char_replace);
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -306,7 +311,7 @@ Encoder.prototype.addMatcher = function (match, replace) {
this.matcher.set(match, replace);
this.matcher_str += (this.matcher_str ? "|" : "") + match;
this.matcher_test = null;
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -322,7 +327,7 @@ Encoder.prototype.addReplacer = function (regex, replace) {
}
this.replacer || (this.replacer = []);
this.replacer.push(regex, replace);
this.cache && clear(this);
/*SUPPORT_CACHE &&*/this.cache && clear(this);
return this;
};
@@ -335,7 +340,7 @@ Encoder.prototype.encode = function (str) {
//if(!str) return str;
// todo remove dupe terms
if (this.cache && str.length <= this.cache_enc_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && str.length <= this.cache_enc_length) {
if (this.timer) {
if (this.cache_enc.has(str)) {
return this.cache_enc.get(str);
@@ -402,7 +407,7 @@ Encoder.prototype.encode = function (str) {
continue;
}
if (this.cache && word.length <= this.cache_term_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && word.length <= this.cache_term_length) {
if (this.timer) {
const tmp = this.cache_term.get(word);
if (tmp || "" === tmp) {
@@ -477,7 +482,7 @@ Encoder.prototype.encode = function (str) {
//word = word.replace(/(.)\1+/g, "$1");
//word = word.replace(/(?<=(.))\1+/g, "");
if (this.cache && base.length <= this.cache_term_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && base.length <= this.cache_term_length) {
this.cache_term.set(base, word);
if (this.cache_term.size > this.cache_size) {
this.cache_term.clear();
@@ -492,7 +497,7 @@ Encoder.prototype.encode = function (str) {
final = this.finalize(final) || final;
}
if (this.cache && str.length <= this.cache_enc_length) {
if ( /*SUPPORT_CACHE &&*/this.cache && str.length <= this.cache_enc_length) {
this.cache_enc.set(str, final);
if (this.cache_enc.size > this.cache_size) {
this.cache_enc.clear();

View File

@@ -48,7 +48,7 @@ export default function Index(options, _register) {
this.resolution = options.resolution || 9;
this.tokenize = tmp = (tmp = options.tokenize) && "default" !== tmp && tmp || "strict";
this.tokenize = tmp = (tmp = options.tokenize) && "default" !== tmp && "exact" !== tmp && tmp || "strict";
this.depth = "strict" === tmp && context.depth || 0;
this.bidirectional = !1 !== context.bidirectional;
this.fastupdate = !!options.fastupdate;

View File

@@ -72,6 +72,7 @@ Index.prototype.add = function (id, content, _append, _skip_update) {
break;
}
// fallthrough to next case when term length < 3
case "bidirectional":
case "reverse":
// skip last round (this token exist already in "forward")
if (1 < term_length) {

25
index.d.ts vendored
View File

@@ -35,28 +35,30 @@ declare module "flexsearch" {
* * Add custom tokenizer: https://github.com/nextapps-de/flexsearch#add-custom-tokenizer
*/
type Tokenizer =
| "strict"
| "strict" | "exact" | "default"
| "forward"
| "reverse"
| "full"
| "default";
| "reverse" | "bidirectional"
| "full";
/**
* **Document:**
* * Encoders: https://github.com/nextapps-de/flexsearch#encoders
*/
type Encoders =
| "Exact"
| "Default"
| "Normalize"
/** @deprecated */
| "LatinExact"
/** @deprecated */
| "LatinDefault"
/** @deprecated */
| "LatinSimple"
| "LatinBalance"
| "LatinAdvanced"
| "LatinExtra"
| "LatinSoundex"
| "ArabicDefault"
| "CjkDefault"
| "CryllicDefault"
| ((x: string) => string[]);
| ((term: string) => string[]);
/**
* **Document:**
@@ -93,7 +95,7 @@ declare module "flexsearch" {
field?: FieldName | FieldName[] | FieldOptions | Array<FieldOptions>;
index?: FieldName | FieldName[] | FieldOptions | Array<FieldOptions>;
tag?: FieldName | FieldName[] | TagOptions | Array<TagOptions>;
store?: FieldName | FieldName[] | StoreOptions | Array<StoreOptions>;
store?: FieldName | FieldName[] | StoreOptions | Array<StoreOptions> | boolean;
};
type WorkerURL = string;
@@ -581,3 +583,8 @@ declare module "flexsearch" {
db: IDBDatabase
}
}
// https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
// https://github.com/futurGH/ts-to-jsdoc
// https://sethmac.com/typescript-to-jsdoc/

View File

@@ -2,7 +2,7 @@
"public": true,
"preferGlobal": false,
"name": "flexsearch",
"version": "0.8.142",
"version": "0.8.143",
"description": "Next-Generation full-text search library for Browser and Node.js",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",
@@ -68,8 +68,8 @@
"build:bundle:debug": "node task/build RELEASE=bundle DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:compact": "node task/build RELEASE=compact DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:compact:debug": "node task/build RELEASE=compact DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:light": "node task/build RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:light:debug": "node task/build RELEASE=light DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:light": "node task/build RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:light:debug": "node task/build RELEASE=light DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:es5": "node task/build RELEASE=es5 DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false LANGUAGE_OUT=ECMASCRIPT5_STRICT",
"build:es5:debug": "node task/build RELEASE=es5 DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT LANGUAGE_OUT=ECMASCRIPT5_STRICT",
"build:lang": "node task/build RELEASE=lang",
@@ -81,8 +81,8 @@
"build:module:bundle:debug": "node task/build RELEASE=bundle.module DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:module:compact": "node task/build RELEASE=compact.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:module:compact:debug": "node task/build RELEASE=compact.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:module:light": "node task/build RELEASE=light.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:module:light:debug": "node task/build RELEASE=light.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:module:light": "node task/build RELEASE=light.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:module:light:debug": "node task/build RELEASE=light.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:all": "npm run build:bundle && npm run build:bundle:debug && npm run build:light && npm run build:light:debug && npm run build:compact && npm run build:compact:debug && npm run build:module && npm run build:module:debug && npm run build:module:min && npm run build:module:bundle && npm run build:module:bundle:debug && npm run build:module:light && npm run build:module:light:debug && npm run build:module:compact && npm run build:module:compact:debug && npm run build:es5 && npm run build:es5:debug && npm run build:lang && npm run build:db",
"build:custom": "node task/build RELEASE=custom",
"test:all": "cd test/ && npm install && npm run test:all && cd ..",

View File

@@ -5,60 +5,33 @@ import charset_latin_balance from "./charset/latin/balance.js";
import charset_latin_advanced from "./charset/latin/advanced.js";
import charset_latin_extra from "./charset/latin/extra.js";
import charset_latin_soundex from "./charset/latin/soundex.js";
import charset_arabic_default from "./charset/arabic/default.js";
import charset_cjk_default from "./charset/cjk/default.js";
import charset_cyrillic_default from "./charset/cyrillic/default.js";
export const LatinExact = charset_latin_exact;
export const LatinDefault = charset_latin_default;
export const LatinSimple = charset_latin_simple;
// all charset
export const Exact = charset_latin_exact;
export const Default = charset_latin_default;
export const Normalize = charset_latin_simple;
// latin charset
export const LatinBalance = charset_latin_balance;
export const LatinAdvanced = charset_latin_advanced;
export const LatinExtra = charset_latin_extra;
export const LatinSoundex = charset_latin_soundex;
export const ArabicDefault = charset_arabic_default;
export const CjkDefault = charset_cjk_default;
export const CyrillicDefault = charset_cyrillic_default;
// export const global_lang = create_object();
//export const global_charset = create_object();
// deprecated
export const LatinExact = charset_latin_exact;
export const LatinDefault = charset_latin_default;
export const LatinSimple = charset_latin_simple;
export default {
LatinExact: charset_latin_exact,
LatinDefault: charset_latin_default,
LatinSimple: charset_latin_simple,
// all charset
Exact: charset_latin_exact,
Default: charset_latin_default,
Normalize: charset_latin_simple,
// latin charset
LatinBalance: charset_latin_balance,
LatinAdvanced: charset_latin_advanced,
LatinExtra: charset_latin_extra,
LatinSoundex: charset_latin_soundex,
ArabicDefault: charset_arabic_default,
CjkDefault: charset_cjk_default,
CyrillicDefault: charset_cyrillic_default
// deprecated
LatinExact: charset_latin_exact,
LatinDefault: charset_latin_default,
LatinSimple: charset_latin_simple,
};
// global_charset["latin:exact"] = charset_exact;
// global_charset["latin:default"] = charset_default;
// global_charset["latin:simple"] = charset_simple;
// global_charset["latin:balance"] = charset_balance;
// global_charset["latin:advanced"] = charset_advanced;
// global_charset["latin:extra"] = charset_extra;
// global_charset["latin:soundex"] = charset_soundex;
/**
* @param {!string} name
* @param {Object} charset
*/
// export function registerCharset(name, charset){
// global_charset[name] = charset;
// }
/**
* @param {!string} name
* @param {Object} lang
*/
// export function registerLanguage(name, lang){
// global_lang[name] = lang;
// }

View File

@@ -1,16 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g;
const split = /\s+/;
/** @type EncoderOptions */
const options = {
// the string is already encoded as RTL by default
//rtl: true,
normalize: false,
dedupe: true,
prepare: function(str){
return ("" + str).replace(regex, " ")
}
};
export default options;

View File

@@ -1,14 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g;
/** @type EncoderOptions */
const options = {
normalize: false,
dedupe: true,
split: "",
prepare: function(str){
return ("" + str).replace(regex, "")
}
};
export default options;

View File

@@ -1,13 +0,0 @@
import { EncoderOptions } from "../../type.js";
// non ascii control chars 0-31
const regex = /[\x00-\x7F]+/g;
/** @type EncoderOptions */
const options = {
normalize: false,
dedupe: true,
prepare: function(str){
return ("" + str).replace(regex, " ")
}
};
export default options;

View File

@@ -2,10 +2,10 @@ import { EncoderOptions } from "../../type.js";
/** @type EncoderOptions */
const options = {
normalize: function(str){
return str.toLowerCase();
},
//numeric: false,
normalize: true
// normalize: function(str){
// return str.toLowerCase();
// },
//dedupe: false
};
export default options;

View File

@@ -2,8 +2,10 @@ import { EncoderOptions } from "../../type.js";
/** @type EncoderOptions */
const options = {
split: /\s+/,
normalize: false,
numeric: false,
split: /\s+/
//normalize: false,
//dedupe: false
};
export default options;

View File

@@ -59,7 +59,7 @@ const numeric_split_next_char = /(\d{3})(\D)/g;
//.replace(/(\d{3})/g, "$1 ")
//.replace(/([^\d])([\d])/g, "$1 $2")
//.replace(/([\d])([^\d])/g, "$1 $2")
const normalize = "".normalize && /[\u0300-\u036f]/g; // '´`ʼ.,
const normalize = /*"".normalize &&*/ /[\u0300-\u036f]/g; // '´`ʼ.,
//const normalize_mapper = SUPPORT_CHARSET && !normalize && normalize_polyfill;
/**
@@ -201,13 +201,13 @@ Encoder.prototype.assign = function(options){
);
// assign the normalization fallback to the mapper
if(SUPPORT_CHARSET && !normalize){
this.mapper = new Map(
/** @type {Array<Array<string, string>>} */ (
normalize_polyfill
)
);
}
// if(SUPPORT_CHARSET && !normalize){
// this.mapper = new Map(
// /** @type {Array<Array<string, string>>} */ (
// normalize_polyfill
// )
// );
// }
tmp = options.filter;
this.filter = typeof tmp === "function" ? tmp : merge_option(tmp && new Set(tmp), null, this.filter);
@@ -221,7 +221,7 @@ Encoder.prototype.assign = function(options){
this.rtl = merge_option(options.rtl, false, this.rtl);
// auto-balanced cache
if(SUPPORT_CACHE){
//if(SUPPORT_CACHE){
this.cache = tmp = merge_option(options.cache, true, this.cache);
if(tmp){
this.timer = null;
@@ -231,7 +231,7 @@ Encoder.prototype.assign = function(options){
this.cache_enc_length = 128;
this.cache_term_length = 128;
}
}
//}
// regex temporary state
this.matcher_str = "";
@@ -277,7 +277,7 @@ Encoder.prototype.addStemmer = function(match, replace){
this.stemmer.set(match, replace);
this.stemmer_str += (this.stemmer_str ? "|" : "") + match;
this.stemmer_test = null;
SUPPORT_CACHE && this.cache && clear(this);
/*SUPPORT_CACHE &&*/ this.cache && clear(this);
return this;
};
@@ -290,7 +290,7 @@ Encoder.prototype.addFilter = function(term){
this.filter || (this.filter = new Set());
this.filter.add(term);
}
SUPPORT_CACHE && this.cache && clear(this);
/*SUPPORT_CACHE &&*/ this.cache && clear(this);
return this;
};
@@ -312,7 +312,7 @@ Encoder.prototype.addMapper = function(char_match, char_replace){
}
this.mapper || (this.mapper = new Map());
this.mapper.set(char_match, char_replace);
SUPPORT_CACHE && this.cache && clear(this);
/*SUPPORT_CACHE &&*/ this.cache && clear(this);
return this;
};
@@ -337,7 +337,7 @@ Encoder.prototype.addMatcher = function(match, replace){
this.matcher.set(match , replace);
this.matcher_str += (this.matcher_str ? "|" : "") + match;
this.matcher_test = null;
SUPPORT_CACHE && this.cache && clear(this);
/*SUPPORT_CACHE &&*/ this.cache && clear(this);
return this;
};
@@ -353,7 +353,7 @@ Encoder.prototype.addReplacer = function(regex, replace){
}
this.replacer || (this.replacer = []);
this.replacer.push(regex, replace);
SUPPORT_CACHE && this.cache && clear(this);
/*SUPPORT_CACHE &&*/ this.cache && clear(this);
return this;
};
@@ -366,7 +366,7 @@ Encoder.prototype.encode = function(str){
//if(!str) return str;
// todo remove dupe terms
if(SUPPORT_CACHE && this.cache && str.length <= this.cache_enc_length){
if(/*SUPPORT_CACHE &&*/ this.cache && str.length <= this.cache_enc_length){
if(this.timer){
if(this.cache_enc.has(str)){
return this.cache_enc.get(str);
@@ -444,7 +444,7 @@ Encoder.prototype.encode = function(str){
continue;
}
if(SUPPORT_CACHE && this.cache && word.length <= this.cache_term_length){
if(/*SUPPORT_CACHE &&*/ this.cache && word.length <= this.cache_term_length){
if(this.timer){
const tmp = this.cache_term.get(word);
if(tmp || tmp === ""){
@@ -530,7 +530,7 @@ Encoder.prototype.encode = function(str){
//word = word.replace(/(.)\1+/g, "$1");
//word = word.replace(/(?<=(.))\1+/g, "");
if(SUPPORT_CACHE && this.cache && base.length <= this.cache_term_length){
if(/*SUPPORT_CACHE &&*/ this.cache && base.length <= this.cache_term_length){
this.cache_term.set(base, word);
if(this.cache_term.size > this.cache_size){
this.cache_term.clear();
@@ -545,7 +545,7 @@ Encoder.prototype.encode = function(str){
final = this.finalize(final) || final;
}
if(SUPPORT_CACHE && this.cache && str.length <= this.cache_enc_length){
if(/*SUPPORT_CACHE &&*/ this.cache && str.length <= this.cache_enc_length){
this.cache_enc.set(str, final);
if(this.cache_enc.size > this.cache_size){
this.cache_enc.clear();

View File

@@ -88,7 +88,7 @@ export default function Index(options, _register){
}
this.resolution = options.resolution || 9;
this.tokenize = tmp = ((tmp = options.tokenize) && (tmp !== "default") && tmp) || "strict";
this.tokenize = tmp = ((tmp = options.tokenize) && (tmp !== "default") && (tmp !== "exact") && tmp) || "strict";
this.depth = (tmp === "strict" && context.depth) || 0;
this.bidirectional = context.bidirectional !== false;
this.fastupdate = !!options.fastupdate;

View File

@@ -81,6 +81,7 @@ Index.prototype.add = function(id, content, _append, _skip_update){
break;
}
// fallthrough to next case when term length < 3
case "bidirectional":
case "reverse":
// skip last round (this token exist already in "forward")
if(term_length > 1){

View File

@@ -6,7 +6,7 @@ const minify = process.argv[2] && process.argv[2].toLowerCase().includes("releas
console.log("Start build .....");
console.log('Bundle: ' + ('module' /* 'custom' */) + (debug ? ":debug" : (minify ? ":min" : "")));
fs.rmSync("tmp/", { recursive: true });
fs.existsSync("tmp") && fs.rmSync("tmp/", { recursive: true });
fs.mkdirSync("tmp");
fs.existsSync("dist") || fs.mkdirSync("dist");
@@ -49,9 +49,9 @@ fs.existsSync("dist") || fs.mkdirSync("dist");
"lang",
"charset/",
"charset/latin",
"charset/arabic",
"charset/cjk",
"charset/cyrillic"
//"charset/arabic",
//"charset/cjk",
//"charset/cyrillic"
];
for(let i = 0, path; i < dirs.length; i++){

View File

@@ -3,7 +3,7 @@ const fs = require("fs");
console.log("Start build .....");
fs.rmSync("tmp/", { recursive: true });
fs.existsSync("tmp") && fs.rmSync("tmp/", { recursive: true });
fs.mkdirSync("tmp");
fs.existsSync("dist") || fs.mkdirSync("dist");

View File

@@ -27,29 +27,29 @@ describe("Encoder", function(){
});
});
describe("Encoder: Latin Charset", function(){
describe("Encoder: Charset", function(){
it("Should have been encoded properly: LatinDefault", function(){
it("Should have been encoded properly: Default", function(){
const index = new Index({ encoder: Charset.LatinDefault });
const index = new Index({ encoder: Charset.Default });
expect(index.encoder.encode("Björn-Phillipp Mayer")).to.eql(
["björn", "phillipp", "mayer"]
["bjorn", "phillipp", "mayer"]
);
});
if(!build_light){
it("Should have been encoded properly: LatinExact", function(){
it("Should have been encoded properly: Exact", function(){
const index = new Index({ encoder: Charset.LatinExact });
const index = new Index({ encoder: Charset.Exact });
expect(index.encoder.encode("Björn-Phillipp Mayer")).to.eql(
["Björn-Phillipp", "Mayer"]
);
});
it("Should have been encoded properly: LatinSimple", function(){
it("Should have been encoded properly: Normalize", function(){
const index = new Index({ encoder: Charset.LatinSimple });
const index = new Index({ encoder: Charset.Normalize });
expect(index.encoder.encode("Björn-Phillipp Mayer")).to.eql(
index.encoder.encode("bjorn/phillipp mayer")
);
@@ -99,14 +99,11 @@ describe("Encoder: Latin Charset", function(){
});
});
describe("Encoder: CJK Word Break", function(){
describe("Encoder: CJK Charset", function(){
it("Should have been tokenized properly", function(){
const index = Index({
encoder: Charset.CjkDefault,
tokenize: "forward"
});
const index = Index({ tokenize: "forward" });
index.add(0, "서울시가 잠이 든 시간에 아무 말, 미뤄, 미뤄");
expect(index.search("든")).to.include(0);
@@ -117,14 +114,11 @@ describe("Encoder: CJK Word Break", function(){
});
});
describe("Encoder: Cyrillic Word Break", function(){
describe("Encoder: Cyrillic Charset", function(){
it("Should have been tokenized properly", function(){
const index = Index({
encoder: Charset.CyrillicDefault,
tokenize: "forward"
});
const index = Index({ tokenize: "forward" });
index.add(0, "Фообар");
expect(index.search("Фообар")).to.include(0);
@@ -132,28 +126,33 @@ describe("Encoder: Cyrillic Word Break", function(){
});
});
describe("Encoder: Arabic Word Break", function(){
describe("Encoder: Arabic Charset", function(){
it("Should have been tokenized properly", function(){
let index = Index({
encoder: Charset.ArabicDefault,
tokenize: "forward"
});
let index = Index({ tokenize: "forward" });
index.add(0, "لكن لا بد أن أوضح لك أن كل");
expect(index.search("بد أن")).to.include(0);
expect(index.search("أو")).to.include(0);
index = Index({
encoder: Charset.ArabicDefault,
tokenize: "reverse"
});
index = Index({ tokenize: "reverse" });
index.add(0, "لكن لا بد أن أوضح لك أن كل");
expect(index.search("ضح")).to.include(0);
});
});
describe("Encoder: Greek Charset", function(){
it("Should have been tokenized properly", function(){
const index = Index({ tokenize: "forward" });
index.add(0, "Μήγαρις ἔχω ἄλλο στὸ νοῦ μου πάρεξ ἐλευθερία καὶ γλώσσα");
expect(index.search("Μηγαρις εχω αλλο στο νου μου παρε ελευθ και γλωσσα")).to.include(0);
});
});
describe("Encoder: Right-to-Left", function(){
it("Should have been scored properly", function(){