1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-01 18:03:56 +02:00
This commit is contained in:
Thomas Wilkerling
2019-02-03 17:12:37 +01:00
parent a43db89ca5
commit 3e1b9c3ae4
9 changed files with 238 additions and 119 deletions

View File

@@ -203,7 +203,7 @@ Comparison: <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/bench
<tr>
<td>1</td>
<td>FlexSearch <a href="#notes">***</a></td>
<td>0.3.3</td>
<td>0.3.6</td>
<td><b>363757</b></td>
<td><b>182603</b></td>
<td><b>1627219</b></td>
@@ -689,8 +689,10 @@ index.search({
When suggestion is enabled all results will be filled up (until limit, default 1000) with similar matches ordered by relevance.
Actually phonetic suggestions are not supported, for that purpose use the encoder and tokenizer which provides similar functionality. Suggestions comes into game when a query has multiple words/phrases. Assume a query contains 3 words. When the index just match 2 of 3 words then normally you will get no results, but with suggestion enabled you will also get results when 2 of 3 words was matched as well 1 of 3 words was matched (depends on the limit), also sorted by relevance.
<a name="index.update"></a>
#### Update item of an index
#### Update item from an index
> Index.__update(id, string)__
@@ -699,7 +701,7 @@ index.update(10025, "Road Runner");
```
<a name="index.remove"></a>
#### Remove item to the index
#### Remove item from an index
> Index.__remove(id)__
@@ -923,6 +925,49 @@ It is also possible to <a href="#builds">compile language packs into the build</
node compile SUPPORT_LANG_EN=true SUPPORT_LANG_DE=true
```
<a name="rtl"></a>
### Right-To-Left Support
> Set the tokenizer at least to "reverse" or "full" when using RTL.
Just set the field "rtl" to _true_ and use a compatible tokenizer:
```js
var index = FlexSearch.create({
encode: "icase",
tokenize: "reverse",
rtl: true
});
```
<a name="cjk"></a>
### CJK Word Break (Chinese, Japanese, Korean)
Set a custom tokenizer which fits your needs, e.g.:
```js
var index = FlexSearch.create({
encode: false,
tokenize: function(str){
return str.split(/[\x00-\x7F]+/);
}
});
```
You can also pass a custom encoder function to apply some linguistic transformations.
```js
index.add(0, "서울시가 잠이 든 시간에 아무 말, 미뤄, 미뤄");
```
```js
var results = index.search("든");
```
```js
var results = index.search("시간에");
```
<a name="index.info"></a>
### Get info about an index
@@ -1182,6 +1227,15 @@ FlexSearch ist highly customizable. Make use of the the <a href="#profiles">righ
</td>
<td>Disable or pass in language shorthand flag (ISO-3166) or a custom array.</td>
</tr>
<tr></tr>
<tr>
<td align="top">rtl<br><br><br></td>
<td>
true<br>
false
</td>
<td>Enables Right-To-Left encoding.</td>
</tr>
</table>
<a name="tokenizer"></a>

View File

@@ -1,23 +1,23 @@
/*
FlexSearch v0.3.51
FlexSearch v0.3.61
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(f,r,d){let k;(k=d.define)&&k.amd?k([],function(){return r}):(k=d.modules)?k[f.toLowerCase()]=r:"object"===typeof exports?module.exports=r:d[f]=r})("FlexSearch",function(){function f(b){z(b)&&(b=F[b]);b||(b=v);this.id=b.id||L++;this.init(b);r(this,"index",function(){return this.b});r(this,"length",function(){return Object.keys(this.b).length})}function r(b,a,c){Object.defineProperty(b,a,{get:c})}function d(b){return new RegExp(b,"g")}function k(b,a){for(let c=0;c<a.length;c+=
'use strict';(function(f,p,d){let k;(k=d.define)&&k.amd?k([],function(){return p}):(k=d.modules)?k[f.toLowerCase()]=p:"object"===typeof exports?module.exports=p:d[f]=p})("FlexSearch",function(){function f(b){z(b)&&(b=F[b]);b||(b=v);this.id=b.id||L++;this.init(b);p(this,"index",function(){return this.b});p(this,"length",function(){return Object.keys(this.b).length})}function p(b,a,c){Object.defineProperty(b,a,{get:c})}function d(b){return new RegExp(b,"g")}function k(b,a){for(let c=0;c<a.length;c+=
2)b=b.replace(a[c],a[c+1]);return b}function y(b,a,c,g,e,d,m){if(a[c])return a[c];e=e?(9-(m||6))*d+(m||6)*e:d;a[c]=e;e>=m&&(b=b[9-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=g);return e}function C(b,a){if(b){const c=Object.keys(b);for(let g=0,d=c.length;g<d;g++){const d=c[g],e=b[d];if(e)for(let c=0,g=e.length;c<g;c++)if(e[c]===a){1===g?delete b[d]:e.splice(c,1);break}else"object"===typeof e[c]&&C(e[c],a)}}}function D(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const g=b[e];if(g!==c)if(e&&"h"===
g){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=g}else a+=g;d=e===b.length-1?"":b[e+1];c=g}return a}function M(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function N(b,a){b=b.length-a.length;return 0>b?-1:b?1:0}function O(b,a,c){let d=[],e;const t=b.length;if(1<t){b.sort(N);const g=u();let l=b[0],n=l.length,h=0;for(;h<n;)g["@"+l[h++]]=1;let f,p=0,q=0;for(;++q<t;){let G=!1;const k=q===t-1;e=[];l=b[q];n=l.length;for(h=
0;h<n;){f=l[h++];var m="@"+f;if(g[m]){const b=g[m];if(b===q){if(k){if(d[p++]=f,a&&p===a)return d}else g[m]=q+1;G=!0}else c&&(m=e[b]||(e[b]=[]),m[m.length]=f)}}if(!G&&!c)break}if(c&&(p=d.length,(q=e.length)&&(!a||p<a)))for(;q--;)if(f=e[q])for(h=0,n=f.length;h<n;h++)if(d[p++]=f[h],a&&p===a)return d}else t&&(d=b[0],a&&d.length>a&&(d=d.slice(0,a)));return d}function z(b){return"string"===typeof b}function A(b){return"function"===typeof b}function B(b){return"undefined"===typeof b}function H(b){const a=
Array(b);for(let c=0;c<b;c++)a[c]=u();return a}function u(){return Object.create(null)}const v={encode:"icase",a:"forward",i:!1,cache:!1,async:!1,j:!1,threshold:0,depth:0},F={memory:{encode:"extra",a:"strict",threshold:7},speed:{encode:"icase",a:"strict",threshold:7,depth:2},match:{encode:"extra",a:"full"},score:{encode:"extra",a:"strict",threshold:5,depth:4},balance:{encode:"balance",a:"strict",threshold:6,depth:3},fastest:{encode:"icase",a:"strict",threshold:9,depth:1}},E=[];let L=0;const I=d("\\W+"),
J={},K={};f.create=function(b){return new f(b)};f.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&E.push(d(a),b[a]);return this};f.registerEncoder=function(b,a){x[b]=a.bind(x);return this};f.registerLanguage=function(b,a){J[b]=a.filter;K[b]=a.stemmer;return this};f.encode=function(b,a){return x[b](a)};f.prototype.init=function(b){this.h=[];b||(b=v);var a=b.preset,c=a?F[a]:{};this.a=b.tokenize||c.a||this.a||v.a;this.async="undefined"===typeof Promise||B(a=b.async)?this.async||v.async:
a;this.threshold=B(a=b.threshold)?c.threshold||this.threshold||v.threshold:a;this.depth=B(a=b.depth)?c.depth||this.depth||v.depth:a;this.f=(a=B(a=b.encode)?c.encode:a)&&x[a]&&x[a].bind(x)||(A(a)?a:this.f||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=J[a]||a;c=this.f;var g=u();if(a)for(let b=0;b<a.length;b++){const d=c?c(a[b]):a[b];g[d]=String.fromCharCode(65E3-a.length+b)}this.filter=a=g}if(a=b.stemmer){var e;b=K[a]||a;a=this.f;c=[];if(b)for(e in b)b.hasOwnProperty(e)&&(g=a?a(e):e,c.push(d("(?=.{"+
(g.length+3)+",})"+g+"$"),a?a(b[e]):b[e]));this.stemmer=e=c}this.g=H(10-(this.threshold||0));this.c=u();this.b=u();return this};f.prototype.encode=function(b){b&&E.length&&(b=k(b,E));b&&this.h.length&&(b=k(b,this.h));b&&this.f&&(b=this.f(b));b&&this.stemmer&&(b=k(b,this.stemmer));return b};f.prototype.addMatcher=function(b){const a=this.h;for(const c in b)b.hasOwnProperty(c)&&a.push(d(c),b[c]);return this};f.prototype.add=function(b,a,c,d,e){if(a&&z(a)&&(b||0===b)){var g="@"+b;if(this.b[g]&&!d)return this.update(b,
a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;g=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=null;c()})});if(c)g.then(c);else return g;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.a;e=A(c)?c(a):a.split(I);const k=u();k._ctx=u();const p=this.threshold,q=this.depth,t=this.g,w=e.length;for(let a=0;a<w;a++){var m=e[a];if(m){var f=m.length,l=(w-a)/w,n="";switch(c){case "reverse":case "both":for(var h=
f-1;1<=h;h--)n=m[h]+n,y(t,k,n,b,(f-h)/f,l,p);n="";case "forward":for(h=0;h<f;h++)n+=m[h],y(t,k,n,b,1,l,p);break;case "full":for(h=0;h<f;h++){const a=(f-h)/f;for(let c=f;c>h;c--)n=m.substring(h,c),y(t,k,n,b,a,l,p)}break;default:if(f=y(t,k,m,b,1,l,p),q&&1<w&&f>=p)for(f=k._ctx[m]||(k._ctx[m]=u()),m=this.c[m]||(this.c[m]=H(10-(p||0))),l=a-q,n=a+q+1,0>l&&(l=0),n>w&&(n=w);l<n;l++)l!==a&&y(m,f,e[l],b,0,10-(l<a?a-l:l-a),p)}}}this.b[g]=1}return this};f.prototype.update=function(b,a,c){this.b["@"+b]&&z(a)&&
(this.remove(b),this.add(b,a,c,!0));return this};f.prototype.remove=function(b,a,c){var d="@"+b;if(this.b[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)C(this.g[a],b);this.depth&&C(this.c,b);delete this.b[d]}return this};f.prototype.search=function(b,a,c,d){let e=b;let f=
[];if("object"===typeof b){(c=b.callback||a)&&(e.callback=null);a=b.limit;var g=b.threshold;b=b.query}g||(g=this.threshold||0);A(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let b=this;g=new Promise(function(c){setTimeout(function(){c(b.search(e,a,null,!0));b=null})});if(c)g.then(c);else return g;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!z(b))return f;e=b;e=this.encode(e);if(!e.length)return f;c=this.a;c=A(c)?c(e):e.split(I);b=c.length;
d=!0;const k=[],l=u();let n;if(1<b)if(this.depth){n=!0;var h=c[0];l[h]=1}else c.sort(M);let r;if(!n||(r=this.c)[h])for(let a=n?1:0;a<b;a++){const b=c[a];if(b){if(!l[b]){const a=[];let c=!1,e=0;if(h=n?r[h]:this.g){let d;for(let f=0;f<10-g;f++)if(d=h[f][b])a[e++]=d,c=!0}if(c)k[k.length]=1<e?a.concat.apply([],a):a[0];else{d=!1;break}l[b]=1}h=b}}else d=!1;d&&(f=O(k,a,!1));return f};f.prototype.clear=function(){return this.destroy().init()};f.prototype.destroy=function(){this.g=this.c=this.b=null;return this};
const x={icase:function(b){return b.toLowerCase()},simple:function(){const b=[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("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){a=k(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=
[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=k(a,b));c||1<a.length&&(a=D(a));return a}}(),extra:function(){const b=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=
a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+k(d.substring(1),b))}a=a.join(" ");a=D(a)}return a}}(),balance:function(){const b=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){return D(k(a.toLowerCase(),b))}}()};return f}(!1),this);
g){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=g}else a+=g;d=e===b.length-1?"":b[e+1];c=g}return a}function M(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function N(b,a){b=b.length-a.length;return 0>b?-1:b?1:0}function O(b,a,c){let d=[],e;const t=b.length;if(1<t){b.sort(N);const g=u();let l=b[0],n=l.length,h=0;for(;h<n;)g["@"+l[h++]]=1;let f,q=0,r=0;for(;++r<t;){let G=!1;const k=r===t-1;e=[];l=b[r];n=l.length;for(h=
0;h<n;){f=l[h++];var m="@"+f;if(g[m]){const b=g[m];if(b===r){if(k){if(d[q++]=f,a&&q===a)return d}else g[m]=r+1;G=!0}else c&&(m=e[b]||(e[b]=[]),m[m.length]=f)}}if(!G&&!c)break}if(c&&(q=d.length,(r=e.length)&&(!a||q<a)))for(;r--;)if(f=e[r])for(h=0,n=f.length;h<n;h++)if(d[q++]=f[h],a&&q===a)return d}else t&&(d=b[0],a&&d.length>a&&(d=d.slice(0,a)));return d}function z(b){return"string"===typeof b}function A(b){return"function"===typeof b}function B(b){return"undefined"===typeof b}function H(b){const a=
Array(b);for(let c=0;c<b;c++)a[c]=u();return a}function u(){return Object.create(null)}const v={encode:"icase",a:"forward",j:!1,cache:!1,async:!1,l:!1,h:!1,threshold:0,depth:0},F={memory:{encode:"extra",a:"strict",threshold:7},speed:{encode:"icase",a:"strict",threshold:7,depth:2},match:{encode:"extra",a:"full"},score:{encode:"extra",a:"strict",threshold:5,depth:4},balance:{encode:"balance",a:"strict",threshold:6,depth:3},fastest:{encode:"icase",a:"strict",threshold:9,depth:1}},E=[];let L=0;const I=
d("\\W+"),J={},K={};f.create=function(b){return new f(b)};f.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&E.push(d(a),b[a]);return this};f.registerEncoder=function(b,a){x[b]=a.bind(x);return this};f.registerLanguage=function(b,a){J[b]=a.filter;K[b]=a.stemmer;return this};f.encode=function(b,a){return x[b](a)};f.prototype.init=function(b){this.i=[];b||(b=v);var a=b.preset,c=a?F[a]:{};this.a=b.tokenize||c.a||this.a||v.a;this.h=b.rtl||this.h||v.h;this.async="undefined"===typeof Promise||
B(a=b.async)?this.async||v.async:a;this.threshold=B(a=b.threshold)?c.threshold||this.threshold||v.threshold:a;this.depth=B(a=b.depth)?c.depth||this.depth||v.depth:a;this.f=(a=B(a=b.encode)?c.encode:a)&&x[a]&&x[a].bind(x)||(A(a)?a:this.f||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=J[a]||a;c=this.f;var g=u();if(a)for(let b=0;b<a.length;b++){const d=c?c(a[b]):a[b];g[d]=String.fromCharCode(65E3-a.length+b)}this.filter=a=g}if(a=b.stemmer){var e;b=K[a]||a;a=this.f;c=[];if(b)for(e in b)b.hasOwnProperty(e)&&
(g=a?a(e):e,c.push(d("(?=.{"+(g.length+3)+",})"+g+"$"),a?a(b[e]):b[e]));this.stemmer=e=c}this.g=H(10-(this.threshold||0));this.c=u();this.b=u();return this};f.prototype.encode=function(b){b&&E.length&&(b=k(b,E));b&&this.i.length&&(b=k(b,this.i));b&&this.f&&(b=this.f(b));b&&this.stemmer&&(b=k(b,this.stemmer));return b};f.prototype.addMatcher=function(b){const a=this.i;for(const c in b)b.hasOwnProperty(c)&&a.push(d(c),b[c]);return this};f.prototype.add=function(b,a,c,d,e){if(a&&z(a)&&(b||0===b)){var g=
"@"+b;if(this.b[g]&&!d)return this.update(b,a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;g=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=null;c()})});if(c)g.then(c);else return g;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.a;e=A(c)?c(a):a.split(I);const k=u();k._ctx=u();const q=this.threshold,r=this.depth,t=this.g,w=e.length,p=this.h;for(let a=0;a<w;a++){var m=e[a];if(m){var f=m.length,l=
(p?a+1:w-a)/w,n="";switch(c){case "reverse":case "both":for(var h=f;--h;)n=m[h]+n,y(t,k,n,b,p?1:(f-h)/f,l,q);n="";case "forward":for(h=0;h<f;h++)n+=m[h],y(t,k,n,b,p?(h+1)/f:1,l,q);break;case "full":for(h=0;h<f;h++){const a=(p?h+1:f-h)/f;for(let c=f;c>h;c--)n=m.substring(h,c),y(t,k,n,b,a,l,q)}break;default:if(f=y(t,k,m,b,1,l,q),r&&1<w&&f>=q)for(f=k._ctx[m]||(k._ctx[m]=u()),m=this.c[m]||(this.c[m]=H(10-(q||0))),l=a-r,n=a+r+1,0>l&&(l=0),n>w&&(n=w);l<n;l++)l!==a&&y(m,f,e[l],b,0,10-(l<a?a-l:l-a),q)}}}this.b[g]=
1}return this};f.prototype.update=function(b,a,c){this.b["@"+b]&&z(a)&&(this.remove(b),this.add(b,a,c,!0));return this};f.prototype.remove=function(b,a,c){var d="@"+b;if(this.b[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)C(this.g[a],b);this.depth&&C(this.c,b);delete this.b[d]}return this};
f.prototype.search=function(b,a,c,d){let e=b;let f=[];if("object"===typeof b){(c=b.callback||a)&&(e.callback=null);a=b.limit;var g=b.threshold;b=b.query}g||(g=this.threshold||0);A(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let b=this;g=new Promise(function(c){setTimeout(function(){c(b.search(e,a,null,!0));b=null})});if(c)g.then(c);else return g;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!z(b))return f;e=b;e=this.encode(e);if(!e.length)return f;
c=this.a;c=A(c)?c(e):e.split(I);b=c.length;d=!0;const k=[],l=u();let n;if(1<b)if(this.depth){n=!0;var h=c[0];l[h]=1}else c.sort(M);let p;if(!n||(p=this.c)[h])for(let a=n?1:0;a<b;a++){const b=c[a];if(b){if(!l[b]){const a=[];let c=!1,e=0;if(h=n?p[h]:this.g){let d;for(let f=0;f<10-g;f++)if(d=h[f][b])a[e++]=d,c=!0}if(c)k[k.length]=1<e?a.concat.apply([],a):a[0];else{d=!1;break}l[b]=1}h=b}}else d=!1;d&&(f=O(k,a,!1));return f};f.prototype.clear=function(){return this.destroy().init()};f.prototype.destroy=
function(){this.g=this.c=this.b=null;return this};const x={icase:function(b){return b.toLowerCase()},simple:function(){const b=[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("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){a=
k(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=k(a,b));c||1<a.length&&(a=D(a));return a}}(),extra:function(){const b=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"),
""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+k(d.substring(1),b))}a=a.join(" ");a=D(a)}return a}}(),balance:function(){const b=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){return D(k(a.toLowerCase(),b))}}()};return f}(!1),this);

View File

@@ -1,37 +1,37 @@
/*
FlexSearch v0.3.51
FlexSearch v0.3.61
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';function J(g){var k=0;return function(){return k<g.length?{done:!1,value:g[k++]}:{done:!0}}}function K(g){var k="undefined"!=typeof Symbol&&Symbol.iterator&&g[Symbol.iterator];return k?k.call(g):{next:J(g)}}var Q="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,R="function"==typeof Object.defineProperties?Object.defineProperty:function(g,k,e){g!=Array.prototype&&g!=Object.prototype&&(g[k]=e.value)};
function S(g,k){if(k){var e=Q;g=g.split(".");for(var h=0;h<g.length-1;h++){var l=g[h];l in e||(e[l]={});e=e[l]}g=g[g.length-1];h=e[g];k=k(h);k!=h&&null!=k&&R(e,g,{configurable:!0,writable:!0,value:k})}}
S("Promise",function(g){function k(d){this.b=0;this.i=void 0;this.a=[];var c=this.c();try{d(c.resolve,c.reject)}catch(z){c.reject(z)}}function e(){this.a=null}function h(d){return d instanceof k?d:new k(function(c){c(d)})}if(g)return g;e.prototype.b=function(d){if(null==this.a){this.a=[];var c=this;this.c(function(){c.i()})}this.a.push(d)};var l=Q.setTimeout;e.prototype.c=function(d){l(d,0)};e.prototype.i=function(){for(;this.a&&this.a.length;){var d=this.a;this.a=[];for(var c=0;c<d.length;++c){var e=
d[c];d[c]=null;try{e()}catch(D){this.f(D)}}}this.a=null};e.prototype.f=function(d){this.c(function(){throw d;})};k.prototype.c=function(){function d(d){return function(k){e||(e=!0,d.call(c,k))}}var c=this,e=!1;return{resolve:d(this.F),reject:d(this.f)}};k.prototype.F=function(d){if(d===this)this.f(new TypeError("A Promise cannot resolve to itself"));else if(d instanceof k)this.G(d);else{a:switch(typeof d){case "object":var c=null!=d;break a;case "function":c=!0;break a;default:c=!1}c?this.D(d):this.j(d)}};
k.prototype.D=function(d){var c=void 0;try{c=d.then}catch(z){this.f(z);return}"function"==typeof c?this.H(c,d):this.j(d)};k.prototype.f=function(c){this.m(2,c)};k.prototype.j=function(c){this.m(1,c)};k.prototype.m=function(c,e){if(0!=this.b)throw Error("Cannot settle("+c+", "+e+"): Promise already settled in state"+this.b);this.b=c;this.i=e;this.u()};k.prototype.u=function(){if(null!=this.a){for(var d=0;d<this.a.length;++d)c.b(this.a[d]);this.a=null}};var c=new e;k.prototype.G=function(c){var d=this.c();
c.A(d.resolve,d.reject)};k.prototype.H=function(c,e){var d=this.c();try{c.call(e,d.resolve,d.reject)}catch(D){d.reject(D)}};k.prototype.then=function(c,e){function d(c,d){return"function"==typeof c?function(d){try{g(c(d))}catch(w){h(w)}}:d}var g,h,B=new k(function(c,d){g=c;h=d});this.A(d(c,g),d(e,h));return B};k.prototype.catch=function(c){return this.then(void 0,c)};k.prototype.A=function(d,e){function k(){switch(g.b){case 1:d(g.i);break;case 2:e(g.i);break;default:throw Error("Unexpected state: "+
g.b);}}var g=this;null==this.a?c.b(k):this.a.push(k)};k.resolve=h;k.reject=function(c){return new k(function(d,e){e(c)})};k.race=function(c){return new k(function(d,e){for(var k=K(c),g=k.next();!g.done;g=k.next())h(g.value).A(d,e)})};k.all=function(c){var d=K(c),e=d.next();return e.done?h([]):new k(function(c,k){function g(d){return function(e){l[d]=e;C--;0==C&&c(l)}}var l=[],C=0;do l.push(void 0),C++,h(e.value).A(g(l.length-1),k),e=d.next();while(!e.done)})};return k});
(function(g,k,e){var h;(h=e.define)&&h.amd?h([],function(){return k}):(h=e.modules)?h[g.toLowerCase()]=k:"object"===typeof exports?module.exports=k:e[g]=k})("FlexSearch",function W(g){function e(b){C(b)&&((b=L[b])||console.warn("Preset not found: "+b));b||(b=t);this.id=b.id||X++;this.init(b);l(this,"index",function(){return this.a});l(this,"length",function(){return Object.keys(this.a).length})}function h(b,a,f,c){this.v!==this.h&&(this.l=this.l.concat(f),this.v++,c&&this.l.length>=c&&(this.v=this.h),
this.B&&this.v===this.h&&(this.cache&&this.o.set(a,this.l),this.B(this.l),this.l=[]));return this}function l(b,a,f){Object.defineProperty(b,a,{get:f})}function c(b){return new RegExp(b,"g")}function d(b,a){for(var f=0;f<a.length;f+=2)b=b.replace(a[f],a[f+1]);return b}function B(b,a,f,c,d,e,g){if(a[f])return a[f];d=d?(9-(g||6))*e+(g||6)*d:e;a[f]=d;d>=g&&(b=b[9-(d+.5>>0)],b=b[f]||(b[f]=[]),b[b.length]=c);return d}function z(b,a){if(b)for(var f=Object.keys(b),c=0,d=f.length;c<d;c++){var e=f[c],g=b[e];
if(g)for(var x=0,h=g.length;x<h;x++)if(g[x]===a){1===h?delete b[e]:g.splice(x,1);break}else"object"===typeof g[x]&&z(g[x],a)}}function D(b){for(var a="",f="",c="",d=0;d<b.length;d++){var e=b[d];if(e!==f)if(d&&"h"===e){if(c="a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c,("a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f)&&c||" "===f)a+=e}else a+=e;c=d===b.length-1?"":b[d+1];f=e}return a}function T(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function V(b,a){b=b.length-a.length;return 0>b?
-1:b?1:0}function U(b,a,f){var c=[],d=b.length;if(1<d){b.sort(V);for(var e=y(),g=b[0],x=g.length,h=0;h<x;)e["@"+g[h++]]=1;for(var l,E=0,r=0;++r<d;){var q=!1,u=r===d-1;var n=[];g=b[r];x=g.length;for(h=0;h<x;){l=g[h++];var m="@"+l;if(e[m]){var p=e[m];if(p===r){if(u){if(c[E++]=l,a&&E===a)return c}else e[m]=r+1;q=!0}else f&&(m=n[p]||(n[p]=[]),m[m.length]=l)}}if(!q&&!f)break}if(f&&(E=c.length,(r=n.length)&&(!a||E<a)))for(;r--;)if(l=n[r])for(h=0,x=l.length;h<x;h++)if(c[E++]=l[h],a&&E===a)return c}else d&&
(c=b[0],a&&c.length>a&&(c=c.slice(0,a)));return c}function C(b){return"string"===typeof b}function G(b){return"function"===typeof b}function w(b){return"undefined"===typeof b}function M(b){for(var a=Array(b),f=0;f<b;f++)a[f]=y();return a}function y(){return Object.create(null)}function Y(){var b,a;self.onmessage=function(f){if(f=f.data)if(f.search){var c=a.search(f.content,f.threshold?{limit:f.limit,threshold:f.threshold}:f.limit);self.postMessage({id:b,content:f.content,limit:f.limit,result:c})}else f.add?
a.add(f.id,f.content):f.update?a.update(f.id,f.content):f.remove?a.remove(f.id):f.clear?a.clear():f.info?(f=a.info(),f.worker=b,console.log(f)):f.register&&(b=f.id,f.options.cache=!1,f.options.async=!1,f.options.worker=!1,a=(new Function(f.register.substring(f.register.indexOf("{")+1,f.register.lastIndexOf("}"))))(),a=new a(f.options))}}function Z(b,a,f,c){b=g("flexsearch","id"+b,Y,function(a){(a=a.data)&&a.result&&c(a.id,a.content,a.result,a.limit)},a);var d=W.toString();f.id=a;b.postMessage({register:d,
options:f,id:a});return b}var t={encode:"icase",g:"forward",w:!1,cache:!1,async:!1,h:!1,threshold:0,depth:0},L={memory:{encode:"extra",g:"strict",threshold:7},speed:{encode:"icase",g:"strict",threshold:7,depth:2},match:{encode:"extra",g:"full"},score:{encode:"extra",g:"strict",threshold:5,depth:4},balance:{encode:"balance",g:"strict",threshold:6,depth:3},fastest:{encode:"icase",g:"strict",threshold:9,depth:1}},I=[],X=0,N=c("\\W+"),O={},P={};e.create=function(b){return new e(b)};e.registerMatcher=
function(b){for(var a in b)b.hasOwnProperty(a)&&I.push(c(a),b[a]);return this};e.registerEncoder=function(b,a){F[b]=a.bind(F);return this};e.registerLanguage=function(b,a){O[b]=a.filter;P[b]=a.stemmer;return this};e.encode=function(b,a){return F[b](a)};e.prototype.init=function(b){this.i=[];b||(b=t);var a=b.preset,f=a?L[a]:{};f||console.warn("Preset not found: "+a);if(a=b.worker)if("undefined"===typeof Worker)b.worker=!1,this.f=null;else{var d=parseInt(a,10)||4;this.u=-1;this.v=0;this.l=[];this.B=
null;this.f=Array(d);for(var e=0;e<d;e++)this.f[e]=Z(this.id,e,b,h.bind(this))}this.g=b.tokenize||f.g||this.g||t.g;this.async="undefined"===typeof Promise||w(a=b.async)?this.async||t.async:a;this.h=w(a=b.worker)?this.h||t.h:a;this.threshold=w(a=b.threshold)?f.threshold||this.threshold||t.threshold:a;this.depth=w(a=b.depth)?f.depth||this.depth||t.depth:a;this.w=w(a=b.suggest)?this.w||t.w:a;this.j=(a=w(a=b.encode)?f.encode:a)&&F[a]&&F[a].bind(F)||(G(a)?a:this.j||!1);(a=b.matcher)&&this.addMatcher(a);
if(a=b.filter){a=O[a]||a;f=this.j;d=y();if(a)for(e=0;e<a.length;e++){var g=f?f(a[e]):a[e];d[g]=String.fromCharCode(65E3-a.length+e)}this.filter=d}if(a=b.stemmer){f=P[a]||a;d=this.j;e=[];if(f)for(var l in f)f.hasOwnProperty(l)&&(g=d?d(l):l,e.push(c("(?=.{"+(g.length+3)+",})"+g+"$"),d?d(f[l]):f[l]));this.stemmer=e}this.b=M(10-(this.threshold||0));this.c=y();this.a=y();this.m=!0;this.o=(this.cache=a=w(a=b.cache)?this.cache||t.cache:a)?new aa(a):!1;return this};e.prototype.encode=function(b){b&&I.length&&
(b=d(b,I));b&&this.i.length&&(b=d(b,this.i));b&&this.j&&(b=this.j(b));b&&this.stemmer&&(b=d(b,this.stemmer));return b};e.prototype.addMatcher=function(b){var a=this.i,f;for(f in b)b.hasOwnProperty(f)&&a.push(c(f),b[f]);return this};e.prototype.add=function(b,a,f,c,d){if(a&&C(a)&&(b||0===b)){var e="@"+b;if(this.a[e]&&!c)return this.update(b,a);if(this.h)return++this.u>=this.f.length&&(this.u=0),this.f[this.u].postMessage({add:!0,id:b,content:a}),this.a[e]=""+this.u,f&&f(),this;if(!d){if(this.async&&
"function"!==typeof importScripts){var g=this;e=new Promise(function(f){setTimeout(function(){g.add(b,a,null,c,!0);g=null;f()})});if(f)e.then(f);else return e;return this}if(f)return this.add(b,a,null,c,!0),f(),this}a=this.encode(a);if(!a.length)return this;f=this.g;d=G(f)?f(a):a.split(N);var h=y();h._ctx=y();for(var A=this.threshold,l=this.depth,H=this.b,r=d.length,q=0;q<r;q++){var u=d[q];if(u){var n=u.length,m=(r-q)/r,p="";switch(f){case "reverse":case "both":for(var v=n-1;1<=v;v--)p=u[v]+p,B(H,
h,p,b,(n-v)/n,m,A);p="";case "forward":for(v=0;v<n;v++)p+=u[v],B(H,h,p,b,1,m,A);break;case "full":for(v=0;v<n;v++)for(var w=(n-v)/n,t=n;t>v;t--)p=u.substring(v,t),B(H,h,p,b,w,m,A);break;default:if(n=B(H,h,u,b,1,m,A),l&&1<r&&n>=A)for(n=h._ctx[u]||(h._ctx[u]=y()),u=this.c[u]||(this.c[u]=M(10-(A||0))),m=q-l,p=q+l+1,0>m&&(m=0),p>r&&(p=r);m<p;m++)m!==q&&B(u,n,d[m],b,0,10-(m<q?q-m:m-q),A)}}}this.a[e]=1;this.m=!1}return this};e.prototype.update=function(b,a,f){this.a["@"+b]&&C(a)&&(this.remove(b),this.add(b,
a,f,!0));return this};e.prototype.remove=function(b,a,f){var c="@"+b;if(this.a[c]){if(this.h)return this.f[this.a[c]].postMessage({remove:!0,id:b}),delete this.a[c],a&&a(),this;if(!f){if(this.async&&"function"!==typeof importScripts){var d=this;c=new Promise(function(a){setTimeout(function(){d.remove(b,null,!0);d=null;a()})});if(a)c.then(a);else return c;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)z(this.b[a],b);this.depth&&z(this.c,b);delete this.a[c];
this.m=!1}return this};e.prototype.search=function(b,a,c,d){var f=b,e=[];if("object"===typeof b){(c=b.callback||a)&&(f.callback=null);a=b.limit;var g=b.threshold;b=b.query}g||(g=this.threshold||0);G(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(this.h)for(this.B=c,this.v=0,this.l=[],e=0;e<this.h;e++)this.f[e].postMessage({search:!0,limit:a,threshold:g,content:b});else{if(!d){if(this.async&&"function"!==typeof importScripts){var h=this;b=new Promise(function(b){setTimeout(function(){b(h.search(f,a,null,!0));
h=null})});if(c)b.then(c);else return b;return this}if(c)return c(this.search(f,a,null,!0)),this}if(!b||!C(b))return e;f=b;if(this.cache)if(this.m){if(c=this.o.get(b))return c}else this.o.clear(),this.m=!0;f=this.encode(f);if(!f.length)return e;c=this.g;c=G(c)?c(f):f.split(N);d=c.length;var l=!0,A=[],t=y();if(1<d)if(this.depth){var r=!0;var q=c[0];t[q]=1}else c.sort(T);var u;if(!r||(u=this.c)[q])for(var n=r?1:0;n<d;n++){var m=c[n];if(m){if(!t[m]){var p=[],v=!1,w=0;if(q=r?u[q]:this.b)for(var B=void 0,
z=0;z<10-g;z++)if(B=q[z][m])p[w++]=B,v=!0;if(v)A[A.length]=1<w?p.concat.apply([],p):p[0];else if(!this.w){l=!1;break}t[m]=1}q=m}}else l=!1;l&&(e=U(A,a,this.w));this.cache&&this.o.set(b,e);return e}};e.prototype.info=function(){if(this.h)for(var b=0;b<this.h;b++)this.f[b].postMessage({info:!0,id:this.id});else{for(var a,c=0,d=0,e=0,g=0;g<10-(this.threshold||0);g++){b=Object.keys(this.b[g]);for(var h=0;h<b.length;h++)a=this.b[g][b[h]].length,c+=1*a+2*b[h].length+4,d+=a,e+=2*b[h].length}b=Object.keys(this.a);
a=b.length;for(g=0;g<a;g++)c+=2*b[g].length+2;return{id:this.id,memory:c,items:a,sequences:d,chars:e,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:I.length+(this.i?this.i.length:0),worker:this.h,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.g}}};e.prototype.clear=function(){return this.destroy().init()};e.prototype.destroy=function(){this.cache&&(this.o.clear(),this.o=null);this.b=this.c=this.a=null;return this};e.prototype.export=function(){return JSON.stringify([this.b,
this.c,this.a])};e.prototype.import=function(b){b=JSON.parse(b);this.b=b[0];this.c=b[1];this.a=b[2]};var F={icase:function(b){return b.toLowerCase()},simple:function(){var b=[c("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",c("[\u00e8\u00e9\u00ea\u00eb]"),"e",c("[\u00ec\u00ed\u00ee\u00ef]"),"i",c("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",c("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",c("[\u00fd\u0177\u00ff]"),"y",c("\u00f1"),"n",c("\u00e7"),"c",c("\u00df"),"s",c(" & ")," and ",c("[-/]")," ",c("[^a-z0-9 ]"),
"",c("\\s+")," "];return function(a){a=d(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){var b=[c("ae"),"a",c("ai"),"ei",c("ay"),"ei",c("ey"),"ei",c("oe"),"o",c("ue"),"u",c("ie"),"i",c("sz"),"s",c("zs"),"s",c("sh"),"s",c("ck"),"k",c("cc"),"k",c("dt"),"t",c("ph"),"f",c("pf"),"f",c("ou"),"o",c("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=d(a,b));c||1<a.length&&(a=D(a));return a}}(),extra:function(){var b=[c("p"),"b",c("z"),"s",c("[cgq]"),"k",c("n"),"m",
c("d"),"t",c("[vw]"),"f",c("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(var c=0;c<a.length;c++){var e=a[c];1<e.length&&(a[c]=e[0]+d(e.substring(1),b))}a=a.join(" ");a=D(a)}return a}}(),balance:function(){var b=[c("[-/]")," ",c("[^a-z0-9 ]"),"",c("\\s+")," "];return function(a){return D(d(a.toLowerCase(),b))}}()},aa=function(){function b(a){this.clear();this.C=!0!==a&&a}b.prototype.clear=function(){this.cache=y();this.count=y();this.index=
y();this.s=[]};b.prototype.set=function(a,b){if(this.C&&w(this.cache[a])){var c=this.s.length;if(c===this.C){c--;var e=this.s[c];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[a]=c;this.s[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){var b=this.cache[a];if(this.C&&b){var c=++this.count[a],e=this.index,d=e[a];if(0<d){for(var g=this.s,h=d;this.count[g[--d]]<=c&&-1!==d;);d++;if(d!==h){for(c=h;c>d;c--)h=g[c-1],g[c]=h,e[h]=
'use strict';function K(g){var k=0;return function(){return k<g.length?{done:!1,value:g[k++]}:{done:!0}}}function L(g){var k="undefined"!=typeof Symbol&&Symbol.iterator&&g[Symbol.iterator];return k?k.call(g):{next:K(g)}}var R="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,S="function"==typeof Object.defineProperties?Object.defineProperty:function(g,k,e){g!=Array.prototype&&g!=Object.prototype&&(g[k]=e.value)};
function T(g,k){if(k){var e=R;g=g.split(".");for(var h=0;h<g.length-1;h++){var l=g[h];l in e||(e[l]={});e=e[l]}g=g[g.length-1];h=e[g];k=k(h);k!=h&&null!=k&&S(e,g,{configurable:!0,writable:!0,value:k})}}
T("Promise",function(g){function k(d){this.b=0;this.i=void 0;this.a=[];var c=this.c();try{d(c.resolve,c.reject)}catch(D){c.reject(D)}}function e(){this.a=null}function h(d){return d instanceof k?d:new k(function(c){c(d)})}if(g)return g;e.prototype.b=function(d){if(null==this.a){this.a=[];var c=this;this.c(function(){c.i()})}this.a.push(d)};var l=R.setTimeout;e.prototype.c=function(d){l(d,0)};e.prototype.i=function(){for(;this.a&&this.a.length;){var d=this.a;this.a=[];for(var c=0;c<d.length;++c){var e=
d[c];d[c]=null;try{e()}catch(E){this.f(E)}}}this.a=null};e.prototype.f=function(d){this.c(function(){throw d;})};k.prototype.c=function(){function d(d){return function(k){e||(e=!0,d.call(c,k))}}var c=this,e=!1;return{resolve:d(this.G),reject:d(this.f)}};k.prototype.G=function(d){if(d===this)this.f(new TypeError("A Promise cannot resolve to itself"));else if(d instanceof k)this.H(d);else{a:switch(typeof d){case "object":var c=null!=d;break a;case "function":c=!0;break a;default:c=!1}c?this.F(d):this.j(d)}};
k.prototype.F=function(d){var c=void 0;try{c=d.then}catch(D){this.f(D);return}"function"==typeof c?this.I(c,d):this.j(d)};k.prototype.f=function(c){this.m(2,c)};k.prototype.j=function(c){this.m(1,c)};k.prototype.m=function(c,e){if(0!=this.b)throw Error("Cannot settle("+c+", "+e+"): Promise already settled in state"+this.b);this.b=c;this.i=e;this.u()};k.prototype.u=function(){if(null!=this.a){for(var d=0;d<this.a.length;++d)c.b(this.a[d]);this.a=null}};var c=new e;k.prototype.H=function(c){var d=this.c();
c.A(d.resolve,d.reject)};k.prototype.I=function(c,e){var d=this.c();try{c.call(e,d.resolve,d.reject)}catch(E){d.reject(E)}};k.prototype.then=function(c,e){function d(c,d){return"function"==typeof c?function(d){try{g(c(d))}catch(v){h(v)}}:d}var g,h,A=new k(function(c,d){g=c;h=d});this.A(d(c,g),d(e,h));return A};k.prototype.catch=function(c){return this.then(void 0,c)};k.prototype.A=function(d,e){function k(){switch(g.b){case 1:d(g.i);break;case 2:e(g.i);break;default:throw Error("Unexpected state: "+
g.b);}}var g=this;null==this.a?c.b(k):this.a.push(k)};k.resolve=h;k.reject=function(c){return new k(function(d,e){e(c)})};k.race=function(c){return new k(function(d,e){for(var k=L(c),g=k.next();!g.done;g=k.next())h(g.value).A(d,e)})};k.all=function(c){var d=L(c),e=d.next();return e.done?h([]):new k(function(c,k){function g(d){return function(e){l[d]=e;C--;0==C&&c(l)}}var l=[],C=0;do l.push(void 0),C++,h(e.value).A(g(l.length-1),k),e=d.next();while(!e.done)})};return k});
(function(g,k,e){var h;(h=e.define)&&h.amd?h([],function(){return k}):(h=e.modules)?h[g.toLowerCase()]=k:"object"===typeof exports?module.exports=k:e[g]=k})("FlexSearch",function X(g){function e(b){C(b)&&((b=M[b])||console.warn("Preset not found: "+b));b||(b=r);this.id=b.id||Y++;this.init(b);l(this,"index",function(){return this.a});l(this,"length",function(){return Object.keys(this.a).length})}function h(b,a,f,c){this.v!==this.h&&(this.l=this.l.concat(f),this.v++,c&&this.l.length>=c&&(this.v=this.h),
this.C&&this.v===this.h&&(this.cache&&this.o.set(a,this.l),this.C(this.l),this.l=[]));return this}function l(b,a,f){Object.defineProperty(b,a,{get:f})}function c(b){return new RegExp(b,"g")}function d(b,a){for(var f=0;f<a.length;f+=2)b=b.replace(a[f],a[f+1]);return b}function A(b,a,f,c,d,e,g){if(a[f])return a[f];d=d?(9-(g||6))*e+(g||6)*d:e;a[f]=d;d>=g&&(b=b[9-(d+.5>>0)],b=b[f]||(b[f]=[]),b[b.length]=c);return d}function D(b,a){if(b)for(var f=Object.keys(b),c=0,d=f.length;c<d;c++){var e=f[c],g=b[e];
if(g)for(var y=0,h=g.length;y<h;y++)if(g[y]===a){1===h?delete b[e]:g.splice(y,1);break}else"object"===typeof g[y]&&D(g[y],a)}}function E(b){for(var a="",f="",c="",d=0;d<b.length;d++){var e=b[d];if(e!==f)if(d&&"h"===e){if(c="a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c,("a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f)&&c||" "===f)a+=e}else a+=e;c=d===b.length-1?"":b[d+1];f=e}return a}function U(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function W(b,a){b=b.length-a.length;return 0>b?
-1:b?1:0}function V(b,a,f){var c=[],d=b.length;if(1<d){b.sort(W);for(var e=z(),g=b[0],y=g.length,h=0;h<y;)e["@"+g[h++]]=1;for(var l,F=0,q=0;++q<d;){var x=!1,u=q===d-1;var p=[];g=b[q];y=g.length;for(h=0;h<y;){l=g[h++];var m="@"+l;if(e[m]){var n=e[m];if(n===q){if(u){if(c[F++]=l,a&&F===a)return c}else e[m]=q+1;x=!0}else f&&(m=p[n]||(p[n]=[]),m[m.length]=l)}}if(!x&&!f)break}if(f&&(F=c.length,(q=p.length)&&(!a||F<a)))for(;q--;)if(l=p[q])for(h=0,y=l.length;h<y;h++)if(c[F++]=l[h],a&&F===a)return c}else d&&
(c=b[0],a&&c.length>a&&(c=c.slice(0,a)));return c}function C(b){return"string"===typeof b}function H(b){return"function"===typeof b}function v(b){return"undefined"===typeof b}function N(b){for(var a=Array(b),f=0;f<b;f++)a[f]=z();return a}function z(){return Object.create(null)}function Z(){var b,a;self.onmessage=function(f){if(f=f.data)if(f.search){var c=a.search(f.content,f.threshold?{limit:f.limit,threshold:f.threshold}:f.limit);self.postMessage({id:b,content:f.content,limit:f.limit,result:c})}else f.add?
a.add(f.id,f.content):f.update?a.update(f.id,f.content):f.remove?a.remove(f.id):f.clear?a.clear():f.info?(f=a.info(),f.worker=b,console.log(f)):f.register&&(b=f.id,f.options.cache=!1,f.options.async=!1,f.options.worker=!1,a=(new Function(f.register.substring(f.register.indexOf("{")+1,f.register.lastIndexOf("}"))))(),a=new a(f.options))}}function aa(b,a,f,c){b=g("flexsearch","id"+b,Z,function(a){(a=a.data)&&a.result&&c(a.id,a.content,a.result,a.limit)},a);var d=X.toString();f.id=a;b.postMessage({register:d,
options:f,id:a});return b}var r={encode:"icase",g:"forward",w:!1,cache:!1,async:!1,h:!1,B:!1,threshold:0,depth:0},M={memory:{encode:"extra",g:"strict",threshold:7},speed:{encode:"icase",g:"strict",threshold:7,depth:2},match:{encode:"extra",g:"full"},score:{encode:"extra",g:"strict",threshold:5,depth:4},balance:{encode:"balance",g:"strict",threshold:6,depth:3},fastest:{encode:"icase",g:"strict",threshold:9,depth:1}},J=[],Y=0,O=c("\\W+"),P={},Q={};e.create=function(b){return new e(b)};e.registerMatcher=
function(b){for(var a in b)b.hasOwnProperty(a)&&J.push(c(a),b[a]);return this};e.registerEncoder=function(b,a){G[b]=a.bind(G);return this};e.registerLanguage=function(b,a){P[b]=a.filter;Q[b]=a.stemmer;return this};e.encode=function(b,a){return G[b](a)};e.prototype.init=function(b){this.i=[];b||(b=r);var a=b.preset,f=a?M[a]:{};f||console.warn("Preset not found: "+a);if(a=b.worker)if("undefined"===typeof Worker)b.worker=!1,this.f=null;else{var d=parseInt(a,10)||4;this.u=-1;this.v=0;this.l=[];this.C=
null;this.f=Array(d);for(var e=0;e<d;e++)this.f[e]=aa(this.id,e,b,h.bind(this))}this.g=b.tokenize||f.g||this.g||r.g;this.B=b.rtl||this.B||r.B;this.async="undefined"===typeof Promise||v(a=b.async)?this.async||r.async:a;this.h=v(a=b.worker)?this.h||r.h:a;this.threshold=v(a=b.threshold)?f.threshold||this.threshold||r.threshold:a;this.depth=v(a=b.depth)?f.depth||this.depth||r.depth:a;this.w=v(a=b.suggest)?this.w||r.w:a;this.j=(a=v(a=b.encode)?f.encode:a)&&G[a]&&G[a].bind(G)||(H(a)?a:this.j||!1);(a=b.matcher)&&
this.addMatcher(a);if(a=b.filter){a=P[a]||a;f=this.j;d=z();if(a)for(e=0;e<a.length;e++){var g=f?f(a[e]):a[e];d[g]=String.fromCharCode(65E3-a.length+e)}this.filter=d}if(a=b.stemmer){f=Q[a]||a;d=this.j;e=[];if(f)for(var l in f)f.hasOwnProperty(l)&&(g=d?d(l):l,e.push(c("(?=.{"+(g.length+3)+",})"+g+"$"),d?d(f[l]):f[l]));this.stemmer=e}this.b=N(10-(this.threshold||0));this.c=z();this.a=z();this.m=!0;this.o=(this.cache=a=v(a=b.cache)?this.cache||r.cache:a)?new ba(a):!1;return this};e.prototype.encode=function(b){b&&
J.length&&(b=d(b,J));b&&this.i.length&&(b=d(b,this.i));b&&this.j&&(b=this.j(b));b&&this.stemmer&&(b=d(b,this.stemmer));return b};e.prototype.addMatcher=function(b){var a=this.i,f;for(f in b)b.hasOwnProperty(f)&&a.push(c(f),b[f]);return this};e.prototype.add=function(b,a,f,c,d){if(a&&C(a)&&(b||0===b)){var e="@"+b;if(this.a[e]&&!c)return this.update(b,a);if(this.h)return++this.u>=this.f.length&&(this.u=0),this.f[this.u].postMessage({add:!0,id:b,content:a}),this.a[e]=""+this.u,f&&f(),this;if(!d){if(this.async&&
"function"!==typeof importScripts){var g=this;e=new Promise(function(f){setTimeout(function(){g.add(b,a,null,c,!0);g=null;f()})});if(f)e.then(f);else return e;return this}if(f)return this.add(b,a,null,c,!0),f(),this}a=this.encode(a);if(!a.length)return this;f=this.g;d=H(f)?f(a):a.split(O);var h=z();h._ctx=z();for(var B=this.threshold,l=this.depth,I=this.b,q=d.length,x=this.B,u=0;u<q;u++){var p=d[u];if(p){var m=p.length,n=(x?u+1:q-u)/q,w="";switch(f){case "reverse":case "both":for(var t=m;--t;)w=p[t]+
w,A(I,h,w,b,x?1:(m-t)/m,n,B);w="";case "forward":for(t=0;t<m;t++)w+=p[t],A(I,h,w,b,x?(t+1)/m:1,n,B);break;case "full":for(t=0;t<m;t++)for(var v=(x?t+1:m-t)/m,r=m;r>t;r--)w=p.substring(t,r),A(I,h,w,b,v,n,B);break;default:if(m=A(I,h,p,b,1,n,B),l&&1<q&&m>=B)for(m=h._ctx[p]||(h._ctx[p]=z()),p=this.c[p]||(this.c[p]=N(10-(B||0))),n=u-l,w=u+l+1,0>n&&(n=0),w>q&&(w=q);n<w;n++)n!==u&&A(p,m,d[n],b,0,10-(n<u?u-n:n-u),B)}}}this.a[e]=1;this.m=!1}return this};e.prototype.update=function(b,a,f){this.a["@"+b]&&C(a)&&
(this.remove(b),this.add(b,a,f,!0));return this};e.prototype.remove=function(b,a,f){var c="@"+b;if(this.a[c]){if(this.h)return this.f[this.a[c]].postMessage({remove:!0,id:b}),delete this.a[c],a&&a(),this;if(!f){if(this.async&&"function"!==typeof importScripts){var d=this;c=new Promise(function(a){setTimeout(function(){d.remove(b,null,!0);d=null;a()})});if(a)c.then(a);else return c;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)D(this.b[a],b);this.depth&&
D(this.c,b);delete this.a[c];this.m=!1}return this};e.prototype.search=function(b,a,c,d){var f=b,e=[];if("object"===typeof b){(c=b.callback||a)&&(f.callback=null);a=b.limit;var g=b.threshold;b=b.query}g||(g=this.threshold||0);H(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(this.h)for(this.C=c,this.v=0,this.l=[],e=0;e<this.h;e++)this.f[e].postMessage({search:!0,limit:a,threshold:g,content:b});else{if(!d){if(this.async&&"function"!==typeof importScripts){var h=this;b=new Promise(function(b){setTimeout(function(){b(h.search(f,
a,null,!0));h=null})});if(c)b.then(c);else return b;return this}if(c)return c(this.search(f,a,null,!0)),this}if(!b||!C(b))return e;f=b;if(this.cache)if(this.m){if(c=this.o.get(b))return c}else this.o.clear(),this.m=!0;f=this.encode(f);if(!f.length)return e;c=this.g;c=H(c)?c(f):f.split(O);d=c.length;var l=!0,B=[],r=z();if(1<d)if(this.depth){var q=!0;var x=c[0];r[x]=1}else c.sort(U);var u;if(!q||(u=this.c)[x])for(var p=q?1:0;p<d;p++){var m=c[p];if(m){if(!r[m]){var n=[],w=!1,t=0;if(x=q?u[x]:this.b)for(var v=
void 0,A=0;A<10-g;A++)if(v=x[A][m])n[t++]=v,w=!0;if(w)B[B.length]=1<t?n.concat.apply([],n):n[0];else if(!this.w){l=!1;break}r[m]=1}x=m}}else l=!1;l&&(e=V(B,a,this.w));this.cache&&this.o.set(b,e);return e}};e.prototype.info=function(){if(this.h)for(var b=0;b<this.h;b++)this.f[b].postMessage({info:!0,id:this.id});else{for(var a,c=0,d=0,e=0,g=0;g<10-(this.threshold||0);g++){b=Object.keys(this.b[g]);for(var h=0;h<b.length;h++)a=this.b[g][b[h]].length,c+=1*a+2*b[h].length+4,d+=a,e+=2*b[h].length}b=Object.keys(this.a);
a=b.length;for(g=0;g<a;g++)c+=2*b[g].length+2;return{id:this.id,memory:c,items:a,sequences:d,chars:e,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:J.length+(this.i?this.i.length:0),worker:this.h,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.g}}};e.prototype.clear=function(){return this.destroy().init()};e.prototype.destroy=function(){this.cache&&(this.o.clear(),this.o=null);this.b=this.c=this.a=null;return this};e.prototype.export=function(){return JSON.stringify([this.b,
this.c,this.a])};e.prototype.import=function(b){b=JSON.parse(b);this.b=b[0];this.c=b[1];this.a=b[2]};var G={icase:function(b){return b.toLowerCase()},simple:function(){var b=[c("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",c("[\u00e8\u00e9\u00ea\u00eb]"),"e",c("[\u00ec\u00ed\u00ee\u00ef]"),"i",c("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",c("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",c("[\u00fd\u0177\u00ff]"),"y",c("\u00f1"),"n",c("\u00e7"),"c",c("\u00df"),"s",c(" & ")," and ",c("[-/]")," ",c("[^a-z0-9 ]"),
"",c("\\s+")," "];return function(a){a=d(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){var b=[c("ae"),"a",c("ai"),"ei",c("ay"),"ei",c("ey"),"ei",c("oe"),"o",c("ue"),"u",c("ie"),"i",c("sz"),"s",c("zs"),"s",c("sh"),"s",c("ck"),"k",c("cc"),"k",c("dt"),"t",c("ph"),"f",c("pf"),"f",c("ou"),"o",c("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=d(a,b));c||1<a.length&&(a=E(a));return a}}(),extra:function(){var b=[c("p"),"b",c("z"),"s",c("[cgq]"),"k",c("n"),"m",
c("d"),"t",c("[vw]"),"f",c("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(var c=0;c<a.length;c++){var e=a[c];1<e.length&&(a[c]=e[0]+d(e.substring(1),b))}a=a.join(" ");a=E(a)}return a}}(),balance:function(){var b=[c("[-/]")," ",c("[^a-z0-9 ]"),"",c("\\s+")," "];return function(a){return E(d(a.toLowerCase(),b))}}()},ba=function(){function b(a){this.clear();this.D=!0!==a&&a}b.prototype.clear=function(){this.cache=z();this.count=z();this.index=
z();this.s=[]};b.prototype.set=function(a,b){if(this.D&&v(this.cache[a])){var c=this.s.length;if(c===this.D){c--;var e=this.s[c];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[a]=c;this.s[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){var b=this.cache[a];if(this.D&&b){var c=++this.count[a],e=this.index,d=e[a];if(0<d){for(var g=this.s,h=d;this.count[g[--d]]<=c&&-1!==d;);d++;if(d!==h){for(c=h;c>d;c--)h=g[c-1],g[c]=h,e[h]=
c;g[d]=a;e[a]=d}}}return b};return b}();return e}(function(){var g={},k="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(e,h,l,c,d){l=k?URL.createObjectURL(new Blob(["("+l.toString()+")()"],{type:"text/javascript"})):e+".es5.js";e+="-"+h;g[e]||(g[e]=[]);g[e][d]=new Worker(l);g[e][d].onmessage=c;console.log("Register Worker: "+e+"@"+d);return g[e][d]}}()),this);

View File

@@ -1,18 +1,18 @@
/*
FlexSearch v0.3.51
FlexSearch v0.3.61
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(e,u,v){let m;(m=v.define)&&m.amd?m([],function(){return u}):(m=v.modules)?m[e.toLowerCase()]=u:"object"===typeof exports?module.exports=u:v[e]=u})("FlexSearch",function(){function e(a){a||(a=x);this.id=a.id||G++;this.init(a);u(this,"index",function(){return this.a});u(this,"length",function(){return Object.keys(this.a).length})}function u(a,b,c){Object.defineProperty(a,b,{get:c})}function v(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function m(a,b,c,
f,d,n,g){if(b[c])return b[c];d=d?(9-(g||6))*n+(g||6)*d:n;b[c]=d;d>=g&&(a=a[9-(d+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=f);return d}function z(a,b){if(a){const c=Object.keys(a);for(let f=0,d=c.length;f<d;f++){const d=c[f],g=a[d];if(g)for(let c=0,f=g.length;c<f;c++)if(g[c]===b){1===f?delete a[d]:g.splice(c,1);break}else"object"===typeof g[c]&&z(g[c],b)}}}function H(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function I(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function y(a){return"function"===typeof a}
function A(a){return"undefined"===typeof a}function C(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=t();return b}function t(){return Object.create(null)}const x={encode:"icase",b:"forward",i:!1,cache:!1,async:!1,j:!1,threshold:0,depth:0},B=[];let G=0;const D=/\W+/g,E={},F={};e.create=function(a){return new e(a)};e.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&B.push(new RegExp(b,"g"),a[b]);return this};e.registerEncoder=function(a,b){w[a]=b.bind(w);return this};e.registerLanguage=
function(a,b){E[a]=b.filter;F[a]=b.stemmer;return this};e.encode=function(a,b){return w[a](b)};e.prototype.init=function(a){this.h=[];a||(a=x);var b=a.preset,c={};this.b=a.tokenize||c.b||this.b||x.b;this.threshold=A(b=a.threshold)?c.threshold||this.threshold||x.threshold:b;this.depth=A(b=a.depth)?c.depth||this.depth||x.depth:b;this.f=(b=A(b=a.encode)?c.encode:b)&&w[b]&&w[b].bind(w)||(y(b)?b:this.f||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){b=E[b]||b;c=this.f;var f=t();if(b)for(let a=0;a<
b.length;a++){const d=c?c(b[a]):b[a];f[d]=String.fromCharCode(65E3-b.length+a)}this.filter=b=f}if(b=a.stemmer){var d;a=F[b]||b;b=this.f;c=[];if(a)for(d in a)a.hasOwnProperty(d)&&(f=b?b(d):d,c.push(new RegExp("(?=.{"+(f.length+3)+",})"+f+"$","g"),b?b(a[d]):a[d]));this.stemmer=d=c}this.g=C(10-(this.threshold||0));this.c=t();this.a=t();return this};e.prototype.encode=function(a){a&&B.length&&(a=v(a,B));a&&this.h.length&&(a=v(a,this.h));a&&this.f&&(a=this.f(a));a&&this.stemmer&&(a=v(a,this.stemmer));
return a};e.prototype.addMatcher=function(a){const b=this.h;for(const c in a)a.hasOwnProperty(c)&&b.push(new RegExp(c,"g"),a[c]);return this};e.prototype.add=function(a,b,c,f,d){if(b&&"string"===typeof b&&(a||0===a)){const e="@"+a;if(this.a[e]&&!f)return this.update(a,b);if(!d&&c)return this.add(a,b,null,f,!0),c(),this;b=this.encode(b);if(!b.length)return this;c=this.b;b=y(c)?c(b):b.split(D);f=t();f._ctx=t();d=this.threshold;const r=this.depth,q=this.g,p=b.length;for(let e=0;e<p;e++){var n=b[e];if(n){var g=
n.length,k=(p-e)/p,l="";switch(c){case "reverse":case "both":for(var h=g-1;1<=h;h--)l=n[h]+l,m(q,f,l,a,(g-h)/g,k,d);l="";case "forward":for(h=0;h<g;h++)l+=n[h],m(q,f,l,a,1,k,d);break;case "full":for(h=0;h<g;h++){const b=(g-h)/g;for(let c=g;c>h;c--)l=n.substring(h,c),m(q,f,l,a,b,k,d)}break;default:if(g=m(q,f,n,a,1,k,d),r&&1<p&&g>=d)for(g=f._ctx[n]||(f._ctx[n]=t()),n=this.c[n]||(this.c[n]=C(10-(d||0))),k=e-r,l=e+r+1,0>k&&(k=0),l>p&&(l=p);k<l;k++)k!==e&&m(n,g,b[k],a,0,10-(k<e?e-k:k-e),d)}}}this.a[e]=
1}return this};e.prototype.update=function(a,b,c){this.a["@"+a]&&"string"===typeof b&&(this.remove(a),this.add(a,b,c,!0));return this};e.prototype.remove=function(a,b,c){const f="@"+a;if(this.a[f]){if(!c&&b)return this.remove(a,null,!0),b(),this;for(b=0;b<10-(this.threshold||0);b++)z(this.g[b],a);this.depth&&z(this.c,a);delete this.a[f]}return this};e.prototype.search=function(a,b,c,f){var d=a,e=[];if("object"===typeof a){b=a.limit;var g=a.threshold;a=a.query}g||(g=this.threshold||0);y(b)?(c=b,b=
1E3):b||0===b||(b=1E3);if(!f&&c)return c(this.search(d,b,null,!0)),this;if(!a||"string"!==typeof a)return e;d=this.encode(a);if(!d.length)return e;a=this.b;a=y(a)?a(d):d.split(D);c=a.length;f=!0;d=[];var k=t();if(1<c)if(this.depth){var l=!0;var h=a[0];k[h]=1}else a.sort(H);var m;if(!l||(m=this.c)[h])for(var r=l?1:0;r<c;r++){var q=a[r];if(q){if(!k[q]){var p=[];let a=!1,b=0;if(h=l?m[h]:this.g){let c;for(let d=0;d<10-g;d++)if(c=h[d][q])p[b++]=c,a=!0}if(a)d[d.length]=1<b?p.concat.apply([],p):p[0];else{f=
!1;break}k[q]=1}h=q}}else f=!1;if(f)a:{g=[];e=d.length;if(1<e){d.sort(I);l=t();m=d[0];h=m.length;for(a=0;a<h;)l["@"+m[a++]]=1;for(k=f=0;++k<e;){r=!1;q=k===e-1;m=d[k];h=m.length;for(a=0;a<h;)if(c=m[a++],p="@"+c,l[p]&&l[p]===k){if(q){if(g[f++]=c,b&&f===b){e=g;break a}}else l[p]=k+1;r=!0}if(!r)break}}else e&&(g=d[0],b&&g.length>b&&(g=g.slice(0,b)));e=g}return e};e.prototype.clear=function(){return this.destroy().init()};e.prototype.destroy=function(){this.g=this.c=this.a=null;return this};const w={icase:function(a){return a.toLowerCase()}};
return e}(!1),this);
'use strict';(function(e,l,u){let n;(n=u.define)&&n.amd?n([],function(){return l}):(n=u.modules)?n[e.toLowerCase()]=l:"object"===typeof exports?module.exports=l:u[e]=l})("FlexSearch",function(){function e(a){a||(a=v);this.id=a.id||G++;this.init(a);l(this,"index",function(){return this.a});l(this,"length",function(){return Object.keys(this.a).length})}function l(a,b,c){Object.defineProperty(a,b,{get:c})}function u(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function n(a,b,c,
f,d,p,g){if(b[c])return b[c];d=d?(9-(g||6))*p+(g||6)*d:p;b[c]=d;d>=g&&(a=a[9-(d+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=f);return d}function y(a,b){if(a){const c=Object.keys(a);for(let f=0,d=c.length;f<d;f++){const d=c[f],g=a[d];if(g)for(let c=0,f=g.length;c<f;c++)if(g[c]===b){1===f?delete a[d]:g.splice(c,1);break}else"object"===typeof g[c]&&y(g[c],b)}}}function H(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function I(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function x(a){return"function"===typeof a}
function z(a){return"undefined"===typeof a}function C(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=t();return b}function t(){return Object.create(null)}const v={encode:"icase",b:"forward",j:!1,cache:!1,async:!1,l:!1,h:!1,threshold:0,depth:0},A=[];let G=0;const D=/\W+/g,E={},F={};e.create=function(a){return new e(a)};e.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&A.push(new RegExp(b,"g"),a[b]);return this};e.registerEncoder=function(a,b){w[a]=b.bind(w);return this};e.registerLanguage=
function(a,b){E[a]=b.filter;F[a]=b.stemmer;return this};e.encode=function(a,b){return w[a](b)};e.prototype.init=function(a){this.i=[];a||(a=v);var b=a.preset,c={};this.b=a.tokenize||c.b||this.b||v.b;this.h=a.rtl||this.h||v.h;this.threshold=z(b=a.threshold)?c.threshold||this.threshold||v.threshold:b;this.depth=z(b=a.depth)?c.depth||this.depth||v.depth:b;this.f=(b=z(b=a.encode)?c.encode:b)&&w[b]&&w[b].bind(w)||(x(b)?b:this.f||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){b=E[b]||b;c=this.f;var f=
t();if(b)for(let a=0;a<b.length;a++){const d=c?c(b[a]):b[a];f[d]=String.fromCharCode(65E3-b.length+a)}this.filter=b=f}if(b=a.stemmer){var d;a=F[b]||b;b=this.f;c=[];if(a)for(d in a)a.hasOwnProperty(d)&&(f=b?b(d):d,c.push(new RegExp("(?=.{"+(f.length+3)+",})"+f+"$","g"),b?b(a[d]):a[d]));this.stemmer=d=c}this.g=C(10-(this.threshold||0));this.c=t();this.a=t();return this};e.prototype.encode=function(a){a&&A.length&&(a=u(a,A));a&&this.i.length&&(a=u(a,this.i));a&&this.f&&(a=this.f(a));a&&this.stemmer&&
(a=u(a,this.stemmer));return a};e.prototype.addMatcher=function(a){const b=this.i;for(const c in a)a.hasOwnProperty(c)&&b.push(new RegExp(c,"g"),a[c]);return this};e.prototype.add=function(a,b,c,f,d){if(b&&"string"===typeof b&&(a||0===a)){const e="@"+a;if(this.a[e]&&!f)return this.update(a,b);if(!d&&c)return this.add(a,b,null,f,!0),c(),this;b=this.encode(b);if(!b.length)return this;c=this.b;b=x(c)?c(b):b.split(D);f=t();f._ctx=t();d=this.threshold;const B=this.depth,r=this.g,q=b.length,l=this.h;for(let e=
0;e<q;e++){var p=b[e];if(p){var g=p.length,k=(l?e+1:q-e)/q,m="";switch(c){case "reverse":case "both":for(var h=g;--h;)m=p[h]+m,n(r,f,m,a,l?1:(g-h)/g,k,d);m="";case "forward":for(h=0;h<g;h++)m+=p[h],n(r,f,m,a,l?(h+1)/g:1,k,d);break;case "full":for(h=0;h<g;h++){const b=(l?h+1:g-h)/g;for(let c=g;c>h;c--)m=p.substring(h,c),n(r,f,m,a,b,k,d)}break;default:if(g=n(r,f,p,a,1,k,d),B&&1<q&&g>=d)for(g=f._ctx[p]||(f._ctx[p]=t()),p=this.c[p]||(this.c[p]=C(10-(d||0))),k=e-B,m=e+B+1,0>k&&(k=0),m>q&&(m=q);k<m;k++)k!==
e&&n(p,g,b[k],a,0,10-(k<e?e-k:k-e),d)}}}this.a[e]=1}return this};e.prototype.update=function(a,b,c){this.a["@"+a]&&"string"===typeof b&&(this.remove(a),this.add(a,b,c,!0));return this};e.prototype.remove=function(a,b,c){const f="@"+a;if(this.a[f]){if(!c&&b)return this.remove(a,null,!0),b(),this;for(b=0;b<10-(this.threshold||0);b++)y(this.g[b],a);this.depth&&y(this.c,a);delete this.a[f]}return this};e.prototype.search=function(a,b,c,f){var d=a,e=[];if("object"===typeof a){b=a.limit;var g=a.threshold;
a=a.query}g||(g=this.threshold||0);x(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(!f&&c)return c(this.search(d,b,null,!0)),this;if(!a||"string"!==typeof a)return e;d=this.encode(a);if(!d.length)return e;a=this.b;a=x(a)?a(d):d.split(D);c=a.length;f=!0;d=[];var k=t();if(1<c)if(this.depth){var m=!0;var h=a[0];k[h]=1}else a.sort(H);var l;if(!m||(l=this.c)[h])for(var n=m?1:0;n<c;n++){var r=a[n];if(r){if(!k[r]){var q=[];let a=!1,b=0;if(h=m?l[h]:this.g){let c;for(let d=0;d<10-g;d++)if(c=h[d][r])q[b++]=c,a=!0}if(a)d[d.length]=
1<b?q.concat.apply([],q):q[0];else{f=!1;break}k[r]=1}h=r}}else f=!1;if(f)a:{g=[];e=d.length;if(1<e){d.sort(I);m=t();l=d[0];h=l.length;for(a=0;a<h;)m["@"+l[a++]]=1;for(k=f=0;++k<e;){n=!1;r=k===e-1;l=d[k];h=l.length;for(a=0;a<h;)if(c=l[a++],q="@"+c,m[q]&&m[q]===k){if(r){if(g[f++]=c,b&&f===b){e=g;break a}}else m[q]=k+1;n=!0}if(!n)break}}else e&&(g=d[0],b&&g.length>b&&(g=g.slice(0,b)));e=g}return e};e.prototype.clear=function(){return this.destroy().init()};e.prototype.destroy=function(){this.g=this.c=
this.a=null;return this};const w={icase:function(a){return a.toLowerCase()}};return e}(!1),this);

View File

@@ -1,30 +1,30 @@
/*
FlexSearch v0.3.51
FlexSearch v0.3.61
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(u,z,h){let v;(v=h.define)&&v.amd?v([],function(){return z}):(v=h.modules)?v[u.toLowerCase()]=z:"object"===typeof exports?module.exports=z:h[u]=z})("FlexSearch",function P(u){function h(b){D(b)&&(b=J[b]);b||(b=w);this.id=b.id||Q++;this.init(b);A(this,"index",function(){return this.a});A(this,"length",function(){return Object.keys(this.a).length})}function v(b,a,c,d){this.m!==this.c&&(this.g=this.g.concat(c),this.m++,d&&this.g.length>=d&&(this.m=this.c),this.A&&this.m===this.c&&
(this.cache&&this.j.set(a,this.g),this.A(this.g),this.g=[]));return this}function A(b,a,c){Object.defineProperty(b,a,{get:c})}function f(b){return new RegExp(b,"g")}function m(b,a){for(let c=0;c<a.length;c+=2)b=b.replace(a[c],a[c+1]);return b}function C(b,a,c,d,e,l,g){if(a[c])return a[c];e=e?(9-(g||6))*l+(g||6)*e:l;a[c]=e;e>=g&&(b=b[9-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=d);return e}function H(b,a){if(b){const c=Object.keys(b);for(let d=0,e=c.length;d<e;d++){const e=c[d],g=b[e];if(g)for(let c=
0,d=g.length;c<d;c++)if(g[c]===a){1===d?delete b[e]:g.splice(c,1);break}else"object"===typeof g[c]&&H(g[c],a)}}}function I(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const l=b[e];if(l!==c)if(e&&"h"===l){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=l}else a+=l;d=e===b.length-1?"":b[e+1];c=l}return a}function R(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function S(b,a){b=b.length-a.length;return 0>b?-1:b?
1:0}function T(b,a,c){let d=[],e;const l=b.length;if(1<l){b.sort(S);const f=r();let h=b[0],n=h.length,k=0;for(;k<n;)f["@"+h[k++]]=1;let y,q=0,t=0;for(;++t<l;){let K=!1;const p=t===l-1;e=[];h=b[t];n=h.length;for(k=0;k<n;){y=h[k++];var g="@"+y;if(f[g]){const b=f[g];if(b===t){if(p){if(d[q++]=y,a&&q===a)return d}else f[g]=t+1;K=!0}else c&&(g=e[b]||(e[b]=[]),g[g.length]=y)}}if(!K&&!c)break}if(c&&(q=d.length,(t=e.length)&&(!a||q<a)))for(;t--;)if(y=e[t])for(k=0,n=y.length;k<n;k++)if(d[q++]=y[k],a&&q===a)return d}else l&&
(d=b[0],a&&d.length>a&&(d=d.slice(0,a)));return d}function D(b){return"string"===typeof b}function F(b){return"function"===typeof b}function x(b){return"undefined"===typeof b}function L(b){const a=Array(b);for(let c=0;c<b;c++)a[c]=r();return a}function r(){return Object.create(null)}function U(){let b,a;self.onmessage=function(c){if(c=c.data)if(c.search){const d=a.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold}:c.limit);self.postMessage({id:b,content:c.content,limit:c.limit,result:d})}else c.add?
'use strict';(function(u,A,h){let w;(w=h.define)&&w.amd?w([],function(){return A}):(w=h.modules)?w[u.toLowerCase()]=A:"object"===typeof exports?module.exports=A:h[u]=A})("FlexSearch",function P(u){function h(b){E(b)&&(b=K[b]);b||(b=v);this.id=b.id||Q++;this.init(b);B(this,"index",function(){return this.a});B(this,"length",function(){return Object.keys(this.a).length})}function w(b,a,c,d){this.m!==this.c&&(this.g=this.g.concat(c),this.m++,d&&this.g.length>=d&&(this.m=this.c),this.B&&this.m===this.c&&
(this.cache&&this.j.set(a,this.g),this.B(this.g),this.g=[]));return this}function B(b,a,c){Object.defineProperty(b,a,{get:c})}function f(b){return new RegExp(b,"g")}function m(b,a){for(let c=0;c<a.length;c+=2)b=b.replace(a[c],a[c+1]);return b}function D(b,a,c,d,e,l,g){if(a[c])return a[c];e=e?(9-(g||6))*l+(g||6)*e:l;a[c]=e;e>=g&&(b=b[9-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=d);return e}function I(b,a){if(b){const c=Object.keys(b);for(let d=0,e=c.length;d<e;d++){const e=c[d],g=b[e];if(g)for(let c=
0,d=g.length;c<d;c++)if(g[c]===a){1===d?delete b[e]:g.splice(c,1);break}else"object"===typeof g[c]&&I(g[c],a)}}}function J(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const l=b[e];if(l!==c)if(e&&"h"===l){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=l}else a+=l;d=e===b.length-1?"":b[e+1];c=l}return a}function R(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function S(b,a){b=b.length-a.length;return 0>b?-1:b?
1:0}function T(b,a,c){let d=[],e;const l=b.length;if(1<l){b.sort(S);const f=r();let h=b[0],n=h.length,k=0;for(;k<n;)f["@"+h[k++]]=1;let z,q=0,t=0;for(;++t<l;){let y=!1;const p=t===l-1;e=[];h=b[t];n=h.length;for(k=0;k<n;){z=h[k++];var g="@"+z;if(f[g]){const b=f[g];if(b===t){if(p){if(d[q++]=z,a&&q===a)return d}else f[g]=t+1;y=!0}else c&&(g=e[b]||(e[b]=[]),g[g.length]=z)}}if(!y&&!c)break}if(c&&(q=d.length,(t=e.length)&&(!a||q<a)))for(;t--;)if(z=e[t])for(k=0,n=z.length;k<n;k++)if(d[q++]=z[k],a&&q===a)return d}else l&&
(d=b[0],a&&d.length>a&&(d=d.slice(0,a)));return d}function E(b){return"string"===typeof b}function G(b){return"function"===typeof b}function x(b){return"undefined"===typeof b}function L(b){const a=Array(b);for(let c=0;c<b;c++)a[c]=r();return a}function r(){return Object.create(null)}function U(){let b,a;self.onmessage=function(c){if(c=c.data)if(c.search){const d=a.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold}:c.limit);self.postMessage({id:b,content:c.content,limit:c.limit,result:d})}else c.add?
a.add(c.id,c.content):c.update?a.update(c.id,c.content):c.remove?a.remove(c.id):c.clear?a.clear():c.info?(c=a.info(),c.worker=b,console.log(c)):c.register&&(b=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,a=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),a=new a(c.options))}}function V(b,a,c,d){b=u("flexsearch","id"+b,U,function(a){(a=a.data)&&a.result&&d(a.id,a.content,a.result,a.limit)},a);const e=P.toString();c.id=a;b.postMessage({register:e,
options:c,id:a});return b}const w={encode:"icase",b:"forward",u:!1,cache:!1,async:!1,c:!1,threshold:0,depth:0},J={memory:{encode:"extra",b:"strict",threshold:7},speed:{encode:"icase",b:"strict",threshold:7,depth:2},match:{encode:"extra",b:"full"},score:{encode:"extra",b:"strict",threshold:5,depth:4},balance:{encode:"balance",b:"strict",threshold:6,depth:3},fastest:{encode:"icase",b:"strict",threshold:9,depth:1}},G=[];let Q=0;const M=f("\\W+"),N={},O={};h.create=function(b){return new h(b)};h.registerMatcher=
function(b){for(const a in b)b.hasOwnProperty(a)&&G.push(f(a),b[a]);return this};h.registerEncoder=function(b,a){B[b]=a.bind(B);return this};h.registerLanguage=function(b,a){N[b]=a.filter;O[b]=a.stemmer;return this};h.encode=function(b,a){return B[b](a)};h.prototype.init=function(b){this.o=[];b||(b=w);var a=b.preset,c=a?J[a]:{};if(a=b.worker)if("undefined"===typeof Worker)b.worker=!1,this.i=null;else{var d=parseInt(a,10)||4;this.w=-1;this.m=0;this.g=[];this.A=null;this.i=Array(d);for(var e=0;e<d;e++)this.i[e]=
V(this.id,e,b,v.bind(this))}this.b=b.tokenize||c.b||this.b||w.b;this.async="undefined"===typeof Promise||x(a=b.async)?this.async||w.async:a;this.c=x(a=b.worker)?this.c||w.c:a;this.threshold=x(a=b.threshold)?c.threshold||this.threshold||w.threshold:a;this.depth=x(a=b.depth)?c.depth||this.depth||w.depth:a;this.u=x(a=b.suggest)?this.u||w.u:a;this.s=(a=x(a=b.encode)?c.encode:a)&&B[a]&&B[a].bind(B)||(F(a)?a:this.s||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=N[a]||a;c=this.s;d=r();if(a)for(e=
0;e<a.length;e++){var l=c?c(a[e]):a[e];d[l]=String.fromCharCode(65E3-a.length+e)}this.filter=a=d}if(a=b.stemmer){var g;c=O[a]||a;d=this.s;e=[];if(c)for(g in c)c.hasOwnProperty(g)&&(l=d?d(g):g,e.push(f("(?=.{"+(l.length+3)+",})"+l+"$"),d?d(c[g]):c[g]));this.stemmer=g=e}this.f=L(10-(this.threshold||0));this.h=r();this.a=r();this.v=!0;this.j=(this.cache=a=x(a=b.cache)?this.cache||w.cache:a)?new W(a):!1;return this};h.prototype.encode=function(b){b&&G.length&&(b=m(b,G));b&&this.o.length&&(b=m(b,this.o));
b&&this.s&&(b=this.s(b));b&&this.stemmer&&(b=m(b,this.stemmer));return b};h.prototype.addMatcher=function(b){const a=this.o;for(const c in b)b.hasOwnProperty(c)&&a.push(f(c),b[c]);return this};h.prototype.add=function(b,a,c,d,e){if(a&&D(a)&&(b||0===b)){var f="@"+b;if(this.a[f]&&!d)return this.update(b,a);if(this.c)return++this.w>=this.i.length&&(this.w=0),this.i[this.w].postMessage({add:!0,id:b,content:a}),this.a[f]=""+this.w,c&&c(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let e=
this;f=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=null;c()})});if(c)f.then(c);else return f;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.b;e=F(c)?c(a):a.split(M);const l=r();l._ctx=r();const q=this.threshold,t=this.depth,E=this.f,m=e.length;for(let a=0;a<m;a++){var g=e[a];if(g){var h=g.length,p=(m-a)/m,n="";switch(c){case "reverse":case "both":for(var k=h-1;1<=k;k--)n=g[k]+n,C(E,l,n,b,(h-k)/h,p,q);n="";case "forward":for(k=
0;k<h;k++)n+=g[k],C(E,l,n,b,1,p,q);break;case "full":for(k=0;k<h;k++){const a=(h-k)/h;for(let c=h;c>k;c--)n=g.substring(k,c),C(E,l,n,b,a,p,q)}break;default:if(h=C(E,l,g,b,1,p,q),t&&1<m&&h>=q)for(h=l._ctx[g]||(l._ctx[g]=r()),g=this.h[g]||(this.h[g]=L(10-(q||0))),p=a-t,n=a+t+1,0>p&&(p=0),n>m&&(n=m);p<n;p++)p!==a&&C(g,h,e[p],b,0,10-(p<a?a-p:p-a),q)}}}this.a[f]=1;this.v=!1}return this};h.prototype.update=function(b,a,c){this.a["@"+b]&&D(a)&&(this.remove(b),this.add(b,a,c,!0));return this};h.prototype.remove=
function(b,a,c){var d="@"+b;if(this.a[d]){if(this.c)return this.i[this.a[d]].postMessage({remove:!0,id:b}),delete this.a[d],a&&a(),this;if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)H(this.f[a],b);this.depth&&H(this.h,b);delete this.a[d];this.v=!1}return this};h.prototype.search=
function(b,a,c,d){let e=b,f;var g=[];"object"===typeof b&&((c=b.callback||a)&&(e.callback=null),a=b.limit,f=b.threshold,b=b.query);f||(f=this.threshold||0);F(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(this.c)for(this.A=c,this.m=0,this.g=[],g=0;g<this.c;g++)this.i[g].postMessage({search:!0,limit:a,threshold:f,content:b});else{if(!d){if(this.async&&"function"!==typeof importScripts){let d=this;b=new Promise(function(b){setTimeout(function(){b(d.search(e,a,null,!0));d=null})});if(c)b.then(c);else return b;
return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!D(b))return g;e=b;if(this.cache)if(this.v){if(c=this.j.get(b))return c}else this.j.clear(),this.v=!0;e=this.encode(e);if(!e.length)return g;c=this.b;c=F(c)?c(e):e.split(M);d=c.length;var h=!0,p=[],n=r();if(1<d)if(this.depth){var k=!0;var m=c[0];n[m]=1}else c.sort(R);var q;if(!k||(q=this.h)[m])for(let a=k?1:0;a<d;a++){const b=c[a];if(b){if(!n[b]){const a=[];let c=!1,d=0;if(m=k?q[m]:this.f){let e;for(let g=0;g<10-f;g++)if(e=m[g][b])a[d++]=
e,c=!0}if(c)p[p.length]=1<d?a.concat.apply([],a):a[0];else if(!this.u){h=!1;break}n[b]=1}m=b}}else h=!1;h&&(g=T(p,a,this.u));this.cache&&this.j.set(b,g);return g}};h.prototype.info=function(){if(this.c)for(var b=0;b<this.c;b++)this.i[b].postMessage({info:!0,id:this.id});else{var a=0,c=0,d=0;for(var e=0;e<10-(this.threshold||0);e++){b=Object.keys(this.f[e]);for(let g=0;g<b.length;g++){var f=this.f[e][b[g]].length;a+=1*f+2*b[g].length+4;c+=f;d+=2*b[g].length}}b=Object.keys(this.a);f=b.length;for(e=
0;e<f;e++)a+=2*b[e].length+2;return{id:this.id,memory:a,items:f,sequences:c,chars:d,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:G.length+(this.o?this.o.length:0),worker:this.c,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.b}}};h.prototype.clear=function(){return this.destroy().init()};h.prototype.destroy=function(){this.cache&&(this.j.clear(),this.j=null);this.f=this.h=this.a=null;return this};h.prototype.export=function(){return JSON.stringify([this.f,
this.h,this.a])};h.prototype.import=function(b){b=JSON.parse(b);this.f=b[0];this.h=b[1];this.a=b[2]};const B={icase:function(b){return b.toLowerCase()},simple:function(){const b=[f("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",f("[\u00e8\u00e9\u00ea\u00eb]"),"e",f("[\u00ec\u00ed\u00ee\u00ef]"),"i",f("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",f("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",f("[\u00fd\u0177\u00ff]"),"y",f("\u00f1"),"n",f("\u00e7"),"c",f("\u00df"),"s",f(" & ")," and ",f("[-/]")," ",f("[^a-z0-9 ]"),
"",f("\\s+")," "];return function(a){a=m(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[f("ae"),"a",f("ai"),"ei",f("ay"),"ei",f("ey"),"ei",f("oe"),"o",f("ue"),"u",f("ie"),"i",f("sz"),"s",f("zs"),"s",f("sh"),"s",f("ck"),"k",f("cc"),"k",f("dt"),"t",f("ph"),"f",f("pf"),"f",f("ou"),"o",f("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=m(a,b));c||1<a.length&&(a=I(a));return a}}(),extra:function(){const b=[f("p"),"b",f("z"),"s",f("[cgq]"),"k",f("n"),
"m",f("d"),"t",f("[vw]"),"f",f("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+m(d.substring(1),b))}a=a.join(" ");a=I(a)}return a}}(),balance:function(){const b=[f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(a){return I(m(a.toLowerCase(),b))}}()},W=function(){function b(a){this.clear();this.B=!0!==a&&a}b.prototype.clear=function(){this.cache=r();this.count=r();this.index=
r();this.l=[]};b.prototype.set=function(a,b){if(this.B&&x(this.cache[a])){let c=this.l.length;if(c===this.B){c--;const a=this.l[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.l[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.B&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.l;for(var e=c;this.count[f[--c]]<=d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=
f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};return b}();return h}(function(){const u={},z="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(h,v,A,f,m){A=z?URL.createObjectURL(new Blob(["("+A.toString()+")()"],{type:"text/javascript"})):h+".min.js";h+="-"+v;u[h]||(u[h]=[]);u[h][m]=new Worker(A);u[h][m].onmessage=f;return u[h][m]}}()),this);
options:c,id:a});return b}const v={encode:"icase",b:"forward",u:!1,cache:!1,async:!1,c:!1,A:!1,threshold:0,depth:0},K={memory:{encode:"extra",b:"strict",threshold:7},speed:{encode:"icase",b:"strict",threshold:7,depth:2},match:{encode:"extra",b:"full"},score:{encode:"extra",b:"strict",threshold:5,depth:4},balance:{encode:"balance",b:"strict",threshold:6,depth:3},fastest:{encode:"icase",b:"strict",threshold:9,depth:1}},H=[];let Q=0;const M=f("\\W+"),N={},O={};h.create=function(b){return new h(b)};h.registerMatcher=
function(b){for(const a in b)b.hasOwnProperty(a)&&H.push(f(a),b[a]);return this};h.registerEncoder=function(b,a){C[b]=a.bind(C);return this};h.registerLanguage=function(b,a){N[b]=a.filter;O[b]=a.stemmer;return this};h.encode=function(b,a){return C[b](a)};h.prototype.init=function(b){this.o=[];b||(b=v);var a=b.preset,c=a?K[a]:{};if(a=b.worker)if("undefined"===typeof Worker)b.worker=!1,this.i=null;else{var d=parseInt(a,10)||4;this.w=-1;this.m=0;this.g=[];this.B=null;this.i=Array(d);for(var e=0;e<d;e++)this.i[e]=
V(this.id,e,b,w.bind(this))}this.b=b.tokenize||c.b||this.b||v.b;this.A=b.rtl||this.A||v.A;this.async="undefined"===typeof Promise||x(a=b.async)?this.async||v.async:a;this.c=x(a=b.worker)?this.c||v.c:a;this.threshold=x(a=b.threshold)?c.threshold||this.threshold||v.threshold:a;this.depth=x(a=b.depth)?c.depth||this.depth||v.depth:a;this.u=x(a=b.suggest)?this.u||v.u:a;this.s=(a=x(a=b.encode)?c.encode:a)&&C[a]&&C[a].bind(C)||(G(a)?a:this.s||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=N[a]||
a;c=this.s;d=r();if(a)for(e=0;e<a.length;e++){var l=c?c(a[e]):a[e];d[l]=String.fromCharCode(65E3-a.length+e)}this.filter=a=d}if(a=b.stemmer){var g;c=O[a]||a;d=this.s;e=[];if(c)for(g in c)c.hasOwnProperty(g)&&(l=d?d(g):g,e.push(f("(?=.{"+(l.length+3)+",})"+l+"$"),d?d(c[g]):c[g]));this.stemmer=g=e}this.f=L(10-(this.threshold||0));this.h=r();this.a=r();this.v=!0;this.j=(this.cache=a=x(a=b.cache)?this.cache||v.cache:a)?new W(a):!1;return this};h.prototype.encode=function(b){b&&H.length&&(b=m(b,H));b&&
this.o.length&&(b=m(b,this.o));b&&this.s&&(b=this.s(b));b&&this.stemmer&&(b=m(b,this.stemmer));return b};h.prototype.addMatcher=function(b){const a=this.o;for(const c in b)b.hasOwnProperty(c)&&a.push(f(c),b[c]);return this};h.prototype.add=function(b,a,c,d,e){if(a&&E(a)&&(b||0===b)){var f="@"+b;if(this.a[f]&&!d)return this.update(b,a);if(this.c)return++this.w>=this.i.length&&(this.w=0),this.i[this.w].postMessage({add:!0,id:b,content:a}),this.a[f]=""+this.w,c&&c(),this;if(!e){if(this.async&&"function"!==
typeof importScripts){let e=this;f=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=null;c()})});if(c)f.then(c);else return f;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.b;e=G(c)?c(a):a.split(M);const l=r();l._ctx=r();const q=this.threshold,t=this.depth,F=this.f,m=e.length,y=this.A;for(let a=0;a<m;a++){var g=e[a];if(g){var h=g.length,p=(y?a+1:m-a)/m,n="";switch(c){case "reverse":case "both":for(var k=h;--k;)n=g[k]+n,
D(F,l,n,b,y?1:(h-k)/h,p,q);n="";case "forward":for(k=0;k<h;k++)n+=g[k],D(F,l,n,b,y?(k+1)/h:1,p,q);break;case "full":for(k=0;k<h;k++){const a=(y?k+1:h-k)/h;for(let c=h;c>k;c--)n=g.substring(k,c),D(F,l,n,b,a,p,q)}break;default:if(h=D(F,l,g,b,1,p,q),t&&1<m&&h>=q)for(h=l._ctx[g]||(l._ctx[g]=r()),g=this.h[g]||(this.h[g]=L(10-(q||0))),p=a-t,n=a+t+1,0>p&&(p=0),n>m&&(n=m);p<n;p++)p!==a&&D(g,h,e[p],b,0,10-(p<a?a-p:p-a),q)}}}this.a[f]=1;this.v=!1}return this};h.prototype.update=function(b,a,c){this.a["@"+b]&&
E(a)&&(this.remove(b),this.add(b,a,c,!0));return this};h.prototype.remove=function(b,a,c){var d="@"+b;if(this.a[d]){if(this.c)return this.i[this.a[d]].postMessage({remove:!0,id:b}),delete this.a[d],a&&a(),this;if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)I(this.f[a],b);this.depth&&
I(this.h,b);delete this.a[d];this.v=!1}return this};h.prototype.search=function(b,a,c,d){let e=b,f;var g=[];"object"===typeof b&&((c=b.callback||a)&&(e.callback=null),a=b.limit,f=b.threshold,b=b.query);f||(f=this.threshold||0);G(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(this.c)for(this.B=c,this.m=0,this.g=[],g=0;g<this.c;g++)this.i[g].postMessage({search:!0,limit:a,threshold:f,content:b});else{if(!d){if(this.async&&"function"!==typeof importScripts){let d=this;b=new Promise(function(b){setTimeout(function(){b(d.search(e,
a,null,!0));d=null})});if(c)b.then(c);else return b;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!E(b))return g;e=b;if(this.cache)if(this.v){if(c=this.j.get(b))return c}else this.j.clear(),this.v=!0;e=this.encode(e);if(!e.length)return g;c=this.b;c=G(c)?c(e):e.split(M);d=c.length;var h=!0,p=[],n=r();if(1<d)if(this.depth){var k=!0;var m=c[0];n[m]=1}else c.sort(R);var q;if(!k||(q=this.h)[m])for(let a=k?1:0;a<d;a++){const b=c[a];if(b){if(!n[b]){const a=[];let c=!1,d=0;if(m=k?q[m]:
this.f){let e;for(let g=0;g<10-f;g++)if(e=m[g][b])a[d++]=e,c=!0}if(c)p[p.length]=1<d?a.concat.apply([],a):a[0];else if(!this.u){h=!1;break}n[b]=1}m=b}}else h=!1;h&&(g=T(p,a,this.u));this.cache&&this.j.set(b,g);return g}};h.prototype.info=function(){if(this.c)for(var b=0;b<this.c;b++)this.i[b].postMessage({info:!0,id:this.id});else{var a=0,c=0,d=0;for(var e=0;e<10-(this.threshold||0);e++){b=Object.keys(this.f[e]);for(let g=0;g<b.length;g++){var f=this.f[e][b[g]].length;a+=1*f+2*b[g].length+4;c+=f;
d+=2*b[g].length}}b=Object.keys(this.a);f=b.length;for(e=0;e<f;e++)a+=2*b[e].length+2;return{id:this.id,memory:a,items:f,sequences:c,chars:d,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:H.length+(this.o?this.o.length:0),worker:this.c,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.b}}};h.prototype.clear=function(){return this.destroy().init()};h.prototype.destroy=function(){this.cache&&(this.j.clear(),this.j=null);this.f=this.h=this.a=null;return this};
h.prototype.export=function(){return JSON.stringify([this.f,this.h,this.a])};h.prototype.import=function(b){b=JSON.parse(b);this.f=b[0];this.h=b[1];this.a=b[2]};const C={icase:function(b){return b.toLowerCase()},simple:function(){const b=[f("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",f("[\u00e8\u00e9\u00ea\u00eb]"),"e",f("[\u00ec\u00ed\u00ee\u00ef]"),"i",f("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",f("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",f("[\u00fd\u0177\u00ff]"),"y",f("\u00f1"),"n",f("\u00e7"),
"c",f("\u00df"),"s",f(" & ")," and ",f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(a){a=m(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[f("ae"),"a",f("ai"),"ei",f("ay"),"ei",f("ey"),"ei",f("oe"),"o",f("ue"),"u",f("ie"),"i",f("sz"),"s",f("zs"),"s",f("sh"),"s",f("ck"),"k",f("cc"),"k",f("dt"),"t",f("ph"),"f",f("pf"),"f",f("ou"),"o",f("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=m(a,b));c||1<a.length&&(a=J(a));return a}}(),extra:function(){const b=
[f("p"),"b",f("z"),"s",f("[cgq]"),"k",f("n"),"m",f("d"),"t",f("[vw]"),"f",f("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+m(d.substring(1),b))}a=a.join(" ");a=J(a)}return a}}(),balance:function(){const b=[f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(a){return J(m(a.toLowerCase(),b))}}()},W=function(){function b(a){this.clear();this.C=!0!==a&&a}b.prototype.clear=
function(){this.cache=r();this.count=r();this.index=r();this.l=[]};b.prototype.set=function(a,b){if(this.C&&x(this.cache[a])){let c=this.l.length;if(c===this.C){c--;const a=this.l[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.l[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.C&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.l;for(var e=c;this.count[f[--c]]<=
d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};return b}();return h}(function(){const u={},A="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(h,w,B,f,m){B=A?URL.createObjectURL(new Blob(["("+B.toString()+")()"],{type:"text/javascript"})):h+".min.js";h+="-"+w;u[h]||(u[h]=[]);u[h][m]=new Worker(B);u[h][m].onmessage=f;return u[h][m]}}()),this);

View File

@@ -1,26 +1,27 @@
/*
FlexSearch v0.3.51
FlexSearch v0.3.61
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(g,x,d){let m;(m=d.define)&&m.amd?m([],function(){return x}):(m=d.modules)?m[g.toLowerCase()]=x:"object"===typeof exports?module.exports=x:d[g]=x})("FlexSearch",function(){function g(b){B(b)&&(b=G[b]);b||(b=w);this.id=b.id||L++;this.init(b);x(this,"index",function(){return this.b});x(this,"length",function(){return Object.keys(this.b).length})}function x(b,a,c){Object.defineProperty(b,a,{get:c})}function d(b){return new RegExp(b,"g")}function m(b,a){for(let c=0;c<a.length;c+=
'use strict';(function(g,w,d){let m;(m=d.define)&&m.amd?m([],function(){return w}):(m=d.modules)?m[g.toLowerCase()]=w:"object"===typeof exports?module.exports=w:d[g]=w})("FlexSearch",function(){function g(b){B(b)&&(b=G[b]);b||(b=n);this.id=b.id||L++;this.init(b);w(this,"index",function(){return this.b});w(this,"length",function(){return Object.keys(this.b).length})}function w(b,a,c){Object.defineProperty(b,a,{get:c})}function d(b){return new RegExp(b,"g")}function m(b,a){for(let c=0;c<a.length;c+=
2)b=b.replace(a[c],a[c+1]);return b}function A(b,a,c,f,e,d,h){if(a[c])return a[c];e=e?(9-(h||6))*d+(h||6)*e:d;a[c]=e;e>=h&&(b=b[9-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=f);return e}function E(b,a){if(b){const c=Object.keys(b);for(let f=0,e=c.length;f<e;f++){const e=c[f],h=b[e];if(h)for(let c=0,f=h.length;c<f;c++)if(h[c]===a){1===f?delete b[e]:h.splice(c,1);break}else"object"===typeof h[c]&&E(h[c],a)}}}function F(b){let a="",c="";var f="";for(let e=0;e<b.length;e++){const d=b[e];if(d!==c)if(e&&"h"===
d){if(f="a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&f||" "===c)a+=d}else a+=d;f=e===b.length-1?"":b[e+1];c=d}return a}function M(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function N(b,a){b=b.length-a.length;return 0>b?-1:b?1:0}function O(b,a,c){let f=[],e;const d=b.length;if(1<d){b.sort(N);const n=t();let l=b[0],g=l.length,k=0;for(;k<g;)n["@"+l[k++]]=1;let r,p=0,u=0;for(;++u<d;){let v=!1;const q=u===d-1;e=[];l=b[u];g=l.length;for(k=
0;k<g;){r=l[k++];var h="@"+r;if(n[h]){const b=n[h];if(b===u){if(q){if(f[p++]=r,a&&p===a)return f}else n[h]=u+1;v=!0}else c&&(h=e[b]||(e[b]=[]),h[h.length]=r)}}if(!v&&!c)break}if(c&&(p=f.length,(u=e.length)&&(!a||p<a)))for(;u--;)if(r=e[u])for(k=0,g=r.length;k<g;k++)if(f[p++]=r[k],a&&p===a)return f}else d&&(f=b[0],a&&f.length>a&&(f=f.slice(0,a)));return f}function B(b){return"string"===typeof b}function C(b){return"function"===typeof b}function y(b){return"undefined"===typeof b}function H(b){const a=
Array(b);for(let c=0;c<b;c++)a[c]=t();return a}function t(){return Object.create(null)}const w={encode:"icase",a:"forward",l:!1,cache:!1,async:!1,s:!1,threshold:0,depth:0},G={memory:{encode:"extra",a:"strict",threshold:7},speed:{encode:"icase",a:"strict",threshold:7,depth:2},match:{encode:"extra",a:"full"},score:{encode:"extra",a:"strict",threshold:5,depth:4},balance:{encode:"balance",a:"strict",threshold:6,depth:3},fastest:{encode:"icase",a:"strict",threshold:9,depth:1}},D=[];let L=0;const I=d("\\W+"),
J={},K={};g.create=function(b){return new g(b)};g.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&D.push(d(a),b[a]);return this};g.registerEncoder=function(b,a){z[b]=a.bind(z);return this};g.registerLanguage=function(b,a){J[b]=a.filter;K[b]=a.stemmer;return this};g.encode=function(b,a){return z[b](a)};g.prototype.init=function(b){this.i=[];b||(b=w);var a=b.preset,c=a?G[a]:{};this.a=b.tokenize||c.a||this.a||w.a;this.async="undefined"===typeof Promise||y(a=b.async)?this.async||w.async:
a;this.threshold=y(a=b.threshold)?c.threshold||this.threshold||w.threshold:a;this.depth=y(a=b.depth)?c.depth||this.depth||w.depth:a;this.l=y(a=b.suggest)?this.l||w.l:a;this.j=(a=y(a=b.encode)?c.encode:a)&&z[a]&&z[a].bind(z)||(C(a)?a:this.j||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=J[a]||a;c=this.j;var f=t();if(a)for(var e=0;e<a.length;e++){var n=c?c(a[e]):a[e];f[n]=String.fromCharCode(65E3-a.length+e)}this.filter=a=f}if(a=b.stemmer){var h;c=K[a]||a;f=this.j;e=[];if(c)for(h in c)c.hasOwnProperty(h)&&
(n=f?f(h):h,e.push(d("(?=.{"+(n.length+3)+",})"+n+"$"),f?f(c[h]):c[h]));this.stemmer=h=e}this.c=H(10-(this.threshold||0));this.f=t();this.b=t();this.m=!0;this.h=(this.cache=a=y(a=b.cache)?this.cache||w.cache:a)?new P(a):!1;return this};g.prototype.encode=function(b){b&&D.length&&(b=m(b,D));b&&this.i.length&&(b=m(b,this.i));b&&this.j&&(b=this.j(b));b&&this.stemmer&&(b=m(b,this.stemmer));return b};g.prototype.addMatcher=function(b){const a=this.i;for(const c in b)b.hasOwnProperty(c)&&a.push(d(c),b[c]);
return this};g.prototype.add=function(b,a,c,f,e){if(a&&B(a)&&(b||0===b)){var d="@"+b;if(this.b[d]&&!f)return this.update(b,a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(c){setTimeout(function(){e.add(b,a,null,f,!0);e=null;c()})});if(c)d.then(c);else return d;return this}if(c)return this.add(b,a,null,f,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.a;e=C(c)?c(a):a.split(I);const n=t();n._ctx=t();const p=this.threshold,u=this.depth,m=this.c,
v=e.length;for(let a=0;a<v;a++){var h=e[a];if(h){var g=h.length,l=(v-a)/v,q="";switch(c){case "reverse":case "both":for(var k=g-1;1<=k;k--)q=h[k]+q,A(m,n,q,b,(g-k)/g,l,p);q="";case "forward":for(k=0;k<g;k++)q+=h[k],A(m,n,q,b,1,l,p);break;case "full":for(k=0;k<g;k++){const a=(g-k)/g;for(let c=g;c>k;c--)q=h.substring(k,c),A(m,n,q,b,a,l,p)}break;default:if(g=A(m,n,h,b,1,l,p),u&&1<v&&g>=p)for(g=n._ctx[h]||(n._ctx[h]=t()),h=this.f[h]||(this.f[h]=H(10-(p||0))),l=a-u,q=a+u+1,0>l&&(l=0),q>v&&(q=v);l<q;l++)l!==
a&&A(h,g,e[l],b,0,10-(l<a?a-l:l-a),p)}}}this.b[d]=1;this.m=!1}return this};g.prototype.update=function(b,a,c){this.b["@"+b]&&B(a)&&(this.remove(b),this.add(b,a,c,!0));return this};g.prototype.remove=function(b,a,c){var f="@"+b;if(this.b[f]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;f=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)f.then(a);else return f;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||
0);a++)E(this.c[a],b);this.depth&&E(this.f,b);delete this.b[f];this.m=!1}return this};g.prototype.search=function(b,a,c,f){let e=b,d,h=[];"object"===typeof b&&((c=b.callback||a)&&(e.callback=null),a=b.limit,d=b.threshold,b=b.query);d||(d=this.threshold||0);C(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!f){if(this.async&&"function"!==typeof importScripts){let d=this;b=new Promise(function(b){setTimeout(function(){b(d.search(e,a,null,!0));d=null})});if(c)b.then(c);else return b;return this}if(c)return c(this.search(e,
a,null,!0)),this}if(!b||!B(b))return h;e=b;if(this.cache)if(this.m){if(c=this.h.get(b))return c}else this.h.clear(),this.m=!0;e=this.encode(e);if(!e.length)return h;c=this.a;c=C(c)?c(e):e.split(I);f=c.length;let g=!0;const l=[],m=t();let k;if(1<f)if(this.depth){k=!0;var r=c[0];m[r]=1}else c.sort(M);let p;if(!k||(p=this.f)[r])for(let a=k?1:0;a<f;a++){const b=c[a];if(b){if(!m[b]){const a=[];let c=!1,f=0;if(r=k?p[r]:this.c){let e;for(let h=0;h<10-d;h++)if(e=r[h][b])a[f++]=e,c=!0}if(c)l[l.length]=1<f?
a.concat.apply([],a):a[0];else if(!this.l){g=!1;break}m[b]=1}r=b}}else g=!1;g&&(h=O(l,a,this.l));this.cache&&this.h.set(b,h);return h};g.prototype.info=function(){let b;let a=0,c=0,d=0;for(var e=0;e<10-(this.threshold||0);e++){b=Object.keys(this.c[e]);for(let f=0;f<b.length;f++){var g=this.c[e][b[f]].length;a+=1*g+2*b[f].length+4;c+=g;d+=2*b[f].length}}b=Object.keys(this.b);g=b.length;for(e=0;e<g;e++)a+=2*b[e].length+2;return{id:this.id,memory:a,items:g,sequences:c,chars:d,cache:this.cache&&this.cache.g?
this.cache.g.length:!1,matcher:D.length+(this.i?this.i.length:0),worker:this.s,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.a}};g.prototype.clear=function(){return this.destroy().init()};g.prototype.destroy=function(){this.cache&&(this.h.clear(),this.h=null);this.c=this.f=this.b=null;return this};g.prototype.export=function(){return JSON.stringify([this.c,this.f,this.b])};g.prototype.import=function(b){b=JSON.parse(b);this.c=b[0];this.f=b[1];this.b=b[2]};const z=
{icase:function(b){return b.toLowerCase()},simple:function(){const b=[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("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){a=m(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=
[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=m(a,b));c||1<a.length&&(a=F(a));return a}}(),extra:function(){const b=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=
a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+m(d.substring(1),b))}a=a.join(" ");a=F(a)}return a}}(),balance:function(){const b=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){return F(m(a.toLowerCase(),b))}}()},P=function(){function b(a){this.clear();this.o=!0!==a&&a}b.prototype.clear=function(){this.cache=t();this.count=t();this.index=t();this.g=[]};b.prototype.set=function(a,b){if(this.o&&y(this.cache[a])){let c=this.g.length;if(c===this.o){c--;
const a=this.g[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.g[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.o&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.g;for(var e=c;this.count[f[--c]]<=d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};return b}();return g}(!1),this);
d){if(f="a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&f||" "===c)a+=d}else a+=d;f=e===b.length-1?"":b[e+1];c=d}return a}function M(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function N(b,a){b=b.length-a.length;return 0>b?-1:b?1:0}function O(b,a,c){let f=[],e;const d=b.length;if(1<d){b.sort(N);const p=t();let l=b[0],g=l.length,k=0;for(;k<g;)p["@"+l[k++]]=1;let x,q=0,u=0;for(;++u<d;){let v=!1;const r=u===d-1;e=[];l=b[u];g=l.length;for(k=
0;k<g;){x=l[k++];var h="@"+x;if(p[h]){const b=p[h];if(b===u){if(r){if(f[q++]=x,a&&q===a)return f}else p[h]=u+1;v=!0}else c&&(h=e[b]||(e[b]=[]),h[h.length]=x)}}if(!v&&!c)break}if(c&&(q=f.length,(u=e.length)&&(!a||q<a)))for(;u--;)if(x=e[u])for(k=0,g=x.length;k<g;k++)if(f[q++]=x[k],a&&q===a)return f}else d&&(f=b[0],a&&f.length>a&&(f=f.slice(0,a)));return f}function B(b){return"string"===typeof b}function C(b){return"function"===typeof b}function y(b){return"undefined"===typeof b}function H(b){const a=
Array(b);for(let c=0;c<b;c++)a[c]=t();return a}function t(){return Object.create(null)}const n={encode:"icase",a:"forward",l:!1,cache:!1,async:!1,u:!1,o:!1,threshold:0,depth:0},G={memory:{encode:"extra",a:"strict",threshold:7},speed:{encode:"icase",a:"strict",threshold:7,depth:2},match:{encode:"extra",a:"full"},score:{encode:"extra",a:"strict",threshold:5,depth:4},balance:{encode:"balance",a:"strict",threshold:6,depth:3},fastest:{encode:"icase",a:"strict",threshold:9,depth:1}},D=[];let L=0;const I=
d("\\W+"),J={},K={};g.create=function(b){return new g(b)};g.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&D.push(d(a),b[a]);return this};g.registerEncoder=function(b,a){z[b]=a.bind(z);return this};g.registerLanguage=function(b,a){J[b]=a.filter;K[b]=a.stemmer;return this};g.encode=function(b,a){return z[b](a)};g.prototype.init=function(b){this.i=[];b||(b=n);var a=b.preset,c=a?G[a]:{};this.a=b.tokenize||c.a||this.a||n.a;this.o=b.rtl||this.o||n.o;this.async="undefined"===typeof Promise||
y(a=b.async)?this.async||n.async:a;this.threshold=y(a=b.threshold)?c.threshold||this.threshold||n.threshold:a;this.depth=y(a=b.depth)?c.depth||this.depth||n.depth:a;this.l=y(a=b.suggest)?this.l||n.l:a;this.j=(a=y(a=b.encode)?c.encode:a)&&z[a]&&z[a].bind(z)||(C(a)?a:this.j||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=J[a]||a;c=this.j;var f=t();if(a)for(var e=0;e<a.length;e++){var p=c?c(a[e]):a[e];f[p]=String.fromCharCode(65E3-a.length+e)}this.filter=a=f}if(a=b.stemmer){var h;c=K[a]||a;f=
this.j;e=[];if(c)for(h in c)c.hasOwnProperty(h)&&(p=f?f(h):h,e.push(d("(?=.{"+(p.length+3)+",})"+p+"$"),f?f(c[h]):c[h]));this.stemmer=h=e}this.c=H(10-(this.threshold||0));this.f=t();this.b=t();this.m=!0;this.h=(this.cache=a=y(a=b.cache)?this.cache||n.cache:a)?new P(a):!1;return this};g.prototype.encode=function(b){b&&D.length&&(b=m(b,D));b&&this.i.length&&(b=m(b,this.i));b&&this.j&&(b=this.j(b));b&&this.stemmer&&(b=m(b,this.stemmer));return b};g.prototype.addMatcher=function(b){const a=this.i;for(const c in b)b.hasOwnProperty(c)&&
a.push(d(c),b[c]);return this};g.prototype.add=function(b,a,c,f,e){if(a&&B(a)&&(b||0===b)){var d="@"+b;if(this.b[d]&&!f)return this.update(b,a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(c){setTimeout(function(){e.add(b,a,null,f,!0);e=null;c()})});if(c)d.then(c);else return d;return this}if(c)return this.add(b,a,null,f,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.a;e=C(c)?c(a):a.split(I);const p=t();p._ctx=t();const q=this.threshold,
u=this.depth,m=this.c,v=e.length,n=this.o;for(let a=0;a<v;a++){var h=e[a];if(h){var g=h.length,l=(n?a+1:v-a)/v,r="";switch(c){case "reverse":case "both":for(var k=g;--k;)r=h[k]+r,A(m,p,r,b,n?1:(g-k)/g,l,q);r="";case "forward":for(k=0;k<g;k++)r+=h[k],A(m,p,r,b,n?(k+1)/g:1,l,q);break;case "full":for(k=0;k<g;k++){const a=(n?k+1:g-k)/g;for(let c=g;c>k;c--)r=h.substring(k,c),A(m,p,r,b,a,l,q)}break;default:if(g=A(m,p,h,b,1,l,q),u&&1<v&&g>=q)for(g=p._ctx[h]||(p._ctx[h]=t()),h=this.f[h]||(this.f[h]=H(10-
(q||0))),l=a-u,r=a+u+1,0>l&&(l=0),r>v&&(r=v);l<r;l++)l!==a&&A(h,g,e[l],b,0,10-(l<a?a-l:l-a),q)}}}this.b[d]=1;this.m=!1}return this};g.prototype.update=function(b,a,c){this.b["@"+b]&&B(a)&&(this.remove(b),this.add(b,a,c,!0));return this};g.prototype.remove=function(b,a,c){var f="@"+b;if(this.b[f]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;f=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)f.then(a);else return f;return this}if(a)return this.remove(b,
null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)E(this.c[a],b);this.depth&&E(this.f,b);delete this.b[f];this.m=!1}return this};g.prototype.search=function(b,a,c,f){let e=b,d,h=[];"object"===typeof b&&((c=b.callback||a)&&(e.callback=null),a=b.limit,d=b.threshold,b=b.query);d||(d=this.threshold||0);C(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!f){if(this.async&&"function"!==typeof importScripts){let d=this;b=new Promise(function(b){setTimeout(function(){b(d.search(e,a,null,!0));d=null})});if(c)b.then(c);
else return b;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!B(b))return h;e=b;if(this.cache)if(this.m){if(c=this.h.get(b))return c}else this.h.clear(),this.m=!0;e=this.encode(e);if(!e.length)return h;c=this.a;c=C(c)?c(e):e.split(I);f=c.length;let g=!0;const l=[],m=t();let k;if(1<f)if(this.depth){k=!0;var n=c[0];m[n]=1}else c.sort(M);let q;if(!k||(q=this.f)[n])for(let a=k?1:0;a<f;a++){const b=c[a];if(b){if(!m[b]){const a=[];let c=!1,f=0;if(n=k?q[n]:this.c){let e;for(let h=0;h<10-
d;h++)if(e=n[h][b])a[f++]=e,c=!0}if(c)l[l.length]=1<f?a.concat.apply([],a):a[0];else if(!this.l){g=!1;break}m[b]=1}n=b}}else g=!1;g&&(h=O(l,a,this.l));this.cache&&this.h.set(b,h);return h};g.prototype.info=function(){let b;let a=0,c=0,d=0;for(var e=0;e<10-(this.threshold||0);e++){b=Object.keys(this.c[e]);for(let f=0;f<b.length;f++){var g=this.c[e][b[f]].length;a+=1*g+2*b[f].length+4;c+=g;d+=2*b[f].length}}b=Object.keys(this.b);g=b.length;for(e=0;e<g;e++)a+=2*b[e].length+2;return{id:this.id,memory:a,
items:g,sequences:c,chars:d,cache:this.cache&&this.cache.g?this.cache.g.length:!1,matcher:D.length+(this.i?this.i.length:0),worker:this.u,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.a}};g.prototype.clear=function(){return this.destroy().init()};g.prototype.destroy=function(){this.cache&&(this.h.clear(),this.h=null);this.c=this.f=this.b=null;return this};g.prototype.export=function(){return JSON.stringify([this.c,this.f,this.b])};g.prototype.import=function(b){b=
JSON.parse(b);this.c=b[0];this.f=b[1];this.b=b[2]};const z={icase:function(b){return b.toLowerCase()},simple:function(){const b=[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("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){a=
m(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=m(a,b));c||1<a.length&&(a=F(a));return a}}(),extra:function(){const b=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"),
""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+m(d.substring(1),b))}a=a.join(" ");a=F(a)}return a}}(),balance:function(){const b=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){return F(m(a.toLowerCase(),b))}}()},P=function(){function b(a){this.clear();this.s=!0!==a&&a}b.prototype.clear=function(){this.cache=t();this.count=t();this.index=t();this.g=[]};b.prototype.set=function(a,
b){if(this.s&&y(this.cache[a])){let c=this.g.length;if(c===this.s){c--;const a=this.g[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.g[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.s&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.g;for(var e=c;this.count[f[--c]]<=d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};
return b}();return g}(!1),this);

View File

@@ -1,5 +1,5 @@
/**!
* @preserve FlexSearch v0.3.51
* @preserve FlexSearch v0.3.61
* Copyright 2019 Nextapps GmbH
* Author: Thomas Wilkerling
* Released under the Apache 2.0 Licence
@@ -38,6 +38,7 @@
cache: false,
async: false,
worker: false,
rtl: false,
// minimum scoring (0 - 9)
threshold: 0,
@@ -377,6 +378,14 @@
defaults.tokenize
);
/** @private */
this.rtl = (
options["rtl"] ||
this.rtl ||
defaults.rtl
);
if(SUPPORT_ASYNC) /** @private */ this.async = (
(typeof Promise === "undefined") || is_undefined(custom = options["async"]) ?
@@ -620,6 +629,8 @@
if(content && is_string(content) && ((id /*&& !index_blacklist[id]*/) || (id === 0))){
// TODO: do not mix ids as string "1" and as number 1
const index = "@" + id;
if(this._ids[index] && !_skip_update){
@@ -733,6 +744,7 @@
const depth = this.depth;
const map = this._map;
const word_length = words.length;
const rtl = this.rtl;
// tokenize
@@ -744,32 +756,34 @@
if(value){
const length = value.length;
const context_score = (word_length - i) / word_length;
const context_score = (rtl ? i + 1 : word_length - i) / word_length;
let tmp = "";
let token = "";
switch(tokenizer){
case "reverse":
case "both":
for(let a = length - 1; a >= 1; a--){
// NOTE: skip last round (this token exist already in "forward")
tmp = value[a] + tmp;
for(let a = length; --a;){
token = value[a] + token;
add_index(
map,
dupes,
tmp,
token,
id,
(length - a) / length,
rtl ? 1 : (length - a) / length,
context_score,
threshold
);
}
tmp = "";
token = "";
// Note: no break here, fallthrough to next case
@@ -777,15 +791,15 @@
for(let a = 0; a < length; a++){
tmp += value[a];
token += value[a];
add_index(
map,
dupes,
tmp,
token,
id,
1,
rtl ? (a + 1) / length : 1,
context_score,
threshold
);
@@ -797,17 +811,17 @@
for(let x = 0; x < length; x++){
const partial_score = (length - x) / length;
const partial_score = (rtl ? x + 1 : length - x) / length;
for(let y = length; y > x; y--){
tmp = value.substring(x, y);
token = value.substring(x, y);
add_index(
map,
dupes,
tmp,
token,
id,
partial_score,
context_score,
@@ -1935,7 +1949,9 @@
partial_score ?
((9 - (threshold || 6)) * context_score) + ((threshold || 6) * partial_score)
(9 - (threshold || 6)) * context_score + (threshold || 6) * partial_score
//(9 - (threshold || 4.5)) * context_score + (threshold || 4.5) * partial_score
//4.5 * (context_score + partial_score)
:
context_score
);

View File

@@ -1,6 +1,6 @@
{
"name": "flexsearch",
"version": "0.3.51",
"version": "0.3.61",
"description": "Next-Generation full text search library with zero dependencies.",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",

View File

@@ -861,6 +861,54 @@ describe("Encoding", function(){
});
});
// ------------------------------------------------------------------------
// CJK Word Break
// ------------------------------------------------------------------------
describe("CJK Word Break", function(){
it("Should have been tokenized properly", function(){
var index = FlexSearch.create({
encode: false,
tokenize: function(str){
return str.split(/[\x00-\x7F]+/);
}
});
index.add(0, "서울시가 잠이 든 시간에 아무 말, 미뤄, 미뤄");
expect(index.search("든")).to.include(0);
expect(index.search("시간에")).to.include(0);
});
});
// ------------------------------------------------------------------------
// Right-To-Left
// ------------------------------------------------------------------------
describe("RTL Support", function(){
it("Should have been scored properly", function(){
var index = new FlexSearch({
encode: "icase",
tokenize: "reverse",
rtl: true
});
index.add(0, "54321 4 3 2 1 0");
index.add(1, "0 1 2 3 4 54321");
index.add(2, "0 1 2 3 4 12345");
expect(index.search("5")[0]).to.equal(2);
expect(index.search("5")[1]).to.equal(1);
expect(index.search("5")[2]).to.equal(0);
});
});
// ------------------------------------------------------------------------
// Contextual Indexing
// ------------------------------------------------------------------------