@sheetxl/studio-vanilla 0.4.20 → 0.4.21
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/browser/cjs/index.cjs +80 -2
- package/browser/cjs/{DlL3FUzHZ4HVF-yg.cjs → n6CXzSocLW_BCO8w.cjs} +6 -6
- package/browser/esm/{BFUWwMA9uskwVkew.mjs → NBuS53B7u8hItiXf.mjs} +933 -937
- package/browser/esm/index.mjs +176 -4
- package/cdn/assets/CY8njwo06MWkoPz2.js +21 -0
- package/cdn/index.js +2 -2
- package/cdn/loader.js +1 -1
- package/package.json +3 -3
- package/browser/cjs/B3IrGavp2xDl72qi.cjs +0 -15
- package/browser/cjs/B4ScrvWBCXLzvNBz.cjs +0 -145
- package/browser/cjs/BBNggAKHDP4QyhrD.cjs +0 -6
- package/browser/cjs/BC_a9wiziJZdu6Au.cjs +0 -6
- package/browser/cjs/BDxykI6GcXpGGGMz.cjs +0 -42
- package/browser/cjs/BK6DsykAfJG4V-cJ.cjs +0 -6
- package/browser/cjs/BKow6xaj0GHFH5-V.cjs +0 -6
- package/browser/cjs/BOAxaoihJZZzZXhd.cjs +0 -6
- package/browser/cjs/BSlU398ba-ACAG1g.cjs +0 -11
- package/browser/cjs/BSoRD8INLnGqOd24.cjs +0 -7
- package/browser/cjs/BTxfWiE-FbVvlbXz.cjs +0 -11
- package/browser/cjs/BdltTXLt7iZT8sku.cjs +0 -6
- package/browser/cjs/Bf-D_AYDbEeRcsvz.cjs +0 -6
- package/browser/cjs/Bhlan81dumwgyb0S.cjs +0 -6
- package/browser/cjs/BlJixWFmG-z3n7dN.cjs +0 -6
- package/browser/cjs/BndDL5HS4RNIfwOd.cjs +0 -15
- package/browser/cjs/Buw8XeqL6XQwxqnQ.cjs +0 -32
- package/browser/cjs/C04_CccTUmfnv-ln.cjs +0 -6
- package/browser/cjs/C4AWzM1Uh9cuE1A9.cjs +0 -6
- package/browser/cjs/C5TLXtw93fBnRGm7.cjs +0 -378
- package/browser/cjs/CKa-Z1SfYc0pkIX2.cjs +0 -6
- package/browser/cjs/CLiSJrUNaSxa5Mn7.cjs +0 -16
- package/browser/cjs/CODi1uYlZ35lFLh9.cjs +0 -6
- package/browser/cjs/CSM5H5PTjrTaUgKK.cjs +0 -6
- package/browser/cjs/CTPgM-UqKCo4_hd1.cjs +0 -6
- package/browser/cjs/CW5RuE4isKBlwHmQ.cjs +0 -6
- package/browser/cjs/CX82d7xySIGMF7yM.cjs +0 -6
- package/browser/cjs/CXik9BghKbVW93T0.cjs +0 -124
- package/browser/cjs/Ccv5NHm99sYZnKE6.cjs +0 -7
- package/browser/cjs/CeH0O9zPmIGKjuT9.cjs +0 -19
- package/browser/cjs/CeLG8vmgbEkx4oD1.cjs +0 -6
- package/browser/cjs/CvYl4W2vXnvHHHoI.cjs +0 -6
- package/browser/cjs/D2J4RLkySRIXFbsa.cjs +0 -6
- package/browser/cjs/D2bZuhwA7aCEA0It.cjs +0 -6
- package/browser/cjs/D3hV1-QRPKCq0om8.cjs +0 -6
- package/browser/cjs/D6WxWENDWFXA_esX.cjs +0 -6
- package/browser/cjs/DEiPHs81OFnGI_GL.cjs +0 -6
- package/browser/cjs/DHiQ_sK8f-95Ft4X.cjs +0 -12
- package/browser/cjs/DMpqQkdCfg2AjXjR.cjs +0 -6
- package/browser/cjs/DUjgS2e8jjyhZF41.cjs +0 -6
- package/browser/cjs/DWIR1gQMiYyoUVpN.cjs +0 -7
- package/browser/cjs/DawJBg8LyIArkwdU.cjs +0 -6
- package/browser/cjs/Dn5IBCKPuNI0ypyZ.cjs +0 -6
- package/browser/cjs/Dp6UwWmFehNr8oln.cjs +0 -6
- package/browser/cjs/Dr95ZpJD5KpADFgL.cjs +0 -6
- package/browser/cjs/IxfGyvVPF27qqDF3.cjs +0 -6
- package/browser/cjs/P7jR9JAKpf5me2pK.cjs +0 -6
- package/browser/cjs/QonkTPcCkOm4Mvas.cjs +0 -6
- package/browser/cjs/T4zy652TD1RHF35F.cjs +0 -6
- package/browser/cjs/d6ywgaNww4eYXcem.cjs +0 -1501
- package/browser/cjs/dQ_t_glP-41DsAl-.cjs +0 -6
- package/browser/cjs/iIOyWIrlq0JiZyZX.cjs +0 -6
- package/browser/cjs/jX_tynzFoHAGPZOz.cjs +0 -6
- package/browser/cjs/nlzloz3gqSXQwTl5.cjs +0 -13
- package/browser/cjs/xPUjEhL251Mb-kyD.cjs +0 -161
- package/browser/cjs/zreCxaXU5L2iHQ99.cjs +0 -6
- package/browser/esm/2vIB3gG-Ct-P7aHY.mjs +0 -24
- package/browser/esm/B1qmfUH_Mmjtp3JU.mjs +0 -56
- package/browser/esm/B4ABRWtE31zu8-wJ.mjs +0 -21
- package/browser/esm/B6c_mMwG96t6MlCE.mjs +0 -10
- package/browser/esm/B7ohU_quBXWjiBEw.mjs +0 -3934
- package/browser/esm/BGJaDv3Ih-M1lFCD.mjs +0 -10
- package/browser/esm/BJkeQi-0GTlyPsTT.mjs +0 -52369
- package/browser/esm/BR2yOGMlFrbNy1I_.mjs +0 -472
- package/browser/esm/BRzxK84abQUinUUx.mjs +0 -10
- package/browser/esm/BS_-p_4yMCoR9FTp.mjs +0 -10
- package/browser/esm/BTbBL2qySirAIMIH.mjs +0 -1346
- package/browser/esm/Be9tvHxvnxnHNRa4.mjs +0 -12
- package/browser/esm/BfiejFYnvgVrrJPI.mjs +0 -10
- package/browser/esm/Bj4d7nd4XMugBsBg.mjs +0 -39
- package/browser/esm/Bmfu8IUFzu9KyCkA.mjs +0 -10
- package/browser/esm/BqgjdQ15LFcefVOZ.mjs +0 -425
- package/browser/esm/BuX3I7e8lbon25vL.mjs +0 -1702
- package/browser/esm/Bz0TojPavQ5NTjyD.mjs +0 -633
- package/browser/esm/CA33PnXmPNl09v6w.mjs +0 -84
- package/browser/esm/CPchasanZLQiASse.mjs +0 -10
- package/browser/esm/CSDiL3gZro2_BYTj.mjs +0 -10
- package/browser/esm/CT_g1GDC8_vSGR0o.mjs +0 -48
- package/browser/esm/CVvfga1mKyvzrvCr.mjs +0 -20
- package/browser/esm/CXSiJ-t5xz78GMwK.mjs +0 -10
- package/browser/esm/CYrbG4T_bwbc4Un4.mjs +0 -390
- package/browser/esm/CeSDjV2b8w7KibJw.mjs +0 -1466
- package/browser/esm/Cjp7NabZ26PaBnIT.mjs +0 -46
- package/browser/esm/CmLCIveZbsUFrSOH.mjs +0 -1665
- package/browser/esm/CpDyqZXpstRo2buW.mjs +0 -10
- package/browser/esm/CpQM3xIeariuqfsN.mjs +0 -47
- package/browser/esm/D2L4EVLdv-YwKGoi.mjs +0 -2344
- package/browser/esm/D7bqIxhqlHgc3Fih.mjs +0 -10
- package/browser/esm/DJx6S7TOhQyWdjS5.mjs +0 -10
- package/browser/esm/DR85glElKOQxCdEw.mjs +0 -820
- package/browser/esm/DWnopZ6R26qNLVyV.mjs +0 -10
- package/browser/esm/DaoqFa2lhVoZvd16.mjs +0 -421
- package/browser/esm/DgxaqoqInkc26SCt.mjs +0 -13208
- package/browser/esm/Dkf0_o7D9GkUfOZy.mjs +0 -147
- package/browser/esm/DlASr70UXrIpKZQO.mjs +0 -2174
- package/browser/esm/DmXkRZFP-WnV2YT9.mjs +0 -10
- package/browser/esm/DsabS3TdXZB45_O2.mjs +0 -1575
- package/browser/esm/Dvo7tXJcgnIXR-H7.mjs +0 -5582
- package/browser/esm/JdOvTKCcf5acl7vA.mjs +0 -10
- package/browser/esm/KUyPDaQO4D8lwO7O.mjs +0 -21
- package/browser/esm/KWZAe-e6U7Po4gCx.mjs +0 -44
- package/browser/esm/Qjkn8L0WuEQToAqm.mjs +0 -41
- package/browser/esm/RvEM-YtFLw3OMG0V.mjs +0 -29
- package/browser/esm/S2TZ7C9tQtDNeeGo.mjs +0 -10
- package/browser/esm/VYFESZA0Jc8C13ZT.mjs +0 -10
- package/browser/esm/_sUvLBCLSPhV2gF6.mjs +0 -10
- package/browser/esm/dWGGn8a_Ez8kVjgZ.mjs +0 -10
- package/browser/esm/dwY5oHtoGa_ktt9_.mjs +0 -1365
- package/browser/esm/giu63J2gO2p8JJIf.mjs +0 -10
- package/browser/esm/glJJyP0v0nlhAzqM.mjs +0 -10
- package/browser/esm/q5jyS6wUD9X8N3dI.mjs +0 -3755
- package/browser/esm/xbsV0YR05atX96kb.mjs +0 -10
- package/cdn/assets/2vIB3gG-Ct-P7aHY.js +0 -24
- package/cdn/assets/9GNkN_zTAHpnP-uq.js +0 -1575
- package/cdn/assets/B6c_mMwG96t6MlCE.js +0 -10
- package/cdn/assets/BBGivbkBG9VS_rL9.js +0 -3756
- package/cdn/assets/BCfZ9L4sqA1AhATQ.js +0 -46
- package/cdn/assets/BF0szY6Cs6OTiu4J.js +0 -22
- package/cdn/assets/BFvB3zk5mbav2VDI.js +0 -52200
- package/cdn/assets/BGJaDv3Ih-M1lFCD.js +0 -10
- package/cdn/assets/BGQ19MuEoWb0IGOg.js +0 -425
- package/cdn/assets/BKAFXvz5L4pnwrYW.js +0 -41
- package/cdn/assets/BRzxK84abQUinUUx.js +0 -10
- package/cdn/assets/BS_-p_4yMCoR9FTp.js +0 -10
- package/cdn/assets/BTbBL2qySirAIMIH.js +0 -1346
- package/cdn/assets/Be9tvHxvnxnHNRa4.js +0 -12
- package/cdn/assets/BfiejFYnvgVrrJPI.js +0 -10
- package/cdn/assets/Bj6XCGohW0EagXDQ.js +0 -1702
- package/cdn/assets/Bmfu8IUFzu9KyCkA.js +0 -10
- package/cdn/assets/Bnpwlyv8i_gnevRF.js +0 -3934
- package/cdn/assets/BnrLDtUMM23rGXOR.js +0 -390
- package/cdn/assets/Bz0TojPavQ5NTjyD.js +0 -633
- package/cdn/assets/C-saEYaoPI4gaVAh.js +0 -820
- package/cdn/assets/CBG91FlGgFb_NSW3.js +0 -1466
- package/cdn/assets/CO9eLmNMi1heLPMx.js +0 -2177
- package/cdn/assets/CPchasanZLQiASse.js +0 -10
- package/cdn/assets/CSDiL3gZro2_BYTj.js +0 -10
- package/cdn/assets/CXSiJ-t5xz78GMwK.js +0 -10
- package/cdn/assets/Cc_7h2P328hlBcqK.js +0 -472
- package/cdn/assets/CmLCIveZbsUFrSOH.js +0 -1665
- package/cdn/assets/CpDyqZXpstRo2buW.js +0 -10
- package/cdn/assets/Cv2EzXYuphY8Hlz2.js +0 -23
- package/cdn/assets/Cz1EUITrDS2M-lu2.js +0 -2346
- package/cdn/assets/D7bqIxhqlHgc3Fih.js +0 -10
- package/cdn/assets/DDWoPuN8AcPJHNxL.js +0 -58
- package/cdn/assets/DJx6S7TOhQyWdjS5.js +0 -10
- package/cdn/assets/DU8_1yjWbaEkXcbL.js +0 -12
- package/cdn/assets/DWnopZ6R26qNLVyV.js +0 -10
- package/cdn/assets/DYE-hWYAUd_f6MX8.js +0 -46
- package/cdn/assets/DaoqFa2lhVoZvd16.js +0 -421
- package/cdn/assets/DfpCefkqWIezzC8Z.js +0 -49
- package/cdn/assets/DgxaqoqInkc26SCt.js +0 -13208
- package/cdn/assets/DmXkRZFP-WnV2YT9.js +0 -10
- package/cdn/assets/EN4PLLABu5llaV3T.js +0 -21
- package/cdn/assets/JdOvTKCcf5acl7vA.js +0 -10
- package/cdn/assets/KUyPDaQO4D8lwO7O.js +0 -21
- package/cdn/assets/LbFq2oCowUDgCX8L.js +0 -43
- package/cdn/assets/S2TZ7C9tQtDNeeGo.js +0 -10
- package/cdn/assets/SPvRfEBpgC5rbgPz.js +0 -29
- package/cdn/assets/SsQFeDXfmfXHyy1R.js +0 -5582
- package/cdn/assets/TP7wJaHcKRz3uH_W.js +0 -50
- package/cdn/assets/UhBzX4vQryCjy6ce.js +0 -84
- package/cdn/assets/VYFESZA0Jc8C13ZT.js +0 -10
- package/cdn/assets/_sUvLBCLSPhV2gF6.js +0 -10
- package/cdn/assets/dWGGn8a_Ez8kVjgZ.js +0 -10
- package/cdn/assets/dwY5oHtoGa_ktt9_.js +0 -1365
- package/cdn/assets/giu63J2gO2p8JJIf.js +0 -10
- package/cdn/assets/glJJyP0v0nlhAzqM.js +0 -10
- package/cdn/assets/nsmFGDjpeUcAO4is.js +0 -149
- package/cdn/assets/xbsV0YR05atX96kb.js +0 -10
|
@@ -1,633 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.4.20
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/
|
|
7
|
-
function v(t) {
|
|
8
|
-
return Array.isArray ? Array.isArray(t) : Fe(t) === "[object Array]";
|
|
9
|
-
}
|
|
10
|
-
function L(t) {
|
|
11
|
-
return typeof t == "string";
|
|
12
|
-
}
|
|
13
|
-
function Ce(t) {
|
|
14
|
-
return typeof t == "number";
|
|
15
|
-
}
|
|
16
|
-
function me(t) {
|
|
17
|
-
return typeof t == "object";
|
|
18
|
-
}
|
|
19
|
-
function F(t) {
|
|
20
|
-
return t != null;
|
|
21
|
-
}
|
|
22
|
-
function te(t) {
|
|
23
|
-
return !t.trim().length;
|
|
24
|
-
}
|
|
25
|
-
function Fe(t) {
|
|
26
|
-
return t == null ? t === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(t);
|
|
27
|
-
}
|
|
28
|
-
const le = Object.prototype.hasOwnProperty;
|
|
29
|
-
class Ie {
|
|
30
|
-
constructor(e) {
|
|
31
|
-
this._keys = [], this._keyMap = {};
|
|
32
|
-
let s = 0;
|
|
33
|
-
e.forEach((i) => {
|
|
34
|
-
let n = Me(i);
|
|
35
|
-
this._keys.push(n), this._keyMap[n.id] = n, s += n.weight;
|
|
36
|
-
}), this._keys.forEach((i) => {
|
|
37
|
-
i.weight /= s;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
get(e) {
|
|
41
|
-
return this._keyMap[e];
|
|
42
|
-
}
|
|
43
|
-
keys() {
|
|
44
|
-
return this._keys;
|
|
45
|
-
}
|
|
46
|
-
toJSON() {
|
|
47
|
-
return JSON.stringify(this._keys);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function Me(t) {
|
|
51
|
-
let e = null, s = null, i = null, n = 1, r = null;
|
|
52
|
-
if (L(t) || v(t)) i = t, e = de(t), s = ie(t);
|
|
53
|
-
else {
|
|
54
|
-
if (!le.call(t, "name")) throw new Error("Missing name property in key");
|
|
55
|
-
const u = t.name;
|
|
56
|
-
if (i = u, le.call(t, "weight") && (n = t.weight, n <= 0)) throw new Error(`Property 'weight' in key '${u}' must be a positive integer`);
|
|
57
|
-
e = de(u), s = ie(u), r = t.getFn;
|
|
58
|
-
}
|
|
59
|
-
return { path: e, id: s, weight: n, src: i, getFn: r };
|
|
60
|
-
}
|
|
61
|
-
function de(t) {
|
|
62
|
-
return v(t) ? t : t.split(".");
|
|
63
|
-
}
|
|
64
|
-
function ie(t) {
|
|
65
|
-
return v(t) ? t.join(".") : t;
|
|
66
|
-
}
|
|
67
|
-
var l = { isCaseSensitive: !1, ignoreDiacritics: !1, includeScore: !1, keys: [], shouldSort: !0, sortFn: (t, e) => t.score === e.score ? t.idx < e.idx ? -1 : 1 : t.score < e.score ? -1 : 1, includeMatches: !1, findAllMatches: !1, minMatchCharLength: 1, location: 0, threshold: 0.6, distance: 100, useExtendedSearch: !1, getFn: function(t, e) {
|
|
68
|
-
let s = [], i = !1;
|
|
69
|
-
const n = (r, u, h) => {
|
|
70
|
-
if (F(r)) if (u[h]) {
|
|
71
|
-
const a = r[u[h]];
|
|
72
|
-
if (!F(a)) return;
|
|
73
|
-
if (h === u.length - 1 && (L(a) || Ce(a) || function(o) {
|
|
74
|
-
return o === !0 || o === !1 || me(d = o) && d !== null && Fe(o) == "[object Boolean]";
|
|
75
|
-
var d;
|
|
76
|
-
}(a))) s.push((c = a) == null ? "" : function(o) {
|
|
77
|
-
if (typeof o == "string") return o;
|
|
78
|
-
let d = o + "";
|
|
79
|
-
return d == "0" && 1 / o == -1 / 0 ? "-0" : d;
|
|
80
|
-
}(c));
|
|
81
|
-
else if (v(a)) {
|
|
82
|
-
i = !0;
|
|
83
|
-
for (let o = 0, d = a.length; o < d; o += 1) n(a[o], u, h + 1);
|
|
84
|
-
} else u.length && n(a, u, h + 1);
|
|
85
|
-
} else s.push(r);
|
|
86
|
-
var c;
|
|
87
|
-
};
|
|
88
|
-
return n(t, L(e) ? e.split(".") : e, 0), i ? s : s[0];
|
|
89
|
-
}, ignoreLocation: !1, ignoreFieldNorm: !1, fieldNormWeight: 1 };
|
|
90
|
-
const we = /[^ ]+/g;
|
|
91
|
-
class ce {
|
|
92
|
-
constructor({ getFn: e = l.getFn, fieldNormWeight: s = l.fieldNormWeight } = {}) {
|
|
93
|
-
this.norm = function(i = 1, n = 3) {
|
|
94
|
-
const r = /* @__PURE__ */ new Map(), u = Math.pow(10, n);
|
|
95
|
-
return { get(h) {
|
|
96
|
-
const c = h.match(we).length;
|
|
97
|
-
if (r.has(c)) return r.get(c);
|
|
98
|
-
const a = 1 / Math.pow(c, 0.5 * i), o = parseFloat(Math.round(a * u) / u);
|
|
99
|
-
return r.set(c, o), o;
|
|
100
|
-
}, clear() {
|
|
101
|
-
r.clear();
|
|
102
|
-
} };
|
|
103
|
-
}(s, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
|
|
104
|
-
}
|
|
105
|
-
setSources(e = []) {
|
|
106
|
-
this.docs = e;
|
|
107
|
-
}
|
|
108
|
-
setIndexRecords(e = []) {
|
|
109
|
-
this.records = e;
|
|
110
|
-
}
|
|
111
|
-
setKeys(e = []) {
|
|
112
|
-
this.keys = e, this._keysMap = {}, e.forEach((s, i) => {
|
|
113
|
-
this._keysMap[s.id] = i;
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
create() {
|
|
117
|
-
!this.isCreated && this.docs.length && (this.isCreated = !0, L(this.docs[0]) ? this.docs.forEach((e, s) => {
|
|
118
|
-
this._addString(e, s);
|
|
119
|
-
}) : this.docs.forEach((e, s) => {
|
|
120
|
-
this._addObject(e, s);
|
|
121
|
-
}), this.norm.clear());
|
|
122
|
-
}
|
|
123
|
-
add(e) {
|
|
124
|
-
const s = this.size();
|
|
125
|
-
L(e) ? this._addString(e, s) : this._addObject(e, s);
|
|
126
|
-
}
|
|
127
|
-
removeAt(e) {
|
|
128
|
-
this.records.splice(e, 1);
|
|
129
|
-
for (let s = e, i = this.size(); s < i; s += 1) this.records[s].i -= 1;
|
|
130
|
-
}
|
|
131
|
-
getValueForItemAtKeyId(e, s) {
|
|
132
|
-
return e[this._keysMap[s]];
|
|
133
|
-
}
|
|
134
|
-
size() {
|
|
135
|
-
return this.records.length;
|
|
136
|
-
}
|
|
137
|
-
_addString(e, s) {
|
|
138
|
-
if (!F(e) || te(e)) return;
|
|
139
|
-
let i = { v: e, i: s, n: this.norm.get(e) };
|
|
140
|
-
this.records.push(i);
|
|
141
|
-
}
|
|
142
|
-
_addObject(e, s) {
|
|
143
|
-
let i = { i: s, $: {} };
|
|
144
|
-
this.keys.forEach((n, r) => {
|
|
145
|
-
let u = n.getFn ? n.getFn(e) : this.getFn(e, n.path);
|
|
146
|
-
if (F(u)) {
|
|
147
|
-
if (v(u)) {
|
|
148
|
-
let h = [];
|
|
149
|
-
const c = [{ nestedArrIndex: -1, value: u }];
|
|
150
|
-
for (; c.length; ) {
|
|
151
|
-
const { nestedArrIndex: a, value: o } = c.pop();
|
|
152
|
-
if (F(o)) if (L(o) && !te(o)) {
|
|
153
|
-
let d = { v: o, i: a, n: this.norm.get(o) };
|
|
154
|
-
h.push(d);
|
|
155
|
-
} else v(o) && o.forEach((d, f) => {
|
|
156
|
-
c.push({ nestedArrIndex: f, value: d });
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
i.$[r] = h;
|
|
160
|
-
} else if (L(u) && !te(u)) {
|
|
161
|
-
let h = { v: u, n: this.norm.get(u) };
|
|
162
|
-
i.$[r] = h;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}), this.records.push(i);
|
|
166
|
-
}
|
|
167
|
-
toJSON() {
|
|
168
|
-
return { keys: this.keys, records: this.records };
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function Ee(t, e, { getFn: s = l.getFn, fieldNormWeight: i = l.fieldNormWeight } = {}) {
|
|
172
|
-
const n = new ce({ getFn: s, fieldNormWeight: i });
|
|
173
|
-
return n.setKeys(t.map(Me)), n.setSources(e), n.create(), n;
|
|
174
|
-
}
|
|
175
|
-
function X(t, { errors: e = 0, currentLocation: s = 0, expectedLocation: i = 0, distance: n = l.distance, ignoreLocation: r = l.ignoreLocation } = {}) {
|
|
176
|
-
const u = e / t.length;
|
|
177
|
-
if (r) return u;
|
|
178
|
-
const h = Math.abs(i - s);
|
|
179
|
-
return n ? u + h / n : h ? 1 : u;
|
|
180
|
-
}
|
|
181
|
-
const z = 32;
|
|
182
|
-
function $e(t) {
|
|
183
|
-
let e = {};
|
|
184
|
-
for (let s = 0, i = t.length; s < i; s += 1) {
|
|
185
|
-
const n = t.charAt(s);
|
|
186
|
-
e[n] = (e[n] || 0) | 1 << i - s - 1;
|
|
187
|
-
}
|
|
188
|
-
return e;
|
|
189
|
-
}
|
|
190
|
-
const Y = String.prototype.normalize ? (t) => t.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, "") : (t) => t;
|
|
191
|
-
class De {
|
|
192
|
-
constructor(e, { location: s = l.location, threshold: i = l.threshold, distance: n = l.distance, includeMatches: r = l.includeMatches, findAllMatches: u = l.findAllMatches, minMatchCharLength: h = l.minMatchCharLength, isCaseSensitive: c = l.isCaseSensitive, ignoreDiacritics: a = l.ignoreDiacritics, ignoreLocation: o = l.ignoreLocation } = {}) {
|
|
193
|
-
if (this.options = { location: s, threshold: i, distance: n, includeMatches: r, findAllMatches: u, minMatchCharLength: h, isCaseSensitive: c, ignoreDiacritics: a, ignoreLocation: o }, e = c ? e : e.toLowerCase(), e = a ? Y(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length) return;
|
|
194
|
-
const d = (g, p) => {
|
|
195
|
-
this.chunks.push({ pattern: g, alphabet: $e(g), startIndex: p });
|
|
196
|
-
}, f = this.pattern.length;
|
|
197
|
-
if (f > z) {
|
|
198
|
-
let g = 0;
|
|
199
|
-
const p = f % z, A = f - p;
|
|
200
|
-
for (; g < A; ) d(this.pattern.substr(g, z), g), g += z;
|
|
201
|
-
if (p) {
|
|
202
|
-
const m = f - z;
|
|
203
|
-
d(this.pattern.substr(m), m);
|
|
204
|
-
}
|
|
205
|
-
} else d(this.pattern, 0);
|
|
206
|
-
}
|
|
207
|
-
searchIn(e) {
|
|
208
|
-
const { isCaseSensitive: s, ignoreDiacritics: i, includeMatches: n } = this.options;
|
|
209
|
-
if (e = s ? e : e.toLowerCase(), e = i ? Y(e) : e, this.pattern === e) {
|
|
210
|
-
let A = { isMatch: !0, score: 0 };
|
|
211
|
-
return n && (A.indices = [[0, e.length - 1]]), A;
|
|
212
|
-
}
|
|
213
|
-
const { location: r, distance: u, threshold: h, findAllMatches: c, minMatchCharLength: a, ignoreLocation: o } = this.options;
|
|
214
|
-
let d = [], f = 0, g = !1;
|
|
215
|
-
this.chunks.forEach(({ pattern: A, alphabet: m, startIndex: _ }) => {
|
|
216
|
-
const { isMatch: N, score: w, indices: S } = function(k, $, Le, { location: ke = l.location, distance: J = l.distance, threshold: ve = l.threshold, findAllMatches: _e = l.findAllMatches, minMatchCharLength: he = l.minMatchCharLength, includeMatches: ae = l.includeMatches, ignoreLocation: V = l.ignoreLocation } = {}) {
|
|
217
|
-
if ($.length > z) throw new Error("Pattern length exceeds max of 32.");
|
|
218
|
-
const R = $.length, K = k.length, y = Math.max(0, Math.min(ke, K));
|
|
219
|
-
let O = ve, b = y;
|
|
220
|
-
const Q = he > 1 || ae, Z = Q ? Array(K) : [];
|
|
221
|
-
let U;
|
|
222
|
-
for (; (U = k.indexOf($, b)) > -1; ) {
|
|
223
|
-
let M = X($, { currentLocation: U, expectedLocation: y, distance: J, ignoreLocation: V });
|
|
224
|
-
if (O = Math.min(M, O), b = U + R, Q) {
|
|
225
|
-
let E = 0;
|
|
226
|
-
for (; E < R; ) Z[U + E] = 1, E += 1;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
b = -1;
|
|
230
|
-
let G = [], H = 1, T = R + K;
|
|
231
|
-
const Se = 1 << R - 1;
|
|
232
|
-
for (let M = 0; M < R; M += 1) {
|
|
233
|
-
let E = 0, B = T;
|
|
234
|
-
for (; E < B; ) X($, { errors: M, currentLocation: y + B, expectedLocation: y, distance: J, ignoreLocation: V }) <= O ? E = B : T = B, B = Math.floor((T - E) / 2 + E);
|
|
235
|
-
T = B;
|
|
236
|
-
let j = Math.max(1, y - B + 1), D = _e ? K : Math.min(y + B, K) + R, x = Array(D + 2);
|
|
237
|
-
x[D + 1] = (1 << M) - 1;
|
|
238
|
-
for (let C = D; C >= j; C -= 1) {
|
|
239
|
-
let W = C - 1, P = Le[k.charAt(W)];
|
|
240
|
-
if (Q && (Z[W] = +!!P), x[C] = (x[C + 1] << 1 | 1) & P, M && (x[C] |= (G[C + 1] | G[C]) << 1 | 1 | G[C + 1]), x[C] & Se && (H = X($, { errors: M, currentLocation: W, expectedLocation: y, distance: J, ignoreLocation: V }), H <= O)) {
|
|
241
|
-
if (O = H, b = W, b <= y) break;
|
|
242
|
-
j = Math.max(1, 2 * y - b);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (X($, { errors: M + 1, currentLocation: y, expectedLocation: y, distance: J, ignoreLocation: V }) > O) break;
|
|
246
|
-
G = x;
|
|
247
|
-
}
|
|
248
|
-
const ee = { isMatch: b >= 0, score: Math.max(1e-3, H) };
|
|
249
|
-
if (Q) {
|
|
250
|
-
const M = function(E = [], B = l.minMatchCharLength) {
|
|
251
|
-
let j = [], D = -1, x = -1, C = 0;
|
|
252
|
-
for (let W = E.length; C < W; C += 1) {
|
|
253
|
-
let P = E[C];
|
|
254
|
-
P && D === -1 ? D = C : P || D === -1 || (x = C - 1, x - D + 1 >= B && j.push([D, x]), D = -1);
|
|
255
|
-
}
|
|
256
|
-
return E[C - 1] && C - D >= B && j.push([D, C - 1]), j;
|
|
257
|
-
}(Z, he);
|
|
258
|
-
M.length ? ae && (ee.indices = M) : ee.isMatch = !1;
|
|
259
|
-
}
|
|
260
|
-
return ee;
|
|
261
|
-
}(e, A, m, { location: r + _, distance: u, threshold: h, findAllMatches: c, minMatchCharLength: a, includeMatches: n, ignoreLocation: o });
|
|
262
|
-
N && (g = !0), f += w, N && S && (d = [...d, ...S]);
|
|
263
|
-
});
|
|
264
|
-
let p = { isMatch: g, score: g ? f / this.chunks.length : 1 };
|
|
265
|
-
return g && n && (p.indices = d), p;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
class I {
|
|
269
|
-
constructor(e) {
|
|
270
|
-
this.pattern = e;
|
|
271
|
-
}
|
|
272
|
-
static isMultiMatch(e) {
|
|
273
|
-
return ge(e, this.multiRegex);
|
|
274
|
-
}
|
|
275
|
-
static isSingleMatch(e) {
|
|
276
|
-
return ge(e, this.singleRegex);
|
|
277
|
-
}
|
|
278
|
-
search() {
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
function ge(t, e) {
|
|
282
|
-
const s = t.match(e);
|
|
283
|
-
return s ? s[1] : null;
|
|
284
|
-
}
|
|
285
|
-
class ye extends I {
|
|
286
|
-
constructor(e, { location: s = l.location, threshold: i = l.threshold, distance: n = l.distance, includeMatches: r = l.includeMatches, findAllMatches: u = l.findAllMatches, minMatchCharLength: h = l.minMatchCharLength, isCaseSensitive: c = l.isCaseSensitive, ignoreDiacritics: a = l.ignoreDiacritics, ignoreLocation: o = l.ignoreLocation } = {}) {
|
|
287
|
-
super(e), this._bitapSearch = new De(e, { location: s, threshold: i, distance: n, includeMatches: r, findAllMatches: u, minMatchCharLength: h, isCaseSensitive: c, ignoreDiacritics: a, ignoreLocation: o });
|
|
288
|
-
}
|
|
289
|
-
static get type() {
|
|
290
|
-
return "fuzzy";
|
|
291
|
-
}
|
|
292
|
-
static get multiRegex() {
|
|
293
|
-
return /^"(.*)"$/;
|
|
294
|
-
}
|
|
295
|
-
static get singleRegex() {
|
|
296
|
-
return /^(.*)$/;
|
|
297
|
-
}
|
|
298
|
-
search(e) {
|
|
299
|
-
return this._bitapSearch.searchIn(e);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
class Be extends I {
|
|
303
|
-
constructor(e) {
|
|
304
|
-
super(e);
|
|
305
|
-
}
|
|
306
|
-
static get type() {
|
|
307
|
-
return "include";
|
|
308
|
-
}
|
|
309
|
-
static get multiRegex() {
|
|
310
|
-
return /^'"(.*)"$/;
|
|
311
|
-
}
|
|
312
|
-
static get singleRegex() {
|
|
313
|
-
return /^'(.*)$/;
|
|
314
|
-
}
|
|
315
|
-
search(e) {
|
|
316
|
-
let s, i = 0;
|
|
317
|
-
const n = [], r = this.pattern.length;
|
|
318
|
-
for (; (s = e.indexOf(this.pattern, i)) > -1; ) i = s + r, n.push([s, i - 1]);
|
|
319
|
-
const u = !!n.length;
|
|
320
|
-
return { isMatch: u, score: u ? 0 : 1, indices: n };
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
const ne = [class extends I {
|
|
324
|
-
constructor(t) {
|
|
325
|
-
super(t);
|
|
326
|
-
}
|
|
327
|
-
static get type() {
|
|
328
|
-
return "exact";
|
|
329
|
-
}
|
|
330
|
-
static get multiRegex() {
|
|
331
|
-
return /^="(.*)"$/;
|
|
332
|
-
}
|
|
333
|
-
static get singleRegex() {
|
|
334
|
-
return /^=(.*)$/;
|
|
335
|
-
}
|
|
336
|
-
search(t) {
|
|
337
|
-
const e = t === this.pattern;
|
|
338
|
-
return { isMatch: e, score: e ? 0 : 1, indices: [0, this.pattern.length - 1] };
|
|
339
|
-
}
|
|
340
|
-
}, Be, class extends I {
|
|
341
|
-
constructor(t) {
|
|
342
|
-
super(t);
|
|
343
|
-
}
|
|
344
|
-
static get type() {
|
|
345
|
-
return "prefix-exact";
|
|
346
|
-
}
|
|
347
|
-
static get multiRegex() {
|
|
348
|
-
return /^\^"(.*)"$/;
|
|
349
|
-
}
|
|
350
|
-
static get singleRegex() {
|
|
351
|
-
return /^\^(.*)$/;
|
|
352
|
-
}
|
|
353
|
-
search(t) {
|
|
354
|
-
const e = t.startsWith(this.pattern);
|
|
355
|
-
return { isMatch: e, score: e ? 0 : 1, indices: [0, this.pattern.length - 1] };
|
|
356
|
-
}
|
|
357
|
-
}, class extends I {
|
|
358
|
-
constructor(t) {
|
|
359
|
-
super(t);
|
|
360
|
-
}
|
|
361
|
-
static get type() {
|
|
362
|
-
return "inverse-prefix-exact";
|
|
363
|
-
}
|
|
364
|
-
static get multiRegex() {
|
|
365
|
-
return /^!\^"(.*)"$/;
|
|
366
|
-
}
|
|
367
|
-
static get singleRegex() {
|
|
368
|
-
return /^!\^(.*)$/;
|
|
369
|
-
}
|
|
370
|
-
search(t) {
|
|
371
|
-
const e = !t.startsWith(this.pattern);
|
|
372
|
-
return { isMatch: e, score: e ? 0 : 1, indices: [0, t.length - 1] };
|
|
373
|
-
}
|
|
374
|
-
}, class extends I {
|
|
375
|
-
constructor(t) {
|
|
376
|
-
super(t);
|
|
377
|
-
}
|
|
378
|
-
static get type() {
|
|
379
|
-
return "inverse-suffix-exact";
|
|
380
|
-
}
|
|
381
|
-
static get multiRegex() {
|
|
382
|
-
return /^!"(.*)"\$$/;
|
|
383
|
-
}
|
|
384
|
-
static get singleRegex() {
|
|
385
|
-
return /^!(.*)\$$/;
|
|
386
|
-
}
|
|
387
|
-
search(t) {
|
|
388
|
-
const e = !t.endsWith(this.pattern);
|
|
389
|
-
return { isMatch: e, score: e ? 0 : 1, indices: [0, t.length - 1] };
|
|
390
|
-
}
|
|
391
|
-
}, class extends I {
|
|
392
|
-
constructor(t) {
|
|
393
|
-
super(t);
|
|
394
|
-
}
|
|
395
|
-
static get type() {
|
|
396
|
-
return "suffix-exact";
|
|
397
|
-
}
|
|
398
|
-
static get multiRegex() {
|
|
399
|
-
return /^"(.*)"\$$/;
|
|
400
|
-
}
|
|
401
|
-
static get singleRegex() {
|
|
402
|
-
return /^(.*)\$$/;
|
|
403
|
-
}
|
|
404
|
-
search(t) {
|
|
405
|
-
const e = t.endsWith(this.pattern);
|
|
406
|
-
return { isMatch: e, score: e ? 0 : 1, indices: [t.length - this.pattern.length, t.length - 1] };
|
|
407
|
-
}
|
|
408
|
-
}, class extends I {
|
|
409
|
-
constructor(t) {
|
|
410
|
-
super(t);
|
|
411
|
-
}
|
|
412
|
-
static get type() {
|
|
413
|
-
return "inverse-exact";
|
|
414
|
-
}
|
|
415
|
-
static get multiRegex() {
|
|
416
|
-
return /^!"(.*)"$/;
|
|
417
|
-
}
|
|
418
|
-
static get singleRegex() {
|
|
419
|
-
return /^!(.*)$/;
|
|
420
|
-
}
|
|
421
|
-
search(t) {
|
|
422
|
-
const e = t.indexOf(this.pattern) === -1;
|
|
423
|
-
return { isMatch: e, score: e ? 0 : 1, indices: [0, t.length - 1] };
|
|
424
|
-
}
|
|
425
|
-
}, ye], fe = ne.length, be = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Ne = /* @__PURE__ */ new Set([ye.type, Be.type]), re = [];
|
|
426
|
-
function ue(t, e) {
|
|
427
|
-
for (let s = 0, i = re.length; s < i; s += 1) {
|
|
428
|
-
let n = re[s];
|
|
429
|
-
if (n.condition(t, e)) return new n(t, e);
|
|
430
|
-
}
|
|
431
|
-
return new De(t, e);
|
|
432
|
-
}
|
|
433
|
-
const oe = "$and", Ae = "$path", se = (t) => !(!t[oe] && !t.$or), pe = (t) => ({ [oe]: Object.keys(t).map((e) => ({ [e]: t[e] })) });
|
|
434
|
-
function xe(t, e, { auto: s = !0 } = {}) {
|
|
435
|
-
const i = (n) => {
|
|
436
|
-
let r = Object.keys(n);
|
|
437
|
-
const u = !!n[Ae];
|
|
438
|
-
if (!u && r.length > 1 && !se(n)) return i(pe(n));
|
|
439
|
-
if (((c) => !v(c) && me(c) && !se(c))(n)) {
|
|
440
|
-
const c = u ? n[Ae] : r[0], a = u ? n.$val : n[c];
|
|
441
|
-
if (!L(a)) throw new Error(`Invalid value for key ${c}`);
|
|
442
|
-
const o = { keyId: ie(c), pattern: a };
|
|
443
|
-
return s && (o.searcher = ue(a, e)), o;
|
|
444
|
-
}
|
|
445
|
-
let h = { children: [], operator: r[0] };
|
|
446
|
-
return r.forEach((c) => {
|
|
447
|
-
const a = n[c];
|
|
448
|
-
v(a) && a.forEach((o) => {
|
|
449
|
-
h.children.push(i(o));
|
|
450
|
-
});
|
|
451
|
-
}), h;
|
|
452
|
-
};
|
|
453
|
-
return se(t) || (t = pe(t)), i(t);
|
|
454
|
-
}
|
|
455
|
-
function Re(t, e) {
|
|
456
|
-
const s = t.matches;
|
|
457
|
-
e.matches = [], F(s) && s.forEach((i) => {
|
|
458
|
-
if (!F(i.indices) || !i.indices.length) return;
|
|
459
|
-
const { indices: n, value: r } = i;
|
|
460
|
-
let u = { indices: n, value: r };
|
|
461
|
-
i.key && (u.key = i.key.src), i.idx > -1 && (u.refIndex = i.idx), e.matches.push(u);
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
function Oe(t, e) {
|
|
465
|
-
e.score = t.score;
|
|
466
|
-
}
|
|
467
|
-
class q {
|
|
468
|
-
constructor(e, s = {}, i) {
|
|
469
|
-
this.options = { ...l, ...s }, this.options.useExtendedSearch, this._keyStore = new Ie(this.options.keys), this.setCollection(e, i);
|
|
470
|
-
}
|
|
471
|
-
setCollection(e, s) {
|
|
472
|
-
if (this._docs = e, s && !(s instanceof ce)) throw new Error("Incorrect 'index' type");
|
|
473
|
-
this._myIndex = s || Ee(this.options.keys, this._docs, { getFn: this.options.getFn, fieldNormWeight: this.options.fieldNormWeight });
|
|
474
|
-
}
|
|
475
|
-
add(e) {
|
|
476
|
-
F(e) && (this._docs.push(e), this._myIndex.add(e));
|
|
477
|
-
}
|
|
478
|
-
remove(e = () => !1) {
|
|
479
|
-
const s = [];
|
|
480
|
-
for (let i = 0, n = this._docs.length; i < n; i += 1) {
|
|
481
|
-
const r = this._docs[i];
|
|
482
|
-
e(r, i) && (this.removeAt(i), i -= 1, n -= 1, s.push(r));
|
|
483
|
-
}
|
|
484
|
-
return s;
|
|
485
|
-
}
|
|
486
|
-
removeAt(e) {
|
|
487
|
-
this._docs.splice(e, 1), this._myIndex.removeAt(e);
|
|
488
|
-
}
|
|
489
|
-
getIndex() {
|
|
490
|
-
return this._myIndex;
|
|
491
|
-
}
|
|
492
|
-
search(e, { limit: s = -1 } = {}) {
|
|
493
|
-
const { includeMatches: i, includeScore: n, shouldSort: r, sortFn: u, ignoreFieldNorm: h } = this.options;
|
|
494
|
-
let c = L(e) ? L(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
|
|
495
|
-
return function(a, { ignoreFieldNorm: o = l.ignoreFieldNorm }) {
|
|
496
|
-
a.forEach((d) => {
|
|
497
|
-
let f = 1;
|
|
498
|
-
d.matches.forEach(({ key: g, norm: p, score: A }) => {
|
|
499
|
-
const m = g ? g.weight : null;
|
|
500
|
-
f *= Math.pow(A === 0 && m ? Number.EPSILON : A, (m || 1) * (o ? 1 : p));
|
|
501
|
-
}), d.score = f;
|
|
502
|
-
});
|
|
503
|
-
}(c, { ignoreFieldNorm: h }), r && c.sort(u), Ce(s) && s > -1 && (c = c.slice(0, s)), function(a, o, { includeMatches: d = l.includeMatches, includeScore: f = l.includeScore } = {}) {
|
|
504
|
-
const g = [];
|
|
505
|
-
return d && g.push(Re), f && g.push(Oe), a.map((p) => {
|
|
506
|
-
const { idx: A } = p, m = { item: o[A], refIndex: A };
|
|
507
|
-
return g.length && g.forEach((_) => {
|
|
508
|
-
_(p, m);
|
|
509
|
-
}), m;
|
|
510
|
-
});
|
|
511
|
-
}(c, this._docs, { includeMatches: i, includeScore: n });
|
|
512
|
-
}
|
|
513
|
-
_searchStringList(e) {
|
|
514
|
-
const s = ue(e, this.options), { records: i } = this._myIndex, n = [];
|
|
515
|
-
return i.forEach(({ v: r, i: u, n: h }) => {
|
|
516
|
-
if (!F(r)) return;
|
|
517
|
-
const { isMatch: c, score: a, indices: o } = s.searchIn(r);
|
|
518
|
-
c && n.push({ item: r, idx: u, matches: [{ score: a, value: r, norm: h, indices: o }] });
|
|
519
|
-
}), n;
|
|
520
|
-
}
|
|
521
|
-
_searchLogical(e) {
|
|
522
|
-
const s = xe(e, this.options), i = (h, c, a) => {
|
|
523
|
-
if (!h.children) {
|
|
524
|
-
const { keyId: d, searcher: f } = h, g = this._findMatches({ key: this._keyStore.get(d), value: this._myIndex.getValueForItemAtKeyId(c, d), searcher: f });
|
|
525
|
-
return g && g.length ? [{ idx: a, item: c, matches: g }] : [];
|
|
526
|
-
}
|
|
527
|
-
const o = [];
|
|
528
|
-
for (let d = 0, f = h.children.length; d < f; d += 1) {
|
|
529
|
-
const g = h.children[d], p = i(g, c, a);
|
|
530
|
-
if (p.length) o.push(...p);
|
|
531
|
-
else if (h.operator === oe) return [];
|
|
532
|
-
}
|
|
533
|
-
return o;
|
|
534
|
-
}, n = this._myIndex.records, r = {}, u = [];
|
|
535
|
-
return n.forEach(({ $: h, i: c }) => {
|
|
536
|
-
if (F(h)) {
|
|
537
|
-
let a = i(s, h, c);
|
|
538
|
-
a.length && (r[c] || (r[c] = { idx: c, item: h, matches: [] }, u.push(r[c])), a.forEach(({ matches: o }) => {
|
|
539
|
-
r[c].matches.push(...o);
|
|
540
|
-
}));
|
|
541
|
-
}
|
|
542
|
-
}), u;
|
|
543
|
-
}
|
|
544
|
-
_searchObjectList(e) {
|
|
545
|
-
const s = ue(e, this.options), { keys: i, records: n } = this._myIndex, r = [];
|
|
546
|
-
return n.forEach(({ $: u, i: h }) => {
|
|
547
|
-
if (!F(u)) return;
|
|
548
|
-
let c = [];
|
|
549
|
-
i.forEach((a, o) => {
|
|
550
|
-
c.push(...this._findMatches({ key: a, value: u[o], searcher: s }));
|
|
551
|
-
}), c.length && r.push({ idx: h, item: u, matches: c });
|
|
552
|
-
}), r;
|
|
553
|
-
}
|
|
554
|
-
_findMatches({ key: e, value: s, searcher: i }) {
|
|
555
|
-
if (!F(s)) return [];
|
|
556
|
-
let n = [];
|
|
557
|
-
if (v(s)) s.forEach(({ v: r, i: u, n: h }) => {
|
|
558
|
-
if (!F(r)) return;
|
|
559
|
-
const { isMatch: c, score: a, indices: o } = i.searchIn(r);
|
|
560
|
-
c && n.push({ score: a, key: e, value: r, idx: u, norm: h, indices: o });
|
|
561
|
-
});
|
|
562
|
-
else {
|
|
563
|
-
const { v: r, n: u } = s, { isMatch: h, score: c, indices: a } = i.searchIn(r);
|
|
564
|
-
h && n.push({ score: c, key: e, value: r, norm: u, indices: a });
|
|
565
|
-
}
|
|
566
|
-
return n;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
q.version = "7.1.0", q.createIndex = Ee, q.parseIndex = function(t, { getFn: e = l.getFn, fieldNormWeight: s = l.fieldNormWeight } = {}) {
|
|
570
|
-
const { keys: i, records: n } = t, r = new ce({ getFn: e, fieldNormWeight: s });
|
|
571
|
-
return r.setKeys(i), r.setIndexRecords(n), r;
|
|
572
|
-
}, q.config = l, q.parseQuery = xe, function(...t) {
|
|
573
|
-
re.push(...t);
|
|
574
|
-
}(class {
|
|
575
|
-
constructor(t, { isCaseSensitive: e = l.isCaseSensitive, ignoreDiacritics: s = l.ignoreDiacritics, includeMatches: i = l.includeMatches, minMatchCharLength: n = l.minMatchCharLength, ignoreLocation: r = l.ignoreLocation, findAllMatches: u = l.findAllMatches, location: h = l.location, threshold: c = l.threshold, distance: a = l.distance } = {}) {
|
|
576
|
-
this.query = null, this.options = { isCaseSensitive: e, ignoreDiacritics: s, includeMatches: i, minMatchCharLength: n, findAllMatches: u, ignoreLocation: r, location: h, threshold: c, distance: a }, t = e ? t : t.toLowerCase(), t = s ? Y(t) : t, this.pattern = t, this.query = function(o, d = {}) {
|
|
577
|
-
return o.split("|").map((f) => {
|
|
578
|
-
let g = f.trim().split(be).filter((A) => A && !!A.trim()), p = [];
|
|
579
|
-
for (let A = 0, m = g.length; A < m; A += 1) {
|
|
580
|
-
const _ = g[A];
|
|
581
|
-
let N = !1, w = -1;
|
|
582
|
-
for (; !N && ++w < fe; ) {
|
|
583
|
-
const S = ne[w];
|
|
584
|
-
let k = S.isMultiMatch(_);
|
|
585
|
-
k && (p.push(new S(k, d)), N = !0);
|
|
586
|
-
}
|
|
587
|
-
if (!N) for (w = -1; ++w < fe; ) {
|
|
588
|
-
const S = ne[w];
|
|
589
|
-
let k = S.isSingleMatch(_);
|
|
590
|
-
if (k) {
|
|
591
|
-
p.push(new S(k, d));
|
|
592
|
-
break;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
return p;
|
|
597
|
-
});
|
|
598
|
-
}(this.pattern, this.options);
|
|
599
|
-
}
|
|
600
|
-
static condition(t, e) {
|
|
601
|
-
return e.useExtendedSearch;
|
|
602
|
-
}
|
|
603
|
-
searchIn(t) {
|
|
604
|
-
const e = this.query;
|
|
605
|
-
if (!e) return { isMatch: !1, score: 1 };
|
|
606
|
-
const { includeMatches: s, isCaseSensitive: i, ignoreDiacritics: n } = this.options;
|
|
607
|
-
t = i ? t : t.toLowerCase(), t = n ? Y(t) : t;
|
|
608
|
-
let r = 0, u = [], h = 0;
|
|
609
|
-
for (let c = 0, a = e.length; c < a; c += 1) {
|
|
610
|
-
const o = e[c];
|
|
611
|
-
u.length = 0, r = 0;
|
|
612
|
-
for (let d = 0, f = o.length; d < f; d += 1) {
|
|
613
|
-
const g = o[d], { isMatch: p, indices: A, score: m } = g.search(t);
|
|
614
|
-
if (!p) {
|
|
615
|
-
h = 0, r = 0, u.length = 0;
|
|
616
|
-
break;
|
|
617
|
-
}
|
|
618
|
-
if (r += 1, h += m, s) {
|
|
619
|
-
const _ = g.constructor.type;
|
|
620
|
-
Ne.has(_) ? u = [...u, ...A] : u.push(A);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
if (r) {
|
|
624
|
-
let d = { isMatch: !0, score: h / r };
|
|
625
|
-
return s && (d.indices = u), d;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
return { isMatch: !1, score: 1 };
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
export {
|
|
632
|
-
q as default
|
|
633
|
-
};
|