@baishuyun/ui-base 2.3.0 → 2.3.2
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.
- package/dist/Card/Card-BE6v4I-A.js +69 -0
- package/dist/Card/index.js +3 -4
- package/dist/CheckBox/CheckBox--rXaUgMO.js +67 -0
- package/dist/CheckBox/CheckBox-Db8X-pw9.js +33 -0
- package/dist/CheckBox/index.js +4 -39
- package/dist/ColorPicker/ColorPicker-BBP-4-so.js +168 -0
- package/dist/ColorPicker/index.js +6 -5
- package/dist/DropDown/DropDown-CKXi9mXN.js +162 -0
- package/dist/DropDown/index.js +7 -4
- package/dist/Editor/Buttons--dMLPuk2.js +595 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +14 -8
- package/dist/Editor/constants/index.js +53 -20
- package/dist/Editor/index.js +518 -576
- package/dist/Icon/Icon-DppVOyPK.js +19 -0
- package/dist/Icon/index.js +2 -4
- package/dist/InputTag/InputTag-B6N5MZA2.js +139 -0
- package/dist/InputTag/index.js +3 -4
- package/dist/Loading/Loading-Bi5NO-Ky.js +15 -0
- package/dist/Loading/index.js +2 -4
- package/dist/Modal/Modal-FVJpbEgw.js +81 -0
- package/dist/Modal/index.js +3 -4
- package/dist/NotFoundContent/NotFoundContent-CTPpcZOt.js +9 -0
- package/dist/NotFoundContent/index.js +2 -4
- package/dist/Radio/Radio-dyoBNiKF.js +85 -0
- package/dist/Radio/index.js +2 -105
- package/dist/Segmented/Segmented-Dd8glDXI.js +62 -0
- package/dist/Segmented/index.js +2 -4
- package/dist/Select/Select-Bd2ECrB0.js +729 -0
- package/dist/Select/SelectInputSearch-CIXBNLFi.js +46 -0
- package/dist/Select/index.js +11 -6
- package/dist/Tabs/Tabs-C79GTyGd.js +410 -0
- package/dist/Tabs/index.js +6 -7
- package/dist/Tree/index.js +5 -4
- package/dist/Tree/utils/index.js +24 -39
- package/dist/components/Editor/context/EditorContainerContext.d.ts +8 -0
- package/dist/index.js +103 -81
- package/dist/style.css +2 -1
- package/dist/vendors/Tree-CQR9fvpA.js +231 -0
- package/dist/vendors/animations-C5JKFkz4.js +38 -0
- package/dist/vendors/clsx-DNOE4Gl8.js +16 -0
- package/dist/vendors/color-BPWy9DvT.js +12 -0
- package/dist/vendors/fuse.js-BKtvbTjL.js +877 -0
- package/dist/vendors/lexical-hZliMgDv.js +6439 -0
- package/dist/vendors/lodash-es-Bu9xU1fK.js +334 -0
- package/dist/vendors/simplebar-react-CFlS-Nm9.js +370 -0
- package/dist/vendors/tinycolor2-DToeAEPD.js +726 -0
- package/dist/vendors/useFloatingPortal-BA6P5GxV.js +45 -0
- package/dist/vendors/useLocale-BfT0V1j4.js +75 -0
- package/package.json +3 -3
- package/dist/Card/Card-Y1ISqAp9.js +0 -86
- package/dist/CheckBox/CheckBox-C9sXWSA5.js +0 -84
- package/dist/ColorPicker/ColorPicker-D0D5azon.js +0 -216
- package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
- package/dist/Editor/index-C0Rjz8DK.js +0 -846
- package/dist/Icon/Icon-CBlIwtp2.js +0 -24
- package/dist/InputTag/InputTag-C-rQUJnF.js +0 -155
- package/dist/Loading/Loading-CEB4PLUE.js +0 -9
- package/dist/Modal/Modal-z3TvEXwN.js +0 -80
- package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +0 -6
- package/dist/Segmented/Segmented-UgzW78Ey.js +0 -75
- package/dist/Select/Select-hwXXDuLU.js +0 -820
- package/dist/Select/SelectInputSearch-ChUpUgxa.js +0 -34
- package/dist/Tabs/TabSelect-DL8Bhehc.js +0 -445
- package/dist/vendors/Tree-CLEy-xqz.js +0 -235
- package/dist/vendors/clsx-OuTLNxxd.js +0 -16
- package/dist/vendors/color-VzwvCPhF.js +0 -21
- package/dist/vendors/fuse.js-D1DCbUBb.js +0 -1022
- package/dist/vendors/index-MTmG1Ezy.js +0 -15
- package/dist/vendors/lexical-DO7eMeC2.js +0 -5891
- package/dist/vendors/lodash-es-DFpaJB4Y.js +0 -305
- package/dist/vendors/simplebar-react-D68KzE44.js +0 -408
- package/dist/vendors/tinycolor2-Begv3Jc8.js +0 -711
- package/dist/vendors/useFloatingPortal-9VUFOAOG.js +0 -45
- package/dist/vendors/useLocale-DgqW9M3h.js +0 -47
|
@@ -0,0 +1,877 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.mjs
|
|
2
|
+
function e(e) {
|
|
3
|
+
return Array.isArray ? Array.isArray(e) : d(e) === "[object Array]";
|
|
4
|
+
}
|
|
5
|
+
var t = Infinity;
|
|
6
|
+
function n(e) {
|
|
7
|
+
if (typeof e == "string") return e;
|
|
8
|
+
let n = e + "";
|
|
9
|
+
return n == "0" && 1 / e == -t ? "-0" : n;
|
|
10
|
+
}
|
|
11
|
+
function r(e) {
|
|
12
|
+
return e == null ? "" : n(e);
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
return typeof e == "string";
|
|
16
|
+
}
|
|
17
|
+
function a(e) {
|
|
18
|
+
return typeof e == "number";
|
|
19
|
+
}
|
|
20
|
+
function o(e) {
|
|
21
|
+
return e === !0 || e === !1 || c(e) && d(e) == "[object Boolean]";
|
|
22
|
+
}
|
|
23
|
+
function s(e) {
|
|
24
|
+
return typeof e == "object";
|
|
25
|
+
}
|
|
26
|
+
function c(e) {
|
|
27
|
+
return s(e) && e !== null;
|
|
28
|
+
}
|
|
29
|
+
function l(e) {
|
|
30
|
+
return e != null;
|
|
31
|
+
}
|
|
32
|
+
function u(e) {
|
|
33
|
+
return !e.trim().length;
|
|
34
|
+
}
|
|
35
|
+
function d(e) {
|
|
36
|
+
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
|
|
37
|
+
}
|
|
38
|
+
var f = "Incorrect 'index' type", p = (e) => `Invalid value for key ${e}`, m = (e) => `Pattern length exceeds max of ${e}.`, h = (e) => `Missing ${e} property in key`, g = (e) => `Property 'weight' in key '${e}' must be a positive integer`, _ = Object.prototype.hasOwnProperty, v = class {
|
|
39
|
+
constructor(e) {
|
|
40
|
+
this._keys = [], this._keyMap = {};
|
|
41
|
+
let t = 0;
|
|
42
|
+
e.forEach((e) => {
|
|
43
|
+
let n = y(e);
|
|
44
|
+
this._keys.push(n), this._keyMap[n.id] = n, t += n.weight;
|
|
45
|
+
}), this._keys.forEach((e) => {
|
|
46
|
+
e.weight /= t;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
get(e) {
|
|
50
|
+
return this._keyMap[e];
|
|
51
|
+
}
|
|
52
|
+
keys() {
|
|
53
|
+
return this._keys;
|
|
54
|
+
}
|
|
55
|
+
toJSON() {
|
|
56
|
+
return JSON.stringify(this._keys);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function y(t) {
|
|
60
|
+
let n = null, r = null, a = null, o = 1, s = null;
|
|
61
|
+
if (i(t) || e(t)) a = t, n = b(t), r = x(t);
|
|
62
|
+
else {
|
|
63
|
+
if (!_.call(t, "name")) throw Error(h("name"));
|
|
64
|
+
let e = t.name;
|
|
65
|
+
if (a = e, _.call(t, "weight") && (o = t.weight, o <= 0)) throw Error(g(e));
|
|
66
|
+
n = b(e), r = x(e), s = t.getFn;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
path: n,
|
|
70
|
+
id: r,
|
|
71
|
+
weight: o,
|
|
72
|
+
src: a,
|
|
73
|
+
getFn: s
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function b(t) {
|
|
77
|
+
return e(t) ? t : t.split(".");
|
|
78
|
+
}
|
|
79
|
+
function x(t) {
|
|
80
|
+
return e(t) ? t.join(".") : t;
|
|
81
|
+
}
|
|
82
|
+
function S(t, n) {
|
|
83
|
+
let s = [], c = !1, u = (t, n, d) => {
|
|
84
|
+
if (l(t)) if (!n[d]) s.push(t);
|
|
85
|
+
else {
|
|
86
|
+
let f = t[n[d]];
|
|
87
|
+
if (!l(f)) return;
|
|
88
|
+
if (d === n.length - 1 && (i(f) || a(f) || o(f))) s.push(r(f));
|
|
89
|
+
else if (e(f)) {
|
|
90
|
+
c = !0;
|
|
91
|
+
for (let e = 0, t = f.length; e < t; e += 1) u(f[e], n, d + 1);
|
|
92
|
+
} else n.length && u(f, n, d + 1);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return u(t, i(n) ? n.split(".") : n, 0), c ? s : s[0];
|
|
96
|
+
}
|
|
97
|
+
var C = {
|
|
98
|
+
includeMatches: !1,
|
|
99
|
+
findAllMatches: !1,
|
|
100
|
+
minMatchCharLength: 1
|
|
101
|
+
}, w = {
|
|
102
|
+
isCaseSensitive: !1,
|
|
103
|
+
ignoreDiacritics: !1,
|
|
104
|
+
includeScore: !1,
|
|
105
|
+
keys: [],
|
|
106
|
+
shouldSort: !0,
|
|
107
|
+
sortFn: (e, t) => e.score === t.score ? e.idx < t.idx ? -1 : 1 : e.score < t.score ? -1 : 1
|
|
108
|
+
}, ee = {
|
|
109
|
+
location: 0,
|
|
110
|
+
threshold: .6,
|
|
111
|
+
distance: 100
|
|
112
|
+
}, te = {
|
|
113
|
+
useExtendedSearch: !1,
|
|
114
|
+
getFn: S,
|
|
115
|
+
ignoreLocation: !1,
|
|
116
|
+
ignoreFieldNorm: !1,
|
|
117
|
+
fieldNormWeight: 1
|
|
118
|
+
}, T = {
|
|
119
|
+
...w,
|
|
120
|
+
...C,
|
|
121
|
+
...ee,
|
|
122
|
+
...te
|
|
123
|
+
}, E = /[^ ]+/g;
|
|
124
|
+
function ne(e = 1, t = 3) {
|
|
125
|
+
let n = /* @__PURE__ */ new Map(), r = 10 ** t;
|
|
126
|
+
return {
|
|
127
|
+
get(t) {
|
|
128
|
+
let i = t.match(E).length;
|
|
129
|
+
if (n.has(i)) return n.get(i);
|
|
130
|
+
let a = 1 / i ** (.5 * e), o = parseFloat(Math.round(a * r) / r);
|
|
131
|
+
return n.set(i, o), o;
|
|
132
|
+
},
|
|
133
|
+
clear() {
|
|
134
|
+
n.clear();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
var D = class {
|
|
139
|
+
constructor({ getFn: e = T.getFn, fieldNormWeight: t = T.fieldNormWeight } = {}) {
|
|
140
|
+
this.norm = ne(t, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
|
|
141
|
+
}
|
|
142
|
+
setSources(e = []) {
|
|
143
|
+
this.docs = e;
|
|
144
|
+
}
|
|
145
|
+
setIndexRecords(e = []) {
|
|
146
|
+
this.records = e;
|
|
147
|
+
}
|
|
148
|
+
setKeys(e = []) {
|
|
149
|
+
this.keys = e, this._keysMap = {}, e.forEach((e, t) => {
|
|
150
|
+
this._keysMap[e.id] = t;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
create() {
|
|
154
|
+
this.isCreated || !this.docs.length || (this.isCreated = !0, i(this.docs[0]) ? this.docs.forEach((e, t) => {
|
|
155
|
+
this._addString(e, t);
|
|
156
|
+
}) : this.docs.forEach((e, t) => {
|
|
157
|
+
this._addObject(e, t);
|
|
158
|
+
}), this.norm.clear());
|
|
159
|
+
}
|
|
160
|
+
add(e) {
|
|
161
|
+
let t = this.size();
|
|
162
|
+
i(e) ? this._addString(e, t) : this._addObject(e, t);
|
|
163
|
+
}
|
|
164
|
+
removeAt(e) {
|
|
165
|
+
this.records.splice(e, 1);
|
|
166
|
+
for (let t = e, n = this.size(); t < n; t += 1) --this.records[t].i;
|
|
167
|
+
}
|
|
168
|
+
getValueForItemAtKeyId(e, t) {
|
|
169
|
+
return e[this._keysMap[t]];
|
|
170
|
+
}
|
|
171
|
+
size() {
|
|
172
|
+
return this.records.length;
|
|
173
|
+
}
|
|
174
|
+
_addString(e, t) {
|
|
175
|
+
if (!l(e) || u(e)) return;
|
|
176
|
+
let n = {
|
|
177
|
+
v: e,
|
|
178
|
+
i: t,
|
|
179
|
+
n: this.norm.get(e)
|
|
180
|
+
};
|
|
181
|
+
this.records.push(n);
|
|
182
|
+
}
|
|
183
|
+
_addObject(t, n) {
|
|
184
|
+
let r = {
|
|
185
|
+
i: n,
|
|
186
|
+
$: {}
|
|
187
|
+
};
|
|
188
|
+
this.keys.forEach((n, a) => {
|
|
189
|
+
let o = n.getFn ? n.getFn(t) : this.getFn(t, n.path);
|
|
190
|
+
if (l(o)) {
|
|
191
|
+
if (e(o)) {
|
|
192
|
+
let t = [], n = [{
|
|
193
|
+
nestedArrIndex: -1,
|
|
194
|
+
value: o
|
|
195
|
+
}];
|
|
196
|
+
for (; n.length;) {
|
|
197
|
+
let { nestedArrIndex: r, value: a } = n.pop();
|
|
198
|
+
if (l(a)) if (i(a) && !u(a)) {
|
|
199
|
+
let e = {
|
|
200
|
+
v: a,
|
|
201
|
+
i: r,
|
|
202
|
+
n: this.norm.get(a)
|
|
203
|
+
};
|
|
204
|
+
t.push(e);
|
|
205
|
+
} else e(a) && a.forEach((e, t) => {
|
|
206
|
+
n.push({
|
|
207
|
+
nestedArrIndex: t,
|
|
208
|
+
value: e
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
r.$[a] = t;
|
|
213
|
+
} else if (i(o) && !u(o)) {
|
|
214
|
+
let e = {
|
|
215
|
+
v: o,
|
|
216
|
+
n: this.norm.get(o)
|
|
217
|
+
};
|
|
218
|
+
r.$[a] = e;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}), this.records.push(r);
|
|
222
|
+
}
|
|
223
|
+
toJSON() {
|
|
224
|
+
return {
|
|
225
|
+
keys: this.keys,
|
|
226
|
+
records: this.records
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
function O(e, t, { getFn: n = T.getFn, fieldNormWeight: r = T.fieldNormWeight } = {}) {
|
|
231
|
+
let i = new D({
|
|
232
|
+
getFn: n,
|
|
233
|
+
fieldNormWeight: r
|
|
234
|
+
});
|
|
235
|
+
return i.setKeys(e.map(y)), i.setSources(t), i.create(), i;
|
|
236
|
+
}
|
|
237
|
+
function re(e, { getFn: t = T.getFn, fieldNormWeight: n = T.fieldNormWeight } = {}) {
|
|
238
|
+
let { keys: r, records: i } = e, a = new D({
|
|
239
|
+
getFn: t,
|
|
240
|
+
fieldNormWeight: n
|
|
241
|
+
});
|
|
242
|
+
return a.setKeys(r), a.setIndexRecords(i), a;
|
|
243
|
+
}
|
|
244
|
+
function k(e, { errors: t = 0, currentLocation: n = 0, expectedLocation: r = 0, distance: i = T.distance, ignoreLocation: a = T.ignoreLocation } = {}) {
|
|
245
|
+
let o = t / e.length;
|
|
246
|
+
if (a) return o;
|
|
247
|
+
let s = Math.abs(r - n);
|
|
248
|
+
return i ? o + s / i : s ? 1 : o;
|
|
249
|
+
}
|
|
250
|
+
function A(e = [], t = T.minMatchCharLength) {
|
|
251
|
+
let n = [], r = -1, i = -1, a = 0;
|
|
252
|
+
for (let o = e.length; a < o; a += 1) {
|
|
253
|
+
let o = e[a];
|
|
254
|
+
o && r === -1 ? r = a : !o && r !== -1 && (i = a - 1, i - r + 1 >= t && n.push([r, i]), r = -1);
|
|
255
|
+
}
|
|
256
|
+
return e[a - 1] && a - r >= t && n.push([r, a - 1]), n;
|
|
257
|
+
}
|
|
258
|
+
var j = 32;
|
|
259
|
+
function M(e, t, n, { location: r = T.location, distance: i = T.distance, threshold: a = T.threshold, findAllMatches: o = T.findAllMatches, minMatchCharLength: s = T.minMatchCharLength, includeMatches: c = T.includeMatches, ignoreLocation: l = T.ignoreLocation } = {}) {
|
|
260
|
+
if (t.length > j) throw Error(m(j));
|
|
261
|
+
let u = t.length, d = e.length, f = Math.max(0, Math.min(r, d)), p = a, h = f, g = s > 1 || c, _ = g ? Array(d) : [], v;
|
|
262
|
+
for (; (v = e.indexOf(t, h)) > -1;) {
|
|
263
|
+
let e = k(t, {
|
|
264
|
+
currentLocation: v,
|
|
265
|
+
expectedLocation: f,
|
|
266
|
+
distance: i,
|
|
267
|
+
ignoreLocation: l
|
|
268
|
+
});
|
|
269
|
+
if (p = Math.min(e, p), h = v + u, g) {
|
|
270
|
+
let e = 0;
|
|
271
|
+
for (; e < u;) _[v + e] = 1, e += 1;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
h = -1;
|
|
275
|
+
let y = [], b = 1, x = u + d, S = 1 << u - 1;
|
|
276
|
+
for (let r = 0; r < u; r += 1) {
|
|
277
|
+
let a = 0, s = x;
|
|
278
|
+
for (; a < s;) k(t, {
|
|
279
|
+
errors: r,
|
|
280
|
+
currentLocation: f + s,
|
|
281
|
+
expectedLocation: f,
|
|
282
|
+
distance: i,
|
|
283
|
+
ignoreLocation: l
|
|
284
|
+
}) <= p ? a = s : x = s, s = Math.floor((x - a) / 2 + a);
|
|
285
|
+
x = s;
|
|
286
|
+
let c = Math.max(1, f - s + 1), m = o ? d : Math.min(f + s, d) + u, v = Array(m + 2);
|
|
287
|
+
v[m + 1] = (1 << r) - 1;
|
|
288
|
+
for (let a = m; a >= c; --a) {
|
|
289
|
+
let o = a - 1, s = n[e.charAt(o)];
|
|
290
|
+
if (g && (_[o] = +!!s), v[a] = (v[a + 1] << 1 | 1) & s, r && (v[a] |= (y[a + 1] | y[a]) << 1 | 1 | y[a + 1]), v[a] & S && (b = k(t, {
|
|
291
|
+
errors: r,
|
|
292
|
+
currentLocation: o,
|
|
293
|
+
expectedLocation: f,
|
|
294
|
+
distance: i,
|
|
295
|
+
ignoreLocation: l
|
|
296
|
+
}), b <= p)) {
|
|
297
|
+
if (p = b, h = o, h <= f) break;
|
|
298
|
+
c = Math.max(1, 2 * f - h);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (k(t, {
|
|
302
|
+
errors: r + 1,
|
|
303
|
+
currentLocation: f,
|
|
304
|
+
expectedLocation: f,
|
|
305
|
+
distance: i,
|
|
306
|
+
ignoreLocation: l
|
|
307
|
+
}) > p) break;
|
|
308
|
+
y = v;
|
|
309
|
+
}
|
|
310
|
+
let C = {
|
|
311
|
+
isMatch: h >= 0,
|
|
312
|
+
score: Math.max(.001, b)
|
|
313
|
+
};
|
|
314
|
+
if (g) {
|
|
315
|
+
let e = A(_, s);
|
|
316
|
+
e.length ? c && (C.indices = e) : C.isMatch = !1;
|
|
317
|
+
}
|
|
318
|
+
return C;
|
|
319
|
+
}
|
|
320
|
+
function ie(e) {
|
|
321
|
+
let t = {};
|
|
322
|
+
for (let n = 0, r = e.length; n < r; n += 1) {
|
|
323
|
+
let i = e.charAt(n);
|
|
324
|
+
t[i] = (t[i] || 0) | 1 << r - n - 1;
|
|
325
|
+
}
|
|
326
|
+
return t;
|
|
327
|
+
}
|
|
328
|
+
var N = 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), P = class {
|
|
329
|
+
constructor(e, { location: t = T.location, threshold: n = T.threshold, distance: r = T.distance, includeMatches: i = T.includeMatches, findAllMatches: a = T.findAllMatches, minMatchCharLength: o = T.minMatchCharLength, isCaseSensitive: s = T.isCaseSensitive, ignoreDiacritics: c = T.ignoreDiacritics, ignoreLocation: l = T.ignoreLocation } = {}) {
|
|
330
|
+
if (this.options = {
|
|
331
|
+
location: t,
|
|
332
|
+
threshold: n,
|
|
333
|
+
distance: r,
|
|
334
|
+
includeMatches: i,
|
|
335
|
+
findAllMatches: a,
|
|
336
|
+
minMatchCharLength: o,
|
|
337
|
+
isCaseSensitive: s,
|
|
338
|
+
ignoreDiacritics: c,
|
|
339
|
+
ignoreLocation: l
|
|
340
|
+
}, e = s ? e : e.toLowerCase(), e = c ? N(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length) return;
|
|
341
|
+
let u = (e, t) => {
|
|
342
|
+
this.chunks.push({
|
|
343
|
+
pattern: e,
|
|
344
|
+
alphabet: ie(e),
|
|
345
|
+
startIndex: t
|
|
346
|
+
});
|
|
347
|
+
}, d = this.pattern.length;
|
|
348
|
+
if (d > j) {
|
|
349
|
+
let e = 0, t = d % j, n = d - t;
|
|
350
|
+
for (; e < n;) u(this.pattern.substr(e, j), e), e += j;
|
|
351
|
+
if (t) {
|
|
352
|
+
let e = d - j;
|
|
353
|
+
u(this.pattern.substr(e), e);
|
|
354
|
+
}
|
|
355
|
+
} else u(this.pattern, 0);
|
|
356
|
+
}
|
|
357
|
+
searchIn(e) {
|
|
358
|
+
let { isCaseSensitive: t, ignoreDiacritics: n, includeMatches: r } = this.options;
|
|
359
|
+
if (e = t ? e : e.toLowerCase(), e = n ? N(e) : e, this.pattern === e) {
|
|
360
|
+
let t = {
|
|
361
|
+
isMatch: !0,
|
|
362
|
+
score: 0
|
|
363
|
+
};
|
|
364
|
+
return r && (t.indices = [[0, e.length - 1]]), t;
|
|
365
|
+
}
|
|
366
|
+
let { location: i, distance: a, threshold: o, findAllMatches: s, minMatchCharLength: c, ignoreLocation: l } = this.options, u = [], d = 0, f = !1;
|
|
367
|
+
this.chunks.forEach(({ pattern: t, alphabet: n, startIndex: p }) => {
|
|
368
|
+
let { isMatch: m, score: h, indices: g } = M(e, t, n, {
|
|
369
|
+
location: i + p,
|
|
370
|
+
distance: a,
|
|
371
|
+
threshold: o,
|
|
372
|
+
findAllMatches: s,
|
|
373
|
+
minMatchCharLength: c,
|
|
374
|
+
includeMatches: r,
|
|
375
|
+
ignoreLocation: l
|
|
376
|
+
});
|
|
377
|
+
m && (f = !0), d += h, m && g && (u = [...u, ...g]);
|
|
378
|
+
});
|
|
379
|
+
let p = {
|
|
380
|
+
isMatch: f,
|
|
381
|
+
score: f ? d / this.chunks.length : 1
|
|
382
|
+
};
|
|
383
|
+
return f && r && (p.indices = u), p;
|
|
384
|
+
}
|
|
385
|
+
}, F = class {
|
|
386
|
+
constructor(e) {
|
|
387
|
+
this.pattern = e;
|
|
388
|
+
}
|
|
389
|
+
static isMultiMatch(e) {
|
|
390
|
+
return I(e, this.multiRegex);
|
|
391
|
+
}
|
|
392
|
+
static isSingleMatch(e) {
|
|
393
|
+
return I(e, this.singleRegex);
|
|
394
|
+
}
|
|
395
|
+
search() {}
|
|
396
|
+
};
|
|
397
|
+
function I(e, t) {
|
|
398
|
+
let n = e.match(t);
|
|
399
|
+
return n ? n[1] : null;
|
|
400
|
+
}
|
|
401
|
+
var ae = class extends F {
|
|
402
|
+
constructor(e) {
|
|
403
|
+
super(e);
|
|
404
|
+
}
|
|
405
|
+
static get type() {
|
|
406
|
+
return "exact";
|
|
407
|
+
}
|
|
408
|
+
static get multiRegex() {
|
|
409
|
+
return /^="(.*)"$/;
|
|
410
|
+
}
|
|
411
|
+
static get singleRegex() {
|
|
412
|
+
return /^=(.*)$/;
|
|
413
|
+
}
|
|
414
|
+
search(e) {
|
|
415
|
+
let t = e === this.pattern;
|
|
416
|
+
return {
|
|
417
|
+
isMatch: t,
|
|
418
|
+
score: t ? 0 : 1,
|
|
419
|
+
indices: [0, this.pattern.length - 1]
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}, oe = class extends F {
|
|
423
|
+
constructor(e) {
|
|
424
|
+
super(e);
|
|
425
|
+
}
|
|
426
|
+
static get type() {
|
|
427
|
+
return "inverse-exact";
|
|
428
|
+
}
|
|
429
|
+
static get multiRegex() {
|
|
430
|
+
return /^!"(.*)"$/;
|
|
431
|
+
}
|
|
432
|
+
static get singleRegex() {
|
|
433
|
+
return /^!(.*)$/;
|
|
434
|
+
}
|
|
435
|
+
search(e) {
|
|
436
|
+
let t = e.indexOf(this.pattern) === -1;
|
|
437
|
+
return {
|
|
438
|
+
isMatch: t,
|
|
439
|
+
score: t ? 0 : 1,
|
|
440
|
+
indices: [0, e.length - 1]
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}, se = class extends F {
|
|
444
|
+
constructor(e) {
|
|
445
|
+
super(e);
|
|
446
|
+
}
|
|
447
|
+
static get type() {
|
|
448
|
+
return "prefix-exact";
|
|
449
|
+
}
|
|
450
|
+
static get multiRegex() {
|
|
451
|
+
return /^\^"(.*)"$/;
|
|
452
|
+
}
|
|
453
|
+
static get singleRegex() {
|
|
454
|
+
return /^\^(.*)$/;
|
|
455
|
+
}
|
|
456
|
+
search(e) {
|
|
457
|
+
let t = e.startsWith(this.pattern);
|
|
458
|
+
return {
|
|
459
|
+
isMatch: t,
|
|
460
|
+
score: t ? 0 : 1,
|
|
461
|
+
indices: [0, this.pattern.length - 1]
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
}, ce = class extends F {
|
|
465
|
+
constructor(e) {
|
|
466
|
+
super(e);
|
|
467
|
+
}
|
|
468
|
+
static get type() {
|
|
469
|
+
return "inverse-prefix-exact";
|
|
470
|
+
}
|
|
471
|
+
static get multiRegex() {
|
|
472
|
+
return /^!\^"(.*)"$/;
|
|
473
|
+
}
|
|
474
|
+
static get singleRegex() {
|
|
475
|
+
return /^!\^(.*)$/;
|
|
476
|
+
}
|
|
477
|
+
search(e) {
|
|
478
|
+
let t = !e.startsWith(this.pattern);
|
|
479
|
+
return {
|
|
480
|
+
isMatch: t,
|
|
481
|
+
score: t ? 0 : 1,
|
|
482
|
+
indices: [0, e.length - 1]
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
}, L = class extends F {
|
|
486
|
+
constructor(e) {
|
|
487
|
+
super(e);
|
|
488
|
+
}
|
|
489
|
+
static get type() {
|
|
490
|
+
return "suffix-exact";
|
|
491
|
+
}
|
|
492
|
+
static get multiRegex() {
|
|
493
|
+
return /^"(.*)"\$$/;
|
|
494
|
+
}
|
|
495
|
+
static get singleRegex() {
|
|
496
|
+
return /^(.*)\$$/;
|
|
497
|
+
}
|
|
498
|
+
search(e) {
|
|
499
|
+
let t = e.endsWith(this.pattern);
|
|
500
|
+
return {
|
|
501
|
+
isMatch: t,
|
|
502
|
+
score: t ? 0 : 1,
|
|
503
|
+
indices: [e.length - this.pattern.length, e.length - 1]
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
}, R = class extends F {
|
|
507
|
+
constructor(e) {
|
|
508
|
+
super(e);
|
|
509
|
+
}
|
|
510
|
+
static get type() {
|
|
511
|
+
return "inverse-suffix-exact";
|
|
512
|
+
}
|
|
513
|
+
static get multiRegex() {
|
|
514
|
+
return /^!"(.*)"\$$/;
|
|
515
|
+
}
|
|
516
|
+
static get singleRegex() {
|
|
517
|
+
return /^!(.*)\$$/;
|
|
518
|
+
}
|
|
519
|
+
search(e) {
|
|
520
|
+
let t = !e.endsWith(this.pattern);
|
|
521
|
+
return {
|
|
522
|
+
isMatch: t,
|
|
523
|
+
score: t ? 0 : 1,
|
|
524
|
+
indices: [0, e.length - 1]
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
}, z = class extends F {
|
|
528
|
+
constructor(e, { location: t = T.location, threshold: n = T.threshold, distance: r = T.distance, includeMatches: i = T.includeMatches, findAllMatches: a = T.findAllMatches, minMatchCharLength: o = T.minMatchCharLength, isCaseSensitive: s = T.isCaseSensitive, ignoreDiacritics: c = T.ignoreDiacritics, ignoreLocation: l = T.ignoreLocation } = {}) {
|
|
529
|
+
super(e), this._bitapSearch = new P(e, {
|
|
530
|
+
location: t,
|
|
531
|
+
threshold: n,
|
|
532
|
+
distance: r,
|
|
533
|
+
includeMatches: i,
|
|
534
|
+
findAllMatches: a,
|
|
535
|
+
minMatchCharLength: o,
|
|
536
|
+
isCaseSensitive: s,
|
|
537
|
+
ignoreDiacritics: c,
|
|
538
|
+
ignoreLocation: l
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
static get type() {
|
|
542
|
+
return "fuzzy";
|
|
543
|
+
}
|
|
544
|
+
static get multiRegex() {
|
|
545
|
+
return /^"(.*)"$/;
|
|
546
|
+
}
|
|
547
|
+
static get singleRegex() {
|
|
548
|
+
return /^(.*)$/;
|
|
549
|
+
}
|
|
550
|
+
search(e) {
|
|
551
|
+
return this._bitapSearch.searchIn(e);
|
|
552
|
+
}
|
|
553
|
+
}, B = class extends F {
|
|
554
|
+
constructor(e) {
|
|
555
|
+
super(e);
|
|
556
|
+
}
|
|
557
|
+
static get type() {
|
|
558
|
+
return "include";
|
|
559
|
+
}
|
|
560
|
+
static get multiRegex() {
|
|
561
|
+
return /^'"(.*)"$/;
|
|
562
|
+
}
|
|
563
|
+
static get singleRegex() {
|
|
564
|
+
return /^'(.*)$/;
|
|
565
|
+
}
|
|
566
|
+
search(e) {
|
|
567
|
+
let t = 0, n, r = [], i = this.pattern.length;
|
|
568
|
+
for (; (n = e.indexOf(this.pattern, t)) > -1;) t = n + i, r.push([n, t - 1]);
|
|
569
|
+
let a = !!r.length;
|
|
570
|
+
return {
|
|
571
|
+
isMatch: a,
|
|
572
|
+
score: a ? 0 : 1,
|
|
573
|
+
indices: r
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
}, V = [
|
|
577
|
+
ae,
|
|
578
|
+
B,
|
|
579
|
+
se,
|
|
580
|
+
ce,
|
|
581
|
+
R,
|
|
582
|
+
L,
|
|
583
|
+
oe,
|
|
584
|
+
z
|
|
585
|
+
], H = V.length, U = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, W = "|";
|
|
586
|
+
function le(e, t = {}) {
|
|
587
|
+
return e.split(W).map((e) => {
|
|
588
|
+
let n = e.trim().split(U).filter((e) => e && !!e.trim()), r = [];
|
|
589
|
+
for (let e = 0, i = n.length; e < i; e += 1) {
|
|
590
|
+
let i = n[e], a = !1, o = -1;
|
|
591
|
+
for (; !a && ++o < H;) {
|
|
592
|
+
let e = V[o], n = e.isMultiMatch(i);
|
|
593
|
+
n && (r.push(new e(n, t)), a = !0);
|
|
594
|
+
}
|
|
595
|
+
if (!a) for (o = -1; ++o < H;) {
|
|
596
|
+
let e = V[o], n = e.isSingleMatch(i);
|
|
597
|
+
if (n) {
|
|
598
|
+
r.push(new e(n, t));
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return r;
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
var ue = new Set([z.type, B.type]), de = class {
|
|
607
|
+
constructor(e, { isCaseSensitive: t = T.isCaseSensitive, ignoreDiacritics: n = T.ignoreDiacritics, includeMatches: r = T.includeMatches, minMatchCharLength: i = T.minMatchCharLength, ignoreLocation: a = T.ignoreLocation, findAllMatches: o = T.findAllMatches, location: s = T.location, threshold: c = T.threshold, distance: l = T.distance } = {}) {
|
|
608
|
+
this.query = null, this.options = {
|
|
609
|
+
isCaseSensitive: t,
|
|
610
|
+
ignoreDiacritics: n,
|
|
611
|
+
includeMatches: r,
|
|
612
|
+
minMatchCharLength: i,
|
|
613
|
+
findAllMatches: o,
|
|
614
|
+
ignoreLocation: a,
|
|
615
|
+
location: s,
|
|
616
|
+
threshold: c,
|
|
617
|
+
distance: l
|
|
618
|
+
}, e = t ? e : e.toLowerCase(), e = n ? N(e) : e, this.pattern = e, this.query = le(this.pattern, this.options);
|
|
619
|
+
}
|
|
620
|
+
static condition(e, t) {
|
|
621
|
+
return t.useExtendedSearch;
|
|
622
|
+
}
|
|
623
|
+
searchIn(e) {
|
|
624
|
+
let t = this.query;
|
|
625
|
+
if (!t) return {
|
|
626
|
+
isMatch: !1,
|
|
627
|
+
score: 1
|
|
628
|
+
};
|
|
629
|
+
let { includeMatches: n, isCaseSensitive: r, ignoreDiacritics: i } = this.options;
|
|
630
|
+
e = r ? e : e.toLowerCase(), e = i ? N(e) : e;
|
|
631
|
+
let a = 0, o = [], s = 0;
|
|
632
|
+
for (let r = 0, i = t.length; r < i; r += 1) {
|
|
633
|
+
let i = t[r];
|
|
634
|
+
o.length = 0, a = 0;
|
|
635
|
+
for (let t = 0, r = i.length; t < r; t += 1) {
|
|
636
|
+
let r = i[t], { isMatch: c, indices: l, score: u } = r.search(e);
|
|
637
|
+
if (c) {
|
|
638
|
+
if (a += 1, s += u, n) {
|
|
639
|
+
let e = r.constructor.type;
|
|
640
|
+
ue.has(e) ? o = [...o, ...l] : o.push(l);
|
|
641
|
+
}
|
|
642
|
+
} else {
|
|
643
|
+
s = 0, a = 0, o.length = 0;
|
|
644
|
+
break;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (a) {
|
|
648
|
+
let e = {
|
|
649
|
+
isMatch: !0,
|
|
650
|
+
score: s / a
|
|
651
|
+
};
|
|
652
|
+
return n && (e.indices = o), e;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
return {
|
|
656
|
+
isMatch: !1,
|
|
657
|
+
score: 1
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
}, G = [];
|
|
661
|
+
function fe(...e) {
|
|
662
|
+
G.push(...e);
|
|
663
|
+
}
|
|
664
|
+
function K(e, t) {
|
|
665
|
+
for (let n = 0, r = G.length; n < r; n += 1) {
|
|
666
|
+
let r = G[n];
|
|
667
|
+
if (r.condition(e, t)) return new r(e, t);
|
|
668
|
+
}
|
|
669
|
+
return new P(e, t);
|
|
670
|
+
}
|
|
671
|
+
var q = {
|
|
672
|
+
AND: "$and",
|
|
673
|
+
OR: "$or"
|
|
674
|
+
}, J = {
|
|
675
|
+
PATH: "$path",
|
|
676
|
+
PATTERN: "$val"
|
|
677
|
+
}, Y = (e) => !!(e[q.AND] || e[q.OR]), pe = (e) => !!e[J.PATH], me = (t) => !e(t) && s(t) && !Y(t), X = (e) => ({ [q.AND]: Object.keys(e).map((t) => ({ [t]: e[t] })) });
|
|
678
|
+
function Z(t, n, { auto: r = !0 } = {}) {
|
|
679
|
+
let a = (t) => {
|
|
680
|
+
let o = Object.keys(t), s = pe(t);
|
|
681
|
+
if (!s && o.length > 1 && !Y(t)) return a(X(t));
|
|
682
|
+
if (me(t)) {
|
|
683
|
+
let e = s ? t[J.PATH] : o[0], a = s ? t[J.PATTERN] : t[e];
|
|
684
|
+
if (!i(a)) throw Error(p(e));
|
|
685
|
+
let c = {
|
|
686
|
+
keyId: x(e),
|
|
687
|
+
pattern: a
|
|
688
|
+
};
|
|
689
|
+
return r && (c.searcher = K(a, n)), c;
|
|
690
|
+
}
|
|
691
|
+
let c = {
|
|
692
|
+
children: [],
|
|
693
|
+
operator: o[0]
|
|
694
|
+
};
|
|
695
|
+
return o.forEach((n) => {
|
|
696
|
+
let r = t[n];
|
|
697
|
+
e(r) && r.forEach((e) => {
|
|
698
|
+
c.children.push(a(e));
|
|
699
|
+
});
|
|
700
|
+
}), c;
|
|
701
|
+
};
|
|
702
|
+
return Y(t) || (t = X(t)), a(t);
|
|
703
|
+
}
|
|
704
|
+
function Q(e, { ignoreFieldNorm: t = T.ignoreFieldNorm }) {
|
|
705
|
+
e.forEach((e) => {
|
|
706
|
+
let n = 1;
|
|
707
|
+
e.matches.forEach(({ key: e, norm: r, score: i }) => {
|
|
708
|
+
let a = e ? e.weight : null;
|
|
709
|
+
n *= (i === 0 && a ? 2 ** -52 : i) ** +((a || 1) * (t ? 1 : r));
|
|
710
|
+
}), e.score = n;
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function he(e, t) {
|
|
714
|
+
let n = e.matches;
|
|
715
|
+
t.matches = [], l(n) && n.forEach((e) => {
|
|
716
|
+
if (!l(e.indices) || !e.indices.length) return;
|
|
717
|
+
let { indices: n, value: r } = e, i = {
|
|
718
|
+
indices: n,
|
|
719
|
+
value: r
|
|
720
|
+
};
|
|
721
|
+
e.key && (i.key = e.key.src), e.idx > -1 && (i.refIndex = e.idx), t.matches.push(i);
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
function ge(e, t) {
|
|
725
|
+
t.score = e.score;
|
|
726
|
+
}
|
|
727
|
+
function _e(e, t, { includeMatches: n = T.includeMatches, includeScore: r = T.includeScore } = {}) {
|
|
728
|
+
let i = [];
|
|
729
|
+
return n && i.push(he), r && i.push(ge), e.map((e) => {
|
|
730
|
+
let { idx: n } = e, r = {
|
|
731
|
+
item: t[n],
|
|
732
|
+
refIndex: n
|
|
733
|
+
};
|
|
734
|
+
return i.length && i.forEach((t) => {
|
|
735
|
+
t(e, r);
|
|
736
|
+
}), r;
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
var $ = class {
|
|
740
|
+
constructor(e, t = {}, n) {
|
|
741
|
+
this.options = {
|
|
742
|
+
...T,
|
|
743
|
+
...t
|
|
744
|
+
}, this.options.useExtendedSearch, this._keyStore = new v(this.options.keys), this.setCollection(e, n);
|
|
745
|
+
}
|
|
746
|
+
setCollection(e, t) {
|
|
747
|
+
if (this._docs = e, t && !(t instanceof D)) throw Error(f);
|
|
748
|
+
this._myIndex = t || O(this.options.keys, this._docs, {
|
|
749
|
+
getFn: this.options.getFn,
|
|
750
|
+
fieldNormWeight: this.options.fieldNormWeight
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
add(e) {
|
|
754
|
+
l(e) && (this._docs.push(e), this._myIndex.add(e));
|
|
755
|
+
}
|
|
756
|
+
remove(e = () => !1) {
|
|
757
|
+
let t = [];
|
|
758
|
+
for (let n = 0, r = this._docs.length; n < r; n += 1) {
|
|
759
|
+
let i = this._docs[n];
|
|
760
|
+
e(i, n) && (this.removeAt(n), --n, --r, t.push(i));
|
|
761
|
+
}
|
|
762
|
+
return t;
|
|
763
|
+
}
|
|
764
|
+
removeAt(e) {
|
|
765
|
+
this._docs.splice(e, 1), this._myIndex.removeAt(e);
|
|
766
|
+
}
|
|
767
|
+
getIndex() {
|
|
768
|
+
return this._myIndex;
|
|
769
|
+
}
|
|
770
|
+
search(e, { limit: t = -1 } = {}) {
|
|
771
|
+
let { includeMatches: n, includeScore: r, shouldSort: o, sortFn: s, ignoreFieldNorm: c } = this.options, l = i(e) ? i(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
|
|
772
|
+
return Q(l, { ignoreFieldNorm: c }), o && l.sort(s), a(t) && t > -1 && (l = l.slice(0, t)), _e(l, this._docs, {
|
|
773
|
+
includeMatches: n,
|
|
774
|
+
includeScore: r
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
_searchStringList(e) {
|
|
778
|
+
let t = K(e, this.options), { records: n } = this._myIndex, r = [];
|
|
779
|
+
return n.forEach(({ v: e, i: n, n: i }) => {
|
|
780
|
+
if (!l(e)) return;
|
|
781
|
+
let { isMatch: a, score: o, indices: s } = t.searchIn(e);
|
|
782
|
+
a && r.push({
|
|
783
|
+
item: e,
|
|
784
|
+
idx: n,
|
|
785
|
+
matches: [{
|
|
786
|
+
score: o,
|
|
787
|
+
value: e,
|
|
788
|
+
norm: i,
|
|
789
|
+
indices: s
|
|
790
|
+
}]
|
|
791
|
+
});
|
|
792
|
+
}), r;
|
|
793
|
+
}
|
|
794
|
+
_searchLogical(e) {
|
|
795
|
+
let t = Z(e, this.options), n = (e, t, r) => {
|
|
796
|
+
if (!e.children) {
|
|
797
|
+
let { keyId: n, searcher: i } = e, a = this._findMatches({
|
|
798
|
+
key: this._keyStore.get(n),
|
|
799
|
+
value: this._myIndex.getValueForItemAtKeyId(t, n),
|
|
800
|
+
searcher: i
|
|
801
|
+
});
|
|
802
|
+
return a && a.length ? [{
|
|
803
|
+
idx: r,
|
|
804
|
+
item: t,
|
|
805
|
+
matches: a
|
|
806
|
+
}] : [];
|
|
807
|
+
}
|
|
808
|
+
let i = [];
|
|
809
|
+
for (let a = 0, o = e.children.length; a < o; a += 1) {
|
|
810
|
+
let o = e.children[a], s = n(o, t, r);
|
|
811
|
+
if (s.length) i.push(...s);
|
|
812
|
+
else if (e.operator === q.AND) return [];
|
|
813
|
+
}
|
|
814
|
+
return i;
|
|
815
|
+
}, r = this._myIndex.records, i = {}, a = [];
|
|
816
|
+
return r.forEach(({ $: e, i: r }) => {
|
|
817
|
+
if (l(e)) {
|
|
818
|
+
let o = n(t, e, r);
|
|
819
|
+
o.length && (i[r] || (i[r] = {
|
|
820
|
+
idx: r,
|
|
821
|
+
item: e,
|
|
822
|
+
matches: []
|
|
823
|
+
}, a.push(i[r])), o.forEach(({ matches: e }) => {
|
|
824
|
+
i[r].matches.push(...e);
|
|
825
|
+
}));
|
|
826
|
+
}
|
|
827
|
+
}), a;
|
|
828
|
+
}
|
|
829
|
+
_searchObjectList(e) {
|
|
830
|
+
let t = K(e, this.options), { keys: n, records: r } = this._myIndex, i = [];
|
|
831
|
+
return r.forEach(({ $: e, i: r }) => {
|
|
832
|
+
if (!l(e)) return;
|
|
833
|
+
let a = [];
|
|
834
|
+
n.forEach((n, r) => {
|
|
835
|
+
a.push(...this._findMatches({
|
|
836
|
+
key: n,
|
|
837
|
+
value: e[r],
|
|
838
|
+
searcher: t
|
|
839
|
+
}));
|
|
840
|
+
}), a.length && i.push({
|
|
841
|
+
idx: r,
|
|
842
|
+
item: e,
|
|
843
|
+
matches: a
|
|
844
|
+
});
|
|
845
|
+
}), i;
|
|
846
|
+
}
|
|
847
|
+
_findMatches({ key: t, value: n, searcher: r }) {
|
|
848
|
+
if (!l(n)) return [];
|
|
849
|
+
let i = [];
|
|
850
|
+
if (e(n)) n.forEach(({ v: e, i: n, n: a }) => {
|
|
851
|
+
if (!l(e)) return;
|
|
852
|
+
let { isMatch: o, score: s, indices: c } = r.searchIn(e);
|
|
853
|
+
o && i.push({
|
|
854
|
+
score: s,
|
|
855
|
+
key: t,
|
|
856
|
+
value: e,
|
|
857
|
+
idx: n,
|
|
858
|
+
norm: a,
|
|
859
|
+
indices: c
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
else {
|
|
863
|
+
let { v: e, n: a } = n, { isMatch: o, score: s, indices: c } = r.searchIn(e);
|
|
864
|
+
o && i.push({
|
|
865
|
+
score: s,
|
|
866
|
+
key: t,
|
|
867
|
+
value: e,
|
|
868
|
+
norm: a,
|
|
869
|
+
indices: c
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
return i;
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
$.version = "7.1.0", $.createIndex = O, $.parseIndex = re, $.config = T, $.parseQuery = Z, fe(de);
|
|
876
|
+
//#endregion
|
|
877
|
+
export { $ as t };
|