@ray-js/robot-map-sdk 0.0.2-beta-2 → 0.0.2-beta-3
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/README.md +18 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.es.js +1 -1
- package/dist-app/assets/{index-BYNxFFSu.js → index-DXGZSNp6.js} +1 -1
- package/dist-app/index.html +1 -1
- package/dist-docs/404.html +3 -3
- package/dist-docs/assets/app.CGP3AJxb.js +1 -0
- package/dist-docs/assets/chunks/@localSearchIndexroot.BYBTPiic.js +1 -0
- package/dist-docs/assets/chunks/VPLocalSearchBox.8Tpit1ck.js +8 -0
- package/dist-docs/assets/chunks/framework.DRADY2L-.js +17 -6807
- package/dist-docs/assets/chunks/theme.SGB7Cf-o.js +2 -0
- package/dist-docs/assets/{guide_advanced-usage.md.DfDqOTuu.js → guide_advanced-usage.md.ChUH15VJ.js} +8 -30
- package/dist-docs/assets/guide_advanced-usage.md.ChUH15VJ.lean.js +1 -0
- package/dist-docs/assets/guide_concepts.md.GEw3xVjc.js +1 -21
- package/dist-docs/assets/guide_concepts.md.GEw3xVjc.lean.js +1 -10
- package/dist-docs/assets/{guide_getting-started.md.dZsqAPPF.js → guide_getting-started.md.CHqmbvad.js} +6 -25
- package/dist-docs/assets/guide_getting-started.md.CHqmbvad.lean.js +1 -0
- package/dist-docs/assets/index.md.Sm6vD2Gl.js +1 -0
- package/dist-docs/assets/index.md.Sm6vD2Gl.lean.js +1 -0
- package/dist-docs/assets/reference_callbacks.md.-S6uhkXO.js +19 -0
- package/dist-docs/assets/reference_callbacks.md.-S6uhkXO.lean.js +1 -0
- package/dist-docs/assets/reference_config.md.ChKLqSi3.js +41 -0
- package/dist-docs/assets/reference_config.md.ChKLqSi3.lean.js +1 -0
- package/dist-docs/assets/reference_data.md.B8JfrRhl.js +156 -0
- package/dist-docs/assets/reference_data.md.B8JfrRhl.lean.js +1 -0
- package/dist-docs/assets/reference_methods.md.BkU-PXMt.js +56 -0
- package/dist-docs/assets/reference_methods.md.BkU-PXMt.lean.js +1 -0
- package/dist-docs/assets/reference_runtime.md.UJkdf65W.js +19 -0
- package/dist-docs/assets/reference_runtime.md.UJkdf65W.lean.js +1 -0
- package/dist-docs/assets/reference_types.md.CteNuaxc.js +111 -0
- package/dist-docs/assets/reference_types.md.CteNuaxc.lean.js +1 -0
- package/dist-docs/assets/reference_utils.md.DU5CMWXW.js +12 -0
- package/dist-docs/assets/reference_utils.md.DU5CMWXW.lean.js +1 -0
- package/dist-docs/assets/{style.BhX5jokk.css → style.CN_tJoU2.css} +1 -1
- package/dist-docs/guide/advanced-usage.html +13 -15
- package/dist-docs/guide/concepts.html +5 -5
- package/dist-docs/guide/getting-started.html +11 -10
- package/dist-docs/hashmap.json +1 -1
- package/dist-docs/index.html +6 -6
- package/dist-docs/reference/callbacks.html +15 -277
- package/dist-docs/reference/config.html +37 -569
- package/dist-docs/reference/data.html +29 -122
- package/dist-docs/reference/methods.html +50 -298
- package/dist-docs/reference/runtime.html +23 -65
- package/dist-docs/reference/types.html +16 -95
- package/dist-docs/reference/utils.html +36 -0
- package/package.json +2 -2
- package/dist-docs/assets/app.D7Qrktsc.js +0 -104
- package/dist-docs/assets/chunks/@localSearchIndexroot.Btgy4C48.js +0 -3
- package/dist-docs/assets/chunks/VPLocalSearchBox.CTbu0gVG.js +0 -3556
- package/dist-docs/assets/chunks/theme.B7-5vjJp.js +0 -4152
- package/dist-docs/assets/guide_advanced-usage.md.DfDqOTuu.lean.js +0 -10
- package/dist-docs/assets/guide_getting-started.md.dZsqAPPF.lean.js +0 -10
- package/dist-docs/assets/index.md.Dd6Azqjp.js +0 -10
- package/dist-docs/assets/index.md.Dd6Azqjp.lean.js +0 -10
- package/dist-docs/assets/reference_callbacks.md.CR2l2ExI.js +0 -301
- package/dist-docs/assets/reference_callbacks.md.CR2l2ExI.lean.js +0 -10
- package/dist-docs/assets/reference_config.md.BW2PJe_F.js +0 -593
- package/dist-docs/assets/reference_config.md.BW2PJe_F.lean.js +0 -10
- package/dist-docs/assets/reference_data.md.GtmKYR4M.js +0 -269
- package/dist-docs/assets/reference_data.md.GtmKYR4M.lean.js +0 -10
- package/dist-docs/assets/reference_methods.md.yDXPS10c.js +0 -324
- package/dist-docs/assets/reference_methods.md.yDXPS10c.lean.js +0 -10
- package/dist-docs/assets/reference_runtime.md.BQ6YWC8F.js +0 -81
- package/dist-docs/assets/reference_runtime.md.BQ6YWC8F.lean.js +0 -10
- package/dist-docs/assets/reference_types.md.b5p13ywD.js +0 -210
- package/dist-docs/assets/reference_types.md.b5p13ywD.lean.js +0 -10
|
@@ -1,3556 +0,0 @@
|
|
|
1
|
-
var Nt = Object.defineProperty
|
|
2
|
-
var Ft = (a, e, t) =>
|
|
3
|
-
e in a
|
|
4
|
-
? Nt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t })
|
|
5
|
-
: (a[e] = t)
|
|
6
|
-
var Ce = (a, e, t) => Ft(a, typeof e != 'symbol' ? e + '' : e, t)
|
|
7
|
-
import {
|
|
8
|
-
V as Ot,
|
|
9
|
-
D as le,
|
|
10
|
-
h as ge,
|
|
11
|
-
ah as et,
|
|
12
|
-
ai as Rt,
|
|
13
|
-
aj as Ct,
|
|
14
|
-
ak as At,
|
|
15
|
-
q as $e,
|
|
16
|
-
al as Mt,
|
|
17
|
-
d as Lt,
|
|
18
|
-
am as tt,
|
|
19
|
-
p as he,
|
|
20
|
-
an as Dt,
|
|
21
|
-
ao as Pt,
|
|
22
|
-
s as zt,
|
|
23
|
-
ap as Vt,
|
|
24
|
-
v as Ae,
|
|
25
|
-
P as fe,
|
|
26
|
-
O as _e,
|
|
27
|
-
aq as $t,
|
|
28
|
-
ar as jt,
|
|
29
|
-
W as Bt,
|
|
30
|
-
R as Wt,
|
|
31
|
-
$ as Kt,
|
|
32
|
-
b as Jt,
|
|
33
|
-
o as H,
|
|
34
|
-
j as _,
|
|
35
|
-
a0 as qt,
|
|
36
|
-
as as Ut,
|
|
37
|
-
k as L,
|
|
38
|
-
at as Gt,
|
|
39
|
-
au as Ht,
|
|
40
|
-
c as Z,
|
|
41
|
-
e as Se,
|
|
42
|
-
n as st,
|
|
43
|
-
B as nt,
|
|
44
|
-
F as it,
|
|
45
|
-
a as pe,
|
|
46
|
-
t as ve,
|
|
47
|
-
av as Qt,
|
|
48
|
-
aw as rt,
|
|
49
|
-
ax as Yt,
|
|
50
|
-
a5 as Zt,
|
|
51
|
-
aa as Xt,
|
|
52
|
-
ay as es,
|
|
53
|
-
_ as ts,
|
|
54
|
-
} from './framework.DRADY2L-.js'
|
|
55
|
-
import { u as ss, c as ns } from './theme.B7-5vjJp.js'
|
|
56
|
-
const is = {
|
|
57
|
-
root: () => Ot(() => import('./@localSearchIndexroot.Btgy4C48.js'), []),
|
|
58
|
-
}
|
|
59
|
-
/*!
|
|
60
|
-
* tabbable 6.2.0
|
|
61
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
62
|
-
*/ var vt = [
|
|
63
|
-
'input:not([inert])',
|
|
64
|
-
'select:not([inert])',
|
|
65
|
-
'textarea:not([inert])',
|
|
66
|
-
'a[href]:not([inert])',
|
|
67
|
-
'button:not([inert])',
|
|
68
|
-
'[tabindex]:not(slot):not([inert])',
|
|
69
|
-
'audio[controls]:not([inert])',
|
|
70
|
-
'video[controls]:not([inert])',
|
|
71
|
-
'[contenteditable]:not([contenteditable="false"]):not([inert])',
|
|
72
|
-
'details>summary:first-of-type:not([inert])',
|
|
73
|
-
'details:not([inert])',
|
|
74
|
-
],
|
|
75
|
-
ke = vt.join(','),
|
|
76
|
-
mt = typeof Element > 'u',
|
|
77
|
-
re = mt
|
|
78
|
-
? function () {}
|
|
79
|
-
: Element.prototype.matches ||
|
|
80
|
-
Element.prototype.msMatchesSelector ||
|
|
81
|
-
Element.prototype.webkitMatchesSelector,
|
|
82
|
-
Ne =
|
|
83
|
-
!mt && Element.prototype.getRootNode
|
|
84
|
-
? function (a) {
|
|
85
|
-
var e
|
|
86
|
-
return a == null || (e = a.getRootNode) === null || e === void 0
|
|
87
|
-
? void 0
|
|
88
|
-
: e.call(a)
|
|
89
|
-
}
|
|
90
|
-
: function (a) {
|
|
91
|
-
return a == null ? void 0 : a.ownerDocument
|
|
92
|
-
},
|
|
93
|
-
Fe = function a(e, t) {
|
|
94
|
-
var s
|
|
95
|
-
t === void 0 && (t = !0)
|
|
96
|
-
var n =
|
|
97
|
-
e == null || (s = e.getAttribute) === null || s === void 0
|
|
98
|
-
? void 0
|
|
99
|
-
: s.call(e, 'inert'),
|
|
100
|
-
r = n === '' || n === 'true',
|
|
101
|
-
i = r || (t && e && a(e.parentNode))
|
|
102
|
-
return i
|
|
103
|
-
},
|
|
104
|
-
rs = function (e) {
|
|
105
|
-
var t,
|
|
106
|
-
s =
|
|
107
|
-
e == null || (t = e.getAttribute) === null || t === void 0
|
|
108
|
-
? void 0
|
|
109
|
-
: t.call(e, 'contenteditable')
|
|
110
|
-
return s === '' || s === 'true'
|
|
111
|
-
},
|
|
112
|
-
gt = function (e, t, s) {
|
|
113
|
-
if (Fe(e)) return []
|
|
114
|
-
var n = Array.prototype.slice.apply(e.querySelectorAll(ke))
|
|
115
|
-
return (t && re.call(e, ke) && n.unshift(e), (n = n.filter(s)), n)
|
|
116
|
-
},
|
|
117
|
-
bt = function a(e, t, s) {
|
|
118
|
-
for (var n = [], r = Array.from(e); r.length; ) {
|
|
119
|
-
var i = r.shift()
|
|
120
|
-
if (!Fe(i, !1))
|
|
121
|
-
if (i.tagName === 'SLOT') {
|
|
122
|
-
var o = i.assignedElements(),
|
|
123
|
-
l = o.length ? o : i.children,
|
|
124
|
-
c = a(l, !0, s)
|
|
125
|
-
s.flatten
|
|
126
|
-
? n.push.apply(n, c)
|
|
127
|
-
: n.push({ scopeParent: i, candidates: c })
|
|
128
|
-
} else {
|
|
129
|
-
var h = re.call(i, ke)
|
|
130
|
-
h && s.filter(i) && (t || !e.includes(i)) && n.push(i)
|
|
131
|
-
var m =
|
|
132
|
-
i.shadowRoot ||
|
|
133
|
-
(typeof s.getShadowRoot == 'function' && s.getShadowRoot(i)),
|
|
134
|
-
f = !Fe(m, !1) && (!s.shadowRootFilter || s.shadowRootFilter(i))
|
|
135
|
-
if (m && f) {
|
|
136
|
-
var b = a(m === !0 ? i.children : m.children, !0, s)
|
|
137
|
-
s.flatten
|
|
138
|
-
? n.push.apply(n, b)
|
|
139
|
-
: n.push({ scopeParent: i, candidates: b })
|
|
140
|
-
} else r.unshift.apply(r, i.children)
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return n
|
|
144
|
-
},
|
|
145
|
-
yt = function (e) {
|
|
146
|
-
return !isNaN(parseInt(e.getAttribute('tabindex'), 10))
|
|
147
|
-
},
|
|
148
|
-
ie = function (e) {
|
|
149
|
-
if (!e) throw new Error('No node provided')
|
|
150
|
-
return e.tabIndex < 0 &&
|
|
151
|
-
(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || rs(e)) &&
|
|
152
|
-
!yt(e)
|
|
153
|
-
? 0
|
|
154
|
-
: e.tabIndex
|
|
155
|
-
},
|
|
156
|
-
as = function (e, t) {
|
|
157
|
-
var s = ie(e)
|
|
158
|
-
return s < 0 && t && !yt(e) ? 0 : s
|
|
159
|
-
},
|
|
160
|
-
os = function (e, t) {
|
|
161
|
-
return e.tabIndex === t.tabIndex
|
|
162
|
-
? e.documentOrder - t.documentOrder
|
|
163
|
-
: e.tabIndex - t.tabIndex
|
|
164
|
-
},
|
|
165
|
-
wt = function (e) {
|
|
166
|
-
return e.tagName === 'INPUT'
|
|
167
|
-
},
|
|
168
|
-
ls = function (e) {
|
|
169
|
-
return wt(e) && e.type === 'hidden'
|
|
170
|
-
},
|
|
171
|
-
cs = function (e) {
|
|
172
|
-
var t =
|
|
173
|
-
e.tagName === 'DETAILS' &&
|
|
174
|
-
Array.prototype.slice.apply(e.children).some(function (s) {
|
|
175
|
-
return s.tagName === 'SUMMARY'
|
|
176
|
-
})
|
|
177
|
-
return t
|
|
178
|
-
},
|
|
179
|
-
us = function (e, t) {
|
|
180
|
-
for (var s = 0; s < e.length; s++)
|
|
181
|
-
if (e[s].checked && e[s].form === t) return e[s]
|
|
182
|
-
},
|
|
183
|
-
ds = function (e) {
|
|
184
|
-
if (!e.name) return !0
|
|
185
|
-
var t = e.form || Ne(e),
|
|
186
|
-
s = function (o) {
|
|
187
|
-
return t.querySelectorAll('input[type="radio"][name="' + o + '"]')
|
|
188
|
-
},
|
|
189
|
-
n
|
|
190
|
-
if (
|
|
191
|
-
typeof window < 'u' &&
|
|
192
|
-
typeof window.CSS < 'u' &&
|
|
193
|
-
typeof window.CSS.escape == 'function'
|
|
194
|
-
)
|
|
195
|
-
n = s(window.CSS.escape(e.name))
|
|
196
|
-
else
|
|
197
|
-
try {
|
|
198
|
-
n = s(e.name)
|
|
199
|
-
} catch (i) {
|
|
200
|
-
return (
|
|
201
|
-
console.error(
|
|
202
|
-
'Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s',
|
|
203
|
-
i.message,
|
|
204
|
-
),
|
|
205
|
-
!1
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
var r = us(n, e.form)
|
|
209
|
-
return !r || r === e
|
|
210
|
-
},
|
|
211
|
-
hs = function (e) {
|
|
212
|
-
return wt(e) && e.type === 'radio'
|
|
213
|
-
},
|
|
214
|
-
fs = function (e) {
|
|
215
|
-
return hs(e) && !ds(e)
|
|
216
|
-
},
|
|
217
|
-
ps = function (e) {
|
|
218
|
-
var t,
|
|
219
|
-
s = e && Ne(e),
|
|
220
|
-
n = (t = s) === null || t === void 0 ? void 0 : t.host,
|
|
221
|
-
r = !1
|
|
222
|
-
if (s && s !== e) {
|
|
223
|
-
var i, o, l
|
|
224
|
-
for (
|
|
225
|
-
r = !!(
|
|
226
|
-
((i = n) !== null &&
|
|
227
|
-
i !== void 0 &&
|
|
228
|
-
(o = i.ownerDocument) !== null &&
|
|
229
|
-
o !== void 0 &&
|
|
230
|
-
o.contains(n)) ||
|
|
231
|
-
(e != null &&
|
|
232
|
-
(l = e.ownerDocument) !== null &&
|
|
233
|
-
l !== void 0 &&
|
|
234
|
-
l.contains(e))
|
|
235
|
-
);
|
|
236
|
-
!r && n;
|
|
237
|
-
|
|
238
|
-
) {
|
|
239
|
-
var c, h, m
|
|
240
|
-
;((s = Ne(n)),
|
|
241
|
-
(n = (c = s) === null || c === void 0 ? void 0 : c.host),
|
|
242
|
-
(r = !!(
|
|
243
|
-
(h = n) !== null &&
|
|
244
|
-
h !== void 0 &&
|
|
245
|
-
(m = h.ownerDocument) !== null &&
|
|
246
|
-
m !== void 0 &&
|
|
247
|
-
m.contains(n)
|
|
248
|
-
)))
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return r
|
|
252
|
-
},
|
|
253
|
-
at = function (e) {
|
|
254
|
-
var t = e.getBoundingClientRect(),
|
|
255
|
-
s = t.width,
|
|
256
|
-
n = t.height
|
|
257
|
-
return s === 0 && n === 0
|
|
258
|
-
},
|
|
259
|
-
vs = function (e, t) {
|
|
260
|
-
var s = t.displayCheck,
|
|
261
|
-
n = t.getShadowRoot
|
|
262
|
-
if (getComputedStyle(e).visibility === 'hidden') return !0
|
|
263
|
-
var r = re.call(e, 'details>summary:first-of-type'),
|
|
264
|
-
i = r ? e.parentElement : e
|
|
265
|
-
if (re.call(i, 'details:not([open]) *')) return !0
|
|
266
|
-
if (!s || s === 'full' || s === 'legacy-full') {
|
|
267
|
-
if (typeof n == 'function') {
|
|
268
|
-
for (var o = e; e; ) {
|
|
269
|
-
var l = e.parentElement,
|
|
270
|
-
c = Ne(e)
|
|
271
|
-
if (l && !l.shadowRoot && n(l) === !0) return at(e)
|
|
272
|
-
e.assignedSlot
|
|
273
|
-
? (e = e.assignedSlot)
|
|
274
|
-
: !l && c !== e.ownerDocument
|
|
275
|
-
? (e = c.host)
|
|
276
|
-
: (e = l)
|
|
277
|
-
}
|
|
278
|
-
e = o
|
|
279
|
-
}
|
|
280
|
-
if (ps(e)) return !e.getClientRects().length
|
|
281
|
-
if (s !== 'legacy-full') return !0
|
|
282
|
-
} else if (s === 'non-zero-area') return at(e)
|
|
283
|
-
return !1
|
|
284
|
-
},
|
|
285
|
-
ms = function (e) {
|
|
286
|
-
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
|
|
287
|
-
for (var t = e.parentElement; t; ) {
|
|
288
|
-
if (t.tagName === 'FIELDSET' && t.disabled) {
|
|
289
|
-
for (var s = 0; s < t.children.length; s++) {
|
|
290
|
-
var n = t.children.item(s)
|
|
291
|
-
if (n.tagName === 'LEGEND')
|
|
292
|
-
return re.call(t, 'fieldset[disabled] *') ? !0 : !n.contains(e)
|
|
293
|
-
}
|
|
294
|
-
return !0
|
|
295
|
-
}
|
|
296
|
-
t = t.parentElement
|
|
297
|
-
}
|
|
298
|
-
return !1
|
|
299
|
-
},
|
|
300
|
-
Oe = function (e, t) {
|
|
301
|
-
return !(t.disabled || Fe(t) || ls(t) || vs(t, e) || cs(t) || ms(t))
|
|
302
|
-
},
|
|
303
|
-
je = function (e, t) {
|
|
304
|
-
return !(fs(t) || ie(t) < 0 || !Oe(e, t))
|
|
305
|
-
},
|
|
306
|
-
gs = function (e) {
|
|
307
|
-
var t = parseInt(e.getAttribute('tabindex'), 10)
|
|
308
|
-
return !!(isNaN(t) || t >= 0)
|
|
309
|
-
},
|
|
310
|
-
bs = function a(e) {
|
|
311
|
-
var t = [],
|
|
312
|
-
s = []
|
|
313
|
-
return (
|
|
314
|
-
e.forEach(function (n, r) {
|
|
315
|
-
var i = !!n.scopeParent,
|
|
316
|
-
o = i ? n.scopeParent : n,
|
|
317
|
-
l = as(o, i),
|
|
318
|
-
c = i ? a(n.candidates) : o
|
|
319
|
-
l === 0
|
|
320
|
-
? i
|
|
321
|
-
? t.push.apply(t, c)
|
|
322
|
-
: t.push(o)
|
|
323
|
-
: s.push({
|
|
324
|
-
documentOrder: r,
|
|
325
|
-
tabIndex: l,
|
|
326
|
-
item: n,
|
|
327
|
-
isScope: i,
|
|
328
|
-
content: c,
|
|
329
|
-
})
|
|
330
|
-
}),
|
|
331
|
-
s
|
|
332
|
-
.sort(os)
|
|
333
|
-
.reduce(function (n, r) {
|
|
334
|
-
return (r.isScope ? n.push.apply(n, r.content) : n.push(r.content), n)
|
|
335
|
-
}, [])
|
|
336
|
-
.concat(t)
|
|
337
|
-
)
|
|
338
|
-
},
|
|
339
|
-
ys = function (e, t) {
|
|
340
|
-
t = t || {}
|
|
341
|
-
var s
|
|
342
|
-
return (
|
|
343
|
-
t.getShadowRoot
|
|
344
|
-
? (s = bt([e], t.includeContainer, {
|
|
345
|
-
filter: je.bind(null, t),
|
|
346
|
-
flatten: !1,
|
|
347
|
-
getShadowRoot: t.getShadowRoot,
|
|
348
|
-
shadowRootFilter: gs,
|
|
349
|
-
}))
|
|
350
|
-
: (s = gt(e, t.includeContainer, je.bind(null, t))),
|
|
351
|
-
bs(s)
|
|
352
|
-
)
|
|
353
|
-
},
|
|
354
|
-
ws = function (e, t) {
|
|
355
|
-
t = t || {}
|
|
356
|
-
var s
|
|
357
|
-
return (
|
|
358
|
-
t.getShadowRoot
|
|
359
|
-
? (s = bt([e], t.includeContainer, {
|
|
360
|
-
filter: Oe.bind(null, t),
|
|
361
|
-
flatten: !0,
|
|
362
|
-
getShadowRoot: t.getShadowRoot,
|
|
363
|
-
}))
|
|
364
|
-
: (s = gt(e, t.includeContainer, Oe.bind(null, t))),
|
|
365
|
-
s
|
|
366
|
-
)
|
|
367
|
-
},
|
|
368
|
-
ae = function (e, t) {
|
|
369
|
-
if (((t = t || {}), !e)) throw new Error('No node provided')
|
|
370
|
-
return re.call(e, ke) === !1 ? !1 : je(t, e)
|
|
371
|
-
},
|
|
372
|
-
xs = vt.concat('iframe').join(','),
|
|
373
|
-
Me = function (e, t) {
|
|
374
|
-
if (((t = t || {}), !e)) throw new Error('No node provided')
|
|
375
|
-
return re.call(e, xs) === !1 ? !1 : Oe(t, e)
|
|
376
|
-
}
|
|
377
|
-
/*!
|
|
378
|
-
* focus-trap 7.6.5
|
|
379
|
-
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
380
|
-
*/ function Be(a, e) {
|
|
381
|
-
;(e == null || e > a.length) && (e = a.length)
|
|
382
|
-
for (var t = 0, s = Array(e); t < e; t++) s[t] = a[t]
|
|
383
|
-
return s
|
|
384
|
-
}
|
|
385
|
-
function _s(a) {
|
|
386
|
-
if (Array.isArray(a)) return Be(a)
|
|
387
|
-
}
|
|
388
|
-
function Ss(a, e, t) {
|
|
389
|
-
return (
|
|
390
|
-
(e = Ns(e)) in a
|
|
391
|
-
? Object.defineProperty(a, e, {
|
|
392
|
-
value: t,
|
|
393
|
-
enumerable: !0,
|
|
394
|
-
configurable: !0,
|
|
395
|
-
writable: !0,
|
|
396
|
-
})
|
|
397
|
-
: (a[e] = t),
|
|
398
|
-
a
|
|
399
|
-
)
|
|
400
|
-
}
|
|
401
|
-
function Es(a) {
|
|
402
|
-
if (
|
|
403
|
-
(typeof Symbol < 'u' && a[Symbol.iterator] != null) ||
|
|
404
|
-
a['@@iterator'] != null
|
|
405
|
-
)
|
|
406
|
-
return Array.from(a)
|
|
407
|
-
}
|
|
408
|
-
function Ts() {
|
|
409
|
-
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
410
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)
|
|
411
|
-
}
|
|
412
|
-
function ot(a, e) {
|
|
413
|
-
var t = Object.keys(a)
|
|
414
|
-
if (Object.getOwnPropertySymbols) {
|
|
415
|
-
var s = Object.getOwnPropertySymbols(a)
|
|
416
|
-
;(e &&
|
|
417
|
-
(s = s.filter(function (n) {
|
|
418
|
-
return Object.getOwnPropertyDescriptor(a, n).enumerable
|
|
419
|
-
})),
|
|
420
|
-
t.push.apply(t, s))
|
|
421
|
-
}
|
|
422
|
-
return t
|
|
423
|
-
}
|
|
424
|
-
function lt(a) {
|
|
425
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
426
|
-
var t = arguments[e] != null ? arguments[e] : {}
|
|
427
|
-
e % 2
|
|
428
|
-
? ot(Object(t), !0).forEach(function (s) {
|
|
429
|
-
Ss(a, s, t[s])
|
|
430
|
-
})
|
|
431
|
-
: Object.getOwnPropertyDescriptors
|
|
432
|
-
? Object.defineProperties(a, Object.getOwnPropertyDescriptors(t))
|
|
433
|
-
: ot(Object(t)).forEach(function (s) {
|
|
434
|
-
Object.defineProperty(a, s, Object.getOwnPropertyDescriptor(t, s))
|
|
435
|
-
})
|
|
436
|
-
}
|
|
437
|
-
return a
|
|
438
|
-
}
|
|
439
|
-
function Is(a) {
|
|
440
|
-
return _s(a) || Es(a) || Fs(a) || Ts()
|
|
441
|
-
}
|
|
442
|
-
function ks(a, e) {
|
|
443
|
-
if (typeof a != 'object' || !a) return a
|
|
444
|
-
var t = a[Symbol.toPrimitive]
|
|
445
|
-
if (t !== void 0) {
|
|
446
|
-
var s = t.call(a, e)
|
|
447
|
-
if (typeof s != 'object') return s
|
|
448
|
-
throw new TypeError('@@toPrimitive must return a primitive value.')
|
|
449
|
-
}
|
|
450
|
-
return (e === 'string' ? String : Number)(a)
|
|
451
|
-
}
|
|
452
|
-
function Ns(a) {
|
|
453
|
-
var e = ks(a, 'string')
|
|
454
|
-
return typeof e == 'symbol' ? e : e + ''
|
|
455
|
-
}
|
|
456
|
-
function Fs(a, e) {
|
|
457
|
-
if (a) {
|
|
458
|
-
if (typeof a == 'string') return Be(a, e)
|
|
459
|
-
var t = {}.toString.call(a).slice(8, -1)
|
|
460
|
-
return (
|
|
461
|
-
t === 'Object' && a.constructor && (t = a.constructor.name),
|
|
462
|
-
t === 'Map' || t === 'Set'
|
|
463
|
-
? Array.from(a)
|
|
464
|
-
: t === 'Arguments' ||
|
|
465
|
-
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
|
|
466
|
-
? Be(a, e)
|
|
467
|
-
: void 0
|
|
468
|
-
)
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
var ct = {
|
|
472
|
-
activateTrap: function (e, t) {
|
|
473
|
-
if (e.length > 0) {
|
|
474
|
-
var s = e[e.length - 1]
|
|
475
|
-
s !== t && s._setPausedState(!0)
|
|
476
|
-
}
|
|
477
|
-
var n = e.indexOf(t)
|
|
478
|
-
;(n === -1 || e.splice(n, 1), e.push(t))
|
|
479
|
-
},
|
|
480
|
-
deactivateTrap: function (e, t) {
|
|
481
|
-
var s = e.indexOf(t)
|
|
482
|
-
;(s !== -1 && e.splice(s, 1),
|
|
483
|
-
e.length > 0 &&
|
|
484
|
-
!e[e.length - 1]._isManuallyPaused() &&
|
|
485
|
-
e[e.length - 1]._setPausedState(!1))
|
|
486
|
-
},
|
|
487
|
-
},
|
|
488
|
-
Os = function (e) {
|
|
489
|
-
return (
|
|
490
|
-
e.tagName &&
|
|
491
|
-
e.tagName.toLowerCase() === 'input' &&
|
|
492
|
-
typeof e.select == 'function'
|
|
493
|
-
)
|
|
494
|
-
},
|
|
495
|
-
Rs = function (e) {
|
|
496
|
-
return (
|
|
497
|
-
(e == null ? void 0 : e.key) === 'Escape' ||
|
|
498
|
-
(e == null ? void 0 : e.key) === 'Esc' ||
|
|
499
|
-
(e == null ? void 0 : e.keyCode) === 27
|
|
500
|
-
)
|
|
501
|
-
},
|
|
502
|
-
be = function (e) {
|
|
503
|
-
return (
|
|
504
|
-
(e == null ? void 0 : e.key) === 'Tab' ||
|
|
505
|
-
(e == null ? void 0 : e.keyCode) === 9
|
|
506
|
-
)
|
|
507
|
-
},
|
|
508
|
-
Cs = function (e) {
|
|
509
|
-
return be(e) && !e.shiftKey
|
|
510
|
-
},
|
|
511
|
-
As = function (e) {
|
|
512
|
-
return be(e) && e.shiftKey
|
|
513
|
-
},
|
|
514
|
-
ut = function (e) {
|
|
515
|
-
return setTimeout(e, 0)
|
|
516
|
-
},
|
|
517
|
-
me = function (e) {
|
|
518
|
-
for (
|
|
519
|
-
var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1;
|
|
520
|
-
n < t;
|
|
521
|
-
n++
|
|
522
|
-
)
|
|
523
|
-
s[n - 1] = arguments[n]
|
|
524
|
-
return typeof e == 'function' ? e.apply(void 0, s) : e
|
|
525
|
-
},
|
|
526
|
-
Ee = function (e) {
|
|
527
|
-
return e.target.shadowRoot && typeof e.composedPath == 'function'
|
|
528
|
-
? e.composedPath()[0]
|
|
529
|
-
: e.target
|
|
530
|
-
},
|
|
531
|
-
Ms = [],
|
|
532
|
-
Ls = function (e, t) {
|
|
533
|
-
var s = (t == null ? void 0 : t.document) || document,
|
|
534
|
-
n = (t == null ? void 0 : t.trapStack) || Ms,
|
|
535
|
-
r = lt(
|
|
536
|
-
{
|
|
537
|
-
returnFocusOnDeactivate: !0,
|
|
538
|
-
escapeDeactivates: !0,
|
|
539
|
-
delayInitialFocus: !0,
|
|
540
|
-
isKeyForward: Cs,
|
|
541
|
-
isKeyBackward: As,
|
|
542
|
-
},
|
|
543
|
-
t,
|
|
544
|
-
),
|
|
545
|
-
i = {
|
|
546
|
-
containers: [],
|
|
547
|
-
containerGroups: [],
|
|
548
|
-
tabbableGroups: [],
|
|
549
|
-
nodeFocusedBeforeActivation: null,
|
|
550
|
-
mostRecentlyFocusedNode: null,
|
|
551
|
-
active: !1,
|
|
552
|
-
paused: !1,
|
|
553
|
-
manuallyPaused: !1,
|
|
554
|
-
delayInitialFocusTimer: void 0,
|
|
555
|
-
recentNavEvent: void 0,
|
|
556
|
-
},
|
|
557
|
-
o,
|
|
558
|
-
l = function (u, d, g) {
|
|
559
|
-
return u && u[d] !== void 0 ? u[d] : r[g || d]
|
|
560
|
-
},
|
|
561
|
-
c = function (u, d) {
|
|
562
|
-
var g =
|
|
563
|
-
typeof (d == null ? void 0 : d.composedPath) == 'function'
|
|
564
|
-
? d.composedPath()
|
|
565
|
-
: void 0
|
|
566
|
-
return i.containerGroups.findIndex(function (E) {
|
|
567
|
-
var T = E.container,
|
|
568
|
-
F = E.tabbableNodes
|
|
569
|
-
return (
|
|
570
|
-
T.contains(u) ||
|
|
571
|
-
(g == null ? void 0 : g.includes(T)) ||
|
|
572
|
-
F.find(function (S) {
|
|
573
|
-
return S === u
|
|
574
|
-
})
|
|
575
|
-
)
|
|
576
|
-
})
|
|
577
|
-
},
|
|
578
|
-
h = function (u) {
|
|
579
|
-
var d =
|
|
580
|
-
arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
581
|
-
g = d.hasFallback,
|
|
582
|
-
E = g === void 0 ? !1 : g,
|
|
583
|
-
T = d.params,
|
|
584
|
-
F = T === void 0 ? [] : T,
|
|
585
|
-
S = r[u]
|
|
586
|
-
if (
|
|
587
|
-
(typeof S == 'function' && (S = S.apply(void 0, Is(F))),
|
|
588
|
-
S === !0 && (S = void 0),
|
|
589
|
-
!S)
|
|
590
|
-
) {
|
|
591
|
-
if (S === void 0 || S === !1) return S
|
|
592
|
-
throw new Error(
|
|
593
|
-
'`'.concat(
|
|
594
|
-
u,
|
|
595
|
-
'` was specified but was not a node, or did not return a node',
|
|
596
|
-
),
|
|
597
|
-
)
|
|
598
|
-
}
|
|
599
|
-
var R = S
|
|
600
|
-
if (typeof S == 'string') {
|
|
601
|
-
try {
|
|
602
|
-
R = s.querySelector(S)
|
|
603
|
-
} catch (v) {
|
|
604
|
-
throw new Error(
|
|
605
|
-
'`'
|
|
606
|
-
.concat(u, '` appears to be an invalid selector; error="')
|
|
607
|
-
.concat(v.message, '"'),
|
|
608
|
-
)
|
|
609
|
-
}
|
|
610
|
-
if (!R && !E)
|
|
611
|
-
throw new Error(
|
|
612
|
-
'`'.concat(u, '` as selector refers to no known node'),
|
|
613
|
-
)
|
|
614
|
-
}
|
|
615
|
-
return R
|
|
616
|
-
},
|
|
617
|
-
m = function () {
|
|
618
|
-
var u = h('initialFocus', { hasFallback: !0 })
|
|
619
|
-
if (u === !1) return !1
|
|
620
|
-
if (u === void 0 || (u && !Me(u, r.tabbableOptions)))
|
|
621
|
-
if (c(s.activeElement) >= 0) u = s.activeElement
|
|
622
|
-
else {
|
|
623
|
-
var d = i.tabbableGroups[0],
|
|
624
|
-
g = d && d.firstTabbableNode
|
|
625
|
-
u = g || h('fallbackFocus')
|
|
626
|
-
}
|
|
627
|
-
else u === null && (u = h('fallbackFocus'))
|
|
628
|
-
if (!u)
|
|
629
|
-
throw new Error(
|
|
630
|
-
'Your focus-trap needs to have at least one focusable element',
|
|
631
|
-
)
|
|
632
|
-
return u
|
|
633
|
-
},
|
|
634
|
-
f = function () {
|
|
635
|
-
if (
|
|
636
|
-
((i.containerGroups = i.containers.map(function (u) {
|
|
637
|
-
var d = ys(u, r.tabbableOptions),
|
|
638
|
-
g = ws(u, r.tabbableOptions),
|
|
639
|
-
E = d.length > 0 ? d[0] : void 0,
|
|
640
|
-
T = d.length > 0 ? d[d.length - 1] : void 0,
|
|
641
|
-
F = g.find(function (v) {
|
|
642
|
-
return ae(v)
|
|
643
|
-
}),
|
|
644
|
-
S = g
|
|
645
|
-
.slice()
|
|
646
|
-
.reverse()
|
|
647
|
-
.find(function (v) {
|
|
648
|
-
return ae(v)
|
|
649
|
-
}),
|
|
650
|
-
R = !!d.find(function (v) {
|
|
651
|
-
return ie(v) > 0
|
|
652
|
-
})
|
|
653
|
-
return {
|
|
654
|
-
container: u,
|
|
655
|
-
tabbableNodes: d,
|
|
656
|
-
focusableNodes: g,
|
|
657
|
-
posTabIndexesFound: R,
|
|
658
|
-
firstTabbableNode: E,
|
|
659
|
-
lastTabbableNode: T,
|
|
660
|
-
firstDomTabbableNode: F,
|
|
661
|
-
lastDomTabbableNode: S,
|
|
662
|
-
nextTabbableNode: function (p) {
|
|
663
|
-
var I =
|
|
664
|
-
arguments.length > 1 && arguments[1] !== void 0
|
|
665
|
-
? arguments[1]
|
|
666
|
-
: !0,
|
|
667
|
-
O = d.indexOf(p)
|
|
668
|
-
return O < 0
|
|
669
|
-
? I
|
|
670
|
-
? g.slice(g.indexOf(p) + 1).find(function (P) {
|
|
671
|
-
return ae(P)
|
|
672
|
-
})
|
|
673
|
-
: g
|
|
674
|
-
.slice(0, g.indexOf(p))
|
|
675
|
-
.reverse()
|
|
676
|
-
.find(function (P) {
|
|
677
|
-
return ae(P)
|
|
678
|
-
})
|
|
679
|
-
: d[O + (I ? 1 : -1)]
|
|
680
|
-
},
|
|
681
|
-
}
|
|
682
|
-
})),
|
|
683
|
-
(i.tabbableGroups = i.containerGroups.filter(function (u) {
|
|
684
|
-
return u.tabbableNodes.length > 0
|
|
685
|
-
})),
|
|
686
|
-
i.tabbableGroups.length <= 0 && !h('fallbackFocus'))
|
|
687
|
-
)
|
|
688
|
-
throw new Error(
|
|
689
|
-
'Your focus-trap must have at least one container with at least one tabbable node in it at all times',
|
|
690
|
-
)
|
|
691
|
-
if (
|
|
692
|
-
i.containerGroups.find(function (u) {
|
|
693
|
-
return u.posTabIndexesFound
|
|
694
|
-
}) &&
|
|
695
|
-
i.containerGroups.length > 1
|
|
696
|
-
)
|
|
697
|
-
throw new Error(
|
|
698
|
-
"At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.",
|
|
699
|
-
)
|
|
700
|
-
},
|
|
701
|
-
b = function (u) {
|
|
702
|
-
var d = u.activeElement
|
|
703
|
-
if (d)
|
|
704
|
-
return d.shadowRoot && d.shadowRoot.activeElement !== null
|
|
705
|
-
? b(d.shadowRoot)
|
|
706
|
-
: d
|
|
707
|
-
},
|
|
708
|
-
y = function (u) {
|
|
709
|
-
if (u !== !1 && u !== b(document)) {
|
|
710
|
-
if (!u || !u.focus) {
|
|
711
|
-
y(m())
|
|
712
|
-
return
|
|
713
|
-
}
|
|
714
|
-
;(u.focus({ preventScroll: !!r.preventScroll }),
|
|
715
|
-
(i.mostRecentlyFocusedNode = u),
|
|
716
|
-
Os(u) && u.select())
|
|
717
|
-
}
|
|
718
|
-
},
|
|
719
|
-
x = function (u) {
|
|
720
|
-
var d = h('setReturnFocus', { params: [u] })
|
|
721
|
-
return d || (d === !1 ? !1 : u)
|
|
722
|
-
},
|
|
723
|
-
w = function (u) {
|
|
724
|
-
var d = u.target,
|
|
725
|
-
g = u.event,
|
|
726
|
-
E = u.isBackward,
|
|
727
|
-
T = E === void 0 ? !1 : E
|
|
728
|
-
;((d = d || Ee(g)), f())
|
|
729
|
-
var F = null
|
|
730
|
-
if (i.tabbableGroups.length > 0) {
|
|
731
|
-
var S = c(d, g),
|
|
732
|
-
R = S >= 0 ? i.containerGroups[S] : void 0
|
|
733
|
-
if (S < 0)
|
|
734
|
-
T
|
|
735
|
-
? (F =
|
|
736
|
-
i.tabbableGroups[i.tabbableGroups.length - 1]
|
|
737
|
-
.lastTabbableNode)
|
|
738
|
-
: (F = i.tabbableGroups[0].firstTabbableNode)
|
|
739
|
-
else if (T) {
|
|
740
|
-
var v = i.tabbableGroups.findIndex(function (V) {
|
|
741
|
-
var k = V.firstTabbableNode
|
|
742
|
-
return d === k
|
|
743
|
-
})
|
|
744
|
-
if (
|
|
745
|
-
(v < 0 &&
|
|
746
|
-
(R.container === d ||
|
|
747
|
-
(Me(d, r.tabbableOptions) &&
|
|
748
|
-
!ae(d, r.tabbableOptions) &&
|
|
749
|
-
!R.nextTabbableNode(d, !1))) &&
|
|
750
|
-
(v = S),
|
|
751
|
-
v >= 0)
|
|
752
|
-
) {
|
|
753
|
-
var p = v === 0 ? i.tabbableGroups.length - 1 : v - 1,
|
|
754
|
-
I = i.tabbableGroups[p]
|
|
755
|
-
F = ie(d) >= 0 ? I.lastTabbableNode : I.lastDomTabbableNode
|
|
756
|
-
} else be(g) || (F = R.nextTabbableNode(d, !1))
|
|
757
|
-
} else {
|
|
758
|
-
var O = i.tabbableGroups.findIndex(function (V) {
|
|
759
|
-
var k = V.lastTabbableNode
|
|
760
|
-
return d === k
|
|
761
|
-
})
|
|
762
|
-
if (
|
|
763
|
-
(O < 0 &&
|
|
764
|
-
(R.container === d ||
|
|
765
|
-
(Me(d, r.tabbableOptions) &&
|
|
766
|
-
!ae(d, r.tabbableOptions) &&
|
|
767
|
-
!R.nextTabbableNode(d))) &&
|
|
768
|
-
(O = S),
|
|
769
|
-
O >= 0)
|
|
770
|
-
) {
|
|
771
|
-
var P = O === i.tabbableGroups.length - 1 ? 0 : O + 1,
|
|
772
|
-
z = i.tabbableGroups[P]
|
|
773
|
-
F = ie(d) >= 0 ? z.firstTabbableNode : z.firstDomTabbableNode
|
|
774
|
-
} else be(g) || (F = R.nextTabbableNode(d))
|
|
775
|
-
}
|
|
776
|
-
} else F = h('fallbackFocus')
|
|
777
|
-
return F
|
|
778
|
-
},
|
|
779
|
-
C = function (u) {
|
|
780
|
-
var d = Ee(u)
|
|
781
|
-
if (!(c(d, u) >= 0)) {
|
|
782
|
-
if (me(r.clickOutsideDeactivates, u)) {
|
|
783
|
-
o.deactivate({ returnFocus: r.returnFocusOnDeactivate })
|
|
784
|
-
return
|
|
785
|
-
}
|
|
786
|
-
me(r.allowOutsideClick, u) || u.preventDefault()
|
|
787
|
-
}
|
|
788
|
-
},
|
|
789
|
-
A = function (u) {
|
|
790
|
-
var d = Ee(u),
|
|
791
|
-
g = c(d, u) >= 0
|
|
792
|
-
if (g || d instanceof Document) g && (i.mostRecentlyFocusedNode = d)
|
|
793
|
-
else {
|
|
794
|
-
u.stopImmediatePropagation()
|
|
795
|
-
var E,
|
|
796
|
-
T = !0
|
|
797
|
-
if (i.mostRecentlyFocusedNode)
|
|
798
|
-
if (ie(i.mostRecentlyFocusedNode) > 0) {
|
|
799
|
-
var F = c(i.mostRecentlyFocusedNode),
|
|
800
|
-
S = i.containerGroups[F].tabbableNodes
|
|
801
|
-
if (S.length > 0) {
|
|
802
|
-
var R = S.findIndex(function (v) {
|
|
803
|
-
return v === i.mostRecentlyFocusedNode
|
|
804
|
-
})
|
|
805
|
-
R >= 0 &&
|
|
806
|
-
(r.isKeyForward(i.recentNavEvent)
|
|
807
|
-
? R + 1 < S.length && ((E = S[R + 1]), (T = !1))
|
|
808
|
-
: R - 1 >= 0 && ((E = S[R - 1]), (T = !1)))
|
|
809
|
-
}
|
|
810
|
-
} else
|
|
811
|
-
i.containerGroups.some(function (v) {
|
|
812
|
-
return v.tabbableNodes.some(function (p) {
|
|
813
|
-
return ie(p) > 0
|
|
814
|
-
})
|
|
815
|
-
}) || (T = !1)
|
|
816
|
-
else T = !1
|
|
817
|
-
;(T &&
|
|
818
|
-
(E = w({
|
|
819
|
-
target: i.mostRecentlyFocusedNode,
|
|
820
|
-
isBackward: r.isKeyBackward(i.recentNavEvent),
|
|
821
|
-
})),
|
|
822
|
-
y(E || i.mostRecentlyFocusedNode || m()))
|
|
823
|
-
}
|
|
824
|
-
i.recentNavEvent = void 0
|
|
825
|
-
},
|
|
826
|
-
J = function (u) {
|
|
827
|
-
var d =
|
|
828
|
-
arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1
|
|
829
|
-
i.recentNavEvent = u
|
|
830
|
-
var g = w({ event: u, isBackward: d })
|
|
831
|
-
g && (be(u) && u.preventDefault(), y(g))
|
|
832
|
-
},
|
|
833
|
-
Q = function (u) {
|
|
834
|
-
;(r.isKeyForward(u) || r.isKeyBackward(u)) && J(u, r.isKeyBackward(u))
|
|
835
|
-
},
|
|
836
|
-
W = function (u) {
|
|
837
|
-
Rs(u) &&
|
|
838
|
-
me(r.escapeDeactivates, u) !== !1 &&
|
|
839
|
-
(u.preventDefault(), o.deactivate())
|
|
840
|
-
},
|
|
841
|
-
$ = function (u) {
|
|
842
|
-
var d = Ee(u)
|
|
843
|
-
c(d, u) >= 0 ||
|
|
844
|
-
me(r.clickOutsideDeactivates, u) ||
|
|
845
|
-
me(r.allowOutsideClick, u) ||
|
|
846
|
-
(u.preventDefault(), u.stopImmediatePropagation())
|
|
847
|
-
},
|
|
848
|
-
j = function () {
|
|
849
|
-
if (i.active)
|
|
850
|
-
return (
|
|
851
|
-
ct.activateTrap(n, o),
|
|
852
|
-
(i.delayInitialFocusTimer = r.delayInitialFocus
|
|
853
|
-
? ut(function () {
|
|
854
|
-
y(m())
|
|
855
|
-
})
|
|
856
|
-
: y(m())),
|
|
857
|
-
s.addEventListener('focusin', A, !0),
|
|
858
|
-
s.addEventListener('mousedown', C, { capture: !0, passive: !1 }),
|
|
859
|
-
s.addEventListener('touchstart', C, { capture: !0, passive: !1 }),
|
|
860
|
-
s.addEventListener('click', $, { capture: !0, passive: !1 }),
|
|
861
|
-
s.addEventListener('keydown', Q, { capture: !0, passive: !1 }),
|
|
862
|
-
s.addEventListener('keydown', W),
|
|
863
|
-
o
|
|
864
|
-
)
|
|
865
|
-
},
|
|
866
|
-
ye = function () {
|
|
867
|
-
if (i.active)
|
|
868
|
-
return (
|
|
869
|
-
s.removeEventListener('focusin', A, !0),
|
|
870
|
-
s.removeEventListener('mousedown', C, !0),
|
|
871
|
-
s.removeEventListener('touchstart', C, !0),
|
|
872
|
-
s.removeEventListener('click', $, !0),
|
|
873
|
-
s.removeEventListener('keydown', Q, !0),
|
|
874
|
-
s.removeEventListener('keydown', W),
|
|
875
|
-
o
|
|
876
|
-
)
|
|
877
|
-
},
|
|
878
|
-
M = function (u) {
|
|
879
|
-
var d = u.some(function (g) {
|
|
880
|
-
var E = Array.from(g.removedNodes)
|
|
881
|
-
return E.some(function (T) {
|
|
882
|
-
return T === i.mostRecentlyFocusedNode
|
|
883
|
-
})
|
|
884
|
-
})
|
|
885
|
-
d && y(m())
|
|
886
|
-
},
|
|
887
|
-
q =
|
|
888
|
-
typeof window < 'u' && 'MutationObserver' in window
|
|
889
|
-
? new MutationObserver(M)
|
|
890
|
-
: void 0,
|
|
891
|
-
U = function () {
|
|
892
|
-
q &&
|
|
893
|
-
(q.disconnect(),
|
|
894
|
-
i.active &&
|
|
895
|
-
!i.paused &&
|
|
896
|
-
i.containers.map(function (u) {
|
|
897
|
-
q.observe(u, { subtree: !0, childList: !0 })
|
|
898
|
-
}))
|
|
899
|
-
}
|
|
900
|
-
return (
|
|
901
|
-
(o = {
|
|
902
|
-
get active() {
|
|
903
|
-
return i.active
|
|
904
|
-
},
|
|
905
|
-
get paused() {
|
|
906
|
-
return i.paused
|
|
907
|
-
},
|
|
908
|
-
activate: function (u) {
|
|
909
|
-
if (i.active) return this
|
|
910
|
-
var d = l(u, 'onActivate'),
|
|
911
|
-
g = l(u, 'onPostActivate'),
|
|
912
|
-
E = l(u, 'checkCanFocusTrap')
|
|
913
|
-
;(E || f(),
|
|
914
|
-
(i.active = !0),
|
|
915
|
-
(i.paused = !1),
|
|
916
|
-
(i.nodeFocusedBeforeActivation = b(s)),
|
|
917
|
-
d == null || d())
|
|
918
|
-
var T = function () {
|
|
919
|
-
;(E && f(), j(), U(), g == null || g())
|
|
920
|
-
}
|
|
921
|
-
return E ? (E(i.containers.concat()).then(T, T), this) : (T(), this)
|
|
922
|
-
},
|
|
923
|
-
deactivate: function (u) {
|
|
924
|
-
if (!i.active) return this
|
|
925
|
-
var d = lt(
|
|
926
|
-
{
|
|
927
|
-
onDeactivate: r.onDeactivate,
|
|
928
|
-
onPostDeactivate: r.onPostDeactivate,
|
|
929
|
-
checkCanReturnFocus: r.checkCanReturnFocus,
|
|
930
|
-
},
|
|
931
|
-
u,
|
|
932
|
-
)
|
|
933
|
-
;(clearTimeout(i.delayInitialFocusTimer),
|
|
934
|
-
(i.delayInitialFocusTimer = void 0),
|
|
935
|
-
ye(),
|
|
936
|
-
(i.active = !1),
|
|
937
|
-
(i.paused = !1),
|
|
938
|
-
U(),
|
|
939
|
-
ct.deactivateTrap(n, o))
|
|
940
|
-
var g = l(d, 'onDeactivate'),
|
|
941
|
-
E = l(d, 'onPostDeactivate'),
|
|
942
|
-
T = l(d, 'checkCanReturnFocus'),
|
|
943
|
-
F = l(d, 'returnFocus', 'returnFocusOnDeactivate')
|
|
944
|
-
g == null || g()
|
|
945
|
-
var S = function () {
|
|
946
|
-
ut(function () {
|
|
947
|
-
;(F && y(x(i.nodeFocusedBeforeActivation)), E == null || E())
|
|
948
|
-
})
|
|
949
|
-
}
|
|
950
|
-
return F && T
|
|
951
|
-
? (T(x(i.nodeFocusedBeforeActivation)).then(S, S), this)
|
|
952
|
-
: (S(), this)
|
|
953
|
-
},
|
|
954
|
-
pause: function (u) {
|
|
955
|
-
return i.active
|
|
956
|
-
? ((i.manuallyPaused = !0), this._setPausedState(!0, u))
|
|
957
|
-
: this
|
|
958
|
-
},
|
|
959
|
-
unpause: function (u) {
|
|
960
|
-
return i.active
|
|
961
|
-
? ((i.manuallyPaused = !1),
|
|
962
|
-
n[n.length - 1] !== this ? this : this._setPausedState(!1, u))
|
|
963
|
-
: this
|
|
964
|
-
},
|
|
965
|
-
updateContainerElements: function (u) {
|
|
966
|
-
var d = [].concat(u).filter(Boolean)
|
|
967
|
-
return (
|
|
968
|
-
(i.containers = d.map(function (g) {
|
|
969
|
-
return typeof g == 'string' ? s.querySelector(g) : g
|
|
970
|
-
})),
|
|
971
|
-
i.active && f(),
|
|
972
|
-
U(),
|
|
973
|
-
this
|
|
974
|
-
)
|
|
975
|
-
},
|
|
976
|
-
}),
|
|
977
|
-
Object.defineProperties(o, {
|
|
978
|
-
_isManuallyPaused: {
|
|
979
|
-
value: function () {
|
|
980
|
-
return i.manuallyPaused
|
|
981
|
-
},
|
|
982
|
-
},
|
|
983
|
-
_setPausedState: {
|
|
984
|
-
value: function (u, d) {
|
|
985
|
-
if (i.paused === u) return this
|
|
986
|
-
if (((i.paused = u), u)) {
|
|
987
|
-
var g = l(d, 'onPause'),
|
|
988
|
-
E = l(d, 'onPostPause')
|
|
989
|
-
;(g == null || g(), ye(), U(), E == null || E())
|
|
990
|
-
} else {
|
|
991
|
-
var T = l(d, 'onUnpause'),
|
|
992
|
-
F = l(d, 'onPostUnpause')
|
|
993
|
-
;(T == null || T(), f(), j(), U(), F == null || F())
|
|
994
|
-
}
|
|
995
|
-
return this
|
|
996
|
-
},
|
|
997
|
-
},
|
|
998
|
-
}),
|
|
999
|
-
o.updateContainerElements(e),
|
|
1000
|
-
o
|
|
1001
|
-
)
|
|
1002
|
-
}
|
|
1003
|
-
function Ds(a, e = {}) {
|
|
1004
|
-
let t
|
|
1005
|
-
const { immediate: s, ...n } = e,
|
|
1006
|
-
r = le(!1),
|
|
1007
|
-
i = le(!1),
|
|
1008
|
-
o = (f) => t && t.activate(f),
|
|
1009
|
-
l = (f) => t && t.deactivate(f),
|
|
1010
|
-
c = () => {
|
|
1011
|
-
t && (t.pause(), (i.value = !0))
|
|
1012
|
-
},
|
|
1013
|
-
h = () => {
|
|
1014
|
-
t && (t.unpause(), (i.value = !1))
|
|
1015
|
-
},
|
|
1016
|
-
m = ge(() => {
|
|
1017
|
-
const f = et(a)
|
|
1018
|
-
return Rt(f)
|
|
1019
|
-
.map((b) => {
|
|
1020
|
-
const y = et(b)
|
|
1021
|
-
return typeof y == 'string' ? y : Ct(y)
|
|
1022
|
-
})
|
|
1023
|
-
.filter(At)
|
|
1024
|
-
})
|
|
1025
|
-
return (
|
|
1026
|
-
$e(
|
|
1027
|
-
m,
|
|
1028
|
-
(f) => {
|
|
1029
|
-
f.length &&
|
|
1030
|
-
((t = Ls(f, {
|
|
1031
|
-
...n,
|
|
1032
|
-
onActivate() {
|
|
1033
|
-
;((r.value = !0), e.onActivate && e.onActivate())
|
|
1034
|
-
},
|
|
1035
|
-
onDeactivate() {
|
|
1036
|
-
;((r.value = !1), e.onDeactivate && e.onDeactivate())
|
|
1037
|
-
},
|
|
1038
|
-
})),
|
|
1039
|
-
s && o())
|
|
1040
|
-
},
|
|
1041
|
-
{ flush: 'post' },
|
|
1042
|
-
),
|
|
1043
|
-
Mt(() => l()),
|
|
1044
|
-
{
|
|
1045
|
-
hasFocus: r,
|
|
1046
|
-
isPaused: i,
|
|
1047
|
-
activate: o,
|
|
1048
|
-
deactivate: l,
|
|
1049
|
-
pause: c,
|
|
1050
|
-
unpause: h,
|
|
1051
|
-
}
|
|
1052
|
-
)
|
|
1053
|
-
}
|
|
1054
|
-
class ce {
|
|
1055
|
-
constructor(e, t = !0, s = [], n = 5e3) {
|
|
1056
|
-
;((this.ctx = e),
|
|
1057
|
-
(this.iframes = t),
|
|
1058
|
-
(this.exclude = s),
|
|
1059
|
-
(this.iframesTimeout = n))
|
|
1060
|
-
}
|
|
1061
|
-
static matches(e, t) {
|
|
1062
|
-
const s = typeof t == 'string' ? [t] : t,
|
|
1063
|
-
n =
|
|
1064
|
-
e.matches ||
|
|
1065
|
-
e.matchesSelector ||
|
|
1066
|
-
e.msMatchesSelector ||
|
|
1067
|
-
e.mozMatchesSelector ||
|
|
1068
|
-
e.oMatchesSelector ||
|
|
1069
|
-
e.webkitMatchesSelector
|
|
1070
|
-
if (n) {
|
|
1071
|
-
let r = !1
|
|
1072
|
-
return (s.every((i) => (n.call(e, i) ? ((r = !0), !1) : !0)), r)
|
|
1073
|
-
} else return !1
|
|
1074
|
-
}
|
|
1075
|
-
getContexts() {
|
|
1076
|
-
let e,
|
|
1077
|
-
t = []
|
|
1078
|
-
return (
|
|
1079
|
-
typeof this.ctx > 'u' || !this.ctx
|
|
1080
|
-
? (e = [])
|
|
1081
|
-
: NodeList.prototype.isPrototypeOf(this.ctx)
|
|
1082
|
-
? (e = Array.prototype.slice.call(this.ctx))
|
|
1083
|
-
: Array.isArray(this.ctx)
|
|
1084
|
-
? (e = this.ctx)
|
|
1085
|
-
: typeof this.ctx == 'string'
|
|
1086
|
-
? (e = Array.prototype.slice.call(
|
|
1087
|
-
document.querySelectorAll(this.ctx),
|
|
1088
|
-
))
|
|
1089
|
-
: (e = [this.ctx]),
|
|
1090
|
-
e.forEach((s) => {
|
|
1091
|
-
const n = t.filter((r) => r.contains(s)).length > 0
|
|
1092
|
-
t.indexOf(s) === -1 && !n && t.push(s)
|
|
1093
|
-
}),
|
|
1094
|
-
t
|
|
1095
|
-
)
|
|
1096
|
-
}
|
|
1097
|
-
getIframeContents(e, t, s = () => {}) {
|
|
1098
|
-
let n
|
|
1099
|
-
try {
|
|
1100
|
-
const r = e.contentWindow
|
|
1101
|
-
if (((n = r.document), !r || !n)) throw new Error('iframe inaccessible')
|
|
1102
|
-
} catch {
|
|
1103
|
-
s()
|
|
1104
|
-
}
|
|
1105
|
-
n && t(n)
|
|
1106
|
-
}
|
|
1107
|
-
isIframeBlank(e) {
|
|
1108
|
-
const t = 'about:blank',
|
|
1109
|
-
s = e.getAttribute('src').trim()
|
|
1110
|
-
return e.contentWindow.location.href === t && s !== t && s
|
|
1111
|
-
}
|
|
1112
|
-
observeIframeLoad(e, t, s) {
|
|
1113
|
-
let n = !1,
|
|
1114
|
-
r = null
|
|
1115
|
-
const i = () => {
|
|
1116
|
-
if (!n) {
|
|
1117
|
-
;((n = !0), clearTimeout(r))
|
|
1118
|
-
try {
|
|
1119
|
-
this.isIframeBlank(e) ||
|
|
1120
|
-
(e.removeEventListener('load', i), this.getIframeContents(e, t, s))
|
|
1121
|
-
} catch {
|
|
1122
|
-
s()
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
;(e.addEventListener('load', i), (r = setTimeout(i, this.iframesTimeout)))
|
|
1127
|
-
}
|
|
1128
|
-
onIframeReady(e, t, s) {
|
|
1129
|
-
try {
|
|
1130
|
-
e.contentWindow.document.readyState === 'complete'
|
|
1131
|
-
? this.isIframeBlank(e)
|
|
1132
|
-
? this.observeIframeLoad(e, t, s)
|
|
1133
|
-
: this.getIframeContents(e, t, s)
|
|
1134
|
-
: this.observeIframeLoad(e, t, s)
|
|
1135
|
-
} catch {
|
|
1136
|
-
s()
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
waitForIframes(e, t) {
|
|
1140
|
-
let s = 0
|
|
1141
|
-
this.forEachIframe(
|
|
1142
|
-
e,
|
|
1143
|
-
() => !0,
|
|
1144
|
-
(n) => {
|
|
1145
|
-
;(s++,
|
|
1146
|
-
this.waitForIframes(n.querySelector('html'), () => {
|
|
1147
|
-
--s || t()
|
|
1148
|
-
}))
|
|
1149
|
-
},
|
|
1150
|
-
(n) => {
|
|
1151
|
-
n || t()
|
|
1152
|
-
},
|
|
1153
|
-
)
|
|
1154
|
-
}
|
|
1155
|
-
forEachIframe(e, t, s, n = () => {}) {
|
|
1156
|
-
let r = e.querySelectorAll('iframe'),
|
|
1157
|
-
i = r.length,
|
|
1158
|
-
o = 0
|
|
1159
|
-
r = Array.prototype.slice.call(r)
|
|
1160
|
-
const l = () => {
|
|
1161
|
-
--i <= 0 && n(o)
|
|
1162
|
-
}
|
|
1163
|
-
;(i || l(),
|
|
1164
|
-
r.forEach((c) => {
|
|
1165
|
-
ce.matches(c, this.exclude)
|
|
1166
|
-
? l()
|
|
1167
|
-
: this.onIframeReady(
|
|
1168
|
-
c,
|
|
1169
|
-
(h) => {
|
|
1170
|
-
;(t(c) && (o++, s(h)), l())
|
|
1171
|
-
},
|
|
1172
|
-
l,
|
|
1173
|
-
)
|
|
1174
|
-
}))
|
|
1175
|
-
}
|
|
1176
|
-
createIterator(e, t, s) {
|
|
1177
|
-
return document.createNodeIterator(e, t, s, !1)
|
|
1178
|
-
}
|
|
1179
|
-
createInstanceOnIframe(e) {
|
|
1180
|
-
return new ce(e.querySelector('html'), this.iframes)
|
|
1181
|
-
}
|
|
1182
|
-
compareNodeIframe(e, t, s) {
|
|
1183
|
-
const n = e.compareDocumentPosition(s),
|
|
1184
|
-
r = Node.DOCUMENT_POSITION_PRECEDING
|
|
1185
|
-
if (n & r)
|
|
1186
|
-
if (t !== null) {
|
|
1187
|
-
const i = t.compareDocumentPosition(s),
|
|
1188
|
-
o = Node.DOCUMENT_POSITION_FOLLOWING
|
|
1189
|
-
if (i & o) return !0
|
|
1190
|
-
} else return !0
|
|
1191
|
-
return !1
|
|
1192
|
-
}
|
|
1193
|
-
getIteratorNode(e) {
|
|
1194
|
-
const t = e.previousNode()
|
|
1195
|
-
let s
|
|
1196
|
-
return (
|
|
1197
|
-
t === null ? (s = e.nextNode()) : (s = e.nextNode() && e.nextNode()),
|
|
1198
|
-
{ prevNode: t, node: s }
|
|
1199
|
-
)
|
|
1200
|
-
}
|
|
1201
|
-
checkIframeFilter(e, t, s, n) {
|
|
1202
|
-
let r = !1,
|
|
1203
|
-
i = !1
|
|
1204
|
-
return (
|
|
1205
|
-
n.forEach((o, l) => {
|
|
1206
|
-
o.val === s && ((r = l), (i = o.handled))
|
|
1207
|
-
}),
|
|
1208
|
-
this.compareNodeIframe(e, t, s)
|
|
1209
|
-
? (r === !1 && !i
|
|
1210
|
-
? n.push({ val: s, handled: !0 })
|
|
1211
|
-
: r !== !1 && !i && (n[r].handled = !0),
|
|
1212
|
-
!0)
|
|
1213
|
-
: (r === !1 && n.push({ val: s, handled: !1 }), !1)
|
|
1214
|
-
)
|
|
1215
|
-
}
|
|
1216
|
-
handleOpenIframes(e, t, s, n) {
|
|
1217
|
-
e.forEach((r) => {
|
|
1218
|
-
r.handled ||
|
|
1219
|
-
this.getIframeContents(r.val, (i) => {
|
|
1220
|
-
this.createInstanceOnIframe(i).forEachNode(t, s, n)
|
|
1221
|
-
})
|
|
1222
|
-
})
|
|
1223
|
-
}
|
|
1224
|
-
iterateThroughNodes(e, t, s, n, r) {
|
|
1225
|
-
const i = this.createIterator(t, e, n)
|
|
1226
|
-
let o = [],
|
|
1227
|
-
l = [],
|
|
1228
|
-
c,
|
|
1229
|
-
h,
|
|
1230
|
-
m = () => (({ prevNode: h, node: c } = this.getIteratorNode(i)), c)
|
|
1231
|
-
for (; m(); )
|
|
1232
|
-
(this.iframes &&
|
|
1233
|
-
this.forEachIframe(
|
|
1234
|
-
t,
|
|
1235
|
-
(f) => this.checkIframeFilter(c, h, f, o),
|
|
1236
|
-
(f) => {
|
|
1237
|
-
this.createInstanceOnIframe(f).forEachNode(e, (b) => l.push(b), n)
|
|
1238
|
-
},
|
|
1239
|
-
),
|
|
1240
|
-
l.push(c))
|
|
1241
|
-
;(l.forEach((f) => {
|
|
1242
|
-
s(f)
|
|
1243
|
-
}),
|
|
1244
|
-
this.iframes && this.handleOpenIframes(o, e, s, n),
|
|
1245
|
-
r())
|
|
1246
|
-
}
|
|
1247
|
-
forEachNode(e, t, s, n = () => {}) {
|
|
1248
|
-
const r = this.getContexts()
|
|
1249
|
-
let i = r.length
|
|
1250
|
-
;(i || n(),
|
|
1251
|
-
r.forEach((o) => {
|
|
1252
|
-
const l = () => {
|
|
1253
|
-
this.iterateThroughNodes(e, o, t, s, () => {
|
|
1254
|
-
--i <= 0 && n()
|
|
1255
|
-
})
|
|
1256
|
-
}
|
|
1257
|
-
this.iframes ? this.waitForIframes(o, l) : l()
|
|
1258
|
-
}))
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
let Ps = class {
|
|
1262
|
-
constructor(e) {
|
|
1263
|
-
;((this.ctx = e), (this.ie = !1))
|
|
1264
|
-
const t = window.navigator.userAgent
|
|
1265
|
-
;(t.indexOf('MSIE') > -1 || t.indexOf('Trident') > -1) && (this.ie = !0)
|
|
1266
|
-
}
|
|
1267
|
-
set opt(e) {
|
|
1268
|
-
this._opt = Object.assign(
|
|
1269
|
-
{},
|
|
1270
|
-
{
|
|
1271
|
-
element: '',
|
|
1272
|
-
className: '',
|
|
1273
|
-
exclude: [],
|
|
1274
|
-
iframes: !1,
|
|
1275
|
-
iframesTimeout: 5e3,
|
|
1276
|
-
separateWordSearch: !0,
|
|
1277
|
-
diacritics: !0,
|
|
1278
|
-
synonyms: {},
|
|
1279
|
-
accuracy: 'partially',
|
|
1280
|
-
acrossElements: !1,
|
|
1281
|
-
caseSensitive: !1,
|
|
1282
|
-
ignoreJoiners: !1,
|
|
1283
|
-
ignoreGroups: 0,
|
|
1284
|
-
ignorePunctuation: [],
|
|
1285
|
-
wildcards: 'disabled',
|
|
1286
|
-
each: () => {},
|
|
1287
|
-
noMatch: () => {},
|
|
1288
|
-
filter: () => !0,
|
|
1289
|
-
done: () => {},
|
|
1290
|
-
debug: !1,
|
|
1291
|
-
log: window.console,
|
|
1292
|
-
},
|
|
1293
|
-
e,
|
|
1294
|
-
)
|
|
1295
|
-
}
|
|
1296
|
-
get opt() {
|
|
1297
|
-
return this._opt
|
|
1298
|
-
}
|
|
1299
|
-
get iterator() {
|
|
1300
|
-
return new ce(
|
|
1301
|
-
this.ctx,
|
|
1302
|
-
this.opt.iframes,
|
|
1303
|
-
this.opt.exclude,
|
|
1304
|
-
this.opt.iframesTimeout,
|
|
1305
|
-
)
|
|
1306
|
-
}
|
|
1307
|
-
log(e, t = 'debug') {
|
|
1308
|
-
const s = this.opt.log
|
|
1309
|
-
this.opt.debug &&
|
|
1310
|
-
typeof s == 'object' &&
|
|
1311
|
-
typeof s[t] == 'function' &&
|
|
1312
|
-
s[t](`mark.js: ${e}`)
|
|
1313
|
-
}
|
|
1314
|
-
escapeStr(e) {
|
|
1315
|
-
return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
|
1316
|
-
}
|
|
1317
|
-
createRegExp(e) {
|
|
1318
|
-
return (
|
|
1319
|
-
this.opt.wildcards !== 'disabled' && (e = this.setupWildcardsRegExp(e)),
|
|
1320
|
-
(e = this.escapeStr(e)),
|
|
1321
|
-
Object.keys(this.opt.synonyms).length &&
|
|
1322
|
-
(e = this.createSynonymsRegExp(e)),
|
|
1323
|
-
(this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) &&
|
|
1324
|
-
(e = this.setupIgnoreJoinersRegExp(e)),
|
|
1325
|
-
this.opt.diacritics && (e = this.createDiacriticsRegExp(e)),
|
|
1326
|
-
(e = this.createMergedBlanksRegExp(e)),
|
|
1327
|
-
(this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) &&
|
|
1328
|
-
(e = this.createJoinersRegExp(e)),
|
|
1329
|
-
this.opt.wildcards !== 'disabled' && (e = this.createWildcardsRegExp(e)),
|
|
1330
|
-
(e = this.createAccuracyRegExp(e)),
|
|
1331
|
-
e
|
|
1332
|
-
)
|
|
1333
|
-
}
|
|
1334
|
-
createSynonymsRegExp(e) {
|
|
1335
|
-
const t = this.opt.synonyms,
|
|
1336
|
-
s = this.opt.caseSensitive ? '' : 'i',
|
|
1337
|
-
n =
|
|
1338
|
-
this.opt.ignoreJoiners || this.opt.ignorePunctuation.length ? '\0' : ''
|
|
1339
|
-
for (let r in t)
|
|
1340
|
-
if (t.hasOwnProperty(r)) {
|
|
1341
|
-
const i = t[r],
|
|
1342
|
-
o =
|
|
1343
|
-
this.opt.wildcards !== 'disabled'
|
|
1344
|
-
? this.setupWildcardsRegExp(r)
|
|
1345
|
-
: this.escapeStr(r),
|
|
1346
|
-
l =
|
|
1347
|
-
this.opt.wildcards !== 'disabled'
|
|
1348
|
-
? this.setupWildcardsRegExp(i)
|
|
1349
|
-
: this.escapeStr(i)
|
|
1350
|
-
o !== '' &&
|
|
1351
|
-
l !== '' &&
|
|
1352
|
-
(e = e.replace(
|
|
1353
|
-
new RegExp(`(${this.escapeStr(o)}|${this.escapeStr(l)})`, `gm${s}`),
|
|
1354
|
-
n + `(${this.processSynomyms(o)}|${this.processSynomyms(l)})` + n,
|
|
1355
|
-
))
|
|
1356
|
-
}
|
|
1357
|
-
return e
|
|
1358
|
-
}
|
|
1359
|
-
processSynomyms(e) {
|
|
1360
|
-
return (
|
|
1361
|
-
(this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) &&
|
|
1362
|
-
(e = this.setupIgnoreJoinersRegExp(e)),
|
|
1363
|
-
e
|
|
1364
|
-
)
|
|
1365
|
-
}
|
|
1366
|
-
setupWildcardsRegExp(e) {
|
|
1367
|
-
return (
|
|
1368
|
-
(e = e.replace(/(?:\\)*\?/g, (t) => (t.charAt(0) === '\\' ? '?' : ''))),
|
|
1369
|
-
e.replace(/(?:\\)*\*/g, (t) => (t.charAt(0) === '\\' ? '*' : ''))
|
|
1370
|
-
)
|
|
1371
|
-
}
|
|
1372
|
-
createWildcardsRegExp(e) {
|
|
1373
|
-
let t = this.opt.wildcards === 'withSpaces'
|
|
1374
|
-
return e
|
|
1375
|
-
.replace(/\u0001/g, t ? '[\\S\\s]?' : '\\S?')
|
|
1376
|
-
.replace(/\u0002/g, t ? '[\\S\\s]*?' : '\\S*')
|
|
1377
|
-
}
|
|
1378
|
-
setupIgnoreJoinersRegExp(e) {
|
|
1379
|
-
return e.replace(/[^(|)\\]/g, (t, s, n) => {
|
|
1380
|
-
let r = n.charAt(s + 1)
|
|
1381
|
-
return /[(|)\\]/.test(r) || r === '' ? t : t + '\0'
|
|
1382
|
-
})
|
|
1383
|
-
}
|
|
1384
|
-
createJoinersRegExp(e) {
|
|
1385
|
-
let t = []
|
|
1386
|
-
const s = this.opt.ignorePunctuation
|
|
1387
|
-
return (
|
|
1388
|
-
Array.isArray(s) && s.length && t.push(this.escapeStr(s.join(''))),
|
|
1389
|
-
this.opt.ignoreJoiners && t.push('\\u00ad\\u200b\\u200c\\u200d'),
|
|
1390
|
-
t.length ? e.split(/\u0000+/).join(`[${t.join('')}]*`) : e
|
|
1391
|
-
)
|
|
1392
|
-
}
|
|
1393
|
-
createDiacriticsRegExp(e) {
|
|
1394
|
-
const t = this.opt.caseSensitive ? '' : 'i',
|
|
1395
|
-
s = this.opt.caseSensitive
|
|
1396
|
-
? [
|
|
1397
|
-
'aàáảãạăằắẳẵặâầấẩẫậäåāą',
|
|
1398
|
-
'AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ',
|
|
1399
|
-
'cçćč',
|
|
1400
|
-
'CÇĆČ',
|
|
1401
|
-
'dđď',
|
|
1402
|
-
'DĐĎ',
|
|
1403
|
-
'eèéẻẽẹêềếểễệëěēę',
|
|
1404
|
-
'EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ',
|
|
1405
|
-
'iìíỉĩịîïī',
|
|
1406
|
-
'IÌÍỈĨỊÎÏĪ',
|
|
1407
|
-
'lł',
|
|
1408
|
-
'LŁ',
|
|
1409
|
-
'nñňń',
|
|
1410
|
-
'NÑŇŃ',
|
|
1411
|
-
'oòóỏõọôồốổỗộơởỡớờợöøō',
|
|
1412
|
-
'OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ',
|
|
1413
|
-
'rř',
|
|
1414
|
-
'RŘ',
|
|
1415
|
-
'sšśșş',
|
|
1416
|
-
'SŠŚȘŞ',
|
|
1417
|
-
'tťțţ',
|
|
1418
|
-
'TŤȚŢ',
|
|
1419
|
-
'uùúủũụưừứửữựûüůū',
|
|
1420
|
-
'UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ',
|
|
1421
|
-
'yýỳỷỹỵÿ',
|
|
1422
|
-
'YÝỲỶỸỴŸ',
|
|
1423
|
-
'zžżź',
|
|
1424
|
-
'ZŽŻŹ',
|
|
1425
|
-
]
|
|
1426
|
-
: [
|
|
1427
|
-
'aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ',
|
|
1428
|
-
'cçćčCÇĆČ',
|
|
1429
|
-
'dđďDĐĎ',
|
|
1430
|
-
'eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ',
|
|
1431
|
-
'iìíỉĩịîïīIÌÍỈĨỊÎÏĪ',
|
|
1432
|
-
'lłLŁ',
|
|
1433
|
-
'nñňńNÑŇŃ',
|
|
1434
|
-
'oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ',
|
|
1435
|
-
'rřRŘ',
|
|
1436
|
-
'sšśșşSŠŚȘŞ',
|
|
1437
|
-
'tťțţTŤȚŢ',
|
|
1438
|
-
'uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ',
|
|
1439
|
-
'yýỳỷỹỵÿYÝỲỶỸỴŸ',
|
|
1440
|
-
'zžżźZŽŻŹ',
|
|
1441
|
-
]
|
|
1442
|
-
let n = []
|
|
1443
|
-
return (
|
|
1444
|
-
e.split('').forEach((r) => {
|
|
1445
|
-
s.every((i) => {
|
|
1446
|
-
if (i.indexOf(r) !== -1) {
|
|
1447
|
-
if (n.indexOf(i) > -1) return !1
|
|
1448
|
-
;((e = e.replace(new RegExp(`[${i}]`, `gm${t}`), `[${i}]`)),
|
|
1449
|
-
n.push(i))
|
|
1450
|
-
}
|
|
1451
|
-
return !0
|
|
1452
|
-
})
|
|
1453
|
-
}),
|
|
1454
|
-
e
|
|
1455
|
-
)
|
|
1456
|
-
}
|
|
1457
|
-
createMergedBlanksRegExp(e) {
|
|
1458
|
-
return e.replace(/[\s]+/gim, '[\\s]+')
|
|
1459
|
-
}
|
|
1460
|
-
createAccuracyRegExp(e) {
|
|
1461
|
-
const t = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~¡¿'
|
|
1462
|
-
let s = this.opt.accuracy,
|
|
1463
|
-
n = typeof s == 'string' ? s : s.value,
|
|
1464
|
-
r = typeof s == 'string' ? [] : s.limiters,
|
|
1465
|
-
i = ''
|
|
1466
|
-
switch (
|
|
1467
|
-
(r.forEach((o) => {
|
|
1468
|
-
i += `|${this.escapeStr(o)}`
|
|
1469
|
-
}),
|
|
1470
|
-
n)
|
|
1471
|
-
) {
|
|
1472
|
-
case 'partially':
|
|
1473
|
-
default:
|
|
1474
|
-
return `()(${e})`
|
|
1475
|
-
case 'complementary':
|
|
1476
|
-
return (
|
|
1477
|
-
(i = '\\s' + (i || this.escapeStr(t))),
|
|
1478
|
-
`()([^${i}]*${e}[^${i}]*)`
|
|
1479
|
-
)
|
|
1480
|
-
case 'exactly':
|
|
1481
|
-
return `(^|\\s${i})(${e})(?=$|\\s${i})`
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
getSeparatedKeywords(e) {
|
|
1485
|
-
let t = []
|
|
1486
|
-
return (
|
|
1487
|
-
e.forEach((s) => {
|
|
1488
|
-
this.opt.separateWordSearch
|
|
1489
|
-
? s.split(' ').forEach((n) => {
|
|
1490
|
-
n.trim() && t.indexOf(n) === -1 && t.push(n)
|
|
1491
|
-
})
|
|
1492
|
-
: s.trim() && t.indexOf(s) === -1 && t.push(s)
|
|
1493
|
-
}),
|
|
1494
|
-
{ keywords: t.sort((s, n) => n.length - s.length), length: t.length }
|
|
1495
|
-
)
|
|
1496
|
-
}
|
|
1497
|
-
isNumeric(e) {
|
|
1498
|
-
return Number(parseFloat(e)) == e
|
|
1499
|
-
}
|
|
1500
|
-
checkRanges(e) {
|
|
1501
|
-
if (
|
|
1502
|
-
!Array.isArray(e) ||
|
|
1503
|
-
Object.prototype.toString.call(e[0]) !== '[object Object]'
|
|
1504
|
-
)
|
|
1505
|
-
return (
|
|
1506
|
-
this.log('markRanges() will only accept an array of objects'),
|
|
1507
|
-
this.opt.noMatch(e),
|
|
1508
|
-
[]
|
|
1509
|
-
)
|
|
1510
|
-
const t = []
|
|
1511
|
-
let s = 0
|
|
1512
|
-
return (
|
|
1513
|
-
e
|
|
1514
|
-
.sort((n, r) => n.start - r.start)
|
|
1515
|
-
.forEach((n) => {
|
|
1516
|
-
let {
|
|
1517
|
-
start: r,
|
|
1518
|
-
end: i,
|
|
1519
|
-
valid: o,
|
|
1520
|
-
} = this.callNoMatchOnInvalidRanges(n, s)
|
|
1521
|
-
o && ((n.start = r), (n.length = i - r), t.push(n), (s = i))
|
|
1522
|
-
}),
|
|
1523
|
-
t
|
|
1524
|
-
)
|
|
1525
|
-
}
|
|
1526
|
-
callNoMatchOnInvalidRanges(e, t) {
|
|
1527
|
-
let s,
|
|
1528
|
-
n,
|
|
1529
|
-
r = !1
|
|
1530
|
-
return (
|
|
1531
|
-
e && typeof e.start < 'u'
|
|
1532
|
-
? ((s = parseInt(e.start, 10)),
|
|
1533
|
-
(n = s + parseInt(e.length, 10)),
|
|
1534
|
-
this.isNumeric(e.start) &&
|
|
1535
|
-
this.isNumeric(e.length) &&
|
|
1536
|
-
n - t > 0 &&
|
|
1537
|
-
n - s > 0
|
|
1538
|
-
? (r = !0)
|
|
1539
|
-
: (this.log(
|
|
1540
|
-
`Ignoring invalid or overlapping range: ${JSON.stringify(e)}`,
|
|
1541
|
-
),
|
|
1542
|
-
this.opt.noMatch(e)))
|
|
1543
|
-
: (this.log(`Ignoring invalid range: ${JSON.stringify(e)}`),
|
|
1544
|
-
this.opt.noMatch(e)),
|
|
1545
|
-
{ start: s, end: n, valid: r }
|
|
1546
|
-
)
|
|
1547
|
-
}
|
|
1548
|
-
checkWhitespaceRanges(e, t, s) {
|
|
1549
|
-
let n,
|
|
1550
|
-
r = !0,
|
|
1551
|
-
i = s.length,
|
|
1552
|
-
o = t - i,
|
|
1553
|
-
l = parseInt(e.start, 10) - o
|
|
1554
|
-
return (
|
|
1555
|
-
(l = l > i ? i : l),
|
|
1556
|
-
(n = l + parseInt(e.length, 10)),
|
|
1557
|
-
n > i &&
|
|
1558
|
-
((n = i),
|
|
1559
|
-
this.log(`End range automatically set to the max value of ${i}`)),
|
|
1560
|
-
l < 0 || n - l < 0 || l > i || n > i
|
|
1561
|
-
? ((r = !1),
|
|
1562
|
-
this.log(`Invalid range: ${JSON.stringify(e)}`),
|
|
1563
|
-
this.opt.noMatch(e))
|
|
1564
|
-
: s.substring(l, n).replace(/\s+/g, '') === '' &&
|
|
1565
|
-
((r = !1),
|
|
1566
|
-
this.log('Skipping whitespace only range: ' + JSON.stringify(e)),
|
|
1567
|
-
this.opt.noMatch(e)),
|
|
1568
|
-
{ start: l, end: n, valid: r }
|
|
1569
|
-
)
|
|
1570
|
-
}
|
|
1571
|
-
getTextNodes(e) {
|
|
1572
|
-
let t = '',
|
|
1573
|
-
s = []
|
|
1574
|
-
this.iterator.forEachNode(
|
|
1575
|
-
NodeFilter.SHOW_TEXT,
|
|
1576
|
-
(n) => {
|
|
1577
|
-
s.push({ start: t.length, end: (t += n.textContent).length, node: n })
|
|
1578
|
-
},
|
|
1579
|
-
(n) =>
|
|
1580
|
-
this.matchesExclude(n.parentNode)
|
|
1581
|
-
? NodeFilter.FILTER_REJECT
|
|
1582
|
-
: NodeFilter.FILTER_ACCEPT,
|
|
1583
|
-
() => {
|
|
1584
|
-
e({ value: t, nodes: s })
|
|
1585
|
-
},
|
|
1586
|
-
)
|
|
1587
|
-
}
|
|
1588
|
-
matchesExclude(e) {
|
|
1589
|
-
return ce.matches(
|
|
1590
|
-
e,
|
|
1591
|
-
this.opt.exclude.concat(['script', 'style', 'title', 'head', 'html']),
|
|
1592
|
-
)
|
|
1593
|
-
}
|
|
1594
|
-
wrapRangeInTextNode(e, t, s) {
|
|
1595
|
-
const n = this.opt.element ? this.opt.element : 'mark',
|
|
1596
|
-
r = e.splitText(t),
|
|
1597
|
-
i = r.splitText(s - t)
|
|
1598
|
-
let o = document.createElement(n)
|
|
1599
|
-
return (
|
|
1600
|
-
o.setAttribute('data-markjs', 'true'),
|
|
1601
|
-
this.opt.className && o.setAttribute('class', this.opt.className),
|
|
1602
|
-
(o.textContent = r.textContent),
|
|
1603
|
-
r.parentNode.replaceChild(o, r),
|
|
1604
|
-
i
|
|
1605
|
-
)
|
|
1606
|
-
}
|
|
1607
|
-
wrapRangeInMappedTextNode(e, t, s, n, r) {
|
|
1608
|
-
e.nodes.every((i, o) => {
|
|
1609
|
-
const l = e.nodes[o + 1]
|
|
1610
|
-
if (typeof l > 'u' || l.start > t) {
|
|
1611
|
-
if (!n(i.node)) return !1
|
|
1612
|
-
const c = t - i.start,
|
|
1613
|
-
h = (s > i.end ? i.end : s) - i.start,
|
|
1614
|
-
m = e.value.substr(0, i.start),
|
|
1615
|
-
f = e.value.substr(h + i.start)
|
|
1616
|
-
if (
|
|
1617
|
-
((i.node = this.wrapRangeInTextNode(i.node, c, h)),
|
|
1618
|
-
(e.value = m + f),
|
|
1619
|
-
e.nodes.forEach((b, y) => {
|
|
1620
|
-
y >= o &&
|
|
1621
|
-
(e.nodes[y].start > 0 && y !== o && (e.nodes[y].start -= h),
|
|
1622
|
-
(e.nodes[y].end -= h))
|
|
1623
|
-
}),
|
|
1624
|
-
(s -= h),
|
|
1625
|
-
r(i.node.previousSibling, i.start),
|
|
1626
|
-
s > i.end)
|
|
1627
|
-
)
|
|
1628
|
-
t = i.end
|
|
1629
|
-
else return !1
|
|
1630
|
-
}
|
|
1631
|
-
return !0
|
|
1632
|
-
})
|
|
1633
|
-
}
|
|
1634
|
-
wrapMatches(e, t, s, n, r) {
|
|
1635
|
-
const i = t === 0 ? 0 : t + 1
|
|
1636
|
-
this.getTextNodes((o) => {
|
|
1637
|
-
;(o.nodes.forEach((l) => {
|
|
1638
|
-
l = l.node
|
|
1639
|
-
let c
|
|
1640
|
-
for (; (c = e.exec(l.textContent)) !== null && c[i] !== ''; ) {
|
|
1641
|
-
if (!s(c[i], l)) continue
|
|
1642
|
-
let h = c.index
|
|
1643
|
-
if (i !== 0) for (let m = 1; m < i; m++) h += c[m].length
|
|
1644
|
-
;((l = this.wrapRangeInTextNode(l, h, h + c[i].length)),
|
|
1645
|
-
n(l.previousSibling),
|
|
1646
|
-
(e.lastIndex = 0))
|
|
1647
|
-
}
|
|
1648
|
-
}),
|
|
1649
|
-
r())
|
|
1650
|
-
})
|
|
1651
|
-
}
|
|
1652
|
-
wrapMatchesAcrossElements(e, t, s, n, r) {
|
|
1653
|
-
const i = t === 0 ? 0 : t + 1
|
|
1654
|
-
this.getTextNodes((o) => {
|
|
1655
|
-
let l
|
|
1656
|
-
for (; (l = e.exec(o.value)) !== null && l[i] !== ''; ) {
|
|
1657
|
-
let c = l.index
|
|
1658
|
-
if (i !== 0) for (let m = 1; m < i; m++) c += l[m].length
|
|
1659
|
-
const h = c + l[i].length
|
|
1660
|
-
this.wrapRangeInMappedTextNode(
|
|
1661
|
-
o,
|
|
1662
|
-
c,
|
|
1663
|
-
h,
|
|
1664
|
-
(m) => s(l[i], m),
|
|
1665
|
-
(m, f) => {
|
|
1666
|
-
;((e.lastIndex = f), n(m))
|
|
1667
|
-
},
|
|
1668
|
-
)
|
|
1669
|
-
}
|
|
1670
|
-
r()
|
|
1671
|
-
})
|
|
1672
|
-
}
|
|
1673
|
-
wrapRangeFromIndex(e, t, s, n) {
|
|
1674
|
-
this.getTextNodes((r) => {
|
|
1675
|
-
const i = r.value.length
|
|
1676
|
-
;(e.forEach((o, l) => {
|
|
1677
|
-
let {
|
|
1678
|
-
start: c,
|
|
1679
|
-
end: h,
|
|
1680
|
-
valid: m,
|
|
1681
|
-
} = this.checkWhitespaceRanges(o, i, r.value)
|
|
1682
|
-
m &&
|
|
1683
|
-
this.wrapRangeInMappedTextNode(
|
|
1684
|
-
r,
|
|
1685
|
-
c,
|
|
1686
|
-
h,
|
|
1687
|
-
(f) => t(f, o, r.value.substring(c, h), l),
|
|
1688
|
-
(f) => {
|
|
1689
|
-
s(f, o)
|
|
1690
|
-
},
|
|
1691
|
-
)
|
|
1692
|
-
}),
|
|
1693
|
-
n())
|
|
1694
|
-
})
|
|
1695
|
-
}
|
|
1696
|
-
unwrapMatches(e) {
|
|
1697
|
-
const t = e.parentNode
|
|
1698
|
-
let s = document.createDocumentFragment()
|
|
1699
|
-
for (; e.firstChild; ) s.appendChild(e.removeChild(e.firstChild))
|
|
1700
|
-
;(t.replaceChild(s, e), this.ie ? this.normalizeTextNode(t) : t.normalize())
|
|
1701
|
-
}
|
|
1702
|
-
normalizeTextNode(e) {
|
|
1703
|
-
if (e) {
|
|
1704
|
-
if (e.nodeType === 3)
|
|
1705
|
-
for (; e.nextSibling && e.nextSibling.nodeType === 3; )
|
|
1706
|
-
((e.nodeValue += e.nextSibling.nodeValue),
|
|
1707
|
-
e.parentNode.removeChild(e.nextSibling))
|
|
1708
|
-
else this.normalizeTextNode(e.firstChild)
|
|
1709
|
-
this.normalizeTextNode(e.nextSibling)
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
markRegExp(e, t) {
|
|
1713
|
-
;((this.opt = t), this.log(`Searching with expression "${e}"`))
|
|
1714
|
-
let s = 0,
|
|
1715
|
-
n = 'wrapMatches'
|
|
1716
|
-
const r = (i) => {
|
|
1717
|
-
;(s++, this.opt.each(i))
|
|
1718
|
-
}
|
|
1719
|
-
;(this.opt.acrossElements && (n = 'wrapMatchesAcrossElements'),
|
|
1720
|
-
this[n](
|
|
1721
|
-
e,
|
|
1722
|
-
this.opt.ignoreGroups,
|
|
1723
|
-
(i, o) => this.opt.filter(o, i, s),
|
|
1724
|
-
r,
|
|
1725
|
-
() => {
|
|
1726
|
-
;(s === 0 && this.opt.noMatch(e), this.opt.done(s))
|
|
1727
|
-
},
|
|
1728
|
-
))
|
|
1729
|
-
}
|
|
1730
|
-
mark(e, t) {
|
|
1731
|
-
this.opt = t
|
|
1732
|
-
let s = 0,
|
|
1733
|
-
n = 'wrapMatches'
|
|
1734
|
-
const { keywords: r, length: i } = this.getSeparatedKeywords(
|
|
1735
|
-
typeof e == 'string' ? [e] : e,
|
|
1736
|
-
),
|
|
1737
|
-
o = this.opt.caseSensitive ? '' : 'i',
|
|
1738
|
-
l = (c) => {
|
|
1739
|
-
let h = new RegExp(this.createRegExp(c), `gm${o}`),
|
|
1740
|
-
m = 0
|
|
1741
|
-
;(this.log(`Searching with expression "${h}"`),
|
|
1742
|
-
this[n](
|
|
1743
|
-
h,
|
|
1744
|
-
1,
|
|
1745
|
-
(f, b) => this.opt.filter(b, c, s, m),
|
|
1746
|
-
(f) => {
|
|
1747
|
-
;(m++, s++, this.opt.each(f))
|
|
1748
|
-
},
|
|
1749
|
-
() => {
|
|
1750
|
-
;(m === 0 && this.opt.noMatch(c),
|
|
1751
|
-
r[i - 1] === c ? this.opt.done(s) : l(r[r.indexOf(c) + 1]))
|
|
1752
|
-
},
|
|
1753
|
-
))
|
|
1754
|
-
}
|
|
1755
|
-
;(this.opt.acrossElements && (n = 'wrapMatchesAcrossElements'),
|
|
1756
|
-
i === 0 ? this.opt.done(s) : l(r[0]))
|
|
1757
|
-
}
|
|
1758
|
-
markRanges(e, t) {
|
|
1759
|
-
this.opt = t
|
|
1760
|
-
let s = 0,
|
|
1761
|
-
n = this.checkRanges(e)
|
|
1762
|
-
n && n.length
|
|
1763
|
-
? (this.log(
|
|
1764
|
-
'Starting to mark with the following ranges: ' + JSON.stringify(n),
|
|
1765
|
-
),
|
|
1766
|
-
this.wrapRangeFromIndex(
|
|
1767
|
-
n,
|
|
1768
|
-
(r, i, o, l) => this.opt.filter(r, i, o, l),
|
|
1769
|
-
(r, i) => {
|
|
1770
|
-
;(s++, this.opt.each(r, i))
|
|
1771
|
-
},
|
|
1772
|
-
() => {
|
|
1773
|
-
this.opt.done(s)
|
|
1774
|
-
},
|
|
1775
|
-
))
|
|
1776
|
-
: this.opt.done(s)
|
|
1777
|
-
}
|
|
1778
|
-
unmark(e) {
|
|
1779
|
-
this.opt = e
|
|
1780
|
-
let t = this.opt.element ? this.opt.element : '*'
|
|
1781
|
-
;((t += '[data-markjs]'),
|
|
1782
|
-
this.opt.className && (t += `.${this.opt.className}`),
|
|
1783
|
-
this.log(`Removal selector "${t}"`),
|
|
1784
|
-
this.iterator.forEachNode(
|
|
1785
|
-
NodeFilter.SHOW_ELEMENT,
|
|
1786
|
-
(s) => {
|
|
1787
|
-
this.unwrapMatches(s)
|
|
1788
|
-
},
|
|
1789
|
-
(s) => {
|
|
1790
|
-
const n = ce.matches(s, t),
|
|
1791
|
-
r = this.matchesExclude(s)
|
|
1792
|
-
return !n || r ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
|
|
1793
|
-
},
|
|
1794
|
-
this.opt.done,
|
|
1795
|
-
))
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
function zs(a) {
|
|
1799
|
-
const e = new Ps(a)
|
|
1800
|
-
return (
|
|
1801
|
-
(this.mark = (t, s) => (e.mark(t, s), this)),
|
|
1802
|
-
(this.markRegExp = (t, s) => (e.markRegExp(t, s), this)),
|
|
1803
|
-
(this.markRanges = (t, s) => (e.markRanges(t, s), this)),
|
|
1804
|
-
(this.unmark = (t) => (e.unmark(t), this)),
|
|
1805
|
-
this
|
|
1806
|
-
)
|
|
1807
|
-
}
|
|
1808
|
-
const Vs = 'ENTRIES',
|
|
1809
|
-
xt = 'KEYS',
|
|
1810
|
-
_t = 'VALUES',
|
|
1811
|
-
D = ''
|
|
1812
|
-
class Le {
|
|
1813
|
-
constructor(e, t) {
|
|
1814
|
-
const s = e._tree,
|
|
1815
|
-
n = Array.from(s.keys())
|
|
1816
|
-
;((this.set = e),
|
|
1817
|
-
(this._type = t),
|
|
1818
|
-
(this._path = n.length > 0 ? [{ node: s, keys: n }] : []))
|
|
1819
|
-
}
|
|
1820
|
-
next() {
|
|
1821
|
-
const e = this.dive()
|
|
1822
|
-
return (this.backtrack(), e)
|
|
1823
|
-
}
|
|
1824
|
-
dive() {
|
|
1825
|
-
if (this._path.length === 0) return { done: !0, value: void 0 }
|
|
1826
|
-
const { node: e, keys: t } = oe(this._path)
|
|
1827
|
-
if (oe(t) === D) return { done: !1, value: this.result() }
|
|
1828
|
-
const s = e.get(oe(t))
|
|
1829
|
-
return (
|
|
1830
|
-
this._path.push({ node: s, keys: Array.from(s.keys()) }),
|
|
1831
|
-
this.dive()
|
|
1832
|
-
)
|
|
1833
|
-
}
|
|
1834
|
-
backtrack() {
|
|
1835
|
-
if (this._path.length === 0) return
|
|
1836
|
-
const e = oe(this._path).keys
|
|
1837
|
-
;(e.pop(), !(e.length > 0) && (this._path.pop(), this.backtrack()))
|
|
1838
|
-
}
|
|
1839
|
-
key() {
|
|
1840
|
-
return (
|
|
1841
|
-
this.set._prefix +
|
|
1842
|
-
this._path
|
|
1843
|
-
.map(({ keys: e }) => oe(e))
|
|
1844
|
-
.filter((e) => e !== D)
|
|
1845
|
-
.join('')
|
|
1846
|
-
)
|
|
1847
|
-
}
|
|
1848
|
-
value() {
|
|
1849
|
-
return oe(this._path).node.get(D)
|
|
1850
|
-
}
|
|
1851
|
-
result() {
|
|
1852
|
-
switch (this._type) {
|
|
1853
|
-
case _t:
|
|
1854
|
-
return this.value()
|
|
1855
|
-
case xt:
|
|
1856
|
-
return this.key()
|
|
1857
|
-
default:
|
|
1858
|
-
return [this.key(), this.value()]
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
[Symbol.iterator]() {
|
|
1862
|
-
return this
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
const oe = (a) => a[a.length - 1],
|
|
1866
|
-
$s = (a, e, t) => {
|
|
1867
|
-
const s = new Map()
|
|
1868
|
-
if (e === void 0) return s
|
|
1869
|
-
const n = e.length + 1,
|
|
1870
|
-
r = n + t,
|
|
1871
|
-
i = new Uint8Array(r * n).fill(t + 1)
|
|
1872
|
-
for (let o = 0; o < n; ++o) i[o] = o
|
|
1873
|
-
for (let o = 1; o < r; ++o) i[o * n] = o
|
|
1874
|
-
return (St(a, e, t, s, i, 1, n, ''), s)
|
|
1875
|
-
},
|
|
1876
|
-
St = (a, e, t, s, n, r, i, o) => {
|
|
1877
|
-
const l = r * i
|
|
1878
|
-
e: for (const c of a.keys())
|
|
1879
|
-
if (c === D) {
|
|
1880
|
-
const h = n[l - 1]
|
|
1881
|
-
h <= t && s.set(o, [a.get(c), h])
|
|
1882
|
-
} else {
|
|
1883
|
-
let h = r
|
|
1884
|
-
for (let m = 0; m < c.length; ++m, ++h) {
|
|
1885
|
-
const f = c[m],
|
|
1886
|
-
b = i * h,
|
|
1887
|
-
y = b - i
|
|
1888
|
-
let x = n[b]
|
|
1889
|
-
const w = Math.max(0, h - t - 1),
|
|
1890
|
-
C = Math.min(i - 1, h + t)
|
|
1891
|
-
for (let A = w; A < C; ++A) {
|
|
1892
|
-
const J = f !== e[A],
|
|
1893
|
-
Q = n[y + A] + +J,
|
|
1894
|
-
W = n[y + A + 1] + 1,
|
|
1895
|
-
$ = n[b + A] + 1,
|
|
1896
|
-
j = (n[b + A + 1] = Math.min(Q, W, $))
|
|
1897
|
-
j < x && (x = j)
|
|
1898
|
-
}
|
|
1899
|
-
if (x > t) continue e
|
|
1900
|
-
}
|
|
1901
|
-
St(a.get(c), e, t, s, n, h, i, o + c)
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
class X {
|
|
1905
|
-
constructor(e = new Map(), t = '') {
|
|
1906
|
-
;((this._size = void 0), (this._tree = e), (this._prefix = t))
|
|
1907
|
-
}
|
|
1908
|
-
atPrefix(e) {
|
|
1909
|
-
if (!e.startsWith(this._prefix)) throw new Error('Mismatched prefix')
|
|
1910
|
-
const [t, s] = Re(this._tree, e.slice(this._prefix.length))
|
|
1911
|
-
if (t === void 0) {
|
|
1912
|
-
const [n, r] = qe(s)
|
|
1913
|
-
for (const i of n.keys())
|
|
1914
|
-
if (i !== D && i.startsWith(r)) {
|
|
1915
|
-
const o = new Map()
|
|
1916
|
-
return (o.set(i.slice(r.length), n.get(i)), new X(o, e))
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
return new X(t, e)
|
|
1920
|
-
}
|
|
1921
|
-
clear() {
|
|
1922
|
-
;((this._size = void 0), this._tree.clear())
|
|
1923
|
-
}
|
|
1924
|
-
delete(e) {
|
|
1925
|
-
return ((this._size = void 0), js(this._tree, e))
|
|
1926
|
-
}
|
|
1927
|
-
entries() {
|
|
1928
|
-
return new Le(this, Vs)
|
|
1929
|
-
}
|
|
1930
|
-
forEach(e) {
|
|
1931
|
-
for (const [t, s] of this) e(t, s, this)
|
|
1932
|
-
}
|
|
1933
|
-
fuzzyGet(e, t) {
|
|
1934
|
-
return $s(this._tree, e, t)
|
|
1935
|
-
}
|
|
1936
|
-
get(e) {
|
|
1937
|
-
const t = We(this._tree, e)
|
|
1938
|
-
return t !== void 0 ? t.get(D) : void 0
|
|
1939
|
-
}
|
|
1940
|
-
has(e) {
|
|
1941
|
-
const t = We(this._tree, e)
|
|
1942
|
-
return t !== void 0 && t.has(D)
|
|
1943
|
-
}
|
|
1944
|
-
keys() {
|
|
1945
|
-
return new Le(this, xt)
|
|
1946
|
-
}
|
|
1947
|
-
set(e, t) {
|
|
1948
|
-
if (typeof e != 'string') throw new Error('key must be a string')
|
|
1949
|
-
return ((this._size = void 0), De(this._tree, e).set(D, t), this)
|
|
1950
|
-
}
|
|
1951
|
-
get size() {
|
|
1952
|
-
if (this._size) return this._size
|
|
1953
|
-
this._size = 0
|
|
1954
|
-
const e = this.entries()
|
|
1955
|
-
for (; !e.next().done; ) this._size += 1
|
|
1956
|
-
return this._size
|
|
1957
|
-
}
|
|
1958
|
-
update(e, t) {
|
|
1959
|
-
if (typeof e != 'string') throw new Error('key must be a string')
|
|
1960
|
-
this._size = void 0
|
|
1961
|
-
const s = De(this._tree, e)
|
|
1962
|
-
return (s.set(D, t(s.get(D))), this)
|
|
1963
|
-
}
|
|
1964
|
-
fetch(e, t) {
|
|
1965
|
-
if (typeof e != 'string') throw new Error('key must be a string')
|
|
1966
|
-
this._size = void 0
|
|
1967
|
-
const s = De(this._tree, e)
|
|
1968
|
-
let n = s.get(D)
|
|
1969
|
-
return (n === void 0 && s.set(D, (n = t())), n)
|
|
1970
|
-
}
|
|
1971
|
-
values() {
|
|
1972
|
-
return new Le(this, _t)
|
|
1973
|
-
}
|
|
1974
|
-
[Symbol.iterator]() {
|
|
1975
|
-
return this.entries()
|
|
1976
|
-
}
|
|
1977
|
-
static from(e) {
|
|
1978
|
-
const t = new X()
|
|
1979
|
-
for (const [s, n] of e) t.set(s, n)
|
|
1980
|
-
return t
|
|
1981
|
-
}
|
|
1982
|
-
static fromObject(e) {
|
|
1983
|
-
return X.from(Object.entries(e))
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
const Re = (a, e, t = []) => {
|
|
1987
|
-
if (e.length === 0 || a == null) return [a, t]
|
|
1988
|
-
for (const s of a.keys())
|
|
1989
|
-
if (s !== D && e.startsWith(s))
|
|
1990
|
-
return (t.push([a, s]), Re(a.get(s), e.slice(s.length), t))
|
|
1991
|
-
return (t.push([a, e]), Re(void 0, '', t))
|
|
1992
|
-
},
|
|
1993
|
-
We = (a, e) => {
|
|
1994
|
-
if (e.length === 0 || a == null) return a
|
|
1995
|
-
for (const t of a.keys())
|
|
1996
|
-
if (t !== D && e.startsWith(t)) return We(a.get(t), e.slice(t.length))
|
|
1997
|
-
},
|
|
1998
|
-
De = (a, e) => {
|
|
1999
|
-
const t = e.length
|
|
2000
|
-
e: for (let s = 0; a && s < t; ) {
|
|
2001
|
-
for (const r of a.keys())
|
|
2002
|
-
if (r !== D && e[s] === r[0]) {
|
|
2003
|
-
const i = Math.min(t - s, r.length)
|
|
2004
|
-
let o = 1
|
|
2005
|
-
for (; o < i && e[s + o] === r[o]; ) ++o
|
|
2006
|
-
const l = a.get(r)
|
|
2007
|
-
if (o === r.length) a = l
|
|
2008
|
-
else {
|
|
2009
|
-
const c = new Map()
|
|
2010
|
-
;(c.set(r.slice(o), l),
|
|
2011
|
-
a.set(e.slice(s, s + o), c),
|
|
2012
|
-
a.delete(r),
|
|
2013
|
-
(a = c))
|
|
2014
|
-
}
|
|
2015
|
-
s += o
|
|
2016
|
-
continue e
|
|
2017
|
-
}
|
|
2018
|
-
const n = new Map()
|
|
2019
|
-
return (a.set(e.slice(s), n), n)
|
|
2020
|
-
}
|
|
2021
|
-
return a
|
|
2022
|
-
},
|
|
2023
|
-
js = (a, e) => {
|
|
2024
|
-
const [t, s] = Re(a, e)
|
|
2025
|
-
if (t !== void 0) {
|
|
2026
|
-
if ((t.delete(D), t.size === 0)) Et(s)
|
|
2027
|
-
else if (t.size === 1) {
|
|
2028
|
-
const [n, r] = t.entries().next().value
|
|
2029
|
-
Tt(s, n, r)
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
},
|
|
2033
|
-
Et = (a) => {
|
|
2034
|
-
if (a.length === 0) return
|
|
2035
|
-
const [e, t] = qe(a)
|
|
2036
|
-
if ((e.delete(t), e.size === 0)) Et(a.slice(0, -1))
|
|
2037
|
-
else if (e.size === 1) {
|
|
2038
|
-
const [s, n] = e.entries().next().value
|
|
2039
|
-
s !== D && Tt(a.slice(0, -1), s, n)
|
|
2040
|
-
}
|
|
2041
|
-
},
|
|
2042
|
-
Tt = (a, e, t) => {
|
|
2043
|
-
if (a.length === 0) return
|
|
2044
|
-
const [s, n] = qe(a)
|
|
2045
|
-
;(s.set(n + e, t), s.delete(n))
|
|
2046
|
-
},
|
|
2047
|
-
qe = (a) => a[a.length - 1],
|
|
2048
|
-
Ue = 'or',
|
|
2049
|
-
It = 'and',
|
|
2050
|
-
Bs = 'and_not'
|
|
2051
|
-
class ue {
|
|
2052
|
-
constructor(e) {
|
|
2053
|
-
if ((e == null ? void 0 : e.fields) == null)
|
|
2054
|
-
throw new Error('MiniSearch: option "fields" must be provided')
|
|
2055
|
-
const t = e.autoVacuum == null || e.autoVacuum === !0 ? Ve : e.autoVacuum
|
|
2056
|
-
;((this._options = {
|
|
2057
|
-
...ze,
|
|
2058
|
-
...e,
|
|
2059
|
-
autoVacuum: t,
|
|
2060
|
-
searchOptions: { ...dt, ...(e.searchOptions || {}) },
|
|
2061
|
-
autoSuggestOptions: { ...Us, ...(e.autoSuggestOptions || {}) },
|
|
2062
|
-
}),
|
|
2063
|
-
(this._index = new X()),
|
|
2064
|
-
(this._documentCount = 0),
|
|
2065
|
-
(this._documentIds = new Map()),
|
|
2066
|
-
(this._idToShortId = new Map()),
|
|
2067
|
-
(this._fieldIds = {}),
|
|
2068
|
-
(this._fieldLength = new Map()),
|
|
2069
|
-
(this._avgFieldLength = []),
|
|
2070
|
-
(this._nextId = 0),
|
|
2071
|
-
(this._storedFields = new Map()),
|
|
2072
|
-
(this._dirtCount = 0),
|
|
2073
|
-
(this._currentVacuum = null),
|
|
2074
|
-
(this._enqueuedVacuum = null),
|
|
2075
|
-
(this._enqueuedVacuumConditions = Je),
|
|
2076
|
-
this.addFields(this._options.fields))
|
|
2077
|
-
}
|
|
2078
|
-
add(e) {
|
|
2079
|
-
const {
|
|
2080
|
-
extractField: t,
|
|
2081
|
-
tokenize: s,
|
|
2082
|
-
processTerm: n,
|
|
2083
|
-
fields: r,
|
|
2084
|
-
idField: i,
|
|
2085
|
-
} = this._options,
|
|
2086
|
-
o = t(e, i)
|
|
2087
|
-
if (o == null)
|
|
2088
|
-
throw new Error(`MiniSearch: document does not have ID field "${i}"`)
|
|
2089
|
-
if (this._idToShortId.has(o))
|
|
2090
|
-
throw new Error(`MiniSearch: duplicate ID ${o}`)
|
|
2091
|
-
const l = this.addDocumentId(o)
|
|
2092
|
-
this.saveStoredFields(l, e)
|
|
2093
|
-
for (const c of r) {
|
|
2094
|
-
const h = t(e, c)
|
|
2095
|
-
if (h == null) continue
|
|
2096
|
-
const m = s(h.toString(), c),
|
|
2097
|
-
f = this._fieldIds[c],
|
|
2098
|
-
b = new Set(m).size
|
|
2099
|
-
this.addFieldLength(l, f, this._documentCount - 1, b)
|
|
2100
|
-
for (const y of m) {
|
|
2101
|
-
const x = n(y, c)
|
|
2102
|
-
if (Array.isArray(x)) for (const w of x) this.addTerm(f, l, w)
|
|
2103
|
-
else x && this.addTerm(f, l, x)
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
addAll(e) {
|
|
2108
|
-
for (const t of e) this.add(t)
|
|
2109
|
-
}
|
|
2110
|
-
addAllAsync(e, t = {}) {
|
|
2111
|
-
const { chunkSize: s = 10 } = t,
|
|
2112
|
-
n = { chunk: [], promise: Promise.resolve() },
|
|
2113
|
-
{ chunk: r, promise: i } = e.reduce(
|
|
2114
|
-
({ chunk: o, promise: l }, c, h) => (
|
|
2115
|
-
o.push(c),
|
|
2116
|
-
(h + 1) % s === 0
|
|
2117
|
-
? {
|
|
2118
|
-
chunk: [],
|
|
2119
|
-
promise: l
|
|
2120
|
-
.then(() => new Promise((m) => setTimeout(m, 0)))
|
|
2121
|
-
.then(() => this.addAll(o)),
|
|
2122
|
-
}
|
|
2123
|
-
: { chunk: o, promise: l }
|
|
2124
|
-
),
|
|
2125
|
-
n,
|
|
2126
|
-
)
|
|
2127
|
-
return i.then(() => this.addAll(r))
|
|
2128
|
-
}
|
|
2129
|
-
remove(e) {
|
|
2130
|
-
const {
|
|
2131
|
-
tokenize: t,
|
|
2132
|
-
processTerm: s,
|
|
2133
|
-
extractField: n,
|
|
2134
|
-
fields: r,
|
|
2135
|
-
idField: i,
|
|
2136
|
-
} = this._options,
|
|
2137
|
-
o = n(e, i)
|
|
2138
|
-
if (o == null)
|
|
2139
|
-
throw new Error(`MiniSearch: document does not have ID field "${i}"`)
|
|
2140
|
-
const l = this._idToShortId.get(o)
|
|
2141
|
-
if (l == null)
|
|
2142
|
-
throw new Error(
|
|
2143
|
-
`MiniSearch: cannot remove document with ID ${o}: it is not in the index`,
|
|
2144
|
-
)
|
|
2145
|
-
for (const c of r) {
|
|
2146
|
-
const h = n(e, c)
|
|
2147
|
-
if (h == null) continue
|
|
2148
|
-
const m = t(h.toString(), c),
|
|
2149
|
-
f = this._fieldIds[c],
|
|
2150
|
-
b = new Set(m).size
|
|
2151
|
-
this.removeFieldLength(l, f, this._documentCount, b)
|
|
2152
|
-
for (const y of m) {
|
|
2153
|
-
const x = s(y, c)
|
|
2154
|
-
if (Array.isArray(x)) for (const w of x) this.removeTerm(f, l, w)
|
|
2155
|
-
else x && this.removeTerm(f, l, x)
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
;(this._storedFields.delete(l),
|
|
2159
|
-
this._documentIds.delete(l),
|
|
2160
|
-
this._idToShortId.delete(o),
|
|
2161
|
-
this._fieldLength.delete(l),
|
|
2162
|
-
(this._documentCount -= 1))
|
|
2163
|
-
}
|
|
2164
|
-
removeAll(e) {
|
|
2165
|
-
if (e) for (const t of e) this.remove(t)
|
|
2166
|
-
else {
|
|
2167
|
-
if (arguments.length > 0)
|
|
2168
|
-
throw new Error(
|
|
2169
|
-
'Expected documents to be present. Omit the argument to remove all documents.',
|
|
2170
|
-
)
|
|
2171
|
-
;((this._index = new X()),
|
|
2172
|
-
(this._documentCount = 0),
|
|
2173
|
-
(this._documentIds = new Map()),
|
|
2174
|
-
(this._idToShortId = new Map()),
|
|
2175
|
-
(this._fieldLength = new Map()),
|
|
2176
|
-
(this._avgFieldLength = []),
|
|
2177
|
-
(this._storedFields = new Map()),
|
|
2178
|
-
(this._nextId = 0))
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
discard(e) {
|
|
2182
|
-
const t = this._idToShortId.get(e)
|
|
2183
|
-
if (t == null)
|
|
2184
|
-
throw new Error(
|
|
2185
|
-
`MiniSearch: cannot discard document with ID ${e}: it is not in the index`,
|
|
2186
|
-
)
|
|
2187
|
-
;(this._idToShortId.delete(e),
|
|
2188
|
-
this._documentIds.delete(t),
|
|
2189
|
-
this._storedFields.delete(t),
|
|
2190
|
-
(this._fieldLength.get(t) || []).forEach((s, n) => {
|
|
2191
|
-
this.removeFieldLength(t, n, this._documentCount, s)
|
|
2192
|
-
}),
|
|
2193
|
-
this._fieldLength.delete(t),
|
|
2194
|
-
(this._documentCount -= 1),
|
|
2195
|
-
(this._dirtCount += 1),
|
|
2196
|
-
this.maybeAutoVacuum())
|
|
2197
|
-
}
|
|
2198
|
-
maybeAutoVacuum() {
|
|
2199
|
-
if (this._options.autoVacuum === !1) return
|
|
2200
|
-
const {
|
|
2201
|
-
minDirtFactor: e,
|
|
2202
|
-
minDirtCount: t,
|
|
2203
|
-
batchSize: s,
|
|
2204
|
-
batchWait: n,
|
|
2205
|
-
} = this._options.autoVacuum
|
|
2206
|
-
this.conditionalVacuum(
|
|
2207
|
-
{ batchSize: s, batchWait: n },
|
|
2208
|
-
{ minDirtCount: t, minDirtFactor: e },
|
|
2209
|
-
)
|
|
2210
|
-
}
|
|
2211
|
-
discardAll(e) {
|
|
2212
|
-
const t = this._options.autoVacuum
|
|
2213
|
-
try {
|
|
2214
|
-
this._options.autoVacuum = !1
|
|
2215
|
-
for (const s of e) this.discard(s)
|
|
2216
|
-
} finally {
|
|
2217
|
-
this._options.autoVacuum = t
|
|
2218
|
-
}
|
|
2219
|
-
this.maybeAutoVacuum()
|
|
2220
|
-
}
|
|
2221
|
-
replace(e) {
|
|
2222
|
-
const { idField: t, extractField: s } = this._options,
|
|
2223
|
-
n = s(e, t)
|
|
2224
|
-
;(this.discard(n), this.add(e))
|
|
2225
|
-
}
|
|
2226
|
-
vacuum(e = {}) {
|
|
2227
|
-
return this.conditionalVacuum(e)
|
|
2228
|
-
}
|
|
2229
|
-
conditionalVacuum(e, t) {
|
|
2230
|
-
return this._currentVacuum
|
|
2231
|
-
? ((this._enqueuedVacuumConditions = this._enqueuedVacuumConditions && t),
|
|
2232
|
-
this._enqueuedVacuum != null
|
|
2233
|
-
? this._enqueuedVacuum
|
|
2234
|
-
: ((this._enqueuedVacuum = this._currentVacuum.then(() => {
|
|
2235
|
-
const s = this._enqueuedVacuumConditions
|
|
2236
|
-
return (
|
|
2237
|
-
(this._enqueuedVacuumConditions = Je),
|
|
2238
|
-
this.performVacuuming(e, s)
|
|
2239
|
-
)
|
|
2240
|
-
})),
|
|
2241
|
-
this._enqueuedVacuum))
|
|
2242
|
-
: this.vacuumConditionsMet(t) === !1
|
|
2243
|
-
? Promise.resolve()
|
|
2244
|
-
: ((this._currentVacuum = this.performVacuuming(e)),
|
|
2245
|
-
this._currentVacuum)
|
|
2246
|
-
}
|
|
2247
|
-
async performVacuuming(e, t) {
|
|
2248
|
-
const s = this._dirtCount
|
|
2249
|
-
if (this.vacuumConditionsMet(t)) {
|
|
2250
|
-
const n = e.batchSize || Ke.batchSize,
|
|
2251
|
-
r = e.batchWait || Ke.batchWait
|
|
2252
|
-
let i = 1
|
|
2253
|
-
for (const [o, l] of this._index) {
|
|
2254
|
-
for (const [c, h] of l)
|
|
2255
|
-
for (const [m] of h)
|
|
2256
|
-
this._documentIds.has(m) ||
|
|
2257
|
-
(h.size <= 1 ? l.delete(c) : h.delete(m))
|
|
2258
|
-
;(this._index.get(o).size === 0 && this._index.delete(o),
|
|
2259
|
-
i % n === 0 && (await new Promise((c) => setTimeout(c, r))),
|
|
2260
|
-
(i += 1))
|
|
2261
|
-
}
|
|
2262
|
-
this._dirtCount -= s
|
|
2263
|
-
}
|
|
2264
|
-
;(await null,
|
|
2265
|
-
(this._currentVacuum = this._enqueuedVacuum),
|
|
2266
|
-
(this._enqueuedVacuum = null))
|
|
2267
|
-
}
|
|
2268
|
-
vacuumConditionsMet(e) {
|
|
2269
|
-
if (e == null) return !0
|
|
2270
|
-
let { minDirtCount: t, minDirtFactor: s } = e
|
|
2271
|
-
return (
|
|
2272
|
-
(t = t || Ve.minDirtCount),
|
|
2273
|
-
(s = s || Ve.minDirtFactor),
|
|
2274
|
-
this.dirtCount >= t && this.dirtFactor >= s
|
|
2275
|
-
)
|
|
2276
|
-
}
|
|
2277
|
-
get isVacuuming() {
|
|
2278
|
-
return this._currentVacuum != null
|
|
2279
|
-
}
|
|
2280
|
-
get dirtCount() {
|
|
2281
|
-
return this._dirtCount
|
|
2282
|
-
}
|
|
2283
|
-
get dirtFactor() {
|
|
2284
|
-
return this._dirtCount / (1 + this._documentCount + this._dirtCount)
|
|
2285
|
-
}
|
|
2286
|
-
has(e) {
|
|
2287
|
-
return this._idToShortId.has(e)
|
|
2288
|
-
}
|
|
2289
|
-
getStoredFields(e) {
|
|
2290
|
-
const t = this._idToShortId.get(e)
|
|
2291
|
-
if (t != null) return this._storedFields.get(t)
|
|
2292
|
-
}
|
|
2293
|
-
search(e, t = {}) {
|
|
2294
|
-
const { searchOptions: s } = this._options,
|
|
2295
|
-
n = { ...s, ...t },
|
|
2296
|
-
r = this.executeQuery(e, t),
|
|
2297
|
-
i = []
|
|
2298
|
-
for (const [o, { score: l, terms: c, match: h }] of r) {
|
|
2299
|
-
const m = c.length || 1,
|
|
2300
|
-
f = {
|
|
2301
|
-
id: this._documentIds.get(o),
|
|
2302
|
-
score: l * m,
|
|
2303
|
-
terms: Object.keys(h),
|
|
2304
|
-
queryTerms: c,
|
|
2305
|
-
match: h,
|
|
2306
|
-
}
|
|
2307
|
-
;(Object.assign(f, this._storedFields.get(o)),
|
|
2308
|
-
(n.filter == null || n.filter(f)) && i.push(f))
|
|
2309
|
-
}
|
|
2310
|
-
return ((e === ue.wildcard && n.boostDocument == null) || i.sort(ft), i)
|
|
2311
|
-
}
|
|
2312
|
-
autoSuggest(e, t = {}) {
|
|
2313
|
-
t = { ...this._options.autoSuggestOptions, ...t }
|
|
2314
|
-
const s = new Map()
|
|
2315
|
-
for (const { score: r, terms: i } of this.search(e, t)) {
|
|
2316
|
-
const o = i.join(' '),
|
|
2317
|
-
l = s.get(o)
|
|
2318
|
-
l != null
|
|
2319
|
-
? ((l.score += r), (l.count += 1))
|
|
2320
|
-
: s.set(o, { score: r, terms: i, count: 1 })
|
|
2321
|
-
}
|
|
2322
|
-
const n = []
|
|
2323
|
-
for (const [r, { score: i, terms: o, count: l }] of s)
|
|
2324
|
-
n.push({ suggestion: r, terms: o, score: i / l })
|
|
2325
|
-
return (n.sort(ft), n)
|
|
2326
|
-
}
|
|
2327
|
-
get documentCount() {
|
|
2328
|
-
return this._documentCount
|
|
2329
|
-
}
|
|
2330
|
-
get termCount() {
|
|
2331
|
-
return this._index.size
|
|
2332
|
-
}
|
|
2333
|
-
static loadJSON(e, t) {
|
|
2334
|
-
if (t == null)
|
|
2335
|
-
throw new Error(
|
|
2336
|
-
'MiniSearch: loadJSON should be given the same options used when serializing the index',
|
|
2337
|
-
)
|
|
2338
|
-
return this.loadJS(JSON.parse(e), t)
|
|
2339
|
-
}
|
|
2340
|
-
static async loadJSONAsync(e, t) {
|
|
2341
|
-
if (t == null)
|
|
2342
|
-
throw new Error(
|
|
2343
|
-
'MiniSearch: loadJSON should be given the same options used when serializing the index',
|
|
2344
|
-
)
|
|
2345
|
-
return this.loadJSAsync(JSON.parse(e), t)
|
|
2346
|
-
}
|
|
2347
|
-
static getDefault(e) {
|
|
2348
|
-
if (ze.hasOwnProperty(e)) return Pe(ze, e)
|
|
2349
|
-
throw new Error(`MiniSearch: unknown option "${e}"`)
|
|
2350
|
-
}
|
|
2351
|
-
static loadJS(e, t) {
|
|
2352
|
-
const {
|
|
2353
|
-
index: s,
|
|
2354
|
-
documentIds: n,
|
|
2355
|
-
fieldLength: r,
|
|
2356
|
-
storedFields: i,
|
|
2357
|
-
serializationVersion: o,
|
|
2358
|
-
} = e,
|
|
2359
|
-
l = this.instantiateMiniSearch(e, t)
|
|
2360
|
-
;((l._documentIds = Te(n)),
|
|
2361
|
-
(l._fieldLength = Te(r)),
|
|
2362
|
-
(l._storedFields = Te(i)))
|
|
2363
|
-
for (const [c, h] of l._documentIds) l._idToShortId.set(h, c)
|
|
2364
|
-
for (const [c, h] of s) {
|
|
2365
|
-
const m = new Map()
|
|
2366
|
-
for (const f of Object.keys(h)) {
|
|
2367
|
-
let b = h[f]
|
|
2368
|
-
;(o === 1 && (b = b.ds), m.set(parseInt(f, 10), Te(b)))
|
|
2369
|
-
}
|
|
2370
|
-
l._index.set(c, m)
|
|
2371
|
-
}
|
|
2372
|
-
return l
|
|
2373
|
-
}
|
|
2374
|
-
static async loadJSAsync(e, t) {
|
|
2375
|
-
const {
|
|
2376
|
-
index: s,
|
|
2377
|
-
documentIds: n,
|
|
2378
|
-
fieldLength: r,
|
|
2379
|
-
storedFields: i,
|
|
2380
|
-
serializationVersion: o,
|
|
2381
|
-
} = e,
|
|
2382
|
-
l = this.instantiateMiniSearch(e, t)
|
|
2383
|
-
;((l._documentIds = await Ie(n)),
|
|
2384
|
-
(l._fieldLength = await Ie(r)),
|
|
2385
|
-
(l._storedFields = await Ie(i)))
|
|
2386
|
-
for (const [h, m] of l._documentIds) l._idToShortId.set(m, h)
|
|
2387
|
-
let c = 0
|
|
2388
|
-
for (const [h, m] of s) {
|
|
2389
|
-
const f = new Map()
|
|
2390
|
-
for (const b of Object.keys(m)) {
|
|
2391
|
-
let y = m[b]
|
|
2392
|
-
;(o === 1 && (y = y.ds), f.set(parseInt(b, 10), await Ie(y)))
|
|
2393
|
-
}
|
|
2394
|
-
;(++c % 1e3 === 0 && (await kt(0)), l._index.set(h, f))
|
|
2395
|
-
}
|
|
2396
|
-
return l
|
|
2397
|
-
}
|
|
2398
|
-
static instantiateMiniSearch(e, t) {
|
|
2399
|
-
const {
|
|
2400
|
-
documentCount: s,
|
|
2401
|
-
nextId: n,
|
|
2402
|
-
fieldIds: r,
|
|
2403
|
-
averageFieldLength: i,
|
|
2404
|
-
dirtCount: o,
|
|
2405
|
-
serializationVersion: l,
|
|
2406
|
-
} = e
|
|
2407
|
-
if (l !== 1 && l !== 2)
|
|
2408
|
-
throw new Error(
|
|
2409
|
-
'MiniSearch: cannot deserialize an index created with an incompatible version',
|
|
2410
|
-
)
|
|
2411
|
-
const c = new ue(t)
|
|
2412
|
-
return (
|
|
2413
|
-
(c._documentCount = s),
|
|
2414
|
-
(c._nextId = n),
|
|
2415
|
-
(c._idToShortId = new Map()),
|
|
2416
|
-
(c._fieldIds = r),
|
|
2417
|
-
(c._avgFieldLength = i),
|
|
2418
|
-
(c._dirtCount = o || 0),
|
|
2419
|
-
(c._index = new X()),
|
|
2420
|
-
c
|
|
2421
|
-
)
|
|
2422
|
-
}
|
|
2423
|
-
executeQuery(e, t = {}) {
|
|
2424
|
-
if (e === ue.wildcard) return this.executeWildcardQuery(t)
|
|
2425
|
-
if (typeof e != 'string') {
|
|
2426
|
-
const f = { ...t, ...e, queries: void 0 },
|
|
2427
|
-
b = e.queries.map((y) => this.executeQuery(y, f))
|
|
2428
|
-
return this.combineResults(b, f.combineWith)
|
|
2429
|
-
}
|
|
2430
|
-
const { tokenize: s, processTerm: n, searchOptions: r } = this._options,
|
|
2431
|
-
i = { tokenize: s, processTerm: n, ...r, ...t },
|
|
2432
|
-
{ tokenize: o, processTerm: l } = i,
|
|
2433
|
-
m = o(e)
|
|
2434
|
-
.flatMap((f) => l(f))
|
|
2435
|
-
.filter((f) => !!f)
|
|
2436
|
-
.map(qs(i))
|
|
2437
|
-
.map((f) => this.executeQuerySpec(f, i))
|
|
2438
|
-
return this.combineResults(m, i.combineWith)
|
|
2439
|
-
}
|
|
2440
|
-
executeQuerySpec(e, t) {
|
|
2441
|
-
const s = { ...this._options.searchOptions, ...t },
|
|
2442
|
-
n = (s.fields || this._options.fields).reduce(
|
|
2443
|
-
(x, w) => ({ ...x, [w]: Pe(s.boost, w) || 1 }),
|
|
2444
|
-
{},
|
|
2445
|
-
),
|
|
2446
|
-
{ boostDocument: r, weights: i, maxFuzzy: o, bm25: l } = s,
|
|
2447
|
-
{ fuzzy: c, prefix: h } = { ...dt.weights, ...i },
|
|
2448
|
-
m = this._index.get(e.term),
|
|
2449
|
-
f = this.termResults(e.term, e.term, 1, e.termBoost, m, n, r, l)
|
|
2450
|
-
let b, y
|
|
2451
|
-
if ((e.prefix && (b = this._index.atPrefix(e.term)), e.fuzzy)) {
|
|
2452
|
-
const x = e.fuzzy === !0 ? 0.2 : e.fuzzy,
|
|
2453
|
-
w = x < 1 ? Math.min(o, Math.round(e.term.length * x)) : x
|
|
2454
|
-
w && (y = this._index.fuzzyGet(e.term, w))
|
|
2455
|
-
}
|
|
2456
|
-
if (b)
|
|
2457
|
-
for (const [x, w] of b) {
|
|
2458
|
-
const C = x.length - e.term.length
|
|
2459
|
-
if (!C) continue
|
|
2460
|
-
y == null || y.delete(x)
|
|
2461
|
-
const A = (h * x.length) / (x.length + 0.3 * C)
|
|
2462
|
-
this.termResults(e.term, x, A, e.termBoost, w, n, r, l, f)
|
|
2463
|
-
}
|
|
2464
|
-
if (y)
|
|
2465
|
-
for (const x of y.keys()) {
|
|
2466
|
-
const [w, C] = y.get(x)
|
|
2467
|
-
if (!C) continue
|
|
2468
|
-
const A = (c * x.length) / (x.length + C)
|
|
2469
|
-
this.termResults(e.term, x, A, e.termBoost, w, n, r, l, f)
|
|
2470
|
-
}
|
|
2471
|
-
return f
|
|
2472
|
-
}
|
|
2473
|
-
executeWildcardQuery(e) {
|
|
2474
|
-
const t = new Map(),
|
|
2475
|
-
s = { ...this._options.searchOptions, ...e }
|
|
2476
|
-
for (const [n, r] of this._documentIds) {
|
|
2477
|
-
const i = s.boostDocument
|
|
2478
|
-
? s.boostDocument(r, '', this._storedFields.get(n))
|
|
2479
|
-
: 1
|
|
2480
|
-
t.set(n, { score: i, terms: [], match: {} })
|
|
2481
|
-
}
|
|
2482
|
-
return t
|
|
2483
|
-
}
|
|
2484
|
-
combineResults(e, t = Ue) {
|
|
2485
|
-
if (e.length === 0) return new Map()
|
|
2486
|
-
const s = t.toLowerCase(),
|
|
2487
|
-
n = Ws[s]
|
|
2488
|
-
if (!n) throw new Error(`Invalid combination operator: ${t}`)
|
|
2489
|
-
return e.reduce(n) || new Map()
|
|
2490
|
-
}
|
|
2491
|
-
toJSON() {
|
|
2492
|
-
const e = []
|
|
2493
|
-
for (const [t, s] of this._index) {
|
|
2494
|
-
const n = {}
|
|
2495
|
-
for (const [r, i] of s) n[r] = Object.fromEntries(i)
|
|
2496
|
-
e.push([t, n])
|
|
2497
|
-
}
|
|
2498
|
-
return {
|
|
2499
|
-
documentCount: this._documentCount,
|
|
2500
|
-
nextId: this._nextId,
|
|
2501
|
-
documentIds: Object.fromEntries(this._documentIds),
|
|
2502
|
-
fieldIds: this._fieldIds,
|
|
2503
|
-
fieldLength: Object.fromEntries(this._fieldLength),
|
|
2504
|
-
averageFieldLength: this._avgFieldLength,
|
|
2505
|
-
storedFields: Object.fromEntries(this._storedFields),
|
|
2506
|
-
dirtCount: this._dirtCount,
|
|
2507
|
-
index: e,
|
|
2508
|
-
serializationVersion: 2,
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
termResults(e, t, s, n, r, i, o, l, c = new Map()) {
|
|
2512
|
-
if (r == null) return c
|
|
2513
|
-
for (const h of Object.keys(i)) {
|
|
2514
|
-
const m = i[h],
|
|
2515
|
-
f = this._fieldIds[h],
|
|
2516
|
-
b = r.get(f)
|
|
2517
|
-
if (b == null) continue
|
|
2518
|
-
let y = b.size
|
|
2519
|
-
const x = this._avgFieldLength[f]
|
|
2520
|
-
for (const w of b.keys()) {
|
|
2521
|
-
if (!this._documentIds.has(w)) {
|
|
2522
|
-
;(this.removeTerm(f, w, t), (y -= 1))
|
|
2523
|
-
continue
|
|
2524
|
-
}
|
|
2525
|
-
const C = o
|
|
2526
|
-
? o(this._documentIds.get(w), t, this._storedFields.get(w))
|
|
2527
|
-
: 1
|
|
2528
|
-
if (!C) continue
|
|
2529
|
-
const A = b.get(w),
|
|
2530
|
-
J = this._fieldLength.get(w)[f],
|
|
2531
|
-
Q = Js(A, y, this._documentCount, J, x, l),
|
|
2532
|
-
W = s * n * m * C * Q,
|
|
2533
|
-
$ = c.get(w)
|
|
2534
|
-
if ($) {
|
|
2535
|
-
;(($.score += W), Gs($.terms, e))
|
|
2536
|
-
const j = Pe($.match, t)
|
|
2537
|
-
j ? j.push(h) : ($.match[t] = [h])
|
|
2538
|
-
} else c.set(w, { score: W, terms: [e], match: { [t]: [h] } })
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
return c
|
|
2542
|
-
}
|
|
2543
|
-
addTerm(e, t, s) {
|
|
2544
|
-
const n = this._index.fetch(s, pt)
|
|
2545
|
-
let r = n.get(e)
|
|
2546
|
-
if (r == null) ((r = new Map()), r.set(t, 1), n.set(e, r))
|
|
2547
|
-
else {
|
|
2548
|
-
const i = r.get(t)
|
|
2549
|
-
r.set(t, (i || 0) + 1)
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
|
-
removeTerm(e, t, s) {
|
|
2553
|
-
if (!this._index.has(s)) {
|
|
2554
|
-
this.warnDocumentChanged(t, e, s)
|
|
2555
|
-
return
|
|
2556
|
-
}
|
|
2557
|
-
const n = this._index.fetch(s, pt),
|
|
2558
|
-
r = n.get(e)
|
|
2559
|
-
;(r == null || r.get(t) == null
|
|
2560
|
-
? this.warnDocumentChanged(t, e, s)
|
|
2561
|
-
: r.get(t) <= 1
|
|
2562
|
-
? r.size <= 1
|
|
2563
|
-
? n.delete(e)
|
|
2564
|
-
: r.delete(t)
|
|
2565
|
-
: r.set(t, r.get(t) - 1),
|
|
2566
|
-
this._index.get(s).size === 0 && this._index.delete(s))
|
|
2567
|
-
}
|
|
2568
|
-
warnDocumentChanged(e, t, s) {
|
|
2569
|
-
for (const n of Object.keys(this._fieldIds))
|
|
2570
|
-
if (this._fieldIds[n] === t) {
|
|
2571
|
-
this._options.logger(
|
|
2572
|
-
'warn',
|
|
2573
|
-
`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${s}" was not present in field "${n}". Removing a document after it has changed can corrupt the index!`,
|
|
2574
|
-
'version_conflict',
|
|
2575
|
-
)
|
|
2576
|
-
return
|
|
2577
|
-
}
|
|
2578
|
-
}
|
|
2579
|
-
addDocumentId(e) {
|
|
2580
|
-
const t = this._nextId
|
|
2581
|
-
return (
|
|
2582
|
-
this._idToShortId.set(e, t),
|
|
2583
|
-
this._documentIds.set(t, e),
|
|
2584
|
-
(this._documentCount += 1),
|
|
2585
|
-
(this._nextId += 1),
|
|
2586
|
-
t
|
|
2587
|
-
)
|
|
2588
|
-
}
|
|
2589
|
-
addFields(e) {
|
|
2590
|
-
for (let t = 0; t < e.length; t++) this._fieldIds[e[t]] = t
|
|
2591
|
-
}
|
|
2592
|
-
addFieldLength(e, t, s, n) {
|
|
2593
|
-
let r = this._fieldLength.get(e)
|
|
2594
|
-
;(r == null && this._fieldLength.set(e, (r = [])), (r[t] = n))
|
|
2595
|
-
const o = (this._avgFieldLength[t] || 0) * s + n
|
|
2596
|
-
this._avgFieldLength[t] = o / (s + 1)
|
|
2597
|
-
}
|
|
2598
|
-
removeFieldLength(e, t, s, n) {
|
|
2599
|
-
if (s === 1) {
|
|
2600
|
-
this._avgFieldLength[t] = 0
|
|
2601
|
-
return
|
|
2602
|
-
}
|
|
2603
|
-
const r = this._avgFieldLength[t] * s - n
|
|
2604
|
-
this._avgFieldLength[t] = r / (s - 1)
|
|
2605
|
-
}
|
|
2606
|
-
saveStoredFields(e, t) {
|
|
2607
|
-
const { storeFields: s, extractField: n } = this._options
|
|
2608
|
-
if (s == null || s.length === 0) return
|
|
2609
|
-
let r = this._storedFields.get(e)
|
|
2610
|
-
r == null && this._storedFields.set(e, (r = {}))
|
|
2611
|
-
for (const i of s) {
|
|
2612
|
-
const o = n(t, i)
|
|
2613
|
-
o !== void 0 && (r[i] = o)
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
ue.wildcard = Symbol('*')
|
|
2618
|
-
const Pe = (a, e) =>
|
|
2619
|
-
Object.prototype.hasOwnProperty.call(a, e) ? a[e] : void 0,
|
|
2620
|
-
Ws = {
|
|
2621
|
-
[Ue]: (a, e) => {
|
|
2622
|
-
for (const t of e.keys()) {
|
|
2623
|
-
const s = a.get(t)
|
|
2624
|
-
if (s == null) a.set(t, e.get(t))
|
|
2625
|
-
else {
|
|
2626
|
-
const { score: n, terms: r, match: i } = e.get(t)
|
|
2627
|
-
;((s.score = s.score + n),
|
|
2628
|
-
(s.match = Object.assign(s.match, i)),
|
|
2629
|
-
ht(s.terms, r))
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
return a
|
|
2633
|
-
},
|
|
2634
|
-
[It]: (a, e) => {
|
|
2635
|
-
const t = new Map()
|
|
2636
|
-
for (const s of e.keys()) {
|
|
2637
|
-
const n = a.get(s)
|
|
2638
|
-
if (n == null) continue
|
|
2639
|
-
const { score: r, terms: i, match: o } = e.get(s)
|
|
2640
|
-
;(ht(n.terms, i),
|
|
2641
|
-
t.set(s, {
|
|
2642
|
-
score: n.score + r,
|
|
2643
|
-
terms: n.terms,
|
|
2644
|
-
match: Object.assign(n.match, o),
|
|
2645
|
-
}))
|
|
2646
|
-
}
|
|
2647
|
-
return t
|
|
2648
|
-
},
|
|
2649
|
-
[Bs]: (a, e) => {
|
|
2650
|
-
for (const t of e.keys()) a.delete(t)
|
|
2651
|
-
return a
|
|
2652
|
-
},
|
|
2653
|
-
},
|
|
2654
|
-
Ks = { k: 1.2, b: 0.7, d: 0.5 },
|
|
2655
|
-
Js = (a, e, t, s, n, r) => {
|
|
2656
|
-
const { k: i, b: o, d: l } = r
|
|
2657
|
-
return (
|
|
2658
|
-
Math.log(1 + (t - e + 0.5) / (e + 0.5)) *
|
|
2659
|
-
(l + (a * (i + 1)) / (a + i * (1 - o + (o * s) / n)))
|
|
2660
|
-
)
|
|
2661
|
-
},
|
|
2662
|
-
qs = (a) => (e, t, s) => {
|
|
2663
|
-
const n = typeof a.fuzzy == 'function' ? a.fuzzy(e, t, s) : a.fuzzy || !1,
|
|
2664
|
-
r = typeof a.prefix == 'function' ? a.prefix(e, t, s) : a.prefix === !0,
|
|
2665
|
-
i = typeof a.boostTerm == 'function' ? a.boostTerm(e, t, s) : 1
|
|
2666
|
-
return { term: e, fuzzy: n, prefix: r, termBoost: i }
|
|
2667
|
-
},
|
|
2668
|
-
ze = {
|
|
2669
|
-
idField: 'id',
|
|
2670
|
-
extractField: (a, e) => a[e],
|
|
2671
|
-
tokenize: (a) => a.split(Hs),
|
|
2672
|
-
processTerm: (a) => a.toLowerCase(),
|
|
2673
|
-
fields: void 0,
|
|
2674
|
-
searchOptions: void 0,
|
|
2675
|
-
storeFields: [],
|
|
2676
|
-
logger: (a, e) => {
|
|
2677
|
-
typeof (console == null ? void 0 : console[a]) == 'function' &&
|
|
2678
|
-
console[a](e)
|
|
2679
|
-
},
|
|
2680
|
-
autoVacuum: !0,
|
|
2681
|
-
},
|
|
2682
|
-
dt = {
|
|
2683
|
-
combineWith: Ue,
|
|
2684
|
-
prefix: !1,
|
|
2685
|
-
fuzzy: !1,
|
|
2686
|
-
maxFuzzy: 6,
|
|
2687
|
-
boost: {},
|
|
2688
|
-
weights: { fuzzy: 0.45, prefix: 0.375 },
|
|
2689
|
-
bm25: Ks,
|
|
2690
|
-
},
|
|
2691
|
-
Us = { combineWith: It, prefix: (a, e, t) => e === t.length - 1 },
|
|
2692
|
-
Ke = { batchSize: 1e3, batchWait: 10 },
|
|
2693
|
-
Je = { minDirtFactor: 0.1, minDirtCount: 20 },
|
|
2694
|
-
Ve = { ...Ke, ...Je },
|
|
2695
|
-
Gs = (a, e) => {
|
|
2696
|
-
a.includes(e) || a.push(e)
|
|
2697
|
-
},
|
|
2698
|
-
ht = (a, e) => {
|
|
2699
|
-
for (const t of e) a.includes(t) || a.push(t)
|
|
2700
|
-
},
|
|
2701
|
-
ft = ({ score: a }, { score: e }) => e - a,
|
|
2702
|
-
pt = () => new Map(),
|
|
2703
|
-
Te = (a) => {
|
|
2704
|
-
const e = new Map()
|
|
2705
|
-
for (const t of Object.keys(a)) e.set(parseInt(t, 10), a[t])
|
|
2706
|
-
return e
|
|
2707
|
-
},
|
|
2708
|
-
Ie = async (a) => {
|
|
2709
|
-
const e = new Map()
|
|
2710
|
-
let t = 0
|
|
2711
|
-
for (const s of Object.keys(a))
|
|
2712
|
-
(e.set(parseInt(s, 10), a[s]), ++t % 1e3 === 0 && (await kt(0)))
|
|
2713
|
-
return e
|
|
2714
|
-
},
|
|
2715
|
-
kt = (a) => new Promise((e) => setTimeout(e, a)),
|
|
2716
|
-
Hs = /[\n\r\p{Z}\p{P}]+/u
|
|
2717
|
-
class Qs {
|
|
2718
|
-
constructor(e = 10) {
|
|
2719
|
-
Ce(this, 'max')
|
|
2720
|
-
Ce(this, 'cache')
|
|
2721
|
-
;((this.max = e), (this.cache = new Map()))
|
|
2722
|
-
}
|
|
2723
|
-
get(e) {
|
|
2724
|
-
let t = this.cache.get(e)
|
|
2725
|
-
return (t !== void 0 && (this.cache.delete(e), this.cache.set(e, t)), t)
|
|
2726
|
-
}
|
|
2727
|
-
set(e, t) {
|
|
2728
|
-
;(this.cache.has(e)
|
|
2729
|
-
? this.cache.delete(e)
|
|
2730
|
-
: this.cache.size === this.max && this.cache.delete(this.first()),
|
|
2731
|
-
this.cache.set(e, t))
|
|
2732
|
-
}
|
|
2733
|
-
first() {
|
|
2734
|
-
return this.cache.keys().next().value
|
|
2735
|
-
}
|
|
2736
|
-
clear() {
|
|
2737
|
-
this.cache.clear()
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
const Ys = ['aria-owns'],
|
|
2741
|
-
Zs = { class: 'shell' },
|
|
2742
|
-
Xs = ['title'],
|
|
2743
|
-
en = { class: 'search-actions before' },
|
|
2744
|
-
tn = ['title'],
|
|
2745
|
-
sn = ['aria-activedescendant', 'aria-controls', 'placeholder'],
|
|
2746
|
-
nn = { class: 'search-actions' },
|
|
2747
|
-
rn = ['title'],
|
|
2748
|
-
an = ['disabled', 'title'],
|
|
2749
|
-
on = ['id', 'role', 'aria-labelledby'],
|
|
2750
|
-
ln = ['id', 'aria-selected'],
|
|
2751
|
-
cn = ['href', 'aria-label', 'onMouseenter', 'onFocusin', 'data-index'],
|
|
2752
|
-
un = { class: 'titles' },
|
|
2753
|
-
dn = ['innerHTML'],
|
|
2754
|
-
hn = { class: 'title main' },
|
|
2755
|
-
fn = ['innerHTML'],
|
|
2756
|
-
pn = { key: 0, class: 'excerpt-wrapper' },
|
|
2757
|
-
vn = { key: 0, class: 'excerpt', inert: '' },
|
|
2758
|
-
mn = ['innerHTML'],
|
|
2759
|
-
gn = { key: 0, class: 'no-results' },
|
|
2760
|
-
bn = { class: 'search-keyboard-shortcuts' },
|
|
2761
|
-
yn = ['aria-label'],
|
|
2762
|
-
wn = ['aria-label'],
|
|
2763
|
-
xn = ['aria-label'],
|
|
2764
|
-
_n = ['aria-label'],
|
|
2765
|
-
Sn = Lt({
|
|
2766
|
-
__name: 'VPLocalSearchBox',
|
|
2767
|
-
emits: ['close'],
|
|
2768
|
-
setup(a, { emit: e }) {
|
|
2769
|
-
var S, R
|
|
2770
|
-
const t = e,
|
|
2771
|
-
s = le(),
|
|
2772
|
-
n = le(),
|
|
2773
|
-
r = le(is),
|
|
2774
|
-
i = ss(),
|
|
2775
|
-
{ activate: o } = Ds(s, {
|
|
2776
|
-
immediate: !0,
|
|
2777
|
-
allowOutsideClick: !0,
|
|
2778
|
-
clickOutsideDeactivates: !0,
|
|
2779
|
-
escapeDeactivates: !0,
|
|
2780
|
-
}),
|
|
2781
|
-
{ localeIndex: l, theme: c } = i,
|
|
2782
|
-
h = tt(async () => {
|
|
2783
|
-
var v, p, I, O, P, z, V, k, K
|
|
2784
|
-
return rt(
|
|
2785
|
-
ue.loadJSON(
|
|
2786
|
-
(I = await ((p = (v = r.value)[l.value]) == null
|
|
2787
|
-
? void 0
|
|
2788
|
-
: p.call(v))) == null
|
|
2789
|
-
? void 0
|
|
2790
|
-
: I.default,
|
|
2791
|
-
{
|
|
2792
|
-
fields: ['title', 'titles', 'text'],
|
|
2793
|
-
storeFields: ['title', 'titles'],
|
|
2794
|
-
searchOptions: {
|
|
2795
|
-
fuzzy: 0.2,
|
|
2796
|
-
prefix: !0,
|
|
2797
|
-
boost: { title: 4, text: 2, titles: 1 },
|
|
2798
|
-
...(((O = c.value.search) == null ? void 0 : O.provider) ===
|
|
2799
|
-
'local' &&
|
|
2800
|
-
((z =
|
|
2801
|
-
(P = c.value.search.options) == null
|
|
2802
|
-
? void 0
|
|
2803
|
-
: P.miniSearch) == null
|
|
2804
|
-
? void 0
|
|
2805
|
-
: z.searchOptions)),
|
|
2806
|
-
},
|
|
2807
|
-
...(((V = c.value.search) == null ? void 0 : V.provider) ===
|
|
2808
|
-
'local' &&
|
|
2809
|
-
((K =
|
|
2810
|
-
(k = c.value.search.options) == null
|
|
2811
|
-
? void 0
|
|
2812
|
-
: k.miniSearch) == null
|
|
2813
|
-
? void 0
|
|
2814
|
-
: K.options)),
|
|
2815
|
-
},
|
|
2816
|
-
),
|
|
2817
|
-
)
|
|
2818
|
-
}),
|
|
2819
|
-
f = ge(() => {
|
|
2820
|
-
var v, p
|
|
2821
|
-
return (
|
|
2822
|
-
((v = c.value.search) == null ? void 0 : v.provider) === 'local' &&
|
|
2823
|
-
((p = c.value.search.options) == null
|
|
2824
|
-
? void 0
|
|
2825
|
-
: p.disableQueryPersistence) === !0
|
|
2826
|
-
)
|
|
2827
|
-
}).value
|
|
2828
|
-
? he('')
|
|
2829
|
-
: Dt('vitepress:local-search-filter', ''),
|
|
2830
|
-
b = Pt(
|
|
2831
|
-
'vitepress:local-search-detailed-list',
|
|
2832
|
-
((S = c.value.search) == null ? void 0 : S.provider) === 'local' &&
|
|
2833
|
-
((R = c.value.search.options) == null ? void 0 : R.detailedView) ===
|
|
2834
|
-
!0,
|
|
2835
|
-
),
|
|
2836
|
-
y = ge(() => {
|
|
2837
|
-
var v, p, I
|
|
2838
|
-
return (
|
|
2839
|
-
((v = c.value.search) == null ? void 0 : v.provider) === 'local' &&
|
|
2840
|
-
(((p = c.value.search.options) == null
|
|
2841
|
-
? void 0
|
|
2842
|
-
: p.disableDetailedView) === !0 ||
|
|
2843
|
-
((I = c.value.search.options) == null
|
|
2844
|
-
? void 0
|
|
2845
|
-
: I.detailedView) === !1)
|
|
2846
|
-
)
|
|
2847
|
-
}),
|
|
2848
|
-
x = ge(() => {
|
|
2849
|
-
var p, I, O, P, z, V, k
|
|
2850
|
-
const v =
|
|
2851
|
-
((p = c.value.search) == null ? void 0 : p.options) ??
|
|
2852
|
-
c.value.algolia
|
|
2853
|
-
return (
|
|
2854
|
-
((z =
|
|
2855
|
-
(P =
|
|
2856
|
-
(O =
|
|
2857
|
-
(I = v == null ? void 0 : v.locales) == null
|
|
2858
|
-
? void 0
|
|
2859
|
-
: I[l.value]) == null
|
|
2860
|
-
? void 0
|
|
2861
|
-
: O.translations) == null
|
|
2862
|
-
? void 0
|
|
2863
|
-
: P.button) == null
|
|
2864
|
-
? void 0
|
|
2865
|
-
: z.buttonText) ||
|
|
2866
|
-
((k =
|
|
2867
|
-
(V = v == null ? void 0 : v.translations) == null
|
|
2868
|
-
? void 0
|
|
2869
|
-
: V.button) == null
|
|
2870
|
-
? void 0
|
|
2871
|
-
: k.buttonText) ||
|
|
2872
|
-
'Search'
|
|
2873
|
-
)
|
|
2874
|
-
})
|
|
2875
|
-
zt(() => {
|
|
2876
|
-
y.value && (b.value = !1)
|
|
2877
|
-
})
|
|
2878
|
-
const w = le([]),
|
|
2879
|
-
C = he(!1)
|
|
2880
|
-
$e(f, () => {
|
|
2881
|
-
C.value = !1
|
|
2882
|
-
})
|
|
2883
|
-
const A = tt(async () => {
|
|
2884
|
-
if (n.value) return rt(new zs(n.value))
|
|
2885
|
-
}, null),
|
|
2886
|
-
J = new Qs(16)
|
|
2887
|
-
Vt(
|
|
2888
|
-
() => [h.value, f.value, b.value],
|
|
2889
|
-
async ([v, p, I], O, P) => {
|
|
2890
|
-
var ee, we, Ge, He
|
|
2891
|
-
;(O == null ? void 0 : O[0]) !== v && J.clear()
|
|
2892
|
-
let z = !1
|
|
2893
|
-
if (
|
|
2894
|
-
(P(() => {
|
|
2895
|
-
z = !0
|
|
2896
|
-
}),
|
|
2897
|
-
!v)
|
|
2898
|
-
)
|
|
2899
|
-
return
|
|
2900
|
-
;((w.value = v.search(p).slice(0, 16)), (C.value = !0))
|
|
2901
|
-
const V = I ? await Promise.all(w.value.map((B) => Q(B.id))) : []
|
|
2902
|
-
if (z) return
|
|
2903
|
-
for (const { id: B, mod: te } of V) {
|
|
2904
|
-
const se = B.slice(0, B.indexOf('#'))
|
|
2905
|
-
let Y = J.get(se)
|
|
2906
|
-
if (Y) continue
|
|
2907
|
-
;((Y = new Map()), J.set(se, Y))
|
|
2908
|
-
const G = te.default ?? te
|
|
2909
|
-
if ((G != null && G.render) || (G != null && G.setup)) {
|
|
2910
|
-
const ne = Yt(G)
|
|
2911
|
-
;((ne.config.warnHandler = () => {}),
|
|
2912
|
-
ne.provide(Zt, i),
|
|
2913
|
-
Object.defineProperties(ne.config.globalProperties, {
|
|
2914
|
-
$frontmatter: {
|
|
2915
|
-
get() {
|
|
2916
|
-
return i.frontmatter.value
|
|
2917
|
-
},
|
|
2918
|
-
},
|
|
2919
|
-
$params: {
|
|
2920
|
-
get() {
|
|
2921
|
-
return i.page.value.params
|
|
2922
|
-
},
|
|
2923
|
-
},
|
|
2924
|
-
}))
|
|
2925
|
-
const Qe = document.createElement('div')
|
|
2926
|
-
;(ne.mount(Qe),
|
|
2927
|
-
Qe.querySelectorAll('h1, h2, h3, h4, h5, h6').forEach((de) => {
|
|
2928
|
-
var Xe
|
|
2929
|
-
const xe =
|
|
2930
|
-
(Xe = de.querySelector('a')) == null
|
|
2931
|
-
? void 0
|
|
2932
|
-
: Xe.getAttribute('href'),
|
|
2933
|
-
Ye =
|
|
2934
|
-
(xe == null ? void 0 : xe.startsWith('#')) && xe.slice(1)
|
|
2935
|
-
if (!Ye) return
|
|
2936
|
-
let Ze = ''
|
|
2937
|
-
for (
|
|
2938
|
-
;
|
|
2939
|
-
(de = de.nextElementSibling) &&
|
|
2940
|
-
!/^h[1-6]$/i.test(de.tagName);
|
|
2941
|
-
|
|
2942
|
-
)
|
|
2943
|
-
Ze += de.outerHTML
|
|
2944
|
-
Y.set(Ye, Ze)
|
|
2945
|
-
}),
|
|
2946
|
-
ne.unmount())
|
|
2947
|
-
}
|
|
2948
|
-
if (z) return
|
|
2949
|
-
}
|
|
2950
|
-
const k = new Set()
|
|
2951
|
-
if (
|
|
2952
|
-
((w.value = w.value.map((B) => {
|
|
2953
|
-
const [te, se] = B.id.split('#'),
|
|
2954
|
-
Y = J.get(te),
|
|
2955
|
-
G = (Y == null ? void 0 : Y.get(se)) ?? ''
|
|
2956
|
-
for (const ne in B.match) k.add(ne)
|
|
2957
|
-
return { ...B, text: G }
|
|
2958
|
-
})),
|
|
2959
|
-
await fe(),
|
|
2960
|
-
z)
|
|
2961
|
-
)
|
|
2962
|
-
return
|
|
2963
|
-
await new Promise((B) => {
|
|
2964
|
-
var te
|
|
2965
|
-
;(te = A.value) == null ||
|
|
2966
|
-
te.unmark({
|
|
2967
|
-
done: () => {
|
|
2968
|
-
var se
|
|
2969
|
-
;(se = A.value) == null || se.markRegExp(T(k), { done: B })
|
|
2970
|
-
},
|
|
2971
|
-
})
|
|
2972
|
-
})
|
|
2973
|
-
const K =
|
|
2974
|
-
((ee = s.value) == null
|
|
2975
|
-
? void 0
|
|
2976
|
-
: ee.querySelectorAll('.result .excerpt')) ?? []
|
|
2977
|
-
for (const B of K)
|
|
2978
|
-
(we = B.querySelector('mark[data-markjs="true"]')) == null ||
|
|
2979
|
-
we.scrollIntoView({ block: 'center' })
|
|
2980
|
-
;(He = (Ge = n.value) == null ? void 0 : Ge.firstElementChild) ==
|
|
2981
|
-
null || He.scrollIntoView({ block: 'start' })
|
|
2982
|
-
},
|
|
2983
|
-
{ debounce: 200, immediate: !0 },
|
|
2984
|
-
)
|
|
2985
|
-
async function Q(v) {
|
|
2986
|
-
const p = Xt(v.slice(0, v.indexOf('#')))
|
|
2987
|
-
try {
|
|
2988
|
-
if (!p) throw new Error(`Cannot find file for id: ${v}`)
|
|
2989
|
-
return { id: v, mod: await import(p) }
|
|
2990
|
-
} catch (I) {
|
|
2991
|
-
return (console.error(I), { id: v, mod: {} })
|
|
2992
|
-
}
|
|
2993
|
-
}
|
|
2994
|
-
const W = he(),
|
|
2995
|
-
$ = ge(() => {
|
|
2996
|
-
var v
|
|
2997
|
-
return ((v = f.value) == null ? void 0 : v.length) <= 0
|
|
2998
|
-
})
|
|
2999
|
-
function j(v = !0) {
|
|
3000
|
-
var p, I
|
|
3001
|
-
;((p = W.value) == null || p.focus(),
|
|
3002
|
-
v && ((I = W.value) == null || I.select()))
|
|
3003
|
-
}
|
|
3004
|
-
Ae(() => {
|
|
3005
|
-
j()
|
|
3006
|
-
})
|
|
3007
|
-
function ye(v) {
|
|
3008
|
-
v.pointerType === 'mouse' && j()
|
|
3009
|
-
}
|
|
3010
|
-
const M = he(-1),
|
|
3011
|
-
q = he(!0)
|
|
3012
|
-
$e(w, (v) => {
|
|
3013
|
-
;((M.value = v.length ? 0 : -1), U())
|
|
3014
|
-
})
|
|
3015
|
-
function U() {
|
|
3016
|
-
fe(() => {
|
|
3017
|
-
const v = document.querySelector('.result.selected')
|
|
3018
|
-
v == null || v.scrollIntoView({ block: 'nearest' })
|
|
3019
|
-
})
|
|
3020
|
-
}
|
|
3021
|
-
;(_e('ArrowUp', (v) => {
|
|
3022
|
-
;(v.preventDefault(),
|
|
3023
|
-
M.value--,
|
|
3024
|
-
M.value < 0 && (M.value = w.value.length - 1),
|
|
3025
|
-
(q.value = !0),
|
|
3026
|
-
U())
|
|
3027
|
-
}),
|
|
3028
|
-
_e('ArrowDown', (v) => {
|
|
3029
|
-
;(v.preventDefault(),
|
|
3030
|
-
M.value++,
|
|
3031
|
-
M.value >= w.value.length && (M.value = 0),
|
|
3032
|
-
(q.value = !0),
|
|
3033
|
-
U())
|
|
3034
|
-
}))
|
|
3035
|
-
const N = $t()
|
|
3036
|
-
;(_e('Enter', (v) => {
|
|
3037
|
-
if (
|
|
3038
|
-
v.isComposing ||
|
|
3039
|
-
(v.target instanceof HTMLButtonElement && v.target.type !== 'submit')
|
|
3040
|
-
)
|
|
3041
|
-
return
|
|
3042
|
-
const p = w.value[M.value]
|
|
3043
|
-
if (v.target instanceof HTMLInputElement && !p) {
|
|
3044
|
-
v.preventDefault()
|
|
3045
|
-
return
|
|
3046
|
-
}
|
|
3047
|
-
p && (N.go(p.id), t('close'))
|
|
3048
|
-
}),
|
|
3049
|
-
_e('Escape', () => {
|
|
3050
|
-
t('close')
|
|
3051
|
-
}))
|
|
3052
|
-
const d = ns({
|
|
3053
|
-
modal: {
|
|
3054
|
-
displayDetails: 'Display detailed list',
|
|
3055
|
-
resetButtonTitle: 'Reset search',
|
|
3056
|
-
backButtonTitle: 'Close search',
|
|
3057
|
-
noResultsText: 'No results for',
|
|
3058
|
-
footer: {
|
|
3059
|
-
selectText: 'to select',
|
|
3060
|
-
selectKeyAriaLabel: 'enter',
|
|
3061
|
-
navigateText: 'to navigate',
|
|
3062
|
-
navigateUpKeyAriaLabel: 'up arrow',
|
|
3063
|
-
navigateDownKeyAriaLabel: 'down arrow',
|
|
3064
|
-
closeText: 'to close',
|
|
3065
|
-
closeKeyAriaLabel: 'escape',
|
|
3066
|
-
},
|
|
3067
|
-
},
|
|
3068
|
-
})
|
|
3069
|
-
;(Ae(() => {
|
|
3070
|
-
window.history.pushState(null, '', null)
|
|
3071
|
-
}),
|
|
3072
|
-
jt('popstate', (v) => {
|
|
3073
|
-
;(v.preventDefault(), t('close'))
|
|
3074
|
-
}))
|
|
3075
|
-
const g = Bt(Wt ? document.body : null)
|
|
3076
|
-
;(Ae(() => {
|
|
3077
|
-
fe(() => {
|
|
3078
|
-
;((g.value = !0), fe().then(() => o()))
|
|
3079
|
-
})
|
|
3080
|
-
}),
|
|
3081
|
-
Kt(() => {
|
|
3082
|
-
g.value = !1
|
|
3083
|
-
}))
|
|
3084
|
-
function E() {
|
|
3085
|
-
;((f.value = ''), fe().then(() => j(!1)))
|
|
3086
|
-
}
|
|
3087
|
-
function T(v) {
|
|
3088
|
-
return new RegExp(
|
|
3089
|
-
[...v]
|
|
3090
|
-
.sort((p, I) => I.length - p.length)
|
|
3091
|
-
.map((p) => `(${es(p)})`)
|
|
3092
|
-
.join('|'),
|
|
3093
|
-
'gi',
|
|
3094
|
-
)
|
|
3095
|
-
}
|
|
3096
|
-
function F(v) {
|
|
3097
|
-
var O
|
|
3098
|
-
if (!q.value) return
|
|
3099
|
-
const p = (O = v.target) == null ? void 0 : O.closest('.result'),
|
|
3100
|
-
I = Number.parseInt(p == null ? void 0 : p.dataset.index)
|
|
3101
|
-
;(I >= 0 && I !== M.value && (M.value = I), (q.value = !1))
|
|
3102
|
-
}
|
|
3103
|
-
return (v, p) => {
|
|
3104
|
-
var I, O, P, z, V
|
|
3105
|
-
return (
|
|
3106
|
-
H(),
|
|
3107
|
-
Jt(Qt, { to: 'body' }, [
|
|
3108
|
-
_(
|
|
3109
|
-
'div',
|
|
3110
|
-
{
|
|
3111
|
-
ref_key: 'el',
|
|
3112
|
-
ref: s,
|
|
3113
|
-
role: 'button',
|
|
3114
|
-
'aria-owns':
|
|
3115
|
-
(I = w.value) != null && I.length
|
|
3116
|
-
? 'localsearch-list'
|
|
3117
|
-
: void 0,
|
|
3118
|
-
'aria-expanded': 'true',
|
|
3119
|
-
'aria-haspopup': 'listbox',
|
|
3120
|
-
'aria-labelledby': 'localsearch-label',
|
|
3121
|
-
class: 'VPLocalSearchBox',
|
|
3122
|
-
},
|
|
3123
|
-
[
|
|
3124
|
-
_('div', {
|
|
3125
|
-
class: 'backdrop',
|
|
3126
|
-
onClick: p[0] || (p[0] = (k) => v.$emit('close')),
|
|
3127
|
-
}),
|
|
3128
|
-
_('div', Zs, [
|
|
3129
|
-
_(
|
|
3130
|
-
'form',
|
|
3131
|
-
{
|
|
3132
|
-
class: 'search-bar',
|
|
3133
|
-
onPointerup: p[4] || (p[4] = (k) => ye(k)),
|
|
3134
|
-
onSubmit: p[5] || (p[5] = qt(() => {}, ['prevent'])),
|
|
3135
|
-
},
|
|
3136
|
-
[
|
|
3137
|
-
_(
|
|
3138
|
-
'label',
|
|
3139
|
-
{
|
|
3140
|
-
title: x.value,
|
|
3141
|
-
id: 'localsearch-label',
|
|
3142
|
-
for: 'localsearch-input',
|
|
3143
|
-
},
|
|
3144
|
-
[
|
|
3145
|
-
...(p[7] ||
|
|
3146
|
-
(p[7] = [
|
|
3147
|
-
_(
|
|
3148
|
-
'span',
|
|
3149
|
-
{
|
|
3150
|
-
'aria-hidden': 'true',
|
|
3151
|
-
class:
|
|
3152
|
-
'vpi-search search-icon local-search-icon',
|
|
3153
|
-
},
|
|
3154
|
-
null,
|
|
3155
|
-
-1,
|
|
3156
|
-
),
|
|
3157
|
-
])),
|
|
3158
|
-
],
|
|
3159
|
-
8,
|
|
3160
|
-
Xs,
|
|
3161
|
-
),
|
|
3162
|
-
_('div', en, [
|
|
3163
|
-
_(
|
|
3164
|
-
'button',
|
|
3165
|
-
{
|
|
3166
|
-
class: 'back-button',
|
|
3167
|
-
title: L(d)('modal.backButtonTitle'),
|
|
3168
|
-
onClick: p[1] || (p[1] = (k) => v.$emit('close')),
|
|
3169
|
-
},
|
|
3170
|
-
[
|
|
3171
|
-
...(p[8] ||
|
|
3172
|
-
(p[8] = [
|
|
3173
|
-
_(
|
|
3174
|
-
'span',
|
|
3175
|
-
{ class: 'vpi-arrow-left local-search-icon' },
|
|
3176
|
-
null,
|
|
3177
|
-
-1,
|
|
3178
|
-
),
|
|
3179
|
-
])),
|
|
3180
|
-
],
|
|
3181
|
-
8,
|
|
3182
|
-
tn,
|
|
3183
|
-
),
|
|
3184
|
-
]),
|
|
3185
|
-
Ut(
|
|
3186
|
-
_(
|
|
3187
|
-
'input',
|
|
3188
|
-
{
|
|
3189
|
-
ref_key: 'searchInput',
|
|
3190
|
-
ref: W,
|
|
3191
|
-
'onUpdate:modelValue':
|
|
3192
|
-
p[2] ||
|
|
3193
|
-
(p[2] = (k) => (Ht(f) ? (f.value = k) : null)),
|
|
3194
|
-
'aria-activedescendant':
|
|
3195
|
-
M.value > -1
|
|
3196
|
-
? 'localsearch-item-' + M.value
|
|
3197
|
-
: void 0,
|
|
3198
|
-
'aria-autocomplete': 'both',
|
|
3199
|
-
'aria-controls':
|
|
3200
|
-
(O = w.value) != null && O.length
|
|
3201
|
-
? 'localsearch-list'
|
|
3202
|
-
: void 0,
|
|
3203
|
-
'aria-labelledby': 'localsearch-label',
|
|
3204
|
-
autocapitalize: 'off',
|
|
3205
|
-
autocomplete: 'off',
|
|
3206
|
-
autocorrect: 'off',
|
|
3207
|
-
class: 'search-input',
|
|
3208
|
-
id: 'localsearch-input',
|
|
3209
|
-
enterkeyhint: 'go',
|
|
3210
|
-
maxlength: '64',
|
|
3211
|
-
placeholder: x.value,
|
|
3212
|
-
spellcheck: 'false',
|
|
3213
|
-
type: 'search',
|
|
3214
|
-
},
|
|
3215
|
-
null,
|
|
3216
|
-
8,
|
|
3217
|
-
sn,
|
|
3218
|
-
),
|
|
3219
|
-
[[Gt, L(f)]],
|
|
3220
|
-
),
|
|
3221
|
-
_('div', nn, [
|
|
3222
|
-
y.value
|
|
3223
|
-
? Se('', !0)
|
|
3224
|
-
: (H(),
|
|
3225
|
-
Z(
|
|
3226
|
-
'button',
|
|
3227
|
-
{
|
|
3228
|
-
key: 0,
|
|
3229
|
-
class: st([
|
|
3230
|
-
'toggle-layout-button',
|
|
3231
|
-
{ 'detailed-list': L(b) },
|
|
3232
|
-
]),
|
|
3233
|
-
type: 'button',
|
|
3234
|
-
title: L(d)('modal.displayDetails'),
|
|
3235
|
-
onClick:
|
|
3236
|
-
p[3] ||
|
|
3237
|
-
(p[3] = (k) =>
|
|
3238
|
-
M.value > -1 && (b.value = !L(b))),
|
|
3239
|
-
},
|
|
3240
|
-
[
|
|
3241
|
-
...(p[9] ||
|
|
3242
|
-
(p[9] = [
|
|
3243
|
-
_(
|
|
3244
|
-
'span',
|
|
3245
|
-
{
|
|
3246
|
-
class:
|
|
3247
|
-
'vpi-layout-list local-search-icon',
|
|
3248
|
-
},
|
|
3249
|
-
null,
|
|
3250
|
-
-1,
|
|
3251
|
-
),
|
|
3252
|
-
])),
|
|
3253
|
-
],
|
|
3254
|
-
10,
|
|
3255
|
-
rn,
|
|
3256
|
-
)),
|
|
3257
|
-
_(
|
|
3258
|
-
'button',
|
|
3259
|
-
{
|
|
3260
|
-
class: 'clear-button',
|
|
3261
|
-
type: 'reset',
|
|
3262
|
-
disabled: $.value,
|
|
3263
|
-
title: L(d)('modal.resetButtonTitle'),
|
|
3264
|
-
onClick: E,
|
|
3265
|
-
},
|
|
3266
|
-
[
|
|
3267
|
-
...(p[10] ||
|
|
3268
|
-
(p[10] = [
|
|
3269
|
-
_(
|
|
3270
|
-
'span',
|
|
3271
|
-
{ class: 'vpi-delete local-search-icon' },
|
|
3272
|
-
null,
|
|
3273
|
-
-1,
|
|
3274
|
-
),
|
|
3275
|
-
])),
|
|
3276
|
-
],
|
|
3277
|
-
8,
|
|
3278
|
-
an,
|
|
3279
|
-
),
|
|
3280
|
-
]),
|
|
3281
|
-
],
|
|
3282
|
-
32,
|
|
3283
|
-
),
|
|
3284
|
-
_(
|
|
3285
|
-
'ul',
|
|
3286
|
-
{
|
|
3287
|
-
ref_key: 'resultsEl',
|
|
3288
|
-
ref: n,
|
|
3289
|
-
id:
|
|
3290
|
-
(P = w.value) != null && P.length
|
|
3291
|
-
? 'localsearch-list'
|
|
3292
|
-
: void 0,
|
|
3293
|
-
role:
|
|
3294
|
-
(z = w.value) != null && z.length ? 'listbox' : void 0,
|
|
3295
|
-
'aria-labelledby':
|
|
3296
|
-
(V = w.value) != null && V.length
|
|
3297
|
-
? 'localsearch-label'
|
|
3298
|
-
: void 0,
|
|
3299
|
-
class: 'results',
|
|
3300
|
-
onMousemove: F,
|
|
3301
|
-
},
|
|
3302
|
-
[
|
|
3303
|
-
(H(!0),
|
|
3304
|
-
Z(
|
|
3305
|
-
it,
|
|
3306
|
-
null,
|
|
3307
|
-
nt(
|
|
3308
|
-
w.value,
|
|
3309
|
-
(k, K) => (
|
|
3310
|
-
H(),
|
|
3311
|
-
Z(
|
|
3312
|
-
'li',
|
|
3313
|
-
{
|
|
3314
|
-
key: k.id,
|
|
3315
|
-
id: 'localsearch-item-' + K,
|
|
3316
|
-
'aria-selected':
|
|
3317
|
-
M.value === K ? 'true' : 'false',
|
|
3318
|
-
role: 'option',
|
|
3319
|
-
},
|
|
3320
|
-
[
|
|
3321
|
-
_(
|
|
3322
|
-
'a',
|
|
3323
|
-
{
|
|
3324
|
-
href: k.id,
|
|
3325
|
-
class: st([
|
|
3326
|
-
'result',
|
|
3327
|
-
{ selected: M.value === K },
|
|
3328
|
-
]),
|
|
3329
|
-
'aria-label': [...k.titles, k.title].join(
|
|
3330
|
-
' > ',
|
|
3331
|
-
),
|
|
3332
|
-
onMouseenter: (ee) =>
|
|
3333
|
-
!q.value && (M.value = K),
|
|
3334
|
-
onFocusin: (ee) => (M.value = K),
|
|
3335
|
-
onClick:
|
|
3336
|
-
p[6] || (p[6] = (ee) => v.$emit('close')),
|
|
3337
|
-
'data-index': K,
|
|
3338
|
-
},
|
|
3339
|
-
[
|
|
3340
|
-
_('div', null, [
|
|
3341
|
-
_('div', un, [
|
|
3342
|
-
p[12] ||
|
|
3343
|
-
(p[12] = _(
|
|
3344
|
-
'span',
|
|
3345
|
-
{ class: 'title-icon' },
|
|
3346
|
-
'#',
|
|
3347
|
-
-1,
|
|
3348
|
-
)),
|
|
3349
|
-
(H(!0),
|
|
3350
|
-
Z(
|
|
3351
|
-
it,
|
|
3352
|
-
null,
|
|
3353
|
-
nt(
|
|
3354
|
-
k.titles,
|
|
3355
|
-
(ee, we) => (
|
|
3356
|
-
H(),
|
|
3357
|
-
Z(
|
|
3358
|
-
'span',
|
|
3359
|
-
{ key: we, class: 'title' },
|
|
3360
|
-
[
|
|
3361
|
-
_(
|
|
3362
|
-
'span',
|
|
3363
|
-
{
|
|
3364
|
-
class: 'text',
|
|
3365
|
-
innerHTML: ee,
|
|
3366
|
-
},
|
|
3367
|
-
null,
|
|
3368
|
-
8,
|
|
3369
|
-
dn,
|
|
3370
|
-
),
|
|
3371
|
-
p[11] ||
|
|
3372
|
-
(p[11] = _(
|
|
3373
|
-
'span',
|
|
3374
|
-
{
|
|
3375
|
-
class:
|
|
3376
|
-
'vpi-chevron-right local-search-icon',
|
|
3377
|
-
},
|
|
3378
|
-
null,
|
|
3379
|
-
-1,
|
|
3380
|
-
)),
|
|
3381
|
-
],
|
|
3382
|
-
)
|
|
3383
|
-
),
|
|
3384
|
-
),
|
|
3385
|
-
128,
|
|
3386
|
-
)),
|
|
3387
|
-
_('span', hn, [
|
|
3388
|
-
_(
|
|
3389
|
-
'span',
|
|
3390
|
-
{
|
|
3391
|
-
class: 'text',
|
|
3392
|
-
innerHTML: k.title,
|
|
3393
|
-
},
|
|
3394
|
-
null,
|
|
3395
|
-
8,
|
|
3396
|
-
fn,
|
|
3397
|
-
),
|
|
3398
|
-
]),
|
|
3399
|
-
]),
|
|
3400
|
-
L(b)
|
|
3401
|
-
? (H(),
|
|
3402
|
-
Z('div', pn, [
|
|
3403
|
-
k.text
|
|
3404
|
-
? (H(),
|
|
3405
|
-
Z('div', vn, [
|
|
3406
|
-
_(
|
|
3407
|
-
'div',
|
|
3408
|
-
{
|
|
3409
|
-
class: 'vp-doc',
|
|
3410
|
-
innerHTML: k.text,
|
|
3411
|
-
},
|
|
3412
|
-
null,
|
|
3413
|
-
8,
|
|
3414
|
-
mn,
|
|
3415
|
-
),
|
|
3416
|
-
]))
|
|
3417
|
-
: Se('', !0),
|
|
3418
|
-
p[13] ||
|
|
3419
|
-
(p[13] = _(
|
|
3420
|
-
'div',
|
|
3421
|
-
{
|
|
3422
|
-
class:
|
|
3423
|
-
'excerpt-gradient-bottom',
|
|
3424
|
-
},
|
|
3425
|
-
null,
|
|
3426
|
-
-1,
|
|
3427
|
-
)),
|
|
3428
|
-
p[14] ||
|
|
3429
|
-
(p[14] = _(
|
|
3430
|
-
'div',
|
|
3431
|
-
{
|
|
3432
|
-
class: 'excerpt-gradient-top',
|
|
3433
|
-
},
|
|
3434
|
-
null,
|
|
3435
|
-
-1,
|
|
3436
|
-
)),
|
|
3437
|
-
]))
|
|
3438
|
-
: Se('', !0),
|
|
3439
|
-
]),
|
|
3440
|
-
],
|
|
3441
|
-
42,
|
|
3442
|
-
cn,
|
|
3443
|
-
),
|
|
3444
|
-
],
|
|
3445
|
-
8,
|
|
3446
|
-
ln,
|
|
3447
|
-
)
|
|
3448
|
-
),
|
|
3449
|
-
),
|
|
3450
|
-
128,
|
|
3451
|
-
)),
|
|
3452
|
-
L(f) && !w.value.length && C.value
|
|
3453
|
-
? (H(),
|
|
3454
|
-
Z('li', gn, [
|
|
3455
|
-
pe(ve(L(d)('modal.noResultsText')) + ' "', 1),
|
|
3456
|
-
_('strong', null, ve(L(f)), 1),
|
|
3457
|
-
p[15] || (p[15] = pe('" ', -1)),
|
|
3458
|
-
]))
|
|
3459
|
-
: Se('', !0),
|
|
3460
|
-
],
|
|
3461
|
-
40,
|
|
3462
|
-
on,
|
|
3463
|
-
),
|
|
3464
|
-
_('div', bn, [
|
|
3465
|
-
_('span', null, [
|
|
3466
|
-
_(
|
|
3467
|
-
'kbd',
|
|
3468
|
-
{
|
|
3469
|
-
'aria-label': L(d)(
|
|
3470
|
-
'modal.footer.navigateUpKeyAriaLabel',
|
|
3471
|
-
),
|
|
3472
|
-
},
|
|
3473
|
-
[
|
|
3474
|
-
...(p[16] ||
|
|
3475
|
-
(p[16] = [
|
|
3476
|
-
_(
|
|
3477
|
-
'span',
|
|
3478
|
-
{ class: 'vpi-arrow-up navigate-icon' },
|
|
3479
|
-
null,
|
|
3480
|
-
-1,
|
|
3481
|
-
),
|
|
3482
|
-
])),
|
|
3483
|
-
],
|
|
3484
|
-
8,
|
|
3485
|
-
yn,
|
|
3486
|
-
),
|
|
3487
|
-
_(
|
|
3488
|
-
'kbd',
|
|
3489
|
-
{
|
|
3490
|
-
'aria-label': L(d)(
|
|
3491
|
-
'modal.footer.navigateDownKeyAriaLabel',
|
|
3492
|
-
),
|
|
3493
|
-
},
|
|
3494
|
-
[
|
|
3495
|
-
...(p[17] ||
|
|
3496
|
-
(p[17] = [
|
|
3497
|
-
_(
|
|
3498
|
-
'span',
|
|
3499
|
-
{ class: 'vpi-arrow-down navigate-icon' },
|
|
3500
|
-
null,
|
|
3501
|
-
-1,
|
|
3502
|
-
),
|
|
3503
|
-
])),
|
|
3504
|
-
],
|
|
3505
|
-
8,
|
|
3506
|
-
wn,
|
|
3507
|
-
),
|
|
3508
|
-
pe(' ' + ve(L(d)('modal.footer.navigateText')), 1),
|
|
3509
|
-
]),
|
|
3510
|
-
_('span', null, [
|
|
3511
|
-
_(
|
|
3512
|
-
'kbd',
|
|
3513
|
-
{
|
|
3514
|
-
'aria-label': L(d)('modal.footer.selectKeyAriaLabel'),
|
|
3515
|
-
},
|
|
3516
|
-
[
|
|
3517
|
-
...(p[18] ||
|
|
3518
|
-
(p[18] = [
|
|
3519
|
-
_(
|
|
3520
|
-
'span',
|
|
3521
|
-
{ class: 'vpi-corner-down-left navigate-icon' },
|
|
3522
|
-
null,
|
|
3523
|
-
-1,
|
|
3524
|
-
),
|
|
3525
|
-
])),
|
|
3526
|
-
],
|
|
3527
|
-
8,
|
|
3528
|
-
xn,
|
|
3529
|
-
),
|
|
3530
|
-
pe(' ' + ve(L(d)('modal.footer.selectText')), 1),
|
|
3531
|
-
]),
|
|
3532
|
-
_('span', null, [
|
|
3533
|
-
_(
|
|
3534
|
-
'kbd',
|
|
3535
|
-
{
|
|
3536
|
-
'aria-label': L(d)('modal.footer.closeKeyAriaLabel'),
|
|
3537
|
-
},
|
|
3538
|
-
'esc',
|
|
3539
|
-
8,
|
|
3540
|
-
_n,
|
|
3541
|
-
),
|
|
3542
|
-
pe(' ' + ve(L(d)('modal.footer.closeText')), 1),
|
|
3543
|
-
]),
|
|
3544
|
-
]),
|
|
3545
|
-
]),
|
|
3546
|
-
],
|
|
3547
|
-
8,
|
|
3548
|
-
Ys,
|
|
3549
|
-
),
|
|
3550
|
-
])
|
|
3551
|
-
)
|
|
3552
|
-
}
|
|
3553
|
-
},
|
|
3554
|
-
}),
|
|
3555
|
-
Fn = ts(Sn, [['__scopeId', 'data-v-ce626c7c']])
|
|
3556
|
-
export { Fn as default }
|