@oneclick.dev/cms-core-modules 0.0.122 → 0.0.124

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 (162) hide show
  1. package/dist/{ContentEditor-CoJjsV-m.js → ContentEditor-BcIUumah.js} +63 -59
  2. package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-DX1bTQKs.mjs} +27894 -26319
  3. package/dist/{Detail-Dk8E6_uF.mjs → Detail-B7pe808q.mjs} +15 -14
  4. package/dist/Detail-BESGmY7z.js +1 -0
  5. package/dist/{Detail-Cn9Bk0u0.mjs → Detail-B_Q7Qkuz.mjs} +26 -25
  6. package/dist/Detail-CNiLIEh9.js +1 -0
  7. package/dist/{Detail-B_scnidb.mjs → Detail-DNxAzeCs.mjs} +35 -34
  8. package/dist/Detail-t3tOcy3X.js +1 -0
  9. package/dist/Editor-D4evcdhv.mjs +768 -0
  10. package/dist/Editor-gLLtuJbY.js +1 -0
  11. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-BjKpsqT9.js +1 -0
  12. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-D5v5AhLe.mjs +76 -0
  13. package/dist/Knowledge-B66vxz--.js +1 -0
  14. package/dist/Knowledge-BnMTTuJ7.mjs +742 -0
  15. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs} +530 -530
  16. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
  17. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
  18. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
  19. package/dist/Overview-BE4uYPx0.mjs +745 -0
  20. package/dist/Overview-CQRpFhbJ.mjs +286 -0
  21. package/dist/Overview-CTs7sX4d.js +1 -0
  22. package/dist/Overview-Cj89XXKN.js +1 -0
  23. package/dist/Overview-D_c18mbR.mjs +248 -0
  24. package/dist/Overview-g4Rcj245.js +1 -0
  25. package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
  26. package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
  27. package/dist/TableDataWidget-7qvC3Egd.js +1 -0
  28. package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
  29. package/dist/TableOverviewCard-AFq-puJs.js +1 -0
  30. package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
  31. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
  32. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
  33. package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
  34. package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
  35. package/dist/TableView-6mdrL3zx.js +4 -0
  36. package/dist/TableView-Du5nOE6R.mjs +8228 -0
  37. package/dist/Test-CzmOmi53.mjs +447 -0
  38. package/dist/Test-USDtNFY1.js +1 -0
  39. package/dist/UserDetail-DpUL3mhk.mjs +1483 -0
  40. package/dist/UserDetail-KRIfxaYd.js +1 -0
  41. package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
  42. package/dist/agenda-r9Gl85GL.js +1 -0
  43. package/dist/cms-core-modules.css +1 -1
  44. package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
  45. package/dist/dateRangePresets-CPWqst_x.js +1 -0
  46. package/dist/fuse-Deb-Iq39.mjs +1473 -0
  47. package/dist/fuse-_CGUd5Zq.js +1 -0
  48. package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
  49. package/dist/index-CQuN5rKx.js +1 -0
  50. package/dist/index-CnDGeInm.js +1 -0
  51. package/dist/index-CqDTc5Ig.mjs +20 -0
  52. package/dist/index-CyvvAdt4.js +1 -0
  53. package/dist/index-DIRD7t5_.mjs +20 -0
  54. package/dist/index-OJuBYR60.mjs +57 -0
  55. package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
  56. package/dist/index.cjs.js +1 -1
  57. package/dist/index.mjs +671 -118
  58. package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
  59. package/dist/orders-DUa2PVoa.js +1 -0
  60. package/dist/reports-ChCsd1Gk.mjs +1107 -0
  61. package/dist/reports-DmJPm8uP.js +158 -0
  62. package/dist/row-item-C1dUyimV.mjs +204 -0
  63. package/dist/row-item-Cyo3m3MZ.js +1 -0
  64. package/dist/server-handlers.cjs.js +1 -1
  65. package/dist/server-handlers.mjs +1764 -605
  66. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
  67. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
  68. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
  69. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
  70. package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
  71. package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
  72. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Container.d.ts +1 -1
  73. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Row.d.ts +7 -0
  74. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Stack.d.ts +7 -0
  75. package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/resizeHistory.d.ts +9 -0
  76. package/dist/src/contentManager/components/content-editor/tiptap-menus/ElementEditorMenu.vue.d.ts +3 -1
  77. package/dist/src/firebaseAuthManager/components/DeleteUserDialog.vue.d.ts +25 -0
  78. package/dist/src/firebaseAuthManager/components/ReasonActionDialog.vue.d.ts +23 -0
  79. package/dist/src/firebaseAuthManager/components/UserStatusBadge.vue.d.ts +5 -0
  80. package/dist/src/firebaseAuthManager/config.d.ts +151 -0
  81. package/dist/src/firebaseAuthManager/index.d.ts +163 -0
  82. package/dist/src/firebaseAuthManager/index.vue.d.ts +14 -0
  83. package/dist/src/firebaseAuthManager/metadata.d.ts +2 -0
  84. package/dist/src/firebaseAuthManager/pages/Overview.vue.d.ts +2 -0
  85. package/dist/src/firebaseAuthManager/pages/UserDetail.vue.d.ts +2 -0
  86. package/dist/src/firebaseAuthManager/permissions.d.ts +5 -0
  87. package/dist/src/firebaseAuthManager/routes.d.ts +5 -0
  88. package/dist/src/firebaseAuthManager/server.d.ts +162 -0
  89. package/dist/src/firebaseAuthManager/types.d.ts +84 -0
  90. package/dist/src/formBuilder/components/FormPreviewDialog.vue.d.ts +12 -0
  91. package/dist/src/formBuilder/components/FormStatusBadge.vue.d.ts +9 -0
  92. package/dist/src/formBuilder/config.d.ts +31 -0
  93. package/dist/src/formBuilder/index.d.ts +44 -0
  94. package/dist/src/formBuilder/index.vue.d.ts +14 -0
  95. package/dist/src/formBuilder/lib/forms.d.ts +11 -0
  96. package/dist/src/formBuilder/metadata.d.ts +2 -0
  97. package/dist/src/formBuilder/pages/Editor.vue.d.ts +2 -0
  98. package/dist/src/formBuilder/pages/Overview.vue.d.ts +2 -0
  99. package/dist/src/formBuilder/permissions.d.ts +5 -0
  100. package/dist/src/formBuilder/routes.d.ts +5 -0
  101. package/dist/src/formBuilder/server.d.ts +87 -0
  102. package/dist/src/formBuilder/tools.d.ts +1 -0
  103. package/dist/src/formBuilder/types.d.ts +46 -0
  104. package/dist/src/helpbot/composables/useHelpbotApi.d.ts +18 -0
  105. package/dist/src/helpbot/config.d.ts +17 -0
  106. package/dist/src/helpbot/index.d.ts +29 -0
  107. package/dist/src/helpbot/index.vue.d.ts +2 -0
  108. package/dist/src/helpbot/metadata.d.ts +2 -0
  109. package/dist/src/helpbot/pages/Knowledge.vue.d.ts +4 -0
  110. package/dist/src/helpbot/pages/Overview.vue.d.ts +2 -0
  111. package/dist/src/helpbot/pages/Test.vue.d.ts +4 -0
  112. package/dist/src/helpbot/permissions.d.ts +5 -0
  113. package/dist/src/helpbot/routes.d.ts +5 -0
  114. package/dist/src/helpbot/types.d.ts +42 -0
  115. package/dist/src/index.d.ts +3 -0
  116. package/dist/src/server-handlers.d.ts +2 -0
  117. package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
  118. package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
  119. package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
  120. package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
  121. package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
  122. package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
  123. package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
  124. package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
  125. package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
  126. package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
  127. package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
  128. package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
  129. package/dist/src/table/index.d.ts +339 -0
  130. package/dist/src/table/tool-sandbox.d.ts +13 -0
  131. package/dist/src/table/tool-utils.d.ts +11 -0
  132. package/dist/src/table/tools.d.ts +333 -1
  133. package/dist/src/table/types.d.ts +79 -0
  134. package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
  135. package/dist/tool-sandbox-DoF1PsyS.js +115 -0
  136. package/dist/types-9N-DKxNj.mjs +250 -0
  137. package/dist/types-BMraG1kN.js +1 -0
  138. package/dist/types-Cem0vPo_.js +1 -0
  139. package/dist/types-ibC3-e1N.mjs +2630 -0
  140. package/dist/useHelpbotApi-BIIungOh.js +1 -0
  141. package/dist/useHelpbotApi-HC9JSiSn.mjs +229 -0
  142. package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
  143. package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
  144. package/dist/vee-validate-zod-BQElPD0m.js +1 -0
  145. package/dist/vee-validate-zod-CN16K2x9.mjs +1780 -0
  146. package/package.json +17 -17
  147. package/src/formBuilder/tools.ts +1 -0
  148. package/src/table/tools.ts +304 -1
  149. package/dist/Detail-BCUUNWvp.js +0 -1
  150. package/dist/Detail-DGg_xXZc.js +0 -1
  151. package/dist/Detail-Sc2qZdxj.js +0 -1
  152. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
  153. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
  154. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
  155. package/dist/TableView-Ctnep-Qu.mjs +0 -6247
  156. package/dist/TableView-DJqyJL9L.js +0 -4
  157. package/dist/agenda-B54F8cEr.js +0 -1
  158. package/dist/orders-BMosTk6r.js +0 -1
  159. package/dist/reports-BQT_GZzU.js +0 -158
  160. package/dist/reports-DksZCTOw.mjs +0 -837
  161. package/dist/vee-validate-zod-SjDT8X35.mjs +0 -4404
  162. package/dist/vee-validate-zod-VCmLnrtQ.js +0 -1
@@ -0,0 +1,1473 @@
1
+ function y(s) {
2
+ return Array.isArray ? Array.isArray(s) : he(s) === "[object Array]";
3
+ }
4
+ function me(s) {
5
+ if (typeof s == "string")
6
+ return s;
7
+ if (typeof s == "bigint")
8
+ return s.toString();
9
+ const e = s + "";
10
+ return e == "0" && 1 / s == -1 / 0 ? "-0" : e;
11
+ }
12
+ function K(s) {
13
+ return s == null ? "" : me(s);
14
+ }
15
+ function C(s) {
16
+ return typeof s == "string";
17
+ }
18
+ function T(s) {
19
+ return typeof s == "number";
20
+ }
21
+ function Ce(s) {
22
+ return s === !0 || s === !1 || Ee(s) && he(s) == "[object Boolean]";
23
+ }
24
+ function ue(s) {
25
+ return typeof s == "object";
26
+ }
27
+ function Ee(s) {
28
+ return ue(s) && s !== null;
29
+ }
30
+ function M(s) {
31
+ return s != null;
32
+ }
33
+ function $(s) {
34
+ return !s.trim().length;
35
+ }
36
+ function he(s) {
37
+ return s == null ? s === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(s);
38
+ }
39
+ const Me = "Incorrect 'index' type", _e = (s) => `Invalid value for key ${s}`, Fe = (s) => `Pattern length exceeds max of ${s}.`, De = (s) => `Missing ${s} property in key`, Ie = (s) => `Property 'weight' in key '${s}' must be a positive integer`, se = Object.prototype.hasOwnProperty;
40
+ class Be {
41
+ constructor(e) {
42
+ this._keys = [], this._keyMap = {};
43
+ let t = 0;
44
+ e.forEach((n) => {
45
+ const i = ae(n);
46
+ this._keys.push(i), this._keyMap[i.id] = i, t += i.weight;
47
+ }), this._keys.forEach((n) => {
48
+ n.weight /= t;
49
+ });
50
+ }
51
+ get(e) {
52
+ return this._keyMap[e];
53
+ }
54
+ keys() {
55
+ return this._keys;
56
+ }
57
+ toJSON() {
58
+ return JSON.stringify(this._keys);
59
+ }
60
+ }
61
+ function ae(s) {
62
+ let e = null, t = null, n = null, i = 1, r = null;
63
+ if (C(s) || y(s))
64
+ n = s, e = ne(s), t = H(s);
65
+ else {
66
+ if (!se.call(s, "name"))
67
+ throw new Error(De("name"));
68
+ const c = s.name;
69
+ if (n = c, se.call(s, "weight") && (i = s.weight, i <= 0))
70
+ throw new Error(Ie(c));
71
+ e = ne(c), t = H(c), r = s.getFn;
72
+ }
73
+ return {
74
+ path: e,
75
+ id: t,
76
+ weight: i,
77
+ src: n,
78
+ getFn: r
79
+ };
80
+ }
81
+ function ne(s) {
82
+ return y(s) ? s : s.split(".");
83
+ }
84
+ function H(s) {
85
+ return y(s) ? s.join(".") : s;
86
+ }
87
+ function Se(s, e) {
88
+ const t = [];
89
+ let n = !1;
90
+ const i = (r, c, h, o) => {
91
+ if (M(r))
92
+ if (!c[h])
93
+ t.push(o !== void 0 ? {
94
+ v: r,
95
+ i: o
96
+ } : r);
97
+ else {
98
+ const l = c[h], u = r[l];
99
+ if (!M(u))
100
+ return;
101
+ if (h === c.length - 1 && (C(u) || T(u) || Ce(u) || typeof u == "bigint"))
102
+ t.push(o !== void 0 ? {
103
+ v: K(u),
104
+ i: o
105
+ } : K(u));
106
+ else if (y(u)) {
107
+ n = !0;
108
+ for (let f = 0, d = u.length; f < d; f += 1)
109
+ i(u[f], c, h + 1, f);
110
+ } else c.length && i(u, c, h + 1, o);
111
+ }
112
+ };
113
+ return i(s, C(e) ? e.split(".") : e, 0), n ? t : t[0];
114
+ }
115
+ const ye = {
116
+ includeMatches: !1,
117
+ findAllMatches: !1,
118
+ minMatchCharLength: 1
119
+ }, xe = {
120
+ isCaseSensitive: !1,
121
+ ignoreDiacritics: !1,
122
+ includeScore: !1,
123
+ keys: [],
124
+ shouldSort: !0,
125
+ sortFn: (s, e) => s.score === e.score ? s.idx < e.idx ? -1 : 1 : s.score < e.score ? -1 : 1
126
+ }, ve = {
127
+ location: 0,
128
+ threshold: 0.6,
129
+ distance: 100
130
+ }, ke = {
131
+ useExtendedSearch: !1,
132
+ useTokenSearch: !1,
133
+ getFn: Se,
134
+ ignoreLocation: !1,
135
+ ignoreFieldNorm: !1,
136
+ fieldNormWeight: 1
137
+ }, g = Object.freeze({
138
+ ...xe,
139
+ ...ye,
140
+ ...ve,
141
+ ...ke
142
+ }), we = /[^ ]+/g;
143
+ function be(s = 1, e = 3) {
144
+ const t = /* @__PURE__ */ new Map(), n = Math.pow(10, e);
145
+ return {
146
+ get(i) {
147
+ const r = i.match(we).length;
148
+ if (t.has(r))
149
+ return t.get(r);
150
+ const c = 1 / Math.pow(r, 0.5 * s), h = parseFloat(Math.round(c * n) / n);
151
+ return t.set(r, h), h;
152
+ },
153
+ clear() {
154
+ t.clear();
155
+ }
156
+ };
157
+ }
158
+ class X {
159
+ constructor({
160
+ getFn: e = g.getFn,
161
+ fieldNormWeight: t = g.fieldNormWeight
162
+ } = {}) {
163
+ this.norm = be(t, 3), this.getFn = e, this.isCreated = !1, this.docs = [], this.keys = [], this._keysMap = {}, this.setIndexRecords();
164
+ }
165
+ setSources(e = []) {
166
+ this.docs = e;
167
+ }
168
+ setIndexRecords(e = []) {
169
+ this.records = e;
170
+ }
171
+ setKeys(e = []) {
172
+ this.keys = e, this._keysMap = {}, e.forEach((t, n) => {
173
+ this._keysMap[t.id] = n;
174
+ });
175
+ }
176
+ create() {
177
+ this.isCreated || !this.docs.length || (this.isCreated = !0, C(this.docs[0]) ? this.docs.forEach((e, t) => {
178
+ this._addString(e, t);
179
+ }) : this.docs.forEach((e, t) => {
180
+ this._addObject(e, t);
181
+ }), this.norm.clear());
182
+ }
183
+ // Adds a doc to the end of the index
184
+ add(e) {
185
+ const t = this.size();
186
+ C(e) ? this._addString(e, t) : this._addObject(e, t);
187
+ }
188
+ // Removes the doc at the specified index of the index
189
+ removeAt(e) {
190
+ this.records.splice(e, 1);
191
+ for (let t = e, n = this.size(); t < n; t += 1)
192
+ this.records[t].i -= 1;
193
+ }
194
+ // Removes docs at the specified indices (must be sorted ascending)
195
+ removeAll(e) {
196
+ for (let t = e.length - 1; t >= 0; t -= 1)
197
+ this.records.splice(e[t], 1);
198
+ for (let t = 0, n = this.records.length; t < n; t += 1)
199
+ this.records[t].i = t;
200
+ }
201
+ getValueForItemAtKeyId(e, t) {
202
+ return e[this._keysMap[t]];
203
+ }
204
+ size() {
205
+ return this.records.length;
206
+ }
207
+ _addString(e, t) {
208
+ if (!M(e) || $(e))
209
+ return;
210
+ const n = {
211
+ v: e,
212
+ i: t,
213
+ n: this.norm.get(e)
214
+ };
215
+ this.records.push(n);
216
+ }
217
+ _addObject(e, t) {
218
+ const n = {
219
+ i: t,
220
+ $: {}
221
+ };
222
+ this.keys.forEach((i, r) => {
223
+ const c = i.getFn ? i.getFn(e) : this.getFn(e, i.path);
224
+ if (M(c)) {
225
+ if (y(c)) {
226
+ const h = [];
227
+ for (let o = 0, l = c.length; o < l; o += 1) {
228
+ const u = c[o];
229
+ if (M(u)) {
230
+ if (C(u)) {
231
+ if (!$(u)) {
232
+ const f = {
233
+ v: u,
234
+ i: o,
235
+ n: this.norm.get(u)
236
+ };
237
+ h.push(f);
238
+ }
239
+ } else if (M(u.v)) {
240
+ const f = C(u.v) ? u.v : K(u.v);
241
+ if (!$(f)) {
242
+ const d = {
243
+ v: f,
244
+ i: u.i,
245
+ n: this.norm.get(f)
246
+ };
247
+ h.push(d);
248
+ }
249
+ }
250
+ }
251
+ }
252
+ n.$[r] = h;
253
+ } else if (C(c) && !$(c)) {
254
+ const h = {
255
+ v: c,
256
+ n: this.norm.get(c)
257
+ };
258
+ n.$[r] = h;
259
+ }
260
+ }
261
+ }), this.records.push(n);
262
+ }
263
+ toJSON() {
264
+ return {
265
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
266
+ keys: this.keys.map(({
267
+ getFn: e,
268
+ ...t
269
+ }) => t),
270
+ records: this.records
271
+ };
272
+ }
273
+ }
274
+ function le(s, e, {
275
+ getFn: t = g.getFn,
276
+ fieldNormWeight: n = g.fieldNormWeight
277
+ } = {}) {
278
+ const i = new X({
279
+ getFn: t,
280
+ fieldNormWeight: n
281
+ });
282
+ return i.setKeys(s.map(ae)), i.setSources(e), i.create(), i;
283
+ }
284
+ function Le(s, {
285
+ getFn: e = g.getFn,
286
+ fieldNormWeight: t = g.fieldNormWeight
287
+ } = {}) {
288
+ const {
289
+ keys: n,
290
+ records: i
291
+ } = s, r = new X({
292
+ getFn: e,
293
+ fieldNormWeight: t
294
+ });
295
+ return r.setKeys(n), r.setIndexRecords(i), r;
296
+ }
297
+ function Oe(s = [], e = g.minMatchCharLength) {
298
+ const t = [];
299
+ let n = -1, i = -1, r = 0;
300
+ for (let c = s.length; r < c; r += 1) {
301
+ const h = s[r];
302
+ h && n === -1 ? n = r : !h && n !== -1 && (i = r - 1, i - n + 1 >= e && t.push([n, i]), n = -1);
303
+ }
304
+ return s[r - 1] && r - n >= e && t.push([n, r - 1]), t;
305
+ }
306
+ const k = 32;
307
+ function Re(s, e, t, {
308
+ location: n = g.location,
309
+ distance: i = g.distance,
310
+ threshold: r = g.threshold,
311
+ findAllMatches: c = g.findAllMatches,
312
+ minMatchCharLength: h = g.minMatchCharLength,
313
+ includeMatches: o = g.includeMatches,
314
+ ignoreLocation: l = g.ignoreLocation
315
+ } = {}) {
316
+ if (e.length > k)
317
+ throw new Error(Fe(k));
318
+ const u = e.length, f = s.length, d = Math.max(0, Math.min(n, f));
319
+ let a = r, p = d;
320
+ const A = (E, I) => {
321
+ const _ = E / u;
322
+ if (l) return _;
323
+ const L = Math.abs(d - I);
324
+ return i ? _ + L / i : L ? 1 : _;
325
+ }, m = h > 1 || o, D = m ? Array(f) : [];
326
+ let B;
327
+ for (; (B = s.indexOf(e, p)) > -1; ) {
328
+ const E = A(0, B);
329
+ if (a = Math.min(E, a), p = B + u, m) {
330
+ let I = 0;
331
+ for (; I < u; )
332
+ D[B + I] = 1, I += 1;
333
+ }
334
+ }
335
+ p = -1;
336
+ let S = [], v = 1, R = u + f;
337
+ const pe = 1 << u - 1;
338
+ for (let E = 0; E < u; E += 1) {
339
+ let I = 0, _ = R;
340
+ for (; I < _; )
341
+ A(E, d + _) <= a ? I = _ : R = _, _ = Math.floor((R - I) / 2 + I);
342
+ R = _;
343
+ let L = Math.max(1, d - _ + 1);
344
+ const W = c ? f : Math.min(d + _, f) + u, b = Array(W + 2);
345
+ b[W + 1] = (1 << E) - 1;
346
+ for (let F = W; F >= L; F -= 1) {
347
+ const N = F - 1, te = t[s[N]];
348
+ if (m && (D[N] = +!!te), b[F] = (b[F + 1] << 1 | 1) & te, E && (b[F] |= (S[F + 1] | S[F]) << 1 | 1 | S[F + 1]), b[F] & pe && (v = A(E, N), v <= a)) {
349
+ if (a = v, p = N, p <= d)
350
+ break;
351
+ L = Math.max(1, 2 * d - p);
352
+ }
353
+ }
354
+ if (A(E + 1, d) > a)
355
+ break;
356
+ S = b;
357
+ }
358
+ const j = {
359
+ isMatch: p >= 0,
360
+ // Count exact matches (those with a score of 0) to be "almost" exact
361
+ score: Math.max(1e-3, v)
362
+ };
363
+ if (m) {
364
+ const E = Oe(D, h);
365
+ E.length ? o && (j.indices = E) : j.isMatch = !1;
366
+ }
367
+ return j;
368
+ }
369
+ function Ne(s) {
370
+ const e = {};
371
+ for (let t = 0, n = s.length; t < n; t += 1) {
372
+ const i = s.charAt(t);
373
+ e[i] = (e[i] || 0) | 1 << n - t - 1;
374
+ }
375
+ return e;
376
+ }
377
+ function Z(s) {
378
+ if (s.length <= 1) return s;
379
+ s.sort((t, n) => t[0] - n[0] || t[1] - n[1]);
380
+ const e = [s[0]];
381
+ for (let t = 1, n = s.length; t < n; t += 1) {
382
+ const i = e[e.length - 1], r = s[t];
383
+ r[0] <= i[1] + 1 ? i[1] = Math.max(i[1], r[1]) : e.push(r);
384
+ }
385
+ return e;
386
+ }
387
+ const fe = {
388
+ ł: "l",
389
+ // ł
390
+ Ł: "L",
391
+ // Ł
392
+ đ: "d",
393
+ // đ
394
+ Đ: "D",
395
+ // Đ
396
+ ø: "o",
397
+ // ø
398
+ Ø: "O",
399
+ // Ø
400
+ ħ: "h",
401
+ // ħ
402
+ Ħ: "H",
403
+ // Ħ
404
+ ŧ: "t",
405
+ // ŧ
406
+ Ŧ: "T",
407
+ // Ŧ
408
+ ı: "i",
409
+ // ı
410
+ ß: "ss"
411
+ // ß
412
+ }, $e = new RegExp("[" + Object.keys(fe).join("") + "]", "g"), O = String.prototype.normalize ? (s) => s.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, "").replace($e, (e) => fe[e]) : (s) => s;
413
+ class q {
414
+ constructor(e, {
415
+ location: t = g.location,
416
+ threshold: n = g.threshold,
417
+ distance: i = g.distance,
418
+ includeMatches: r = g.includeMatches,
419
+ findAllMatches: c = g.findAllMatches,
420
+ minMatchCharLength: h = g.minMatchCharLength,
421
+ isCaseSensitive: o = g.isCaseSensitive,
422
+ ignoreDiacritics: l = g.ignoreDiacritics,
423
+ ignoreLocation: u = g.ignoreLocation
424
+ } = {}) {
425
+ if (this.options = {
426
+ location: t,
427
+ threshold: n,
428
+ distance: i,
429
+ includeMatches: r,
430
+ findAllMatches: c,
431
+ minMatchCharLength: h,
432
+ isCaseSensitive: o,
433
+ ignoreDiacritics: l,
434
+ ignoreLocation: u
435
+ }, e = o ? e : e.toLowerCase(), e = l ? O(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length)
436
+ return;
437
+ const f = (a, p) => {
438
+ this.chunks.push({
439
+ pattern: a,
440
+ alphabet: Ne(a),
441
+ startIndex: p
442
+ });
443
+ }, d = this.pattern.length;
444
+ if (d > k) {
445
+ let a = 0;
446
+ const p = d % k, A = d - p;
447
+ for (; a < A; )
448
+ f(this.pattern.substr(a, k), a), a += k;
449
+ if (p) {
450
+ const m = d - k;
451
+ f(this.pattern.substr(m), m);
452
+ }
453
+ } else
454
+ f(this.pattern, 0);
455
+ }
456
+ searchIn(e) {
457
+ const {
458
+ isCaseSensitive: t,
459
+ ignoreDiacritics: n,
460
+ includeMatches: i
461
+ } = this.options;
462
+ if (e = t ? e : e.toLowerCase(), e = n ? O(e) : e, this.pattern === e) {
463
+ const A = {
464
+ isMatch: !0,
465
+ score: 0
466
+ };
467
+ return i && (A.indices = [[0, e.length - 1]]), A;
468
+ }
469
+ const {
470
+ location: r,
471
+ distance: c,
472
+ threshold: h,
473
+ findAllMatches: o,
474
+ minMatchCharLength: l,
475
+ ignoreLocation: u
476
+ } = this.options, f = [];
477
+ let d = 0, a = !1;
478
+ this.chunks.forEach(({
479
+ pattern: A,
480
+ alphabet: m,
481
+ startIndex: D
482
+ }) => {
483
+ const {
484
+ isMatch: B,
485
+ score: S,
486
+ indices: v
487
+ } = Re(e, A, m, {
488
+ location: r + D,
489
+ distance: c,
490
+ threshold: h,
491
+ findAllMatches: o,
492
+ minMatchCharLength: l,
493
+ includeMatches: i,
494
+ ignoreLocation: u
495
+ });
496
+ B && (a = !0), d += S, B && v && f.push(...v);
497
+ });
498
+ const p = {
499
+ isMatch: a,
500
+ score: a ? d / this.chunks.length : 1
501
+ };
502
+ return a && i && (p.indices = Z(f)), p;
503
+ }
504
+ }
505
+ class x {
506
+ constructor(e) {
507
+ this.pattern = e;
508
+ }
509
+ static isMultiMatch(e) {
510
+ return ie(e, this.multiRegex);
511
+ }
512
+ static isSingleMatch(e) {
513
+ return ie(e, this.singleRegex);
514
+ }
515
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
516
+ search(e) {
517
+ return {
518
+ isMatch: !1,
519
+ score: 1
520
+ };
521
+ }
522
+ }
523
+ function ie(s, e) {
524
+ const t = s.match(e);
525
+ return t ? t[1] : null;
526
+ }
527
+ class Te extends x {
528
+ constructor(e) {
529
+ super(e);
530
+ }
531
+ static get type() {
532
+ return "exact";
533
+ }
534
+ static get multiRegex() {
535
+ return /^="(.*)"$/;
536
+ }
537
+ static get singleRegex() {
538
+ return /^=(.*)$/;
539
+ }
540
+ search(e) {
541
+ const t = e === this.pattern;
542
+ return {
543
+ isMatch: t,
544
+ score: t ? 0 : 1,
545
+ indices: [0, this.pattern.length - 1]
546
+ };
547
+ }
548
+ }
549
+ class ze extends x {
550
+ constructor(e) {
551
+ super(e);
552
+ }
553
+ static get type() {
554
+ return "inverse-exact";
555
+ }
556
+ static get multiRegex() {
557
+ return /^!"(.*)"$/;
558
+ }
559
+ static get singleRegex() {
560
+ return /^!(.*)$/;
561
+ }
562
+ search(e) {
563
+ const n = e.indexOf(this.pattern) === -1;
564
+ return {
565
+ isMatch: n,
566
+ score: n ? 0 : 1,
567
+ indices: [0, e.length - 1]
568
+ };
569
+ }
570
+ }
571
+ class Pe extends x {
572
+ constructor(e) {
573
+ super(e);
574
+ }
575
+ static get type() {
576
+ return "prefix-exact";
577
+ }
578
+ static get multiRegex() {
579
+ return /^\^"(.*)"$/;
580
+ }
581
+ static get singleRegex() {
582
+ return /^\^(.*)$/;
583
+ }
584
+ search(e) {
585
+ const t = e.startsWith(this.pattern);
586
+ return {
587
+ isMatch: t,
588
+ score: t ? 0 : 1,
589
+ indices: [0, this.pattern.length - 1]
590
+ };
591
+ }
592
+ }
593
+ class je extends x {
594
+ constructor(e) {
595
+ super(e);
596
+ }
597
+ static get type() {
598
+ return "inverse-prefix-exact";
599
+ }
600
+ static get multiRegex() {
601
+ return /^!\^"(.*)"$/;
602
+ }
603
+ static get singleRegex() {
604
+ return /^!\^(.*)$/;
605
+ }
606
+ search(e) {
607
+ const t = !e.startsWith(this.pattern);
608
+ return {
609
+ isMatch: t,
610
+ score: t ? 0 : 1,
611
+ indices: [0, e.length - 1]
612
+ };
613
+ }
614
+ }
615
+ class We extends x {
616
+ constructor(e) {
617
+ super(e);
618
+ }
619
+ static get type() {
620
+ return "suffix-exact";
621
+ }
622
+ static get multiRegex() {
623
+ return /^"(.*)"\$$/;
624
+ }
625
+ static get singleRegex() {
626
+ return /^(.*)\$$/;
627
+ }
628
+ search(e) {
629
+ const t = e.endsWith(this.pattern);
630
+ return {
631
+ isMatch: t,
632
+ score: t ? 0 : 1,
633
+ indices: [e.length - this.pattern.length, e.length - 1]
634
+ };
635
+ }
636
+ }
637
+ class Ke extends x {
638
+ constructor(e) {
639
+ super(e);
640
+ }
641
+ static get type() {
642
+ return "inverse-suffix-exact";
643
+ }
644
+ static get multiRegex() {
645
+ return /^!"(.*)"\$$/;
646
+ }
647
+ static get singleRegex() {
648
+ return /^!(.*)\$$/;
649
+ }
650
+ search(e) {
651
+ const t = !e.endsWith(this.pattern);
652
+ return {
653
+ isMatch: t,
654
+ score: t ? 0 : 1,
655
+ indices: [0, e.length - 1]
656
+ };
657
+ }
658
+ }
659
+ class de extends x {
660
+ constructor(e, {
661
+ location: t = g.location,
662
+ threshold: n = g.threshold,
663
+ distance: i = g.distance,
664
+ includeMatches: r = g.includeMatches,
665
+ findAllMatches: c = g.findAllMatches,
666
+ minMatchCharLength: h = g.minMatchCharLength,
667
+ isCaseSensitive: o = g.isCaseSensitive,
668
+ ignoreDiacritics: l = g.ignoreDiacritics,
669
+ ignoreLocation: u = g.ignoreLocation
670
+ } = {}) {
671
+ super(e), this._bitapSearch = new q(e, {
672
+ location: t,
673
+ threshold: n,
674
+ distance: i,
675
+ includeMatches: r,
676
+ findAllMatches: c,
677
+ minMatchCharLength: h,
678
+ isCaseSensitive: o,
679
+ ignoreDiacritics: l,
680
+ ignoreLocation: u
681
+ });
682
+ }
683
+ static get type() {
684
+ return "fuzzy";
685
+ }
686
+ static get multiRegex() {
687
+ return /^"(.*)"$/;
688
+ }
689
+ static get singleRegex() {
690
+ return /^(.*)$/;
691
+ }
692
+ search(e) {
693
+ return this._bitapSearch.searchIn(e);
694
+ }
695
+ }
696
+ class ge extends x {
697
+ constructor(e) {
698
+ super(e);
699
+ }
700
+ static get type() {
701
+ return "include";
702
+ }
703
+ static get multiRegex() {
704
+ return /^'"(.*)"$/;
705
+ }
706
+ static get singleRegex() {
707
+ return /^'(.*)$/;
708
+ }
709
+ search(e) {
710
+ let t = 0, n;
711
+ const i = [], r = this.pattern.length;
712
+ for (; (n = e.indexOf(this.pattern, t)) > -1; )
713
+ t = n + r, i.push([n, t - 1]);
714
+ const c = !!i.length;
715
+ return {
716
+ isMatch: c,
717
+ score: c ? 0 : 1,
718
+ indices: i
719
+ };
720
+ }
721
+ }
722
+ const Q = [Te, ge, Pe, je, Ke, We, ze, de], re = Q.length, He = "\0", Qe = "|";
723
+ function Ge(s) {
724
+ const e = [], t = s.length;
725
+ let n = 0;
726
+ for (; n < t; ) {
727
+ for (; n < t && s[n] === " "; ) n++;
728
+ if (n >= t) break;
729
+ let i = n;
730
+ for (; i < t && s[i] !== " " && s[i] !== '"'; ) i++;
731
+ if (i < t && s[i] === '"') {
732
+ for (i++; i < t; ) {
733
+ if (s[i] === '"') {
734
+ const r = i + 1;
735
+ if (r >= t || s[r] === " ") {
736
+ i++;
737
+ break;
738
+ }
739
+ if (s[r] === "$" && (r + 1 >= t || s[r + 1] === " ")) {
740
+ i += 2;
741
+ break;
742
+ }
743
+ }
744
+ i++;
745
+ }
746
+ e.push(s.substring(n, i)), n = i;
747
+ } else {
748
+ for (; i < t && s[i] !== " "; ) i++;
749
+ e.push(s.substring(n, i)), n = i;
750
+ }
751
+ }
752
+ return e;
753
+ }
754
+ function Ye(s, e = {}) {
755
+ return s.replace(/\\\|/g, He).split(Qe).map((n) => {
756
+ const i = n.replace(/\u0000/g, "|"), r = Ge(i.trim()).filter((h) => h && !!h.trim()), c = [];
757
+ for (let h = 0, o = r.length; h < o; h += 1) {
758
+ const l = r[h];
759
+ let u = !1, f = -1;
760
+ for (; !u && ++f < re; ) {
761
+ const d = Q[f], a = d.isMultiMatch(l);
762
+ a && (c.push(new d(a, e)), u = !0);
763
+ }
764
+ if (!u)
765
+ for (f = -1; ++f < re; ) {
766
+ const d = Q[f], a = d.isSingleMatch(l);
767
+ if (a) {
768
+ c.push(new d(a, e));
769
+ break;
770
+ }
771
+ }
772
+ }
773
+ return c;
774
+ });
775
+ }
776
+ const Ue = /* @__PURE__ */ new Set([de.type, ge.type]);
777
+ class Ve {
778
+ constructor(e, {
779
+ isCaseSensitive: t = g.isCaseSensitive,
780
+ ignoreDiacritics: n = g.ignoreDiacritics,
781
+ includeMatches: i = g.includeMatches,
782
+ minMatchCharLength: r = g.minMatchCharLength,
783
+ ignoreLocation: c = g.ignoreLocation,
784
+ findAllMatches: h = g.findAllMatches,
785
+ location: o = g.location,
786
+ threshold: l = g.threshold,
787
+ distance: u = g.distance
788
+ } = {}) {
789
+ this.query = null, this.options = {
790
+ isCaseSensitive: t,
791
+ ignoreDiacritics: n,
792
+ includeMatches: i,
793
+ minMatchCharLength: r,
794
+ findAllMatches: h,
795
+ ignoreLocation: c,
796
+ location: o,
797
+ threshold: l,
798
+ distance: u
799
+ }, e = t ? e : e.toLowerCase(), e = n ? O(e) : e, this.pattern = e, this.query = Ye(this.pattern, this.options);
800
+ }
801
+ static condition(e, t) {
802
+ return t.useExtendedSearch;
803
+ }
804
+ // Note: searchIn operates on a single text value and sets hasInverse on the
805
+ // result when inverse patterns are involved. _searchObjectList uses this to
806
+ // switch from "ANY key" to "ALL keys" aggregation. See #712.
807
+ searchIn(e) {
808
+ const t = this.query;
809
+ if (!t)
810
+ return {
811
+ isMatch: !1,
812
+ score: 1
813
+ };
814
+ const {
815
+ includeMatches: n,
816
+ isCaseSensitive: i,
817
+ ignoreDiacritics: r
818
+ } = this.options;
819
+ e = i ? e : e.toLowerCase(), e = r ? O(e) : e;
820
+ let c = 0;
821
+ const h = [];
822
+ let o = 0, l = !1;
823
+ for (let u = 0, f = t.length; u < f; u += 1) {
824
+ const d = t[u];
825
+ h.length = 0, c = 0, l = !1;
826
+ for (let a = 0, p = d.length; a < p; a += 1) {
827
+ const A = d[a], {
828
+ isMatch: m,
829
+ indices: D,
830
+ score: B
831
+ } = A.search(e);
832
+ if (m) {
833
+ c += 1, o += B;
834
+ const S = A.constructor.type;
835
+ S.startsWith("inverse") && (l = !0), n && (Ue.has(S) ? h.push(...D) : h.push(D));
836
+ } else {
837
+ o = 0, c = 0, h.length = 0, l = !1;
838
+ break;
839
+ }
840
+ }
841
+ if (c) {
842
+ const a = {
843
+ isMatch: !0,
844
+ score: o / c
845
+ };
846
+ return l && (a.hasInverse = !0), n && (a.indices = Z(h)), a;
847
+ }
848
+ }
849
+ return {
850
+ isMatch: !1,
851
+ score: 1
852
+ };
853
+ }
854
+ }
855
+ const G = [];
856
+ function ee(...s) {
857
+ G.push(...s);
858
+ }
859
+ function z(s, e) {
860
+ for (let t = 0, n = G.length; t < n; t += 1) {
861
+ const i = G[t];
862
+ if (i.condition(s, e))
863
+ return new i(s, e);
864
+ }
865
+ return new q(s, e);
866
+ }
867
+ const P = {
868
+ AND: "$and",
869
+ OR: "$or"
870
+ }, Y = {
871
+ PATH: "$path",
872
+ PATTERN: "$val"
873
+ }, U = (s) => !!(s[P.AND] || s[P.OR]), Je = (s) => !!s[Y.PATH], Xe = (s) => !y(s) && ue(s) && !U(s), ce = (s) => ({
874
+ [P.AND]: Object.keys(s).map((e) => ({
875
+ [e]: s[e]
876
+ }))
877
+ });
878
+ function Ae(s, e, {
879
+ auto: t = !0
880
+ } = {}) {
881
+ const n = (i) => {
882
+ if (C(i)) {
883
+ const o = {
884
+ keyId: null,
885
+ pattern: i
886
+ };
887
+ return t && (o.searcher = z(i, e)), o;
888
+ }
889
+ const r = Object.keys(i), c = Je(i);
890
+ if (!c && r.length > 1 && !U(i))
891
+ return n(ce(i));
892
+ if (Xe(i)) {
893
+ const o = c ? i[Y.PATH] : r[0], l = c ? i[Y.PATTERN] : i[o];
894
+ if (!C(l))
895
+ throw new Error(_e(o));
896
+ const u = {
897
+ keyId: H(o),
898
+ pattern: l
899
+ };
900
+ return t && (u.searcher = z(l, e)), u;
901
+ }
902
+ const h = {
903
+ children: [],
904
+ operator: r[0]
905
+ };
906
+ return r.forEach((o) => {
907
+ const l = i[o];
908
+ y(l) && l.forEach((u) => {
909
+ h.children.push(n(u));
910
+ });
911
+ }), h;
912
+ };
913
+ return U(s) || (s = ce(s)), n(s);
914
+ }
915
+ function V(s, {
916
+ ignoreFieldNorm: e = g.ignoreFieldNorm
917
+ }) {
918
+ let t = 1;
919
+ return s.forEach(({
920
+ key: n,
921
+ norm: i,
922
+ score: r
923
+ }) => {
924
+ const c = n ? n.weight : null;
925
+ t *= Math.pow(r === 0 && c ? Number.EPSILON : r, (c || 1) * (e ? 1 : i));
926
+ }), t;
927
+ }
928
+ function Ze(s, {
929
+ ignoreFieldNorm: e = g.ignoreFieldNorm
930
+ }) {
931
+ s.forEach((t) => {
932
+ t.score = V(t.matches, {
933
+ ignoreFieldNorm: e
934
+ });
935
+ });
936
+ }
937
+ class qe {
938
+ constructor(e) {
939
+ this.limit = e, this.heap = [];
940
+ }
941
+ get size() {
942
+ return this.heap.length;
943
+ }
944
+ shouldInsert(e) {
945
+ return this.size < this.limit || e < this.heap[0].score;
946
+ }
947
+ insert(e) {
948
+ this.size < this.limit ? (this.heap.push(e), this._bubbleUp(this.size - 1)) : e.score < this.heap[0].score && (this.heap[0] = e, this._sinkDown(0));
949
+ }
950
+ extractSorted(e) {
951
+ return this.heap.sort(e);
952
+ }
953
+ _bubbleUp(e) {
954
+ const t = this.heap;
955
+ for (; e > 0; ) {
956
+ const n = e - 1 >> 1;
957
+ if (t[e].score <= t[n].score) break;
958
+ const i = t[e];
959
+ t[e] = t[n], t[n] = i, e = n;
960
+ }
961
+ }
962
+ _sinkDown(e) {
963
+ const t = this.heap, n = t.length;
964
+ let i = e;
965
+ do {
966
+ e = i;
967
+ const r = 2 * e + 1, c = 2 * e + 2;
968
+ if (r < n && t[r].score > t[i].score && (i = r), c < n && t[c].score > t[i].score && (i = c), i !== e) {
969
+ const h = t[e];
970
+ t[e] = t[i], t[i] = h;
971
+ }
972
+ } while (i !== e);
973
+ }
974
+ }
975
+ function et(s, e) {
976
+ const t = s.matches;
977
+ e.matches = [], M(t) && t.forEach((n) => {
978
+ if (!M(n.indices) || !n.indices.length)
979
+ return;
980
+ const {
981
+ indices: i,
982
+ value: r
983
+ } = n, c = {
984
+ indices: i,
985
+ value: r
986
+ };
987
+ n.key && (c.key = n.key.src), n.idx > -1 && (c.refIndex = n.idx), e.matches.push(c);
988
+ });
989
+ }
990
+ function tt(s, e) {
991
+ e.score = s.score;
992
+ }
993
+ function st(s, e, {
994
+ includeMatches: t = g.includeMatches,
995
+ includeScore: n = g.includeScore
996
+ } = {}) {
997
+ const i = [];
998
+ return t && i.push(et), n && i.push(tt), s.map((r) => {
999
+ const {
1000
+ idx: c
1001
+ } = r, h = {
1002
+ item: e[c],
1003
+ refIndex: c
1004
+ };
1005
+ return i.length && i.forEach((o) => {
1006
+ o(r, h);
1007
+ }), h;
1008
+ });
1009
+ }
1010
+ const nt = /\b\w+\b/g;
1011
+ function J({
1012
+ isCaseSensitive: s = !1,
1013
+ ignoreDiacritics: e = !1
1014
+ } = {}) {
1015
+ return {
1016
+ tokenize(t) {
1017
+ return s || (t = t.toLowerCase()), e && (t = O(t)), t.match(nt) || [];
1018
+ }
1019
+ };
1020
+ }
1021
+ function it(s, e, t) {
1022
+ const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1023
+ let r = 0;
1024
+ function c(h, o, l, u) {
1025
+ const f = t.tokenize(h);
1026
+ if (!f.length) return;
1027
+ r++;
1028
+ const d = /* @__PURE__ */ new Map();
1029
+ for (const a of f)
1030
+ d.set(a, (d.get(a) || 0) + 1);
1031
+ for (const [a, p] of d) {
1032
+ const A = {
1033
+ docIdx: o,
1034
+ keyIdx: l,
1035
+ subIdx: u,
1036
+ tf: p
1037
+ };
1038
+ let m = n.get(a);
1039
+ m || (m = [], n.set(a, m)), m.push(A), i.set(a, (i.get(a) || 0) + 1);
1040
+ }
1041
+ }
1042
+ for (const h of s) {
1043
+ const {
1044
+ i: o,
1045
+ v: l,
1046
+ $: u
1047
+ } = h;
1048
+ if (l !== void 0) {
1049
+ c(l, o, -1, -1);
1050
+ continue;
1051
+ }
1052
+ if (u)
1053
+ for (let f = 0; f < e; f++) {
1054
+ const d = u[f];
1055
+ if (d)
1056
+ if (Array.isArray(d))
1057
+ for (const a of d)
1058
+ c(a.v, o, f, a.i ?? -1);
1059
+ else
1060
+ c(d.v, o, f, -1);
1061
+ }
1062
+ }
1063
+ return {
1064
+ terms: n,
1065
+ fieldCount: r,
1066
+ df: i
1067
+ };
1068
+ }
1069
+ function rt(s, e, t, n) {
1070
+ const {
1071
+ i,
1072
+ v: r,
1073
+ $: c
1074
+ } = e;
1075
+ function h(o, l, u) {
1076
+ const f = n.tokenize(o);
1077
+ if (!f.length) return;
1078
+ s.fieldCount++;
1079
+ const d = /* @__PURE__ */ new Map();
1080
+ for (const a of f)
1081
+ d.set(a, (d.get(a) || 0) + 1);
1082
+ for (const [a, p] of d) {
1083
+ const A = {
1084
+ docIdx: i,
1085
+ keyIdx: l,
1086
+ subIdx: u,
1087
+ tf: p
1088
+ };
1089
+ let m = s.terms.get(a);
1090
+ m || (m = [], s.terms.set(a, m)), m.push(A), s.df.set(a, (s.df.get(a) || 0) + 1);
1091
+ }
1092
+ }
1093
+ if (r !== void 0) {
1094
+ h(r, -1, -1);
1095
+ return;
1096
+ }
1097
+ if (c)
1098
+ for (let o = 0; o < t; o++) {
1099
+ const l = c[o];
1100
+ if (l)
1101
+ if (Array.isArray(l))
1102
+ for (const u of l)
1103
+ h(u.v, o, u.i ?? -1);
1104
+ else
1105
+ h(l.v, o, -1);
1106
+ }
1107
+ }
1108
+ function oe(s, e) {
1109
+ for (const [t, n] of s.terms) {
1110
+ const i = n.filter((c) => c.docIdx !== e), r = n.length - i.length;
1111
+ r > 0 && (s.fieldCount -= r, s.df.set(t, (s.df.get(t) || 0) - r), i.length === 0 ? (s.terms.delete(t), s.df.delete(t)) : s.terms.set(t, i));
1112
+ }
1113
+ }
1114
+ class w {
1115
+ // Statics are assigned in entry.ts
1116
+ constructor(e, t, n) {
1117
+ this.options = {
1118
+ ...g,
1119
+ ...t
1120
+ }, this.options.useExtendedSearch, this.options.useTokenSearch, this._keyStore = new Be(this.options.keys), this._docs = e, this._myIndex = null, this._invertedIndex = null, this.setCollection(e, n), this._lastQuery = null, this._lastSearcher = null;
1121
+ }
1122
+ _getSearcher(e) {
1123
+ if (this._lastQuery === e)
1124
+ return this._lastSearcher;
1125
+ const t = this._invertedIndex ? {
1126
+ ...this.options,
1127
+ _invertedIndex: this._invertedIndex
1128
+ } : this.options, n = z(e, t);
1129
+ return this._lastQuery = e, this._lastSearcher = n, n;
1130
+ }
1131
+ setCollection(e, t) {
1132
+ if (this._docs = e, t && !(t instanceof X))
1133
+ throw new Error(Me);
1134
+ if (this._myIndex = t || le(this.options.keys, this._docs, {
1135
+ getFn: this.options.getFn,
1136
+ fieldNormWeight: this.options.fieldNormWeight
1137
+ }), this.options.useTokenSearch) {
1138
+ const n = J({
1139
+ isCaseSensitive: this.options.isCaseSensitive,
1140
+ ignoreDiacritics: this.options.ignoreDiacritics
1141
+ });
1142
+ this._invertedIndex = it(this._myIndex.records, this._myIndex.keys.length, n);
1143
+ }
1144
+ }
1145
+ add(e) {
1146
+ if (M(e) && (this._docs.push(e), this._myIndex.add(e), this._invertedIndex)) {
1147
+ const t = this._myIndex.records[this._myIndex.records.length - 1], n = J({
1148
+ isCaseSensitive: this.options.isCaseSensitive,
1149
+ ignoreDiacritics: this.options.ignoreDiacritics
1150
+ });
1151
+ rt(this._invertedIndex, t, this._myIndex.keys.length, n);
1152
+ }
1153
+ }
1154
+ remove(e = () => !1) {
1155
+ const t = [], n = [];
1156
+ for (let i = 0, r = this._docs.length; i < r; i += 1)
1157
+ e(this._docs[i], i) && (t.push(this._docs[i]), n.push(i));
1158
+ if (n.length) {
1159
+ if (this._invertedIndex)
1160
+ for (const i of n)
1161
+ oe(this._invertedIndex, i);
1162
+ for (let i = n.length - 1; i >= 0; i -= 1)
1163
+ this._docs.splice(n[i], 1);
1164
+ this._myIndex.removeAll(n);
1165
+ }
1166
+ return t;
1167
+ }
1168
+ removeAt(e) {
1169
+ this._invertedIndex && oe(this._invertedIndex, e);
1170
+ const t = this._docs.splice(e, 1)[0];
1171
+ return this._myIndex.removeAt(e), t;
1172
+ }
1173
+ getIndex() {
1174
+ return this._myIndex;
1175
+ }
1176
+ search(e, t) {
1177
+ const {
1178
+ limit: n = -1
1179
+ } = t || {}, {
1180
+ includeMatches: i,
1181
+ includeScore: r,
1182
+ shouldSort: c,
1183
+ sortFn: h,
1184
+ ignoreFieldNorm: o
1185
+ } = this.options;
1186
+ if (C(e) && !e.trim()) {
1187
+ let f = this._docs.map((d, a) => ({
1188
+ item: d,
1189
+ refIndex: a
1190
+ }));
1191
+ return T(n) && n > -1 && (f = f.slice(0, n)), f;
1192
+ }
1193
+ const l = T(n) && n > 0 && C(e);
1194
+ let u;
1195
+ if (l) {
1196
+ const f = new qe(n);
1197
+ C(this._docs[0]) ? this._searchStringList(e, {
1198
+ heap: f,
1199
+ ignoreFieldNorm: o
1200
+ }) : this._searchObjectList(e, {
1201
+ heap: f,
1202
+ ignoreFieldNorm: o
1203
+ }), u = f.extractSorted(h);
1204
+ } else
1205
+ u = C(e) ? C(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e), Ze(u, {
1206
+ ignoreFieldNorm: o
1207
+ }), c && u.sort(h), T(n) && n > -1 && (u = u.slice(0, n));
1208
+ return st(u, this._docs, {
1209
+ includeMatches: i,
1210
+ includeScore: r
1211
+ });
1212
+ }
1213
+ _searchStringList(e, {
1214
+ heap: t,
1215
+ ignoreFieldNorm: n
1216
+ } = {}) {
1217
+ const i = this._getSearcher(e), {
1218
+ records: r
1219
+ } = this._myIndex, c = t ? null : [];
1220
+ return r.forEach(({
1221
+ v: h,
1222
+ i: o,
1223
+ n: l
1224
+ }) => {
1225
+ if (!M(h))
1226
+ return;
1227
+ const {
1228
+ isMatch: u,
1229
+ score: f,
1230
+ indices: d
1231
+ } = i.searchIn(h);
1232
+ if (u) {
1233
+ const a = {
1234
+ item: h,
1235
+ idx: o,
1236
+ matches: [{
1237
+ score: f,
1238
+ value: h,
1239
+ norm: l,
1240
+ indices: d
1241
+ }]
1242
+ };
1243
+ t ? (a.score = V(a.matches, {
1244
+ ignoreFieldNorm: n
1245
+ }), t.shouldInsert(a.score) && t.insert(a)) : c.push(a);
1246
+ }
1247
+ }), c;
1248
+ }
1249
+ _searchLogical(e) {
1250
+ const t = Ae(e, this.options), n = (h, o, l) => {
1251
+ if (!("children" in h)) {
1252
+ const {
1253
+ keyId: a,
1254
+ searcher: p
1255
+ } = h;
1256
+ let A;
1257
+ return a === null ? (A = [], this._myIndex.keys.forEach((m, D) => {
1258
+ A.push(...this._findMatches({
1259
+ key: m,
1260
+ value: o[D],
1261
+ searcher: p
1262
+ }));
1263
+ })) : A = this._findMatches({
1264
+ key: this._keyStore.get(a),
1265
+ value: this._myIndex.getValueForItemAtKeyId(o, a),
1266
+ searcher: p
1267
+ }), A && A.length ? [{
1268
+ idx: l,
1269
+ item: o,
1270
+ matches: A
1271
+ }] : [];
1272
+ }
1273
+ const {
1274
+ children: u,
1275
+ operator: f
1276
+ } = h, d = [];
1277
+ for (let a = 0, p = u.length; a < p; a += 1) {
1278
+ const A = u[a], m = n(A, o, l);
1279
+ if (m.length)
1280
+ d.push(...m);
1281
+ else if (f === P.AND)
1282
+ return [];
1283
+ }
1284
+ return d;
1285
+ }, i = this._myIndex.records, r = /* @__PURE__ */ new Map(), c = [];
1286
+ return i.forEach(({
1287
+ $: h,
1288
+ i: o
1289
+ }) => {
1290
+ if (M(h)) {
1291
+ const l = n(t, h, o);
1292
+ l.length && (r.has(o) || (r.set(o, {
1293
+ idx: o,
1294
+ item: h,
1295
+ matches: []
1296
+ }), c.push(r.get(o))), l.forEach(({
1297
+ matches: u
1298
+ }) => {
1299
+ r.get(o).matches.push(...u);
1300
+ }));
1301
+ }
1302
+ }), c;
1303
+ }
1304
+ // When a search involves inverse patterns (e.g. !Syrup), the aggregation
1305
+ // across keys switches from "ANY key matches" to "ALL keys must match."
1306
+ // This is signaled by hasInverse on the SearchResult from ExtendedSearch.
1307
+ //
1308
+ // For mixed patterns like "^hello !Syrup", a key failure is ambiguous —
1309
+ // it could be the positive or inverse term that failed. In that case we
1310
+ // conservatively exclude the item, which is strictly better than the old
1311
+ // behavior of including it. See: https://github.com/krisk/Fuse/issues/712
1312
+ _searchObjectList(e, {
1313
+ heap: t,
1314
+ ignoreFieldNorm: n
1315
+ } = {}) {
1316
+ const i = this._getSearcher(e), {
1317
+ keys: r,
1318
+ records: c
1319
+ } = this._myIndex, h = t ? null : [];
1320
+ return c.forEach(({
1321
+ $: o,
1322
+ i: l
1323
+ }) => {
1324
+ if (!M(o))
1325
+ return;
1326
+ const u = [];
1327
+ let f = !1, d = !1;
1328
+ if (r.forEach((a, p) => {
1329
+ const A = this._findMatches({
1330
+ key: a,
1331
+ value: o[p],
1332
+ searcher: i
1333
+ });
1334
+ A.length ? (u.push(...A), A[0].hasInverse && (d = !0)) : f = !0;
1335
+ }), !(d && f) && u.length) {
1336
+ const a = {
1337
+ idx: l,
1338
+ item: o,
1339
+ matches: u
1340
+ };
1341
+ t ? (a.score = V(a.matches, {
1342
+ ignoreFieldNorm: n
1343
+ }), t.shouldInsert(a.score) && t.insert(a)) : h.push(a);
1344
+ }
1345
+ }), h;
1346
+ }
1347
+ _findMatches({
1348
+ key: e,
1349
+ value: t,
1350
+ searcher: n
1351
+ }) {
1352
+ if (!M(t))
1353
+ return [];
1354
+ const i = [];
1355
+ if (y(t))
1356
+ t.forEach(({
1357
+ v: r,
1358
+ i: c,
1359
+ n: h
1360
+ }) => {
1361
+ if (!M(r))
1362
+ return;
1363
+ const {
1364
+ isMatch: o,
1365
+ score: l,
1366
+ indices: u,
1367
+ hasInverse: f
1368
+ } = n.searchIn(r);
1369
+ o && i.push({
1370
+ score: l,
1371
+ key: e,
1372
+ value: r,
1373
+ idx: c,
1374
+ norm: h,
1375
+ indices: u,
1376
+ hasInverse: f
1377
+ });
1378
+ });
1379
+ else {
1380
+ const {
1381
+ v: r,
1382
+ n: c
1383
+ } = t, {
1384
+ isMatch: h,
1385
+ score: o,
1386
+ indices: l,
1387
+ hasInverse: u
1388
+ } = n.searchIn(r);
1389
+ h && i.push({
1390
+ score: o,
1391
+ key: e,
1392
+ value: r,
1393
+ norm: c,
1394
+ indices: l,
1395
+ hasInverse: u
1396
+ });
1397
+ }
1398
+ return i;
1399
+ }
1400
+ }
1401
+ class ct {
1402
+ static condition(e, t) {
1403
+ return t.useTokenSearch;
1404
+ }
1405
+ constructor(e, t) {
1406
+ this.options = t, this.analyzer = J({
1407
+ isCaseSensitive: t.isCaseSensitive,
1408
+ ignoreDiacritics: t.ignoreDiacritics
1409
+ });
1410
+ const n = this.analyzer.tokenize(e), i = t._invertedIndex, {
1411
+ df: r,
1412
+ fieldCount: c
1413
+ } = i;
1414
+ this.termSearchers = [], this.idfWeights = [];
1415
+ for (const h of n) {
1416
+ this.termSearchers.push(new q(h, {
1417
+ location: t.location,
1418
+ threshold: t.threshold,
1419
+ distance: t.distance,
1420
+ includeMatches: t.includeMatches,
1421
+ findAllMatches: t.findAllMatches,
1422
+ minMatchCharLength: t.minMatchCharLength,
1423
+ isCaseSensitive: t.isCaseSensitive,
1424
+ ignoreDiacritics: t.ignoreDiacritics,
1425
+ ignoreLocation: !0
1426
+ }));
1427
+ const o = r.get(h) || 0, l = Math.log(1 + (c - o + 0.5) / (o + 0.5));
1428
+ this.idfWeights.push(l);
1429
+ }
1430
+ }
1431
+ searchIn(e) {
1432
+ if (!this.termSearchers.length)
1433
+ return {
1434
+ isMatch: !1,
1435
+ score: 1
1436
+ };
1437
+ const t = [];
1438
+ let n = 0, i = 0, r = 0;
1439
+ for (let o = 0; o < this.termSearchers.length; o++) {
1440
+ const l = this.termSearchers[o].searchIn(e), u = this.idfWeights[o];
1441
+ i += u, l.isMatch && (r++, n += u * (1 - l.score), l.indices && t.push(...l.indices));
1442
+ }
1443
+ if (r === 0)
1444
+ return {
1445
+ isMatch: !1,
1446
+ score: 1
1447
+ };
1448
+ const c = i > 0 ? 1 - n / i : 0, h = {
1449
+ isMatch: !0,
1450
+ score: Math.max(1e-3, c)
1451
+ };
1452
+ return this.options.includeMatches && t.length && (h.indices = Z(t)), h;
1453
+ }
1454
+ }
1455
+ w.version = "7.3.0";
1456
+ w.createIndex = le;
1457
+ w.parseIndex = Le;
1458
+ w.config = g;
1459
+ w.match = function(s, e, t) {
1460
+ return z(s, {
1461
+ ...g,
1462
+ ...t
1463
+ }).searchIn(e);
1464
+ };
1465
+ w.parseQuery = Ae;
1466
+ ee(Ve);
1467
+ ee(ct);
1468
+ w.use = function(...s) {
1469
+ s.forEach((e) => ee(e));
1470
+ };
1471
+ export {
1472
+ w as F
1473
+ };