react-lib-tools 0.0.35 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/{CommonQuestionsRoute-D9K79upc.js → CommonQuestionsRoute-BwwqUJyI.js} +2 -2
  2. package/dist/{CommonQuestionsRoute-D9K79upc.js.map → CommonQuestionsRoute-BwwqUJyI.js.map} +1 -1
  3. package/dist/{CommonQuestionsRoute-CA0eEVPH.cjs → CommonQuestionsRoute-sImKiGx8.cjs} +2 -2
  4. package/dist/{CommonQuestionsRoute-CA0eEVPH.cjs.map → CommonQuestionsRoute-sImKiGx8.cjs.map} +1 -1
  5. package/dist/{GettingStartedRoute-rQVjSgEq.js → GettingStartedRoute-ClJU7JcL.js} +2 -2
  6. package/dist/{GettingStartedRoute-rQVjSgEq.js.map → GettingStartedRoute-ClJU7JcL.js.map} +1 -1
  7. package/dist/{GettingStartedRoute-B2gmhrI5.cjs → GettingStartedRoute-tyikH6yS.cjs} +2 -2
  8. package/dist/{GettingStartedRoute-B2gmhrI5.cjs.map → GettingStartedRoute-tyikH6yS.cjs.map} +1 -1
  9. package/dist/{PageNotFound-YcVoO6YV.cjs → PageNotFound-CSDM7qet.cjs} +2 -2
  10. package/dist/{PageNotFound-YcVoO6YV.cjs.map → PageNotFound-CSDM7qet.cjs.map} +1 -1
  11. package/dist/{PageNotFound-CrAUgSnt.js → PageNotFound-ibjIlKwX.js} +2 -2
  12. package/dist/{PageNotFound-CrAUgSnt.js.map → PageNotFound-ibjIlKwX.js.map} +1 -1
  13. package/dist/{SupportRoute-C74g_-rm.js → SupportRoute-BWxqeS9G.js} +2 -2
  14. package/dist/{SupportRoute-C74g_-rm.js.map → SupportRoute-BWxqeS9G.js.map} +1 -1
  15. package/dist/{SupportRoute-B4AetYXb.cjs → SupportRoute-CaVQtANn.cjs} +2 -2
  16. package/dist/{SupportRoute-B4AetYXb.cjs.map → SupportRoute-CaVQtANn.cjs.map} +1 -1
  17. package/dist/{VersionsRoute-CX4l8cMW.js → VersionsRoute-CRPHJWuY.js} +2 -2
  18. package/dist/{VersionsRoute-CX4l8cMW.js.map → VersionsRoute-CRPHJWuY.js.map} +1 -1
  19. package/dist/{VersionsRoute-Spk6Sna2.cjs → VersionsRoute-s9kvgKZE.cjs} +2 -2
  20. package/dist/{VersionsRoute-Spk6Sna2.cjs.map → VersionsRoute-s9kvgKZE.cjs.map} +1 -1
  21. package/dist/fuse-BvOe6mNx.js +1023 -0
  22. package/dist/fuse-BvOe6mNx.js.map +1 -0
  23. package/dist/fuse-CM2wbN_z.cjs +2 -0
  24. package/dist/fuse-CM2wbN_z.cjs.map +1 -0
  25. package/dist/index-D_pov2Kn.cjs +8 -0
  26. package/dist/index-D_pov2Kn.cjs.map +1 -0
  27. package/dist/{index-Bf43K_g2.js → index-DbkaDE2f.js} +2577 -2286
  28. package/dist/index-DbkaDE2f.js.map +1 -0
  29. package/dist/react-lib-tools.cjs +1 -1
  30. package/dist/react-lib-tools.d.ts +9 -3
  31. package/dist/react-lib-tools.js +1 -1
  32. package/lib/types.ts +6 -0
  33. package/package.json +5 -4
  34. package/scripts/compile-search-index.ts +39 -0
  35. package/scripts/utils/search/crawlPage.ts +103 -0
  36. package/scripts/utils/search/stopWords.ts +129 -0
  37. package/scripts/utils/search/types.ts +6 -0
  38. package/dist/index-BB-4-AeJ.cjs +0 -8
  39. package/dist/index-BB-4-AeJ.cjs.map +0 -1
  40. package/dist/index-Bf43K_g2.js.map +0 -1
@@ -0,0 +1,1023 @@
1
+ function m(e) {
2
+ return Array.isArray ? Array.isArray(e) : st(e) === "[object Array]";
3
+ }
4
+ function at(e) {
5
+ if (typeof e == "string")
6
+ return e;
7
+ let t = e + "";
8
+ return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
9
+ }
10
+ function lt(e) {
11
+ return e == null ? "" : at(e);
12
+ }
13
+ function M(e) {
14
+ return typeof e == "string";
15
+ }
16
+ function tt(e) {
17
+ return typeof e == "number";
18
+ }
19
+ function ft(e) {
20
+ return e === !0 || e === !1 || dt(e) && st(e) == "[object Boolean]";
21
+ }
22
+ function et(e) {
23
+ return typeof e == "object";
24
+ }
25
+ function dt(e) {
26
+ return et(e) && e !== null;
27
+ }
28
+ function E(e) {
29
+ return e != null;
30
+ }
31
+ function P(e) {
32
+ return !e.trim().length;
33
+ }
34
+ function st(e) {
35
+ return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
36
+ }
37
+ const gt = "Incorrect 'index' type", At = (e) => `Invalid value for key ${e}`, pt = (e) => `Pattern length exceeds max of ${e}.`, Et = (e) => `Missing ${e} property in key`, Ct = (e) => `Property 'weight' in key '${e}' must be a positive integer`, J = Object.prototype.hasOwnProperty;
38
+ class Ft {
39
+ constructor(t) {
40
+ this._keys = [], this._keyMap = {};
41
+ let s = 0;
42
+ t.forEach((n) => {
43
+ let r = nt(n);
44
+ this._keys.push(r), this._keyMap[r.id] = r, s += r.weight;
45
+ }), this._keys.forEach((n) => {
46
+ n.weight /= s;
47
+ });
48
+ }
49
+ get(t) {
50
+ return this._keyMap[t];
51
+ }
52
+ keys() {
53
+ return this._keys;
54
+ }
55
+ toJSON() {
56
+ return JSON.stringify(this._keys);
57
+ }
58
+ }
59
+ function nt(e) {
60
+ let t = null, s = null, n = null, r = 1, i = null;
61
+ if (M(e) || m(e))
62
+ n = e, t = U(e), s = j(e);
63
+ else {
64
+ if (!J.call(e, "name"))
65
+ throw new Error(Et("name"));
66
+ const u = e.name;
67
+ if (n = u, J.call(e, "weight") && (r = e.weight, r <= 0))
68
+ throw new Error(Ct(u));
69
+ t = U(u), s = j(u), i = e.getFn;
70
+ }
71
+ return { path: t, id: s, weight: r, src: n, getFn: i };
72
+ }
73
+ function U(e) {
74
+ return m(e) ? e : e.split(".");
75
+ }
76
+ function j(e) {
77
+ return m(e) ? e.join(".") : e;
78
+ }
79
+ function Bt(e, t) {
80
+ let s = [], n = !1;
81
+ const r = (i, u, c) => {
82
+ if (E(i))
83
+ if (!u[c])
84
+ s.push(i);
85
+ else {
86
+ let o = u[c];
87
+ const h = i[o];
88
+ if (!E(h))
89
+ return;
90
+ if (c === u.length - 1 && (M(h) || tt(h) || ft(h)))
91
+ s.push(lt(h));
92
+ else if (m(h)) {
93
+ n = !0;
94
+ for (let a = 0, f = h.length; a < f; a += 1)
95
+ r(h[a], u, c + 1);
96
+ } else u.length && r(h, u, c + 1);
97
+ }
98
+ };
99
+ return r(e, M(t) ? t.split(".") : t, 0), n ? s : s[0];
100
+ }
101
+ const Mt = {
102
+ // Whether the matches should be included in the result set. When `true`, each record in the result
103
+ // set will include the indices of the matched characters.
104
+ // These can consequently be used for highlighting purposes.
105
+ includeMatches: !1,
106
+ // When `true`, the matching function will continue to the end of a search pattern even if
107
+ // a perfect match has already been located in the string.
108
+ findAllMatches: !1,
109
+ // Minimum number of characters that must be matched before a result is considered a match
110
+ minMatchCharLength: 1
111
+ }, Dt = {
112
+ // When `true`, the algorithm continues searching to the end of the input even if a perfect
113
+ // match is found before the end of the same input.
114
+ isCaseSensitive: !1,
115
+ // When `true`, the algorithm will ignore diacritics (accents) in comparisons
116
+ ignoreDiacritics: !1,
117
+ // When true, the matching function will continue to the end of a search pattern even if
118
+ includeScore: !1,
119
+ // List of properties that will be searched. This also supports nested properties.
120
+ keys: [],
121
+ // Whether to sort the result list, by score
122
+ shouldSort: !0,
123
+ // Default sort function: sort by ascending score, ascending index
124
+ sortFn: (e, t) => e.score === t.score ? e.idx < t.idx ? -1 : 1 : e.score < t.score ? -1 : 1
125
+ }, mt = {
126
+ // Approximately where in the text is the pattern expected to be found?
127
+ location: 0,
128
+ // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
129
+ // (of both letters and location), a threshold of '1.0' would match anything.
130
+ threshold: 0.6,
131
+ // Determines how close the match must be to the fuzzy location (specified above).
132
+ // An exact letter match which is 'distance' characters away from the fuzzy location
133
+ // would score as a complete mismatch. A distance of '0' requires the match be at
134
+ // the exact location specified, a threshold of '1000' would require a perfect match
135
+ // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
136
+ distance: 100
137
+ }, yt = {
138
+ // When `true`, it enables the use of unix-like search commands
139
+ useExtendedSearch: !1,
140
+ // The get function to use when fetching an object's properties.
141
+ // The default will search nested paths *ie foo.bar.baz*
142
+ getFn: Bt,
143
+ // When `true`, search will ignore `location` and `distance`, so it won't matter
144
+ // where in the string the pattern appears.
145
+ // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
146
+ ignoreLocation: !1,
147
+ // When `true`, the calculation for the relevance score (used for sorting) will
148
+ // ignore the field-length norm.
149
+ // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
150
+ ignoreFieldNorm: !1,
151
+ // The weight to determine how much field length norm effects scoring.
152
+ fieldNormWeight: 1
153
+ };
154
+ var l = {
155
+ ...Dt,
156
+ ...Mt,
157
+ ...mt,
158
+ ...yt
159
+ };
160
+ const xt = /[^ ]+/g;
161
+ function _t(e = 1, t = 3) {
162
+ const s = /* @__PURE__ */ new Map(), n = Math.pow(10, t);
163
+ return {
164
+ get(r) {
165
+ const i = r.match(xt).length;
166
+ if (s.has(i))
167
+ return s.get(i);
168
+ const u = 1 / Math.pow(i, 0.5 * e), c = parseFloat(Math.round(u * n) / n);
169
+ return s.set(i, c), c;
170
+ },
171
+ clear() {
172
+ s.clear();
173
+ }
174
+ };
175
+ }
176
+ class Y {
177
+ constructor({
178
+ getFn: t = l.getFn,
179
+ fieldNormWeight: s = l.fieldNormWeight
180
+ } = {}) {
181
+ this.norm = _t(s, 3), this.getFn = t, this.isCreated = !1, this.setIndexRecords();
182
+ }
183
+ setSources(t = []) {
184
+ this.docs = t;
185
+ }
186
+ setIndexRecords(t = []) {
187
+ this.records = t;
188
+ }
189
+ setKeys(t = []) {
190
+ this.keys = t, this._keysMap = {}, t.forEach((s, n) => {
191
+ this._keysMap[s.id] = n;
192
+ });
193
+ }
194
+ create() {
195
+ this.isCreated || !this.docs.length || (this.isCreated = !0, M(this.docs[0]) ? this.docs.forEach((t, s) => {
196
+ this._addString(t, s);
197
+ }) : this.docs.forEach((t, s) => {
198
+ this._addObject(t, s);
199
+ }), this.norm.clear());
200
+ }
201
+ // Adds a doc to the end of the index
202
+ add(t) {
203
+ const s = this.size();
204
+ M(t) ? this._addString(t, s) : this._addObject(t, s);
205
+ }
206
+ // Removes the doc at the specified index of the index
207
+ removeAt(t) {
208
+ this.records.splice(t, 1);
209
+ for (let s = t, n = this.size(); s < n; s += 1)
210
+ this.records[s].i -= 1;
211
+ }
212
+ getValueForItemAtKeyId(t, s) {
213
+ return t[this._keysMap[s]];
214
+ }
215
+ size() {
216
+ return this.records.length;
217
+ }
218
+ _addString(t, s) {
219
+ if (!E(t) || P(t))
220
+ return;
221
+ let n = {
222
+ v: t,
223
+ i: s,
224
+ n: this.norm.get(t)
225
+ };
226
+ this.records.push(n);
227
+ }
228
+ _addObject(t, s) {
229
+ let n = { i: s, $: {} };
230
+ this.keys.forEach((r, i) => {
231
+ let u = r.getFn ? r.getFn(t) : this.getFn(t, r.path);
232
+ if (E(u)) {
233
+ if (m(u)) {
234
+ let c = [];
235
+ const o = [{ nestedArrIndex: -1, value: u }];
236
+ for (; o.length; ) {
237
+ const { nestedArrIndex: h, value: a } = o.pop();
238
+ if (E(a))
239
+ if (M(a) && !P(a)) {
240
+ let f = {
241
+ v: a,
242
+ i: h,
243
+ n: this.norm.get(a)
244
+ };
245
+ c.push(f);
246
+ } else m(a) && a.forEach((f, d) => {
247
+ o.push({
248
+ nestedArrIndex: d,
249
+ value: f
250
+ });
251
+ });
252
+ }
253
+ n.$[i] = c;
254
+ } else if (M(u) && !P(u)) {
255
+ let c = {
256
+ v: u,
257
+ n: this.norm.get(u)
258
+ };
259
+ n.$[i] = c;
260
+ }
261
+ }
262
+ }), this.records.push(n);
263
+ }
264
+ toJSON() {
265
+ return {
266
+ keys: this.keys,
267
+ records: this.records
268
+ };
269
+ }
270
+ }
271
+ function rt(e, t, { getFn: s = l.getFn, fieldNormWeight: n = l.fieldNormWeight } = {}) {
272
+ const r = new Y({ getFn: s, fieldNormWeight: n });
273
+ return r.setKeys(e.map(nt)), r.setSources(t), r.create(), r;
274
+ }
275
+ function It(e, { getFn: t = l.getFn, fieldNormWeight: s = l.fieldNormWeight } = {}) {
276
+ const { keys: n, records: r } = e, i = new Y({ getFn: t, fieldNormWeight: s });
277
+ return i.setKeys(n), i.setIndexRecords(r), i;
278
+ }
279
+ function $(e, {
280
+ errors: t = 0,
281
+ currentLocation: s = 0,
282
+ expectedLocation: n = 0,
283
+ distance: r = l.distance,
284
+ ignoreLocation: i = l.ignoreLocation
285
+ } = {}) {
286
+ const u = t / e.length;
287
+ if (i)
288
+ return u;
289
+ const c = Math.abs(n - s);
290
+ return r ? u + c / r : c ? 1 : u;
291
+ }
292
+ function St(e = [], t = l.minMatchCharLength) {
293
+ let s = [], n = -1, r = -1, i = 0;
294
+ for (let u = e.length; i < u; i += 1) {
295
+ let c = e[i];
296
+ c && n === -1 ? n = i : !c && n !== -1 && (r = i - 1, r - n + 1 >= t && s.push([n, r]), n = -1);
297
+ }
298
+ return e[i - 1] && i - n >= t && s.push([n, i - 1]), s;
299
+ }
300
+ const w = 32;
301
+ function wt(e, t, s, {
302
+ location: n = l.location,
303
+ distance: r = l.distance,
304
+ threshold: i = l.threshold,
305
+ findAllMatches: u = l.findAllMatches,
306
+ minMatchCharLength: c = l.minMatchCharLength,
307
+ includeMatches: o = l.includeMatches,
308
+ ignoreLocation: h = l.ignoreLocation
309
+ } = {}) {
310
+ if (t.length > w)
311
+ throw new Error(pt(w));
312
+ const a = t.length, f = e.length, d = Math.max(0, Math.min(n, f));
313
+ let g = i, A = d;
314
+ const p = c > 1 || o, F = p ? Array(f) : [];
315
+ let y;
316
+ for (; (y = e.indexOf(t, A)) > -1; ) {
317
+ let C = $(t, {
318
+ currentLocation: y,
319
+ expectedLocation: d,
320
+ distance: r,
321
+ ignoreLocation: h
322
+ });
323
+ if (g = Math.min(C, g), A = y + a, p) {
324
+ let x = 0;
325
+ for (; x < a; )
326
+ F[y + x] = 1, x += 1;
327
+ }
328
+ }
329
+ A = -1;
330
+ let D = [], L = 1, S = a + f;
331
+ const ht = 1 << a - 1;
332
+ for (let C = 0; C < a; C += 1) {
333
+ let x = 0, _ = S;
334
+ for (; x < _; )
335
+ $(t, {
336
+ errors: C,
337
+ currentLocation: d + _,
338
+ expectedLocation: d,
339
+ distance: r,
340
+ ignoreLocation: h
341
+ }) <= g ? x = _ : S = _, _ = Math.floor((S - x) / 2 + x);
342
+ S = _;
343
+ let V = Math.max(1, d - _ + 1), T = u ? f : Math.min(d + _, f) + a, R = Array(T + 2);
344
+ R[T + 1] = (1 << C) - 1;
345
+ for (let B = T; B >= V; B -= 1) {
346
+ let O = B - 1, Q = s[e.charAt(O)];
347
+ if (p && (F[O] = +!!Q), R[B] = (R[B + 1] << 1 | 1) & Q, C && (R[B] |= (D[B + 1] | D[B]) << 1 | 1 | D[B + 1]), R[B] & ht && (L = $(t, {
348
+ errors: C,
349
+ currentLocation: O,
350
+ expectedLocation: d,
351
+ distance: r,
352
+ ignoreLocation: h
353
+ }), L <= g)) {
354
+ if (g = L, A = O, A <= d)
355
+ break;
356
+ V = Math.max(1, 2 * d - A);
357
+ }
358
+ }
359
+ if ($(t, {
360
+ errors: C + 1,
361
+ currentLocation: d,
362
+ expectedLocation: d,
363
+ distance: r,
364
+ ignoreLocation: h
365
+ }) > g)
366
+ break;
367
+ D = R;
368
+ }
369
+ const v = {
370
+ isMatch: A >= 0,
371
+ // Count exact matches (those with a score of 0) to be "almost" exact
372
+ score: Math.max(1e-3, L)
373
+ };
374
+ if (p) {
375
+ const C = St(F, c);
376
+ C.length ? o && (v.indices = C) : v.isMatch = !1;
377
+ }
378
+ return v;
379
+ }
380
+ function Lt(e) {
381
+ let t = {};
382
+ for (let s = 0, n = e.length; s < n; s += 1) {
383
+ const r = e.charAt(s);
384
+ t[r] = (t[r] || 0) | 1 << n - s - 1;
385
+ }
386
+ return t;
387
+ }
388
+ const k = String.prototype.normalize ? ((e) => e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "")) : ((e) => e);
389
+ class it {
390
+ constructor(t, {
391
+ location: s = l.location,
392
+ threshold: n = l.threshold,
393
+ distance: r = l.distance,
394
+ includeMatches: i = l.includeMatches,
395
+ findAllMatches: u = l.findAllMatches,
396
+ minMatchCharLength: c = l.minMatchCharLength,
397
+ isCaseSensitive: o = l.isCaseSensitive,
398
+ ignoreDiacritics: h = l.ignoreDiacritics,
399
+ ignoreLocation: a = l.ignoreLocation
400
+ } = {}) {
401
+ if (this.options = {
402
+ location: s,
403
+ threshold: n,
404
+ distance: r,
405
+ includeMatches: i,
406
+ findAllMatches: u,
407
+ minMatchCharLength: c,
408
+ isCaseSensitive: o,
409
+ ignoreDiacritics: h,
410
+ ignoreLocation: a
411
+ }, t = o ? t : t.toLowerCase(), t = h ? k(t) : t, this.pattern = t, this.chunks = [], !this.pattern.length)
412
+ return;
413
+ const f = (g, A) => {
414
+ this.chunks.push({
415
+ pattern: g,
416
+ alphabet: Lt(g),
417
+ startIndex: A
418
+ });
419
+ }, d = this.pattern.length;
420
+ if (d > w) {
421
+ let g = 0;
422
+ const A = d % w, p = d - A;
423
+ for (; g < p; )
424
+ f(this.pattern.substr(g, w), g), g += w;
425
+ if (A) {
426
+ const F = d - w;
427
+ f(this.pattern.substr(F), F);
428
+ }
429
+ } else
430
+ f(this.pattern, 0);
431
+ }
432
+ searchIn(t) {
433
+ const { isCaseSensitive: s, ignoreDiacritics: n, includeMatches: r } = this.options;
434
+ if (t = s ? t : t.toLowerCase(), t = n ? k(t) : t, this.pattern === t) {
435
+ let p = {
436
+ isMatch: !0,
437
+ score: 0
438
+ };
439
+ return r && (p.indices = [[0, t.length - 1]]), p;
440
+ }
441
+ const {
442
+ location: i,
443
+ distance: u,
444
+ threshold: c,
445
+ findAllMatches: o,
446
+ minMatchCharLength: h,
447
+ ignoreLocation: a
448
+ } = this.options;
449
+ let f = [], d = 0, g = !1;
450
+ this.chunks.forEach(({ pattern: p, alphabet: F, startIndex: y }) => {
451
+ const { isMatch: D, score: L, indices: S } = wt(t, p, F, {
452
+ location: i + y,
453
+ distance: u,
454
+ threshold: c,
455
+ findAllMatches: o,
456
+ minMatchCharLength: h,
457
+ includeMatches: r,
458
+ ignoreLocation: a
459
+ });
460
+ D && (g = !0), d += L, D && S && (f = [...f, ...S]);
461
+ });
462
+ let A = {
463
+ isMatch: g,
464
+ score: g ? d / this.chunks.length : 1
465
+ };
466
+ return g && r && (A.indices = f), A;
467
+ }
468
+ }
469
+ class I {
470
+ constructor(t) {
471
+ this.pattern = t;
472
+ }
473
+ static isMultiMatch(t) {
474
+ return X(t, this.multiRegex);
475
+ }
476
+ static isSingleMatch(t) {
477
+ return X(t, this.singleRegex);
478
+ }
479
+ search() {
480
+ }
481
+ }
482
+ function X(e, t) {
483
+ const s = e.match(t);
484
+ return s ? s[1] : null;
485
+ }
486
+ class Rt extends I {
487
+ constructor(t) {
488
+ super(t);
489
+ }
490
+ static get type() {
491
+ return "exact";
492
+ }
493
+ static get multiRegex() {
494
+ return /^="(.*)"$/;
495
+ }
496
+ static get singleRegex() {
497
+ return /^=(.*)$/;
498
+ }
499
+ search(t) {
500
+ const s = t === this.pattern;
501
+ return {
502
+ isMatch: s,
503
+ score: s ? 0 : 1,
504
+ indices: [0, this.pattern.length - 1]
505
+ };
506
+ }
507
+ }
508
+ class bt extends I {
509
+ constructor(t) {
510
+ super(t);
511
+ }
512
+ static get type() {
513
+ return "inverse-exact";
514
+ }
515
+ static get multiRegex() {
516
+ return /^!"(.*)"$/;
517
+ }
518
+ static get singleRegex() {
519
+ return /^!(.*)$/;
520
+ }
521
+ search(t) {
522
+ const n = t.indexOf(this.pattern) === -1;
523
+ return {
524
+ isMatch: n,
525
+ score: n ? 0 : 1,
526
+ indices: [0, t.length - 1]
527
+ };
528
+ }
529
+ }
530
+ class Ot extends I {
531
+ constructor(t) {
532
+ super(t);
533
+ }
534
+ static get type() {
535
+ return "prefix-exact";
536
+ }
537
+ static get multiRegex() {
538
+ return /^\^"(.*)"$/;
539
+ }
540
+ static get singleRegex() {
541
+ return /^\^(.*)$/;
542
+ }
543
+ search(t) {
544
+ const s = t.startsWith(this.pattern);
545
+ return {
546
+ isMatch: s,
547
+ score: s ? 0 : 1,
548
+ indices: [0, this.pattern.length - 1]
549
+ };
550
+ }
551
+ }
552
+ class $t extends I {
553
+ constructor(t) {
554
+ super(t);
555
+ }
556
+ static get type() {
557
+ return "inverse-prefix-exact";
558
+ }
559
+ static get multiRegex() {
560
+ return /^!\^"(.*)"$/;
561
+ }
562
+ static get singleRegex() {
563
+ return /^!\^(.*)$/;
564
+ }
565
+ search(t) {
566
+ const s = !t.startsWith(this.pattern);
567
+ return {
568
+ isMatch: s,
569
+ score: s ? 0 : 1,
570
+ indices: [0, t.length - 1]
571
+ };
572
+ }
573
+ }
574
+ class kt extends I {
575
+ constructor(t) {
576
+ super(t);
577
+ }
578
+ static get type() {
579
+ return "suffix-exact";
580
+ }
581
+ static get multiRegex() {
582
+ return /^"(.*)"\$$/;
583
+ }
584
+ static get singleRegex() {
585
+ return /^(.*)\$$/;
586
+ }
587
+ search(t) {
588
+ const s = t.endsWith(this.pattern);
589
+ return {
590
+ isMatch: s,
591
+ score: s ? 0 : 1,
592
+ indices: [t.length - this.pattern.length, t.length - 1]
593
+ };
594
+ }
595
+ }
596
+ class Nt extends I {
597
+ constructor(t) {
598
+ super(t);
599
+ }
600
+ static get type() {
601
+ return "inverse-suffix-exact";
602
+ }
603
+ static get multiRegex() {
604
+ return /^!"(.*)"\$$/;
605
+ }
606
+ static get singleRegex() {
607
+ return /^!(.*)\$$/;
608
+ }
609
+ search(t) {
610
+ const s = !t.endsWith(this.pattern);
611
+ return {
612
+ isMatch: s,
613
+ score: s ? 0 : 1,
614
+ indices: [0, t.length - 1]
615
+ };
616
+ }
617
+ }
618
+ class ut extends I {
619
+ constructor(t, {
620
+ location: s = l.location,
621
+ threshold: n = l.threshold,
622
+ distance: r = l.distance,
623
+ includeMatches: i = l.includeMatches,
624
+ findAllMatches: u = l.findAllMatches,
625
+ minMatchCharLength: c = l.minMatchCharLength,
626
+ isCaseSensitive: o = l.isCaseSensitive,
627
+ ignoreDiacritics: h = l.ignoreDiacritics,
628
+ ignoreLocation: a = l.ignoreLocation
629
+ } = {}) {
630
+ super(t), this._bitapSearch = new it(t, {
631
+ location: s,
632
+ threshold: n,
633
+ distance: r,
634
+ includeMatches: i,
635
+ findAllMatches: u,
636
+ minMatchCharLength: c,
637
+ isCaseSensitive: o,
638
+ ignoreDiacritics: h,
639
+ ignoreLocation: a
640
+ });
641
+ }
642
+ static get type() {
643
+ return "fuzzy";
644
+ }
645
+ static get multiRegex() {
646
+ return /^"(.*)"$/;
647
+ }
648
+ static get singleRegex() {
649
+ return /^(.*)$/;
650
+ }
651
+ search(t) {
652
+ return this._bitapSearch.searchIn(t);
653
+ }
654
+ }
655
+ class ct extends I {
656
+ constructor(t) {
657
+ super(t);
658
+ }
659
+ static get type() {
660
+ return "include";
661
+ }
662
+ static get multiRegex() {
663
+ return /^'"(.*)"$/;
664
+ }
665
+ static get singleRegex() {
666
+ return /^'(.*)$/;
667
+ }
668
+ search(t) {
669
+ let s = 0, n;
670
+ const r = [], i = this.pattern.length;
671
+ for (; (n = t.indexOf(this.pattern, s)) > -1; )
672
+ s = n + i, r.push([n, s - 1]);
673
+ const u = !!r.length;
674
+ return {
675
+ isMatch: u,
676
+ score: u ? 0 : 1,
677
+ indices: r
678
+ };
679
+ }
680
+ }
681
+ const K = [
682
+ Rt,
683
+ ct,
684
+ Ot,
685
+ $t,
686
+ Nt,
687
+ kt,
688
+ bt,
689
+ ut
690
+ ], Z = K.length, vt = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Tt = "|";
691
+ function Pt(e, t = {}) {
692
+ return e.split(Tt).map((s) => {
693
+ let n = s.trim().split(vt).filter((i) => i && !!i.trim()), r = [];
694
+ for (let i = 0, u = n.length; i < u; i += 1) {
695
+ const c = n[i];
696
+ let o = !1, h = -1;
697
+ for (; !o && ++h < Z; ) {
698
+ const a = K[h];
699
+ let f = a.isMultiMatch(c);
700
+ f && (r.push(new a(f, t)), o = !0);
701
+ }
702
+ if (!o)
703
+ for (h = -1; ++h < Z; ) {
704
+ const a = K[h];
705
+ let f = a.isSingleMatch(c);
706
+ if (f) {
707
+ r.push(new a(f, t));
708
+ break;
709
+ }
710
+ }
711
+ }
712
+ return r;
713
+ });
714
+ }
715
+ const jt = /* @__PURE__ */ new Set([ut.type, ct.type]);
716
+ class Kt {
717
+ constructor(t, {
718
+ isCaseSensitive: s = l.isCaseSensitive,
719
+ ignoreDiacritics: n = l.ignoreDiacritics,
720
+ includeMatches: r = l.includeMatches,
721
+ minMatchCharLength: i = l.minMatchCharLength,
722
+ ignoreLocation: u = l.ignoreLocation,
723
+ findAllMatches: c = l.findAllMatches,
724
+ location: o = l.location,
725
+ threshold: h = l.threshold,
726
+ distance: a = l.distance
727
+ } = {}) {
728
+ this.query = null, this.options = {
729
+ isCaseSensitive: s,
730
+ ignoreDiacritics: n,
731
+ includeMatches: r,
732
+ minMatchCharLength: i,
733
+ findAllMatches: c,
734
+ ignoreLocation: u,
735
+ location: o,
736
+ threshold: h,
737
+ distance: a
738
+ }, t = s ? t : t.toLowerCase(), t = n ? k(t) : t, this.pattern = t, this.query = Pt(this.pattern, this.options);
739
+ }
740
+ static condition(t, s) {
741
+ return s.useExtendedSearch;
742
+ }
743
+ searchIn(t) {
744
+ const s = this.query;
745
+ if (!s)
746
+ return {
747
+ isMatch: !1,
748
+ score: 1
749
+ };
750
+ const { includeMatches: n, isCaseSensitive: r, ignoreDiacritics: i } = this.options;
751
+ t = r ? t : t.toLowerCase(), t = i ? k(t) : t;
752
+ let u = 0, c = [], o = 0;
753
+ for (let h = 0, a = s.length; h < a; h += 1) {
754
+ const f = s[h];
755
+ c.length = 0, u = 0;
756
+ for (let d = 0, g = f.length; d < g; d += 1) {
757
+ const A = f[d], { isMatch: p, indices: F, score: y } = A.search(t);
758
+ if (p) {
759
+ if (u += 1, o += y, n) {
760
+ const D = A.constructor.type;
761
+ jt.has(D) ? c = [...c, ...F] : c.push(F);
762
+ }
763
+ } else {
764
+ o = 0, u = 0, c.length = 0;
765
+ break;
766
+ }
767
+ }
768
+ if (u) {
769
+ let d = {
770
+ isMatch: !0,
771
+ score: o / u
772
+ };
773
+ return n && (d.indices = c), d;
774
+ }
775
+ }
776
+ return {
777
+ isMatch: !1,
778
+ score: 1
779
+ };
780
+ }
781
+ }
782
+ const W = [];
783
+ function Wt(...e) {
784
+ W.push(...e);
785
+ }
786
+ function z(e, t) {
787
+ for (let s = 0, n = W.length; s < n; s += 1) {
788
+ let r = W[s];
789
+ if (r.condition(e, t))
790
+ return new r(e, t);
791
+ }
792
+ return new it(e, t);
793
+ }
794
+ const N = {
795
+ AND: "$and",
796
+ OR: "$or"
797
+ }, G = {
798
+ PATH: "$path",
799
+ PATTERN: "$val"
800
+ }, H = (e) => !!(e[N.AND] || e[N.OR]), zt = (e) => !!e[G.PATH], Gt = (e) => !m(e) && et(e) && !H(e), q = (e) => ({
801
+ [N.AND]: Object.keys(e).map((t) => ({
802
+ [t]: e[t]
803
+ }))
804
+ });
805
+ function ot(e, t, { auto: s = !0 } = {}) {
806
+ const n = (r) => {
807
+ let i = Object.keys(r);
808
+ const u = zt(r);
809
+ if (!u && i.length > 1 && !H(r))
810
+ return n(q(r));
811
+ if (Gt(r)) {
812
+ const o = u ? r[G.PATH] : i[0], h = u ? r[G.PATTERN] : r[o];
813
+ if (!M(h))
814
+ throw new Error(At(o));
815
+ const a = {
816
+ keyId: j(o),
817
+ pattern: h
818
+ };
819
+ return s && (a.searcher = z(h, t)), a;
820
+ }
821
+ let c = {
822
+ children: [],
823
+ operator: i[0]
824
+ };
825
+ return i.forEach((o) => {
826
+ const h = r[o];
827
+ m(h) && h.forEach((a) => {
828
+ c.children.push(n(a));
829
+ });
830
+ }), c;
831
+ };
832
+ return H(e) || (e = q(e)), n(e);
833
+ }
834
+ function Ht(e, { ignoreFieldNorm: t = l.ignoreFieldNorm }) {
835
+ e.forEach((s) => {
836
+ let n = 1;
837
+ s.matches.forEach(({ key: r, norm: i, score: u }) => {
838
+ const c = r ? r.weight : null;
839
+ n *= Math.pow(
840
+ u === 0 && c ? Number.EPSILON : u,
841
+ (c || 1) * (t ? 1 : i)
842
+ );
843
+ }), s.score = n;
844
+ });
845
+ }
846
+ function Yt(e, t) {
847
+ const s = e.matches;
848
+ t.matches = [], E(s) && s.forEach((n) => {
849
+ if (!E(n.indices) || !n.indices.length)
850
+ return;
851
+ const { indices: r, value: i } = n;
852
+ let u = {
853
+ indices: r,
854
+ value: i
855
+ };
856
+ n.key && (u.key = n.key.src), n.idx > -1 && (u.refIndex = n.idx), t.matches.push(u);
857
+ });
858
+ }
859
+ function Vt(e, t) {
860
+ t.score = e.score;
861
+ }
862
+ function Qt(e, t, {
863
+ includeMatches: s = l.includeMatches,
864
+ includeScore: n = l.includeScore
865
+ } = {}) {
866
+ const r = [];
867
+ return s && r.push(Yt), n && r.push(Vt), e.map((i) => {
868
+ const { idx: u } = i, c = {
869
+ item: t[u],
870
+ refIndex: u
871
+ };
872
+ return r.length && r.forEach((o) => {
873
+ o(i, c);
874
+ }), c;
875
+ });
876
+ }
877
+ class b {
878
+ constructor(t, s = {}, n) {
879
+ this.options = { ...l, ...s }, this.options.useExtendedSearch, this._keyStore = new Ft(this.options.keys), this.setCollection(t, n);
880
+ }
881
+ setCollection(t, s) {
882
+ if (this._docs = t, s && !(s instanceof Y))
883
+ throw new Error(gt);
884
+ this._myIndex = s || rt(this.options.keys, this._docs, {
885
+ getFn: this.options.getFn,
886
+ fieldNormWeight: this.options.fieldNormWeight
887
+ });
888
+ }
889
+ add(t) {
890
+ E(t) && (this._docs.push(t), this._myIndex.add(t));
891
+ }
892
+ remove(t = () => !1) {
893
+ const s = [];
894
+ for (let n = 0, r = this._docs.length; n < r; n += 1) {
895
+ const i = this._docs[n];
896
+ t(i, n) && (this.removeAt(n), n -= 1, r -= 1, s.push(i));
897
+ }
898
+ return s;
899
+ }
900
+ removeAt(t) {
901
+ this._docs.splice(t, 1), this._myIndex.removeAt(t);
902
+ }
903
+ getIndex() {
904
+ return this._myIndex;
905
+ }
906
+ search(t, { limit: s = -1 } = {}) {
907
+ const {
908
+ includeMatches: n,
909
+ includeScore: r,
910
+ shouldSort: i,
911
+ sortFn: u,
912
+ ignoreFieldNorm: c
913
+ } = this.options;
914
+ let o = M(t) ? M(this._docs[0]) ? this._searchStringList(t) : this._searchObjectList(t) : this._searchLogical(t);
915
+ return Ht(o, { ignoreFieldNorm: c }), i && o.sort(u), tt(s) && s > -1 && (o = o.slice(0, s)), Qt(o, this._docs, {
916
+ includeMatches: n,
917
+ includeScore: r
918
+ });
919
+ }
920
+ _searchStringList(t) {
921
+ const s = z(t, this.options), { records: n } = this._myIndex, r = [];
922
+ return n.forEach(({ v: i, i: u, n: c }) => {
923
+ if (!E(i))
924
+ return;
925
+ const { isMatch: o, score: h, indices: a } = s.searchIn(i);
926
+ o && r.push({
927
+ item: i,
928
+ idx: u,
929
+ matches: [{ score: h, value: i, norm: c, indices: a }]
930
+ });
931
+ }), r;
932
+ }
933
+ _searchLogical(t) {
934
+ const s = ot(t, this.options), n = (c, o, h) => {
935
+ if (!c.children) {
936
+ const { keyId: f, searcher: d } = c, g = this._findMatches({
937
+ key: this._keyStore.get(f),
938
+ value: this._myIndex.getValueForItemAtKeyId(o, f),
939
+ searcher: d
940
+ });
941
+ return g && g.length ? [
942
+ {
943
+ idx: h,
944
+ item: o,
945
+ matches: g
946
+ }
947
+ ] : [];
948
+ }
949
+ const a = [];
950
+ for (let f = 0, d = c.children.length; f < d; f += 1) {
951
+ const g = c.children[f], A = n(g, o, h);
952
+ if (A.length)
953
+ a.push(...A);
954
+ else if (c.operator === N.AND)
955
+ return [];
956
+ }
957
+ return a;
958
+ }, r = this._myIndex.records, i = {}, u = [];
959
+ return r.forEach(({ $: c, i: o }) => {
960
+ if (E(c)) {
961
+ let h = n(s, c, o);
962
+ h.length && (i[o] || (i[o] = { idx: o, item: c, matches: [] }, u.push(i[o])), h.forEach(({ matches: a }) => {
963
+ i[o].matches.push(...a);
964
+ }));
965
+ }
966
+ }), u;
967
+ }
968
+ _searchObjectList(t) {
969
+ const s = z(t, this.options), { keys: n, records: r } = this._myIndex, i = [];
970
+ return r.forEach(({ $: u, i: c }) => {
971
+ if (!E(u))
972
+ return;
973
+ let o = [];
974
+ n.forEach((h, a) => {
975
+ o.push(
976
+ ...this._findMatches({
977
+ key: h,
978
+ value: u[a],
979
+ searcher: s
980
+ })
981
+ );
982
+ }), o.length && i.push({
983
+ idx: c,
984
+ item: u,
985
+ matches: o
986
+ });
987
+ }), i;
988
+ }
989
+ _findMatches({ key: t, value: s, searcher: n }) {
990
+ if (!E(s))
991
+ return [];
992
+ let r = [];
993
+ if (m(s))
994
+ s.forEach(({ v: i, i: u, n: c }) => {
995
+ if (!E(i))
996
+ return;
997
+ const { isMatch: o, score: h, indices: a } = n.searchIn(i);
998
+ o && r.push({
999
+ score: h,
1000
+ key: t,
1001
+ value: i,
1002
+ idx: u,
1003
+ norm: c,
1004
+ indices: a
1005
+ });
1006
+ });
1007
+ else {
1008
+ const { v: i, n: u } = s, { isMatch: c, score: o, indices: h } = n.searchIn(i);
1009
+ c && r.push({ score: o, key: t, value: i, norm: u, indices: h });
1010
+ }
1011
+ return r;
1012
+ }
1013
+ }
1014
+ b.version = "7.1.0";
1015
+ b.createIndex = rt;
1016
+ b.parseIndex = It;
1017
+ b.config = l;
1018
+ b.parseQuery = ot;
1019
+ Wt(Kt);
1020
+ export {
1021
+ b as default
1022
+ };
1023
+ //# sourceMappingURL=fuse-BvOe6mNx.js.map