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

improve language handler

This commit is contained in:
Thomas Wilkerling
2021-05-24 22:10:27 +02:00
parent a68e6d15de
commit 0386c3fc94
33 changed files with 627 additions and 514 deletions

View File

@@ -5,29 +5,32 @@
* Licence: Apache-2.0 * Licence: Apache-2.0
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var u;const w=/[\W_]+/;function aa(a){if(a=a.toLowerCase())if(a&&this.C&&(a=y(a,this.C)),this.G&&1<a.length&&(a=y(a,this.G)),a&&(w||""===w)&&(a=a.split(w),this.filter)){var b=this.filter;const c=a.length,d=[];for(let e=0,f=0;e<c;e++){const g=a[e];g&&!b[g]&&(d[f++]=g)}a=d}return a};function z(a,b){return"undefined"!==typeof a?a:b}function A(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}function ba(a,b){return b.length-a.length}function C(a){return"string"===typeof a}function D(a){return"object"===typeof a}function E(a){return"function"===typeof a};function H(a,b){const c=Object.keys(a),d=c.length,e=[];let f="",g=0;for(let h=0,k,l;h<d;h++)k=c[h],(l=a[k])?(e[g++]=new RegExp(b?"(?!\\b)"+k+"(\\b|_)":k,"g"),e[g++]=l):f+=(f?"|":"")+k;f&&(e[g++]=new RegExp(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")","g"),e[g]="");return e}function y(a,b){for(let c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a};const I={},ca={};let da=Promise;function ea(a){J(a,"add");J(a,"append");J(a,"search");J(a,"update");J(a,"remove")}function J(a,b){a[b+"Async"]=function(){const c=this,d=arguments;var e=d[d.length-1];let f;E(e)&&(f=e,delete d[d.length-1]);e=new da(function(g){setTimeout(function(){c.async=!0;g(c[b].apply(c,d));c.async=!1})});return f?(e.then(f),this):e}};function fa(a,b,c,d){var e=a.length;let f=[],g,h=0;d&&(d=[]);for(--e;0<=e;e--){const k=a[e],l=k.length,n=B();let q=!g;for(let r=0;r<l;r++){const v=k[r],p=v.length;if(p)for(let m=0,t=0,x;m<p;m++)if(x=v[m],!g)n[x]=1;else if(g[x]){if(e)d&&t<b&&((d[r]||(d[r]=[]))[t++]=x),n[x]=1;else if(c)c--;else if(f[h++]=x,h===b)return f;q=!0}}if(!q&&!d)return[];g=n}if(d)for(let k=d.length-1,l,n;0<=k;k--)if((n=(l=d[k])&&l.length)&&c&&(n<=c?(c-=n,n=0):n-=c),n){if(h+n>=b)return f.concat(l.slice(c,b-h+c));f=f.concat(c? (function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var u;function w(a,b){return"undefined"!==typeof a?a:b}function x(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=z();return b}function z(){return Object.create(null)}function aa(a,b){return b.length-a.length}function A(a){return"string"===typeof a}function B(a){return"object"===typeof a}function C(a){return"function"===typeof a};const ba=/[\u0300-\u036f]/g;function D(a){a.normalize&&(a=a.normalize("NFD").replace(ba,""));return a}function ca(a,b){const c=Object.keys(a),d=c.length,e=[];let f="",g=0;for(let h=0,k,l;h<d;h++)k=c[h],(l=a[k])?(e[g++]=E(b?"(?!\\b)"+k+"(\\b|_)":k),e[g++]=l):f+=(f?"|":"")+k;f&&(e[g++]=E(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")"),e[g]="");return e}function F(a,b){for(let c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function E(a){return new RegExp(a,"g")}
l.slice(c):l);h+=n;c=0}return f}function ha(a,b){const c=B(),d=B(),e=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e[e.length]=k)}return e};function K(a){this.h=!0!==a&&a;this.cache=B();this.g=[]}function ia(a,b,c){D(a)&&(a=a.query);let d=this.cache.get(a);d||(d=this.search(a,b,c),this.cache.set(a,d));return d}K.prototype.set=function(a,b){if(!this.cache[a]){var c=this.g.length;c===this.h?delete this.cache[this.g[c-1]]:c++;for(--c;0<c;c--)this.g[c]=this.g[c-1];this.g[0]=a}this.cache[a]=b};K.prototype.get=function(a){const b=this.cache[a];if(this.h&&b&&(a=this.g.indexOf(a))){const c=this.g[a-1];this.g[a-1]=this.g[a];this.g[a]=c}return b};const ja={memory:{charset:"latin:extra",s:3,o:3,j:!1,m:"memory"},performance:{threshold:8,o:3,context:{depth:1,v:!0}},match:{charset:"latin:extra",I:"full",s:3},score:{charset:"latin:advanced",threshold:1,context:{depth:3,v:!0}},"default":{s:3,threshold:0,depth:3}};function ka(a,b,c,d,e,f){setTimeout(function(){const g=a(c,JSON.stringify(f));g&&g.then?g.then(function(){b.export(a,b,c,d,e+1)}):b.export(a,b,c,d,e+1)})};function L(a,b){if(!(this instanceof L))return new L(a);var c;if(a){C(a)?a=ja[a]:(c=a.preset)&&(a=Object.assign({},c[c],a));c=a.charset;var d=a.lang;C(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=ca[c]);C(d)&&(d=I[d])}else a={};let e,f,g,h=a.context||{};this.encode=a.encode||c&&c.encode||aa;this.register=b||B();e=a.resolution||9;f=a.threshold||0;f>=e&&(f=e-1);this.s=e;this.threshold=f;this.u=b=c&&c.I||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.v=z(h.bidirectional,!0);this.m=g="memory"=== function da(a){let b="",c="";for(let d=0,e=a.length,f;d<e;d++)(f=a[d])!==c&&(b+=c=f);return b};const ea=/[\W_]+/;function fa(a){return ha(this,D(a).toLowerCase(),!1,ea)};const ia={},G={};let ja=Promise;function ka(a){J(a,"add");J(a,"append");J(a,"search");J(a,"update");J(a,"remove")}function J(a,b){a[b+"Async"]=function(){const c=this,d=arguments;var e=d[d.length-1];let f;C(e)&&(f=e,delete d[d.length-1]);e=new ja(function(g){setTimeout(function(){c.async=!0;g(c[b].apply(c,d));c.async=!1})});return f?(e.then(f),this):e}};function la(a,b,c,d){var e=a.length;let f=[],g,h=0;d&&(d=[]);for(--e;0<=e;e--){const k=a[e],l=k.length,m=z();let q=!g;for(let r=0;r<l;r++){const v=k[r],p=v.length;if(p)for(let n=0,t=0,y;n<p;n++)if(y=v[n],!g)m[y]=1;else if(g[y]){if(e)d&&t<b&&((d[r]||(d[r]=[]))[t++]=y),m[y]=1;else if(c)c--;else if(f[h++]=y,h===b)return f;q=!0}}if(!q&&!d)return[];g=m}if(d)for(let k=d.length-1,l,m;0<=k;k--)if((m=(l=d[k])&&l.length)&&c&&(m<=c?(c-=m,m=0):m-=c),m){if(h+m>=b)return f.concat(l.slice(c,b-h+c));f=f.concat(c?
a.optimize;this.j=z(a.fastupdate,!0);this.o=a.minlength||1;this.map=g?A(e-f):B();e=h.resolution||e;f=h.threshold||f;f>=e&&(f=e-1);this.h=e;this.l=f;this.g=g?A(e-f):B();this.F=c&&c.F||a.rtl;this.C=(b=a.matcher||d&&d.C)&&H(b,!1);this.G=(b=a.stemmer||d&&d.G)&&H(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=B();for(let k=0,l=c.length;k<l;k++)d[c[k]]=1;c=d}this.filter=c;this.cache=(b=a.cache)&&new K(b)}u=L.prototype;u.append=function(a,b){return this.add(a,b,!0)}; l.slice(c):l);h+=m;c=0}return f}function ma(a,b){const c=z(),d=z(),e=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e[e.length]=k)}return e};function K(a){this.l=!0!==a&&a;this.cache=z();this.h=[]}function na(a,b,c){B(a)&&(a=a.query);let d=this.cache.get(a);d||(d=this.search(a,b,c),this.cache.set(a,d));return d}K.prototype.set=function(a,b){if(!this.cache[a]){var c=this.h.length;c===this.l?delete this.cache[this.h[c-1]]:c++;for(--c;0<c;c--)this.h[c]=this.h[c-1];this.h[0]=a}this.cache[a]=b};K.prototype.get=function(a){const b=this.cache[a];if(this.l&&b&&(a=this.h.indexOf(a))){const c=this.h[a-1];this.h[a-1]=this.h[a];this.h[a]=c}return b};const oa={memory:{charset:"latin:extra",C:3,B:3,o:!1,A:"memory"},performance:{threshold:8,B:3,context:{depth:1,G:!0}},match:{charset:"latin:extra",I:"full",C:3},score:{charset:"latin:advanced",threshold:1,context:{depth:3,G:!0}},"default":{C:3,threshold:0,depth:3}};function ra(a,b,c,d,e,f){setTimeout(function(){const g=a(c,JSON.stringify(f));g&&g.then?g.then(function(){b.export(a,b,c,d,e+1)}):b.export(a,b,c,d,e+1)})};G["latin:default"]=fa;
u.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);const l=b.length;if(l){const n=this.depth,q=this.s-this.threshold,r=B(),v=B();for(let p=0;p<l;p++){let m=b[this.F?l-1-p:p];var d=m.length;if(m&&d>=this.o&&(n||!r[m])){var e=Math.min(this.s/l*p|0,p);if(e<q){var f="";switch(this.u){case "full":if(3<d){for(var g=0;g<d;g++){var h=g?Math.min(e/2+this.s/d*g/2|0,e+g):e;if(h<q)for(var k=d;k>g;k--)f=m.substring(g,k),f.length>=this.o&&O(this,r,f,h,a,c)}break}case "reverse":if(2< function L(a,b){if(!(this instanceof L))return new L(a);var c;if(a){A(a)?a=oa[a]:(c=a.preset)&&(a=Object.assign({},c[c],a));c=a.charset;var d=a.lang;A(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=G[c]);A(d)&&(d=ia[d])}else a={};let e,f,g,h=a.context||{};this.encode=a.encode||c&&c.encode||fa;this.register=b||z();e=a.resolution||9;f=a.threshold||0;f>=e&&(f=e-1);this.C=e;this.threshold=f;this.D=b=c&&c.I||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.G=w(h.bidirectional,!0);this.A=g="memory"===
d){for(g=d-1;0<g;g--)f=m[g]+f,f.length>=this.o&&O(this,r,f,e,a,c);f=""}case "forward":if(1<d)for(g=0;g<d;g++)f+=m[g],f.length>=this.o&&O(this,r,f,e,a,c);break;default:if(O(this,r,m,e,a,c),n&&1<l&&p<l-1)for(d=this.h-this.l,e=B(),f=m,g=Math.min(n+1,l-p),e[f]=1,h=1;h<g;h++)if((m=b[this.F?l-1-p-h:p+h])&&m.length>=this.o&&!e[m]){if(e[m]=1,k=Math.min((this.h-g)/l*p+h|0,p+(h-1)),k<d){const t=this.v&&m>f;O(this,v,t?f:m,k,a,c,t?m:f)}}else g=Math.min(g+1,l-p)}}}}this.j||(this.register[a]=1)}}return this}; a.optimize;this.o=w(a.fastupdate,!0);this.B=a.minlength||1;this.map=g?x(e-f):z();e=h.resolution||e;f=h.threshold||f;f>=e&&(f=e-1);this.l=e;this.s=f;this.h=g?x(e-f):z();this.F=c&&c.F||a.rtl;this.L=(b=a.matcher||d&&d.L)&&ca(b,!1);this.M=(b=a.stemmer||d&&d.M)&&ca(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=z();for(let k=0,l=c.length;k<l;k++)d[c[k]]=1;c=d}this.filter=c;this.cache=(b=a.cache)&&new K(b)}
function O(a,b,c,d,e,f,g){let h=g?a.g:a.map;if(!b[c]||g&&!b[c][g])a.m&&(h=h[d]),g?(b=b[c]||(b[c]=B()),b[g]=1,h=h[g]||(h[g]=B())):b[c]=1,h=h[c]||(h[c]=[]),a.m||(h=h[d]||(h[d]=[])),f&&-1!==h.indexOf(e)||(h[h.length]=e,a.j&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} function ha(a,b,c,d){if(b&&(c&&(b=F(b,c)),a.L&&(b=F(b,a.L)),a.M&&1<b.length&&(b=F(b,a.M)),d||""===d)){b=b.split(d);if(a.filter){a=a.filter;c=b.length;d=[];for(let e=0,f=0;e<c;e++){const g=b[e];g&&!a[g]&&(d[f++]=g)}a=d}else a=b;return a}return b}u=L.prototype;u.append=function(a,b){return this.add(a,b,!0)};
u.search=function(a,b,c){D(a)?(c=a,a=c.query):D(b)&&(c=b);let d=[],e;var f=this.threshold;let g,h=0;if(c){b=c.limit;h=c.offset||0;f=z(c.threshold,f);var k=c.context;g=c.suggest}if(a&&(a=this.encode(a),e=a.length,1<e)){c=B();var l=[];for(let q=0,r=0,v;q<e;q++)if((v=a[q])&&v.length>=this.o&&!c[v])if(this.m||g||this.map[v])l[r++]=v,c[v]=1;else return d;a=l;e=a.length}if(!e)return d;b||(b=100);c=this.s-f;f=this.h-f;k=this.depth&&1<e&&!1!==k;l=0;let n;k?(n=a[0],l=1):1<e&&a.sort(ba);for(let q,r;l<e;l++){r= u.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);const l=b.length;if(l){const m=this.depth,q=this.C-this.threshold,r=z(),v=z();for(let p=0;p<l;p++){let n=b[this.F?l-1-p:p];var d=n.length;if(n&&d>=this.B&&(m||!r[n])){var e=Math.min(this.C/l*p|0,p);if(e<q){var f="";switch(this.D){case "full":if(3<d){for(var g=0;g<d;g++){var h=g?Math.min(e/2+this.C/d*g/2|0,e+g):e;if(h<q)for(var k=d;k>g;k--)f=n.substring(g,k),f.length>=this.B&&M(this,r,f,h,a,c)}break}case "reverse":if(2<
a[l];k?(q=na(this,d,g,f,b,h,2===e,r,n),g&&!1===q&&d.length||(n=r)):q=na(this,d,g,c,b,h,1===e,r);if(q)return q;if(g&&l===e-1){let v=d.length;if(!v){if(k){k=0;l=-1;continue}return d}if(1===v)return oa(d[0],b,h)}}return fa(d,b,h,g)}; d){for(g=d-1;0<g;g--)f=n[g]+f,f.length>=this.B&&M(this,r,f,e,a,c);f=""}case "forward":if(1<d)for(g=0;g<d;g++)f+=n[g],f.length>=this.B&&M(this,r,f,e,a,c);break;default:if(M(this,r,n,e,a,c),m&&1<l&&p<l-1)for(d=this.l-this.s,e=z(),f=n,g=Math.min(m+1,l-p),e[f]=1,h=1;h<g;h++)if((n=b[this.F?l-1-p-h:p+h])&&n.length>=this.B&&!e[n]){if(e[n]=1,k=Math.min((this.l-g)/l*p+h|0,p+(h-1)),k<d){const t=this.G&&n>f;M(this,v,t?f:n,k,a,c,t?n:f)}}else g=Math.min(g+1,l-p)}}}}this.o||(this.register[a]=1)}}return this};
function na(a,b,c,d,e,f,g,h,k){let l=[],n=k?a.g:a.map;a.m||(n=pa(n,h,k,a.v));if(n){let q=0;d=Math.min(n.length,d);for(let r=0,v=0,p,m;r<d&&!(p=n[r],a.m&&(p=pa(p,h,k,a.v)),p&&g&&(m=p.length,m<=f?(f-=m,p=null):f&&(p=p.slice(f),f=0)),p&&(l[q++]=p,g&&(v+=p.length,v>=e)));r++);if(q){if(g)return oa(l,e,0);b[b.length]=l;return}}return!c&&l}function oa(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function M(a,b,c,d,e,f,g){let h=g?a.h:a.map;if(!b[c]||g&&!b[c][g])a.A&&(h=h[d]),g?(b=b[c]||(b[c]=z()),b[g]=1,h=h[g]||(h[g]=z())):b[c]=1,h=h[c]||(h[c]=[]),a.A||(h=h[d]||(h[d]=[])),f&&-1!==h.indexOf(e)||(h[h.length]=e,a.o&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))}
function pa(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}u.contain=function(a){return!!this.register[a]};u.update=function(a,b){return this.remove(a).add(a,b)}; u.search=function(a,b,c){B(a)?(c=a,a=c.query):B(b)&&(c=b);let d=[],e;var f=this.threshold;let g,h=0;if(c){b=c.limit;h=c.offset||0;f=w(c.threshold,f);var k=c.context;g=c.suggest}if(a&&(a=this.encode(a),e=a.length,1<e)){c=z();var l=[];for(let q=0,r=0,v;q<e;q++)if((v=a[q])&&v.length>=this.B&&!c[v])if(this.A||g||this.map[v])l[r++]=v,c[v]=1;else return d;a=l;e=a.length}if(!e)return d;b||(b=100);c=this.C-f;f=this.l-f;k=this.depth&&1<e&&!1!==k;l=0;let m;k?(m=a[0],l=1):1<e&&a.sort(aa);for(let q,r;l<e;l++){r=
u.remove=function(a,b){const c=this.register[a];if(c){if(this.j)for(let d=0,e;d<c.length;d++)e=c[d],e.splice(e.indexOf(a),1);else P(this.map,a,this.s-this.threshold,this.m),this.depth&&P(this.g,a,this.h-this.l,this.m);b||delete this.register[a];if(this.cache){b=this.cache;for(let d=0,e,f;d<b.g.length;d++)f=b.g[d],e=b.cache[f],-1!==e.indexOf(a)&&(b.g.splice(d--,1),delete b.cache[f])}}return this}; a[l];k?(q=sa(this,d,g,f,b,h,2===e,r,m),g&&!1===q&&d.length||(m=r)):q=sa(this,d,g,c,b,h,1===e,r);if(q)return q;if(g&&l===e-1){let v=d.length;if(!v){if(k){k=0;l=-1;continue}return d}if(1===v)return ta(d[0],b,h)}}return la(d,b,h,g)};
function P(a,b,c,d,e){let f=0;if(a.constructor===Array)if(e)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),f++):f++;else{e=Math.min(a.length,c);for(let g=0,h;g<e;g++)if(h=a[g])f=P(h,b,c,d,e),d||f||delete a[g]}else for(let g in a)(f=P(a[g],b,c,d,e))||delete a[g];return f}u.searchCache=ia; function sa(a,b,c,d,e,f,g,h,k){let l=[],m=k?a.h:a.map;a.A||(m=ua(m,h,k,a.G));if(m){let q=0;d=Math.min(m.length,d);for(let r=0,v=0,p,n;r<d&&!(p=m[r],a.A&&(p=ua(p,h,k,a.G)),p&&g&&(n=p.length,n<=f?(f-=n,p=null):f&&(p=p.slice(f),f=0)),p&&(l[q++]=p,g&&(v+=p.length,v>=e)));r++);if(q){if(g)return ta(l,e,0);b[b.length]=l;return}}return!c&&l}function ta(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a}
u.export=function(a,b,c,d,e){let f,g;switch(e||(e=0)){case 0:f="reg";if(this.j){g=B();for(let h in this.register)g[h]=1}else g=this.register;break;case 1:f="cfg";g={doc:0,opt:this.m?1:0};break;case 2:f="map";g=this.map;break;case 3:f="ctx";g=this.g;break;default:return}ka(a,b||this,c?c+"."+f:f,d,e,g);return!0};u.import=function(a,b){if(b)switch(C(b)&&(b=JSON.parse(b)),a){case "cfg":this.m=!!b.opt;break;case "reg":this.j=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.g=b}};ea(L.prototype);function qa(a){var b=self._index;a=a.data;var c=a.args;const d=a.task;switch(d){case "init":b=a.options||{};a=a.factory;c=b.encode;b.cache=!1;c&&0===c.indexOf("function")&&(b.encode=Function("return "+c)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(b),delete self.FlexSearch):self._index=new L(b);break;case "search":b=b.search.apply(b,c);postMessage(b);break;default:b[d].apply(b,c)}};function Q(a,b){var c;D(a)?b=a:b?E(c=b.encode)&&(b.encode=c.toString()):b={};(a=(self||window)._factory)&&(a=a.toString());c=self.exports;if(this.i=ra(a,c)){this.g=null;var d=this;if(c)this.i.on("message",function(e){d.g(e)});else this.i.onmessage=function(e){d.g(e.data)};this.i.postMessage({task:"init",factory:a,options:b})}}R("add");R("append");R("search");R("update");R("remove"); function ua(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}u.contain=function(a){return!!this.register[a]};u.update=function(a,b){return this.remove(a).add(a,b)};
function R(a){Q.prototype[a]=Q.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;E(d)&&(e=d,c.splice(c.length-1,1));d=new da(function(f){setTimeout(function(){b.i.postMessage({task:a,args:c});"search"===a?b.g=f:f()})});return e?(d.then(e),this):d}} u.remove=function(a,b){const c=this.register[a];if(c){if(this.o)for(let d=0,e;d<c.length;d++)e=c[d],e.splice(e.indexOf(a),1);else N(this.map,a,this.C-this.threshold,this.A),this.depth&&N(this.h,a,this.l-this.s,this.A);b||delete this.register[a];if(this.cache){b=this.cache;for(let d=0,e,f;d<b.h.length;d++)f=b.h[d],e=b.cache[f],-1!==e.indexOf(a)&&(b.h.splice(d--,1),delete b.cache[f])}}return this};
function ra(a,b){let c;try{c=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+qa.toString()],{type:"text/javascript"}))):new Worker("worker.js",{type:"module"})}catch(d){}return c};function S(a){if(!(this instanceof S))return new S(a);var b;a||(a={});this.H=[];this.g=[];this.u=[];this.register=B();this.key=(b=a.key)&&U(b,this.u)||"id";this.j=z(a.fastupdate,!0);this.B=!!(b=a.extern);this.A=!this.B&&(b=a.store)&&!0!==b&&[];this.store=b&&(this.B?b:B());this.D=(b=a.tag)&&U(b,this.u);this.h=b&&B();this.cache=(b=a.cache)&&new K(b);a.cache=!1;this.i=a.worker;this.async=!1;b=a;a=B();let c=b.doc;if(C(c))c=[c];else if(c.constructor!==Array){var d=c;c=Object.keys(c)}for(let e=0,f,g;e< function N(a,b,c,d,e){let f=0;if(a.constructor===Array)if(e)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),f++):f++;else{e=Math.min(a.length,c);for(let g=0,h;g<e;g++)if(h=a[g])f=N(h,b,c,d,e),d||f||delete a[g]}else for(let g in a)(f=N(a[g],b,c,d,e))||delete a[g];return f}u.searchCache=na;
c.length;e++)f=c[e],C(f)?d&&(g=d[f]):(g=f,f=f.field),g=D(g)?Object.assign({},b,g):b,this.i&&(a[f]=new Q(g),a[f].i||(this.i=!1)),this.i||(a[f]=new L(g,this.register)),this.H[e]=U(f,this.u),this.g[e]=f;if(this.A)for(d=b.store,C(d)&&(d=[d]),b=0;b<d.length;b++)this.A[b]=U(d[b],this.u);this.l=a}function U(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],0<=a.indexOf("[]")&&(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.export=function(a,b,c,d,e){let f,g;switch(e||(e=0)){case 0:f="reg";if(this.o){g=z();for(let h in this.register)g[h]=1}else g=this.register;break;case 1:f="cfg";g={doc:0,opt:this.A?1:0};break;case 2:f="map";g=this.map;break;case 3:f="ctx";g=this.h;break;default:return}ra(a,b||this,c?c+"."+f:f,d,e,g);return!0};u.import=function(a,b){if(b)switch(A(b)&&(b=JSON.parse(b)),a){case "cfg":this.A=!!b.opt;break;case "reg":this.o=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};ka(L.prototype);function va(a){var b=self._index;a=a.data;var c=a.args;const d=a.task;switch(d){case "init":b=a.options||{};a=a.factory;c=b.encode;b.cache=!1;c&&0===c.indexOf("function")&&(b.encode=Function("return "+c)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(b),delete self.FlexSearch):self._index=new L(b);break;case "search":b=b.search.apply(b,c);postMessage(b);break;default:b[d].apply(b,c)}};function O(a,b){var c;B(a)?b=a:b?C(c=b.encode)&&(b.encode=c.toString()):b={};(a=(self||window)._factory)&&(a=a.toString());c=self.exports;if(this.m=wa(a,c)){this.h=null;var d=this;if(c)this.m.on("message",function(e){d.h(e)});else this.m.onmessage=function(e){d.h(e.data)};this.m.postMessage({task:"init",factory:a,options:b})}}R("add");R("append");R("search");R("update");R("remove");
function sa(a,b){if(C(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a}function V(a,b,c,d,e){a=a[e];if(d===c.length-1)b[e]=a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)V(a,b,c,d,e);else b=b[e]||(b[e]=B()),e=c[++d],V(a,b,c,d,e)} function R(a){O.prototype[a]=O.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;C(d)&&(e=d,c.splice(c.length-1,1));d=new ja(function(f){setTimeout(function(){b.m.postMessage({task:a,args:c});"search"===a?b.h=f:f()})});return e?(d.then(e),this):d}}
function wa(a,b){let c;try{c=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+va.toString()],{type:"text/javascript"}))):new Worker("worker.js",{type:"module"})}catch(d){}return c};function S(a){if(!(this instanceof S))return new S(a);var b;a||(a={});this.N=[];this.h=[];this.D=[];this.register=z();this.key=(b=a.key)&&T(b,this.D)||"id";this.o=w(a.fastupdate,!0);this.J=!!(b=a.extern);this.H=!this.J&&(b=a.store)&&!0!==b&&[];this.store=b&&(this.J?b:z());this.K=(b=a.tag)&&T(b,this.D);this.l=b&&z();this.cache=(b=a.cache)&&new K(b);a.cache=!1;this.m=a.worker;this.async=!1;b=a;a=z();let c=b.doc;if(A(c))c=[c];else if(c.constructor!==Array){var d=c;c=Object.keys(c)}for(let e=0,f,g;e<
c.length;e++)f=c[e],A(f)?d&&(g=d[f]):(g=f,f=f.field),g=B(g)?Object.assign({},b,g):b,this.m&&(a[f]=new O(g),a[f].m||(this.m=!1)),this.m||(a[f]=new L(g,this.register)),this.N[e]=T(f,this.D),this.h[e]=f;if(this.H)for(d=b.store,A(d)&&(d=[d]),b=0;b<d.length;b++)this.H[b]=T(d[b],this.D);this.s=a}function T(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],0<=a.indexOf("[]")&&(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]}
function xa(a,b){if(A(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a}function U(a,b,c,d,e){a=a[e];if(d===c.length-1)b[e]=a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)U(a,b,c,d,e);else b=b[e]||(b[e]=z()),e=c[++d],U(a,b,c,d,e)}
function W(a,b,c,d,e,f,g,h){a=a[g];if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(f,a[b],!0);return}a=a.join(" ")}e.add(f,a,h)}else if(a)if(a.constructor===Array)for(g=0;g<a.length;g++)W(a,b,c,d,e,f,g,h);else g=b[++d],W(a,b,c,d,e,f,g,h)}u=S.prototype; function W(a,b,c,d,e,f,g,h){a=a[g];if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(f,a[b],!0);return}a=a.join(" ")}e.add(f,a,h)}else if(a)if(a.constructor===Array)for(g=0;g<a.length;g++)W(a,b,c,d,e,f,g,h);else g=b[++d],W(a,b,c,d,e,f,g,h)}u=S.prototype;
u.add=function(a,b,c){D(a)&&(b=a,a=sa(b,this.key));if(b&&(a||0===a)){if(this.register[a])return this.update(a,b);for(let d=0,e,f;d<this.g.length;d++)f=this.g[d],e=this.H[d],C(e)&&(e=[e]),W(b,e,this.u,0,this.l[f],a,e[0],c);if(this.D){let d=sa(b,this.D),e=B();C(d)&&(d=[d]);for(let f=0,g,h;f<d.length;f++)if(g=d[f],!e[g]&&(e[g]=1,h=this.h[g]||(this.h[g]=[]),!c||-1===h.indexOf(a)))if(h[h.length]=a,this.j){const k=this.register[a]||(this.register[a]=[]);k[k.length]=h}}if(this.store&&!this.B){let d;if(this.A){d= u.add=function(a,b,c){B(a)&&(b=a,a=xa(b,this.key));if(b&&(a||0===a)){if(this.register[a])return this.update(a,b);for(let d=0,e,f;d<this.h.length;d++)f=this.h[d],e=this.N[d],A(e)&&(e=[e]),W(b,e,this.D,0,this.s[f],a,e[0],c);if(this.K){let d=xa(b,this.K),e=z();A(d)&&(d=[d]);for(let f=0,g,h;f<d.length;f++)if(g=d[f],!e[g]&&(e[g]=1,h=this.l[g]||(this.l[g]=[]),!c||-1===h.indexOf(a)))if(h[h.length]=a,this.o){const k=this.register[a]||(this.register[a]=[]);k[k.length]=h}}if(this.store&&!this.J){let d;if(this.H){d=
B();for(let e=0,f;e<this.A.length;e++)f=this.A[e],C(f)?d[f]=b[f]:V(b,d,f,0,f[0])}this.store[a]=d||b}}return this};u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)}; z();for(let e=0,f;e<this.H.length;e++)f=this.H[e],A(f)?d[f]=b[f]:U(b,d,f,0,f[0])}this.store[a]=d||b}}return this};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){D(a)&&(a=a[this.key]);if(this.register[a]){for(var b=0;b<this.g.length&&(this.l[this.g[b]].remove(a,!0),!this.j||this.i);b++);if(this.D&&(!this.j||this.i))for(let c in this.h){b=this.h[c];const d=b.indexOf(a);-1!==d&&(1<b.length?b.splice(d,1):delete this.h[c])}this.store&&!this.B&&delete this.store[a];delete this.register[a]}return this}; u.remove=function(a){B(a)&&(a=a[this.key]);if(this.register[a]){for(var b=0;b<this.h.length&&(this.s[this.h[b]].remove(a,!0),!this.o||this.m);b++);if(this.K&&(!this.o||this.m))for(let c in this.l){b=this.l[c];const d=b.indexOf(a);-1!==d&&(1<b.length?b.splice(d,1):delete this.l[c])}this.store&&!this.J&&delete this.store[a];delete this.register[a]}return this};
u.search=function(a,b,c,d){D(a)?(c=a,a=c.query):D(b)&&(c=b,b=0);let e=[],f=[],g,h,k,l,n,q,r,v=0;if(c)if(c.constructor===Array)k=c,c=null;else if(k=(g=c.pluck)||c.field||c.doc,n=c.tag,h=this.store&&c.enrich,q="and"===c.bool,b=c.limit||100,r=c.offset||0,k&&(C(k)?k=[k]:k.constructor!==Array&&(l=k,k=Object.keys(k))),n&&(C(n)&&(n=[n]),!a)){for(let m=0,t;m<n.length;m++)if(t=ta.call(this,n[m],b,r,h))e[e.length]=t,v++;return v?e:[]}k||(k=this.g);q=q&&(1<k.length||n&&1<n.length);const p=!d&&(this.i||this.async)&& u.search=function(a,b,c,d){B(a)?(c=a,a=c.query):B(b)&&(c=b,b=0);let e=[],f=[],g,h,k,l,m,q,r,v=0;if(c)if(c.constructor===Array)k=c,c=null;else if(k=(g=c.pluck)||c.field||c.doc,m=c.tag,h=this.store&&c.enrich,q="and"===c.bool,b=c.limit||100,r=c.offset||0,k&&(A(k)?k=[k]:k.constructor!==Array&&(l=k,k=Object.keys(k))),m&&(A(m)&&(m=[m]),!a)){for(let n=0,t;n<m.length;n++)if(t=ya.call(this,m[n],b,r,h))e[e.length]=t,v++;return v?e:[]}k||(k=this.h);q=q&&(1<k.length||m&&1<m.length);const p=!d&&(this.m||this.async)&&
[];for(let m=0,t,x,F;m<k.length;m++){let M;x=k[m];C(x)?l&&(M=l[x]):(M=x,x=x.field);if(p)p[m]=this.l[x].searchAsync(a,b,M||c);else{d?t=d[m]:t=this.l[x].search(a,b,M||c);F=t.length;if(n&&F){const G=[];let la=0;q&&(G[0]=[t]);for(let T=0,ma,N;T<n.length;T++)if(ma=n[T],F=(N=this.h[ma])&&N.length)la++,G[G.length]=q?[N]:N;la&&(t=q?fa(G,b||100,r||0):ha(t,G),F=t.length)}if(F)f[v]=x,e[v++]=t;else if(q)return[]}}if(p){const m=this;return new Promise(function(t){Promise.all(p).then(function(x){t(m.search(a,b, [];for(let n=0,t,y,H;n<k.length;n++){let P;y=k[n];A(y)?l&&(P=l[y]):(P=y,y=y.field);if(p)p[n]=this.s[y].searchAsync(a,b,P||c);else{d?t=d[n]:t=this.s[y].search(a,b,P||c);H=t.length;if(m&&H){const I=[];let pa=0;q&&(I[0]=[t]);for(let V=0,qa,Q;V<m.length;V++)if(qa=m[V],H=(Q=this.l[qa])&&Q.length)pa++,I[I.length]=q?[Q]:Q;pa&&(t=q?la(I,b||100,r||0):ma(t,I),H=t.length)}if(H)f[v]=y,e[v++]=t;else if(q)return[]}}if(p){const n=this;return new Promise(function(t){Promise.all(p).then(function(y){t(n.search(a,b,
c,x))})})}if(!v)return[];if(g&&(!h||!this.store))return e[0];for(let m=0,t;m<f.length;m++){t=e[m];t.length&&h&&(t=ua.call(this,t));if(g)return t;e[m]={field:f[m],result:t}}return e};function ta(a,b,c,d){let e=this.h[a],f=e&&e.length-c;if(f&&0<f){if(f>b||c)e=e.slice(c,c+b);d&&(e=ua.call(this,e));return{tag:a,result:e}}}function ua(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={key:d,doc:this.store[d]};return b}u.contain=function(a){return!!this.register[a]};u.get=function(a){return this.store[a]}; c,y))})})}if(!v)return[];if(g&&(!h||!this.store))return e[0];for(let n=0,t;n<f.length;n++){t=e[n];t.length&&h&&(t=za.call(this,t));if(g)return t;e[n]={field:f[n],result:t}}return e};function ya(a,b,c,d){let e=this.l[a],f=e&&e.length-c;if(f&&0<f){if(f>b||c)e=e.slice(c,c+b);d&&(e=za.call(this,e));return{tag:a,result:e}}}function za(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={key:d,doc:this.store[d]};return b}u.contain=function(a){return!!this.register[a]};u.get=function(a){return this.store[a]};
u.set=function(a,b){this.store[a]=b;return this};u.searchCache=ia;u.export=function(a,b,c,d,e){e||(e=0);d||(d=0);if(d<this.g.length){const f=this.g[d],g=this.l[f];b=this;setTimeout(function(){g.export(a,b,e?f.replace(":","-"):"",d,e++)||(d++,e=1,b.export(a,b,f,d,e))})}else{let f;switch(e){case 1:c="tag";f=this.h;break;case 2:c="store";f=this.store;break;default:return}ka(a,this,c,d,e,f)}}; u.set=function(a,b){this.store[a]=b;return this};u.searchCache=na;u.export=function(a,b,c,d,e){e||(e=0);d||(d=0);if(d<this.h.length){const f=this.h[d],g=this.s[f];b=this;setTimeout(function(){g.export(a,b,e?f.replace(":","-"):"",d,e++)||(d++,e=1,b.export(a,b,f,d,e))})}else{let f;switch(e){case 1:c="tag";f=this.l;break;case 2:c="store";f=this.store;break;default:return}ra(a,this,c,d,e,f)}};
u.import=function(a,b){if(b)switch(C(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.j=!1;this.register=b;for(let d=0,e;d<this.g.length;d++)e=this.l[this.g[d]],e.register=b,e.j=!1;break;case "store":this.store=b;break;default:a=a.split(".");const c=a[0];a=a[1];c&&a&&this.l[c].import(a,b)}};ea(S.prototype);const X=self;let Y;const Z={Index:L,Document:S,Worker:Q,registerCharset:function(a,b){ca[a]=b},registerLanguage:function(a,b){I[a]=b}};(Y=X.define)&&Y.amd?Y([],function(){return Z}):X.exports?X.exports=Z:X.FlexSearch=Z;}(this)); u.import=function(a,b){if(b)switch(A(b)&&(b=JSON.parse(b)),a){case "tag":this.l=b;break;case "reg":this.o=!1;this.register=b;for(let d=0,e;d<this.h.length;d++)e=this.s[this.h[d]],e.register=b,e.o=!1;break;case "store":this.store=b;break;default:a=a.split(".");const c=a[0];a=a[1];c&&a&&this.s[c].import(a,b)}};ka(S.prototype);const Aa=/[\W_]+/,Ba=[E("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",E("[\u00e8\u00e9\u00ea\u00eb]"),"e",E("[\u00ec\u00ed\u00ee\u00ef]"),"i",E("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",E("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",E("[\u00fd\u0177\u00ff]"),"y",E("\u00f1"),"n",E("[\u00e7c]"),"k",E("\u00df"),"s",E(" & ")," and "];function Ca(a){return ha(this,D(a).toLowerCase(),!a.normalize&&Ba,Aa)};var Ea={encode:Da,F:!1,I:"strict"};const Fa=/[^a-z0-9]+/,Ga={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function Da(a){a=Ca.call(this,a).join(" ");const b=[];if(a){const c=a.split(Fa),d=c.length;for(let e=0,f,g=0;e<d;e++)if((a=c[e])&&(!this.filter||!this.filter[a])){f=a[0];let h=Ga[f]||f,k=h;for(let l=1;l<a.length;l++){f=a[l];const m=Ga[f]||f;m&&m!==k&&(h+=m,k=m)}b[g++]=h}}return b};var Ia={encode:Ha,F:!1,I:""};const Ja=[E("ae"),"a",E("oe"),"o",E("sh"),"s",E("th"),"t",E("ph"),"f",E("pf"),"f"];function Ha(a,b){a&&(a=Da.call(this,a).join(" "),2<a.length&&(a=F(a,Ja)),b||(1<a.length&&(a=da(a)),a&&(a=a.split(" "))));return a};var La={encode:Ka,F:!1,I:""};const Ma=E("(?!\\b)[aeiouy]");function Ka(a){a&&(a=Ha.call(this,a,!0),1<a.length&&(a=a.replace(Ma,"")),1<a.length&&(a=da(a)),a&&(a=a.split(" ")));return a};G["latin:simple"]={encode:Ca,F:!1,I:""};G["latin:balance"]=Ea;G["latin:advanced"]=Ia;G["latin:extra"]=La;const X=self;let Y;const Z={Index:L,Document:S,Worker:O,registerCharset:function(a,b){G[a]=b},registerLanguage:function(a,b){ia[a]=b}};(Y=X.define)&&Y.amd?Y([],function(){return Z}):X.exports?X.exports=Z:X.FlexSearch=Z;}(this));

View File

@@ -5,22 +5,25 @@
* Licence: Apache-2.0 * Licence: Apache-2.0
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict';var v;const x=/[\W_]+/;function aa(a){if(a=a.toLowerCase())if(a&&this.A&&(a=y(a,this.A)),this.C&&1<a.length&&(a=y(a,this.C)),a&&(x||""===x)&&(a=a.split(x),this.filter)){var b=this.filter;const c=a.length,e=[];for(let d=0,f=0;d<c;d++){const g=a[d];g&&!b[g]&&(e[f++]=g)}a=e}return a};function z(a,b){return"undefined"!==typeof a?a:b}function A(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}function ba(a,b){return b.length-a.length}function C(a){return"string"===typeof a}function D(a){return"object"===typeof a};function G(a,b){const c=Object.keys(a),e=c.length,d=[];let f="",g=0;for(let h=0,k,l;h<e;h++)k=c[h],(l=a[k])?(d[g++]=new RegExp(b?"(?!\\b)"+k+"(\\b|_)":k,"g"),d[g++]=l):f+=(f?"|":"")+k;f&&(d[g++]=new RegExp(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")","g"),d[g]="");return d}function y(a,b){for(let c=0,e=b.length;c<e&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a};const H={},K={};let ea=Promise;function L(a){M(a,"add");M(a,"append");M(a,"search");M(a,"update");M(a,"remove")}function M(a,b){a[b+"Async"]=function(){const c=this,e=arguments;var d=e[e.length-1];let f;"function"===typeof d&&(f=d,delete e[e.length-1]);d=new ea(function(g){setTimeout(function(){c.async=!0;g(c[b].apply(c,e));c.async=!1})});return f?(d.then(f),this):d}};function N(a,b,c,e){var d=a.length;let f=[],g,h=0;e&&(e=[]);for(--d;0<=d;d--){const k=a[d],l=k.length,n=B();let q=!g;for(let r=0;r<l;r++){const u=k[r],p=u.length;if(p)for(let m=0,t=0,w;m<p;m++)if(w=u[m],!g)n[w]=1;else if(g[w]){if(d)e&&t<b&&((e[r]||(e[r]=[]))[t++]=w),n[w]=1;else if(c)c--;else if(f[h++]=w,h===b)return f;q=!0}}if(!q&&!e)return[];g=n}if(e)for(let k=e.length-1,l,n;0<=k;k--)if((n=(l=e[k])&&l.length)&&c&&(n<=c?(c-=n,n=0):n-=c),n){if(h+n>=b)return f.concat(l.slice(c,b-h+c));f=f.concat(c? (function(self){'use strict';var v;function w(a,b){return"undefined"!==typeof a?a:b}function y(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=z();return b}function z(){return Object.create(null)}function aa(a,b){return b.length-a.length}function A(a){return"string"===typeof a}function B(a){return"object"===typeof a};const ba=/[\u0300-\u036f]/g;function C(a){a.normalize&&(a=a.normalize("NFD").replace(ba,""));return a}function D(a,b){const c=Object.keys(a),e=c.length,d=[];let f="",g=0;for(let h=0,k,l;h<e;h++)k=c[h],(l=a[k])?(d[g++]=E(b?"(?!\\b)"+k+"(\\b|_)":k),d[g++]=l):f+=(f?"|":"")+k;f&&(d[g++]=E(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")"),d[g]="");return d}function F(a,b){for(let c=0,e=b.length;c<e&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function E(a){return new RegExp(a,"g")}
l.slice(c):l);h+=n;c=0}return f}function fa(a,b){const c=B(),e=B(),d=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!e[k]&&(e[k]=1,d[d.length]=k)}return d};const ha={memory:{charset:"latin:extra",m:3,j:3,s:!1,l:"memory"},performance:{threshold:8,j:3,context:{depth:1,v:!0}},match:{charset:"latin:extra",H:"full",m:3},score:{charset:"latin:advanced",threshold:1,context:{depth:3,v:!0}},"default":{m:3,threshold:0,depth:3}};function O(a,b){if(!(this instanceof O))return new O(a);var c;let e;a?(C(a)?a=ha[a]:(c=a.preset)&&(a=Object.assign({},c[c],a)),c=a.charset,e=a.lang,C(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=K[c]),C(e)&&(e=H[e])):a={};let d,f,g,h=a.context||{};this.encode=a.encode||c&&c.encode||aa;this.register=b||B();d=a.resolution||9;f=a.threshold||0;f>=d&&(f=d-1);this.m=d;this.threshold=f;this.u=b=c&&c.H||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.v=z(h.bidirectional,!0);this.l=g="memory"=== function I(a){let b="",c="";for(let e=0,d=a.length,f;e<d;e++)(f=a[e])!==c&&(b+=c=f);return b};const ca=/[\W_]+/;function J(a){return K(this,C(a).toLowerCase(),!1,ca)};const da={},N={};let ea=Promise;function fa(a){O(a,"add");O(a,"append");O(a,"search");O(a,"update");O(a,"remove")}function O(a,b){a[b+"Async"]=function(){const c=this,e=arguments;var d=e[e.length-1];let f;"function"===typeof d&&(f=d,delete e[e.length-1]);d=new ea(function(g){setTimeout(function(){c.async=!0;g(c[b].apply(c,e));c.async=!1})});return f?(d.then(f),this):d}};function ja(a,b,c,e){var d=a.length;let f=[],g,h=0;e&&(e=[]);for(--d;0<=d;d--){const k=a[d],l=k.length,m=z();let q=!g;for(let r=0;r<l;r++){const u=k[r],p=u.length;if(p)for(let n=0,t=0,x;n<p;n++)if(x=u[n],!g)m[x]=1;else if(g[x]){if(d)e&&t<b&&((e[r]||(e[r]=[]))[t++]=x),m[x]=1;else if(c)c--;else if(f[h++]=x,h===b)return f;q=!0}}if(!q&&!e)return[];g=m}if(e)for(let k=e.length-1,l,m;0<=k;k--)if((m=(l=e[k])&&l.length)&&c&&(m<=c?(c-=m,m=0):m-=c),m){if(h+m>=b)return f.concat(l.slice(c,b-h+c));f=f.concat(c?
a.optimize;this.s=z(a.fastupdate,!0);this.j=a.minlength||1;this.g=g?A(d-f):B();d=h.resolution||d;f=h.threshold||f;f>=d&&(f=d-1);this.h=d;this.o=f;this.i=g?A(d-f):B();this.B=c&&c.B||a.rtl;this.A=(b=a.matcher||e&&e.A)&&G(b,!1);this.C=(b=a.stemmer||e&&e.C)&&G(b,!0);if(a=b=a.filter||e&&e.filter){a=b;c=B();for(let k=0,l=a.length;k<l;k++)c[a[k]]=1;a=c}this.filter=a}v=O.prototype;v.append=function(a,b){return this.add(a,b,!0)}; l.slice(c):l);h+=m;c=0}return f}function ka(a,b){const c=z(),e=z(),d=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!e[k]&&(e[k]=1,d[d.length]=k)}return d};const la={memory:{charset:"latin:extra",A:3,o:3,D:!1,s:"memory"},performance:{threshold:8,o:3,context:{depth:1,G:!0}},match:{charset:"latin:extra",H:"full",A:3},score:{charset:"latin:advanced",threshold:1,context:{depth:3,G:!0}},"default":{A:3,threshold:0,depth:3}};N["latin:default"]=J;
v.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);const l=b.length;if(l){const n=this.depth,q=this.m-this.threshold,r=B(),u=B();for(let p=0;p<l;p++){let m=b[this.B?l-1-p:p];var e=m.length;if(m&&e>=this.j&&(n||!r[m])){var d=Math.min(this.m/l*p|0,p);if(d<q){var f="";switch(this.u){case "full":if(3<e){for(var g=0;g<e;g++){var h=g?Math.min(d/2+this.m/e*g/2|0,d+g):d;if(h<q)for(var k=e;k>g;k--)f=m.substring(g,k),f.length>=this.j&&Q(this,r,f,h,a,c)}break}case "reverse":if(2< function P(a,b){if(!(this instanceof P))return new P(a);var c;let e;a?(A(a)?a=la[a]:(c=a.preset)&&(a=Object.assign({},c[c],a)),c=a.charset,e=a.lang,A(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=N[c]),A(e)&&(e=da[e])):a={};let d,f,g,h=a.context||{};this.encode=a.encode||c&&c.encode||J;this.register=b||z();d=a.resolution||9;f=a.threshold||0;f>=d&&(f=d-1);this.A=d;this.threshold=f;this.F=b=c&&c.H||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.G=w(h.bidirectional,!0);this.s=g="memory"===
e){for(g=e-1;0<g;g--)f=m[g]+f,f.length>=this.j&&Q(this,r,f,d,a,c);f=""}case "forward":if(1<e)for(g=0;g<e;g++)f+=m[g],f.length>=this.j&&Q(this,r,f,d,a,c);break;default:if(Q(this,r,m,d,a,c),n&&1<l&&p<l-1)for(e=this.h-this.o,d=B(),f=m,g=Math.min(n+1,l-p),d[f]=1,h=1;h<g;h++)if((m=b[this.B?l-1-p-h:p+h])&&m.length>=this.j&&!d[m]){if(d[m]=1,k=Math.min((this.h-g)/l*p+h|0,p+(h-1)),k<e){const t=this.v&&m>f;Q(this,u,t?f:m,k,a,c,t?m:f)}}else g=Math.min(g+1,l-p)}}}}this.s||(this.register[a]=1)}}return this}; a.optimize;this.D=w(a.fastupdate,!0);this.o=a.minlength||1;this.h=g?y(d-f):z();d=h.resolution||d;f=h.threshold||f;f>=d&&(f=d-1);this.l=d;this.B=f;this.m=g?y(d-f):z();this.C=c&&c.C||a.rtl;this.I=(b=a.matcher||e&&e.I)&&D(b,!1);this.J=(b=a.stemmer||e&&e.J)&&D(b,!0);if(a=b=a.filter||e&&e.filter){a=b;c=z();for(let k=0,l=a.length;k<l;k++)c[a[k]]=1;a=c}this.filter=a}
function Q(a,b,c,e,d,f,g){let h=g?a.i:a.g;if(!b[c]||g&&!b[c][g])a.l&&(h=h[e]),g?(b=b[c]||(b[c]=B()),b[g]=1,h=h[g]||(h[g]=B())):b[c]=1,h=h[c]||(h[c]=[]),a.l||(h=h[e]||(h[e]=[])),f&&-1!==h.indexOf(d)||(h[h.length]=d,a.s&&(a=a.register[d]||(a.register[d]=[]),a[a.length]=h))} function K(a,b,c,e){if(b&&(c&&(b=F(b,c)),a.I&&(b=F(b,a.I)),a.J&&1<b.length&&(b=F(b,a.J)),e||""===e)){b=b.split(e);if(a.filter){a=a.filter;c=b.length;e=[];for(let d=0,f=0;d<c;d++){const g=b[d];g&&!a[g]&&(e[f++]=g)}a=e}else a=b;return a}return b}v=P.prototype;v.append=function(a,b){return this.add(a,b,!0)};
v.search=function(a,b,c){D(a)?(c=a,a=c.query):D(b)&&(c=b);let e=[],d;var f=this.threshold;let g,h=0;if(c){b=c.limit;h=c.offset||0;f=z(c.threshold,f);var k=c.context;g=c.suggest}if(a&&(a=this.encode(a),d=a.length,1<d)){c=B();var l=[];for(let q=0,r=0,u;q<d;q++)if((u=a[q])&&u.length>=this.j&&!c[u])if(this.l||g||this.g[u])l[r++]=u,c[u]=1;else return e;a=l;d=a.length}if(!d)return e;b||(b=100);c=this.m-f;f=this.h-f;k=this.depth&&1<d&&!1!==k;l=0;let n;k?(n=a[0],l=1):1<d&&a.sort(ba);for(let q,r;l<d;l++){r= v.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);const l=b.length;if(l){const m=this.depth,q=this.A-this.threshold,r=z(),u=z();for(let p=0;p<l;p++){let n=b[this.C?l-1-p:p];var e=n.length;if(n&&e>=this.o&&(m||!r[n])){var d=Math.min(this.A/l*p|0,p);if(d<q){var f="";switch(this.F){case "full":if(3<e){for(var g=0;g<e;g++){var h=g?Math.min(d/2+this.A/e*g/2|0,d+g):d;if(h<q)for(var k=e;k>g;k--)f=n.substring(g,k),f.length>=this.o&&Q(this,r,f,h,a,c)}break}case "reverse":if(2<
a[l];k?(q=R(this,e,g,f,b,h,2===d,r,n),g&&!1===q&&e.length||(n=r)):q=R(this,e,g,c,b,h,1===d,r);if(q)return q;if(g&&l===d-1){let u=e.length;if(!u){if(k){k=0;l=-1;continue}return e}if(1===u)return ia(e[0],b,h)}}return N(e,b,h,g)}; e){for(g=e-1;0<g;g--)f=n[g]+f,f.length>=this.o&&Q(this,r,f,d,a,c);f=""}case "forward":if(1<e)for(g=0;g<e;g++)f+=n[g],f.length>=this.o&&Q(this,r,f,d,a,c);break;default:if(Q(this,r,n,d,a,c),m&&1<l&&p<l-1)for(e=this.l-this.B,d=z(),f=n,g=Math.min(m+1,l-p),d[f]=1,h=1;h<g;h++)if((n=b[this.C?l-1-p-h:p+h])&&n.length>=this.o&&!d[n]){if(d[n]=1,k=Math.min((this.l-g)/l*p+h|0,p+(h-1)),k<e){const t=this.G&&n>f;Q(this,u,t?f:n,k,a,c,t?n:f)}}else g=Math.min(g+1,l-p)}}}}this.D||(this.register[a]=1)}}return this};
function R(a,b,c,e,d,f,g,h,k){let l=[],n=k?a.i:a.g;a.l||(n=ja(n,h,k,a.v));if(n){let q=0;e=Math.min(n.length,e);for(let r=0,u=0,p,m;r<e&&!(p=n[r],a.l&&(p=ja(p,h,k,a.v)),p&&g&&(m=p.length,m<=f?(f-=m,p=null):f&&(p=p.slice(f),f=0)),p&&(l[q++]=p,g&&(u+=p.length,u>=d)));r++);if(q){if(g)return ia(l,d,0);b[b.length]=l;return}}return!c&&l}function ia(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function Q(a,b,c,e,d,f,g){let h=g?a.m:a.h;if(!b[c]||g&&!b[c][g])a.s&&(h=h[e]),g?(b=b[c]||(b[c]=z()),b[g]=1,h=h[g]||(h[g]=z())):b[c]=1,h=h[c]||(h[c]=[]),a.s||(h=h[e]||(h[e]=[])),f&&-1!==h.indexOf(d)||(h[h.length]=d,a.D&&(a=a.register[d]||(a.register[d]=[]),a[a.length]=h))}
function ja(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}v.contain=function(a){return!!this.register[a]};v.update=function(a,b){return this.remove(a).add(a,b)};v.remove=function(a,b){const c=this.register[a];if(c){if(this.s)for(let e=0,d;e<c.length;e++)d=c[e],d.splice(d.indexOf(a),1);else S(this.g,a,this.m-this.threshold,this.l),this.depth&&S(this.i,a,this.h-this.o,this.l);b||delete this.register[a]}return this}; v.search=function(a,b,c){B(a)?(c=a,a=c.query):B(b)&&(c=b);let e=[],d;var f=this.threshold;let g,h=0;if(c){b=c.limit;h=c.offset||0;f=w(c.threshold,f);var k=c.context;g=c.suggest}if(a&&(a=this.encode(a),d=a.length,1<d)){c=z();var l=[];for(let q=0,r=0,u;q<d;q++)if((u=a[q])&&u.length>=this.o&&!c[u])if(this.s||g||this.h[u])l[r++]=u,c[u]=1;else return e;a=l;d=a.length}if(!d)return e;b||(b=100);c=this.A-f;f=this.l-f;k=this.depth&&1<d&&!1!==k;l=0;let m;k?(m=a[0],l=1):1<d&&a.sort(aa);for(let q,r;l<d;l++){r=
function S(a,b,c,e,d){let f=0;if(a.constructor===Array)if(d)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),f++):f++;else{d=Math.min(a.length,c);for(let g=0,h;g<d;g++)if(h=a[g])f=S(h,b,c,e,d),e||f||delete a[g]}else for(let g in a)(f=S(a[g],b,c,e,d))||delete a[g];return f}L(O.prototype);function T(a){if(!(this instanceof T))return new T(a);var b;a||(a={});this.D=[];this.g=[];this.u=[];this.register=B();this.key=(b=a.key)&&U(b,this.u)||"id";this.s=z(a.fastupdate,!0);this.o=!!(b=a.extern);this.h=!this.o&&(b=a.store)&&!0!==b&&[];this.store=b&&(this.o?b:B());this.async=!1;b=a;a=B();let c=b.doc;if(C(c))c=[c];else if(c.constructor!==Array){var e=c;c=Object.keys(c)}for(let d=0,f,g;d<c.length;d++)f=c[d],C(f)?e&&(g=e[f]):(g=f,f=f.field),g=D(g)?Object.assign({},b,g):b,this.F||(a[f]=new O(g, a[l];k?(q=ma(this,e,g,f,b,h,2===d,r,m),g&&!1===q&&e.length||(m=r)):q=ma(this,e,g,c,b,h,1===d,r);if(q)return q;if(g&&l===d-1){let u=e.length;if(!u){if(k){k=0;l=-1;continue}return e}if(1===u)return na(e[0],b,h)}}return ja(e,b,h,g)};
this.register)),this.D[d]=U(f,this.u),this.g[d]=f;if(this.h)for(e=b.store,C(e)&&(e=[e]),b=0;b<e.length;b++)this.h[b]=U(e[b],this.u);this.i=a}function U(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],0<=a.indexOf("[]")&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]} function ma(a,b,c,e,d,f,g,h,k){let l=[],m=k?a.m:a.h;a.s||(m=oa(m,h,k,a.G));if(m){let q=0;e=Math.min(m.length,e);for(let r=0,u=0,p,n;r<e&&!(p=m[r],a.s&&(p=oa(p,h,k,a.G)),p&&g&&(n=p.length,n<=f?(f-=n,p=null):f&&(p=p.slice(f),f=0)),p&&(l[q++]=p,g&&(u+=p.length,u>=d)));r++);if(q){if(g)return na(l,d,0);b[b.length]=l;return}}return!c&&l}function na(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a}
function V(a,b,c,e,d){a=a[d];if(e===c.length-1)b[d]=a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)V(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],V(a,b,c,e,d)}function W(a,b,c,e,d,f,g,h){a=a[g];if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0);return}a=a.join(" ")}d.add(f,a,h)}else if(a)if(a.constructor===Array)for(g=0;g<a.length;g++)W(a,b,c,e,d,f,g,h);else g=b[++e],W(a,b,c,e,d,f,g,h)}v=T.prototype; function oa(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}v.contain=function(a){return!!this.register[a]};v.update=function(a,b){return this.remove(a).add(a,b)};v.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;e<c.length;e++)d=c[e],d.splice(d.indexOf(a),1);else S(this.h,a,this.A-this.threshold,this.s),this.depth&&S(this.m,a,this.l-this.B,this.s);b||delete this.register[a]}return this};
v.add=function(a,b,c){if(D(a)){a=b=a;var e=this.key;if(C(e))a=a[e];else for(let d=0;a&&d<e.length;d++)a=a[e[d]]}if(b&&(a||0===a)){if(this.register[a])return this.update(a,b);for(let d=0,f,g;d<this.g.length;d++)g=this.g[d],f=this.D[d],C(f)&&(f=[f]),W(b,f,this.u,0,this.i[g],a,f[0],c);if(this.store&&!this.o){let d;if(this.h){d=B();for(let f=0,g;f<this.h.length;f++)g=this.h[f],C(g)?d[g]=b[g]:V(b,d,g,0,g[0])}this.store[a]=d||b}}return this};v.append=function(a,b){return this.add(a,b,!0)}; function S(a,b,c,e,d){let f=0;if(a.constructor===Array)if(d)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),f++):f++;else{d=Math.min(a.length,c);for(let g=0,h;g<d;g++)if(h=a[g])f=S(h,b,c,e,d),e||f||delete a[g]}else for(let g in a)(f=S(a[g],b,c,e,d))||delete a[g];return f}fa(P.prototype);function T(a){if(!(this instanceof T))return new T(a);var b;a||(a={});this.K=[];this.h=[];this.F=[];this.register=z();this.key=(b=a.key)&&U(b,this.F)||"id";this.D=w(a.fastupdate,!0);this.B=!!(b=a.extern);this.l=!this.B&&(b=a.store)&&!0!==b&&[];this.store=b&&(this.B?b:z());this.async=!1;b=a;a=z();let c=b.doc;if(A(c))c=[c];else if(c.constructor!==Array){var e=c;c=Object.keys(c)}for(let d=0,f,g;d<c.length;d++)f=c[d],A(f)?e&&(g=e[f]):(g=f,f=f.field),g=B(g)?Object.assign({},b,g):b,this.L||(a[f]=new P(g,
v.update=function(a,b){return this.remove(a).add(a,b)};v.remove=function(a){D(a)&&(a=a[this.key]);if(this.register[a]){for(let b=0;b<this.g.length&&(this.i[this.g[b]].remove(a,!0),!this.s||this.F);b++);this.store&&!this.o&&delete this.store[a];delete this.register[a]}return this}; this.register)),this.K[d]=U(f,this.F),this.h[d]=f;if(this.l)for(e=b.store,A(e)&&(e=[e]),b=0;b<e.length;b++)this.l[b]=U(e[b],this.F);this.m=a}function U(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],0<=a.indexOf("[]")&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]}
v.search=function(a,b,c,e){D(a)?(c=a,a=c.query):D(b)&&(c=b,b=0);let d=[],f=[],g,h,k,l,n,q,r,u=0;if(c)if(c.constructor===Array)k=c,c=null;else if(k=(g=c.pluck)||c.field||c.doc,n=!1,h=this.store&&c.enrich,q="and"===c.bool,b=c.limit||100,r=c.offset||0,k&&(C(k)?k=[k]:k.constructor!==Array&&(l=k,k=Object.keys(k))),n&&(C(n)&&(n=[n]),!a)){for(let m=0,t;m<n.length;m++)if(t=ka.call(this,n[m],b,r,h))d[d.length]=t,u++;return u?d:[]}k||(k=this.g);q=q&&(1<k.length||n&&1<n.length);const p=!e&&(this.F||this.async)&& function V(a,b,c,e,d){a=a[d];if(e===c.length-1)b[d]=a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)V(a,b,c,e,d);else b=b[d]||(b[d]=z()),d=c[++e],V(a,b,c,e,d)}function W(a,b,c,e,d,f,g,h){a=a[g];if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0);return}a=a.join(" ")}d.add(f,a,h)}else if(a)if(a.constructor===Array)for(g=0;g<a.length;g++)W(a,b,c,e,d,f,g,h);else g=b[++e],W(a,b,c,e,d,f,g,h)}v=T.prototype;
[];for(let m=0,t,w,E;m<k.length;m++){let I;w=k[m];C(w)?l&&(I=l[w]):(I=w,w=w.field);if(p)p[m]=this.i[w].searchAsync(a,b,I||c);else{e?t=e[m]:t=this.i[w].search(a,b,I||c);E=t.length;if(n&&E){const F=[];let ca=0;q&&(F[0]=[t]);for(let P=0,da,J;P<n.length;P++)if(da=n[P],E=(J=this.G[da])&&J.length)ca++,F[F.length]=q?[J]:J;ca&&(t=q?N(F,b||100,r||0):fa(t,F),E=t.length)}if(E)f[u]=w,d[u++]=t;else if(q)return[]}}if(p){const m=this;return new Promise(function(t){Promise.all(p).then(function(w){t(m.search(a,b, v.add=function(a,b,c){if(B(a)){a=b=a;var e=this.key;if(A(e))a=a[e];else for(let d=0;a&&d<e.length;d++)a=a[e[d]]}if(b&&(a||0===a)){if(this.register[a])return this.update(a,b);for(let d=0,f,g;d<this.h.length;d++)g=this.h[d],f=this.K[d],A(f)&&(f=[f]),W(b,f,this.F,0,this.m[g],a,f[0],c);if(this.store&&!this.B){let d;if(this.l){d=z();for(let f=0,g;f<this.l.length;f++)g=this.l[f],A(g)?d[g]=b[g]:V(b,d,g,0,g[0])}this.store[a]=d||b}}return this};v.append=function(a,b){return this.add(a,b,!0)};
c,w))})})}if(!u)return[];if(g&&(!h||!this.store))return d[0];for(let m=0,t;m<f.length;m++){t=d[m];t.length&&h&&(t=la.call(this,t));if(g)return t;d[m]={field:f[m],result:t}}return d};function ka(a,b,c,e){let d=this.G[a],f=d&&d.length-c;if(f&&0<f){if(f>b||c)d=d.slice(c,c+b);e&&(d=la.call(this,d));return{tag:a,result:d}}}function la(a){const b=Array(a.length);for(let c=0,e;c<a.length;c++)e=a[c],b[c]={key:e,doc:this.store[e]};return b}v.contain=function(a){return!!this.register[a]};v.get=function(a){return this.store[a]}; v.update=function(a,b){return this.remove(a).add(a,b)};v.remove=function(a){B(a)&&(a=a[this.key]);if(this.register[a]){for(let b=0;b<this.h.length&&(this.m[this.h[b]].remove(a,!0),!this.D||this.L);b++);this.store&&!this.B&&delete this.store[a];delete this.register[a]}return this};
v.set=function(a,b){this.store[a]=b;return this};L(T.prototype);const X=self;let Y;const Z={Index:O,Document:T,Worker:null,registerCharset:function(a,b){K[a]=b},registerLanguage:function(a,b){H[a]=b}};(Y=X.define)&&Y.amd?Y([],function(){return Z}):X.exports?X.exports=Z:X.FlexSearch=Z;}(this)); v.search=function(a,b,c,e){B(a)?(c=a,a=c.query):B(b)&&(c=b,b=0);let d=[],f=[],g,h,k,l,m,q,r,u=0;if(c)if(c.constructor===Array)k=c,c=null;else if(k=(g=c.pluck)||c.field||c.doc,m=!1,h=this.store&&c.enrich,q="and"===c.bool,b=c.limit||100,r=c.offset||0,k&&(A(k)?k=[k]:k.constructor!==Array&&(l=k,k=Object.keys(k))),m&&(A(m)&&(m=[m]),!a)){for(let n=0,t;n<m.length;n++)if(t=pa.call(this,m[n],b,r,h))d[d.length]=t,u++;return u?d:[]}k||(k=this.h);q=q&&(1<k.length||m&&1<m.length);const p=!e&&(this.L||this.async)&&
[];for(let n=0,t,x,G;n<k.length;n++){let L;x=k[n];A(x)?l&&(L=l[x]):(L=x,x=x.field);if(p)p[n]=this.m[x].searchAsync(a,b,L||c);else{e?t=e[n]:t=this.m[x].search(a,b,L||c);G=t.length;if(m&&G){const H=[];let ha=0;q&&(H[0]=[t]);for(let R=0,ia,M;R<m.length;R++)if(ia=m[R],G=(M=this.M[ia])&&M.length)ha++,H[H.length]=q?[M]:M;ha&&(t=q?ja(H,b||100,r||0):ka(t,H),G=t.length)}if(G)f[u]=x,d[u++]=t;else if(q)return[]}}if(p){const n=this;return new Promise(function(t){Promise.all(p).then(function(x){t(n.search(a,b,
c,x))})})}if(!u)return[];if(g&&(!h||!this.store))return d[0];for(let n=0,t;n<f.length;n++){t=d[n];t.length&&h&&(t=qa.call(this,t));if(g)return t;d[n]={field:f[n],result:t}}return d};function pa(a,b,c,e){let d=this.M[a],f=d&&d.length-c;if(f&&0<f){if(f>b||c)d=d.slice(c,c+b);e&&(d=qa.call(this,d));return{tag:a,result:d}}}function qa(a){const b=Array(a.length);for(let c=0,e;c<a.length;c++)e=a[c],b[c]={key:e,doc:this.store[e]};return b}v.contain=function(a){return!!this.register[a]};v.get=function(a){return this.store[a]};
v.set=function(a,b){this.store[a]=b;return this};fa(T.prototype);const ra=/[\W_]+/,sa=[E("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",E("[\u00e8\u00e9\u00ea\u00eb]"),"e",E("[\u00ec\u00ed\u00ee\u00ef]"),"i",E("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",E("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",E("[\u00fd\u0177\u00ff]"),"y",E("\u00f1"),"n",E("[\u00e7c]"),"k",E("\u00df"),"s",E(" & ")," and "];function ta(a){return K(this,C(a).toLowerCase(),!a.normalize&&sa,ra)};var va={encode:ua,C:!1,H:"strict"};const wa=/[^a-z0-9]+/,xa={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function ua(a){a=ta.call(this,a).join(" ");const b=[];if(a){const c=a.split(wa),e=c.length;for(let d=0,f,g=0;d<e;d++)if((a=c[d])&&(!this.filter||!this.filter[a])){f=a[0];let h=xa[f]||f,k=h;for(let l=1;l<a.length;l++){f=a[l];const m=xa[f]||f;m&&m!==k&&(h+=m,k=m)}b[g++]=h}}return b};var za={encode:ya,C:!1,H:""};const Aa=[E("ae"),"a",E("oe"),"o",E("sh"),"s",E("th"),"t",E("ph"),"f",E("pf"),"f"];function ya(a,b){a&&(a=ua.call(this,a).join(" "),2<a.length&&(a=F(a,Aa)),b||(1<a.length&&(a=I(a)),a&&(a=a.split(" "))));return a};var Ca={encode:Ba,C:!1,H:""};const Da=E("(?!\\b)[aeiouy]");function Ba(a){a&&(a=ya.call(this,a,!0),1<a.length&&(a=a.replace(Da,"")),1<a.length&&(a=I(a)),a&&(a=a.split(" ")));return a};N["latin:simple"]={encode:ta,C:!1,H:""};N["latin:balance"]=va;N["latin:advanced"]=za;N["latin:extra"]=Ca;const X=self;let Y;const Z={Index:P,Document:T,Worker:null,registerCharset:function(a,b){N[a]=b},registerLanguage:function(a,b){da[a]=b}};(Y=X.define)&&Y.amd?Y([],function(){return Z}):X.exports?X.exports=Z:X.FlexSearch=Z;}(this));

View File

@@ -6,14 +6,10 @@
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict'; (function(self){'use strict';
const aa = /[\W_]+/; function v(a, b) {
function ba(a) {
return this.pipeline(a.toLowerCase(), !1, aa, !1);
}
;function v(a, b) {
return "undefined" !== typeof a ? a : b; return "undefined" !== typeof a ? a : b;
} }
function x(a) { function w(a) {
const b = Array(a); const b = Array(a);
for (let c = 0; c < a; c++) { for (let c = 0; c < a; c++) {
b[c] = y(); b[c] = y();
@@ -23,7 +19,7 @@ function x(a) {
function y() { function y() {
return Object.create(null); return Object.create(null);
} }
function ca(a, b) { function aa(a, b) {
return b.length - a.length; return b.length - a.length;
} }
function z(a) { function z(a) {
@@ -35,36 +31,55 @@ function A(a) {
function B(a) { function B(a) {
return "function" === typeof a; return "function" === typeof a;
} }
;function C(a, b) { ;const ba = /[\u0300-\u036f]/g;
function C(a) {
a.normalize && (a = a.normalize("NFD").replace(ba, ""));
return a;
}
function D(a, b) {
const c = Object.keys(a), d = c.length, e = []; const c = Object.keys(a), d = c.length, e = [];
let f = "", g = 0; let f = "", g = 0;
for (let k = 0, h, l; k < d; k++) { for (let k = 0, h, l; k < d; k++) {
h = c[k], (l = a[h]) ? (e[g++] = new RegExp(b ? "(?!\\b)" + h + "(\\b|_)" : h, "g"), e[g++] = l) : f += (f ? "|" : "") + h; h = c[k], (l = a[h]) ? (e[g++] = E(b ? "(?!\\b)" + h + "(\\b|_)" : h), e[g++] = l) : f += (f ? "|" : "") + h;
} }
f && (e[g++] = new RegExp(b ? "(?!\\b)(" + f + ")(\\b|_)" : "(" + f + ")", "g"), e[g] = ""); f && (e[g++] = E(b ? "(?!\\b)(" + f + ")(\\b|_)" : "(" + f + ")"), e[g] = "");
return e; return e;
} }
function D(a, b) { function F(a, b) {
for (let c = 0, d = b.length; c < d && (a = a.replace(b[c], b[c + 1]), a); c += 2) { for (let c = 0, d = b.length; c < d && (a = a.replace(b[c], b[c + 1]), a); c += 2) {
} }
return a; return a;
} }
;const G = {}, H = {}; function E(a) {
let I = Promise; return new RegExp(a, "g");
function J(a) {
M(a, "add");
M(a, "append");
M(a, "search");
M(a, "update");
M(a, "remove");
} }
function M(a, b) { function I(a) {
let b = "", c = "";
for (let d = 0, e = a.length, f; d < e; d++) {
(f = a[d]) !== c && (b += c = f);
}
return b;
}
;const ca = /[\W_]+/;
function da(a) {
return this.pipeline(C(a).toLowerCase(), !1, ca, !1);
}
;const ea = {}, J = {};
let fa = Promise;
function ha(a) {
K(a, "add");
K(a, "append");
K(a, "search");
K(a, "update");
K(a, "remove");
}
function K(a, b) {
a[b + "Async"] = function() { a[b + "Async"] = function() {
const c = this, d = arguments; const c = this, d = arguments;
var e = d[d.length - 1]; var e = d[d.length - 1];
let f; let f;
B(e) && (f = e, delete d[d.length - 1]); B(e) && (f = e, delete d[d.length - 1]);
e = new I(function(g) { e = new fa(function(g) {
setTimeout(function() { setTimeout(function() {
c.async = !0; c.async = !0;
g(c[b].apply(c, d)); g(c[b].apply(c, d));
@@ -74,28 +89,28 @@ function M(a, b) {
return f ? (e.then(f), this) : e; return f ? (e.then(f), this) : e;
}; };
} }
;function da(a, b, c, d) { ;function ia(a, b, c, d) {
var e = a.length; var e = a.length;
let f = [], g, k = 0; let f = [], g, k = 0;
d && (d = []); d && (d = []);
for (--e; 0 <= e; e--) { for (--e; 0 <= e; e--) {
const h = a[e], l = h.length, n = y(); const h = a[e], l = h.length, m = y();
let q = !g; let q = !g;
for (let r = 0; r < l; r++) { for (let r = 0; r < l; r++) {
const p = h[r], t = p.length; const p = h[r], t = p.length;
if (t) { if (t) {
for (let m = 0, u = 0, w; m < t; m++) { for (let n = 0, u = 0, x; n < t; n++) {
if (w = p[m], !g) { if (x = p[n], !g) {
n[w] = 1; m[x] = 1;
} else { } else {
if (g[w]) { if (g[x]) {
if (e) { if (e) {
d && u < b && ((d[r] || (d[r] = []))[u++] = w), n[w] = 1; d && u < b && ((d[r] || (d[r] = []))[u++] = x), m[x] = 1;
} else { } else {
if (c) { if (c) {
c--; c--;
} else { } else {
if (f[k++] = w, k === b) { if (f[k++] = x, k === b) {
return f; return f;
} }
} }
@@ -109,23 +124,23 @@ function M(a, b) {
if (!q && !d) { if (!q && !d) {
return []; return [];
} }
g = n; g = m;
} }
if (d) { if (d) {
for (let h = d.length - 1, l, n; 0 <= h; h--) { for (let h = d.length - 1, l, m; 0 <= h; h--) {
if ((n = (l = d[h]) && l.length) && c && (n <= c ? (c -= n, n = 0) : n -= c), n) { if ((m = (l = d[h]) && l.length) && c && (m <= c ? (c -= m, m = 0) : m -= c), m) {
if (k + n >= b) { if (k + m >= b) {
return f.concat(l.slice(c, b - k + c)); return f.concat(l.slice(c, b - k + c));
} }
f = f.concat(c ? l.slice(c) : l); f = f.concat(c ? l.slice(c) : l);
k += n; k += m;
c = 0; c = 0;
} }
} }
} }
return f; return f;
} }
function ea(a, b) { function ja(a, b) {
const c = y(), d = y(), e = []; const c = y(), d = y(), e = [];
for (let f = 0; f < a.length; f++) { for (let f = 0; f < a.length; f++) {
c[a[f]] = 1; c[a[f]] = 1;
@@ -138,18 +153,18 @@ function ea(a, b) {
} }
return e; return e;
} }
;function N(a) { ;function L(a) {
this.limit = !0 !== a && a; this.limit = !0 !== a && a;
this.cache = y(); this.cache = y();
this.queue = []; this.queue = [];
} }
function fa(a, b, c) { function ka(a, b, c) {
A(a) && (a = a.query); A(a) && (a = a.query);
let d = this.cache.get(a); let d = this.cache.get(a);
d || (d = this.search(a, b, c), this.cache.set(a, d)); d || (d = this.search(a, b, c), this.cache.set(a, d));
return d; return d;
} }
N.prototype.set = function(a, b) { L.prototype.set = function(a, b) {
if (!this.cache[a]) { if (!this.cache[a]) {
var c = this.queue.length; var c = this.queue.length;
c === this.limit ? delete this.cache[this.queue[c - 1]] : c++; c === this.limit ? delete this.cache[this.queue[c - 1]] : c++;
@@ -160,7 +175,7 @@ N.prototype.set = function(a, b) {
} }
this.cache[a] = b; this.cache[a] = b;
}; };
N.prototype.get = function(a) { L.prototype.get = function(a) {
const b = this.cache[a]; const b = this.cache[a];
if (this.limit && b && (a = this.queue.indexOf(a))) { if (this.limit && b && (a = this.queue.indexOf(a))) {
const c = this.queue[a - 1]; const c = this.queue[a - 1];
@@ -169,13 +184,13 @@ N.prototype.get = function(a) {
} }
return b; return b;
}; };
N.prototype.del = function(a) { L.prototype.del = function(a) {
for (let b = 0, c, d; b < this.queue.length; b++) { for (let b = 0, c, d; b < this.queue.length; b++) {
d = this.queue[b], c = this.cache[d], -1 !== c.indexOf(a) && (this.queue.splice(b--, 1), delete this.cache[d]); d = this.queue[b], c = this.cache[d], -1 !== c.indexOf(a) && (this.queue.splice(b--, 1), delete this.cache[d]);
} }
}; };
const ha = {memory:{charset:"latin:extra", resolution:3, minlength:3, fastupdate:!1, optimize:"memory"}, performance:{threshold:8, minlength:3, context:{depth:1, bidirectional:!0}}, match:{charset:"latin:extra", tokenize:"full", resolution:3, }, score:{charset:"latin:advanced", threshold:1, context:{depth:3, bidirectional:!0}}, "default":{resolution:3, threshold:0, depth:3}, }; const la = {memory:{charset:"latin:extra", resolution:3, minlength:3, fastupdate:!1, optimize:"memory"}, performance:{threshold:8, minlength:3, context:{depth:1, bidirectional:!0}}, match:{charset:"latin:extra", tokenize:"full", resolution:3, }, score:{charset:"latin:advanced", threshold:1, context:{depth:3, bidirectional:!0}}, "default":{resolution:3, threshold:0, depth:3}, };
function ka(a, b, c, d, e, f) { function oa(a, b, c, d, e, f) {
setTimeout(function() { setTimeout(function() {
const g = a(c, JSON.stringify(f)); const g = a(c, JSON.stringify(f));
g && g.then ? g.then(function() { g && g.then ? g.then(function() {
@@ -183,14 +198,15 @@ function ka(a, b, c, d, e, f) {
}) : b.export(a, b, c, d, e + 1); }) : b.export(a, b, c, d, e + 1);
}); });
} }
;function O(a, b) { ;J["latin:default"] = da;
if (!(this instanceof O)) { function M(a, b) {
return new O(a); if (!(this instanceof M)) {
return new M(a);
} }
var c; var c;
if (a) { if (a) {
if (z(a)) { if (z(a)) {
ha[a] || console.warn("Preset not found: " + a), a = ha[a]; la[a] || console.warn("Preset not found: " + a), a = la[a];
} else { } else {
if (c = a.preset) { if (c = a.preset) {
c[c] || console.warn("Preset not found: " + c), a = Object.assign({}, c[c], a); c[c] || console.warn("Preset not found: " + c), a = Object.assign({}, c[c], a);
@@ -198,13 +214,13 @@ function ka(a, b, c, d, e, f) {
} }
c = a.charset; c = a.charset;
var d = a.lang; var d = a.lang;
z(c) && (-1 === c.indexOf(":") && (c += ":default"), c = H[c]); z(c) && (-1 === c.indexOf(":") && (c += ":default"), c = J[c]);
z(d) && (d = G[d]); z(d) && (d = ea[d]);
} else { } else {
a = {}; a = {};
} }
let e, f, g, k = a.context || {}; let e, f, g, k = a.context || {};
this.encode = a.encode || c && c.encode || ba; this.encode = a.encode || c && c.encode || da;
this.register = b || y(); this.register = b || y();
e = a.resolution || 9; e = a.resolution || 9;
f = a.threshold || 0; f = a.threshold || 0;
@@ -217,16 +233,16 @@ function ka(a, b, c, d, e, f) {
this.optimize = g = "memory" === a.optimize; this.optimize = g = "memory" === a.optimize;
this.fastupdate = v(a.fastupdate, !0); this.fastupdate = v(a.fastupdate, !0);
this.minlength = a.minlength || 1; this.minlength = a.minlength || 1;
this.map = g ? x(e - f) : y(); this.map = g ? w(e - f) : y();
e = k.resolution || e; e = k.resolution || e;
f = k.threshold || f; f = k.threshold || f;
f >= e && (f = e - 1); f >= e && (f = e - 1);
this.resolution_ctx = e; this.resolution_ctx = e;
this.threshold_ctx = f; this.threshold_ctx = f;
this.ctx = g ? x(e - f) : y(); this.ctx = g ? w(e - f) : y();
this.rtl = c && c.rtl || a.rtl; this.rtl = c && c.rtl || a.rtl;
this.matcher = (b = a.matcher || d && d.matcher) && C(b, !1); this.matcher = (b = a.matcher || d && d.matcher) && D(b, !1);
this.stemmer = (b = a.stemmer || d && d.stemmer) && C(b, !0); this.stemmer = (b = a.stemmer || d && d.stemmer) && D(b, !0);
if (c = b = a.filter || d && d.filter) { if (c = b = a.filter || d && d.filter) {
c = b; c = b;
d = y(); d = y();
@@ -236,41 +252,29 @@ function ka(a, b, c, d, e, f) {
c = d; c = d;
} }
this.filter = c; this.filter = c;
this.cache = (b = a.cache) && new N(b); this.cache = (b = a.cache) && new L(b);
} }
O.prototype.pipeline = function(a, b, c, d) { M.prototype.pipeline = function(a, b, c, d) {
if (a) { if (a && (b && (a = F(a, b)), this.matcher && (a = F(a, this.matcher)), this.stemmer && 1 < a.length && (a = F(a, this.stemmer)), d && 1 < a.length && (a = I(a)), c || "" === c)) {
b && a && (a = D(a, b));
a && this.matcher && (a = D(a, this.matcher));
this.stemmer && 1 < a.length && (a = D(a, this.stemmer));
if (d && 1 < a.length) {
d = b = "";
for (let e = 0, f = a.length, g; e < f; e++) {
(g = a[e]) !== d && (b += d = g);
}
a = b;
}
if (a && (c || "" === c)) {
a = a.split(c); a = a.split(c);
if (this.filter) { if (this.filter) {
c = this.filter; b = this.filter;
b = a.length; c = a.length;
d = []; d = [];
for (let e = 0, f = 0; e < b; e++) { for (let e = 0, f = 0; e < c; e++) {
const g = a[e]; const g = a[e];
g && !c[g] && (d[f++] = g); g && !b[g] && (d[f++] = g);
} }
a = d; a = d;
} }
return a; return a;
} }
}
return a; return a;
}; };
O.prototype.append = function(a, b) { M.prototype.append = function(a, b) {
return this.add(a, b, !0); return this.add(a, b, !0);
}; };
O.prototype.add = function(a, b, c) { M.prototype.add = function(a, b, c) {
if (this.register[a] && !c) { if (this.register[a] && !c) {
return this.update(a, b); return this.update(a, b);
} }
@@ -278,11 +282,11 @@ O.prototype.add = function(a, b, c) {
b = this.encode(b); b = this.encode(b);
const l = b.length; const l = b.length;
if (l) { if (l) {
const n = this.depth, q = this.resolution - this.threshold, r = y(), p = y(); const m = this.depth, q = this.resolution - this.threshold, r = y(), p = y();
for (let t = 0; t < l; t++) { for (let t = 0; t < l; t++) {
let m = b[this.rtl ? l - 1 - t : t]; let n = b[this.rtl ? l - 1 - t : t];
var d = m.length; var d = n.length;
if (m && d >= this.minlength && (n || !r[m])) { if (n && d >= this.minlength && (m || !r[n])) {
var e = Math.min(this.resolution / l * t | 0, t); var e = Math.min(this.resolution / l * t | 0, t);
if (e < q) { if (e < q) {
var f = ""; var f = "";
@@ -293,7 +297,7 @@ O.prototype.add = function(a, b, c) {
var k = g ? Math.min(e / 2 + this.resolution / d * g / 2 | 0, e + g) : e; var k = g ? Math.min(e / 2 + this.resolution / d * g / 2 | 0, e + g) : e;
if (k < q) { if (k < q) {
for (var h = d; h > g; h--) { for (var h = d; h > g; h--) {
f = m.substring(g, h), f.length >= this.minlength && this.push_index(r, f, k, a, c); f = n.substring(g, h), f.length >= this.minlength && this.push_index(r, f, k, a, c);
} }
} }
} }
@@ -302,24 +306,24 @@ O.prototype.add = function(a, b, c) {
case "reverse": case "reverse":
if (2 < d) { if (2 < d) {
for (g = d - 1; 0 < g; g--) { for (g = d - 1; 0 < g; g--) {
f = m[g] + f, f.length >= this.minlength && this.push_index(r, f, e, a, c); f = n[g] + f, f.length >= this.minlength && this.push_index(r, f, e, a, c);
} }
f = ""; f = "";
} }
case "forward": case "forward":
if (1 < d) { if (1 < d) {
for (g = 0; g < d; g++) { for (g = 0; g < d; g++) {
f += m[g], f.length >= this.minlength && this.push_index(r, f, e, a, c); f += n[g], f.length >= this.minlength && this.push_index(r, f, e, a, c);
} }
} }
break; break;
default: default:
if (this.push_index(r, m, e, a, c), n && 1 < l && t < l - 1) { if (this.push_index(r, n, e, a, c), m && 1 < l && t < l - 1) {
for (d = this.resolution_ctx - this.threshold_ctx, e = y(), f = m, g = Math.min(n + 1, l - t), e[f] = 1, k = 1; k < g; k++) { for (d = this.resolution_ctx - this.threshold_ctx, e = y(), f = n, g = Math.min(m + 1, l - t), e[f] = 1, k = 1; k < g; k++) {
if ((m = b[this.rtl ? l - 1 - t - k : t + k]) && m.length >= this.minlength && !e[m]) { if ((n = b[this.rtl ? l - 1 - t - k : t + k]) && n.length >= this.minlength && !e[n]) {
if (e[m] = 1, h = Math.min((this.resolution_ctx - g) / l * t + k | 0, t + (k - 1)), h < d) { if (e[n] = 1, h = Math.min((this.resolution_ctx - g) / l * t + k | 0, t + (k - 1)), h < d) {
const u = this.bidirectional && m > f; const u = this.bidirectional && n > f;
this.push_index(p, u ? f : m, h, a, c, u ? m : f); this.push_index(p, u ? f : n, h, a, c, u ? n : f);
} }
} else { } else {
g = Math.min(g + 1, l - t); g = Math.min(g + 1, l - t);
@@ -335,13 +339,13 @@ O.prototype.add = function(a, b, c) {
} }
return this; return this;
}; };
O.prototype.push_index = function(a, b, c, d, e, f) { M.prototype.push_index = function(a, b, c, d, e, f) {
let g = f ? this.ctx : this.map; let g = f ? this.ctx : this.map;
if (!a[b] || f && !a[b][f]) { if (!a[b] || f && !a[b][f]) {
this.optimize && (g = g[c]), f ? (a = a[b] || (a[b] = y()), a[f] = 1, g = g[f] || (g[f] = y())) : a[b] = 1, g = g[b] || (g[b] = []), this.optimize || (g = g[c] || (g[c] = [])), e && -1 !== g.indexOf(d) || (g[g.length] = d, this.fastupdate && (a = this.register[d] || (this.register[d] = []), a[a.length] = g)); this.optimize && (g = g[c]), f ? (a = a[b] || (a[b] = y()), a[f] = 1, g = g[f] || (g[f] = y())) : a[b] = 1, g = g[b] || (g[b] = []), this.optimize || (g = g[c] || (g[c] = [])), e && -1 !== g.indexOf(d) || (g[g.length] = d, this.fastupdate && (a = this.register[d] || (this.register[d] = []), a[a.length] = g));
} }
}; };
O.prototype.search = function(a, b, c) { M.prototype.search = function(a, b, c) {
A(a) ? (c = a, a = c.query) : A(b) && (c = b); A(a) ? (c = a, a = c.query) : A(b) && (c = b);
let d = [], e; let d = [], e;
var f = this.threshold; var f = this.threshold;
@@ -376,11 +380,11 @@ O.prototype.search = function(a, b, c) {
f = this.resolution_ctx - f; f = this.resolution_ctx - f;
h = this.depth && 1 < e && !1 !== h; h = this.depth && 1 < e && !1 !== h;
l = 0; l = 0;
let n; let m;
h ? (n = a[0], l = 1) : 1 < e && a.sort(ca); h ? (m = a[0], l = 1) : 1 < e && a.sort(aa);
for (let q, r; l < e; l++) { for (let q, r; l < e; l++) {
r = a[l]; r = a[l];
h ? (q = this.add_result(d, g, f, b, k, 2 === e, r, n), g && !1 === q && d.length || (n = r)) : q = this.add_result(d, g, c, b, k, 1 === e, r); h ? (q = this.add_result(d, g, f, b, k, 2 === e, r, m), g && !1 === q && d.length || (m = r)) : q = this.add_result(d, g, c, b, k, 1 === e, r);
if (q) { if (q) {
return q; return q;
} }
@@ -395,23 +399,23 @@ O.prototype.search = function(a, b, c) {
return d; return d;
} }
if (1 === p) { if (1 === p) {
return la(d[0], b, k); return pa(d[0], b, k);
} }
} }
} }
return da(d, b, k, g); return ia(d, b, k, g);
}; };
O.prototype.add_result = function(a, b, c, d, e, f, g, k) { M.prototype.add_result = function(a, b, c, d, e, f, g, k) {
let h = [], l = k ? this.ctx : this.map; let h = [], l = k ? this.ctx : this.map;
this.optimize || (l = ma(l, g, k, this.bidirectional)); this.optimize || (l = qa(l, g, k, this.bidirectional));
if (l) { if (l) {
let n = 0; let m = 0;
c = Math.min(l.length, c); c = Math.min(l.length, c);
for (let q = 0, r = 0, p, t; q < c && !(p = l[q], this.optimize && (p = ma(p, g, k, this.bidirectional)), p && f && (t = p.length, t <= e ? (e -= t, p = null) : e && (p = p.slice(e), e = 0)), p && (h[n++] = p, f && (r += p.length, r >= d))); q++) { for (let q = 0, r = 0, p, t; q < c && !(p = l[q], this.optimize && (p = qa(p, g, k, this.bidirectional)), p && f && (t = p.length, t <= e ? (e -= t, p = null) : e && (p = p.slice(e), e = 0)), p && (h[m++] = p, f && (r += p.length, r >= d))); q++) {
} }
if (n) { if (m) {
if (f) { if (f) {
return la(h, d, 0); return pa(h, d, 0);
} }
a[a.length] = h; a[a.length] = h;
return; return;
@@ -419,21 +423,21 @@ O.prototype.add_result = function(a, b, c, d, e, f, g, k) {
} }
return !b && h; return !b && h;
}; };
function la(a, b, c) { function pa(a, b, c) {
a = 1 === a.length ? a[0] : [].concat.apply([], a); a = 1 === a.length ? a[0] : [].concat.apply([], a);
return c || a.length > b ? a.slice(c, c + b) : a; return c || a.length > b ? a.slice(c, c + b) : a;
} }
function ma(a, b, c, d) { function qa(a, b, c, d) {
c ? (d = d && b > c, a = (a = a[d ? b : c]) && a[d ? c : b]) : a = a[b]; c ? (d = d && b > c, a = (a = a[d ? b : c]) && a[d ? c : b]) : a = a[b];
return a; return a;
} }
O.prototype.contain = function(a) { M.prototype.contain = function(a) {
return !!this.register[a]; return !!this.register[a];
}; };
O.prototype.update = function(a, b) { M.prototype.update = function(a, b) {
return this.remove(a).add(a, b); return this.remove(a).add(a, b);
}; };
O.prototype.remove = function(a, b) { M.prototype.remove = function(a, b) {
const c = this.register[a]; const c = this.register[a];
if (c) { if (c) {
if (this.fastupdate) { if (this.fastupdate) {
@@ -468,8 +472,8 @@ function P(a, b, c, d, e) {
} }
return f; return f;
} }
O.prototype.searchCache = fa; M.prototype.searchCache = ka;
O.prototype.export = function(a, b, c, d, e) { M.prototype.export = function(a, b, c, d, e) {
let f, g; let f, g;
switch(e || (e = 0)) { switch(e || (e = 0)) {
case 0: case 0:
@@ -498,10 +502,10 @@ O.prototype.export = function(a, b, c, d, e) {
default: default:
return; return;
} }
ka(a, b || this, c ? c + "." + f : f, d, e, g); oa(a, b || this, c ? c + "." + f : f, d, e, g);
return !0; return !0;
}; };
O.prototype.import = function(a, b) { M.prototype.import = function(a, b) {
if (b) { if (b) {
switch(z(b) && (b = JSON.parse(b)), a) { switch(z(b) && (b = JSON.parse(b)), a) {
case "cfg": case "cfg":
@@ -519,8 +523,8 @@ O.prototype.import = function(a, b) {
} }
} }
}; };
J(O.prototype); ha(M.prototype);
function na(a) { function ra(a) {
var b = self._index; var b = self._index;
a = a.data; a = a.data;
var c = a.args; var c = a.args;
@@ -532,7 +536,7 @@ function na(a) {
c = b.encode; c = b.encode;
b.cache = !1; b.cache = !1;
c && 0 === c.indexOf("function") && (b.encode = Function("return " + c)()); c && 0 === c.indexOf("function") && (b.encode = Function("return " + c)());
a ? (Function("return " + a)()(self), self._index = new self.FlexSearch.Index(b), delete self.FlexSearch) : self._index = new O(b); a ? (Function("return " + a)()(self), self._index = new self.FlexSearch.Index(b), delete self.FlexSearch) : self._index = new M(b);
break; break;
case "search": case "search":
b = b.search.apply(b, c); b = b.search.apply(b, c);
@@ -547,7 +551,7 @@ function na(a) {
A(a) ? b = a : b ? B(c = b.encode) && (b.encode = c.toString()) : b = {}; A(a) ? b = a : b ? B(c = b.encode) && (b.encode = c.toString()) : b = {};
(a = (self || window)._factory) && (a = a.toString()); (a = (self || window)._factory) && (a = a.toString());
c = self.exports; c = self.exports;
if (this.worker = oa(a, c)) { if (this.worker = sa(a, c)) {
this.resolver = null; this.resolver = null;
var d = this; var d = this;
if (c) { if (c) {
@@ -562,18 +566,18 @@ function na(a) {
this.worker.postMessage({task:"init", factory:a, options:b}); this.worker.postMessage({task:"init", factory:a, options:b});
} }
} }
S("add"); R("add");
S("append"); R("append");
S("search"); R("search");
S("update"); R("update");
S("remove"); R("remove");
function S(a) { function R(a) {
Q.prototype[a] = Q.prototype[a + "Async"] = function() { Q.prototype[a] = Q.prototype[a + "Async"] = function() {
const b = this, c = [].slice.call(arguments); const b = this, c = [].slice.call(arguments);
var d = c[c.length - 1]; var d = c[c.length - 1];
let e; let e;
B(d) && (e = d, c.splice(c.length - 1, 1)); B(d) && (e = d, c.splice(c.length - 1, 1));
d = new I(function(f) { d = new fa(function(f) {
setTimeout(function() { setTimeout(function() {
b.worker.postMessage({task:a, args:c}); b.worker.postMessage({task:a, args:c});
"search" === a ? b.resolver = f : f(); "search" === a ? b.resolver = f : f();
@@ -582,17 +586,17 @@ function S(a) {
return e ? (d.then(e), this) : d; return e ? (d.then(e), this) : d;
}; };
} }
function oa(a, b) { function sa(a, b) {
let c; let c;
try { try {
c = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + na.toString()], {type:"text/javascript"}))) : new Worker("worker.js", {type:"module"}); c = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + ra.toString()], {type:"text/javascript"}))) : new Worker("worker.js", {type:"module"});
} catch (d) { } catch (d) {
} }
return c; return c;
} }
;function T(a) { ;function S(a) {
if (!(this instanceof T)) { if (!(this instanceof S)) {
return new T(a); return new S(a);
} }
var b; var b;
a || (a = {}); a || (a = {});
@@ -600,14 +604,14 @@ function oa(a, b) {
this.field = []; this.field = [];
this.marker = []; this.marker = [];
this.register = y(); this.register = y();
this.key = (b = a.key) && U(b, this.marker) || "id"; this.key = (b = a.key) && T(b, this.marker) || "id";
this.fastupdate = v(a.fastupdate, !0); this.fastupdate = v(a.fastupdate, !0);
this.extern = !!(b = a.extern); this.extern = !!(b = a.extern);
this.storetree = !this.extern && (b = a.store) && !0 !== b && []; this.storetree = !this.extern && (b = a.store) && !0 !== b && [];
this.store = b && (this.extern ? b : y()); this.store = b && (this.extern ? b : y());
this.tag = (b = a.tag) && U(b, this.marker); this.tag = (b = a.tag) && T(b, this.marker);
this.tagindex = b && y(); this.tagindex = b && y();
this.cache = (b = a.cache) && new N(b); this.cache = (b = a.cache) && new L(b);
a.cache = !1; a.cache = !1;
this.worker = a.worker; this.worker = a.worker;
this.async = !1; this.async = !1;
@@ -623,16 +627,16 @@ function oa(a, b) {
} }
} }
for (let e = 0, f, g; e < c.length; e++) { for (let e = 0, f, g; e < c.length; e++) {
f = c[e], z(f) ? d && (g = d[f]) : (g = f, f = f.field), g = A(g) ? Object.assign({}, b, g) : b, this.worker && (a[f] = new Q(g), a[f].worker || (this.worker = !1)), this.worker || (a[f] = new O(g, this.register)), this.tree[e] = U(f, this.marker), this.field[e] = f; f = c[e], z(f) ? d && (g = d[f]) : (g = f, f = f.field), g = A(g) ? Object.assign({}, b, g) : b, this.worker && (a[f] = new Q(g), a[f].worker || (this.worker = !1)), this.worker || (a[f] = new M(g, this.register)), this.tree[e] = T(f, this.marker), this.field[e] = f;
} }
if (this.storetree) { if (this.storetree) {
for (d = b.store, z(d) && (d = [d]), b = 0; b < d.length; b++) { for (d = b.store, z(d) && (d = [d]), b = 0; b < d.length; b++) {
this.storetree[b] = U(d[b], this.marker); this.storetree[b] = T(d[b], this.marker);
} }
} }
this.index = a; this.index = a;
} }
function U(a, b) { function T(a, b) {
const c = a.split(":"); const c = a.split(":");
let d = 0; let d = 0;
for (let e = 0; e < c.length; e++) { for (let e = 0; e < c.length; e++) {
@@ -641,7 +645,7 @@ function U(a, b) {
d < c.length && (c.length = d); d < c.length && (c.length = d);
return 1 < d ? c : c[0]; return 1 < d ? c : c[0];
} }
function pa(a, b) { function ta(a, b) {
if (z(b)) { if (z(b)) {
a = a[b]; a = a[b];
} else { } else {
@@ -692,8 +696,8 @@ function W(a, b, c, d, e, f, g, k) {
} }
} }
} }
T.prototype.add = function(a, b, c) { S.prototype.add = function(a, b, c) {
A(a) && (b = a, a = pa(b, this.key)); A(a) && (b = a, a = ta(b, this.key));
if (b && (a || 0 === a)) { if (b && (a || 0 === a)) {
if (this.register[a]) { if (this.register[a]) {
return this.update(a, b); return this.update(a, b);
@@ -702,7 +706,7 @@ T.prototype.add = function(a, b, c) {
f = this.field[d], e = this.tree[d], z(e) && (e = [e]), W(b, e, this.marker, 0, this.index[f], a, e[0], c); f = this.field[d], e = this.tree[d], z(e) && (e = [e]), W(b, e, this.marker, 0, this.index[f], a, e[0], c);
} }
if (this.tag) { if (this.tag) {
let d = pa(b, this.tag), e = y(); let d = ta(b, this.tag), e = y();
z(d) && (d = [d]); z(d) && (d = [d]);
for (let f = 0, g, k; f < d.length; f++) { for (let f = 0, g, k; f < d.length; f++) {
if (g = d[f], !e[g] && (e[g] = 1, k = this.tagindex[g] || (this.tagindex[g] = []), !c || -1 === k.indexOf(a))) { if (g = d[f], !e[g] && (e[g] = 1, k = this.tagindex[g] || (this.tagindex[g] = []), !c || -1 === k.indexOf(a))) {
@@ -726,13 +730,13 @@ T.prototype.add = function(a, b, c) {
} }
return this; return this;
}; };
T.prototype.append = function(a, b) { S.prototype.append = function(a, b) {
return this.add(a, b, !0); return this.add(a, b, !0);
}; };
T.prototype.update = function(a, b) { S.prototype.update = function(a, b) {
return this.remove(a).add(a, b); return this.remove(a).add(a, b);
}; };
T.prototype.remove = function(a) { S.prototype.remove = function(a) {
A(a) && (a = a[this.key]); A(a) && (a = a[this.key]);
if (this.register[a]) { if (this.register[a]) {
for (var b = 0; b < this.field.length && (this.index[this.field[b]].remove(a, !0), !this.fastupdate || this.worker); b++) { for (var b = 0; b < this.field.length && (this.index[this.field[b]].remove(a, !0), !this.fastupdate || this.worker); b++) {
@@ -749,16 +753,16 @@ T.prototype.remove = function(a) {
} }
return this; return this;
}; };
T.prototype.search = function(a, b, c, d) { S.prototype.search = function(a, b, c, d) {
A(a) ? (c = a, a = c.query) : A(b) && (c = b, b = 0); A(a) ? (c = a, a = c.query) : A(b) && (c = b, b = 0);
let e = [], f = [], g, k, h, l, n, q, r, p = 0; let e = [], f = [], g, k, h, l, m, q, r, p = 0;
if (c) { if (c) {
if (c.constructor === Array) { if (c.constructor === Array) {
h = c, c = null; h = c, c = null;
} else { } else {
if (h = (g = c.pluck) || c.field || c.doc, n = c.tag, k = this.store && c.enrich, q = "and" === c.bool, b = c.limit || 100, r = c.offset || 0, h && (z(h) ? h = [h] : h.constructor !== Array && (l = h, h = Object.keys(h))), n && (z(n) && (n = [n]), !a)) { if (h = (g = c.pluck) || c.field || c.doc, m = c.tag, k = this.store && c.enrich, q = "and" === c.bool, b = c.limit || 100, r = c.offset || 0, h && (z(h) ? h = [h] : h.constructor !== Array && (l = h, h = Object.keys(h))), m && (z(m) && (m = [m]), !a)) {
for (let m = 0, u; m < n.length; m++) { for (let n = 0, u; n < m.length; n++) {
if (u = qa.call(this, n[m], b, r, k)) { if (u = ua.call(this, m[n], b, r, k)) {
e[e.length] = u, p++; e[e.length] = u, p++;
} }
} }
@@ -767,30 +771,30 @@ T.prototype.search = function(a, b, c, d) {
} }
} }
h || (h = this.field); h || (h = this.field);
q = q && (1 < h.length || n && 1 < n.length); q = q && (1 < h.length || m && 1 < m.length);
const t = !d && (this.worker || this.async) && []; const t = !d && (this.worker || this.async) && [];
for (let m = 0, u, w, E; m < h.length; m++) { for (let n = 0, u, x, G; n < h.length; n++) {
let K; let N;
w = h[m]; x = h[n];
z(w) ? l && (K = l[w]) : (K = w, w = w.field); z(x) ? l && (N = l[x]) : (N = x, x = x.field);
if (t) { if (t) {
t[m] = this.index[w].searchAsync(a, b, K || c); t[n] = this.index[x].searchAsync(a, b, N || c);
} else { } else {
u = d ? d[m] : this.index[w].search(a, b, K || c); u = d ? d[n] : this.index[x].search(a, b, N || c);
E = u.length; G = u.length;
if (n && E) { if (m && G) {
const F = []; const H = [];
let ia = 0; let ma = 0;
q && (F[0] = [u]); q && (H[0] = [u]);
for (let R = 0, ja, L; R < n.length; R++) { for (let U = 0, na, O; U < m.length; U++) {
if (ja = n[R], E = (L = this.tagindex[ja]) && L.length) { if (na = m[U], G = (O = this.tagindex[na]) && O.length) {
ia++, F[F.length] = q ? [L] : L; ma++, H[H.length] = q ? [O] : O;
} }
} }
ia && (u = q ? da(F, b || 100, r || 0) : ea(u, F), E = u.length); ma && (u = q ? ia(H, b || 100, r || 0) : ja(u, H), G = u.length);
} }
if (E) { if (G) {
f[p] = w, e[p++] = u; f[p] = x, e[p++] = u;
} else { } else {
if (q) { if (q) {
return []; return [];
@@ -799,10 +803,10 @@ T.prototype.search = function(a, b, c, d) {
} }
} }
if (t) { if (t) {
const m = this; const n = this;
return new Promise(function(u) { return new Promise(function(u) {
Promise.all(t).then(function(w) { Promise.all(t).then(function(x) {
u(m.search(a, b, c, w)); u(n.search(a, b, c, x));
}); });
}); });
} }
@@ -812,45 +816,45 @@ T.prototype.search = function(a, b, c, d) {
if (g && (!k || !this.store)) { if (g && (!k || !this.store)) {
return e[0]; return e[0];
} }
for (let m = 0, u; m < f.length; m++) { for (let n = 0, u; n < f.length; n++) {
u = e[m]; u = e[n];
u.length && k && (u = ra.call(this, u)); u.length && k && (u = va.call(this, u));
if (g) { if (g) {
return u; return u;
} }
e[m] = {field:f[m], result:u}; e[n] = {field:f[n], result:u};
} }
return e; return e;
}; };
function qa(a, b, c, d) { function ua(a, b, c, d) {
let e = this.tagindex[a], f = e && e.length - c; let e = this.tagindex[a], f = e && e.length - c;
if (f && 0 < f) { if (f && 0 < f) {
if (f > b || c) { if (f > b || c) {
e = e.slice(c, c + b); e = e.slice(c, c + b);
} }
d && (e = ra.call(this, e)); d && (e = va.call(this, e));
return {tag:a, result:e}; return {tag:a, result:e};
} }
} }
function ra(a) { function va(a) {
const b = Array(a.length); const b = Array(a.length);
for (let c = 0, d; c < a.length; c++) { for (let c = 0, d; c < a.length; c++) {
d = a[c], b[c] = {key:d, doc:this.store[d]}; d = a[c], b[c] = {key:d, doc:this.store[d]};
} }
return b; return b;
} }
T.prototype.contain = function(a) { S.prototype.contain = function(a) {
return !!this.register[a]; return !!this.register[a];
}; };
T.prototype.get = function(a) { S.prototype.get = function(a) {
return this.store[a]; return this.store[a];
}; };
T.prototype.set = function(a, b) { S.prototype.set = function(a, b) {
this.store[a] = b; this.store[a] = b;
return this; return this;
}; };
T.prototype.searchCache = fa; S.prototype.searchCache = ka;
T.prototype.export = function(a, b, c, d, e) { S.prototype.export = function(a, b, c, d, e) {
e || (e = 0); e || (e = 0);
d || (d = 0); d || (d = 0);
if (d < this.field.length) { if (d < this.field.length) {
@@ -873,10 +877,10 @@ T.prototype.export = function(a, b, c, d, e) {
default: default:
return; return;
} }
ka(a, this, c, d, e, f); oa(a, this, c, d, e, f);
} }
}; };
T.prototype.import = function(a, b) { S.prototype.import = function(a, b) {
if (b) { if (b) {
switch(z(b) && (b = JSON.parse(b)), a) { switch(z(b) && (b = JSON.parse(b)), a) {
case "tag": case "tag":
@@ -900,13 +904,56 @@ T.prototype.import = function(a, b) {
} }
} }
}; };
J(T.prototype); ha(S.prototype);
var xa = {encode:wa, rtl:!1, tokenize:""};
const ya = /[\W_]+/, za = E("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), Aa = E("[\u00e8\u00e9\u00ea\u00eb]"), Ba = E("[\u00ec\u00ed\u00ee\u00ef]"), Ca = E("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), Da = E("[\u00f9\u00fa\u00fb\u00fc\u0171]"), Ea = E("[\u00fd\u0177\u00ff]"), Fa = E("\u00f1"), Ga = E("[\u00e7c]"), Ha = E("\u00df"), Ia = E(" & "), Ja = [za, "a", Aa, "e", Ba, "i", Ca, "o", Da, "u", Ea, "y", Fa, "n", Ga, "k", Ha, "s", Ia, " and "];
function wa(a) {
return this.pipeline(C(a).toLowerCase(), !a.normalize && Ja, ya, !1);
}
;var La = {encode:Ka, rtl:!1, tokenize:"strict"};
const Ma = /[^a-z0-9]+/, Na = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"};
function Ka(a) {
a = wa.call(this, a).join(" ");
const b = [];
if (a) {
const c = a.split(Ma), d = c.length;
for (let e = 0, f, g = 0; e < d; e++) {
if ((a = c[e]) && (!this.filter || !this.filter[a])) {
f = a[0];
let k = Na[f] || f, h = k;
for (let l = 1; l < a.length; l++) {
f = a[l];
const m = Na[f] || f;
m && m !== h && (k += m, h = m);
}
b[g++] = k;
}
}
}
return b;
}
;var Pa = {encode:Oa, rtl:!1, tokenize:""};
const Qa = E("ae"), Ra = E("oe"), Sa = E("sh"), Ta = E("th"), Ua = E("ph"), Va = E("pf"), Wa = [Qa, "a", Ra, "o", Sa, "s", Ta, "t", Ua, "f", Va, "f", ];
function Oa(a, b) {
a && (a = Ka.call(this, a).join(" "), 2 < a.length && (a = F(a, Wa)), b || (1 < a.length && (a = I(a)), a && (a = a.split(" "))));
return a;
}
;var Ya = {encode:Xa, rtl:!1, tokenize:""};
const Za = E("(?!\\b)[aeiouy]");
function Xa(a) {
a && (a = Oa.call(this, a, !0), 1 < a.length && (a = a.replace(Za, "")), 1 < a.length && (a = I(a)), a && (a = a.split(" ")));
return a;
}
;J["latin:simple"] = xa;
J["latin:balance"] = La;
J["latin:advanced"] = Pa;
J["latin:extra"] = Ya;
const X = self; const X = self;
let Y; let Y;
const Z = {Index:O, Document:T, Worker:Q, registerCharset:function(a, b) { const Z = {Index:M, Document:S, Worker:Q, registerCharset:function(a, b) {
H[a] = b; J[a] = b;
}, registerLanguage:function(a, b) { }, registerLanguage:function(a, b) {
G[a] = b; ea[a] = b;
}}; }};
(Y = X.define) && Y.amd ? Y([], function() { (Y = X.define) && Y.amd ? Y([], function() {
return Z; return Z;

View File

@@ -5,40 +5,43 @@
* Licence: Apache-2.0 * Licence: Apache-2.0
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict';var u;function v(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var y="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a}; (function(self){'use strict';var u;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var v="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
function aa(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var A=aa(this);function B(a,b){if(b)a:{var c=A;a=a.split(".");for(var d=0;d<a.length-1;d++){var f=a[d];if(!(f in c))break a;c=c[f]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&y(c,a,{configurable:!0,writable:!0,value:b})}} function ba(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var w=ba(this);function z(a,b){if(b)a:{var c=w;a=a.split(".");for(var d=0;d<a.length-1;d++){var f=a[d];if(!(f in c))break a;c=c[f]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&v(c,a,{configurable:!0,writable:!0,value:b})}}
B("Symbol",function(a){function b(g){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(g||"")+"_"+f++,g)}function c(g,e){this.g=g;y(this,"description",{configurable:!0,writable:!0,value:e})}if(a)return a;c.prototype.toString=function(){return this.g};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",f=0;return b}); z("Symbol",function(a){function b(g){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(g||"")+"_"+f++,g)}function c(g,e){this.h=g;v(this,"description",{configurable:!0,writable:!0,value:e})}if(a)return a;c.prototype.toString=function(){return this.h};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",f=0;return b});
B("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=A[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&y(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ba(v(this))}})}return a});function ba(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} z("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=w[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&v(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ca(aa(this))}})}return a});function ca(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}
function ca(a,b){a instanceof String&&(a+="");var c=0,d=!1,f={next:function(){if(!d&&c<a.length){var g=c++;return{value:b(g,a[g]),done:!1}}d=!0;return{done:!0,value:void 0}}};f[Symbol.iterator]=function(){return f};return f}B("Array.prototype.keys",function(a){return a?a:function(){return ca(this,function(b){return b})}});function C(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:v(a)}} function da(a,b){a instanceof String&&(a+="");var c=0,d=!1,f={next:function(){if(!d&&c<a.length){var g=c++;return{value:b(g,a[g]),done:!1}}d=!0;return{done:!0,value:void 0}}};f[Symbol.iterator]=function(){return f};return f}z("Array.prototype.keys",function(a){return a?a:function(){return da(this,function(b){return b})}});function ea(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}
B("Promise",function(a){function b(e){this.h=0;this.i=void 0;this.g=[];this.B=!1;var h=this.j();try{e(h.resolve,h.reject)}catch(k){h.reject(k)}}function c(){this.g=null}function d(e){return e instanceof b?e:new b(function(h){h(e)})}if(a)return a;c.prototype.h=function(e){if(null==this.g){this.g=[];var h=this;this.i(function(){h.o()})}this.g.push(e)};var f=A.setTimeout;c.prototype.i=function(e){f(e,0)};c.prototype.o=function(){for(;this.g&&this.g.length;){var e=this.g;this.g=[];for(var h=0;h<e.length;++h){var k= z("Promise",function(a){function b(e){this.l=0;this.m=void 0;this.h=[];this.I=!1;var h=this.o();try{e(h.resolve,h.reject)}catch(k){h.reject(k)}}function c(){this.h=null}function d(e){return e instanceof b?e:new b(function(h){h(e)})}if(a)return a;c.prototype.l=function(e){if(null==this.h){this.h=[];var h=this;this.m(function(){h.B()})}this.h.push(e)};var f=w.setTimeout;c.prototype.m=function(e){f(e,0)};c.prototype.B=function(){for(;this.h&&this.h.length;){var e=this.h;this.h=[];for(var h=0;h<e.length;++h){var k=
e[h];e[h]=null;try{k()}catch(l){this.j(l)}}}this.g=null};c.prototype.j=function(e){this.i(function(){throw e;})};b.prototype.j=function(){function e(l){return function(n){k||(k=!0,l.call(h,n))}}var h=this,k=!1;return{resolve:e(this.K),reject:e(this.o)}};b.prototype.K=function(e){if(e===this)this.o(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof b)this.M(e);else{a:switch(typeof e){case "object":var h=null!=e;break a;case "function":h=!0;break a;default:h=!1}h?this.J(e):this.A(e)}}; e[h];e[h]=null;try{k()}catch(l){this.o(l)}}}this.h=null};c.prototype.o=function(e){this.m(function(){throw e;})};b.prototype.o=function(){function e(l){return function(n){k||(k=!0,l.call(h,n))}}var h=this,k=!1;return{resolve:e(this.T),reject:e(this.B)}};b.prototype.T=function(e){if(e===this)this.B(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof b)this.V(e);else{a:switch(typeof e){case "object":var h=null!=e;break a;case "function":h=!0;break a;default:h=!1}h?this.S(e):this.G(e)}};
b.prototype.J=function(e){var h=void 0;try{h=e.then}catch(k){this.o(k);return}"function"==typeof h?this.N(h,e):this.A(e)};b.prototype.o=function(e){this.D(2,e)};b.prototype.A=function(e){this.D(1,e)};b.prototype.D=function(e,h){if(0!=this.h)throw Error("Cannot settle("+e+", "+h+"): Promise already settled in state"+this.h);this.h=e;this.i=h;2===this.h&&this.L();this.P()};b.prototype.L=function(){var e=this;f(function(){if(e.R()){var h=A.console;"undefined"!==typeof h&&h.error(e.i)}},1)};b.prototype.R= b.prototype.S=function(e){var h=void 0;try{h=e.then}catch(k){this.B(k);return}"function"==typeof h?this.W(h,e):this.G(e)};b.prototype.B=function(e){this.J(2,e)};b.prototype.G=function(e){this.J(1,e)};b.prototype.J=function(e,h){if(0!=this.l)throw Error("Cannot settle("+e+", "+h+"): Promise already settled in state"+this.l);this.l=e;this.m=h;2===this.l&&this.U();this.P()};b.prototype.U=function(){var e=this;f(function(){if(e.R()){var h=w.console;"undefined"!==typeof h&&h.error(e.m)}},1)};b.prototype.R=
function(){if(this.B)return!1;var e=A.CustomEvent,h=A.Event,k=A.dispatchEvent;if("undefined"===typeof k)return!0;"function"===typeof e?e=new e("unhandledrejection",{cancelable:!0}):"function"===typeof h?e=new h("unhandledrejection",{cancelable:!0}):(e=A.document.createEvent("CustomEvent"),e.initCustomEvent("unhandledrejection",!1,!0,e));e.promise=this;e.reason=this.i;return k(e)};b.prototype.P=function(){if(null!=this.g){for(var e=0;e<this.g.length;++e)g.h(this.g[e]);this.g=null}};var g=new c;b.prototype.M= function(){if(this.I)return!1;var e=w.CustomEvent,h=w.Event,k=w.dispatchEvent;if("undefined"===typeof k)return!0;"function"===typeof e?e=new e("unhandledrejection",{cancelable:!0}):"function"===typeof h?e=new h("unhandledrejection",{cancelable:!0}):(e=w.document.createEvent("CustomEvent"),e.initCustomEvent("unhandledrejection",!1,!0,e));e.promise=this;e.reason=this.m;return k(e)};b.prototype.P=function(){if(null!=this.h){for(var e=0;e<this.h.length;++e)g.l(this.h[e]);this.h=null}};var g=new c;b.prototype.V=
function(e){var h=this.j();e.F(h.resolve,h.reject)};b.prototype.N=function(e,h){var k=this.j();try{e.call(h,k.resolve,k.reject)}catch(l){k.reject(l)}};b.prototype.then=function(e,h){function k(m,p){return"function"==typeof m?function(r){try{l(m(r))}catch(t){n(t)}}:p}var l,n,q=new b(function(m,p){l=m;n=p});this.F(k(e,l),k(h,n));return q};b.prototype.catch=function(e){return this.then(void 0,e)};b.prototype.F=function(e,h){function k(){switch(l.h){case 1:e(l.i);break;case 2:h(l.i);break;default:throw Error("Unexpected state: "+ function(e){var h=this.o();e.M(h.resolve,h.reject)};b.prototype.W=function(e,h){var k=this.o();try{e.call(h,k.resolve,k.reject)}catch(l){k.reject(l)}};b.prototype.then=function(e,h){function k(m,p){return"function"==typeof m?function(r){try{l(m(r))}catch(t){n(t)}}:p}var l,n,q=new b(function(m,p){l=m;n=p});this.M(k(e,l),k(h,n));return q};b.prototype.catch=function(e){return this.then(void 0,e)};b.prototype.M=function(e,h){function k(){switch(l.l){case 1:e(l.m);break;case 2:h(l.m);break;default:throw Error("Unexpected state: "+
l.h);}}var l=this;null==this.g?g.h(k):this.g.push(k);this.B=!0};b.resolve=d;b.reject=function(e){return new b(function(h,k){k(e)})};b.race=function(e){return new b(function(h,k){for(var l=C(e),n=l.next();!n.done;n=l.next())d(n.value).F(h,k)})};b.all=function(e){var h=C(e),k=h.next();return k.done?d([]):new b(function(l,n){function q(r){return function(t){m[r]=t;p--;0==p&&l(m)}}var m=[],p=0;do m.push(void 0),p++,d(k.value).F(q(m.length-1),n),k=h.next();while(!k.done)})};return b}); l.l);}}var l=this;null==this.h?g.l(k):this.h.push(k);this.I=!0};b.resolve=d;b.reject=function(e){return new b(function(h,k){k(e)})};b.race=function(e){return new b(function(h,k){for(var l=ea(e),n=l.next();!n.done;n=l.next())d(n.value).M(h,k)})};b.all=function(e){var h=ea(e),k=h.next();return k.done?d([]):new b(function(l,n){function q(r){return function(t){m[r]=t;p--;0==p&&l(m)}}var m=[],p=0;do m.push(void 0),p++,d(k.value).M(q(m.length-1),n),k=h.next();while(!k.done)})};return b});
var da="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 f in d)Object.prototype.hasOwnProperty.call(d,f)&&(a[f]=d[f])}return a};B("Object.assign",function(a){return a||da});var E=/[\W_]+/;function ea(a){if(a=a.toLowerCase())if(a&&this.G&&(a=fa(a,this.G)),this.I&&1<a.length&&(a=fa(a,this.I)),a&&(E||""===E)&&(a=a.split(E),this.filter)){for(var b=this.filter,c=a.length,d=[],f=0,g=0;f<c;f++){var e=a[f];e&&!b[e]&&(d[g++]=e)}a=d}return a};function F(a,b){return"undefined"!==typeof a?a:b}function ha(a){for(var b=Array(a),c=0;c<a;c++)b[c]=G();return b}function G(){return Object.create(null)}function ia(a,b){return b.length-a.length}function H(a){return"string"===typeof a}function I(a){return"object"===typeof a}function K(a){return"function"===typeof a};function ja(a,b){for(var c=Object.keys(a),d=c.length,f=[],g="",e=0,h=0,k,l;h<d;h++)k=c[h],(l=a[k])?(f[e++]=new RegExp(b?"(?!\\b)"+k+"(\\b|_)":k,"g"),f[e++]=l):g+=(g?"|":"")+k;g&&(f[e++]=new RegExp(b?"(?!\\b)("+g+")(\\b|_)":"("+g+")","g"),f[e]="");return f}function fa(a,b){for(var c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a};var ka={},la={};var ma=Promise;function na(a){L(a,"add");L(a,"append");L(a,"search");L(a,"update");L(a,"remove")}function L(a,b){a[b+"Async"]=function(){var c=this,d=arguments,f=d[d.length-1];if(K(f)){var g=f;delete d[d.length-1]}f=new ma(function(e){setTimeout(function(){c.async=!0;e(c[b].apply(c,d));c.async=!1})});return g?(f.then(g),this):f}};function oa(a,b,c,d){var f=a.length,g=[],e=0;d&&(d=[]);for(--f;0<=f;f--){for(var h=a[f],k=h.length,l=G(),n=!w,q=0;q<k;q++){var m=h[q],p=m.length;if(p)for(var r=0,t=0,x;r<p;r++)if(x=m[r],!w)l[x]=1;else if(w[x]){if(f)d&&t<b&&((d[q]||(d[q]=[]))[t++]=x),l[x]=1;else if(c)c--;else if(g[e++]=x,e===b)return g;n=!0}}if(!n&&!d)return[];var w=l}if(d)for(a=d.length-1;0<=a;a--)if((f=(w=d[a])&&w.length)&&c&&(f<=c?(c-=f,f=0):f-=c),f){if(e+f>=b)return g.concat(w.slice(c,b-e+c));g=g.concat(c?w.slice(c):w);e+=f;c= var fa="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 f in d)Object.prototype.hasOwnProperty.call(d,f)&&(a[f]=d[f])}return a};z("Object.assign",function(a){return a||fa});function B(a,b){return"undefined"!==typeof a?a:b}function ha(a){for(var b=Array(a),c=0;c<a;c++)b[c]=C();return b}function C(){return Object.create(null)}function ia(a,b){return b.length-a.length}function D(a){return"string"===typeof a}function E(a){return"object"===typeof a}function G(a){return"function"===typeof a};var ja=/[\u0300-\u036f]/g;function ka(a){a.normalize&&(a=a.normalize("NFD").replace(ja,""));return a}function la(a,b){for(var c=Object.keys(a),d=c.length,f=[],g="",e=0,h=0,k,l;h<d;h++)k=c[h],(l=a[k])?(f[e++]=H(b?"(?!\\b)"+k+"(\\b|_)":k),f[e++]=l):g+=(g?"|":"")+k;g&&(f[e++]=H(b?"(?!\\b)("+g+")(\\b|_)":"("+g+")"),f[e]="");return f}function I(a,b){for(var c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function H(a){return new RegExp(a,"g")}
0}return g}function qa(a,b){for(var c=G(),d=G(),f=[],g=0;g<a.length;g++)c[a[g]]=1;for(a=0;a<b.length;a++){g=b[a];for(var e=0,h;e<g.length;e++)h=g[e],c[h]&&!d[h]&&(d[h]=1,f[f.length]=h)}return f};function M(a){this.h=!0!==a&&a;this.cache=G();this.g=[]}function ra(a,b,c){I(a)&&(a=a.query);var d=this.cache.get(a);d||(d=this.search(a,b,c),this.cache.set(a,d));return d}M.prototype.set=function(a,b){if(!this.cache[a]){var c=this.g.length;c===this.h?delete this.cache[this.g[c-1]]:c++;for(--c;0<c;c--)this.g[c]=this.g[c-1];this.g[0]=a}this.cache[a]=b};M.prototype.get=function(a){var b=this.cache[a];if(this.h&&b&&(a=this.g.indexOf(a))){var c=this.g[a-1];this.g[a-1]=this.g[a];this.g[a]=c}return b};var sa={memory:{charset:"latin:extra",v:3,u:3,m:!1,s:"memory"},performance:{threshold:8,u:3,context:{depth:1,C:!0}},match:{charset:"latin:extra",O:"full",v:3},score:{charset:"latin:advanced",threshold:1,context:{depth:3,C:!0}},"default":{v:3,threshold:0,depth:3}};function ta(a,b,c,d,f,g){setTimeout(function(){var e=a(c,JSON.stringify(g));e&&e.then?e.then(function(){b.export(a,b,c,d,f+1)}):b.export(a,b,c,d,f+1)})};function N(a,b){if(!(this instanceof N))return new N(a);var c;if(a){H(a)?a=sa[a]:(c=a.preset)&&(a=Object.assign({},c[c],a));c=a.charset;var d=a.lang;H(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=la[c]);H(d)&&(d=ka[d])}else a={};var f,g=a.context||{};this.encode=a.encode||c&&c.encode||ea;this.register=b||G();var e=a.resolution||9;var h=a.threshold||0;h>=e&&(h=e-1);this.v=e;this.threshold=h;this.j=b=c&&c.O||a.tokenize||"strict";this.depth="strict"===b&&g.depth;this.C=F(g.bidirectional,!0);this.s=f= function ma(a){for(var b="",c="",d=0,f=a.length,g=void 0;d<f;d++)(g=a[d])!==c&&(b+=c=g);return b};var na=/[\W_]+/;function oa(a){return pa(this,ka(a).toLowerCase(),!1,na)};var qa={},J={};var ra=Promise;function sa(a){K(a,"add");K(a,"append");K(a,"search");K(a,"update");K(a,"remove")}function K(a,b){a[b+"Async"]=function(){var c=this,d=arguments,f=d[d.length-1];if(G(f)){var g=f;delete d[d.length-1]}f=new ra(function(e){setTimeout(function(){c.async=!0;e(c[b].apply(c,d));c.async=!1})});return g?(f.then(g),this):f}};function ua(a,b,c,d){var f=a.length,g=[],e=0;d&&(d=[]);for(--f;0<=f;f--){for(var h=a[f],k=h.length,l=C(),n=!x,q=0;q<k;q++){var m=h[q],p=m.length;if(p)for(var r=0,t=0,y;r<p;r++)if(y=m[r],!x)l[y]=1;else if(x[y]){if(f)d&&t<b&&((d[q]||(d[q]=[]))[t++]=y),l[y]=1;else if(c)c--;else if(g[e++]=y,e===b)return g;n=!0}}if(!n&&!d)return[];var x=l}if(d)for(a=d.length-1;0<=a;a--)if((f=(x=d[a])&&x.length)&&c&&(f<=c?(c-=f,f=0):f-=c),f){if(e+f>=b)return g.concat(x.slice(c,b-e+c));g=g.concat(c?x.slice(c):x);e+=f;c=
"memory"===a.optimize;this.m=F(a.fastupdate,!0);this.u=a.minlength||1;this.map=f?ha(e-h):G();e=g.resolution||e;h=g.threshold||h;h>=e&&(h=e-1);this.h=e;this.i=h;this.g=f?ha(e-h):G();this.H=c&&c.H||a.rtl;this.G=(b=a.matcher||d&&d.G)&&ja(b,!1);this.I=(b=a.stemmer||d&&d.I)&&ja(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=G();g=0;for(e=c.length;g<e;g++)d[c[g]]=1;c=d}this.filter=c;this.cache=(b=a.cache)&&new M(b)}u=N.prototype;u.append=function(a,b){return this.add(a,b,!0)}; 0}return g}function va(a,b){for(var c=C(),d=C(),f=[],g=0;g<a.length;g++)c[a[g]]=1;for(a=0;a<b.length;a++){g=b[a];for(var e=0,h;e<g.length;e++)h=g[e],c[h]&&!d[h]&&(d[h]=1,f[f.length]=h)}return f};function M(a){this.l=!0!==a&&a;this.cache=C();this.h=[]}function wa(a,b,c){E(a)&&(a=a.query);var d=this.cache.get(a);d||(d=this.search(a,b,c),this.cache.set(a,d));return d}M.prototype.set=function(a,b){if(!this.cache[a]){var c=this.h.length;c===this.l?delete this.cache[this.h[c-1]]:c++;for(--c;0<c;c--)this.h[c]=this.h[c-1];this.h[0]=a}this.cache[a]=b};M.prototype.get=function(a){var b=this.cache[a];if(this.l&&b&&(a=this.h.indexOf(a))){var c=this.h[a-1];this.h[a-1]=this.h[a];this.h[a]=c}return b};var xa={memory:{charset:"latin:extra",F:3,D:3,A:!1,C:"memory"},performance:{threshold:8,D:3,context:{depth:1,K:!0}},match:{charset:"latin:extra",L:"full",F:3},score:{charset:"latin:advanced",threshold:1,context:{depth:3,K:!0}},"default":{F:3,threshold:0,depth:3}};function ya(a,b,c,d,f,g){setTimeout(function(){var e=a(c,JSON.stringify(g));e&&e.then?e.then(function(){b.export(a,b,c,d,f+1)}):b.export(a,b,c,d,f+1)})};J["latin:default"]=oa;
u.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);var d=b.length;if(d){for(var f=this.depth,g=this.v-this.threshold,e=G(),h=G(),k=0;k<d;k++){var l=b[this.H?d-1-k:k],n=l.length;if(l&&n>=this.u&&(f||!e[l])){var q=Math.min(this.v/d*k|0,k);if(q<g){var m="";switch(this.j){case "full":if(3<n){for(var p=0;p<n;p++){var r=p?Math.min(q/2+this.v/n*p/2|0,q+p):q;if(r<g)for(var t=n;t>p;t--)m=l.substring(p,t),m.length>=this.u&&O(this,e,m,r,a,c)}break}case "reverse":if(2< function N(a,b){if(!(this instanceof N))return new N(a);var c;if(a){D(a)?a=xa[a]:(c=a.preset)&&(a=Object.assign({},c[c],a));c=a.charset;var d=a.lang;D(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=J[c]);D(d)&&(d=qa[d])}else a={};var f,g=a.context||{};this.encode=a.encode||c&&c.encode||oa;this.register=b||C();var e=a.resolution||9;var h=a.threshold||0;h>=e&&(h=e-1);this.F=e;this.threshold=h;this.o=b=c&&c.L||a.tokenize||"strict";this.depth="strict"===b&&g.depth;this.K=B(g.bidirectional,!0);this.C=f="memory"===
n){for(p=n-1;0<p;p--)m=l[p]+m,m.length>=this.u&&O(this,e,m,q,a,c);m=""}case "forward":if(1<n)for(p=0;p<n;p++)m+=l[p],m.length>=this.u&&O(this,e,m,q,a,c);break;default:if(O(this,e,l,q,a,c),f&&1<d&&k<d-1)for(n=this.h-this.i,q=G(),m=l,p=Math.min(f+1,d-k),r=q[m]=1;r<p;r++)if((l=b[this.H?d-1-k-r:k+r])&&l.length>=this.u&&!q[l]){if(q[l]=1,t=Math.min((this.h-p)/d*k+r|0,k+(r-1)),t<n){var x=this.C&&l>m;O(this,h,x?m:l,t,a,c,x?l:m)}}else p=Math.min(p+1,d-k)}}}}this.m||(this.register[a]=1)}}return this}; a.optimize;this.A=B(a.fastupdate,!0);this.D=a.minlength||1;this.map=f?ha(e-h):C();e=g.resolution||e;h=g.threshold||h;h>=e&&(h=e-1);this.l=e;this.m=h;this.h=f?ha(e-h):C();this.H=c&&c.H||a.rtl;this.N=(b=a.matcher||d&&d.N)&&la(b,!1);this.O=(b=a.stemmer||d&&d.O)&&la(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=C();g=0;for(e=c.length;g<e;g++)d[c[g]]=1;c=d}this.filter=c;this.cache=(b=a.cache)&&new M(b)}
function O(a,b,c,d,f,g,e){var h=e?a.g:a.map;if(!b[c]||e&&!b[c][e])a.s&&(h=h[d]),e?(b=b[c]||(b[c]=G()),b[e]=1,h=h[e]||(h[e]=G())):b[c]=1,h=h[c]||(h[c]=[]),a.s||(h=h[d]||(h[d]=[])),g&&-1!==h.indexOf(f)||(h[h.length]=f,a.m&&(a=a.register[f]||(a.register[f]=[]),a[a.length]=h))} function pa(a,b,c,d){if(b&&(c&&(b=I(b,c)),a.N&&(b=I(b,a.N)),a.O&&1<b.length&&(b=I(b,a.O)),d||""===d)){b=b.split(d);if(a.filter){a=a.filter;c=b.length;d=[];for(var f=0,g=0;f<c;f++){var e=b[f];e&&!a[e]&&(d[g++]=e)}b=d}return b}return b}u=N.prototype;u.append=function(a,b){return this.add(a,b,!0)};
u.search=function(a,b,c){I(a)?(c=a,a=c.query):I(b)&&(c=b);var d=[],f=this.threshold,g=0;if(c){b=c.limit;g=c.offset||0;f=F(c.threshold,f);var e=c.context;var h=c.suggest}if(a){a=this.encode(a);var k=a.length;if(1<k){c=G();for(var l=[],n=0,q=0,m;n<k;n++)if((m=a[n])&&m.length>=this.u&&!c[m])if(this.s||h||this.map[m])l[q++]=m,c[m]=1;else return d;a=l;k=a.length}}if(!k)return d;b||(b=100);c=this.v-f;f=this.h-f;e=this.depth&&1<k&&!1!==e;l=0;if(e){var p=a[0];l=1}else 1<k&&a.sort(ia);for(;l<k;l++){q=a[l]; u.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);var d=b.length;if(d){for(var f=this.depth,g=this.F-this.threshold,e=C(),h=C(),k=0;k<d;k++){var l=b[this.H?d-1-k:k],n=l.length;if(l&&n>=this.D&&(f||!e[l])){var q=Math.min(this.F/d*k|0,k);if(q<g){var m="";switch(this.o){case "full":if(3<n){for(var p=0;p<n;p++){var r=p?Math.min(q/2+this.F/n*p/2|0,q+p):q;if(r<g)for(var t=n;t>p;t--)m=l.substring(p,t),m.length>=this.D&&O(this,e,m,r,a,c)}break}case "reverse":if(2<
e?(n=ua(this,d,h,f,b,g,2===k,q,p),h&&!1===n&&d.length||(p=q)):n=ua(this,d,h,c,b,g,1===k,q);if(n)return n;if(h&&l===k-1){n=d.length;if(!n){if(e){e=0;l=-1;continue}return d}if(1===n)return va(d[0],b,g)}}return oa(d,b,g,h)}; n){for(p=n-1;0<p;p--)m=l[p]+m,m.length>=this.D&&O(this,e,m,q,a,c);m=""}case "forward":if(1<n)for(p=0;p<n;p++)m+=l[p],m.length>=this.D&&O(this,e,m,q,a,c);break;default:if(O(this,e,l,q,a,c),f&&1<d&&k<d-1)for(n=this.l-this.m,q=C(),m=l,p=Math.min(f+1,d-k),r=q[m]=1;r<p;r++)if((l=b[this.H?d-1-k-r:k+r])&&l.length>=this.D&&!q[l]){if(q[l]=1,t=Math.min((this.l-p)/d*k+r|0,k+(r-1)),t<n){var y=this.K&&l>m;O(this,h,y?m:l,t,a,c,y?l:m)}}else p=Math.min(p+1,d-k)}}}}this.A||(this.register[a]=1)}}return this};
function ua(a,b,c,d,f,g,e,h,k){var l=[],n=k?a.g:a.map;a.s||(n=wa(n,h,k,a.C));if(n){var q=0;d=Math.min(n.length,d);for(var m=0,p=0,r,t;m<d&&!(r=n[m],a.s&&(r=wa(r,h,k,a.C)),r&&e&&(t=r.length,t<=g?(g-=t,r=null):g&&(r=r.slice(g),g=0)),r&&(l[q++]=r,e&&(p+=r.length,p>=f)));m++);if(q){if(e)return va(l,f,0);b[b.length]=l;return}}return!c&&l}function va(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function O(a,b,c,d,f,g,e){var h=e?a.h:a.map;if(!b[c]||e&&!b[c][e])a.C&&(h=h[d]),e?(b=b[c]||(b[c]=C()),b[e]=1,h=h[e]||(h[e]=C())):b[c]=1,h=h[c]||(h[c]=[]),a.C||(h=h[d]||(h[d]=[])),g&&-1!==h.indexOf(f)||(h[h.length]=f,a.A&&(a=a.register[f]||(a.register[f]=[]),a[a.length]=h))}
function wa(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}u.contain=function(a){return!!this.register[a]};u.update=function(a,b){return this.remove(a).add(a,b)}; u.search=function(a,b,c){E(a)?(c=a,a=c.query):E(b)&&(c=b);var d=[],f=this.threshold,g=0;if(c){b=c.limit;g=c.offset||0;f=B(c.threshold,f);var e=c.context;var h=c.suggest}if(a){a=this.encode(a);var k=a.length;if(1<k){c=C();for(var l=[],n=0,q=0,m;n<k;n++)if((m=a[n])&&m.length>=this.D&&!c[m])if(this.C||h||this.map[m])l[q++]=m,c[m]=1;else return d;a=l;k=a.length}}if(!k)return d;b||(b=100);c=this.F-f;f=this.l-f;e=this.depth&&1<k&&!1!==e;l=0;if(e){var p=a[0];l=1}else 1<k&&a.sort(ia);for(;l<k;l++){q=a[l];
u.remove=function(a,b){var c=this.register[a];if(c){if(this.m)for(var d=0,f;d<c.length;d++)f=c[d],f.splice(f.indexOf(a),1);else P(this.map,a,this.v-this.threshold,this.s),this.depth&&P(this.g,a,this.h-this.i,this.s);b||delete this.register[a];if(this.cache)for(b=this.cache,c=0;c<b.g.length;c++)f=b.g[c],d=b.cache[f],-1!==d.indexOf(a)&&(b.g.splice(c--,1),delete b.cache[f])}return this}; e?(n=za(this,d,h,f,b,g,2===k,q,p),h&&!1===n&&d.length||(p=q)):n=za(this,d,h,c,b,g,1===k,q);if(n)return n;if(h&&l===k-1){n=d.length;if(!n){if(e){e=0;l=-1;continue}return d}if(1===n)return Aa(d[0],b,g)}}return ua(d,b,g,h)};
function P(a,b,c,d,f){var g=0;if(a.constructor===Array)if(f)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),g++):g++;else{f=Math.min(a.length,c);for(var e=0,h;e<f;e++)if(h=a[e])g=P(h,b,c,d,f),d||g||delete a[e]}else for(e in a)(g=P(a[e],b,c,d,f))||delete a[e];return g}u.searchCache=ra; function za(a,b,c,d,f,g,e,h,k){var l=[],n=k?a.h:a.map;a.C||(n=Ba(n,h,k,a.K));if(n){var q=0;d=Math.min(n.length,d);for(var m=0,p=0,r,t;m<d&&!(r=n[m],a.C&&(r=Ba(r,h,k,a.K)),r&&e&&(t=r.length,t<=g?(g-=t,r=null):g&&(r=r.slice(g),g=0)),r&&(l[q++]=r,e&&(p+=r.length,p>=f)));m++);if(q){if(e)return Aa(l,f,0);b[b.length]=l;return}}return!c&&l}function Aa(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a}
u.export=function(a,b,c,d,f){switch(f||(f=0)){case 0:var g="reg";if(this.m){var e=G();for(var h in this.register)e[h]=1}else e=this.register;break;case 1:g="cfg";e={doc:0,opt:this.s?1:0};break;case 2:g="map";e=this.map;break;case 3:g="ctx";e=this.g;break;default:return}ta(a,b||this,c?c+"."+g:g,d,f,e);return!0};u.import=function(a,b){if(b)switch(H(b)&&(b=JSON.parse(b)),a){case "cfg":this.s=!!b.opt;break;case "reg":this.m=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.g=b}};na(N.prototype);function xa(a){var b=self._index;a=a.data;var c=a.args,d=a.task;switch(d){case "init":b=a.options||{};a=a.factory;c=b.encode;b.cache=!1;c&&0===c.indexOf("function")&&(b.encode=Function("return "+c)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(b),delete self.FlexSearch):self._index=new N(b);break;case "search":b=b.search.apply(b,c);postMessage(b);break;default:b[d].apply(b,c)}};function Q(a,b){var c;I(a)?b=a:b?K(c=b.encode)&&(b.encode=c.toString()):b={};(a=(self||window)._factory)&&(a=a.toString());c=self.exports;if(this.l=ya(a,c)){this.g=null;var d=this;if(c)this.l.on("message",function(f){d.g(f)});else this.l.onmessage=function(f){d.g(f.data)};this.l.postMessage({task:"init",factory:a,options:b})}}R("add");R("append");R("search");R("update");R("remove"); function Ba(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}u.contain=function(a){return!!this.register[a]};u.update=function(a,b){return this.remove(a).add(a,b)};
function R(a){Q.prototype[a]=Q.prototype[a+"Async"]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if(K(d)){var f=d;c.splice(c.length-1,1)}d=new ma(function(g){setTimeout(function(){b.l.postMessage({task:a,args:c});"search"===a?b.g=g:g()})});return f?(d.then(f),this):d}} u.remove=function(a,b){var c=this.register[a];if(c){if(this.A)for(var d=0,f;d<c.length;d++)f=c[d],f.splice(f.indexOf(a),1);else P(this.map,a,this.F-this.threshold,this.C),this.depth&&P(this.h,a,this.l-this.m,this.C);b||delete this.register[a];if(this.cache)for(b=this.cache,c=0;c<b.h.length;c++)f=b.h[c],d=b.cache[f],-1!==d.indexOf(a)&&(b.h.splice(c--,1),delete b.cache[f])}return this};
function ya(a,b){try{var c=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+xa.toString()],{type:"text/javascript"}))):new Worker("worker.js",{type:"module"})}catch(d){}return c};function S(a){if(!(this instanceof S))return new S(a);var b;a||(a={});this.D=[];this.g=[];this.j=[];this.register=G();this.key=(b=a.key)&&T(b,this.j)||"id";this.m=F(a.fastupdate,!0);this.A=!!(b=a.extern);this.o=!this.A&&(b=a.store)&&!0!==b&&[];this.store=b&&(this.A?b:G());this.B=(b=a.tag)&&T(b,this.j);this.h=b&&G();this.cache=(b=a.cache)&&new M(b);a.cache=!1;this.l=a.worker;this.async=!1;b=a;a=G();var c=b.doc;if(H(c))c=[c];else if(c.constructor!==Array){var d=c;c=Object.keys(c)}for(var f=0,g,e=void 0;f< function P(a,b,c,d,f){var g=0;if(a.constructor===Array)if(f)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),g++):g++;else{f=Math.min(a.length,c);for(var e=0,h;e<f;e++)if(h=a[e])g=P(h,b,c,d,f),d||g||delete a[e]}else for(e in a)(g=P(a[e],b,c,d,f))||delete a[e];return g}u.searchCache=wa;
c.length;f++)g=c[f],H(g)?d&&(e=d[g]):(e=g,g=g.field),e=I(e)?Object.assign({},b,e):b,this.l&&(a[g]=new Q(e),a[g].l||(this.l=!1)),this.l||(a[g]=new N(e,this.register)),this.D[f]=T(g,this.j),this.g[f]=g;if(this.o)for(d=b.store,H(d)&&(d=[d]),b=0;b<d.length;b++)this.o[b]=T(d[b],this.j);this.i=a}function T(a,b){for(var c=a.split(":"),d=0,f=0;f<c.length;f++)a=c[f],0<=a.indexOf("[]")&&(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.export=function(a,b,c,d,f){switch(f||(f=0)){case 0:var g="reg";if(this.A){var e=C();for(var h in this.register)e[h]=1}else e=this.register;break;case 1:g="cfg";e={doc:0,opt:this.C?1:0};break;case 2:g="map";e=this.map;break;case 3:g="ctx";e=this.h;break;default:return}ya(a,b||this,c?c+"."+g:g,d,f,e);return!0};u.import=function(a,b){if(b)switch(D(b)&&(b=JSON.parse(b)),a){case "cfg":this.C=!!b.opt;break;case "reg":this.A=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};sa(N.prototype);function Ca(a){var b=self._index;a=a.data;var c=a.args,d=a.task;switch(d){case "init":b=a.options||{};a=a.factory;c=b.encode;b.cache=!1;c&&0===c.indexOf("function")&&(b.encode=Function("return "+c)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(b),delete self.FlexSearch):self._index=new N(b);break;case "search":b=b.search.apply(b,c);postMessage(b);break;default:b[d].apply(b,c)}};function Q(a,b){var c;E(a)?b=a:b?G(c=b.encode)&&(b.encode=c.toString()):b={};(a=(self||window)._factory)&&(a=a.toString());c=self.exports;if(this.s=Da(a,c)){this.h=null;var d=this;if(c)this.s.on("message",function(f){d.h(f)});else this.s.onmessage=function(f){d.h(f.data)};this.s.postMessage({task:"init",factory:a,options:b})}}R("add");R("append");R("search");R("update");R("remove");
function za(a,b){if(H(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function U(a,b,c,d,f){a=a[f];if(d===c.length-1)b[f]=a;else if(a)if(a.constructor===Array)for(b=b[f]=Array(a.length),f=0;f<a.length;f++)U(a,b,c,d,f);else b=b[f]||(b[f]=G()),f=c[++d],U(a,b,c,d,f)} function R(a){Q.prototype[a]=Q.prototype[a+"Async"]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if(G(d)){var f=d;c.splice(c.length-1,1)}d=new ra(function(g){setTimeout(function(){b.s.postMessage({task:a,args:c});"search"===a?b.h=g:g()})});return f?(d.then(f),this):d}}
function W(a,b,c,d,f,g,e,h){a=a[e];if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)f.add(g,a[b],!0);return}a=a.join(" ")}f.add(g,a,h)}else if(a)if(a.constructor===Array)for(e=0;e<a.length;e++)W(a,b,c,d,f,g,e,h);else e=b[++d],W(a,b,c,d,f,g,e,h)}u=S.prototype; function Da(a,b){try{var c=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+Ca.toString()],{type:"text/javascript"}))):new Worker("worker.js",{type:"module"})}catch(d){}return c};function S(a){if(!(this instanceof S))return new S(a);var b;a||(a={});this.J=[];this.h=[];this.o=[];this.register=C();this.key=(b=a.key)&&T(b,this.o)||"id";this.A=B(a.fastupdate,!0);this.G=!!(b=a.extern);this.B=!this.G&&(b=a.store)&&!0!==b&&[];this.store=b&&(this.G?b:C());this.I=(b=a.tag)&&T(b,this.o);this.l=b&&C();this.cache=(b=a.cache)&&new M(b);a.cache=!1;this.s=a.worker;this.async=!1;b=a;a=C();var c=b.doc;if(D(c))c=[c];else if(c.constructor!==Array){var d=c;c=Object.keys(c)}for(var f=0,g,e=void 0;f<
u.add=function(a,b,c){I(a)&&(b=a,a=za(b,this.key));if(b&&(a||0===a)){if(this.register[a])return this.update(a,b);for(var d=0,f,g;d<this.g.length;d++)g=this.g[d],f=this.D[d],H(f)&&(f=[f]),W(b,f,this.j,0,this.i[g],a,f[0],c);if(this.B){d=za(b,this.B);f=G();H(d)&&(d=[d]);g=0;for(var e;g<d.length;g++)if(e=d[g],!f[e]&&(f[e]=1,e=this.h[e]||(this.h[e]=[]),!c||-1===e.indexOf(a)))if(e[e.length]=a,this.m){var h=this.register[a]||(this.register[a]=[]);h[h.length]=e}}if(this.store&&!this.A){if(this.o){var k=G(); c.length;f++)g=c[f],D(g)?d&&(e=d[g]):(e=g,g=g.field),e=E(e)?Object.assign({},b,e):b,this.s&&(a[g]=new Q(e),a[g].s||(this.s=!1)),this.s||(a[g]=new N(e,this.register)),this.J[f]=T(g,this.o),this.h[f]=g;if(this.B)for(d=b.store,D(d)&&(d=[d]),b=0;b<d.length;b++)this.B[b]=T(d[b],this.o);this.m=a}function T(a,b){for(var c=a.split(":"),d=0,f=0;f<c.length;f++)a=c[f],0<=a.indexOf("[]")&&(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]}
for(c=0;c<this.o.length;c++)d=this.o[c],H(d)?k[d]=b[d]:U(b,k,d,0,d[0])}this.store[a]=k||b}}return this};u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)}; function Ea(a,b){if(D(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function U(a,b,c,d,f){a=a[f];if(d===c.length-1)b[f]=a;else if(a)if(a.constructor===Array)for(b=b[f]=Array(a.length),f=0;f<a.length;f++)U(a,b,c,d,f);else b=b[f]||(b[f]=C()),f=c[++d],U(a,b,c,d,f)}
u.remove=function(a){I(a)&&(a=a[this.key]);if(this.register[a]){for(var b=0;b<this.g.length&&(this.i[this.g[b]].remove(a,!0),!this.m||this.l);b++);if(this.B&&(!this.m||this.l))for(var c in this.h){b=this.h[c];var d=b.indexOf(a);-1!==d&&(1<b.length?b.splice(d,1):delete this.h[c])}this.store&&!this.A&&delete this.store[a];delete this.register[a]}return this}; function V(a,b,c,d,f,g,e,h){a=a[e];if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)f.add(g,a[b],!0);return}a=a.join(" ")}f.add(g,a,h)}else if(a)if(a.constructor===Array)for(e=0;e<a.length;e++)V(a,b,c,d,f,g,e,h);else e=b[++d],V(a,b,c,d,f,g,e,h)}u=S.prototype;
u.search=function(a,b,c,d){I(a)?(c=a,a=c.query):I(b)&&(c=b,b=0);var f=[],g=[],e,h=0;if(c)if(c.constructor===Array){var k=c;c=null}else{k=(e=c.pluck)||c.field||c.doc;var l=c.tag;var n=this.store&&c.enrich;var q="and"===c.bool;b=c.limit||100;var m=c.offset||0;if(k)if(H(k))k=[k];else if(k.constructor!==Array){var p=k;k=Object.keys(k)}if(l&&(H(l)&&(l=[l]),!a)){g=0;for(e=void 0;g<l.length;g++)if(e=Aa.call(this,l[g],b,m,n))f[f.length]=e,h++;return h?f:[]}}k||(k=this.g);q=q&&(1<k.length||l&&1<l.length); u.add=function(a,b,c){E(a)&&(b=a,a=Ea(b,this.key));if(b&&(a||0===a)){if(this.register[a])return this.update(a,b);for(var d=0,f,g;d<this.h.length;d++)g=this.h[d],f=this.J[d],D(f)&&(f=[f]),V(b,f,this.o,0,this.m[g],a,f[0],c);if(this.I){d=Ea(b,this.I);f=C();D(d)&&(d=[d]);g=0;for(var e;g<d.length;g++)if(e=d[g],!f[e]&&(f[e]=1,e=this.l[e]||(this.l[e]=[]),!c||-1===e.indexOf(a)))if(e[e.length]=a,this.A){var h=this.register[a]||(this.register[a]=[]);h[h.length]=e}}if(this.store&&!this.G){if(this.B){var k=C();
for(var r=!d&&(this.l||this.async)&&[],t=0,x=void 0,w=void 0,z=void 0;t<k.length;t++)if(z=void 0,w=k[t],H(w)?p&&(z=p[w]):(z=w,w=w.field),r)r[t]=this.i[w].searchAsync(a,b,z||c);else{d?x=d[t]:x=this.i[w].search(a,b,z||c);z=x.length;if(l&&z){var J=[],pa=0;q&&(J[0]=[x]);var V=0,D=void 0;for(D=void 0;V<l.length;V++)if(D=l[V],z=(D=this.h[D])&&D.length)pa++,J[J.length]=q?[D]:D;pa&&(x=q?oa(J,b||100,m||0):qa(x,J),z=x.length)}if(z)g[h]=w,f[h++]=x;else if(q)return[]}if(r){var Ca=this;return new Promise(function(Da){Promise.all(r).then(function(Ea){Da(Ca.search(a, for(c=0;c<this.B.length;c++)d=this.B[c],D(d)?k[d]=b[d]:U(b,k,d,0,d[0])}this.store[a]=k||b}}return this};u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)};
b,c,Ea))})})}if(!h)return[];if(e&&(!n||!this.store))return f[0];l=0;for(m=void 0;l<g.length;l++){m=f[l];m.length&&n&&(m=Ba.call(this,m));if(e)return m;f[l]={field:g[l],result:m}}return f};function Aa(a,b,c,d){var f=this.h[a],g=f&&f.length-c;if(g&&0<g){if(g>b||c)f=f.slice(c,c+b);d&&(f=Ba.call(this,f));return{tag:a,result:f}}}function Ba(a){for(var b=Array(a.length),c=0,d;c<a.length;c++)d=a[c],b[c]={key:d,doc:this.store[d]};return b}u.contain=function(a){return!!this.register[a]};u.get=function(a){return this.store[a]}; u.remove=function(a){E(a)&&(a=a[this.key]);if(this.register[a]){for(var b=0;b<this.h.length&&(this.m[this.h[b]].remove(a,!0),!this.A||this.s);b++);if(this.I&&(!this.A||this.s))for(var c in this.l){b=this.l[c];var d=b.indexOf(a);-1!==d&&(1<b.length?b.splice(d,1):delete this.l[c])}this.store&&!this.G&&delete this.store[a];delete this.register[a]}return this};
u.set=function(a,b){this.store[a]=b;return this};u.searchCache=ra;u.export=function(a,b,c,d,f){f||(f=0);d||(d=0);if(d<this.g.length){var g=this.g[d],e=this.i[g];b=this;setTimeout(function(){e.export(a,b,f?g.replace(":","-"):"",d,f++)||(d++,f=1,b.export(a,b,g,d,f))})}else{switch(f){case 1:c="tag";var h=this.h;break;case 2:c="store";h=this.store;break;default:return}ta(a,this,c,d,f,h)}}; u.search=function(a,b,c,d){E(a)?(c=a,a=c.query):E(b)&&(c=b,b=0);var f=[],g=[],e,h=0;if(c)if(c.constructor===Array){var k=c;c=null}else{k=(e=c.pluck)||c.field||c.doc;var l=c.tag;var n=this.store&&c.enrich;var q="and"===c.bool;b=c.limit||100;var m=c.offset||0;if(k)if(D(k))k=[k];else if(k.constructor!==Array){var p=k;k=Object.keys(k)}if(l&&(D(l)&&(l=[l]),!a)){g=0;for(e=void 0;g<l.length;g++)if(e=Fa.call(this,l[g],b,m,n))f[f.length]=e,h++;return h?f:[]}}k||(k=this.h);q=q&&(1<k.length||l&&1<l.length);
u.import=function(a,b){if(b)switch(H(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.m=!1;this.register=b;a=0;for(var c;a<this.g.length;a++)c=this.i[this.g[a]],c.register=b,c.m=!1;break;case "store":this.store=b;break;default:a=a.split("."),c=a[0],a=a[1],c&&a&&this.i[c].import(a,b)}};na(S.prototype);var X=self,Y,Z={Index:N,Document:S,Worker:Q,registerCharset:function(a,b){la[a]=b},registerLanguage:function(a,b){ka[a]=b}};(Y=X.define)&&Y.amd?Y([],function(){return Z}):X.exports?X.exports=Z:X.FlexSearch=Z;}(this)); for(var r=!d&&(this.s||this.async)&&[],t=0,y=void 0,x=void 0,A=void 0;t<k.length;t++)if(A=void 0,x=k[t],D(x)?p&&(A=p[x]):(A=x,x=x.field),r)r[t]=this.m[x].searchAsync(a,b,A||c);else{d?y=d[t]:y=this.m[x].search(a,b,A||c);A=y.length;if(l&&A){var L=[],ta=0;q&&(L[0]=[y]);var X=0,F=void 0;for(F=void 0;X<l.length;X++)if(F=l[X],A=(F=this.l[F])&&F.length)ta++,L[L.length]=q?[F]:F;ta&&(y=q?ua(L,b||100,m||0):va(y,L),A=y.length)}if(A)g[h]=x,f[h++]=y;else if(q)return[]}if(r){var La=this;return new Promise(function(Ma){Promise.all(r).then(function(Na){Ma(La.search(a,
b,c,Na))})})}if(!h)return[];if(e&&(!n||!this.store))return f[0];l=0;for(m=void 0;l<g.length;l++){m=f[l];m.length&&n&&(m=Ga.call(this,m));if(e)return m;f[l]={field:g[l],result:m}}return f};function Fa(a,b,c,d){var f=this.l[a],g=f&&f.length-c;if(g&&0<g){if(g>b||c)f=f.slice(c,c+b);d&&(f=Ga.call(this,f));return{tag:a,result:f}}}function Ga(a){for(var b=Array(a.length),c=0,d;c<a.length;c++)d=a[c],b[c]={key:d,doc:this.store[d]};return b}u.contain=function(a){return!!this.register[a]};u.get=function(a){return this.store[a]};
u.set=function(a,b){this.store[a]=b;return this};u.searchCache=wa;u.export=function(a,b,c,d,f){f||(f=0);d||(d=0);if(d<this.h.length){var g=this.h[d],e=this.m[g];b=this;setTimeout(function(){e.export(a,b,f?g.replace(":","-"):"",d,f++)||(d++,f=1,b.export(a,b,g,d,f))})}else{switch(f){case 1:c="tag";var h=this.l;break;case 2:c="store";h=this.store;break;default:return}ya(a,this,c,d,f,h)}};
u.import=function(a,b){if(b)switch(D(b)&&(b=JSON.parse(b)),a){case "tag":this.l=b;break;case "reg":this.A=!1;this.register=b;a=0;for(var c;a<this.h.length;a++)c=this.m[this.h[a]],c.register=b,c.A=!1;break;case "store":this.store=b;break;default:a=a.split("."),c=a[0],a=a[1],c&&a&&this.m[c].import(a,b)}};sa(S.prototype);var Ha=/[\W_]+/,Ia=[H("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",H("[\u00e8\u00e9\u00ea\u00eb]"),"e",H("[\u00ec\u00ed\u00ee\u00ef]"),"i",H("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",H("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",H("[\u00fd\u0177\u00ff]"),"y",H("\u00f1"),"n",H("[\u00e7c]"),"k",H("\u00df"),"s",H(" & ")," and "];function Ja(a){return pa(this,ka(a).toLowerCase(),!a.normalize&&Ia,Ha)};var Oa={encode:Ka,H:!1,L:"strict"},Pa=/[^a-z0-9]+/,Qa={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function Ka(a){a=Ja.call(this,a).join(" ");var b=[];if(a)for(var c=a.split(Pa),d=c.length,f=0,g,e=0;f<d;f++)if((a=c[f])&&(!this.filter||!this.filter[a])){g=a[0];for(var h=Qa[g]||g,k=h,l=1;l<a.length;l++)g=a[l],(g=Qa[g]||g)&&g!==k&&(h+=g,k=g);b[e++]=h}return b};var Sa={encode:Ra,H:!1,L:""},Ta=[H("ae"),"a",H("oe"),"o",H("sh"),"s",H("th"),"t",H("ph"),"f",H("pf"),"f"];function Ra(a,b){a&&(a=Ka.call(this,a).join(" "),2<a.length&&(a=I(a,Ta)),b||(1<a.length&&(a=ma(a)),a&&(a=a.split(" "))));return a};var Va={encode:Ua,H:!1,L:""},Wa=H("(?!\\b)[aeiouy]");function Ua(a){a&&(a=Ra.call(this,a,!0),1<a.length&&(a=a.replace(Wa,"")),1<a.length&&(a=ma(a)),a&&(a=a.split(" ")));return a};J["latin:simple"]={encode:Ja,H:!1,L:""};J["latin:balance"]=Oa;J["latin:advanced"]=Sa;J["latin:extra"]=Va;var W=self,Y,Z={Index:N,Document:S,Worker:Q,registerCharset:function(a,b){J[a]=b},registerLanguage:function(a,b){qa[a]=b}};(Y=W.define)&&Y.amd?Y([],function(){return Z}):W.exports?W.exports=Z:W.FlexSearch=Z;}(this));

View File

@@ -5,14 +5,15 @@
* Licence: Apache-2.0 * Licence: Apache-2.0
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict';const u=/[\W_]+/;function v(a){if(a=a.toLowerCase())if(a&&this.o&&(a=y(a,this.o)),this.A&&1<a.length&&(a=y(a,this.A)),a&&(u||""===u)&&(a=a.split(u),this.filter)){var b=this.filter;const c=a.length,d=[];for(let e=0,g=0;e<c;e++){const f=a[e];f&&!b[f]&&(d[g++]=f)}a=d}return a};function z(a,b){return"undefined"!==typeof a?a:b}function A(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}function C(a,b){return b.length-a.length};function D(a,b){const c=Object.keys(a),d=c.length,e=[];let g="",f=0;for(let h=0,l,k;h<d;h++)l=c[h],(k=a[l])?(e[f++]=new RegExp(b?"(?!\\b)"+l+"(\\b|_)":l,"g"),e[f++]=k):g+=(g?"|":"")+l;g&&(e[f++]=new RegExp(b?"(?!\\b)("+g+")(\\b|_)":"("+g+")","g"),e[f]="");return e}function y(a,b){for(let c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a};const E={},F={};function G(a,b,c,d){var e=a.length;let g=[],f,h=0;d&&(d=[]);for(--e;0<=e;e--){const l=a[e],k=l.length,n=B();let r=!f;for(let q=0;q<k;q++){const t=l[q],m=t.length;if(m)for(let p=0,x=0,w;p<m;p++)if(w=t[p],!f)n[w]=1;else if(f[w]){if(e)d&&x<b&&((d[q]||(d[q]=[]))[x++]=w),n[w]=1;else if(c)c--;else if(g[h++]=w,h===b)return g;r=!0}}if(!r&&!d)return[];f=n}if(d)for(let l=d.length-1,k,n;0<=l;l--)if((n=(k=d[l])&&k.length)&&c&&(n<=c?(c-=n,n=0):n-=c),n){if(h+n>=b)return g.concat(k.slice(c,b-h+c));g=g.concat(c? (function(self){'use strict';function u(a,b){return"undefined"!==typeof a?a:b}function v(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=y();return b}function y(){return Object.create(null)}function z(a,b){return b.length-a.length};const A=/[\u0300-\u036f]/g;function B(a,b){const c=Object.keys(a),d=c.length,e=[];let g="",f=0;for(let h=0,l,k;h<d;h++)l=c[h],(k=a[l])?(e[f++]=new RegExp(b?"(?!\\b)"+l+"(\\b|_)":l,"g"),e[f++]=k):g+=(g?"|":"")+l;g&&(e[f++]=new RegExp(b?"(?!\\b)("+g+")(\\b|_)":"("+g+")","g"),e[f]="");return e}function C(a,b){for(let c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a};const D=/[\W_]+/;function E(a){a.normalize&&(a=a.normalize("NFD").replace(A,""));if(a=a.toLowerCase())if(this.o&&(a=C(a,this.o)),this.A&&1<a.length&&(a=C(a,this.A)),D||""===D)if(a=a.split(D),this.filter){var b=this.filter;const c=a.length,d=[];for(let e=0,g=0;e<c;e++){const f=a[e];f&&!b[f]&&(d[g++]=f)}a=d}return a};const F={},G={};function H(a,b,c,d){var e=a.length;let g=[],f,h=0;d&&(d=[]);for(--e;0<=e;e--){const l=a[e],k=l.length,n=y();let r=!f;for(let q=0;q<k;q++){const t=l[q],m=t.length;if(m)for(let p=0,x=0,w;p<m;p++)if(w=t[p],!f)n[w]=1;else if(f[w]){if(e)d&&x<b&&((d[q]||(d[q]=[]))[x++]=w),n[w]=1;else if(c)c--;else if(g[h++]=w,h===b)return g;r=!0}}if(!r&&!d)return[];f=n}if(d)for(let l=d.length-1,k,n;0<=l;l--)if((n=(k=d[l])&&k.length)&&c&&(n<=c?(c-=n,n=0):n-=c),n){if(h+n>=b)return g.concat(k.slice(c,b-h+c));g=g.concat(c?
k.slice(c):k);h+=n;c=0}return g};function H(a,b){if(!(this instanceof H))return new H(a);let c;if(a){var d=a.charset;c=a.lang;"string"===typeof d&&(-1===d.indexOf(":")&&(d+=":default"),d=F[d]);"string"===typeof c&&(c=E[c])}else a={};let e,g,f,h=a.context||{};this.encode=a.encode||d&&d.encode||v;this.register=b||B();e=a.resolution||9;g=a.threshold||0;g>=e&&(g=e-1);this.i=e;this.s=g;this.F=b=d&&d.G||a.tokenize||"strict";this.m="strict"===b&&h.depth;this.v=z(h.bidirectional,!0);this.g=f="memory"===a.optimize;this.C=z(a.fastupdate,!0); k.slice(c):k);h+=n;c=0}return g};G["latin:default"]=E;
this.h=a.minlength||1;this.j=f?A(e-g):B();e=h.resolution||e;g=h.threshold||g;g>=e&&(g=e-1);this.l=e;this.D=g;this.B=f?A(e-g):B();this.u=d&&d.u||a.rtl;this.o=(b=a.matcher||c&&c.o)&&D(b,!1);this.A=(b=a.stemmer||c&&c.A)&&D(b,!0);if(a=b=a.filter||c&&c.filter){a=b;d=B();for(let l=0,k=a.length;l<k;l++)d[a[l]]=1;a=d}this.filter=a}H.prototype.append=function(a,b){return this.add(a,b,!0)}; function I(a,b){if(!(this instanceof I))return new I(a);let c;if(a){var d=a.charset;c=a.lang;"string"===typeof d&&(-1===d.indexOf(":")&&(d+=":default"),d=G[d]);"string"===typeof c&&(c=F[c])}else a={};let e,g,f,h=a.context||{};this.encode=a.encode||d&&d.encode||E;this.register=b||y();e=a.resolution||9;g=a.threshold||0;g>=e&&(g=e-1);this.i=e;this.s=g;this.F=b=d&&d.G||a.tokenize||"strict";this.m="strict"===b&&h.depth;this.v=u(h.bidirectional,!0);this.g=f="memory"===a.optimize;this.C=u(a.fastupdate,!0);
H.prototype.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);const k=b.length;if(k){const n=this.m,r=this.i-this.s,q=B(),t=B();for(let m=0;m<k;m++){let p=b[this.u?k-1-m:m];var d=p.length;if(p&&d>=this.h&&(n||!q[p])){var e=Math.min(this.i/k*m|0,m);if(e<r){var g="";switch(this.F){case "full":if(3<d){for(var f=0;f<d;f++){var h=f?Math.min(e/2+this.i/d*f/2|0,e+f):e;if(h<r)for(var l=d;l>f;l--)g=p.substring(f,l),g.length>=this.h&&I(this,q,g,h,a,c)}break}case "reverse":if(2< this.h=a.minlength||1;this.j=f?v(e-g):y();e=h.resolution||e;g=h.threshold||g;g>=e&&(g=e-1);this.l=e;this.D=g;this.B=f?v(e-g):y();this.u=d&&d.u||a.rtl;this.o=(b=a.matcher||c&&c.o)&&B(b,!1);this.A=(b=a.stemmer||c&&c.A)&&B(b,!0);if(a=b=a.filter||c&&c.filter){a=b;d=y();for(let l=0,k=a.length;l<k;l++)d[a[l]]=1;a=d}this.filter=a}I.prototype.append=function(a,b){return this.add(a,b,!0)};
d){for(f=d-1;0<f;f--)g=p[f]+g,g.length>=this.h&&I(this,q,g,e,a,c);g=""}case "forward":if(1<d)for(f=0;f<d;f++)g+=p[f],g.length>=this.h&&I(this,q,g,e,a,c);break;default:if(I(this,q,p,e,a,c),n&&1<k&&m<k-1)for(d=this.l-this.D,e=B(),g=p,f=Math.min(n+1,k-m),e[g]=1,h=1;h<f;h++)if((p=b[this.u?k-1-m-h:m+h])&&p.length>=this.h&&!e[p]){if(e[p]=1,l=Math.min((this.l-f)/k*m+h|0,m+(h-1)),l<d){const x=this.v&&p>g;I(this,t,x?g:p,l,a,c,x?p:g)}}else f=Math.min(f+1,k-m)}}}}this.C||(this.register[a]=1)}}return this}; I.prototype.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);const k=b.length;if(k){const n=this.m,r=this.i-this.s,q=y(),t=y();for(let m=0;m<k;m++){let p=b[this.u?k-1-m:m];var d=p.length;if(p&&d>=this.h&&(n||!q[p])){var e=Math.min(this.i/k*m|0,m);if(e<r){var g="";switch(this.F){case "full":if(3<d){for(var f=0;f<d;f++){var h=f?Math.min(e/2+this.i/d*f/2|0,e+f):e;if(h<r)for(var l=d;l>f;l--)g=p.substring(f,l),g.length>=this.h&&J(this,q,g,h,a,c)}break}case "reverse":if(2<
function I(a,b,c,d,e,g,f){let h=f?a.B:a.j;if(!b[c]||f&&!b[c][f])a.g&&(h=h[d]),f?(b=b[c]||(b[c]=B()),b[f]=1,h=h[f]||(h[f]=B())):b[c]=1,h=h[c]||(h[c]=[]),a.g||(h=h[d]||(h[d]=[])),g&&-1!==h.indexOf(e)||(h[h.length]=e,a.C&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} d){for(f=d-1;0<f;f--)g=p[f]+g,g.length>=this.h&&J(this,q,g,e,a,c);g=""}case "forward":if(1<d)for(f=0;f<d;f++)g+=p[f],g.length>=this.h&&J(this,q,g,e,a,c);break;default:if(J(this,q,p,e,a,c),n&&1<k&&m<k-1)for(d=this.l-this.D,e=y(),g=p,f=Math.min(n+1,k-m),e[g]=1,h=1;h<f;h++)if((p=b[this.u?k-1-m-h:m+h])&&p.length>=this.h&&!e[p]){if(e[p]=1,l=Math.min((this.l-f)/k*m+h|0,m+(h-1)),l<d){const x=this.v&&p>g;J(this,t,x?g:p,l,a,c,x?p:g)}}else f=Math.min(f+1,k-m)}}}}this.C||(this.register[a]=1)}}return this};
H.prototype.search=function(a,b,c){"object"===typeof a?(c=a,a=c.query):"object"===typeof b&&(c=b);let d=[],e;var g=this.s;let f,h=0;if(c){b=c.limit;h=c.offset||0;g=z(c.threshold,g);var l=c.context;f=!1}if(a&&(a=this.encode(a),e=a.length,1<e)){c=B();var k=[];for(let r=0,q=0,t;r<e;r++)if((t=a[r])&&t.length>=this.h&&!c[t])if(this.g||f||this.j[t])k[q++]=t,c[t]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);c=this.i-g;g=this.l-g;l=this.m&&1<e&&!1!==l;k=0;let n;l?(n=a[0],k=1):1<e&&a.sort(C);for(let r, function J(a,b,c,d,e,g,f){let h=f?a.B:a.j;if(!b[c]||f&&!b[c][f])a.g&&(h=h[d]),f?(b=b[c]||(b[c]=y()),b[f]=1,h=h[f]||(h[f]=y())):b[c]=1,h=h[c]||(h[c]=[]),a.g||(h=h[d]||(h[d]=[])),g&&-1!==h.indexOf(e)||(h[h.length]=e,a.C&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))}
q;k<e;k++){q=a[k];l?(r=J(this,d,f,g,b,h,2===e,q,n),f&&!1===r&&d.length||(n=q)):r=J(this,d,f,c,b,h,1===e,q);if(r)return r;if(f&&k===e-1){let t=d.length;if(!t){if(l){l=0;k=-1;continue}return d}if(1===t)return K(d[0],b,h)}}return G(d,b,h,f)}; I.prototype.search=function(a,b,c){"object"===typeof a?(c=a,a=c.query):"object"===typeof b&&(c=b);let d=[],e;var g=this.s;let f,h=0;if(c){b=c.limit;h=c.offset||0;g=u(c.threshold,g);var l=c.context;f=!1}if(a&&(a=this.encode(a),e=a.length,1<e)){c=y();var k=[];for(let r=0,q=0,t;r<e;r++)if((t=a[r])&&t.length>=this.h&&!c[t])if(this.g||f||this.j[t])k[q++]=t,c[t]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);c=this.i-g;g=this.l-g;l=this.m&&1<e&&!1!==l;k=0;let n;l?(n=a[0],k=1):1<e&&a.sort(z);for(let r,
function J(a,b,c,d,e,g,f,h,l){let k=[],n=l?a.B:a.j;a.g||(n=L(n,h,l,a.v));if(n){let r=0;d=Math.min(n.length,d);for(let q=0,t=0,m,p;q<d&&!(m=n[q],a.g&&(m=L(m,h,l,a.v)),m&&f&&(p=m.length,p<=g?(g-=p,m=null):g&&(m=m.slice(g),g=0)),m&&(k[r++]=m,f&&(t+=m.length,t>=e)));q++);if(r){if(f)return K(k,e,0);b[b.length]=k;return}}return!c&&k}function K(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} q;k<e;k++){q=a[k];l?(r=K(this,d,f,g,b,h,2===e,q,n),f&&!1===r&&d.length||(n=q)):r=K(this,d,f,c,b,h,1===e,q);if(r)return r;if(f&&k===e-1){let t=d.length;if(!t){if(l){l=0;k=-1;continue}return d}if(1===t)return L(d[0],b,h)}}return H(d,b,h,f)};
function L(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}H.prototype.contain=function(a){return!!this.register[a]};H.prototype.update=function(a,b){return this.remove(a).add(a,b)};H.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.C)for(let d=0,e;d<c.length;d++)e=c[d],e.splice(e.indexOf(a),1);else M(this.j,a,this.i-this.s,this.g),this.m&&M(this.B,a,this.l-this.D,this.g);b||delete this.register[a]}return this}; function K(a,b,c,d,e,g,f,h,l){let k=[],n=l?a.B:a.j;a.g||(n=M(n,h,l,a.v));if(n){let r=0;d=Math.min(n.length,d);for(let q=0,t=0,m,p;q<d&&!(m=n[q],a.g&&(m=M(m,h,l,a.v)),m&&f&&(p=m.length,p<=g?(g-=p,m=null):g&&(m=m.slice(g),g=0)),m&&(k[r++]=m,f&&(t+=m.length,t>=e)));q++);if(r){if(f)return L(k,e,0);b[b.length]=k;return}}return!c&&k}function L(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a}
function M(a,b,c,d,e){let g=0;if(a.constructor===Array)if(e)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),g++):g++;else{e=Math.min(a.length,c);for(let f=0,h;f<e;f++)if(h=a[f])g=M(h,b,c,d,e),d||g||delete a[f]}else for(let f in a)(g=M(a[f],b,c,d,e))||delete a[f];return g};const N=self;let O;const P={Index:H,Document:null,Worker:null,registerCharset:function(a,b){F[a]=b},registerLanguage:function(a,b){E[a]=b}};(O=N.define)&&O.amd?O([],function(){return P}):N.exports?N.exports=P:N.FlexSearch=P;}(this)); function M(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}I.prototype.contain=function(a){return!!this.register[a]};I.prototype.update=function(a,b){return this.remove(a).add(a,b)};I.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.C)for(let d=0,e;d<c.length;d++)e=c[d],e.splice(e.indexOf(a),1);else N(this.j,a,this.i-this.s,this.g),this.m&&N(this.B,a,this.l-this.D,this.g);b||delete this.register[a]}return this};
function N(a,b,c,d,e){let g=0;if(a.constructor===Array)if(e)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),g++):g++;else{e=Math.min(a.length,c);for(let f=0,h;f<e;f++)if(h=a[f])g=N(h,b,c,d,e),d||g||delete a[f]}else for(let f in a)(g=N(a[f],b,c,d,e))||delete a[f];return g};const O=self;let P;const Q={Index:I,Document:null,Worker:null,registerCharset:function(a,b){G[a]=b},registerLanguage:function(a,b){F[a]=b}};(P=O.define)&&P.amd?P([],function(){return Q}):O.exports?O.exports=Q:O.FlexSearch=Q;}(this));

1
dist/lang/arabic/default.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function(self){'use strict';const a=/[\x00-\x7F]+/g;self.FlexSearch.registerCharset("arabic:default",{encode:function(b){return this.g(b.replace(a," "),!1," ",!1)},h:!0});}(this));

2
dist/lang/at.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(function(self){'use strict';self.FlexSearch.registerLanguage("at",{filter:"aber als am an auch auf aus bei bin bis bist da dadurch daher darum das da\u00df dass dein deine dem den der des dessen deshalb die dies dieser dieses doch dort du durch ein eine einem einen einer eines er es euer eure f\u00fcr hatte hatten hattest hattet hier hinter ich ihr ihre im in ist ja jede jedem jeden jeder jedes jener jenes jetzt kann kannst k\u00f6nnen k\u00f6nnt machen mein meine mit mu\u00df mu\u00dft musst m\u00fcssen m\u00fc\u00dft nach nachdem nein nicht nun oder seid sein seine sich sie sind soll sollen sollst sollt sonst soweit sowie und unser unsere unter vom von vor wann warum was weiter weitere wenn wer werde werden werdet weshalb wie wieder wieso wir wird wirst wo woher wohin zu zum zur \u00fcber".split(" "),
h:{niss:"",isch:"",lich:"",heit:"",keit:"",end:"",ung:"",est:"",ern:"",em:"",er:"",en:"",es:"",st:"",ig:"",ik:"",e:"",s:""},g:{}});}(this));

1
dist/lang/cjk/default.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function(self){'use strict';const a=/[\x00-\x7F]+/g;self.FlexSearch.registerCharset("cjk:default",{encode:function(b){return this.g(b.replace(a,""),!1,"",!1)},h:!1,i:"strict"});}(this));

1
dist/lang/cyrillic/default.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function(self){'use strict';const a=/[\x00-\x7F]+/g;self.FlexSearch.registerCharset("cyrillic:default",{encode:function(b){return this.g(b.replace(a," "),!1," ",!1)},h:!1});}(this));

2
dist/lang/de.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(function(self){'use strict';self.FlexSearch.registerLanguage("de",{filter:"aber als am an auch auf aus bei bin bis bist da dadurch daher darum das da\u00df dass dein deine dem den der des dessen deshalb die dies dieser dieses doch dort du durch ein eine einem einen einer eines er es euer eure f\u00fcr hatte hatten hattest hattet hier hinter ich ihr ihre im in ist ja jede jedem jeden jeder jedes jener jenes jetzt kann kannst k\u00f6nnen k\u00f6nnt machen mein meine mit mu\u00df mu\u00dft musst m\u00fcssen m\u00fc\u00dft nach nachdem nein nicht nun oder seid sein seine sich sie sind soll sollen sollst sollt sonst soweit sowie und unser unsere unter vom von vor wann warum was weiter weitere wenn wer werde werden werdet weshalb wie wieder wieso wir wird wirst wo woher wohin zu zum zur \u00fcber".split(" "),
h:{niss:"",isch:"",lich:"",heit:"",keit:"",ell:"",bar:"",end:"",ung:"",est:"",ern:"",em:"",er:"",en:"",es:"",st:"",ig:"",ik:"",e:"",s:""},g:{}});}(this));

2
dist/lang/en.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(function(self){'use strict';self.FlexSearch.registerLanguage("en",{filter:"a about above after again against all also am an and any are aren't as at be because been before being below both but by can cannot can't come could couldn't did didn't do does doesn't doing dont down during each even few first for from further get go had hadn't has hasn't have haven't having he hed her here here's hers herself hes him himself his how how's i id if ill im in into is isn't it it's itself i've just know let's like make me more most mustn't my myself new no nor not now of off on once only or other ought our our's ourselves out over own same say see shan't she she'd shell shes should shouldn't so some such than that that's the their theirs them themselves then there there's these they they'd they'll they're they've this those through time to too until up us very want was wasn't way we wed well were weren't we've what what's when when's where where's which while who whom who's why why's will with won't would wouldn't you you'd you'll your you're your's yourself yourselves you've".split(" "),
h:{ational:"ate",iveness:"ive",fulness:"ful",ousness:"ous",ization:"ize",tional:"tion",biliti:"ble",icate:"ic",ative:"",alize:"al",iciti:"ic",entli:"ent",ousli:"ous",alism:"al",ation:"ate",aliti:"al",iviti:"ive",ement:"",enci:"ence",anci:"ance",izer:"ize",alli:"al",ator:"ate",logi:"log",ical:"ic",ance:"",ence:"",ness:"",able:"",ible:"",ment:"",eli:"e",bli:"ble",ful:"",ant:"",ent:"",ism:"",ate:"",iti:"",ous:"",ive:"",ize:"",al:"",ou:"",er:"",ic:""},g:{}});}(this));

2
dist/lang/latin/advanced.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(function(self){'use strict';const b=/[\u0300-\u036f]/g;function l(a){return new RegExp(a,"g")};const p=/[\W_]+/,r=[l("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",l("[\u00e8\u00e9\u00ea\u00eb]"),"e",l("[\u00ec\u00ed\u00ee\u00ef]"),"i",l("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",l("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",l("[\u00fd\u0177\u00ff]"),"y",l("\u00f1"),"n",l("[\u00e7c]"),"k",l("\u00df"),"s",l(" & ")," and "];const t=/[^a-z0-9]+/,u={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};const v=[l("ae"),"a",l("oe"),"o",l("sh"),"s",l("th"),"t",l("ph"),"f",l("pf"),"f"];self.FlexSearch.registerCharset("latin:advanced",{encode:function(a,h){if(a){var e=this.h,f=a;f.normalize&&(f=f.normalize("NFD").replace(b,""));a=e.call(this,f.toLowerCase(),!a.normalize&&r,p,!1).join(" ");e=[];if(a){f=a.split(t);const c=f.length;for(let g=0,d,w=0;g<c;g++)if((a=f[g])&&(!this.filter||!this.filter[a])){d=a[0];let m=u[d]||d,q=m;for(let n=1;n<a.length;n++){d=a[n];const k=u[d]||d;k&&k!==q&&(m+=k,q=k)}e[w++]=m}}a=e.join(" ");if(2<a.length)for(let c=0,g=v.length;c<g&&(a=a.replace(v[c],v[c+
1]),a);c+=2);if(!h){if(1<a.length){e=h="";for(let c=0,g=a.length,d;c<g;c++)(d=a[c])!==e&&(h+=e=d);a=h}a&&(a=a.split(" "))}}return a},l:!1,m:""});}(this));

1
dist/lang/latin/balance.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function(self){'use strict';const b=/[\u0300-\u036f]/g;function l(a){return new RegExp(a,"g")};const n=/[\W_]+/,p=[l("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",l("[\u00e8\u00e9\u00ea\u00eb]"),"e",l("[\u00ec\u00ed\u00ee\u00ef]"),"i",l("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",l("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",l("[\u00fd\u0177\u00ff]"),"y",l("\u00f1"),"n",l("[\u00e7c]"),"k",l("\u00df"),"s",l(" & ")," and "];const q=/[^a-z0-9]+/,r={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};self.FlexSearch.registerCharset("latin:balance",{encode:function(a){var e=this.h,c=a;c.normalize&&(c=c.normalize("NFD").replace(b,""));a=e.call(this,c.toLowerCase(),!a.normalize&&p,n,!1).join(" ");e=[];if(a){c=a.split(q);const t=c.length;for(let g=0,d,u=0;g<t;g++)if((a=c[g])&&(!this.filter||!this.filter[a])){d=a[0];let h=r[d]||d,m=h;for(let k=1;k<a.length;k++){d=a[k];const f=r[d]||d;f&&f!==m&&(h+=f,m=f)}e[u++]=h}}return e},l:!1,m:"strict"});}(this));

1
dist/lang/latin/default.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function(self){'use strict';const b=/[\u0300-\u036f]/g;const c=/[\W_]+/;self.FlexSearch.registerCharset("latin:default",{encode:function(a){var d=this.g;a.normalize&&(a=a.normalize("NFD").replace(b,""));return d.call(this,a.toLowerCase(),!1,c,!1)},h:!1,i:""});}(this));

2
dist/lang/latin/extra.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(function(self){'use strict';const b=/[\u0300-\u036f]/g;function k(a){return new RegExp(a,"g")};const n=/[\W_]+/,q=[k("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",k("[\u00e8\u00e9\u00ea\u00eb]"),"e",k("[\u00ec\u00ed\u00ee\u00ef]"),"i",k("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",k("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",k("[\u00fd\u0177\u00ff]"),"y",k("\u00f1"),"n",k("[\u00e7c]"),"k",k("\u00df"),"s",k(" & ")," and "];const r=/[^a-z0-9]+/,t={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};const u=[k("ae"),"a",k("oe"),"o",k("sh"),"s",k("th"),"t",k("ph"),"f",k("pf"),"f"];const v=k("(?!\\b)[aeiouy]");self.FlexSearch.registerCharset("latin:extra",{encode:function(a){if(a){if(a){var f=this.h,c=a;c.normalize&&(c=c.normalize("NFD").replace(b,""));a=f.call(this,c.toLowerCase(),!a.normalize&&q,n,!1).join(" ");f=[];if(a){c=a.split(r);const d=c.length;for(let g=0,e,w=0;g<d;g++)if((a=c[g])&&(!this.filter||!this.filter[a])){e=a[0];let l=t[e]||e,p=l;for(let m=1;m<a.length;m++){e=a[m];const h=t[e]||e;h&&h!==p&&(l+=h,p=h)}f[w++]=l}}a=f.join(" ");if(2<a.length)for(let d=0,g=u.length;d<g&&(a=a.replace(u[d],
u[d+1]),a);d+=2);}1<a.length&&(a=a.replace(v,""));if(1<a.length){c=f="";for(let d=0,g=a.length,e;d<g;d++)(e=a[d])!==c&&(f+=c=e);a=f}a&&(a=a.split(" "))}return a},l:!1,m:""});}(this));

1
dist/lang/latin/simple.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function(self){'use strict';const a=/[\u0300-\u036f]/g;function d(b){return new RegExp(b,"g")};const e=/[\W_]+/,f=[d("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",d("[\u00e8\u00e9\u00ea\u00eb]"),"e",d("[\u00ec\u00ed\u00ee\u00ef]"),"i",d("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",d("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",d("[\u00fd\u0177\u00ff]"),"y",d("\u00f1"),"n",d("[\u00e7c]"),"k",d("\u00df"),"s",d(" & ")," and "];self.FlexSearch.registerCharset("latin:simple",{encode:function(b){var g=this.g,c=b;c.normalize&&(c=c.normalize("NFD").replace(a,""));return g.call(this,c.toLowerCase(),!b.normalize&&f,e,!1)},h:!1,i:""});}(this));

2
dist/lang/us.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(function(self){'use strict';self.FlexSearch.registerLanguage("us",{filter:"a about above after again against all also am an and any are aren't as at be because been before being below both but by can cannot can't come could couldn't did didn't do does doesn't doing dont down during each even few first for from further get go had hadn't has hasn't have haven't having he hed her here here's hers herself hes him himself his how how's i id if ill im in into is isn't it it's itself i've just know let's like make me more most mustn't my myself new no nor not now of off on once only or other ought our our's ourselves out over own same say see shan't she she'd shell shes should shouldn't so some such than that that's the their theirs them themselves then there there's these they they'd they'll they're they've this those through time to too until up us very want was wasn't way we wed well were weren't we've what what's when when's where where's which while who whom who's why why's will with won't would wouldn't you you'd you'll your you're your's yourself yourselves you've".split(" "),
h:{ational:"ate",iveness:"ive",fulness:"ful",ousness:"ous",ization:"ize",tional:"tion",biliti:"ble",icate:"ic",ative:"",alize:"al",iciti:"ic",entli:"ent",ousli:"ous",alism:"al",ation:"ate",aliti:"al",iviti:"ive",ement:"",enci:"ence",anci:"ance",izer:"ize",alli:"al",ator:"ate",logi:"log",ical:"ic",ance:"",ence:"",ness:"",able:"",ible:"",ment:"",eli:"e",bli:"ble",ful:"",ant:"",ent:"",ism:"",ate:"",iti:"",ous:"",ive:"",ize:"",al:"",ou:"",er:"",ic:""},g:{}});}(this));

View File

@@ -11,7 +11,10 @@
"elastic search", "elastic search",
"fastest search", "fastest search",
"contextual search", "contextual search",
"fuzzy search" "document search",
"fuzzy search",
"fuzzy match",
"search engine"
], ],
"bugs": { "bugs": {
"url": "https://github.com/nextapps-de/flexsearch/issues", "url": "https://github.com/nextapps-de/flexsearch/issues",
@@ -28,16 +31,16 @@
"copy": "npm run clean && cpx \"src/**\" tmp/", "copy": "npm run clean && cpx \"src/**\" tmp/",
"clean": "if exist tmp rmdir tmp /s /q && mkdir tmp", "clean": "if exist tmp rmdir tmp /s /q && mkdir tmp",
"build": "npm run copy && npm run build:bundle", "build": "npm run copy && npm run build:bundle",
"build:bundle": "cpx src/config/bundle/config.js tmp/ && node task/build RELEASE=bundle", "build:bundle": "node task/build RELEASE=bundle",
"build:debug": "cpx src/config/debug/config.js tmp/ && node task/build RELEASE=debug COMPILATION_LEVEL=SIMPLE FORMATTING=PRETTY_PRINT", "build:debug": "node task/build RELEASE=debug COMPILATION_LEVEL=SIMPLE FORMATTING=PRETTY_PRINT",
"build:compact": "cpx src/config/compact/config.js tmp/ && node task/build RELEASE=compact", "build:compact": "node task/build RELEASE=compact",
"build:light": "cpx src/config/light/config.js tmp/ && node task/build RELEASE=light", "build:light": "node task/build RELEASE=light",
"build:custom": "cpx src/config/custom/config.js tmp/ && node task/build RELEASE=custom", "build:custom": "node task/build RELEASE=custom",
"build:es5": "cpx src/config/bundle/config.js tmp/ && node task/build RELEASE=es5 LANGUAGE_OUT=ECMASCRIPT5_STRICT POLYFILL=true", "build:es5": "node task/build RELEASE=es5 LANGUAGE_OUT=ECMASCRIPT5_STRICT POLYFILL=true",
"build:pre": "cpx src/config/bundle/config.js tmp/ && node task/build RELEASE=pre COMPILATION_LEVEL=WHITESPACE FORMATTING=PRETTY_PRINT", "build:pre": "node task/build RELEASE=pre COMPILATION_LEVEL=WHITESPACE FORMATTING=PRETTY_PRINT",
"build:lang": "node task/build RELEASE=lang POLYFILL=false", "build:lang": "node task/build RELEASE=lang",
"build:module": "babel src -d dist/module && exit 0", "build:module": "babel src -d dist/module && exit 0",
"build:all": "npm run build && npm run build:light && npm run build:compact && npm run build:es5 && npm run build:pre && npm run build:debug", "build:all": "npm run build && npm run build:light && npm run build:compact && npm run build:es5 && npm run build:debug",
"test": "npm run build:pre && cd test && npm install && npm run test", "test": "npm run build:pre && cd test && npm install && npm run test",
"update": "npm install google-closure-compiler@nightly" "update": "npm install google-closure-compiler@nightly"
}, },

View File

@@ -1,8 +1,5 @@
/** @define {string} */
export const RELEASE = "browser";
/** @define {boolean} */ /** @define {boolean} */
export const DEBUG = false; export const DEBUG = true;
/** @define {boolean} */ /** @define {boolean} */
export const POLYFILL = true; export const POLYFILL = true;

View File

@@ -20,13 +20,15 @@ import { IndexInterface } from "./type.js";
import { encode as default_encoder } from "./lang/latin/default.js"; import { encode as default_encoder } from "./lang/latin/default.js";
import { create_object, create_object_array, concat, sort_by_length_down, is_array, is_string, is_object, parse_option } from "./common.js"; import { create_object, create_object_array, concat, sort_by_length_down, is_array, is_string, is_object, parse_option } from "./common.js";
import { pipeline, init_stemmer_or_matcher, init_filter } from "./lang.js"; import { pipeline, init_stemmer_or_matcher, init_filter } from "./lang.js";
import { global_lang, global_charset } from "./global.js"; import { registerCharset, global_lang, global_charset } from "./global.js";
import apply_async from "./async.js"; import apply_async from "./async.js";
import { intersect } from "./intersect.js"; import { intersect } from "./intersect.js";
import Cache, { searchCache } from "./cache.js"; import Cache, { searchCache } from "./cache.js";
import apply_preset from "./preset.js"; import apply_preset from "./preset.js";
import { exportIndex, importIndex } from "./serialize.js"; import { exportIndex, importIndex } from "./serialize.js";
registerCharset("latin:default", default_encoder);
/** /**
* @constructor * @constructor
* @implements IndexInterface * @implements IndexInterface
@@ -76,6 +78,7 @@ function Index(options, _register){
let resolution, threshold, optimize, context = options["context"] || {}; let resolution, threshold, optimize, context = options["context"] || {};
/** @export */
this.encode = options["encode"] || (charset && charset.encode) || default_encoder; this.encode = options["encode"] || (charset && charset.encode) || default_encoder;
this.register = _register || create_object(); this.register = _register || create_object();

View File

@@ -1,4 +1,4 @@
import { IndexInterface, DocumentInterface } from "./type.js"; import { IndexInterface } from "./type.js";
import { create_object, get_keys } from "./common.js"; import { create_object, get_keys } from "./common.js";
/** /**
@@ -14,28 +14,26 @@ export function pipeline(str, normalize, split, _collapse){
if(str){ if(str){
if(normalize && str){ if(normalize){
str = replace(str, /** @type {Array<string|RegExp>} */ (normalize)); str = replace(str, /** @type {Array<string|RegExp>} */ (normalize));
} }
if(str && this.matcher){ if(this.matcher){
str = replace(str, this.matcher); str = replace(str, this.matcher);
} }
if(this.stemmer && str.length > 1){ if(this.stemmer && (str.length > 1)){
str = replace(str, this.stemmer); str = replace(str, this.stemmer);
} }
if(_collapse && str.length > 1){ if(_collapse && (str.length > 1)){
str = collapse(str); str = collapse(str);
} }
if(str){
if(split || (split === "")){ if(split || (split === "")){
const words = str.split(/** @type {string|RegExp} */ (split)); const words = str.split(/** @type {string|RegExp} */ (split));
@@ -43,6 +41,17 @@ export function pipeline(str, normalize, split, _collapse){
return this.filter ? filter(words, this.filter) : words; return this.filter ? filter(words, this.filter) : words;
} }
} }
return str;
}
const regex_normalize = /[\u0300-\u036f]/g;
export function normalize(str){
if(str.normalize){
str = str.normalize("NFD").replace(regex_normalize, "");
} }
return str; return str;

View File

@@ -1,3 +1,5 @@
import { IndexInterface } from "../../type.js";
export const rtl = true; export const rtl = true;
export const tokenize = ""; export const tokenize = "";
export default { export default {
@@ -7,6 +9,10 @@ export default {
const regex = /[\x00-\x7F]+/g; const regex = /[\x00-\x7F]+/g;
/**
* @this IndexInterface
*/
export function encode(str){ export function encode(str){
return this.pipeline( return this.pipeline(

View File

@@ -1,3 +1,5 @@
import { IndexInterface } from "../../type.js";
export const rtl = false; export const rtl = false;
export const tokenize = "strict"; export const tokenize = "strict";
export default { export default {
@@ -8,6 +10,10 @@ export default {
const regex = /[\x00-\x7F]+/g; const regex = /[\x00-\x7F]+/g;
/**
* @this IndexInterface
*/
export function encode(str){ export function encode(str){
return this.pipeline( return this.pipeline(

View File

@@ -1,3 +1,5 @@
import { IndexInterface } from "../../type.js";
export const rtl = false; export const rtl = false;
export const tokenize = ""; export const tokenize = "";
export default { export default {
@@ -7,6 +9,10 @@ export default {
const regex = /[\x00-\x7F]+/g; const regex = /[\x00-\x7F]+/g;
/**
* @this IndexInterface
*/
export function encode(str){ export function encode(str){
return this.pipeline( return this.pipeline(

View File

@@ -1,60 +1,66 @@
import { IndexInterface } from "../../type.js";
import { regex, replace, collapse } from "../../lang.js"; import { regex, replace, collapse } from "../../lang.js";
import { encode as encode_simple } from "./simple.js"; import { encode as encode_balance } from "./balance.js";
export const rtl = false; export const rtl = false;
export const tokenize = ""; export const tokenize = "";
export default { export default {
encode: encode, encode: encode,
rtl: rtl rtl: rtl,
tokenize: tokenize
} }
// Phonetic Normalization // Phonetic Normalization
const regex_ae = regex("ae"), const regex_ae = regex("ae"),
regex_ai = regex("ai"), //regex_ai = regex("ai"),
regex_ay = regex("ay"), //regex_ay = regex("ay"),
regex_ey = regex("ey"), //regex_ey = regex("ey"),
regex_oe = regex("oe"), regex_oe = regex("oe"),
regex_ue = regex("ue"), //regex_ue = regex("ue"),
regex_ie = regex("ie"), //regex_ie = regex("ie"),
regex_sz = regex("sz"), //regex_sz = regex("sz"),
regex_zs = regex("zs"), //regex_zs = regex("zs"),
regex_ck = regex("ck"), //regex_ck = regex("ck"),
regex_cc = regex("cc"), //regex_cc = regex("cc"),
regex_sh = regex("sh"), regex_sh = regex("sh"),
regex_th = regex("th"), regex_th = regex("th"),
regex_dt = regex("dt"), //regex_dt = regex("dt"),
regex_ph = regex("ph"), regex_ph = regex("ph"),
regex_pf = regex("pf"), regex_pf = regex("pf");
regex_ou = regex("ou"), //regex_ou = regex("ou"),
regex_uo = regex("uo"); //regex_uo = regex("uo");
const pairs = [ const pairs = [
regex_ae, "a", regex_ae, "a",
regex_ai, "ei", // regex_ai, "ei",
regex_ay, "ei", // regex_ay, "ei",
regex_ey, "ei", // regex_ey, "ei",
regex_oe, "o", regex_oe, "o",
regex_ue, "u", // regex_ue, "u",
regex_ie, "i", // regex_ie, "i",
regex_sz, "s", // regex_sz, "s",
regex_zs, "s", // regex_zs, "s",
regex_sh, "s", regex_sh, "s",
regex_ck, "k", // regex_ck, "k",
regex_cc, "k", // regex_cc, "k",
regex_th, "t", regex_th, "t",
regex_dt, "t", // regex_dt, "t",
regex_ph, "f", regex_ph, "f",
regex_pf, "f", regex_pf, "f",
regex_ou, "o", // regex_ou, "o",
regex_uo, "u" // regex_uo, "u"
]; ];
export function encode(str, self, _skip_postprocessing){ /**
* @this IndexInterface
*/
export function encode(str, _skip_postprocessing){
if(str){ if(str){
str = encode_simple(str, self || this).join(" "); str = encode_balance.call(this, str).join(" ");
if(str.length > 2){ if(str.length > 2){

View File

@@ -1,31 +1,118 @@
import Index from "../../index.js"; import { IndexInterface } from "../../type.js";
import { encode as encode_simple } from "./simple.js";
// custom soundex implementation
export const rtl = false; export const rtl = false;
export const tokenize = ""; export const tokenize = "strict";
export default { export default {
encode: encode, encode: encode,
rtl: rtl rtl: rtl,
tokenize: tokenize
} }
const regex_whitespace = /[\W_]+/; //const regex_whitespace = /[\W_]+/g;
//const regex_strip = /[^a-z0-9 ]/g; const regex_strip = /[^a-z0-9]+/;
// const pairs = [ // const pairs = [
// regex_whitespace, " ", // regex_whitespace, " ",
// regex_strip, "" // regex_strip, ""
// ]; // ];
// modified
const soundex = {
"b": "p",
//"p": "p",
//"f": "f",
"v": "f",
"w": "f",
//"s": "s",
"z": "s",
"x": "s",
"ß": "s",
"d": "t",
//"t": "t",
//"l": "l",
//"m": "m",
"n": "m",
"c": "k",
"g": "k",
"j": "k",
//"k": "k",
"q": "k",
//"r": "r",
//"h": "h",
//"a": "a",
//"e": "e",
"i": "e",
"y": "e",
//"o": "o",
"u": "o"
};
/** /**
* @this Index * @this IndexInterface
*/ */
export function encode(str){ export function encode(str){
return this.pipeline( str = encode_simple.call(this, str).join(" ");
/* string: */ str.toLowerCase(), // str = this.pipeline(
/* normalize: */ false, //
/* split: */ regex_whitespace, // /* string: */ normalize(str).toLowerCase(),
/* collapse: */ false // /* normalize: */ false,
); // /* split: */ false,
// /* collapse: */ false
// );
const result = [];
if(str){
const words = str.split(regex_strip);
const length = words.length;
for(let x = 0, tmp, count = 0; x < length; x++){
if((str = words[x]) /*&& (str.length > 2)*/ && (!this.filter || !this.filter[str])){
tmp = str[0];
let code = soundex[tmp] || tmp; //str[0];
let previous = code; //soundex[code] || code;
for(let i = 1; i < str.length; i++){
tmp = str[i];
const current = soundex[tmp] || tmp;
if(current && (current !== previous)){
code += current;
previous = current;
// if(code.length === 7){
//
// break;
// }
}
}
result[count++] = code; //(code + "0000").substring(0, 4);
}
}
}
return result;
} }

View File

@@ -1,23 +1,25 @@
import Index from "../../index.js"; import { IndexInterface } from "../../type.js";
import { normalize } from "../../lang.js";
export const rtl = false; export const rtl = false;
export const tokenize = ""; export const tokenize = "";
export default { export default {
encode: encode, encode: encode,
rtl: rtl rtl: rtl,
tokenize: tokenize
} }
const regex_whitespace = /[\W_]+/; const regex_whitespace = /[\W_]+/;
/** /**
* @this Index * @this IndexInterface
*/ */
export function encode(str){ export function encode(str){
return this.pipeline( return this.pipeline(
/* string: */ str.toLowerCase(), /* string: */ normalize(str).toLowerCase(),
/* normalize: */ false, /* normalize: */ false,
/* split: */ regex_whitespace, /* split: */ regex_whitespace,
/* collapse: */ false /* collapse: */ false

View File

@@ -1,3 +1,4 @@
import { IndexInterface } from "../../type.js";
import { regex, replace, collapse } from "../../lang.js"; import { regex, replace, collapse } from "../../lang.js";
import { encode as encode_advanced } from "./advanced.js"; import { encode as encode_advanced } from "./advanced.js";
@@ -5,40 +6,46 @@ export const rtl = false;
export const tokenize = ""; export const tokenize = "";
export default { export default {
encode: encode, encode: encode,
rtl: rtl rtl: rtl,
tokenize: tokenize
} }
// Soundex Normalization // Soundex Normalization
const prefix = "(?!\\b)"; const prefix = "(?!\\b)";
const soundex_b = regex(prefix + "p"), const //soundex_b = regex(prefix + "p"),
soundex_s = regex(prefix + "z"), // soundex_s = regex(prefix + "z"),
soundex_k = regex(prefix + "[cgq]"), // soundex_k = regex(prefix + "[cgq]"),
soundex_m = regex(prefix + "n"), // soundex_m = regex(prefix + "n"),
soundex_t = regex(prefix + "d"), // soundex_t = regex(prefix + "d"),
soundex_f = regex(prefix + "[vw]"), // soundex_f = regex(prefix + "[vw]"),
regex_vowel = regex(prefix + "[aeiouy]"); regex_vowel = regex(prefix + "[aeiouy]");
const pairs = [ const pairs = [
soundex_b, "b", // soundex_b, "b",
soundex_s, "s", // soundex_s, "s",
soundex_k, "k", // soundex_k, "k",
soundex_m, "m", // soundex_m, "m",
soundex_t, "t", // soundex_t, "t",
soundex_f, "f", // soundex_f, "f",
regex_vowel, "" regex_vowel, ""
]; ];
/**
* @this IndexInterface
*/
export function encode(str){ export function encode(str){
if(str){ if(str){
str = encode_advanced(str, this, /* skip post-processing: */ true); str = encode_advanced.call(this, str, /* skip post-processing: */ true);
if(str.length > 1){ if(str.length > 1){
str = replace(str, pairs); //str = replace(str, pairs);
str = str.replace(regex_vowel, "");
} }
if(str.length > 1){ if(str.length > 1){

View File

@@ -1,11 +1,12 @@
import Index from "../../index.js"; import { IndexInterface } from "../../type.js";
import { regex } from "../../lang.js"; import { normalize, regex } from "../../lang.js";
export const rtl = false; export const rtl = false;
export const tokenize = ""; export const tokenize = "";
export default { export default {
encode: encode, encode: encode,
rtl: rtl rtl: rtl,
tokenize: tokenize
} }
// Charset Normalization // Charset Normalization
@@ -41,14 +42,15 @@ const pairs = [
/** /**
* @param {string} str * @param {string} str
* @this IndexInterface
*/ */
export function encode(str, self){ export function encode(str){
return /** @type {Index} */ (self || this).pipeline( return this.pipeline(
/* string: */ str.toLowerCase(), /* string: */ normalize(str).toLowerCase(),
/* normalize: */ pairs, /* normalize: */ !str.normalize && pairs,
/* split: */ regex_whitespace, /* split: */ regex_whitespace,
/* collapse: */ false /* collapse: */ false
); );

View File

@@ -1,135 +0,0 @@
import Index from "../../index.js";
export const rtl = false;
export const tokenize = "strict";
export default {
encode: encode,
rtl: rtl,
tokenize: tokenize
}
//const regex_whitespace = /[\W_]+/g;
const regex_strip = /[^a-z]+/;
// const pairs = [
// regex_whitespace, " ",
// regex_strip, ""
// ];
// modified
const soundex = {
"b": 1,
"f": 1,
"p": 1,
"v": 1,
"c": 7,
"g": 7,
"j": 7,
"k": 7,
"q": 7,
"s": 2,
"x": 2,
"z": 2,
"d": 3,
"t": 3,
"l": 4,
"m": 5,
"n": 5,
"r": 6
};
/**
* @this Index
*/
export function encode(str){
str = this.pipeline(
/* string: */ str.toLowerCase(),
/* normalize: */ false,
/* split: */ false,
/* collapse: */ false
);
const result = [];
if(str){
const words = str.split(regex_strip);
const length = words.length;
for(let x = 0, count = 0; x < length; x++){
if((str = words[x]) && (str.length > 2) && (!this.filter || !this.filter[str])){
let code = str[0];
let previous = getCode(code);
for(let i = 1; i < str.length; i++){
const current = soundex[str[i]];
if(current && (current !== previous)){
code += current;
previous = current;
if(code.length === 4){
break;
}
}
}
result[count++] = (code + "0000").substring(0, 4);
}
}
}
return result;
}
// https://www.rosettacode.org/wiki/Soundex
// function getCode(char){
//
// switch(char){
//
// case 'b':
// case 'f':
// case 'p':
// case 'v':
// return 1;
// case 'c':
// case 'g':
// case 'j':
// case 'k':
// case 'q':
// case 's':
// case 'x':
// case 'z':
// return 2;
// case 'd':
// case 't':
// return 3;
// case 'l':
// return 4;
// case 'm':
// case 'n':
// return 5;
// case 'r':
// return 6;
// }
//
// return "";
// }

View File

@@ -5,8 +5,21 @@
export function IndexInterface(){ export function IndexInterface(){
this.cache = null; this.cache = null;
this.matcher = null;
this.stemmer = null;
this.filter = null;
} }
/**
* @param {!string} str
* @param {boolean|Array<string|RegExp>=} normalize
* @param {boolean|string|RegExp=} split
* @param {boolean=} collapse
* @returns {string|Array<string>}
*/
IndexInterface.prototype.pipeline;
/** /**
* @param {!number|string} id * @param {!number|string} id
* @param {!string} content * @param {!string} content

View File

@@ -1,8 +1,12 @@
import { SUPPORT_ASYNC, SUPPORT_DOCUMENT, SUPPORT_CACHE, SUPPORT_SERIALIZE, SUPPORT_WORKER } from "./config.js"; import { SUPPORT_ASYNC, SUPPORT_DOCUMENT, SUPPORT_CACHE, SUPPORT_SERIALIZE, SUPPORT_WORKER, SUPPORT_ENCODER } from "./config.js";
import Document from "./document.js"; import Document from "./document.js";
import Index from "./index.js"; import Index from "./index.js";
import WorkerIndex from "./worker/index.js"; import WorkerIndex from "./worker/index.js";
import { registerCharset, registerLanguage } from "./global.js"; import { registerCharset, registerLanguage } from "./global.js";
import charset_simple from "./lang/latin/simple.js"
import charset_balance from "./lang/latin/balance.js"
import charset_advanced from "./lang/latin/advanced.js"
import charset_extra from "./lang/latin/extra.js"
/** @export */ Document.prototype.add; /** @export */ Document.prototype.add;
/** @export */ Document.prototype.append; /** @export */ Document.prototype.append;
@@ -49,6 +53,14 @@ if(SUPPORT_SERIALIZE){
/** @export */ Document.prototype.import; /** @export */ Document.prototype.import;
} }
if(SUPPORT_ENCODER){
registerCharset("latin:simple", charset_simple);
registerCharset("latin:balance", charset_balance);
registerCharset("latin:advanced", charset_advanced);
registerCharset("latin:extra", charset_extra);
}
const root = self; const root = self;
let tmp; let tmp;

View File

@@ -18,7 +18,7 @@ var supported_lang = [
var supported_charset = { var supported_charset = {
'latin': ["default", "advanced", "balance", "extra", "simple", "soundex"], 'latin': ["default", "advanced", "balance", "extra", "simple"],
'cjk': ["default"], 'cjk': ["default"],
'cyrillic': ["default"], 'cyrillic': ["default"],
'arabic': ["default"], 'arabic': ["default"],
@@ -85,6 +85,18 @@ var release = options["RELEASE"];
// const es5_version = (release === "es5") || (process.argv[2] === "--es5"); // const es5_version = (release === "es5") || (process.argv[2] === "--es5");
// const module_version = (release === "module") || (process.argv[2] === "--module"); // const module_version = (release === "module") || (process.argv[2] === "--module");
if(release){
let filename
if(!fs.existsSync(filename = "src/config/" + release + "/config.js")){
filename = "src/config/bundle/config.js";
}
fs.writeFileSync("tmp/config.js", fs.readFileSync(filename));
}
if(release === "es5"){ if(release === "es5"){
release = "ES5"; release = "ES5";
@@ -126,7 +138,7 @@ let parameter = (function(opt){
process_closure_primitives: true, process_closure_primitives: true,
summary_detail_level: 3, summary_detail_level: 3,
warning_level: "VERBOSE", warning_level: "VERBOSE",
emit_use_strict: true, emit_use_strict: true, // release !== "lang",
output_manifest: "log/manifest.log", output_manifest: "log/manifest.log",
//output_module_dependencies: "log/module_dependencies.log", //output_module_dependencies: "log/module_dependencies.log",
@@ -147,7 +159,7 @@ let parameter = (function(opt){
rewrite_polyfills: use_polyfill || false, rewrite_polyfills: use_polyfill || false,
// isolation_mode: "IIFE", // isolation_mode: "IIFE",
output_wrapper: "(function(self){%output%}(this));" output_wrapper: /*release === "lang" ? "%output%" :*/ "(function(self){%output%}(this));"
//formatting: "PRETTY_PRINT" //formatting: "PRETTY_PRINT"
}); });
@@ -181,7 +193,8 @@ if(release === "lang"){
fs.writeFileSync("tmp/" + lang + ".js", ` fs.writeFileSync("tmp/" + lang + ".js", `
import lang from "../src/lang/${lang}.js"; import lang from "../src/lang/${lang}.js";
window["FlexSearch"]["registerLanguage"]("${lang}", lang); /*try{if(module)self=module}catch(e){}*/
self["FlexSearch"]["registerLanguage"]("${lang}", lang);
`); `);
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --entry_point='tmp/" + lang + ".js' --js='tmp/" + lang + ".js' --js='src/**.js'" + flag_str + " --js_output_file='dist/lang/" + lang + ".min.js' && exit 0", function(){ exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --entry_point='tmp/" + lang + ".js' --js='tmp/" + lang + ".js' --js='src/**.js'" + flag_str + " --js_output_file='dist/lang/" + lang + ".min.js' && exit 0", function(){
@@ -203,7 +216,8 @@ if(release === "lang"){
fs.writeFileSync("tmp/" + charset + "_" + variant + ".js", ` fs.writeFileSync("tmp/" + charset + "_" + variant + ".js", `
import charset from "../src/lang/${charset}/${variant}.js"; import charset from "../src/lang/${charset}/${variant}.js";
window["FlexSearch"]["registerCharset"]("${charset}:${variant}", charset); /*try{if(module)self=module}catch(e){}*/
self["FlexSearch"]["registerCharset"]("${charset}:${variant}", charset);
`); `);
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --entry_point='tmp/" + charset + "_" + variant + ".js' --js='tmp/" + charset + "_" + variant + ".js' --js='src/**.js'" + flag_str + " --js_output_file='dist/lang/" + charset + "/" + variant + ".min.js' && exit 0", function(){ exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --entry_point='tmp/" + charset + "_" + variant + ".js' --js='tmp/" + charset + "_" + variant + ".js' --js='src/**.js'" + flag_str + " --js_output_file='dist/lang/" + charset + "/" + variant + ".min.js' && exit 0", function(){