@useknest/widget-core 0.0.1-alpha.1 → 0.0.1-alpha.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/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +98 -0
- package/dist/streaming.d.ts +19 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +33 -47
- package/README.md +0 -26
- package/dist/internal.d.ts +0 -4
- package/dist/widget.js +0 -4677
- package/dist/widget.umd.js +0 -85
package/dist/widget.js
DELETED
|
@@ -1,4677 +0,0 @@
|
|
|
1
|
-
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
2
|
-
const jn = 1, Yn = 2, Ks = 4, _a = 8, ba = 16, ka = 1, wa = 2, Xs = "[", Vn = "[!", zr = "]", Rt = {}, re = Symbol(), xa = "http://www.w3.org/1999/xhtml", Qs = !1;
|
|
3
|
-
var Ur = Array.isArray, ya = Array.prototype.indexOf, Fr = Array.from, Mn = Object.keys, Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Ea = Object.getOwnPropertyDescriptors, Ta = Object.prototype, Aa = Array.prototype, Js = Object.getPrototypeOf, Es = Object.isExtensible;
|
|
4
|
-
const Sa = () => {
|
|
5
|
-
};
|
|
6
|
-
function Ra(t) {
|
|
7
|
-
for (var e = 0; e < t.length; e++)
|
|
8
|
-
t[e]();
|
|
9
|
-
}
|
|
10
|
-
function ei() {
|
|
11
|
-
var t, e, n = new Promise((s, r) => {
|
|
12
|
-
t = s, e = r;
|
|
13
|
-
});
|
|
14
|
-
return { promise: n, resolve: t, reject: e };
|
|
15
|
-
}
|
|
16
|
-
const xe = 2, Hr = 4, Br = 8, It = 16, ft = 32, _t = 64, Gr = 128, Ie = 256, Pn = 512, oe = 1024, Re = 2048, bt = 4096, Ge = 8192, Ot = 16384, Wr = 32768, Zn = 65536, Ts = 1 << 17, $a = 1 << 18, Nt = 1 << 19, Ca = 1 << 20, yr = 1 << 21, Kn = 1 << 22, At = 1 << 23, In = Symbol("$state"), La = Symbol("legacy props"), Ia = Symbol(""), dn = new class extends Error {
|
|
17
|
-
name = "StaleReactionError";
|
|
18
|
-
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
|
|
19
|
-
}(), qr = 3, Dt = 8;
|
|
20
|
-
function Oa(t) {
|
|
21
|
-
throw new Error("https://svelte.dev/e/lifecycle_outside_component");
|
|
22
|
-
}
|
|
23
|
-
function Na() {
|
|
24
|
-
throw new Error("https://svelte.dev/e/async_derived_orphan");
|
|
25
|
-
}
|
|
26
|
-
function Da(t) {
|
|
27
|
-
throw new Error("https://svelte.dev/e/effect_in_teardown");
|
|
28
|
-
}
|
|
29
|
-
function Ma() {
|
|
30
|
-
throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
|
|
31
|
-
}
|
|
32
|
-
function Pa(t) {
|
|
33
|
-
throw new Error("https://svelte.dev/e/effect_orphan");
|
|
34
|
-
}
|
|
35
|
-
function za() {
|
|
36
|
-
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
|
|
37
|
-
}
|
|
38
|
-
function Ua() {
|
|
39
|
-
throw new Error("https://svelte.dev/e/hydration_failed");
|
|
40
|
-
}
|
|
41
|
-
function Fa() {
|
|
42
|
-
throw new Error("https://svelte.dev/e/state_descriptors_fixed");
|
|
43
|
-
}
|
|
44
|
-
function Ha() {
|
|
45
|
-
throw new Error("https://svelte.dev/e/state_prototype_fixed");
|
|
46
|
-
}
|
|
47
|
-
function Ba() {
|
|
48
|
-
throw new Error("https://svelte.dev/e/state_unsafe_mutation");
|
|
49
|
-
}
|
|
50
|
-
function Ga() {
|
|
51
|
-
throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
|
|
52
|
-
}
|
|
53
|
-
function wn(t) {
|
|
54
|
-
console.warn("https://svelte.dev/e/hydration_mismatch");
|
|
55
|
-
}
|
|
56
|
-
function Wa() {
|
|
57
|
-
console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
|
|
58
|
-
}
|
|
59
|
-
let I = !1;
|
|
60
|
-
function He(t) {
|
|
61
|
-
I = t;
|
|
62
|
-
}
|
|
63
|
-
let N;
|
|
64
|
-
function ue(t) {
|
|
65
|
-
if (t === null)
|
|
66
|
-
throw wn(), Rt;
|
|
67
|
-
return N = t;
|
|
68
|
-
}
|
|
69
|
-
function Xt() {
|
|
70
|
-
return ue(
|
|
71
|
-
/** @type {TemplateNode} */
|
|
72
|
-
/* @__PURE__ */ We(N)
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
function X(t) {
|
|
76
|
-
if (I) {
|
|
77
|
-
if (/* @__PURE__ */ We(N) !== null)
|
|
78
|
-
throw wn(), Rt;
|
|
79
|
-
N = t;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function ti(t = 1) {
|
|
83
|
-
if (I) {
|
|
84
|
-
for (var e = t, n = N; e--; )
|
|
85
|
-
n = /** @type {TemplateNode} */
|
|
86
|
-
/* @__PURE__ */ We(n);
|
|
87
|
-
N = n;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function zn(t = !0) {
|
|
91
|
-
for (var e = 0, n = N; ; ) {
|
|
92
|
-
if (n.nodeType === Dt) {
|
|
93
|
-
var s = (
|
|
94
|
-
/** @type {Comment} */
|
|
95
|
-
n.data
|
|
96
|
-
);
|
|
97
|
-
if (s === zr) {
|
|
98
|
-
if (e === 0) return n;
|
|
99
|
-
e -= 1;
|
|
100
|
-
} else (s === Xs || s === Vn) && (e += 1);
|
|
101
|
-
}
|
|
102
|
-
var r = (
|
|
103
|
-
/** @type {TemplateNode} */
|
|
104
|
-
/* @__PURE__ */ We(n)
|
|
105
|
-
);
|
|
106
|
-
t && n.remove(), n = r;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function ni(t) {
|
|
110
|
-
if (!t || t.nodeType !== Dt)
|
|
111
|
-
throw wn(), Rt;
|
|
112
|
-
return (
|
|
113
|
-
/** @type {Comment} */
|
|
114
|
-
t.data
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
function ri(t) {
|
|
118
|
-
return t === this.v;
|
|
119
|
-
}
|
|
120
|
-
function qa(t, e) {
|
|
121
|
-
return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
|
|
122
|
-
}
|
|
123
|
-
function si(t) {
|
|
124
|
-
return !qa(t, this.v);
|
|
125
|
-
}
|
|
126
|
-
let ja = !1, $e = null;
|
|
127
|
-
function Qt(t) {
|
|
128
|
-
$e = t;
|
|
129
|
-
}
|
|
130
|
-
function Xn(t, e = !1, n) {
|
|
131
|
-
$e = {
|
|
132
|
-
p: $e,
|
|
133
|
-
c: null,
|
|
134
|
-
e: null,
|
|
135
|
-
s: t,
|
|
136
|
-
x: null,
|
|
137
|
-
l: null
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
function Qn(t) {
|
|
141
|
-
var e = (
|
|
142
|
-
/** @type {ComponentContext} */
|
|
143
|
-
$e
|
|
144
|
-
), n = e.e;
|
|
145
|
-
if (n !== null) {
|
|
146
|
-
e.e = null;
|
|
147
|
-
for (var s of n)
|
|
148
|
-
Ei(s);
|
|
149
|
-
}
|
|
150
|
-
return t !== void 0 && (e.x = t), $e = e.p, t ?? /** @type {T} */
|
|
151
|
-
{};
|
|
152
|
-
}
|
|
153
|
-
function ii() {
|
|
154
|
-
return !0;
|
|
155
|
-
}
|
|
156
|
-
let Tt = [];
|
|
157
|
-
function ai() {
|
|
158
|
-
var t = Tt;
|
|
159
|
-
Tt = [], Ra(t);
|
|
160
|
-
}
|
|
161
|
-
function mt(t) {
|
|
162
|
-
if (Tt.length === 0 && !gn) {
|
|
163
|
-
var e = Tt;
|
|
164
|
-
queueMicrotask(() => {
|
|
165
|
-
e === Tt && ai();
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
Tt.push(t);
|
|
169
|
-
}
|
|
170
|
-
function Ya() {
|
|
171
|
-
for (; Tt.length > 0; )
|
|
172
|
-
ai();
|
|
173
|
-
}
|
|
174
|
-
const Va = /* @__PURE__ */ new WeakMap();
|
|
175
|
-
function li(t) {
|
|
176
|
-
var e = C;
|
|
177
|
-
if (e === null)
|
|
178
|
-
return O.f |= At, t;
|
|
179
|
-
if ((e.f & Wr) === 0) {
|
|
180
|
-
if ((e.f & Gr) === 0)
|
|
181
|
-
throw !e.parent && t instanceof Error && oi(t), t;
|
|
182
|
-
e.b.error(t);
|
|
183
|
-
} else
|
|
184
|
-
Jt(t, e);
|
|
185
|
-
}
|
|
186
|
-
function Jt(t, e) {
|
|
187
|
-
for (; e !== null; ) {
|
|
188
|
-
if ((e.f & Gr) !== 0)
|
|
189
|
-
try {
|
|
190
|
-
e.b.error(t);
|
|
191
|
-
return;
|
|
192
|
-
} catch (n) {
|
|
193
|
-
t = n;
|
|
194
|
-
}
|
|
195
|
-
e = e.parent;
|
|
196
|
-
}
|
|
197
|
-
throw t instanceof Error && oi(t), t;
|
|
198
|
-
}
|
|
199
|
-
function oi(t) {
|
|
200
|
-
const e = Va.get(t);
|
|
201
|
-
e && (Kt(t, "message", {
|
|
202
|
-
value: e.message
|
|
203
|
-
}), Kt(t, "stack", {
|
|
204
|
-
value: e.stack
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
const Rn = /* @__PURE__ */ new Set();
|
|
208
|
-
let q = null, On = null, Er = /* @__PURE__ */ new Set(), Qe = [], Jn = null, Tr = !1, gn = !1;
|
|
209
|
-
class Ae {
|
|
210
|
-
/**
|
|
211
|
-
* The current values of any sources that are updated in this batch
|
|
212
|
-
* They keys of this map are identical to `this.#previous`
|
|
213
|
-
* @type {Map<Source, any>}
|
|
214
|
-
*/
|
|
215
|
-
current = /* @__PURE__ */ new Map();
|
|
216
|
-
/**
|
|
217
|
-
* The values of any sources that are updated in this batch _before_ those updates took place.
|
|
218
|
-
* They keys of this map are identical to `this.#current`
|
|
219
|
-
* @type {Map<Source, any>}
|
|
220
|
-
*/
|
|
221
|
-
#t = /* @__PURE__ */ new Map();
|
|
222
|
-
/**
|
|
223
|
-
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
224
|
-
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
225
|
-
* @type {Set<() => void>}
|
|
226
|
-
*/
|
|
227
|
-
#e = /* @__PURE__ */ new Set();
|
|
228
|
-
/**
|
|
229
|
-
* The number of async effects that are currently in flight
|
|
230
|
-
*/
|
|
231
|
-
#c = 0;
|
|
232
|
-
/**
|
|
233
|
-
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
234
|
-
* TODO replace with Promise.withResolvers once supported widely enough
|
|
235
|
-
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
236
|
-
*/
|
|
237
|
-
#i = null;
|
|
238
|
-
/**
|
|
239
|
-
* Async effects inside a newly-created `<svelte:boundary>`
|
|
240
|
-
* — these do not prevent the batch from committing
|
|
241
|
-
* @type {Effect[]}
|
|
242
|
-
*/
|
|
243
|
-
#o = [];
|
|
244
|
-
/**
|
|
245
|
-
* Template effects and `$effect.pre` effects, which run when
|
|
246
|
-
* a batch is committed
|
|
247
|
-
* @type {Effect[]}
|
|
248
|
-
*/
|
|
249
|
-
#s = [];
|
|
250
|
-
/**
|
|
251
|
-
* The same as `#render_effects`, but for `$effect` (which runs after)
|
|
252
|
-
* @type {Effect[]}
|
|
253
|
-
*/
|
|
254
|
-
#r = [];
|
|
255
|
-
/**
|
|
256
|
-
* Block effects, which may need to re-run on subsequent flushes
|
|
257
|
-
* in order to update internal sources (e.g. each block items)
|
|
258
|
-
* @type {Effect[]}
|
|
259
|
-
*/
|
|
260
|
-
#n = [];
|
|
261
|
-
/**
|
|
262
|
-
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
263
|
-
* @type {Effect[]}
|
|
264
|
-
*/
|
|
265
|
-
#a = [];
|
|
266
|
-
/**
|
|
267
|
-
* Deferred effects that are MAYBE_DIRTY
|
|
268
|
-
* @type {Effect[]}
|
|
269
|
-
*/
|
|
270
|
-
#u = [];
|
|
271
|
-
/**
|
|
272
|
-
* A set of branches that still exist, but will be destroyed when this batch
|
|
273
|
-
* is committed — we skip over these during `process`
|
|
274
|
-
* @type {Set<Effect>}
|
|
275
|
-
*/
|
|
276
|
-
skipped_effects = /* @__PURE__ */ new Set();
|
|
277
|
-
/**
|
|
278
|
-
*
|
|
279
|
-
* @param {Effect[]} root_effects
|
|
280
|
-
*/
|
|
281
|
-
process(e) {
|
|
282
|
-
Qe = [], On = null;
|
|
283
|
-
var n = Ae.apply(this);
|
|
284
|
-
for (const i of e)
|
|
285
|
-
this.#f(i);
|
|
286
|
-
if (this.#c === 0) {
|
|
287
|
-
this.#h();
|
|
288
|
-
var s = this.#s, r = this.#r;
|
|
289
|
-
this.#s = [], this.#r = [], this.#n = [], On = this, q = null, As(s), As(r), On = null, this.#i?.resolve();
|
|
290
|
-
} else
|
|
291
|
-
this.#l(this.#s), this.#l(this.#r), this.#l(this.#n);
|
|
292
|
-
n();
|
|
293
|
-
for (const i of this.#o)
|
|
294
|
-
bn(i);
|
|
295
|
-
this.#o = [];
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Traverse the effect tree, executing effects or stashing
|
|
299
|
-
* them for later execution as appropriate
|
|
300
|
-
* @param {Effect} root
|
|
301
|
-
*/
|
|
302
|
-
#f(e) {
|
|
303
|
-
e.f ^= oe;
|
|
304
|
-
for (var n = e.first; n !== null; ) {
|
|
305
|
-
var s = n.f, r = (s & (ft | _t)) !== 0, i = r && (s & oe) !== 0, a = i || (s & Ge) !== 0 || this.skipped_effects.has(n);
|
|
306
|
-
if (!a && n.fn !== null) {
|
|
307
|
-
r ? n.f ^= oe : (s & Hr) !== 0 ? this.#r.push(n) : (s & oe) === 0 && ((s & Kn) !== 0 && n.b?.is_pending() ? this.#o.push(n) : rr(n) && ((n.f & It) !== 0 && this.#n.push(n), bn(n)));
|
|
308
|
-
var u = n.first;
|
|
309
|
-
if (u !== null) {
|
|
310
|
-
n = u;
|
|
311
|
-
continue;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
var l = n.parent;
|
|
315
|
-
for (n = n.next; n === null && l !== null; )
|
|
316
|
-
n = l.next, l = l.parent;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* @param {Effect[]} effects
|
|
321
|
-
*/
|
|
322
|
-
#l(e) {
|
|
323
|
-
for (const n of e)
|
|
324
|
-
((n.f & Re) !== 0 ? this.#a : this.#u).push(n), pe(n, oe);
|
|
325
|
-
e.length = 0;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Associate a change to a given source with the current
|
|
329
|
-
* batch, noting its previous and current values
|
|
330
|
-
* @param {Source} source
|
|
331
|
-
* @param {any} value
|
|
332
|
-
*/
|
|
333
|
-
capture(e, n) {
|
|
334
|
-
this.#t.has(e) || this.#t.set(e, n), this.current.set(e, e.v);
|
|
335
|
-
}
|
|
336
|
-
activate() {
|
|
337
|
-
q = this;
|
|
338
|
-
}
|
|
339
|
-
deactivate() {
|
|
340
|
-
q = null;
|
|
341
|
-
}
|
|
342
|
-
flush() {
|
|
343
|
-
if (Qe.length > 0) {
|
|
344
|
-
if (this.activate(), ui(), q !== null && q !== this)
|
|
345
|
-
return;
|
|
346
|
-
} else this.#c === 0 && this.#h();
|
|
347
|
-
this.deactivate();
|
|
348
|
-
for (const e of Er)
|
|
349
|
-
if (Er.delete(e), e(), q !== null)
|
|
350
|
-
break;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Append and remove branches to/from the DOM
|
|
354
|
-
*/
|
|
355
|
-
#h() {
|
|
356
|
-
for (const e of this.#e)
|
|
357
|
-
e();
|
|
358
|
-
if (this.#e.clear(), Rn.size > 1) {
|
|
359
|
-
this.#t.clear();
|
|
360
|
-
let e = !0;
|
|
361
|
-
for (const n of Rn) {
|
|
362
|
-
if (n === this) {
|
|
363
|
-
e = !1;
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
for (const [s, r] of this.current) {
|
|
367
|
-
if (n.current.has(s))
|
|
368
|
-
if (e)
|
|
369
|
-
n.current.set(s, r);
|
|
370
|
-
else
|
|
371
|
-
continue;
|
|
372
|
-
ci(s);
|
|
373
|
-
}
|
|
374
|
-
if (Qe.length > 0) {
|
|
375
|
-
q = n;
|
|
376
|
-
const s = Ae.apply(n);
|
|
377
|
-
for (const r of Qe)
|
|
378
|
-
n.#f(r);
|
|
379
|
-
Qe = [], s();
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
q = null;
|
|
383
|
-
}
|
|
384
|
-
Rn.delete(this);
|
|
385
|
-
}
|
|
386
|
-
increment() {
|
|
387
|
-
this.#c += 1;
|
|
388
|
-
}
|
|
389
|
-
decrement() {
|
|
390
|
-
this.#c -= 1;
|
|
391
|
-
for (const e of this.#a)
|
|
392
|
-
pe(e, Re), $t(e);
|
|
393
|
-
for (const e of this.#u)
|
|
394
|
-
pe(e, bt), $t(e);
|
|
395
|
-
this.flush();
|
|
396
|
-
}
|
|
397
|
-
/** @param {() => void} fn */
|
|
398
|
-
add_callback(e) {
|
|
399
|
-
this.#e.add(e);
|
|
400
|
-
}
|
|
401
|
-
settled() {
|
|
402
|
-
return (this.#i ??= ei()).promise;
|
|
403
|
-
}
|
|
404
|
-
static ensure() {
|
|
405
|
-
if (q === null) {
|
|
406
|
-
const e = q = new Ae();
|
|
407
|
-
Rn.add(q), gn || Ae.enqueue(() => {
|
|
408
|
-
q === e && e.flush();
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
return q;
|
|
412
|
-
}
|
|
413
|
-
/** @param {() => void} task */
|
|
414
|
-
static enqueue(e) {
|
|
415
|
-
mt(e);
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* @param {Batch} current_batch
|
|
419
|
-
*/
|
|
420
|
-
static apply(e) {
|
|
421
|
-
return Sa;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
function ot(t) {
|
|
425
|
-
var e = gn;
|
|
426
|
-
gn = !0;
|
|
427
|
-
try {
|
|
428
|
-
for (var n; ; ) {
|
|
429
|
-
if (Ya(), Qe.length === 0 && (q?.flush(), Qe.length === 0))
|
|
430
|
-
return Jn = null, /** @type {T} */
|
|
431
|
-
n;
|
|
432
|
-
ui();
|
|
433
|
-
}
|
|
434
|
-
} finally {
|
|
435
|
-
gn = e;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
function ui() {
|
|
439
|
-
var t = Zt;
|
|
440
|
-
Tr = !0;
|
|
441
|
-
try {
|
|
442
|
-
var e = 0;
|
|
443
|
-
for ($s(!0); Qe.length > 0; ) {
|
|
444
|
-
var n = Ae.ensure();
|
|
445
|
-
if (e++ > 1e3) {
|
|
446
|
-
var s, r;
|
|
447
|
-
Za();
|
|
448
|
-
}
|
|
449
|
-
n.process(Qe), gt.clear();
|
|
450
|
-
}
|
|
451
|
-
} finally {
|
|
452
|
-
Tr = !1, $s(t), Jn = null;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
function Za() {
|
|
456
|
-
try {
|
|
457
|
-
za();
|
|
458
|
-
} catch (t) {
|
|
459
|
-
Jt(t, Jn);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
let yt = null;
|
|
463
|
-
function As(t) {
|
|
464
|
-
var e = t.length;
|
|
465
|
-
if (e !== 0) {
|
|
466
|
-
for (var n = 0; n < e; ) {
|
|
467
|
-
var s = t[n++];
|
|
468
|
-
if ((s.f & (Ot | Ge)) === 0 && rr(s) && (yt = [], bn(s), s.deps === null && s.first === null && s.nodes_start === null && (s.teardown === null && s.ac === null ? $i(s) : s.fn = null), yt?.length > 0)) {
|
|
469
|
-
gt.clear();
|
|
470
|
-
for (const r of yt)
|
|
471
|
-
bn(r);
|
|
472
|
-
yt = [];
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
yt = null;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
function ci(t) {
|
|
479
|
-
if (t.reactions !== null)
|
|
480
|
-
for (const e of t.reactions) {
|
|
481
|
-
const n = e.f;
|
|
482
|
-
(n & xe) !== 0 ? ci(
|
|
483
|
-
/** @type {Derived} */
|
|
484
|
-
e
|
|
485
|
-
) : (n & (Kn | It)) !== 0 && (pe(e, Re), $t(
|
|
486
|
-
/** @type {Effect} */
|
|
487
|
-
e
|
|
488
|
-
));
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function $t(t) {
|
|
492
|
-
for (var e = Jn = t; e.parent !== null; ) {
|
|
493
|
-
e = e.parent;
|
|
494
|
-
var n = e.f;
|
|
495
|
-
if (Tr && e === C && (n & It) !== 0)
|
|
496
|
-
return;
|
|
497
|
-
if ((n & (_t | ft)) !== 0) {
|
|
498
|
-
if ((n & oe) === 0) return;
|
|
499
|
-
e.f ^= oe;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
Qe.push(e);
|
|
503
|
-
}
|
|
504
|
-
function Ka(t) {
|
|
505
|
-
let e = 0, n = Ct(0), s;
|
|
506
|
-
return () => {
|
|
507
|
-
ul() && (m(n), nr(() => (e === 0 && (s = sr(() => t(() => vn(n)))), e += 1, () => {
|
|
508
|
-
mt(() => {
|
|
509
|
-
e -= 1, e === 0 && (s?.(), s = void 0, vn(n));
|
|
510
|
-
});
|
|
511
|
-
})));
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
var Xa = Zn | Nt | Gr;
|
|
515
|
-
function Qa(t, e, n) {
|
|
516
|
-
new Ja(t, e, n);
|
|
517
|
-
}
|
|
518
|
-
class Ja {
|
|
519
|
-
/** @type {Boundary | null} */
|
|
520
|
-
parent;
|
|
521
|
-
#t = !1;
|
|
522
|
-
/** @type {TemplateNode} */
|
|
523
|
-
#e;
|
|
524
|
-
/** @type {TemplateNode | null} */
|
|
525
|
-
#c = I ? N : null;
|
|
526
|
-
/** @type {BoundaryProps} */
|
|
527
|
-
#i;
|
|
528
|
-
/** @type {((anchor: Node) => void)} */
|
|
529
|
-
#o;
|
|
530
|
-
/** @type {Effect} */
|
|
531
|
-
#s;
|
|
532
|
-
/** @type {Effect | null} */
|
|
533
|
-
#r = null;
|
|
534
|
-
/** @type {Effect | null} */
|
|
535
|
-
#n = null;
|
|
536
|
-
/** @type {Effect | null} */
|
|
537
|
-
#a = null;
|
|
538
|
-
/** @type {DocumentFragment | null} */
|
|
539
|
-
#u = null;
|
|
540
|
-
#f = 0;
|
|
541
|
-
#l = 0;
|
|
542
|
-
#h = !1;
|
|
543
|
-
/**
|
|
544
|
-
* A source containing the number of pending async deriveds/expressions.
|
|
545
|
-
* Only created if `$effect.pending()` is used inside the boundary,
|
|
546
|
-
* otherwise updating the source results in needless `Batch.ensure()`
|
|
547
|
-
* calls followed by no-op flushes
|
|
548
|
-
* @type {Source<number> | null}
|
|
549
|
-
*/
|
|
550
|
-
#p = null;
|
|
551
|
-
#m = () => {
|
|
552
|
-
this.#p && en(this.#p, this.#f);
|
|
553
|
-
};
|
|
554
|
-
#_ = Ka(() => (this.#p = Ct(this.#f), () => {
|
|
555
|
-
this.#p = null;
|
|
556
|
-
}));
|
|
557
|
-
/**
|
|
558
|
-
* @param {TemplateNode} node
|
|
559
|
-
* @param {BoundaryProps} props
|
|
560
|
-
* @param {((anchor: Node) => void)} children
|
|
561
|
-
*/
|
|
562
|
-
constructor(e, n, s) {
|
|
563
|
-
this.#e = e, this.#i = n, this.#o = s, this.parent = /** @type {Effect} */
|
|
564
|
-
C.b, this.#t = !!this.#i.pending, this.#s = Yr(() => {
|
|
565
|
-
if (C.b = this, I) {
|
|
566
|
-
const r = this.#c;
|
|
567
|
-
Xt(), /** @type {Comment} */
|
|
568
|
-
r.nodeType === Dt && /** @type {Comment} */
|
|
569
|
-
r.data === Vn ? this.#k() : this.#b();
|
|
570
|
-
} else {
|
|
571
|
-
try {
|
|
572
|
-
this.#r = Le(() => s(this.#e));
|
|
573
|
-
} catch (r) {
|
|
574
|
-
this.error(r);
|
|
575
|
-
}
|
|
576
|
-
this.#l > 0 ? this.#g() : this.#t = !1;
|
|
577
|
-
}
|
|
578
|
-
}, Xa), I && (this.#e = N);
|
|
579
|
-
}
|
|
580
|
-
#b() {
|
|
581
|
-
try {
|
|
582
|
-
this.#r = Le(() => this.#o(this.#e));
|
|
583
|
-
} catch (e) {
|
|
584
|
-
this.error(e);
|
|
585
|
-
}
|
|
586
|
-
this.#t = !1;
|
|
587
|
-
}
|
|
588
|
-
#k() {
|
|
589
|
-
const e = this.#i.pending;
|
|
590
|
-
e && (this.#n = Le(() => e(this.#e)), Ae.enqueue(() => {
|
|
591
|
-
this.#r = this.#d(() => (Ae.ensure(), Le(() => this.#o(this.#e)))), this.#l > 0 ? this.#g() : (Vt(
|
|
592
|
-
/** @type {Effect} */
|
|
593
|
-
this.#n,
|
|
594
|
-
() => {
|
|
595
|
-
this.#n = null;
|
|
596
|
-
}
|
|
597
|
-
), this.#t = !1);
|
|
598
|
-
}));
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Returns `true` if the effect exists inside a boundary whose pending snippet is shown
|
|
602
|
-
* @returns {boolean}
|
|
603
|
-
*/
|
|
604
|
-
is_pending() {
|
|
605
|
-
return this.#t || !!this.parent && this.parent.is_pending();
|
|
606
|
-
}
|
|
607
|
-
has_pending_snippet() {
|
|
608
|
-
return !!this.#i.pending;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* @param {() => Effect | null} fn
|
|
612
|
-
*/
|
|
613
|
-
#d(e) {
|
|
614
|
-
var n = C, s = O, r = $e;
|
|
615
|
-
Je(this.#s), we(this.#s), Qt(this.#s.ctx);
|
|
616
|
-
try {
|
|
617
|
-
return e();
|
|
618
|
-
} catch (i) {
|
|
619
|
-
return li(i), null;
|
|
620
|
-
} finally {
|
|
621
|
-
Je(n), we(s), Qt(r);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
#g() {
|
|
625
|
-
const e = (
|
|
626
|
-
/** @type {(anchor: Node) => void} */
|
|
627
|
-
this.#i.pending
|
|
628
|
-
);
|
|
629
|
-
this.#r !== null && (this.#u = document.createDocumentFragment(), el(this.#r, this.#u)), this.#n === null && (this.#n = Le(() => e(this.#e)));
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Updates the pending count associated with the currently visible pending snippet,
|
|
633
|
-
* if any, such that we can replace the snippet with content once work is done
|
|
634
|
-
* @param {1 | -1} d
|
|
635
|
-
*/
|
|
636
|
-
#v(e) {
|
|
637
|
-
if (!this.has_pending_snippet()) {
|
|
638
|
-
this.parent && this.parent.#v(e);
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
this.#l += e, this.#l === 0 && (this.#t = !1, this.#n && Vt(this.#n, () => {
|
|
642
|
-
this.#n = null;
|
|
643
|
-
}), this.#u && (this.#e.before(this.#u), this.#u = null), mt(() => {
|
|
644
|
-
Ae.ensure().flush();
|
|
645
|
-
}));
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Update the source that powers `$effect.pending()` inside this boundary,
|
|
649
|
-
* and controls when the current `pending` snippet (if any) is removed.
|
|
650
|
-
* Do not call from inside the class
|
|
651
|
-
* @param {1 | -1} d
|
|
652
|
-
*/
|
|
653
|
-
update_pending_count(e) {
|
|
654
|
-
this.#v(e), this.#f += e, Er.add(this.#m);
|
|
655
|
-
}
|
|
656
|
-
get_effect_pending() {
|
|
657
|
-
return this.#_(), m(
|
|
658
|
-
/** @type {Source<number>} */
|
|
659
|
-
this.#p
|
|
660
|
-
);
|
|
661
|
-
}
|
|
662
|
-
/** @param {unknown} error */
|
|
663
|
-
error(e) {
|
|
664
|
-
var n = this.#i.onerror;
|
|
665
|
-
let s = this.#i.failed;
|
|
666
|
-
if (this.#h || !n && !s)
|
|
667
|
-
throw e;
|
|
668
|
-
this.#r && (Se(this.#r), this.#r = null), this.#n && (Se(this.#n), this.#n = null), this.#a && (Se(this.#a), this.#a = null), I && (ue(
|
|
669
|
-
/** @type {TemplateNode} */
|
|
670
|
-
this.#c
|
|
671
|
-
), ti(), ue(zn()));
|
|
672
|
-
var r = !1, i = !1;
|
|
673
|
-
const a = () => {
|
|
674
|
-
if (r) {
|
|
675
|
-
Wa();
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
r = !0, i && Ga(), Ae.ensure(), this.#f = 0, this.#a !== null && Vt(this.#a, () => {
|
|
679
|
-
this.#a = null;
|
|
680
|
-
}), this.#t = this.has_pending_snippet(), this.#r = this.#d(() => (this.#h = !1, Le(() => this.#o(this.#e)))), this.#l > 0 ? this.#g() : this.#t = !1;
|
|
681
|
-
};
|
|
682
|
-
var u = O;
|
|
683
|
-
try {
|
|
684
|
-
we(null), i = !0, n?.(e, a), i = !1;
|
|
685
|
-
} catch (l) {
|
|
686
|
-
Jt(l, this.#s && this.#s.parent);
|
|
687
|
-
} finally {
|
|
688
|
-
we(u);
|
|
689
|
-
}
|
|
690
|
-
s && mt(() => {
|
|
691
|
-
this.#a = this.#d(() => {
|
|
692
|
-
this.#h = !0;
|
|
693
|
-
try {
|
|
694
|
-
return Le(() => {
|
|
695
|
-
s(
|
|
696
|
-
this.#e,
|
|
697
|
-
() => e,
|
|
698
|
-
() => a
|
|
699
|
-
);
|
|
700
|
-
});
|
|
701
|
-
} catch (l) {
|
|
702
|
-
return Jt(
|
|
703
|
-
l,
|
|
704
|
-
/** @type {Effect} */
|
|
705
|
-
this.#s.parent
|
|
706
|
-
), null;
|
|
707
|
-
} finally {
|
|
708
|
-
this.#h = !1;
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
function el(t, e) {
|
|
715
|
-
for (var n = t.nodes_start, s = t.nodes_end; n !== null; ) {
|
|
716
|
-
var r = n === s ? null : (
|
|
717
|
-
/** @type {TemplateNode} */
|
|
718
|
-
/* @__PURE__ */ We(n)
|
|
719
|
-
);
|
|
720
|
-
e.append(n), n = r;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function tl(t, e, n) {
|
|
724
|
-
const s = er;
|
|
725
|
-
if (e.length === 0) {
|
|
726
|
-
n(t.map(s));
|
|
727
|
-
return;
|
|
728
|
-
}
|
|
729
|
-
var r = q, i = (
|
|
730
|
-
/** @type {Effect} */
|
|
731
|
-
C
|
|
732
|
-
), a = nl(), u = I;
|
|
733
|
-
Promise.all(e.map((l) => /* @__PURE__ */ rl(l))).then((l) => {
|
|
734
|
-
a();
|
|
735
|
-
try {
|
|
736
|
-
n([...t.map(s), ...l]);
|
|
737
|
-
} catch (c) {
|
|
738
|
-
(i.f & Ot) === 0 && Jt(c, i);
|
|
739
|
-
}
|
|
740
|
-
u && He(!1), r?.deactivate(), fi();
|
|
741
|
-
}).catch((l) => {
|
|
742
|
-
Jt(l, i);
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
function nl() {
|
|
746
|
-
var t = C, e = O, n = $e, s = q, r = I;
|
|
747
|
-
if (r)
|
|
748
|
-
var i = N;
|
|
749
|
-
return function() {
|
|
750
|
-
Je(t), we(e), Qt(n), s?.activate(), r && (He(!0), ue(i));
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
|
-
function fi() {
|
|
754
|
-
Je(null), we(null), Qt(null);
|
|
755
|
-
}
|
|
756
|
-
// @__NO_SIDE_EFFECTS__
|
|
757
|
-
function er(t) {
|
|
758
|
-
var e = xe | Re, n = O !== null && (O.f & xe) !== 0 ? (
|
|
759
|
-
/** @type {Derived} */
|
|
760
|
-
O
|
|
761
|
-
) : null;
|
|
762
|
-
return C === null || n !== null && (n.f & Ie) !== 0 ? e |= Ie : C.f |= Nt, {
|
|
763
|
-
ctx: $e,
|
|
764
|
-
deps: null,
|
|
765
|
-
effects: null,
|
|
766
|
-
equals: ri,
|
|
767
|
-
f: e,
|
|
768
|
-
fn: t,
|
|
769
|
-
reactions: null,
|
|
770
|
-
rv: 0,
|
|
771
|
-
v: (
|
|
772
|
-
/** @type {V} */
|
|
773
|
-
re
|
|
774
|
-
),
|
|
775
|
-
wv: 0,
|
|
776
|
-
parent: n ?? C,
|
|
777
|
-
ac: null
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
// @__NO_SIDE_EFFECTS__
|
|
781
|
-
function rl(t, e) {
|
|
782
|
-
let n = (
|
|
783
|
-
/** @type {Effect | null} */
|
|
784
|
-
C
|
|
785
|
-
);
|
|
786
|
-
n === null && Na();
|
|
787
|
-
var s = (
|
|
788
|
-
/** @type {Boundary} */
|
|
789
|
-
n.b
|
|
790
|
-
), r = (
|
|
791
|
-
/** @type {Promise<V>} */
|
|
792
|
-
/** @type {unknown} */
|
|
793
|
-
void 0
|
|
794
|
-
), i = Ct(
|
|
795
|
-
/** @type {V} */
|
|
796
|
-
re
|
|
797
|
-
), a = !O, u = /* @__PURE__ */ new Map();
|
|
798
|
-
return hl(() => {
|
|
799
|
-
var l = ei();
|
|
800
|
-
r = l.promise;
|
|
801
|
-
try {
|
|
802
|
-
Promise.resolve(t()).then(l.resolve, l.reject);
|
|
803
|
-
} catch (p) {
|
|
804
|
-
l.reject(p);
|
|
805
|
-
}
|
|
806
|
-
var c = (
|
|
807
|
-
/** @type {Batch} */
|
|
808
|
-
q
|
|
809
|
-
), f = s.is_pending();
|
|
810
|
-
a && (s.update_pending_count(1), f || (c.increment(), u.get(c)?.reject(dn), u.set(c, l)));
|
|
811
|
-
const d = (p, v = void 0) => {
|
|
812
|
-
f || c.activate(), v ? v !== dn && (i.f |= At, en(i, v)) : ((i.f & At) !== 0 && (i.f ^= At), en(i, p)), a && (s.update_pending_count(-1), f || c.decrement()), fi();
|
|
813
|
-
};
|
|
814
|
-
l.promise.then(d, (p) => d(null, p || "unknown"));
|
|
815
|
-
}), xi(() => {
|
|
816
|
-
for (const l of u.values())
|
|
817
|
-
l.reject(dn);
|
|
818
|
-
}), new Promise((l) => {
|
|
819
|
-
function c(f) {
|
|
820
|
-
function d() {
|
|
821
|
-
f === r ? l(i) : c(r);
|
|
822
|
-
}
|
|
823
|
-
f.then(d, d);
|
|
824
|
-
}
|
|
825
|
-
c(r);
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
// @__NO_SIDE_EFFECTS__
|
|
829
|
-
function rn(t) {
|
|
830
|
-
const e = /* @__PURE__ */ er(t);
|
|
831
|
-
return Ii(e), e;
|
|
832
|
-
}
|
|
833
|
-
// @__NO_SIDE_EFFECTS__
|
|
834
|
-
function sl(t) {
|
|
835
|
-
const e = /* @__PURE__ */ er(t);
|
|
836
|
-
return e.equals = si, e;
|
|
837
|
-
}
|
|
838
|
-
function hi(t) {
|
|
839
|
-
var e = t.effects;
|
|
840
|
-
if (e !== null) {
|
|
841
|
-
t.effects = null;
|
|
842
|
-
for (var n = 0; n < e.length; n += 1)
|
|
843
|
-
Se(
|
|
844
|
-
/** @type {Effect} */
|
|
845
|
-
e[n]
|
|
846
|
-
);
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
function il(t) {
|
|
850
|
-
for (var e = t.parent; e !== null; ) {
|
|
851
|
-
if ((e.f & xe) === 0)
|
|
852
|
-
return (
|
|
853
|
-
/** @type {Effect} */
|
|
854
|
-
e
|
|
855
|
-
);
|
|
856
|
-
e = e.parent;
|
|
857
|
-
}
|
|
858
|
-
return null;
|
|
859
|
-
}
|
|
860
|
-
function jr(t) {
|
|
861
|
-
var e, n = C;
|
|
862
|
-
Je(il(t));
|
|
863
|
-
try {
|
|
864
|
-
hi(t), e = Mi(t);
|
|
865
|
-
} finally {
|
|
866
|
-
Je(n);
|
|
867
|
-
}
|
|
868
|
-
return e;
|
|
869
|
-
}
|
|
870
|
-
function pi(t) {
|
|
871
|
-
var e = jr(t);
|
|
872
|
-
if (t.equals(e) || (t.v = e, t.wv = Ni()), !Mt) {
|
|
873
|
-
var n = (dt || (t.f & Ie) !== 0) && t.deps !== null ? bt : oe;
|
|
874
|
-
pe(t, n);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
const gt = /* @__PURE__ */ new Map();
|
|
878
|
-
function Ct(t, e) {
|
|
879
|
-
var n = {
|
|
880
|
-
f: 0,
|
|
881
|
-
// TODO ideally we could skip this altogether, but it causes type errors
|
|
882
|
-
v: t,
|
|
883
|
-
reactions: null,
|
|
884
|
-
equals: ri,
|
|
885
|
-
rv: 0,
|
|
886
|
-
wv: 0
|
|
887
|
-
};
|
|
888
|
-
return n;
|
|
889
|
-
}
|
|
890
|
-
// @__NO_SIDE_EFFECTS__
|
|
891
|
-
function le(t, e) {
|
|
892
|
-
const n = Ct(t);
|
|
893
|
-
return Ii(n), n;
|
|
894
|
-
}
|
|
895
|
-
// @__NO_SIDE_EFFECTS__
|
|
896
|
-
function di(t, e = !1, n = !0) {
|
|
897
|
-
const s = Ct(t);
|
|
898
|
-
return e || (s.equals = si), s;
|
|
899
|
-
}
|
|
900
|
-
function F(t, e, n = !1) {
|
|
901
|
-
O !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
|
|
902
|
-
// to ensure we error if state is set inside an inspect effect
|
|
903
|
-
(!Fe || (O.f & Ts) !== 0) && ii() && (O.f & (xe | It | Kn | Ts)) !== 0 && !ut?.includes(t) && Ba();
|
|
904
|
-
let s = n ? jt(e) : e;
|
|
905
|
-
return en(t, s);
|
|
906
|
-
}
|
|
907
|
-
function en(t, e) {
|
|
908
|
-
if (!t.equals(e)) {
|
|
909
|
-
var n = t.v;
|
|
910
|
-
Mt ? gt.set(t, e) : gt.set(t, n), t.v = e;
|
|
911
|
-
var s = Ae.ensure();
|
|
912
|
-
s.capture(t, n), (t.f & xe) !== 0 && ((t.f & Re) !== 0 && jr(
|
|
913
|
-
/** @type {Derived} */
|
|
914
|
-
t
|
|
915
|
-
), pe(t, (t.f & Ie) === 0 ? oe : bt)), t.wv = Ni(), gi(t, Re), C !== null && (C.f & oe) !== 0 && (C.f & (ft | _t)) === 0 && (Ce === null ? dl([t]) : Ce.push(t));
|
|
916
|
-
}
|
|
917
|
-
return e;
|
|
918
|
-
}
|
|
919
|
-
function vn(t) {
|
|
920
|
-
F(t, t.v + 1);
|
|
921
|
-
}
|
|
922
|
-
function gi(t, e) {
|
|
923
|
-
var n = t.reactions;
|
|
924
|
-
if (n !== null)
|
|
925
|
-
for (var s = n.length, r = 0; r < s; r++) {
|
|
926
|
-
var i = n[r], a = i.f, u = (a & Re) === 0;
|
|
927
|
-
u && pe(i, e), (a & xe) !== 0 ? gi(
|
|
928
|
-
/** @type {Derived} */
|
|
929
|
-
i,
|
|
930
|
-
bt
|
|
931
|
-
) : u && ((a & It) !== 0 && yt !== null && yt.push(
|
|
932
|
-
/** @type {Effect} */
|
|
933
|
-
i
|
|
934
|
-
), $t(
|
|
935
|
-
/** @type {Effect} */
|
|
936
|
-
i
|
|
937
|
-
));
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
function jt(t) {
|
|
941
|
-
if (typeof t != "object" || t === null || In in t)
|
|
942
|
-
return t;
|
|
943
|
-
const e = Js(t);
|
|
944
|
-
if (e !== Ta && e !== Aa)
|
|
945
|
-
return t;
|
|
946
|
-
var n = /* @__PURE__ */ new Map(), s = Ur(t), r = /* @__PURE__ */ le(0), i = St, a = (u) => {
|
|
947
|
-
if (St === i)
|
|
948
|
-
return u();
|
|
949
|
-
var l = O, c = St;
|
|
950
|
-
we(null), Ls(i);
|
|
951
|
-
var f = u();
|
|
952
|
-
return we(l), Ls(c), f;
|
|
953
|
-
};
|
|
954
|
-
return s && n.set("length", /* @__PURE__ */ le(
|
|
955
|
-
/** @type {any[]} */
|
|
956
|
-
t.length
|
|
957
|
-
)), new Proxy(
|
|
958
|
-
/** @type {any} */
|
|
959
|
-
t,
|
|
960
|
-
{
|
|
961
|
-
defineProperty(u, l, c) {
|
|
962
|
-
(!("value" in c) || c.configurable === !1 || c.enumerable === !1 || c.writable === !1) && Fa();
|
|
963
|
-
var f = n.get(l);
|
|
964
|
-
return f === void 0 ? f = a(() => {
|
|
965
|
-
var d = /* @__PURE__ */ le(c.value);
|
|
966
|
-
return n.set(l, d), d;
|
|
967
|
-
}) : F(f, c.value, !0), !0;
|
|
968
|
-
},
|
|
969
|
-
deleteProperty(u, l) {
|
|
970
|
-
var c = n.get(l);
|
|
971
|
-
if (c === void 0) {
|
|
972
|
-
if (l in u) {
|
|
973
|
-
const f = a(() => /* @__PURE__ */ le(re));
|
|
974
|
-
n.set(l, f), vn(r);
|
|
975
|
-
}
|
|
976
|
-
} else
|
|
977
|
-
F(c, re), vn(r);
|
|
978
|
-
return !0;
|
|
979
|
-
},
|
|
980
|
-
get(u, l, c) {
|
|
981
|
-
if (l === In)
|
|
982
|
-
return t;
|
|
983
|
-
var f = n.get(l), d = l in u;
|
|
984
|
-
if (f === void 0 && (!d || Yt(u, l)?.writable) && (f = a(() => {
|
|
985
|
-
var v = jt(d ? u[l] : re), h = /* @__PURE__ */ le(v);
|
|
986
|
-
return h;
|
|
987
|
-
}), n.set(l, f)), f !== void 0) {
|
|
988
|
-
var p = m(f);
|
|
989
|
-
return p === re ? void 0 : p;
|
|
990
|
-
}
|
|
991
|
-
return Reflect.get(u, l, c);
|
|
992
|
-
},
|
|
993
|
-
getOwnPropertyDescriptor(u, l) {
|
|
994
|
-
var c = Reflect.getOwnPropertyDescriptor(u, l);
|
|
995
|
-
if (c && "value" in c) {
|
|
996
|
-
var f = n.get(l);
|
|
997
|
-
f && (c.value = m(f));
|
|
998
|
-
} else if (c === void 0) {
|
|
999
|
-
var d = n.get(l), p = d?.v;
|
|
1000
|
-
if (d !== void 0 && p !== re)
|
|
1001
|
-
return {
|
|
1002
|
-
enumerable: !0,
|
|
1003
|
-
configurable: !0,
|
|
1004
|
-
value: p,
|
|
1005
|
-
writable: !0
|
|
1006
|
-
};
|
|
1007
|
-
}
|
|
1008
|
-
return c;
|
|
1009
|
-
},
|
|
1010
|
-
has(u, l) {
|
|
1011
|
-
if (l === In)
|
|
1012
|
-
return !0;
|
|
1013
|
-
var c = n.get(l), f = c !== void 0 && c.v !== re || Reflect.has(u, l);
|
|
1014
|
-
if (c !== void 0 || C !== null && (!f || Yt(u, l)?.writable)) {
|
|
1015
|
-
c === void 0 && (c = a(() => {
|
|
1016
|
-
var p = f ? jt(u[l]) : re, v = /* @__PURE__ */ le(p);
|
|
1017
|
-
return v;
|
|
1018
|
-
}), n.set(l, c));
|
|
1019
|
-
var d = m(c);
|
|
1020
|
-
if (d === re)
|
|
1021
|
-
return !1;
|
|
1022
|
-
}
|
|
1023
|
-
return f;
|
|
1024
|
-
},
|
|
1025
|
-
set(u, l, c, f) {
|
|
1026
|
-
var d = n.get(l), p = l in u;
|
|
1027
|
-
if (s && l === "length")
|
|
1028
|
-
for (var v = c; v < /** @type {Source<number>} */
|
|
1029
|
-
d.v; v += 1) {
|
|
1030
|
-
var h = n.get(v + "");
|
|
1031
|
-
h !== void 0 ? F(h, re) : v in u && (h = a(() => /* @__PURE__ */ le(re)), n.set(v + "", h));
|
|
1032
|
-
}
|
|
1033
|
-
if (d === void 0)
|
|
1034
|
-
(!p || Yt(u, l)?.writable) && (d = a(() => /* @__PURE__ */ le(void 0)), F(d, jt(c)), n.set(l, d));
|
|
1035
|
-
else {
|
|
1036
|
-
p = d.v !== re;
|
|
1037
|
-
var x = a(() => jt(c));
|
|
1038
|
-
F(d, x);
|
|
1039
|
-
}
|
|
1040
|
-
var T = Reflect.getOwnPropertyDescriptor(u, l);
|
|
1041
|
-
if (T?.set && T.set.call(f, c), !p) {
|
|
1042
|
-
if (s && typeof l == "string") {
|
|
1043
|
-
var R = (
|
|
1044
|
-
/** @type {Source<number>} */
|
|
1045
|
-
n.get("length")
|
|
1046
|
-
), w = Number(l);
|
|
1047
|
-
Number.isInteger(w) && w >= R.v && F(R, w + 1);
|
|
1048
|
-
}
|
|
1049
|
-
vn(r);
|
|
1050
|
-
}
|
|
1051
|
-
return !0;
|
|
1052
|
-
},
|
|
1053
|
-
ownKeys(u) {
|
|
1054
|
-
m(r);
|
|
1055
|
-
var l = Reflect.ownKeys(u).filter((d) => {
|
|
1056
|
-
var p = n.get(d);
|
|
1057
|
-
return p === void 0 || p.v !== re;
|
|
1058
|
-
});
|
|
1059
|
-
for (var [c, f] of n)
|
|
1060
|
-
f.v !== re && !(c in u) && l.push(c);
|
|
1061
|
-
return l;
|
|
1062
|
-
},
|
|
1063
|
-
setPrototypeOf() {
|
|
1064
|
-
Ha();
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
);
|
|
1068
|
-
}
|
|
1069
|
-
var Ss, vi, mi, _i;
|
|
1070
|
-
function Ar() {
|
|
1071
|
-
if (Ss === void 0) {
|
|
1072
|
-
Ss = window, vi = /Firefox/.test(navigator.userAgent);
|
|
1073
|
-
var t = Element.prototype, e = Node.prototype, n = Text.prototype;
|
|
1074
|
-
mi = Yt(e, "firstChild").get, _i = Yt(e, "nextSibling").get, Es(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), Es(n) && (n.__t = void 0);
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
function ct(t = "") {
|
|
1078
|
-
return document.createTextNode(t);
|
|
1079
|
-
}
|
|
1080
|
-
// @__NO_SIDE_EFFECTS__
|
|
1081
|
-
function Be(t) {
|
|
1082
|
-
return mi.call(t);
|
|
1083
|
-
}
|
|
1084
|
-
// @__NO_SIDE_EFFECTS__
|
|
1085
|
-
function We(t) {
|
|
1086
|
-
return _i.call(t);
|
|
1087
|
-
}
|
|
1088
|
-
function Q(t, e) {
|
|
1089
|
-
if (!I)
|
|
1090
|
-
return /* @__PURE__ */ Be(t);
|
|
1091
|
-
var n = (
|
|
1092
|
-
/** @type {TemplateNode} */
|
|
1093
|
-
/* @__PURE__ */ Be(N)
|
|
1094
|
-
);
|
|
1095
|
-
if (n === null)
|
|
1096
|
-
n = N.appendChild(ct());
|
|
1097
|
-
else if (e && n.nodeType !== qr) {
|
|
1098
|
-
var s = ct();
|
|
1099
|
-
return n?.before(s), ue(s), s;
|
|
1100
|
-
}
|
|
1101
|
-
return ue(n), n;
|
|
1102
|
-
}
|
|
1103
|
-
function Un(t, e = !1) {
|
|
1104
|
-
if (!I) {
|
|
1105
|
-
var n = (
|
|
1106
|
-
/** @type {DocumentFragment} */
|
|
1107
|
-
/* @__PURE__ */ Be(
|
|
1108
|
-
/** @type {Node} */
|
|
1109
|
-
t
|
|
1110
|
-
)
|
|
1111
|
-
);
|
|
1112
|
-
return n instanceof Comment && n.data === "" ? /* @__PURE__ */ We(n) : n;
|
|
1113
|
-
}
|
|
1114
|
-
if (e && N?.nodeType !== qr) {
|
|
1115
|
-
var s = ct();
|
|
1116
|
-
return N?.before(s), ue(s), s;
|
|
1117
|
-
}
|
|
1118
|
-
return N;
|
|
1119
|
-
}
|
|
1120
|
-
function ke(t, e = 1, n = !1) {
|
|
1121
|
-
let s = I ? N : t;
|
|
1122
|
-
for (var r; e--; )
|
|
1123
|
-
r = s, s = /** @type {TemplateNode} */
|
|
1124
|
-
/* @__PURE__ */ We(s);
|
|
1125
|
-
if (!I)
|
|
1126
|
-
return s;
|
|
1127
|
-
if (n && s?.nodeType !== qr) {
|
|
1128
|
-
var i = ct();
|
|
1129
|
-
return s === null ? r?.after(i) : s.before(i), ue(i), i;
|
|
1130
|
-
}
|
|
1131
|
-
return ue(s), /** @type {TemplateNode} */
|
|
1132
|
-
s;
|
|
1133
|
-
}
|
|
1134
|
-
function bi(t) {
|
|
1135
|
-
t.textContent = "";
|
|
1136
|
-
}
|
|
1137
|
-
function ki() {
|
|
1138
|
-
return !1;
|
|
1139
|
-
}
|
|
1140
|
-
let Rs = !1;
|
|
1141
|
-
function wi() {
|
|
1142
|
-
Rs || (Rs = !0, document.addEventListener(
|
|
1143
|
-
"reset",
|
|
1144
|
-
(t) => {
|
|
1145
|
-
Promise.resolve().then(() => {
|
|
1146
|
-
if (!t.defaultPrevented)
|
|
1147
|
-
for (
|
|
1148
|
-
const e of
|
|
1149
|
-
/**@type {HTMLFormElement} */
|
|
1150
|
-
t.target.elements
|
|
1151
|
-
)
|
|
1152
|
-
e.__on_r?.();
|
|
1153
|
-
});
|
|
1154
|
-
},
|
|
1155
|
-
// In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
|
|
1156
|
-
{ capture: !0 }
|
|
1157
|
-
));
|
|
1158
|
-
}
|
|
1159
|
-
function tr(t) {
|
|
1160
|
-
var e = O, n = C;
|
|
1161
|
-
we(null), Je(null);
|
|
1162
|
-
try {
|
|
1163
|
-
return t();
|
|
1164
|
-
} finally {
|
|
1165
|
-
we(e), Je(n);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
function al(t, e, n, s = n) {
|
|
1169
|
-
t.addEventListener(e, () => tr(n));
|
|
1170
|
-
const r = t.__on_r;
|
|
1171
|
-
r ? t.__on_r = () => {
|
|
1172
|
-
r(), s(!0);
|
|
1173
|
-
} : t.__on_r = () => s(!0), wi();
|
|
1174
|
-
}
|
|
1175
|
-
function ll(t) {
|
|
1176
|
-
C === null && O === null && Pa(), O !== null && (O.f & Ie) !== 0 && C === null && Ma(), Mt && Da();
|
|
1177
|
-
}
|
|
1178
|
-
function ol(t, e) {
|
|
1179
|
-
var n = e.last;
|
|
1180
|
-
n === null ? e.last = e.first = t : (n.next = t, t.prev = n, e.last = t);
|
|
1181
|
-
}
|
|
1182
|
-
function et(t, e, n, s = !0) {
|
|
1183
|
-
var r = C;
|
|
1184
|
-
r !== null && (r.f & Ge) !== 0 && (t |= Ge);
|
|
1185
|
-
var i = {
|
|
1186
|
-
ctx: $e,
|
|
1187
|
-
deps: null,
|
|
1188
|
-
nodes_start: null,
|
|
1189
|
-
nodes_end: null,
|
|
1190
|
-
f: t | Re,
|
|
1191
|
-
first: null,
|
|
1192
|
-
fn: e,
|
|
1193
|
-
last: null,
|
|
1194
|
-
next: null,
|
|
1195
|
-
parent: r,
|
|
1196
|
-
b: r && r.b,
|
|
1197
|
-
prev: null,
|
|
1198
|
-
teardown: null,
|
|
1199
|
-
transitions: null,
|
|
1200
|
-
wv: 0,
|
|
1201
|
-
ac: null
|
|
1202
|
-
};
|
|
1203
|
-
if (n)
|
|
1204
|
-
try {
|
|
1205
|
-
bn(i), i.f |= Wr;
|
|
1206
|
-
} catch (l) {
|
|
1207
|
-
throw Se(i), l;
|
|
1208
|
-
}
|
|
1209
|
-
else e !== null && $t(i);
|
|
1210
|
-
if (s) {
|
|
1211
|
-
var a = i;
|
|
1212
|
-
if (n && a.deps === null && a.teardown === null && a.nodes_start === null && a.first === a.last && // either `null`, or a singular child
|
|
1213
|
-
(a.f & Nt) === 0 && (a = a.first), a !== null && (a.parent = r, r !== null && ol(a, r), O !== null && (O.f & xe) !== 0 && (t & _t) === 0)) {
|
|
1214
|
-
var u = (
|
|
1215
|
-
/** @type {Derived} */
|
|
1216
|
-
O
|
|
1217
|
-
);
|
|
1218
|
-
(u.effects ??= []).push(a);
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
return i;
|
|
1222
|
-
}
|
|
1223
|
-
function ul() {
|
|
1224
|
-
return O !== null && !Fe;
|
|
1225
|
-
}
|
|
1226
|
-
function xi(t) {
|
|
1227
|
-
const e = et(Br, null, !1);
|
|
1228
|
-
return pe(e, oe), e.teardown = t, e;
|
|
1229
|
-
}
|
|
1230
|
-
function yi(t) {
|
|
1231
|
-
ll();
|
|
1232
|
-
var e = (
|
|
1233
|
-
/** @type {Effect} */
|
|
1234
|
-
C.f
|
|
1235
|
-
), n = !O && (e & ft) !== 0 && (e & Wr) === 0;
|
|
1236
|
-
if (n) {
|
|
1237
|
-
var s = (
|
|
1238
|
-
/** @type {ComponentContext} */
|
|
1239
|
-
$e
|
|
1240
|
-
);
|
|
1241
|
-
(s.e ??= []).push(t);
|
|
1242
|
-
} else
|
|
1243
|
-
return Ei(t);
|
|
1244
|
-
}
|
|
1245
|
-
function Ei(t) {
|
|
1246
|
-
return et(Hr | Ca, t, !1);
|
|
1247
|
-
}
|
|
1248
|
-
function cl(t) {
|
|
1249
|
-
Ae.ensure();
|
|
1250
|
-
const e = et(_t | Nt, t, !0);
|
|
1251
|
-
return () => {
|
|
1252
|
-
Se(e);
|
|
1253
|
-
};
|
|
1254
|
-
}
|
|
1255
|
-
function fl(t) {
|
|
1256
|
-
Ae.ensure();
|
|
1257
|
-
const e = et(_t | Nt, t, !0);
|
|
1258
|
-
return (n = {}) => new Promise((s) => {
|
|
1259
|
-
n.outro ? Vt(e, () => {
|
|
1260
|
-
Se(e), s(void 0);
|
|
1261
|
-
}) : (Se(e), s(void 0));
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
function Ti(t) {
|
|
1265
|
-
return et(Hr, t, !1);
|
|
1266
|
-
}
|
|
1267
|
-
function hl(t) {
|
|
1268
|
-
return et(Kn | Nt, t, !0);
|
|
1269
|
-
}
|
|
1270
|
-
function nr(t, e = 0) {
|
|
1271
|
-
return et(Br | e, t, !0);
|
|
1272
|
-
}
|
|
1273
|
-
function pt(t, e = [], n = []) {
|
|
1274
|
-
tl(e, n, (s) => {
|
|
1275
|
-
et(Br, () => t(...s.map(m)), !0);
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
function Yr(t, e = 0) {
|
|
1279
|
-
var n = et(It | e, t, !0);
|
|
1280
|
-
return n;
|
|
1281
|
-
}
|
|
1282
|
-
function Le(t, e = !0) {
|
|
1283
|
-
return et(ft | Nt, t, !0, e);
|
|
1284
|
-
}
|
|
1285
|
-
function Ai(t) {
|
|
1286
|
-
var e = t.teardown;
|
|
1287
|
-
if (e !== null) {
|
|
1288
|
-
const n = Mt, s = O;
|
|
1289
|
-
Cs(!0), we(null);
|
|
1290
|
-
try {
|
|
1291
|
-
e.call(null);
|
|
1292
|
-
} finally {
|
|
1293
|
-
Cs(n), we(s);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
function Si(t, e = !1) {
|
|
1298
|
-
var n = t.first;
|
|
1299
|
-
for (t.first = t.last = null; n !== null; ) {
|
|
1300
|
-
const r = n.ac;
|
|
1301
|
-
r !== null && tr(() => {
|
|
1302
|
-
r.abort(dn);
|
|
1303
|
-
});
|
|
1304
|
-
var s = n.next;
|
|
1305
|
-
(n.f & _t) !== 0 ? n.parent = null : Se(n, e), n = s;
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
function pl(t) {
|
|
1309
|
-
for (var e = t.first; e !== null; ) {
|
|
1310
|
-
var n = e.next;
|
|
1311
|
-
(e.f & ft) === 0 && Se(e), e = n;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
function Se(t, e = !0) {
|
|
1315
|
-
var n = !1;
|
|
1316
|
-
(e || (t.f & $a) !== 0) && t.nodes_start !== null && t.nodes_end !== null && (Ri(
|
|
1317
|
-
t.nodes_start,
|
|
1318
|
-
/** @type {TemplateNode} */
|
|
1319
|
-
t.nodes_end
|
|
1320
|
-
), n = !0), Si(t, e && !n), Fn(t, 0), pe(t, Ot);
|
|
1321
|
-
var s = t.transitions;
|
|
1322
|
-
if (s !== null)
|
|
1323
|
-
for (const i of s)
|
|
1324
|
-
i.stop();
|
|
1325
|
-
Ai(t);
|
|
1326
|
-
var r = t.parent;
|
|
1327
|
-
r !== null && r.first !== null && $i(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes_start = t.nodes_end = t.ac = null;
|
|
1328
|
-
}
|
|
1329
|
-
function Ri(t, e) {
|
|
1330
|
-
for (; t !== null; ) {
|
|
1331
|
-
var n = t === e ? null : (
|
|
1332
|
-
/** @type {TemplateNode} */
|
|
1333
|
-
/* @__PURE__ */ We(t)
|
|
1334
|
-
);
|
|
1335
|
-
t.remove(), t = n;
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
function $i(t) {
|
|
1339
|
-
var e = t.parent, n = t.prev, s = t.next;
|
|
1340
|
-
n !== null && (n.next = s), s !== null && (s.prev = n), e !== null && (e.first === t && (e.first = s), e.last === t && (e.last = n));
|
|
1341
|
-
}
|
|
1342
|
-
function Vt(t, e) {
|
|
1343
|
-
var n = [];
|
|
1344
|
-
Vr(t, n, !0), Ci(n, () => {
|
|
1345
|
-
Se(t), e && e();
|
|
1346
|
-
});
|
|
1347
|
-
}
|
|
1348
|
-
function Ci(t, e) {
|
|
1349
|
-
var n = t.length;
|
|
1350
|
-
if (n > 0) {
|
|
1351
|
-
var s = () => --n || e();
|
|
1352
|
-
for (var r of t)
|
|
1353
|
-
r.out(s);
|
|
1354
|
-
} else
|
|
1355
|
-
e();
|
|
1356
|
-
}
|
|
1357
|
-
function Vr(t, e, n) {
|
|
1358
|
-
if ((t.f & Ge) === 0) {
|
|
1359
|
-
if (t.f ^= Ge, t.transitions !== null)
|
|
1360
|
-
for (const a of t.transitions)
|
|
1361
|
-
(a.is_global || n) && e.push(a);
|
|
1362
|
-
for (var s = t.first; s !== null; ) {
|
|
1363
|
-
var r = s.next, i = (s.f & Zn) !== 0 || (s.f & ft) !== 0;
|
|
1364
|
-
Vr(s, e, i ? n : !1), s = r;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
function Zr(t) {
|
|
1369
|
-
Li(t, !0);
|
|
1370
|
-
}
|
|
1371
|
-
function Li(t, e) {
|
|
1372
|
-
if ((t.f & Ge) !== 0) {
|
|
1373
|
-
t.f ^= Ge, (t.f & oe) === 0 && (pe(t, Re), $t(t));
|
|
1374
|
-
for (var n = t.first; n !== null; ) {
|
|
1375
|
-
var s = n.next, r = (n.f & Zn) !== 0 || (n.f & ft) !== 0;
|
|
1376
|
-
Li(n, r ? e : !1), n = s;
|
|
1377
|
-
}
|
|
1378
|
-
if (t.transitions !== null)
|
|
1379
|
-
for (const i of t.transitions)
|
|
1380
|
-
(i.is_global || e) && i.in();
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
let Zt = !1;
|
|
1384
|
-
function $s(t) {
|
|
1385
|
-
Zt = t;
|
|
1386
|
-
}
|
|
1387
|
-
let Mt = !1;
|
|
1388
|
-
function Cs(t) {
|
|
1389
|
-
Mt = t;
|
|
1390
|
-
}
|
|
1391
|
-
let O = null, Fe = !1;
|
|
1392
|
-
function we(t) {
|
|
1393
|
-
O = t;
|
|
1394
|
-
}
|
|
1395
|
-
let C = null;
|
|
1396
|
-
function Je(t) {
|
|
1397
|
-
C = t;
|
|
1398
|
-
}
|
|
1399
|
-
let ut = null;
|
|
1400
|
-
function Ii(t) {
|
|
1401
|
-
O !== null && (ut === null ? ut = [t] : ut.push(t));
|
|
1402
|
-
}
|
|
1403
|
-
let fe = null, Te = 0, Ce = null;
|
|
1404
|
-
function dl(t) {
|
|
1405
|
-
Ce = t;
|
|
1406
|
-
}
|
|
1407
|
-
let Oi = 1, _n = 0, St = _n;
|
|
1408
|
-
function Ls(t) {
|
|
1409
|
-
St = t;
|
|
1410
|
-
}
|
|
1411
|
-
let dt = !1;
|
|
1412
|
-
function Ni() {
|
|
1413
|
-
return ++Oi;
|
|
1414
|
-
}
|
|
1415
|
-
function rr(t) {
|
|
1416
|
-
var e = t.f;
|
|
1417
|
-
if ((e & Re) !== 0)
|
|
1418
|
-
return !0;
|
|
1419
|
-
if ((e & bt) !== 0) {
|
|
1420
|
-
var n = t.deps, s = (e & Ie) !== 0;
|
|
1421
|
-
if (n !== null) {
|
|
1422
|
-
var r, i, a = (e & Pn) !== 0, u = s && C !== null && !dt, l = n.length;
|
|
1423
|
-
if ((a || u) && (C === null || (C.f & Ot) === 0)) {
|
|
1424
|
-
var c = (
|
|
1425
|
-
/** @type {Derived} */
|
|
1426
|
-
t
|
|
1427
|
-
), f = c.parent;
|
|
1428
|
-
for (r = 0; r < l; r++)
|
|
1429
|
-
i = n[r], (a || !i?.reactions?.includes(c)) && (i.reactions ??= []).push(c);
|
|
1430
|
-
a && (c.f ^= Pn), u && f !== null && (f.f & Ie) === 0 && (c.f ^= Ie);
|
|
1431
|
-
}
|
|
1432
|
-
for (r = 0; r < l; r++)
|
|
1433
|
-
if (i = n[r], rr(
|
|
1434
|
-
/** @type {Derived} */
|
|
1435
|
-
i
|
|
1436
|
-
) && pi(
|
|
1437
|
-
/** @type {Derived} */
|
|
1438
|
-
i
|
|
1439
|
-
), i.wv > t.wv)
|
|
1440
|
-
return !0;
|
|
1441
|
-
}
|
|
1442
|
-
(!s || C !== null && !dt) && pe(t, oe);
|
|
1443
|
-
}
|
|
1444
|
-
return !1;
|
|
1445
|
-
}
|
|
1446
|
-
function Di(t, e, n = !0) {
|
|
1447
|
-
var s = t.reactions;
|
|
1448
|
-
if (s !== null && !ut?.includes(t))
|
|
1449
|
-
for (var r = 0; r < s.length; r++) {
|
|
1450
|
-
var i = s[r];
|
|
1451
|
-
(i.f & xe) !== 0 ? Di(
|
|
1452
|
-
/** @type {Derived} */
|
|
1453
|
-
i,
|
|
1454
|
-
e,
|
|
1455
|
-
!1
|
|
1456
|
-
) : e === i && (n ? pe(i, Re) : (i.f & oe) !== 0 && pe(i, bt), $t(
|
|
1457
|
-
/** @type {Effect} */
|
|
1458
|
-
i
|
|
1459
|
-
));
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
function Mi(t) {
|
|
1463
|
-
var e = fe, n = Te, s = Ce, r = O, i = dt, a = ut, u = $e, l = Fe, c = St, f = t.f;
|
|
1464
|
-
fe = /** @type {null | Value[]} */
|
|
1465
|
-
null, Te = 0, Ce = null, dt = (f & Ie) !== 0 && (Fe || !Zt || O === null), O = (f & (ft | _t)) === 0 ? t : null, ut = null, Qt(t.ctx), Fe = !1, St = ++_n, t.ac !== null && (tr(() => {
|
|
1466
|
-
t.ac.abort(dn);
|
|
1467
|
-
}), t.ac = null);
|
|
1468
|
-
try {
|
|
1469
|
-
t.f |= yr;
|
|
1470
|
-
var d = (
|
|
1471
|
-
/** @type {Function} */
|
|
1472
|
-
t.fn
|
|
1473
|
-
), p = d(), v = t.deps;
|
|
1474
|
-
if (fe !== null) {
|
|
1475
|
-
var h;
|
|
1476
|
-
if (Fn(t, Te), v !== null && Te > 0)
|
|
1477
|
-
for (v.length = Te + fe.length, h = 0; h < fe.length; h++)
|
|
1478
|
-
v[Te + h] = fe[h];
|
|
1479
|
-
else
|
|
1480
|
-
t.deps = v = fe;
|
|
1481
|
-
if (!dt || // Deriveds that already have reactions can cleanup, so we still add them as reactions
|
|
1482
|
-
(f & xe) !== 0 && /** @type {import('#client').Derived} */
|
|
1483
|
-
t.reactions !== null)
|
|
1484
|
-
for (h = Te; h < v.length; h++)
|
|
1485
|
-
(v[h].reactions ??= []).push(t);
|
|
1486
|
-
} else v !== null && Te < v.length && (Fn(t, Te), v.length = Te);
|
|
1487
|
-
if (ii() && Ce !== null && !Fe && v !== null && (t.f & (xe | bt | Re)) === 0)
|
|
1488
|
-
for (h = 0; h < /** @type {Source[]} */
|
|
1489
|
-
Ce.length; h++)
|
|
1490
|
-
Di(
|
|
1491
|
-
Ce[h],
|
|
1492
|
-
/** @type {Effect} */
|
|
1493
|
-
t
|
|
1494
|
-
);
|
|
1495
|
-
return r !== null && r !== t && (_n++, Ce !== null && (s === null ? s = Ce : s.push(.../** @type {Source[]} */
|
|
1496
|
-
Ce))), (t.f & At) !== 0 && (t.f ^= At), p;
|
|
1497
|
-
} catch (x) {
|
|
1498
|
-
return li(x);
|
|
1499
|
-
} finally {
|
|
1500
|
-
t.f ^= yr, fe = e, Te = n, Ce = s, O = r, dt = i, ut = a, Qt(u), Fe = l, St = c;
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
function gl(t, e) {
|
|
1504
|
-
let n = e.reactions;
|
|
1505
|
-
if (n !== null) {
|
|
1506
|
-
var s = ya.call(n, t);
|
|
1507
|
-
if (s !== -1) {
|
|
1508
|
-
var r = n.length - 1;
|
|
1509
|
-
r === 0 ? n = e.reactions = null : (n[s] = n[r], n.pop());
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
n === null && (e.f & xe) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
|
|
1513
|
-
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
|
|
1514
|
-
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
|
|
1515
|
-
(fe === null || !fe.includes(e)) && (pe(e, bt), (e.f & (Ie | Pn)) === 0 && (e.f ^= Pn), hi(
|
|
1516
|
-
/** @type {Derived} **/
|
|
1517
|
-
e
|
|
1518
|
-
), Fn(
|
|
1519
|
-
/** @type {Derived} **/
|
|
1520
|
-
e,
|
|
1521
|
-
0
|
|
1522
|
-
));
|
|
1523
|
-
}
|
|
1524
|
-
function Fn(t, e) {
|
|
1525
|
-
var n = t.deps;
|
|
1526
|
-
if (n !== null)
|
|
1527
|
-
for (var s = e; s < n.length; s++)
|
|
1528
|
-
gl(t, n[s]);
|
|
1529
|
-
}
|
|
1530
|
-
function bn(t) {
|
|
1531
|
-
var e = t.f;
|
|
1532
|
-
if ((e & Ot) === 0) {
|
|
1533
|
-
pe(t, oe);
|
|
1534
|
-
var n = C, s = Zt;
|
|
1535
|
-
C = t, Zt = !0;
|
|
1536
|
-
try {
|
|
1537
|
-
(e & It) !== 0 ? pl(t) : Si(t), Ai(t);
|
|
1538
|
-
var r = Mi(t);
|
|
1539
|
-
t.teardown = typeof r == "function" ? r : null, t.wv = Oi;
|
|
1540
|
-
var i;
|
|
1541
|
-
Qs && ja && (t.f & Re) !== 0 && t.deps;
|
|
1542
|
-
} finally {
|
|
1543
|
-
Zt = s, C = n;
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
async function vl() {
|
|
1548
|
-
await Promise.resolve(), ot();
|
|
1549
|
-
}
|
|
1550
|
-
function m(t) {
|
|
1551
|
-
var e = t.f, n = (e & xe) !== 0;
|
|
1552
|
-
if (O !== null && !Fe) {
|
|
1553
|
-
var s = C !== null && (C.f & Ot) !== 0;
|
|
1554
|
-
if (!s && !ut?.includes(t)) {
|
|
1555
|
-
var r = O.deps;
|
|
1556
|
-
if ((O.f & yr) !== 0)
|
|
1557
|
-
t.rv < _n && (t.rv = _n, fe === null && r !== null && r[Te] === t ? Te++ : fe === null ? fe = [t] : (!dt || !fe.includes(t)) && fe.push(t));
|
|
1558
|
-
else {
|
|
1559
|
-
(O.deps ??= []).push(t);
|
|
1560
|
-
var i = t.reactions;
|
|
1561
|
-
i === null ? t.reactions = [O] : i.includes(O) || i.push(O);
|
|
1562
|
-
}
|
|
1563
|
-
}
|
|
1564
|
-
} else if (n && /** @type {Derived} */
|
|
1565
|
-
t.deps === null && /** @type {Derived} */
|
|
1566
|
-
t.effects === null) {
|
|
1567
|
-
var a = (
|
|
1568
|
-
/** @type {Derived} */
|
|
1569
|
-
t
|
|
1570
|
-
), u = a.parent;
|
|
1571
|
-
u !== null && (u.f & Ie) === 0 && (a.f ^= Ie);
|
|
1572
|
-
}
|
|
1573
|
-
if (Mt) {
|
|
1574
|
-
if (gt.has(t))
|
|
1575
|
-
return gt.get(t);
|
|
1576
|
-
if (n) {
|
|
1577
|
-
a = /** @type {Derived} */
|
|
1578
|
-
t;
|
|
1579
|
-
var l = a.v;
|
|
1580
|
-
return ((a.f & oe) === 0 && a.reactions !== null || Pi(a)) && (l = jr(a)), gt.set(a, l), l;
|
|
1581
|
-
}
|
|
1582
|
-
} else n && (a = /** @type {Derived} */
|
|
1583
|
-
t, rr(a) && pi(a));
|
|
1584
|
-
if ((t.f & At) !== 0)
|
|
1585
|
-
throw t.v;
|
|
1586
|
-
return t.v;
|
|
1587
|
-
}
|
|
1588
|
-
function Pi(t) {
|
|
1589
|
-
if (t.v === re) return !0;
|
|
1590
|
-
if (t.deps === null) return !1;
|
|
1591
|
-
for (const e of t.deps)
|
|
1592
|
-
if (gt.has(e) || (e.f & xe) !== 0 && Pi(
|
|
1593
|
-
/** @type {Derived} */
|
|
1594
|
-
e
|
|
1595
|
-
))
|
|
1596
|
-
return !0;
|
|
1597
|
-
return !1;
|
|
1598
|
-
}
|
|
1599
|
-
function sr(t) {
|
|
1600
|
-
var e = Fe;
|
|
1601
|
-
try {
|
|
1602
|
-
return Fe = !0, t();
|
|
1603
|
-
} finally {
|
|
1604
|
-
Fe = e;
|
|
1605
|
-
}
|
|
1606
|
-
}
|
|
1607
|
-
const ml = -7169;
|
|
1608
|
-
function pe(t, e) {
|
|
1609
|
-
t.f = t.f & ml | e;
|
|
1610
|
-
}
|
|
1611
|
-
const zi = /* @__PURE__ */ new Set(), Sr = /* @__PURE__ */ new Set();
|
|
1612
|
-
function Ui(t) {
|
|
1613
|
-
if (!I) return;
|
|
1614
|
-
t.removeAttribute("onload"), t.removeAttribute("onerror");
|
|
1615
|
-
const e = t.__e;
|
|
1616
|
-
e !== void 0 && (t.__e = void 0, queueMicrotask(() => {
|
|
1617
|
-
t.isConnected && t.dispatchEvent(e);
|
|
1618
|
-
}));
|
|
1619
|
-
}
|
|
1620
|
-
function _l(t, e, n, s = {}) {
|
|
1621
|
-
function r(i) {
|
|
1622
|
-
if (s.capture || hn.call(e, i), !i.cancelBubble)
|
|
1623
|
-
return tr(() => n?.call(this, i));
|
|
1624
|
-
}
|
|
1625
|
-
return t.startsWith("pointer") || t.startsWith("touch") || t === "wheel" ? mt(() => {
|
|
1626
|
-
e.addEventListener(t, r, s);
|
|
1627
|
-
}) : e.addEventListener(t, r, s), r;
|
|
1628
|
-
}
|
|
1629
|
-
function Rr(t, e, n, s, r) {
|
|
1630
|
-
var i = { capture: s, passive: r }, a = _l(t, e, n, i);
|
|
1631
|
-
(e === document.body || // @ts-ignore
|
|
1632
|
-
e === window || // @ts-ignore
|
|
1633
|
-
e === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
|
|
1634
|
-
e instanceof HTMLMediaElement) && xi(() => {
|
|
1635
|
-
e.removeEventListener(t, a, i);
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
function bl(t) {
|
|
1639
|
-
for (var e = 0; e < t.length; e++)
|
|
1640
|
-
zi.add(t[e]);
|
|
1641
|
-
for (var n of Sr)
|
|
1642
|
-
n(t);
|
|
1643
|
-
}
|
|
1644
|
-
let Is = null;
|
|
1645
|
-
function hn(t) {
|
|
1646
|
-
var e = this, n = (
|
|
1647
|
-
/** @type {Node} */
|
|
1648
|
-
e.ownerDocument
|
|
1649
|
-
), s = t.type, r = t.composedPath?.() || [], i = (
|
|
1650
|
-
/** @type {null | Element} */
|
|
1651
|
-
r[0] || t.target
|
|
1652
|
-
);
|
|
1653
|
-
Is = t;
|
|
1654
|
-
var a = 0, u = Is === t && t.__root;
|
|
1655
|
-
if (u) {
|
|
1656
|
-
var l = r.indexOf(u);
|
|
1657
|
-
if (l !== -1 && (e === document || e === /** @type {any} */
|
|
1658
|
-
window)) {
|
|
1659
|
-
t.__root = e;
|
|
1660
|
-
return;
|
|
1661
|
-
}
|
|
1662
|
-
var c = r.indexOf(e);
|
|
1663
|
-
if (c === -1)
|
|
1664
|
-
return;
|
|
1665
|
-
l <= c && (a = l);
|
|
1666
|
-
}
|
|
1667
|
-
if (i = /** @type {Element} */
|
|
1668
|
-
r[a] || t.target, i !== e) {
|
|
1669
|
-
Kt(t, "currentTarget", {
|
|
1670
|
-
configurable: !0,
|
|
1671
|
-
get() {
|
|
1672
|
-
return i || n;
|
|
1673
|
-
}
|
|
1674
|
-
});
|
|
1675
|
-
var f = O, d = C;
|
|
1676
|
-
we(null), Je(null);
|
|
1677
|
-
try {
|
|
1678
|
-
for (var p, v = []; i !== null; ) {
|
|
1679
|
-
var h = i.assignedSlot || i.parentNode || /** @type {any} */
|
|
1680
|
-
i.host || null;
|
|
1681
|
-
try {
|
|
1682
|
-
var x = i["__" + s];
|
|
1683
|
-
if (x != null && (!/** @type {any} */
|
|
1684
|
-
i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
|
|
1685
|
-
// -> the target could not have been disabled because it emits the event in the first place
|
|
1686
|
-
t.target === i))
|
|
1687
|
-
if (Ur(x)) {
|
|
1688
|
-
var [T, ...R] = x;
|
|
1689
|
-
T.apply(i, [t, ...R]);
|
|
1690
|
-
} else
|
|
1691
|
-
x.call(i, t);
|
|
1692
|
-
} catch (w) {
|
|
1693
|
-
p ? v.push(w) : p = w;
|
|
1694
|
-
}
|
|
1695
|
-
if (t.cancelBubble || h === e || h === null)
|
|
1696
|
-
break;
|
|
1697
|
-
i = h;
|
|
1698
|
-
}
|
|
1699
|
-
if (p) {
|
|
1700
|
-
for (let w of v)
|
|
1701
|
-
queueMicrotask(() => {
|
|
1702
|
-
throw w;
|
|
1703
|
-
});
|
|
1704
|
-
throw p;
|
|
1705
|
-
}
|
|
1706
|
-
} finally {
|
|
1707
|
-
t.__root = e, delete t.currentTarget, we(f), Je(d);
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
function Fi(t) {
|
|
1712
|
-
var e = document.createElement("template");
|
|
1713
|
-
return e.innerHTML = t.replaceAll("<!>", "<!---->"), e.content;
|
|
1714
|
-
}
|
|
1715
|
-
function vt(t, e) {
|
|
1716
|
-
var n = (
|
|
1717
|
-
/** @type {Effect} */
|
|
1718
|
-
C
|
|
1719
|
-
);
|
|
1720
|
-
n.nodes_start === null && (n.nodes_start = t, n.nodes_end = e);
|
|
1721
|
-
}
|
|
1722
|
-
// @__NO_SIDE_EFFECTS__
|
|
1723
|
-
function se(t, e) {
|
|
1724
|
-
var n = (e & ka) !== 0, s = (e & wa) !== 0, r, i = !t.startsWith("<!>");
|
|
1725
|
-
return () => {
|
|
1726
|
-
if (I)
|
|
1727
|
-
return vt(N, null), N;
|
|
1728
|
-
r === void 0 && (r = Fi(i ? t : "<!>" + t), n || (r = /** @type {Node} */
|
|
1729
|
-
/* @__PURE__ */ Be(r)));
|
|
1730
|
-
var a = (
|
|
1731
|
-
/** @type {TemplateNode} */
|
|
1732
|
-
s || vi ? document.importNode(r, !0) : r.cloneNode(!0)
|
|
1733
|
-
);
|
|
1734
|
-
if (n) {
|
|
1735
|
-
var u = (
|
|
1736
|
-
/** @type {TemplateNode} */
|
|
1737
|
-
/* @__PURE__ */ Be(a)
|
|
1738
|
-
), l = (
|
|
1739
|
-
/** @type {TemplateNode} */
|
|
1740
|
-
a.lastChild
|
|
1741
|
-
);
|
|
1742
|
-
vt(u, l);
|
|
1743
|
-
} else
|
|
1744
|
-
vt(a, a);
|
|
1745
|
-
return a;
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
function Os() {
|
|
1749
|
-
if (I)
|
|
1750
|
-
return vt(N, null), N;
|
|
1751
|
-
var t = document.createDocumentFragment(), e = document.createComment(""), n = ct();
|
|
1752
|
-
return t.append(e, n), vt(e, n), t;
|
|
1753
|
-
}
|
|
1754
|
-
function K(t, e) {
|
|
1755
|
-
if (I) {
|
|
1756
|
-
C.nodes_end = N, Xt();
|
|
1757
|
-
return;
|
|
1758
|
-
}
|
|
1759
|
-
t !== null && t.before(
|
|
1760
|
-
/** @type {Node} */
|
|
1761
|
-
e
|
|
1762
|
-
);
|
|
1763
|
-
}
|
|
1764
|
-
const kl = ["touchstart", "touchmove"];
|
|
1765
|
-
function wl(t) {
|
|
1766
|
-
return kl.includes(t);
|
|
1767
|
-
}
|
|
1768
|
-
function $r(t, e) {
|
|
1769
|
-
var n = e == null ? "" : typeof e == "object" ? e + "" : e;
|
|
1770
|
-
n !== (t.__t ??= t.nodeValue) && (t.__t = n, t.nodeValue = n + "");
|
|
1771
|
-
}
|
|
1772
|
-
function Hi(t, e) {
|
|
1773
|
-
return Bi(t, e);
|
|
1774
|
-
}
|
|
1775
|
-
function xl(t, e) {
|
|
1776
|
-
Ar(), e.intro = e.intro ?? !1;
|
|
1777
|
-
const n = e.target, s = I, r = N;
|
|
1778
|
-
try {
|
|
1779
|
-
for (var i = (
|
|
1780
|
-
/** @type {TemplateNode} */
|
|
1781
|
-
/* @__PURE__ */ Be(n)
|
|
1782
|
-
); i && (i.nodeType !== Dt || /** @type {Comment} */
|
|
1783
|
-
i.data !== Xs); )
|
|
1784
|
-
i = /** @type {TemplateNode} */
|
|
1785
|
-
/* @__PURE__ */ We(i);
|
|
1786
|
-
if (!i)
|
|
1787
|
-
throw Rt;
|
|
1788
|
-
He(!0), ue(
|
|
1789
|
-
/** @type {Comment} */
|
|
1790
|
-
i
|
|
1791
|
-
);
|
|
1792
|
-
const a = Bi(t, { ...e, anchor: i });
|
|
1793
|
-
return He(!1), /** @type {Exports} */
|
|
1794
|
-
a;
|
|
1795
|
-
} catch (a) {
|
|
1796
|
-
if (a instanceof Error && a.message.split(`
|
|
1797
|
-
`).some((u) => u.startsWith("https://svelte.dev/e/")))
|
|
1798
|
-
throw a;
|
|
1799
|
-
return a !== Rt && console.warn("Failed to hydrate: ", a), e.recover === !1 && Ua(), Ar(), bi(n), He(!1), Hi(t, e);
|
|
1800
|
-
} finally {
|
|
1801
|
-
He(s), ue(r);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
const qt = /* @__PURE__ */ new Map();
|
|
1805
|
-
function Bi(t, { target: e, anchor: n, props: s = {}, events: r, context: i, intro: a = !0 }) {
|
|
1806
|
-
Ar();
|
|
1807
|
-
var u = /* @__PURE__ */ new Set(), l = (d) => {
|
|
1808
|
-
for (var p = 0; p < d.length; p++) {
|
|
1809
|
-
var v = d[p];
|
|
1810
|
-
if (!u.has(v)) {
|
|
1811
|
-
u.add(v);
|
|
1812
|
-
var h = wl(v);
|
|
1813
|
-
e.addEventListener(v, hn, { passive: h });
|
|
1814
|
-
var x = qt.get(v);
|
|
1815
|
-
x === void 0 ? (document.addEventListener(v, hn, { passive: h }), qt.set(v, 1)) : qt.set(v, x + 1);
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
};
|
|
1819
|
-
l(Fr(zi)), Sr.add(l);
|
|
1820
|
-
var c = void 0, f = fl(() => {
|
|
1821
|
-
var d = n ?? e.appendChild(ct());
|
|
1822
|
-
return Qa(
|
|
1823
|
-
/** @type {TemplateNode} */
|
|
1824
|
-
d,
|
|
1825
|
-
{
|
|
1826
|
-
pending: () => {
|
|
1827
|
-
}
|
|
1828
|
-
},
|
|
1829
|
-
(p) => {
|
|
1830
|
-
if (i) {
|
|
1831
|
-
Xn({});
|
|
1832
|
-
var v = (
|
|
1833
|
-
/** @type {ComponentContext} */
|
|
1834
|
-
$e
|
|
1835
|
-
);
|
|
1836
|
-
v.c = i;
|
|
1837
|
-
}
|
|
1838
|
-
if (r && (s.$$events = r), I && vt(
|
|
1839
|
-
/** @type {TemplateNode} */
|
|
1840
|
-
p,
|
|
1841
|
-
null
|
|
1842
|
-
), c = t(p, s) || {}, I && (C.nodes_end = N, N === null || N.nodeType !== Dt || /** @type {Comment} */
|
|
1843
|
-
N.data !== zr))
|
|
1844
|
-
throw wn(), Rt;
|
|
1845
|
-
i && Qn();
|
|
1846
|
-
}
|
|
1847
|
-
), () => {
|
|
1848
|
-
for (var p of u) {
|
|
1849
|
-
e.removeEventListener(p, hn);
|
|
1850
|
-
var v = (
|
|
1851
|
-
/** @type {number} */
|
|
1852
|
-
qt.get(p)
|
|
1853
|
-
);
|
|
1854
|
-
--v === 0 ? (document.removeEventListener(p, hn), qt.delete(p)) : qt.set(p, v);
|
|
1855
|
-
}
|
|
1856
|
-
Sr.delete(l), d !== n && d.parentNode?.removeChild(d);
|
|
1857
|
-
};
|
|
1858
|
-
});
|
|
1859
|
-
return Cr.set(c, f), c;
|
|
1860
|
-
}
|
|
1861
|
-
let Cr = /* @__PURE__ */ new WeakMap();
|
|
1862
|
-
function yl(t, e) {
|
|
1863
|
-
const n = Cr.get(t);
|
|
1864
|
-
return n ? (Cr.delete(t), n(e)) : Promise.resolve();
|
|
1865
|
-
}
|
|
1866
|
-
function El(t) {
|
|
1867
|
-
$e === null && Oa(), yi(() => {
|
|
1868
|
-
const e = sr(t);
|
|
1869
|
-
if (typeof e == "function") return (
|
|
1870
|
-
/** @type {() => void} */
|
|
1871
|
-
e
|
|
1872
|
-
);
|
|
1873
|
-
});
|
|
1874
|
-
}
|
|
1875
|
-
function lt(t, e, n = !1) {
|
|
1876
|
-
I && Xt();
|
|
1877
|
-
var s = t, r = null, i = null, a = re, u = n ? Zn : 0, l = !1;
|
|
1878
|
-
const c = (v, h = !0) => {
|
|
1879
|
-
l = !0, p(h, v);
|
|
1880
|
-
};
|
|
1881
|
-
var f = null;
|
|
1882
|
-
function d() {
|
|
1883
|
-
f !== null && (f.lastChild.remove(), s.before(f), f = null);
|
|
1884
|
-
var v = a ? r : i, h = a ? i : r;
|
|
1885
|
-
v && Zr(v), h && Vt(h, () => {
|
|
1886
|
-
a ? i = null : r = null;
|
|
1887
|
-
});
|
|
1888
|
-
}
|
|
1889
|
-
const p = (v, h) => {
|
|
1890
|
-
if (a === (a = v)) return;
|
|
1891
|
-
let x = !1;
|
|
1892
|
-
if (I) {
|
|
1893
|
-
const k = ni(s) === Vn;
|
|
1894
|
-
!!a === k && (s = zn(), ue(s), He(!1), x = !0);
|
|
1895
|
-
}
|
|
1896
|
-
var T = ki(), R = s;
|
|
1897
|
-
if (T && (f = document.createDocumentFragment(), f.append(R = ct())), a ? r ??= h && Le(() => h(R)) : i ??= h && Le(() => h(R)), T) {
|
|
1898
|
-
var w = (
|
|
1899
|
-
/** @type {Batch} */
|
|
1900
|
-
q
|
|
1901
|
-
), P = a ? r : i, S = a ? i : r;
|
|
1902
|
-
P && w.skipped_effects.delete(P), S && w.skipped_effects.add(S), w.add_callback(d);
|
|
1903
|
-
} else
|
|
1904
|
-
d();
|
|
1905
|
-
x && He(!0);
|
|
1906
|
-
};
|
|
1907
|
-
Yr(() => {
|
|
1908
|
-
l = !1, e(c), l || p(null, null);
|
|
1909
|
-
}, u), I && (s = N);
|
|
1910
|
-
}
|
|
1911
|
-
function Gi(t, e) {
|
|
1912
|
-
return e;
|
|
1913
|
-
}
|
|
1914
|
-
function Tl(t, e, n) {
|
|
1915
|
-
for (var s = t.items, r = [], i = e.length, a = 0; a < i; a++)
|
|
1916
|
-
Vr(e[a].e, r, !0);
|
|
1917
|
-
var u = i > 0 && r.length === 0 && n !== null;
|
|
1918
|
-
if (u) {
|
|
1919
|
-
var l = (
|
|
1920
|
-
/** @type {Element} */
|
|
1921
|
-
/** @type {Element} */
|
|
1922
|
-
n.parentNode
|
|
1923
|
-
);
|
|
1924
|
-
bi(l), l.append(
|
|
1925
|
-
/** @type {Element} */
|
|
1926
|
-
n
|
|
1927
|
-
), s.clear(), Xe(t, e[0].prev, e[i - 1].next);
|
|
1928
|
-
}
|
|
1929
|
-
Ci(r, () => {
|
|
1930
|
-
for (var c = 0; c < i; c++) {
|
|
1931
|
-
var f = e[c];
|
|
1932
|
-
u || (s.delete(f.k), Xe(t, f.prev, f.next)), Se(f.e, !u);
|
|
1933
|
-
}
|
|
1934
|
-
});
|
|
1935
|
-
}
|
|
1936
|
-
function Hn(t, e, n, s, r, i = null) {
|
|
1937
|
-
var a = t, u = { flags: e, items: /* @__PURE__ */ new Map(), first: null }, l = (e & Ks) !== 0;
|
|
1938
|
-
if (l) {
|
|
1939
|
-
var c = (
|
|
1940
|
-
/** @type {Element} */
|
|
1941
|
-
t
|
|
1942
|
-
);
|
|
1943
|
-
a = I ? ue(
|
|
1944
|
-
/** @type {Comment | Text} */
|
|
1945
|
-
/* @__PURE__ */ Be(c)
|
|
1946
|
-
) : c.appendChild(ct());
|
|
1947
|
-
}
|
|
1948
|
-
I && Xt();
|
|
1949
|
-
var f = null, d = !1, p = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ sl(() => {
|
|
1950
|
-
var R = n();
|
|
1951
|
-
return Ur(R) ? R : R == null ? [] : Fr(R);
|
|
1952
|
-
}), h, x;
|
|
1953
|
-
function T() {
|
|
1954
|
-
Al(
|
|
1955
|
-
x,
|
|
1956
|
-
h,
|
|
1957
|
-
u,
|
|
1958
|
-
p,
|
|
1959
|
-
a,
|
|
1960
|
-
r,
|
|
1961
|
-
e,
|
|
1962
|
-
s,
|
|
1963
|
-
n
|
|
1964
|
-
), i !== null && (h.length === 0 ? f ? Zr(f) : f = Le(() => i(a)) : f !== null && Vt(f, () => {
|
|
1965
|
-
f = null;
|
|
1966
|
-
}));
|
|
1967
|
-
}
|
|
1968
|
-
Yr(() => {
|
|
1969
|
-
x ??= /** @type {Effect} */
|
|
1970
|
-
C, h = /** @type {V[]} */
|
|
1971
|
-
m(v);
|
|
1972
|
-
var R = h.length;
|
|
1973
|
-
if (d && R === 0)
|
|
1974
|
-
return;
|
|
1975
|
-
d = R === 0;
|
|
1976
|
-
let w = !1;
|
|
1977
|
-
if (I) {
|
|
1978
|
-
var P = ni(a) === Vn;
|
|
1979
|
-
P !== (R === 0) && (a = zn(), ue(a), He(!1), w = !0);
|
|
1980
|
-
}
|
|
1981
|
-
if (I) {
|
|
1982
|
-
for (var S = null, k, _ = 0; _ < R; _++) {
|
|
1983
|
-
if (N.nodeType === Dt && /** @type {Comment} */
|
|
1984
|
-
N.data === zr) {
|
|
1985
|
-
a = /** @type {Comment} */
|
|
1986
|
-
N, w = !0, He(!1);
|
|
1987
|
-
break;
|
|
1988
|
-
}
|
|
1989
|
-
var E = h[_], U = s(E, _);
|
|
1990
|
-
k = Lr(
|
|
1991
|
-
N,
|
|
1992
|
-
u,
|
|
1993
|
-
S,
|
|
1994
|
-
null,
|
|
1995
|
-
E,
|
|
1996
|
-
U,
|
|
1997
|
-
_,
|
|
1998
|
-
r,
|
|
1999
|
-
e,
|
|
2000
|
-
n
|
|
2001
|
-
), u.items.set(U, k), S = k;
|
|
2002
|
-
}
|
|
2003
|
-
R > 0 && ue(zn());
|
|
2004
|
-
}
|
|
2005
|
-
if (I)
|
|
2006
|
-
R === 0 && i && (f = Le(() => i(a)));
|
|
2007
|
-
else if (ki()) {
|
|
2008
|
-
var J = /* @__PURE__ */ new Set(), B = (
|
|
2009
|
-
/** @type {Batch} */
|
|
2010
|
-
q
|
|
2011
|
-
);
|
|
2012
|
-
for (_ = 0; _ < R; _ += 1) {
|
|
2013
|
-
E = h[_], U = s(E, _);
|
|
2014
|
-
var $ = u.items.get(U) ?? p.get(U);
|
|
2015
|
-
$ ? (e & (jn | Yn)) !== 0 && Wi($, E, _, e) : (k = Lr(
|
|
2016
|
-
null,
|
|
2017
|
-
u,
|
|
2018
|
-
null,
|
|
2019
|
-
null,
|
|
2020
|
-
E,
|
|
2021
|
-
U,
|
|
2022
|
-
_,
|
|
2023
|
-
r,
|
|
2024
|
-
e,
|
|
2025
|
-
n,
|
|
2026
|
-
!0
|
|
2027
|
-
), p.set(U, k)), J.add(U);
|
|
2028
|
-
}
|
|
2029
|
-
for (const [Y, ve] of u.items)
|
|
2030
|
-
J.has(Y) || B.skipped_effects.add(ve.e);
|
|
2031
|
-
B.add_callback(T);
|
|
2032
|
-
} else
|
|
2033
|
-
T();
|
|
2034
|
-
w && He(!0), m(v);
|
|
2035
|
-
}), I && (a = N);
|
|
2036
|
-
}
|
|
2037
|
-
function Al(t, e, n, s, r, i, a, u, l) {
|
|
2038
|
-
var c = (a & _a) !== 0, f = (a & (jn | Yn)) !== 0, d = e.length, p = n.items, v = n.first, h = v, x, T = null, R, w = [], P = [], S, k, _, E;
|
|
2039
|
-
if (c)
|
|
2040
|
-
for (E = 0; E < d; E += 1)
|
|
2041
|
-
S = e[E], k = u(S, E), _ = p.get(k), _ !== void 0 && (_.a?.measure(), (R ??= /* @__PURE__ */ new Set()).add(_));
|
|
2042
|
-
for (E = 0; E < d; E += 1) {
|
|
2043
|
-
if (S = e[E], k = u(S, E), _ = p.get(k), _ === void 0) {
|
|
2044
|
-
var U = s.get(k);
|
|
2045
|
-
if (U !== void 0) {
|
|
2046
|
-
s.delete(k), p.set(k, U);
|
|
2047
|
-
var J = T ? T.next : h;
|
|
2048
|
-
Xe(n, T, U), Xe(n, U, J), dr(U, J, r), T = U;
|
|
2049
|
-
} else {
|
|
2050
|
-
var B = h ? (
|
|
2051
|
-
/** @type {TemplateNode} */
|
|
2052
|
-
h.e.nodes_start
|
|
2053
|
-
) : r;
|
|
2054
|
-
T = Lr(
|
|
2055
|
-
B,
|
|
2056
|
-
n,
|
|
2057
|
-
T,
|
|
2058
|
-
T === null ? n.first : T.next,
|
|
2059
|
-
S,
|
|
2060
|
-
k,
|
|
2061
|
-
E,
|
|
2062
|
-
i,
|
|
2063
|
-
a,
|
|
2064
|
-
l
|
|
2065
|
-
);
|
|
2066
|
-
}
|
|
2067
|
-
p.set(k, T), w = [], P = [], h = T.next;
|
|
2068
|
-
continue;
|
|
2069
|
-
}
|
|
2070
|
-
if (f && Wi(_, S, E, a), (_.e.f & Ge) !== 0 && (Zr(_.e), c && (_.a?.unfix(), (R ??= /* @__PURE__ */ new Set()).delete(_))), _ !== h) {
|
|
2071
|
-
if (x !== void 0 && x.has(_)) {
|
|
2072
|
-
if (w.length < P.length) {
|
|
2073
|
-
var $ = P[0], Y;
|
|
2074
|
-
T = $.prev;
|
|
2075
|
-
var ve = w[0], me = w[w.length - 1];
|
|
2076
|
-
for (Y = 0; Y < w.length; Y += 1)
|
|
2077
|
-
dr(w[Y], $, r);
|
|
2078
|
-
for (Y = 0; Y < P.length; Y += 1)
|
|
2079
|
-
x.delete(P[Y]);
|
|
2080
|
-
Xe(n, ve.prev, me.next), Xe(n, T, ve), Xe(n, me, $), h = $, T = me, E -= 1, w = [], P = [];
|
|
2081
|
-
} else
|
|
2082
|
-
x.delete(_), dr(_, h, r), Xe(n, _.prev, _.next), Xe(n, _, T === null ? n.first : T.next), Xe(n, T, _), T = _;
|
|
2083
|
-
continue;
|
|
2084
|
-
}
|
|
2085
|
-
for (w = [], P = []; h !== null && h.k !== k; )
|
|
2086
|
-
(h.e.f & Ge) === 0 && (x ??= /* @__PURE__ */ new Set()).add(h), P.push(h), h = h.next;
|
|
2087
|
-
if (h === null)
|
|
2088
|
-
continue;
|
|
2089
|
-
_ = h;
|
|
2090
|
-
}
|
|
2091
|
-
w.push(_), T = _, h = _.next;
|
|
2092
|
-
}
|
|
2093
|
-
if (h !== null || x !== void 0) {
|
|
2094
|
-
for (var A = x === void 0 ? [] : Fr(x); h !== null; )
|
|
2095
|
-
(h.e.f & Ge) === 0 && A.push(h), h = h.next;
|
|
2096
|
-
var D = A.length;
|
|
2097
|
-
if (D > 0) {
|
|
2098
|
-
var ee = (a & Ks) !== 0 && d === 0 ? r : null;
|
|
2099
|
-
if (c) {
|
|
2100
|
-
for (E = 0; E < D; E += 1)
|
|
2101
|
-
A[E].a?.measure();
|
|
2102
|
-
for (E = 0; E < D; E += 1)
|
|
2103
|
-
A[E].a?.fix();
|
|
2104
|
-
}
|
|
2105
|
-
Tl(n, A, ee);
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
c && mt(() => {
|
|
2109
|
-
if (R !== void 0)
|
|
2110
|
-
for (_ of R)
|
|
2111
|
-
_.a?.apply();
|
|
2112
|
-
}), t.first = n.first && n.first.e, t.last = T && T.e;
|
|
2113
|
-
for (var ye of s.values())
|
|
2114
|
-
Se(ye.e);
|
|
2115
|
-
s.clear();
|
|
2116
|
-
}
|
|
2117
|
-
function Wi(t, e, n, s) {
|
|
2118
|
-
(s & jn) !== 0 && en(t.v, e), (s & Yn) !== 0 ? en(
|
|
2119
|
-
/** @type {Value<number>} */
|
|
2120
|
-
t.i,
|
|
2121
|
-
n
|
|
2122
|
-
) : t.i = n;
|
|
2123
|
-
}
|
|
2124
|
-
function Lr(t, e, n, s, r, i, a, u, l, c, f) {
|
|
2125
|
-
var d = (l & jn) !== 0, p = (l & ba) === 0, v = d ? p ? /* @__PURE__ */ di(r, !1, !1) : Ct(r) : r, h = (l & Yn) === 0 ? a : Ct(a), x = {
|
|
2126
|
-
i: h,
|
|
2127
|
-
v,
|
|
2128
|
-
k: i,
|
|
2129
|
-
a: null,
|
|
2130
|
-
// @ts-expect-error
|
|
2131
|
-
e: null,
|
|
2132
|
-
prev: n,
|
|
2133
|
-
next: s
|
|
2134
|
-
};
|
|
2135
|
-
try {
|
|
2136
|
-
if (t === null) {
|
|
2137
|
-
var T = document.createDocumentFragment();
|
|
2138
|
-
T.append(t = ct());
|
|
2139
|
-
}
|
|
2140
|
-
return x.e = Le(() => u(
|
|
2141
|
-
/** @type {Node} */
|
|
2142
|
-
t,
|
|
2143
|
-
v,
|
|
2144
|
-
h,
|
|
2145
|
-
c
|
|
2146
|
-
), I), x.e.prev = n && n.e, x.e.next = s && s.e, n === null ? f || (e.first = x) : (n.next = x, n.e.next = x.e), s !== null && (s.prev = x, s.e.prev = x.e), x;
|
|
2147
|
-
} finally {
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
function dr(t, e, n) {
|
|
2151
|
-
for (var s = t.next ? (
|
|
2152
|
-
/** @type {TemplateNode} */
|
|
2153
|
-
t.next.e.nodes_start
|
|
2154
|
-
) : n, r = e ? (
|
|
2155
|
-
/** @type {TemplateNode} */
|
|
2156
|
-
e.e.nodes_start
|
|
2157
|
-
) : n, i = (
|
|
2158
|
-
/** @type {TemplateNode} */
|
|
2159
|
-
t.e.nodes_start
|
|
2160
|
-
); i !== null && i !== s; ) {
|
|
2161
|
-
var a = (
|
|
2162
|
-
/** @type {TemplateNode} */
|
|
2163
|
-
/* @__PURE__ */ We(i)
|
|
2164
|
-
);
|
|
2165
|
-
r.before(i), i = a;
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
function Xe(t, e, n) {
|
|
2169
|
-
e === null ? t.first = n : (e.next = n, e.e.next = n && n.e), n !== null && (n.prev = e, n.e.prev = e && e.e);
|
|
2170
|
-
}
|
|
2171
|
-
function Sl(t, e, n = !1, s = !1, r = !1) {
|
|
2172
|
-
var i = t, a = "";
|
|
2173
|
-
pt(() => {
|
|
2174
|
-
var u = (
|
|
2175
|
-
/** @type {Effect} */
|
|
2176
|
-
C
|
|
2177
|
-
);
|
|
2178
|
-
if (a === (a = e() ?? "")) {
|
|
2179
|
-
I && Xt();
|
|
2180
|
-
return;
|
|
2181
|
-
}
|
|
2182
|
-
if (u.nodes_start !== null && (Ri(
|
|
2183
|
-
u.nodes_start,
|
|
2184
|
-
/** @type {TemplateNode} */
|
|
2185
|
-
u.nodes_end
|
|
2186
|
-
), u.nodes_start = u.nodes_end = null), a !== "") {
|
|
2187
|
-
if (I) {
|
|
2188
|
-
N.data;
|
|
2189
|
-
for (var l = Xt(), c = l; l !== null && (l.nodeType !== Dt || /** @type {Comment} */
|
|
2190
|
-
l.data !== ""); )
|
|
2191
|
-
c = l, l = /** @type {TemplateNode} */
|
|
2192
|
-
/* @__PURE__ */ We(l);
|
|
2193
|
-
if (l === null)
|
|
2194
|
-
throw wn(), Rt;
|
|
2195
|
-
vt(N, c), i = ue(l);
|
|
2196
|
-
return;
|
|
2197
|
-
}
|
|
2198
|
-
var f = a + "";
|
|
2199
|
-
n ? f = `<svg>${f}</svg>` : s && (f = `<math>${f}</math>`);
|
|
2200
|
-
var d = Fi(f);
|
|
2201
|
-
if ((n || s) && (d = /** @type {Element} */
|
|
2202
|
-
/* @__PURE__ */ Be(d)), vt(
|
|
2203
|
-
/** @type {TemplateNode} */
|
|
2204
|
-
/* @__PURE__ */ Be(d),
|
|
2205
|
-
/** @type {TemplateNode} */
|
|
2206
|
-
d.lastChild
|
|
2207
|
-
), n || s)
|
|
2208
|
-
for (; /* @__PURE__ */ Be(d); )
|
|
2209
|
-
i.before(
|
|
2210
|
-
/** @type {Node} */
|
|
2211
|
-
/* @__PURE__ */ Be(d)
|
|
2212
|
-
);
|
|
2213
|
-
else
|
|
2214
|
-
i.before(d);
|
|
2215
|
-
}
|
|
2216
|
-
});
|
|
2217
|
-
}
|
|
2218
|
-
function qi(t, e) {
|
|
2219
|
-
Ti(() => {
|
|
2220
|
-
var n = t.getRootNode(), s = (
|
|
2221
|
-
/** @type {ShadowRoot} */
|
|
2222
|
-
n.host ? (
|
|
2223
|
-
/** @type {ShadowRoot} */
|
|
2224
|
-
n
|
|
2225
|
-
) : (
|
|
2226
|
-
/** @type {Document} */
|
|
2227
|
-
n.head ?? /** @type {Document} */
|
|
2228
|
-
n.ownerDocument.head
|
|
2229
|
-
)
|
|
2230
|
-
);
|
|
2231
|
-
if (!s.querySelector("#" + e.hash)) {
|
|
2232
|
-
const r = document.createElement("style");
|
|
2233
|
-
r.id = e.hash, r.textContent = e.code, s.appendChild(r);
|
|
2234
|
-
}
|
|
2235
|
-
});
|
|
2236
|
-
}
|
|
2237
|
-
function Rl(t, e) {
|
|
2238
|
-
return t == null ? null : String(t);
|
|
2239
|
-
}
|
|
2240
|
-
function Bn(t, e, n, s) {
|
|
2241
|
-
var r = t.__style;
|
|
2242
|
-
if (I || r !== e) {
|
|
2243
|
-
var i = Rl(e);
|
|
2244
|
-
(!I || i !== t.getAttribute("style")) && (i == null ? t.removeAttribute("style") : t.style.cssText = i), t.__style = e;
|
|
2245
|
-
}
|
|
2246
|
-
return s;
|
|
2247
|
-
}
|
|
2248
|
-
const $l = Symbol("is custom element"), Cl = Symbol("is html");
|
|
2249
|
-
function Ll(t) {
|
|
2250
|
-
if (I) {
|
|
2251
|
-
var e = !1, n = () => {
|
|
2252
|
-
if (!e) {
|
|
2253
|
-
if (e = !0, t.hasAttribute("value")) {
|
|
2254
|
-
var s = t.value;
|
|
2255
|
-
kn(t, "value", null), t.value = s;
|
|
2256
|
-
}
|
|
2257
|
-
if (t.hasAttribute("checked")) {
|
|
2258
|
-
var r = t.checked;
|
|
2259
|
-
kn(t, "checked", null), t.checked = r;
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2262
|
-
};
|
|
2263
|
-
t.__on_r = n, mt(n), wi();
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
function kn(t, e, n, s) {
|
|
2267
|
-
var r = Il(t);
|
|
2268
|
-
I && (r[e] = t.getAttribute(e), e === "src" || e === "srcset" || e === "href" && t.nodeName === "LINK") || r[e] !== (r[e] = n) && (e === "loading" && (t[Ia] = n), n == null ? t.removeAttribute(e) : typeof n != "string" && Ol(t).includes(e) ? t[e] = n : t.setAttribute(e, n));
|
|
2269
|
-
}
|
|
2270
|
-
function Il(t) {
|
|
2271
|
-
return (
|
|
2272
|
-
/** @type {Record<string | symbol, unknown>} **/
|
|
2273
|
-
// @ts-expect-error
|
|
2274
|
-
t.__attributes ??= {
|
|
2275
|
-
[$l]: t.nodeName.includes("-"),
|
|
2276
|
-
[Cl]: t.namespaceURI === xa
|
|
2277
|
-
}
|
|
2278
|
-
);
|
|
2279
|
-
}
|
|
2280
|
-
var Ns = /* @__PURE__ */ new Map();
|
|
2281
|
-
function Ol(t) {
|
|
2282
|
-
var e = t.getAttribute("is") || t.nodeName, n = Ns.get(e);
|
|
2283
|
-
if (n) return n;
|
|
2284
|
-
Ns.set(e, n = []);
|
|
2285
|
-
for (var s, r = t, i = Element.prototype; i !== r; ) {
|
|
2286
|
-
s = Ea(r);
|
|
2287
|
-
for (var a in s)
|
|
2288
|
-
s[a].set && n.push(a);
|
|
2289
|
-
r = Js(r);
|
|
2290
|
-
}
|
|
2291
|
-
return n;
|
|
2292
|
-
}
|
|
2293
|
-
function Nl(t, e, n = e) {
|
|
2294
|
-
var s = /* @__PURE__ */ new WeakSet();
|
|
2295
|
-
al(t, "input", async (r) => {
|
|
2296
|
-
var i = r ? t.defaultValue : t.value;
|
|
2297
|
-
if (i = gr(t) ? vr(i) : i, n(i), q !== null && s.add(q), await vl(), i !== (i = e())) {
|
|
2298
|
-
var a = t.selectionStart, u = t.selectionEnd;
|
|
2299
|
-
t.value = i ?? "", u !== null && (t.selectionStart = a, t.selectionEnd = Math.min(u, t.value.length));
|
|
2300
|
-
}
|
|
2301
|
-
}), // If we are hydrating and the value has since changed,
|
|
2302
|
-
// then use the updated value from the input instead.
|
|
2303
|
-
(I && t.defaultValue !== t.value || // If defaultValue is set, then value == defaultValue
|
|
2304
|
-
// TODO Svelte 6: remove input.value check and set to empty string?
|
|
2305
|
-
sr(e) == null && t.value) && (n(gr(t) ? vr(t.value) : t.value), q !== null && s.add(q)), nr(() => {
|
|
2306
|
-
var r = e();
|
|
2307
|
-
if (t === document.activeElement) {
|
|
2308
|
-
var i = (
|
|
2309
|
-
/** @type {Batch} */
|
|
2310
|
-
On ?? q
|
|
2311
|
-
);
|
|
2312
|
-
if (s.has(i))
|
|
2313
|
-
return;
|
|
2314
|
-
}
|
|
2315
|
-
gr(t) && r === vr(t.value) || t.type === "date" && !r && !t.value || r !== t.value && (t.value = r ?? "");
|
|
2316
|
-
});
|
|
2317
|
-
}
|
|
2318
|
-
function gr(t) {
|
|
2319
|
-
var e = t.type;
|
|
2320
|
-
return e === "number" || e === "range";
|
|
2321
|
-
}
|
|
2322
|
-
function vr(t) {
|
|
2323
|
-
return t === "" ? null : +t;
|
|
2324
|
-
}
|
|
2325
|
-
function Ds(t, e) {
|
|
2326
|
-
return t === e || t?.[In] === e;
|
|
2327
|
-
}
|
|
2328
|
-
function Dl(t = {}, e, n, s) {
|
|
2329
|
-
return Ti(() => {
|
|
2330
|
-
var r, i;
|
|
2331
|
-
return nr(() => {
|
|
2332
|
-
r = i, i = [], sr(() => {
|
|
2333
|
-
t !== n(...i) && (e(t, ...i), r && Ds(n(...r), t) && e(null, ...r));
|
|
2334
|
-
});
|
|
2335
|
-
}), () => {
|
|
2336
|
-
mt(() => {
|
|
2337
|
-
i && Ds(n(...i), t) && e(null, ...i);
|
|
2338
|
-
});
|
|
2339
|
-
};
|
|
2340
|
-
}), t;
|
|
2341
|
-
}
|
|
2342
|
-
function Et(t, e, n, s) {
|
|
2343
|
-
var r = (
|
|
2344
|
-
/** @type {V} */
|
|
2345
|
-
s
|
|
2346
|
-
), i = !0, a = () => (i && (i = !1, r = /** @type {V} */
|
|
2347
|
-
s), r), u;
|
|
2348
|
-
u = /** @type {V} */
|
|
2349
|
-
t[e], u === void 0 && s !== void 0 && (u = a());
|
|
2350
|
-
var l;
|
|
2351
|
-
l = () => {
|
|
2352
|
-
var p = (
|
|
2353
|
-
/** @type {V} */
|
|
2354
|
-
t[e]
|
|
2355
|
-
);
|
|
2356
|
-
return p === void 0 ? a() : (i = !0, p);
|
|
2357
|
-
};
|
|
2358
|
-
var c = !1, f = /* @__PURE__ */ er(() => (c = !1, l())), d = (
|
|
2359
|
-
/** @type {Effect} */
|
|
2360
|
-
C
|
|
2361
|
-
);
|
|
2362
|
-
return (
|
|
2363
|
-
/** @type {() => V} */
|
|
2364
|
-
(function(p, v) {
|
|
2365
|
-
if (arguments.length > 0) {
|
|
2366
|
-
const h = v ? m(f) : p;
|
|
2367
|
-
return F(f, h), c = !0, r !== void 0 && (r = h), p;
|
|
2368
|
-
}
|
|
2369
|
-
return Mt && c || (d.f & Ot) !== 0 ? f.v : m(f);
|
|
2370
|
-
})
|
|
2371
|
-
);
|
|
2372
|
-
}
|
|
2373
|
-
function Ml(t) {
|
|
2374
|
-
return new Pl(t);
|
|
2375
|
-
}
|
|
2376
|
-
class Pl {
|
|
2377
|
-
/** @type {any} */
|
|
2378
|
-
#t;
|
|
2379
|
-
/** @type {Record<string, any>} */
|
|
2380
|
-
#e;
|
|
2381
|
-
/**
|
|
2382
|
-
* @param {ComponentConstructorOptions & {
|
|
2383
|
-
* component: any;
|
|
2384
|
-
* }} options
|
|
2385
|
-
*/
|
|
2386
|
-
constructor(e) {
|
|
2387
|
-
var n = /* @__PURE__ */ new Map(), s = (i, a) => {
|
|
2388
|
-
var u = /* @__PURE__ */ di(a, !1, !1);
|
|
2389
|
-
return n.set(i, u), u;
|
|
2390
|
-
};
|
|
2391
|
-
const r = new Proxy(
|
|
2392
|
-
{ ...e.props || {}, $$events: {} },
|
|
2393
|
-
{
|
|
2394
|
-
get(i, a) {
|
|
2395
|
-
return m(n.get(a) ?? s(a, Reflect.get(i, a)));
|
|
2396
|
-
},
|
|
2397
|
-
has(i, a) {
|
|
2398
|
-
return a === La ? !0 : (m(n.get(a) ?? s(a, Reflect.get(i, a))), Reflect.has(i, a));
|
|
2399
|
-
},
|
|
2400
|
-
set(i, a, u) {
|
|
2401
|
-
return F(n.get(a) ?? s(a, u), u), Reflect.set(i, a, u);
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
);
|
|
2405
|
-
this.#e = (e.hydrate ? xl : Hi)(e.component, {
|
|
2406
|
-
target: e.target,
|
|
2407
|
-
anchor: e.anchor,
|
|
2408
|
-
props: r,
|
|
2409
|
-
context: e.context,
|
|
2410
|
-
intro: e.intro ?? !1,
|
|
2411
|
-
recover: e.recover
|
|
2412
|
-
}), (!e?.props?.$$host || e.sync === !1) && ot(), this.#t = r.$$events;
|
|
2413
|
-
for (const i of Object.keys(this.#e))
|
|
2414
|
-
i === "$set" || i === "$destroy" || i === "$on" || Kt(this, i, {
|
|
2415
|
-
get() {
|
|
2416
|
-
return this.#e[i];
|
|
2417
|
-
},
|
|
2418
|
-
/** @param {any} value */
|
|
2419
|
-
set(a) {
|
|
2420
|
-
this.#e[i] = a;
|
|
2421
|
-
},
|
|
2422
|
-
enumerable: !0
|
|
2423
|
-
});
|
|
2424
|
-
this.#e.$set = /** @param {Record<string, any>} next */
|
|
2425
|
-
(i) => {
|
|
2426
|
-
Object.assign(r, i);
|
|
2427
|
-
}, this.#e.$destroy = () => {
|
|
2428
|
-
yl(this.#e);
|
|
2429
|
-
};
|
|
2430
|
-
}
|
|
2431
|
-
/** @param {Record<string, any>} props */
|
|
2432
|
-
$set(e) {
|
|
2433
|
-
this.#e.$set(e);
|
|
2434
|
-
}
|
|
2435
|
-
/**
|
|
2436
|
-
* @param {string} event
|
|
2437
|
-
* @param {(...args: any[]) => any} callback
|
|
2438
|
-
* @returns {any}
|
|
2439
|
-
*/
|
|
2440
|
-
$on(e, n) {
|
|
2441
|
-
this.#t[e] = this.#t[e] || [];
|
|
2442
|
-
const s = (...r) => n.call(this, ...r);
|
|
2443
|
-
return this.#t[e].push(s), () => {
|
|
2444
|
-
this.#t[e] = this.#t[e].filter(
|
|
2445
|
-
/** @param {any} fn */
|
|
2446
|
-
(r) => r !== s
|
|
2447
|
-
);
|
|
2448
|
-
};
|
|
2449
|
-
}
|
|
2450
|
-
$destroy() {
|
|
2451
|
-
this.#e.$destroy();
|
|
2452
|
-
}
|
|
2453
|
-
}
|
|
2454
|
-
let ji;
|
|
2455
|
-
typeof HTMLElement == "function" && (ji = class extends HTMLElement {
|
|
2456
|
-
/** The Svelte component constructor */
|
|
2457
|
-
$$ctor;
|
|
2458
|
-
/** Slots */
|
|
2459
|
-
$$s;
|
|
2460
|
-
/** @type {any} The Svelte component instance */
|
|
2461
|
-
$$c;
|
|
2462
|
-
/** Whether or not the custom element is connected */
|
|
2463
|
-
$$cn = !1;
|
|
2464
|
-
/** @type {Record<string, any>} Component props data */
|
|
2465
|
-
$$d = {};
|
|
2466
|
-
/** `true` if currently in the process of reflecting component props back to attributes */
|
|
2467
|
-
$$r = !1;
|
|
2468
|
-
/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
|
|
2469
|
-
$$p_d = {};
|
|
2470
|
-
/** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
|
|
2471
|
-
$$l = {};
|
|
2472
|
-
/** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
|
|
2473
|
-
$$l_u = /* @__PURE__ */ new Map();
|
|
2474
|
-
/** @type {any} The managed render effect for reflecting attributes */
|
|
2475
|
-
$$me;
|
|
2476
|
-
/**
|
|
2477
|
-
* @param {*} $$componentCtor
|
|
2478
|
-
* @param {*} $$slots
|
|
2479
|
-
* @param {*} use_shadow_dom
|
|
2480
|
-
*/
|
|
2481
|
-
constructor(t, e, n) {
|
|
2482
|
-
super(), this.$$ctor = t, this.$$s = e, n && this.attachShadow({ mode: "open" });
|
|
2483
|
-
}
|
|
2484
|
-
/**
|
|
2485
|
-
* @param {string} type
|
|
2486
|
-
* @param {EventListenerOrEventListenerObject} listener
|
|
2487
|
-
* @param {boolean | AddEventListenerOptions} [options]
|
|
2488
|
-
*/
|
|
2489
|
-
addEventListener(t, e, n) {
|
|
2490
|
-
if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(e), this.$$c) {
|
|
2491
|
-
const s = this.$$c.$on(t, e);
|
|
2492
|
-
this.$$l_u.set(e, s);
|
|
2493
|
-
}
|
|
2494
|
-
super.addEventListener(t, e, n);
|
|
2495
|
-
}
|
|
2496
|
-
/**
|
|
2497
|
-
* @param {string} type
|
|
2498
|
-
* @param {EventListenerOrEventListenerObject} listener
|
|
2499
|
-
* @param {boolean | AddEventListenerOptions} [options]
|
|
2500
|
-
*/
|
|
2501
|
-
removeEventListener(t, e, n) {
|
|
2502
|
-
if (super.removeEventListener(t, e, n), this.$$c) {
|
|
2503
|
-
const s = this.$$l_u.get(e);
|
|
2504
|
-
s && (s(), this.$$l_u.delete(e));
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
|
-
async connectedCallback() {
|
|
2508
|
-
if (this.$$cn = !0, !this.$$c) {
|
|
2509
|
-
let t = function(s) {
|
|
2510
|
-
return (r) => {
|
|
2511
|
-
const i = document.createElement("slot");
|
|
2512
|
-
s !== "default" && (i.name = s), K(r, i);
|
|
2513
|
-
};
|
|
2514
|
-
};
|
|
2515
|
-
if (await Promise.resolve(), !this.$$cn || this.$$c)
|
|
2516
|
-
return;
|
|
2517
|
-
const e = {}, n = zl(this);
|
|
2518
|
-
for (const s of this.$$s)
|
|
2519
|
-
s in n && (s === "default" && !this.$$d.children ? (this.$$d.children = t(s), e.default = !0) : e[s] = t(s));
|
|
2520
|
-
for (const s of this.attributes) {
|
|
2521
|
-
const r = this.$$g_p(s.name);
|
|
2522
|
-
r in this.$$d || (this.$$d[r] = Nn(r, s.value, this.$$p_d, "toProp"));
|
|
2523
|
-
}
|
|
2524
|
-
for (const s in this.$$p_d)
|
|
2525
|
-
!(s in this.$$d) && this[s] !== void 0 && (this.$$d[s] = this[s], delete this[s]);
|
|
2526
|
-
this.$$c = Ml({
|
|
2527
|
-
component: this.$$ctor,
|
|
2528
|
-
target: this.shadowRoot || this,
|
|
2529
|
-
props: {
|
|
2530
|
-
...this.$$d,
|
|
2531
|
-
$$slots: e,
|
|
2532
|
-
$$host: this
|
|
2533
|
-
}
|
|
2534
|
-
}), this.$$me = cl(() => {
|
|
2535
|
-
nr(() => {
|
|
2536
|
-
this.$$r = !0;
|
|
2537
|
-
for (const s of Mn(this.$$c)) {
|
|
2538
|
-
if (!this.$$p_d[s]?.reflect) continue;
|
|
2539
|
-
this.$$d[s] = this.$$c[s];
|
|
2540
|
-
const r = Nn(
|
|
2541
|
-
s,
|
|
2542
|
-
this.$$d[s],
|
|
2543
|
-
this.$$p_d,
|
|
2544
|
-
"toAttribute"
|
|
2545
|
-
);
|
|
2546
|
-
r == null ? this.removeAttribute(this.$$p_d[s].attribute || s) : this.setAttribute(this.$$p_d[s].attribute || s, r);
|
|
2547
|
-
}
|
|
2548
|
-
this.$$r = !1;
|
|
2549
|
-
});
|
|
2550
|
-
});
|
|
2551
|
-
for (const s in this.$$l)
|
|
2552
|
-
for (const r of this.$$l[s]) {
|
|
2553
|
-
const i = this.$$c.$on(s, r);
|
|
2554
|
-
this.$$l_u.set(r, i);
|
|
2555
|
-
}
|
|
2556
|
-
this.$$l = {};
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
|
|
2560
|
-
// and setting attributes through setAttribute etc, this is helpful
|
|
2561
|
-
/**
|
|
2562
|
-
* @param {string} attr
|
|
2563
|
-
* @param {string} _oldValue
|
|
2564
|
-
* @param {string} newValue
|
|
2565
|
-
*/
|
|
2566
|
-
attributeChangedCallback(t, e, n) {
|
|
2567
|
-
this.$$r || (t = this.$$g_p(t), this.$$d[t] = Nn(t, n, this.$$p_d, "toProp"), this.$$c?.$set({ [t]: this.$$d[t] }));
|
|
2568
|
-
}
|
|
2569
|
-
disconnectedCallback() {
|
|
2570
|
-
this.$$cn = !1, Promise.resolve().then(() => {
|
|
2571
|
-
!this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
|
|
2572
|
-
});
|
|
2573
|
-
}
|
|
2574
|
-
/**
|
|
2575
|
-
* @param {string} attribute_name
|
|
2576
|
-
*/
|
|
2577
|
-
$$g_p(t) {
|
|
2578
|
-
return Mn(this.$$p_d).find(
|
|
2579
|
-
(e) => this.$$p_d[e].attribute === t || !this.$$p_d[e].attribute && e.toLowerCase() === t
|
|
2580
|
-
) || t;
|
|
2581
|
-
}
|
|
2582
|
-
});
|
|
2583
|
-
function Nn(t, e, n, s) {
|
|
2584
|
-
const r = n[t]?.type;
|
|
2585
|
-
if (e = r === "Boolean" && typeof e != "boolean" ? e != null : e, !s || !n[t])
|
|
2586
|
-
return e;
|
|
2587
|
-
if (s === "toAttribute")
|
|
2588
|
-
switch (r) {
|
|
2589
|
-
case "Object":
|
|
2590
|
-
case "Array":
|
|
2591
|
-
return e == null ? null : JSON.stringify(e);
|
|
2592
|
-
case "Boolean":
|
|
2593
|
-
return e ? "" : null;
|
|
2594
|
-
case "Number":
|
|
2595
|
-
return e ?? null;
|
|
2596
|
-
default:
|
|
2597
|
-
return e;
|
|
2598
|
-
}
|
|
2599
|
-
else
|
|
2600
|
-
switch (r) {
|
|
2601
|
-
case "Object":
|
|
2602
|
-
case "Array":
|
|
2603
|
-
return e && JSON.parse(e);
|
|
2604
|
-
case "Boolean":
|
|
2605
|
-
return e;
|
|
2606
|
-
// conversion already handled above
|
|
2607
|
-
case "Number":
|
|
2608
|
-
return e != null ? +e : e;
|
|
2609
|
-
default:
|
|
2610
|
-
return e;
|
|
2611
|
-
}
|
|
2612
|
-
}
|
|
2613
|
-
function zl(t) {
|
|
2614
|
-
const e = {};
|
|
2615
|
-
return t.childNodes.forEach((n) => {
|
|
2616
|
-
e[
|
|
2617
|
-
/** @type {Element} node */
|
|
2618
|
-
n.slot || "default"
|
|
2619
|
-
] = !0;
|
|
2620
|
-
}), e;
|
|
2621
|
-
}
|
|
2622
|
-
function Kr(t, e, n, s, r, i) {
|
|
2623
|
-
let a = class extends ji {
|
|
2624
|
-
constructor() {
|
|
2625
|
-
super(t, n, r), this.$$p_d = e;
|
|
2626
|
-
}
|
|
2627
|
-
static get observedAttributes() {
|
|
2628
|
-
return Mn(e).map(
|
|
2629
|
-
(u) => (e[u].attribute || u).toLowerCase()
|
|
2630
|
-
);
|
|
2631
|
-
}
|
|
2632
|
-
};
|
|
2633
|
-
return Mn(e).forEach((u) => {
|
|
2634
|
-
Kt(a.prototype, u, {
|
|
2635
|
-
get() {
|
|
2636
|
-
return this.$$c && u in this.$$c ? this.$$c[u] : this.$$d[u];
|
|
2637
|
-
},
|
|
2638
|
-
set(l) {
|
|
2639
|
-
l = Nn(u, l, e), this.$$d[u] = l;
|
|
2640
|
-
var c = this.$$c;
|
|
2641
|
-
if (c) {
|
|
2642
|
-
var f = Yt(c, u)?.get;
|
|
2643
|
-
f ? c[u] = l : c.$set({ [u]: l });
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
});
|
|
2647
|
-
}), s.forEach((u) => {
|
|
2648
|
-
Kt(a.prototype, u, {
|
|
2649
|
-
get() {
|
|
2650
|
-
return this.$$c?.[u];
|
|
2651
|
-
}
|
|
2652
|
-
});
|
|
2653
|
-
}), t.element = /** @type {any} */
|
|
2654
|
-
a, a;
|
|
2655
|
-
}
|
|
2656
|
-
function Xr() {
|
|
2657
|
-
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
2658
|
-
}
|
|
2659
|
-
var Pt = Xr();
|
|
2660
|
-
function Yi(t) {
|
|
2661
|
-
Pt = t;
|
|
2662
|
-
}
|
|
2663
|
-
var mn = { exec: () => null };
|
|
2664
|
-
function M(t, e = "") {
|
|
2665
|
-
let n = typeof t == "string" ? t : t.source, s = { replace: (r, i) => {
|
|
2666
|
-
let a = typeof i == "string" ? i : i.source;
|
|
2667
|
-
return a = a.replace(he.caret, "$1"), n = n.replace(r, a), s;
|
|
2668
|
-
}, getRegex: () => new RegExp(n, e) };
|
|
2669
|
-
return s;
|
|
2670
|
-
}
|
|
2671
|
-
var Ul = (() => {
|
|
2672
|
-
try {
|
|
2673
|
-
return !!new RegExp("(?<=1)(?<!1)");
|
|
2674
|
-
} catch {
|
|
2675
|
-
return !1;
|
|
2676
|
-
}
|
|
2677
|
-
})(), he = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (t) => new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`), htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i") }, Fl = /^(?:[ \t]*(?:\n|$))+/, Hl = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Bl = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, xn = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Gl = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Qr = /(?:[*+-]|\d{1,9}[.)])/, Vi = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Zi = M(Vi).replace(/bull/g, Qr).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Wl = M(Vi).replace(/bull/g, Qr).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Jr = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ql = /^[^\n]+/, es = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, jl = M(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", es).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Yl = M(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Qr).getRegex(), ir = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", ts = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Vl = M("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ts).replace("tag", ir).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Ki = M(Jr).replace("hr", xn).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ir).getRegex(), Zl = M(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ki).getRegex(), ns = { blockquote: Zl, code: Hl, def: jl, fences: Bl, heading: Gl, hr: xn, html: Vl, lheading: Zi, list: Yl, newline: Fl, paragraph: Ki, table: mn, text: ql }, Ms = M("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", xn).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ir).getRegex(), Kl = { ...ns, lheading: Wl, table: Ms, paragraph: M(Jr).replace("hr", xn).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Ms).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ir).getRegex() }, Xl = { ...ns, html: M(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ts).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: mn, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: M(Jr).replace("hr", xn).replace("heading", ` *#{1,6} *[^
|
|
2678
|
-
]`).replace("lheading", Zi).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ql = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Jl = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Xi = /^( {2,}|\\)\n(?!\s*$)/, eo = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, ar = /[\p{P}\p{S}]/u, rs = /[\s\p{P}\p{S}]/u, Qi = /[^\s\p{P}\p{S}]/u, to = M(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rs).getRegex(), Ji = /(?!~)[\p{P}\p{S}]/u, no = /(?!~)[\s\p{P}\p{S}]/u, ro = /(?:[^\s\p{P}\p{S}]|~)/u, so = M(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Ul ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ea = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, io = M(ea, "u").replace(/punct/g, ar).getRegex(), ao = M(ea, "u").replace(/punct/g, Ji).getRegex(), ta = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", lo = M(ta, "gu").replace(/notPunctSpace/g, Qi).replace(/punctSpace/g, rs).replace(/punct/g, ar).getRegex(), oo = M(ta, "gu").replace(/notPunctSpace/g, ro).replace(/punctSpace/g, no).replace(/punct/g, Ji).getRegex(), uo = M("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Qi).replace(/punctSpace/g, rs).replace(/punct/g, ar).getRegex(), co = M(/\\(punct)/, "gu").replace(/punct/g, ar).getRegex(), fo = M(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), ho = M(ts).replace("(?:-->|$)", "-->").getRegex(), po = M("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ho).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Gn = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, go = M(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Gn).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), na = M(/^!?\[(label)\]\[(ref)\]/).replace("label", Gn).replace("ref", es).getRegex(), ra = M(/^!?\[(ref)\](?:\[\])?/).replace("ref", es).getRegex(), vo = M("reflink|nolink(?!\\()", "g").replace("reflink", na).replace("nolink", ra).getRegex(), Ps = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, ss = { _backpedal: mn, anyPunctuation: co, autolink: fo, blockSkip: so, br: Xi, code: Jl, del: mn, emStrongLDelim: io, emStrongRDelimAst: lo, emStrongRDelimUnd: uo, escape: Ql, link: go, nolink: ra, punctuation: to, reflink: na, reflinkSearch: vo, tag: po, text: eo, url: mn }, mo = { ...ss, link: M(/^!?\[(label)\]\((.*?)\)/).replace("label", Gn).getRegex(), reflink: M(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Gn).getRegex() }, Ir = { ...ss, emStrongRDelimAst: oo, emStrongLDelim: ao, url: M(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Ps).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: M(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Ps).getRegex() }, _o = { ...Ir, br: M(Xi).replace("{2,}", "*").getRegex(), text: M(Ir.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, $n = { normal: ns, gfm: Kl, pedantic: Xl }, sn = { normal: ss, gfm: Ir, breaks: _o, pedantic: mo }, bo = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, zs = (t) => bo[t];
|
|
2679
|
-
function Ke(t, e) {
|
|
2680
|
-
if (e) {
|
|
2681
|
-
if (he.escapeTest.test(t)) return t.replace(he.escapeReplace, zs);
|
|
2682
|
-
} else if (he.escapeTestNoEncode.test(t)) return t.replace(he.escapeReplaceNoEncode, zs);
|
|
2683
|
-
return t;
|
|
2684
|
-
}
|
|
2685
|
-
function Us(t) {
|
|
2686
|
-
try {
|
|
2687
|
-
t = encodeURI(t).replace(he.percentDecode, "%");
|
|
2688
|
-
} catch {
|
|
2689
|
-
return null;
|
|
2690
|
-
}
|
|
2691
|
-
return t;
|
|
2692
|
-
}
|
|
2693
|
-
function Fs(t, e) {
|
|
2694
|
-
let n = t.replace(he.findPipe, (i, a, u) => {
|
|
2695
|
-
let l = !1, c = a;
|
|
2696
|
-
for (; --c >= 0 && u[c] === "\\"; ) l = !l;
|
|
2697
|
-
return l ? "|" : " |";
|
|
2698
|
-
}), s = n.split(he.splitPipe), r = 0;
|
|
2699
|
-
if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e) if (s.length > e) s.splice(e);
|
|
2700
|
-
else for (; s.length < e; ) s.push("");
|
|
2701
|
-
for (; r < s.length; r++) s[r] = s[r].trim().replace(he.slashPipe, "|");
|
|
2702
|
-
return s;
|
|
2703
|
-
}
|
|
2704
|
-
function an(t, e, n) {
|
|
2705
|
-
let s = t.length;
|
|
2706
|
-
if (s === 0) return "";
|
|
2707
|
-
let r = 0;
|
|
2708
|
-
for (; r < s && t.charAt(s - r - 1) === e; )
|
|
2709
|
-
r++;
|
|
2710
|
-
return t.slice(0, s - r);
|
|
2711
|
-
}
|
|
2712
|
-
function ko(t, e) {
|
|
2713
|
-
if (t.indexOf(e[1]) === -1) return -1;
|
|
2714
|
-
let n = 0;
|
|
2715
|
-
for (let s = 0; s < t.length; s++) if (t[s] === "\\") s++;
|
|
2716
|
-
else if (t[s] === e[0]) n++;
|
|
2717
|
-
else if (t[s] === e[1] && (n--, n < 0)) return s;
|
|
2718
|
-
return n > 0 ? -2 : -1;
|
|
2719
|
-
}
|
|
2720
|
-
function Hs(t, e, n, s, r) {
|
|
2721
|
-
let i = e.href, a = e.title || null, u = t[1].replace(r.other.outputLinkReplace, "$1");
|
|
2722
|
-
s.state.inLink = !0;
|
|
2723
|
-
let l = { type: t[0].charAt(0) === "!" ? "image" : "link", raw: n, href: i, title: a, text: u, tokens: s.inlineTokens(u) };
|
|
2724
|
-
return s.state.inLink = !1, l;
|
|
2725
|
-
}
|
|
2726
|
-
function wo(t, e, n) {
|
|
2727
|
-
let s = t.match(n.other.indentCodeCompensation);
|
|
2728
|
-
if (s === null) return e;
|
|
2729
|
-
let r = s[1];
|
|
2730
|
-
return e.split(`
|
|
2731
|
-
`).map((i) => {
|
|
2732
|
-
let a = i.match(n.other.beginningSpace);
|
|
2733
|
-
if (a === null) return i;
|
|
2734
|
-
let [u] = a;
|
|
2735
|
-
return u.length >= r.length ? i.slice(r.length) : i;
|
|
2736
|
-
}).join(`
|
|
2737
|
-
`);
|
|
2738
|
-
}
|
|
2739
|
-
var Wn = class {
|
|
2740
|
-
options;
|
|
2741
|
-
rules;
|
|
2742
|
-
lexer;
|
|
2743
|
-
constructor(t) {
|
|
2744
|
-
this.options = t || Pt;
|
|
2745
|
-
}
|
|
2746
|
-
space(t) {
|
|
2747
|
-
let e = this.rules.block.newline.exec(t);
|
|
2748
|
-
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
2749
|
-
}
|
|
2750
|
-
code(t) {
|
|
2751
|
-
let e = this.rules.block.code.exec(t);
|
|
2752
|
-
if (e) {
|
|
2753
|
-
let n = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
2754
|
-
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : an(n, `
|
|
2755
|
-
`) };
|
|
2756
|
-
}
|
|
2757
|
-
}
|
|
2758
|
-
fences(t) {
|
|
2759
|
-
let e = this.rules.block.fences.exec(t);
|
|
2760
|
-
if (e) {
|
|
2761
|
-
let n = e[0], s = wo(n, e[3] || "", this.rules);
|
|
2762
|
-
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
heading(t) {
|
|
2766
|
-
let e = this.rules.block.heading.exec(t);
|
|
2767
|
-
if (e) {
|
|
2768
|
-
let n = e[2].trim();
|
|
2769
|
-
if (this.rules.other.endingHash.test(n)) {
|
|
2770
|
-
let s = an(n, "#");
|
|
2771
|
-
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
2772
|
-
}
|
|
2773
|
-
return { type: "heading", raw: e[0], depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
hr(t) {
|
|
2777
|
-
let e = this.rules.block.hr.exec(t);
|
|
2778
|
-
if (e) return { type: "hr", raw: an(e[0], `
|
|
2779
|
-
`) };
|
|
2780
|
-
}
|
|
2781
|
-
blockquote(t) {
|
|
2782
|
-
let e = this.rules.block.blockquote.exec(t);
|
|
2783
|
-
if (e) {
|
|
2784
|
-
let n = an(e[0], `
|
|
2785
|
-
`).split(`
|
|
2786
|
-
`), s = "", r = "", i = [];
|
|
2787
|
-
for (; n.length > 0; ) {
|
|
2788
|
-
let a = !1, u = [], l;
|
|
2789
|
-
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) u.push(n[l]), a = !0;
|
|
2790
|
-
else if (!a) u.push(n[l]);
|
|
2791
|
-
else break;
|
|
2792
|
-
n = n.slice(l);
|
|
2793
|
-
let c = u.join(`
|
|
2794
|
-
`), f = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
2795
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
2796
|
-
s = s ? `${s}
|
|
2797
|
-
${c}` : c, r = r ? `${r}
|
|
2798
|
-
${f}` : f;
|
|
2799
|
-
let d = this.lexer.state.top;
|
|
2800
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(f, i, !0), this.lexer.state.top = d, n.length === 0) break;
|
|
2801
|
-
let p = i.at(-1);
|
|
2802
|
-
if (p?.type === "code") break;
|
|
2803
|
-
if (p?.type === "blockquote") {
|
|
2804
|
-
let v = p, h = v.raw + `
|
|
2805
|
-
` + n.join(`
|
|
2806
|
-
`), x = this.blockquote(h);
|
|
2807
|
-
i[i.length - 1] = x, s = s.substring(0, s.length - v.raw.length) + x.raw, r = r.substring(0, r.length - v.text.length) + x.text;
|
|
2808
|
-
break;
|
|
2809
|
-
} else if (p?.type === "list") {
|
|
2810
|
-
let v = p, h = v.raw + `
|
|
2811
|
-
` + n.join(`
|
|
2812
|
-
`), x = this.list(h);
|
|
2813
|
-
i[i.length - 1] = x, s = s.substring(0, s.length - p.raw.length) + x.raw, r = r.substring(0, r.length - v.raw.length) + x.raw, n = h.substring(i.at(-1).raw.length).split(`
|
|
2814
|
-
`);
|
|
2815
|
-
continue;
|
|
2816
|
-
}
|
|
2817
|
-
}
|
|
2818
|
-
return { type: "blockquote", raw: s, tokens: i, text: r };
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
list(t) {
|
|
2822
|
-
let e = this.rules.block.list.exec(t);
|
|
2823
|
-
if (e) {
|
|
2824
|
-
let n = e[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: !1, items: [] };
|
|
2825
|
-
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
2826
|
-
let i = this.rules.other.listItemRegex(n), a = !1;
|
|
2827
|
-
for (; t; ) {
|
|
2828
|
-
let l = !1, c = "", f = "";
|
|
2829
|
-
if (!(e = i.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
2830
|
-
c = e[0], t = t.substring(c.length);
|
|
2831
|
-
let d = e[2].split(`
|
|
2832
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (R) => " ".repeat(3 * R.length)), p = t.split(`
|
|
2833
|
-
`, 1)[0], v = !d.trim(), h = 0;
|
|
2834
|
-
if (this.options.pedantic ? (h = 2, f = d.trimStart()) : v ? h = e[1].length + 1 : (h = e[2].search(this.rules.other.nonSpaceChar), h = h > 4 ? 1 : h, f = d.slice(h), h += e[1].length), v && this.rules.other.blankLine.test(p) && (c += p + `
|
|
2835
|
-
`, t = t.substring(p.length + 1), l = !0), !l) {
|
|
2836
|
-
let R = this.rules.other.nextBulletRegex(h), w = this.rules.other.hrRegex(h), P = this.rules.other.fencesBeginRegex(h), S = this.rules.other.headingBeginRegex(h), k = this.rules.other.htmlBeginRegex(h);
|
|
2837
|
-
for (; t; ) {
|
|
2838
|
-
let _ = t.split(`
|
|
2839
|
-
`, 1)[0], E;
|
|
2840
|
-
if (p = _, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), E = p) : E = p.replace(this.rules.other.tabCharGlobal, " "), P.test(p) || S.test(p) || k.test(p) || R.test(p) || w.test(p)) break;
|
|
2841
|
-
if (E.search(this.rules.other.nonSpaceChar) >= h || !p.trim()) f += `
|
|
2842
|
-
` + E.slice(h);
|
|
2843
|
-
else {
|
|
2844
|
-
if (v || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || P.test(d) || S.test(d) || w.test(d)) break;
|
|
2845
|
-
f += `
|
|
2846
|
-
` + p;
|
|
2847
|
-
}
|
|
2848
|
-
!v && !p.trim() && (v = !0), c += _ + `
|
|
2849
|
-
`, t = t.substring(_.length + 1), d = E.slice(h);
|
|
2850
|
-
}
|
|
2851
|
-
}
|
|
2852
|
-
r.loose || (a ? r.loose = !0 : this.rules.other.doubleBlankLine.test(c) && (a = !0));
|
|
2853
|
-
let x = null, T;
|
|
2854
|
-
this.options.gfm && (x = this.rules.other.listIsTask.exec(f), x && (T = x[0] !== "[ ] ", f = f.replace(this.rules.other.listReplaceTask, ""))), r.items.push({ type: "list_item", raw: c, task: !!x, checked: T, loose: !1, text: f, tokens: [] }), r.raw += c;
|
|
2855
|
-
}
|
|
2856
|
-
let u = r.items.at(-1);
|
|
2857
|
-
if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
2858
|
-
else return;
|
|
2859
|
-
r.raw = r.raw.trimEnd();
|
|
2860
|
-
for (let l = 0; l < r.items.length; l++) if (this.lexer.state.top = !1, r.items[l].tokens = this.lexer.blockTokens(r.items[l].text, []), !r.loose) {
|
|
2861
|
-
let c = r.items[l].tokens.filter((d) => d.type === "space"), f = c.length > 0 && c.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
2862
|
-
r.loose = f;
|
|
2863
|
-
}
|
|
2864
|
-
if (r.loose) for (let l = 0; l < r.items.length; l++) r.items[l].loose = !0;
|
|
2865
|
-
return r;
|
|
2866
|
-
}
|
|
2867
|
-
}
|
|
2868
|
-
html(t) {
|
|
2869
|
-
let e = this.rules.block.html.exec(t);
|
|
2870
|
-
if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
|
|
2871
|
-
}
|
|
2872
|
-
def(t) {
|
|
2873
|
-
let e = this.rules.block.def.exec(t);
|
|
2874
|
-
if (e) {
|
|
2875
|
-
let n = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
2876
|
-
return { type: "def", tag: n, raw: e[0], href: s, title: r };
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
table(t) {
|
|
2880
|
-
let e = this.rules.block.table.exec(t);
|
|
2881
|
-
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
2882
|
-
let n = Fs(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
2883
|
-
`) : [], i = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
2884
|
-
if (n.length === s.length) {
|
|
2885
|
-
for (let a of s) this.rules.other.tableAlignRight.test(a) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? i.align.push("left") : i.align.push(null);
|
|
2886
|
-
for (let a = 0; a < n.length; a++) i.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: !0, align: i.align[a] });
|
|
2887
|
-
for (let a of r) i.rows.push(Fs(a, i.header.length).map((u, l) => ({ text: u, tokens: this.lexer.inline(u), header: !1, align: i.align[l] })));
|
|
2888
|
-
return i;
|
|
2889
|
-
}
|
|
2890
|
-
}
|
|
2891
|
-
lheading(t) {
|
|
2892
|
-
let e = this.rules.block.lheading.exec(t);
|
|
2893
|
-
if (e) return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: e[1], tokens: this.lexer.inline(e[1]) };
|
|
2894
|
-
}
|
|
2895
|
-
paragraph(t) {
|
|
2896
|
-
let e = this.rules.block.paragraph.exec(t);
|
|
2897
|
-
if (e) {
|
|
2898
|
-
let n = e[1].charAt(e[1].length - 1) === `
|
|
2899
|
-
` ? e[1].slice(0, -1) : e[1];
|
|
2900
|
-
return { type: "paragraph", raw: e[0], text: n, tokens: this.lexer.inline(n) };
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
text(t) {
|
|
2904
|
-
let e = this.rules.block.text.exec(t);
|
|
2905
|
-
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
2906
|
-
}
|
|
2907
|
-
escape(t) {
|
|
2908
|
-
let e = this.rules.inline.escape.exec(t);
|
|
2909
|
-
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
2910
|
-
}
|
|
2911
|
-
tag(t) {
|
|
2912
|
-
let e = this.rules.inline.tag.exec(t);
|
|
2913
|
-
if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: e[0] };
|
|
2914
|
-
}
|
|
2915
|
-
link(t) {
|
|
2916
|
-
let e = this.rules.inline.link.exec(t);
|
|
2917
|
-
if (e) {
|
|
2918
|
-
let n = e[2].trim();
|
|
2919
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
2920
|
-
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
2921
|
-
let i = an(n.slice(0, -1), "\\");
|
|
2922
|
-
if ((n.length - i.length) % 2 === 0) return;
|
|
2923
|
-
} else {
|
|
2924
|
-
let i = ko(e[2], "()");
|
|
2925
|
-
if (i === -2) return;
|
|
2926
|
-
if (i > -1) {
|
|
2927
|
-
let a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
|
|
2928
|
-
e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, a).trim(), e[3] = "";
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
let s = e[2], r = "";
|
|
2932
|
-
if (this.options.pedantic) {
|
|
2933
|
-
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
2934
|
-
i && (s = i[1], r = i[3]);
|
|
2935
|
-
} else r = e[3] ? e[3].slice(1, -1) : "";
|
|
2936
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), Hs(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
reflink(t, e) {
|
|
2940
|
-
let n;
|
|
2941
|
-
if ((n = this.rules.inline.reflink.exec(t)) || (n = this.rules.inline.nolink.exec(t))) {
|
|
2942
|
-
let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = e[s.toLowerCase()];
|
|
2943
|
-
if (!r) {
|
|
2944
|
-
let i = n[0].charAt(0);
|
|
2945
|
-
return { type: "text", raw: i, text: i };
|
|
2946
|
-
}
|
|
2947
|
-
return Hs(n, r, n[0], this.lexer, this.rules);
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
emStrong(t, e, n = "") {
|
|
2951
|
-
let s = this.rules.inline.emStrongLDelim.exec(t);
|
|
2952
|
-
if (!(!s || s[3] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[2]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
2953
|
-
let r = [...s[0]].length - 1, i, a, u = r, l = 0, c = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
2954
|
-
for (c.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = c.exec(e)) != null; ) {
|
|
2955
|
-
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
2956
|
-
if (a = [...i].length, s[3] || s[4]) {
|
|
2957
|
-
u += a;
|
|
2958
|
-
continue;
|
|
2959
|
-
} else if ((s[5] || s[6]) && r % 3 && !((r + a) % 3)) {
|
|
2960
|
-
l += a;
|
|
2961
|
-
continue;
|
|
2962
|
-
}
|
|
2963
|
-
if (u -= a, u > 0) continue;
|
|
2964
|
-
a = Math.min(a, a + u + l);
|
|
2965
|
-
let f = [...s[0]][0].length, d = t.slice(0, r + s.index + f + a);
|
|
2966
|
-
if (Math.min(r, a) % 2) {
|
|
2967
|
-
let v = d.slice(1, -1);
|
|
2968
|
-
return { type: "em", raw: d, text: v, tokens: this.lexer.inlineTokens(v) };
|
|
2969
|
-
}
|
|
2970
|
-
let p = d.slice(2, -2);
|
|
2971
|
-
return { type: "strong", raw: d, text: p, tokens: this.lexer.inlineTokens(p) };
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
codespan(t) {
|
|
2976
|
-
let e = this.rules.inline.code.exec(t);
|
|
2977
|
-
if (e) {
|
|
2978
|
-
let n = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
2979
|
-
return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: e[0], text: n };
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
br(t) {
|
|
2983
|
-
let e = this.rules.inline.br.exec(t);
|
|
2984
|
-
if (e) return { type: "br", raw: e[0] };
|
|
2985
|
-
}
|
|
2986
|
-
del(t) {
|
|
2987
|
-
let e = this.rules.inline.del.exec(t);
|
|
2988
|
-
if (e) return { type: "del", raw: e[0], text: e[2], tokens: this.lexer.inlineTokens(e[2]) };
|
|
2989
|
-
}
|
|
2990
|
-
autolink(t) {
|
|
2991
|
-
let e = this.rules.inline.autolink.exec(t);
|
|
2992
|
-
if (e) {
|
|
2993
|
-
let n, s;
|
|
2994
|
-
return e[2] === "@" ? (n = e[1], s = "mailto:" + n) : (n = e[1], s = n), { type: "link", raw: e[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
url(t) {
|
|
2998
|
-
let e;
|
|
2999
|
-
if (e = this.rules.inline.url.exec(t)) {
|
|
3000
|
-
let n, s;
|
|
3001
|
-
if (e[2] === "@") n = e[0], s = "mailto:" + n;
|
|
3002
|
-
else {
|
|
3003
|
-
let r;
|
|
3004
|
-
do
|
|
3005
|
-
r = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
3006
|
-
while (r !== e[0]);
|
|
3007
|
-
n = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
3008
|
-
}
|
|
3009
|
-
return { type: "link", raw: e[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
3010
|
-
}
|
|
3011
|
-
}
|
|
3012
|
-
inlineText(t) {
|
|
3013
|
-
let e = this.rules.inline.text.exec(t);
|
|
3014
|
-
if (e) {
|
|
3015
|
-
let n = this.lexer.state.inRawBlock;
|
|
3016
|
-
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
3017
|
-
}
|
|
3018
|
-
}
|
|
3019
|
-
}, ze = class Or {
|
|
3020
|
-
tokens;
|
|
3021
|
-
options;
|
|
3022
|
-
state;
|
|
3023
|
-
tokenizer;
|
|
3024
|
-
inlineQueue;
|
|
3025
|
-
constructor(e) {
|
|
3026
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || Pt, this.options.tokenizer = this.options.tokenizer || new Wn(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
3027
|
-
let n = { other: he, block: $n.normal, inline: sn.normal };
|
|
3028
|
-
this.options.pedantic ? (n.block = $n.pedantic, n.inline = sn.pedantic) : this.options.gfm && (n.block = $n.gfm, this.options.breaks ? n.inline = sn.breaks : n.inline = sn.gfm), this.tokenizer.rules = n;
|
|
3029
|
-
}
|
|
3030
|
-
static get rules() {
|
|
3031
|
-
return { block: $n, inline: sn };
|
|
3032
|
-
}
|
|
3033
|
-
static lex(e, n) {
|
|
3034
|
-
return new Or(n).lex(e);
|
|
3035
|
-
}
|
|
3036
|
-
static lexInline(e, n) {
|
|
3037
|
-
return new Or(n).inlineTokens(e);
|
|
3038
|
-
}
|
|
3039
|
-
lex(e) {
|
|
3040
|
-
e = e.replace(he.carriageReturn, `
|
|
3041
|
-
`), this.blockTokens(e, this.tokens);
|
|
3042
|
-
for (let n = 0; n < this.inlineQueue.length; n++) {
|
|
3043
|
-
let s = this.inlineQueue[n];
|
|
3044
|
-
this.inlineTokens(s.src, s.tokens);
|
|
3045
|
-
}
|
|
3046
|
-
return this.inlineQueue = [], this.tokens;
|
|
3047
|
-
}
|
|
3048
|
-
blockTokens(e, n = [], s = !1) {
|
|
3049
|
-
for (this.options.pedantic && (e = e.replace(he.tabCharGlobal, " ").replace(he.spaceLine, "")); e; ) {
|
|
3050
|
-
let r;
|
|
3051
|
-
if (this.options.extensions?.block?.some((a) => (r = a.call({ lexer: this }, e, n)) ? (e = e.substring(r.raw.length), n.push(r), !0) : !1)) continue;
|
|
3052
|
-
if (r = this.tokenizer.space(e)) {
|
|
3053
|
-
e = e.substring(r.raw.length);
|
|
3054
|
-
let a = n.at(-1);
|
|
3055
|
-
r.raw.length === 1 && a !== void 0 ? a.raw += `
|
|
3056
|
-
` : n.push(r);
|
|
3057
|
-
continue;
|
|
3058
|
-
}
|
|
3059
|
-
if (r = this.tokenizer.code(e)) {
|
|
3060
|
-
e = e.substring(r.raw.length);
|
|
3061
|
-
let a = n.at(-1);
|
|
3062
|
-
a?.type === "paragraph" || a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
3063
|
-
`) ? "" : `
|
|
3064
|
-
`) + r.raw, a.text += `
|
|
3065
|
-
` + r.text, this.inlineQueue.at(-1).src = a.text) : n.push(r);
|
|
3066
|
-
continue;
|
|
3067
|
-
}
|
|
3068
|
-
if (r = this.tokenizer.fences(e)) {
|
|
3069
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3070
|
-
continue;
|
|
3071
|
-
}
|
|
3072
|
-
if (r = this.tokenizer.heading(e)) {
|
|
3073
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3074
|
-
continue;
|
|
3075
|
-
}
|
|
3076
|
-
if (r = this.tokenizer.hr(e)) {
|
|
3077
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3078
|
-
continue;
|
|
3079
|
-
}
|
|
3080
|
-
if (r = this.tokenizer.blockquote(e)) {
|
|
3081
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3082
|
-
continue;
|
|
3083
|
-
}
|
|
3084
|
-
if (r = this.tokenizer.list(e)) {
|
|
3085
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3086
|
-
continue;
|
|
3087
|
-
}
|
|
3088
|
-
if (r = this.tokenizer.html(e)) {
|
|
3089
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3090
|
-
continue;
|
|
3091
|
-
}
|
|
3092
|
-
if (r = this.tokenizer.def(e)) {
|
|
3093
|
-
e = e.substring(r.raw.length);
|
|
3094
|
-
let a = n.at(-1);
|
|
3095
|
-
a?.type === "paragraph" || a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
3096
|
-
`) ? "" : `
|
|
3097
|
-
`) + r.raw, a.text += `
|
|
3098
|
-
` + r.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, n.push(r));
|
|
3099
|
-
continue;
|
|
3100
|
-
}
|
|
3101
|
-
if (r = this.tokenizer.table(e)) {
|
|
3102
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3103
|
-
continue;
|
|
3104
|
-
}
|
|
3105
|
-
if (r = this.tokenizer.lheading(e)) {
|
|
3106
|
-
e = e.substring(r.raw.length), n.push(r);
|
|
3107
|
-
continue;
|
|
3108
|
-
}
|
|
3109
|
-
let i = e;
|
|
3110
|
-
if (this.options.extensions?.startBlock) {
|
|
3111
|
-
let a = 1 / 0, u = e.slice(1), l;
|
|
3112
|
-
this.options.extensions.startBlock.forEach((c) => {
|
|
3113
|
-
l = c.call({ lexer: this }, u), typeof l == "number" && l >= 0 && (a = Math.min(a, l));
|
|
3114
|
-
}), a < 1 / 0 && a >= 0 && (i = e.substring(0, a + 1));
|
|
3115
|
-
}
|
|
3116
|
-
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
3117
|
-
let a = n.at(-1);
|
|
3118
|
-
s && a?.type === "paragraph" ? (a.raw += (a.raw.endsWith(`
|
|
3119
|
-
`) ? "" : `
|
|
3120
|
-
`) + r.raw, a.text += `
|
|
3121
|
-
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : n.push(r), s = i.length !== e.length, e = e.substring(r.raw.length);
|
|
3122
|
-
continue;
|
|
3123
|
-
}
|
|
3124
|
-
if (r = this.tokenizer.text(e)) {
|
|
3125
|
-
e = e.substring(r.raw.length);
|
|
3126
|
-
let a = n.at(-1);
|
|
3127
|
-
a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
3128
|
-
`) ? "" : `
|
|
3129
|
-
`) + r.raw, a.text += `
|
|
3130
|
-
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : n.push(r);
|
|
3131
|
-
continue;
|
|
3132
|
-
}
|
|
3133
|
-
if (e) {
|
|
3134
|
-
let a = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
3135
|
-
if (this.options.silent) {
|
|
3136
|
-
console.error(a);
|
|
3137
|
-
break;
|
|
3138
|
-
} else throw new Error(a);
|
|
3139
|
-
}
|
|
3140
|
-
}
|
|
3141
|
-
return this.state.top = !0, n;
|
|
3142
|
-
}
|
|
3143
|
-
inline(e, n = []) {
|
|
3144
|
-
return this.inlineQueue.push({ src: e, tokens: n }), n;
|
|
3145
|
-
}
|
|
3146
|
-
inlineTokens(e, n = []) {
|
|
3147
|
-
let s = e, r = null;
|
|
3148
|
-
if (this.tokens.links) {
|
|
3149
|
-
let l = Object.keys(this.tokens.links);
|
|
3150
|
-
if (l.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) l.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
3151
|
-
}
|
|
3152
|
-
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, r.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
3153
|
-
let i;
|
|
3154
|
-
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) i = r[2] ? r[2].length : 0, s = s.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
3155
|
-
s = this.options.hooks?.emStrongMask?.call({ lexer: this }, s) ?? s;
|
|
3156
|
-
let a = !1, u = "";
|
|
3157
|
-
for (; e; ) {
|
|
3158
|
-
a || (u = ""), a = !1;
|
|
3159
|
-
let l;
|
|
3160
|
-
if (this.options.extensions?.inline?.some((f) => (l = f.call({ lexer: this }, e, n)) ? (e = e.substring(l.raw.length), n.push(l), !0) : !1)) continue;
|
|
3161
|
-
if (l = this.tokenizer.escape(e)) {
|
|
3162
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3163
|
-
continue;
|
|
3164
|
-
}
|
|
3165
|
-
if (l = this.tokenizer.tag(e)) {
|
|
3166
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3167
|
-
continue;
|
|
3168
|
-
}
|
|
3169
|
-
if (l = this.tokenizer.link(e)) {
|
|
3170
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3171
|
-
continue;
|
|
3172
|
-
}
|
|
3173
|
-
if (l = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
3174
|
-
e = e.substring(l.raw.length);
|
|
3175
|
-
let f = n.at(-1);
|
|
3176
|
-
l.type === "text" && f?.type === "text" ? (f.raw += l.raw, f.text += l.text) : n.push(l);
|
|
3177
|
-
continue;
|
|
3178
|
-
}
|
|
3179
|
-
if (l = this.tokenizer.emStrong(e, s, u)) {
|
|
3180
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3181
|
-
continue;
|
|
3182
|
-
}
|
|
3183
|
-
if (l = this.tokenizer.codespan(e)) {
|
|
3184
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3185
|
-
continue;
|
|
3186
|
-
}
|
|
3187
|
-
if (l = this.tokenizer.br(e)) {
|
|
3188
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3189
|
-
continue;
|
|
3190
|
-
}
|
|
3191
|
-
if (l = this.tokenizer.del(e)) {
|
|
3192
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3193
|
-
continue;
|
|
3194
|
-
}
|
|
3195
|
-
if (l = this.tokenizer.autolink(e)) {
|
|
3196
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3197
|
-
continue;
|
|
3198
|
-
}
|
|
3199
|
-
if (!this.state.inLink && (l = this.tokenizer.url(e))) {
|
|
3200
|
-
e = e.substring(l.raw.length), n.push(l);
|
|
3201
|
-
continue;
|
|
3202
|
-
}
|
|
3203
|
-
let c = e;
|
|
3204
|
-
if (this.options.extensions?.startInline) {
|
|
3205
|
-
let f = 1 / 0, d = e.slice(1), p;
|
|
3206
|
-
this.options.extensions.startInline.forEach((v) => {
|
|
3207
|
-
p = v.call({ lexer: this }, d), typeof p == "number" && p >= 0 && (f = Math.min(f, p));
|
|
3208
|
-
}), f < 1 / 0 && f >= 0 && (c = e.substring(0, f + 1));
|
|
3209
|
-
}
|
|
3210
|
-
if (l = this.tokenizer.inlineText(c)) {
|
|
3211
|
-
e = e.substring(l.raw.length), l.raw.slice(-1) !== "_" && (u = l.raw.slice(-1)), a = !0;
|
|
3212
|
-
let f = n.at(-1);
|
|
3213
|
-
f?.type === "text" ? (f.raw += l.raw, f.text += l.text) : n.push(l);
|
|
3214
|
-
continue;
|
|
3215
|
-
}
|
|
3216
|
-
if (e) {
|
|
3217
|
-
let f = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
3218
|
-
if (this.options.silent) {
|
|
3219
|
-
console.error(f);
|
|
3220
|
-
break;
|
|
3221
|
-
} else throw new Error(f);
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
return n;
|
|
3225
|
-
}
|
|
3226
|
-
}, qn = class {
|
|
3227
|
-
options;
|
|
3228
|
-
parser;
|
|
3229
|
-
constructor(t) {
|
|
3230
|
-
this.options = t || Pt;
|
|
3231
|
-
}
|
|
3232
|
-
space(t) {
|
|
3233
|
-
return "";
|
|
3234
|
-
}
|
|
3235
|
-
code({ text: t, lang: e, escaped: n }) {
|
|
3236
|
-
let s = (e || "").match(he.notSpaceStart)?.[0], r = t.replace(he.endingNewline, "") + `
|
|
3237
|
-
`;
|
|
3238
|
-
return s ? '<pre><code class="language-' + Ke(s) + '">' + (n ? r : Ke(r, !0)) + `</code></pre>
|
|
3239
|
-
` : "<pre><code>" + (n ? r : Ke(r, !0)) + `</code></pre>
|
|
3240
|
-
`;
|
|
3241
|
-
}
|
|
3242
|
-
blockquote({ tokens: t }) {
|
|
3243
|
-
return `<blockquote>
|
|
3244
|
-
${this.parser.parse(t)}</blockquote>
|
|
3245
|
-
`;
|
|
3246
|
-
}
|
|
3247
|
-
html({ text: t }) {
|
|
3248
|
-
return t;
|
|
3249
|
-
}
|
|
3250
|
-
def(t) {
|
|
3251
|
-
return "";
|
|
3252
|
-
}
|
|
3253
|
-
heading({ tokens: t, depth: e }) {
|
|
3254
|
-
return `<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
3255
|
-
`;
|
|
3256
|
-
}
|
|
3257
|
-
hr(t) {
|
|
3258
|
-
return `<hr>
|
|
3259
|
-
`;
|
|
3260
|
-
}
|
|
3261
|
-
list(t) {
|
|
3262
|
-
let e = t.ordered, n = t.start, s = "";
|
|
3263
|
-
for (let a = 0; a < t.items.length; a++) {
|
|
3264
|
-
let u = t.items[a];
|
|
3265
|
-
s += this.listitem(u);
|
|
3266
|
-
}
|
|
3267
|
-
let r = e ? "ol" : "ul", i = e && n !== 1 ? ' start="' + n + '"' : "";
|
|
3268
|
-
return "<" + r + i + `>
|
|
3269
|
-
` + s + "</" + r + `>
|
|
3270
|
-
`;
|
|
3271
|
-
}
|
|
3272
|
-
listitem(t) {
|
|
3273
|
-
let e = "";
|
|
3274
|
-
if (t.task) {
|
|
3275
|
-
let n = this.checkbox({ checked: !!t.checked });
|
|
3276
|
-
t.loose ? t.tokens[0]?.type === "paragraph" ? (t.tokens[0].text = n + " " + t.tokens[0].text, t.tokens[0].tokens && t.tokens[0].tokens.length > 0 && t.tokens[0].tokens[0].type === "text" && (t.tokens[0].tokens[0].text = n + " " + Ke(t.tokens[0].tokens[0].text), t.tokens[0].tokens[0].escaped = !0)) : t.tokens.unshift({ type: "text", raw: n + " ", text: n + " ", escaped: !0 }) : e += n + " ";
|
|
3277
|
-
}
|
|
3278
|
-
return e += this.parser.parse(t.tokens, !!t.loose), `<li>${e}</li>
|
|
3279
|
-
`;
|
|
3280
|
-
}
|
|
3281
|
-
checkbox({ checked: t }) {
|
|
3282
|
-
return "<input " + (t ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
3283
|
-
}
|
|
3284
|
-
paragraph({ tokens: t }) {
|
|
3285
|
-
return `<p>${this.parser.parseInline(t)}</p>
|
|
3286
|
-
`;
|
|
3287
|
-
}
|
|
3288
|
-
table(t) {
|
|
3289
|
-
let e = "", n = "";
|
|
3290
|
-
for (let r = 0; r < t.header.length; r++) n += this.tablecell(t.header[r]);
|
|
3291
|
-
e += this.tablerow({ text: n });
|
|
3292
|
-
let s = "";
|
|
3293
|
-
for (let r = 0; r < t.rows.length; r++) {
|
|
3294
|
-
let i = t.rows[r];
|
|
3295
|
-
n = "";
|
|
3296
|
-
for (let a = 0; a < i.length; a++) n += this.tablecell(i[a]);
|
|
3297
|
-
s += this.tablerow({ text: n });
|
|
3298
|
-
}
|
|
3299
|
-
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
3300
|
-
<thead>
|
|
3301
|
-
` + e + `</thead>
|
|
3302
|
-
` + s + `</table>
|
|
3303
|
-
`;
|
|
3304
|
-
}
|
|
3305
|
-
tablerow({ text: t }) {
|
|
3306
|
-
return `<tr>
|
|
3307
|
-
${t}</tr>
|
|
3308
|
-
`;
|
|
3309
|
-
}
|
|
3310
|
-
tablecell(t) {
|
|
3311
|
-
let e = this.parser.parseInline(t.tokens), n = t.header ? "th" : "td";
|
|
3312
|
-
return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
|
|
3313
|
-
`;
|
|
3314
|
-
}
|
|
3315
|
-
strong({ tokens: t }) {
|
|
3316
|
-
return `<strong>${this.parser.parseInline(t)}</strong>`;
|
|
3317
|
-
}
|
|
3318
|
-
em({ tokens: t }) {
|
|
3319
|
-
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
3320
|
-
}
|
|
3321
|
-
codespan({ text: t }) {
|
|
3322
|
-
return `<code>${Ke(t, !0)}</code>`;
|
|
3323
|
-
}
|
|
3324
|
-
br(t) {
|
|
3325
|
-
return "<br>";
|
|
3326
|
-
}
|
|
3327
|
-
del({ tokens: t }) {
|
|
3328
|
-
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
3329
|
-
}
|
|
3330
|
-
link({ href: t, title: e, tokens: n }) {
|
|
3331
|
-
let s = this.parser.parseInline(n), r = Us(t);
|
|
3332
|
-
if (r === null) return s;
|
|
3333
|
-
t = r;
|
|
3334
|
-
let i = '<a href="' + t + '"';
|
|
3335
|
-
return e && (i += ' title="' + Ke(e) + '"'), i += ">" + s + "</a>", i;
|
|
3336
|
-
}
|
|
3337
|
-
image({ href: t, title: e, text: n, tokens: s }) {
|
|
3338
|
-
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
3339
|
-
let r = Us(t);
|
|
3340
|
-
if (r === null) return Ke(n);
|
|
3341
|
-
t = r;
|
|
3342
|
-
let i = `<img src="${t}" alt="${n}"`;
|
|
3343
|
-
return e && (i += ` title="${Ke(e)}"`), i += ">", i;
|
|
3344
|
-
}
|
|
3345
|
-
text(t) {
|
|
3346
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : Ke(t.text);
|
|
3347
|
-
}
|
|
3348
|
-
}, is = class {
|
|
3349
|
-
strong({ text: t }) {
|
|
3350
|
-
return t;
|
|
3351
|
-
}
|
|
3352
|
-
em({ text: t }) {
|
|
3353
|
-
return t;
|
|
3354
|
-
}
|
|
3355
|
-
codespan({ text: t }) {
|
|
3356
|
-
return t;
|
|
3357
|
-
}
|
|
3358
|
-
del({ text: t }) {
|
|
3359
|
-
return t;
|
|
3360
|
-
}
|
|
3361
|
-
html({ text: t }) {
|
|
3362
|
-
return t;
|
|
3363
|
-
}
|
|
3364
|
-
text({ text: t }) {
|
|
3365
|
-
return t;
|
|
3366
|
-
}
|
|
3367
|
-
link({ text: t }) {
|
|
3368
|
-
return "" + t;
|
|
3369
|
-
}
|
|
3370
|
-
image({ text: t }) {
|
|
3371
|
-
return "" + t;
|
|
3372
|
-
}
|
|
3373
|
-
br() {
|
|
3374
|
-
return "";
|
|
3375
|
-
}
|
|
3376
|
-
}, Ue = class Nr {
|
|
3377
|
-
options;
|
|
3378
|
-
renderer;
|
|
3379
|
-
textRenderer;
|
|
3380
|
-
constructor(e) {
|
|
3381
|
-
this.options = e || Pt, this.options.renderer = this.options.renderer || new qn(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new is();
|
|
3382
|
-
}
|
|
3383
|
-
static parse(e, n) {
|
|
3384
|
-
return new Nr(n).parse(e);
|
|
3385
|
-
}
|
|
3386
|
-
static parseInline(e, n) {
|
|
3387
|
-
return new Nr(n).parseInline(e);
|
|
3388
|
-
}
|
|
3389
|
-
parse(e, n = !0) {
|
|
3390
|
-
let s = "";
|
|
3391
|
-
for (let r = 0; r < e.length; r++) {
|
|
3392
|
-
let i = e[r];
|
|
3393
|
-
if (this.options.extensions?.renderers?.[i.type]) {
|
|
3394
|
-
let u = i, l = this.options.extensions.renderers[u.type].call({ parser: this }, u);
|
|
3395
|
-
if (l !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(u.type)) {
|
|
3396
|
-
s += l || "";
|
|
3397
|
-
continue;
|
|
3398
|
-
}
|
|
3399
|
-
}
|
|
3400
|
-
let a = i;
|
|
3401
|
-
switch (a.type) {
|
|
3402
|
-
case "space": {
|
|
3403
|
-
s += this.renderer.space(a);
|
|
3404
|
-
continue;
|
|
3405
|
-
}
|
|
3406
|
-
case "hr": {
|
|
3407
|
-
s += this.renderer.hr(a);
|
|
3408
|
-
continue;
|
|
3409
|
-
}
|
|
3410
|
-
case "heading": {
|
|
3411
|
-
s += this.renderer.heading(a);
|
|
3412
|
-
continue;
|
|
3413
|
-
}
|
|
3414
|
-
case "code": {
|
|
3415
|
-
s += this.renderer.code(a);
|
|
3416
|
-
continue;
|
|
3417
|
-
}
|
|
3418
|
-
case "table": {
|
|
3419
|
-
s += this.renderer.table(a);
|
|
3420
|
-
continue;
|
|
3421
|
-
}
|
|
3422
|
-
case "blockquote": {
|
|
3423
|
-
s += this.renderer.blockquote(a);
|
|
3424
|
-
continue;
|
|
3425
|
-
}
|
|
3426
|
-
case "list": {
|
|
3427
|
-
s += this.renderer.list(a);
|
|
3428
|
-
continue;
|
|
3429
|
-
}
|
|
3430
|
-
case "html": {
|
|
3431
|
-
s += this.renderer.html(a);
|
|
3432
|
-
continue;
|
|
3433
|
-
}
|
|
3434
|
-
case "def": {
|
|
3435
|
-
s += this.renderer.def(a);
|
|
3436
|
-
continue;
|
|
3437
|
-
}
|
|
3438
|
-
case "paragraph": {
|
|
3439
|
-
s += this.renderer.paragraph(a);
|
|
3440
|
-
continue;
|
|
3441
|
-
}
|
|
3442
|
-
case "text": {
|
|
3443
|
-
let u = a, l = this.renderer.text(u);
|
|
3444
|
-
for (; r + 1 < e.length && e[r + 1].type === "text"; ) u = e[++r], l += `
|
|
3445
|
-
` + this.renderer.text(u);
|
|
3446
|
-
n ? s += this.renderer.paragraph({ type: "paragraph", raw: l, text: l, tokens: [{ type: "text", raw: l, text: l, escaped: !0 }] }) : s += l;
|
|
3447
|
-
continue;
|
|
3448
|
-
}
|
|
3449
|
-
default: {
|
|
3450
|
-
let u = 'Token with "' + a.type + '" type was not found.';
|
|
3451
|
-
if (this.options.silent) return console.error(u), "";
|
|
3452
|
-
throw new Error(u);
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
return s;
|
|
3457
|
-
}
|
|
3458
|
-
parseInline(e, n = this.renderer) {
|
|
3459
|
-
let s = "";
|
|
3460
|
-
for (let r = 0; r < e.length; r++) {
|
|
3461
|
-
let i = e[r];
|
|
3462
|
-
if (this.options.extensions?.renderers?.[i.type]) {
|
|
3463
|
-
let u = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
3464
|
-
if (u !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
3465
|
-
s += u || "";
|
|
3466
|
-
continue;
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
let a = i;
|
|
3470
|
-
switch (a.type) {
|
|
3471
|
-
case "escape": {
|
|
3472
|
-
s += n.text(a);
|
|
3473
|
-
break;
|
|
3474
|
-
}
|
|
3475
|
-
case "html": {
|
|
3476
|
-
s += n.html(a);
|
|
3477
|
-
break;
|
|
3478
|
-
}
|
|
3479
|
-
case "link": {
|
|
3480
|
-
s += n.link(a);
|
|
3481
|
-
break;
|
|
3482
|
-
}
|
|
3483
|
-
case "image": {
|
|
3484
|
-
s += n.image(a);
|
|
3485
|
-
break;
|
|
3486
|
-
}
|
|
3487
|
-
case "strong": {
|
|
3488
|
-
s += n.strong(a);
|
|
3489
|
-
break;
|
|
3490
|
-
}
|
|
3491
|
-
case "em": {
|
|
3492
|
-
s += n.em(a);
|
|
3493
|
-
break;
|
|
3494
|
-
}
|
|
3495
|
-
case "codespan": {
|
|
3496
|
-
s += n.codespan(a);
|
|
3497
|
-
break;
|
|
3498
|
-
}
|
|
3499
|
-
case "br": {
|
|
3500
|
-
s += n.br(a);
|
|
3501
|
-
break;
|
|
3502
|
-
}
|
|
3503
|
-
case "del": {
|
|
3504
|
-
s += n.del(a);
|
|
3505
|
-
break;
|
|
3506
|
-
}
|
|
3507
|
-
case "text": {
|
|
3508
|
-
s += n.text(a);
|
|
3509
|
-
break;
|
|
3510
|
-
}
|
|
3511
|
-
default: {
|
|
3512
|
-
let u = 'Token with "' + a.type + '" type was not found.';
|
|
3513
|
-
if (this.options.silent) return console.error(u), "";
|
|
3514
|
-
throw new Error(u);
|
|
3515
|
-
}
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
return s;
|
|
3519
|
-
}
|
|
3520
|
-
}, pn = class {
|
|
3521
|
-
options;
|
|
3522
|
-
block;
|
|
3523
|
-
constructor(t) {
|
|
3524
|
-
this.options = t || Pt;
|
|
3525
|
-
}
|
|
3526
|
-
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
3527
|
-
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
3528
|
-
preprocess(t) {
|
|
3529
|
-
return t;
|
|
3530
|
-
}
|
|
3531
|
-
postprocess(t) {
|
|
3532
|
-
return t;
|
|
3533
|
-
}
|
|
3534
|
-
processAllTokens(t) {
|
|
3535
|
-
return t;
|
|
3536
|
-
}
|
|
3537
|
-
emStrongMask(t) {
|
|
3538
|
-
return t;
|
|
3539
|
-
}
|
|
3540
|
-
provideLexer() {
|
|
3541
|
-
return this.block ? ze.lex : ze.lexInline;
|
|
3542
|
-
}
|
|
3543
|
-
provideParser() {
|
|
3544
|
-
return this.block ? Ue.parse : Ue.parseInline;
|
|
3545
|
-
}
|
|
3546
|
-
}, xo = class {
|
|
3547
|
-
defaults = Xr();
|
|
3548
|
-
options = this.setOptions;
|
|
3549
|
-
parse = this.parseMarkdown(!0);
|
|
3550
|
-
parseInline = this.parseMarkdown(!1);
|
|
3551
|
-
Parser = Ue;
|
|
3552
|
-
Renderer = qn;
|
|
3553
|
-
TextRenderer = is;
|
|
3554
|
-
Lexer = ze;
|
|
3555
|
-
Tokenizer = Wn;
|
|
3556
|
-
Hooks = pn;
|
|
3557
|
-
constructor(...t) {
|
|
3558
|
-
this.use(...t);
|
|
3559
|
-
}
|
|
3560
|
-
walkTokens(t, e) {
|
|
3561
|
-
let n = [];
|
|
3562
|
-
for (let s of t) switch (n = n.concat(e.call(this, s)), s.type) {
|
|
3563
|
-
case "table": {
|
|
3564
|
-
let r = s;
|
|
3565
|
-
for (let i of r.header) n = n.concat(this.walkTokens(i.tokens, e));
|
|
3566
|
-
for (let i of r.rows) for (let a of i) n = n.concat(this.walkTokens(a.tokens, e));
|
|
3567
|
-
break;
|
|
3568
|
-
}
|
|
3569
|
-
case "list": {
|
|
3570
|
-
let r = s;
|
|
3571
|
-
n = n.concat(this.walkTokens(r.items, e));
|
|
3572
|
-
break;
|
|
3573
|
-
}
|
|
3574
|
-
default: {
|
|
3575
|
-
let r = s;
|
|
3576
|
-
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
|
|
3577
|
-
let a = r[i].flat(1 / 0);
|
|
3578
|
-
n = n.concat(this.walkTokens(a, e));
|
|
3579
|
-
}) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, e)));
|
|
3580
|
-
}
|
|
3581
|
-
}
|
|
3582
|
-
return n;
|
|
3583
|
-
}
|
|
3584
|
-
use(...t) {
|
|
3585
|
-
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
3586
|
-
return t.forEach((n) => {
|
|
3587
|
-
let s = { ...n };
|
|
3588
|
-
if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((r) => {
|
|
3589
|
-
if (!r.name) throw new Error("extension name required");
|
|
3590
|
-
if ("renderer" in r) {
|
|
3591
|
-
let i = e.renderers[r.name];
|
|
3592
|
-
i ? e.renderers[r.name] = function(...a) {
|
|
3593
|
-
let u = r.renderer.apply(this, a);
|
|
3594
|
-
return u === !1 && (u = i.apply(this, a)), u;
|
|
3595
|
-
} : e.renderers[r.name] = r.renderer;
|
|
3596
|
-
}
|
|
3597
|
-
if ("tokenizer" in r) {
|
|
3598
|
-
if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
3599
|
-
let i = e[r.level];
|
|
3600
|
-
i ? i.unshift(r.tokenizer) : e[r.level] = [r.tokenizer], r.start && (r.level === "block" ? e.startBlock ? e.startBlock.push(r.start) : e.startBlock = [r.start] : r.level === "inline" && (e.startInline ? e.startInline.push(r.start) : e.startInline = [r.start]));
|
|
3601
|
-
}
|
|
3602
|
-
"childTokens" in r && r.childTokens && (e.childTokens[r.name] = r.childTokens);
|
|
3603
|
-
}), s.extensions = e), n.renderer) {
|
|
3604
|
-
let r = this.defaults.renderer || new qn(this.defaults);
|
|
3605
|
-
for (let i in n.renderer) {
|
|
3606
|
-
if (!(i in r)) throw new Error(`renderer '${i}' does not exist`);
|
|
3607
|
-
if (["options", "parser"].includes(i)) continue;
|
|
3608
|
-
let a = i, u = n.renderer[a], l = r[a];
|
|
3609
|
-
r[a] = (...c) => {
|
|
3610
|
-
let f = u.apply(r, c);
|
|
3611
|
-
return f === !1 && (f = l.apply(r, c)), f || "";
|
|
3612
|
-
};
|
|
3613
|
-
}
|
|
3614
|
-
s.renderer = r;
|
|
3615
|
-
}
|
|
3616
|
-
if (n.tokenizer) {
|
|
3617
|
-
let r = this.defaults.tokenizer || new Wn(this.defaults);
|
|
3618
|
-
for (let i in n.tokenizer) {
|
|
3619
|
-
if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
3620
|
-
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
3621
|
-
let a = i, u = n.tokenizer[a], l = r[a];
|
|
3622
|
-
r[a] = (...c) => {
|
|
3623
|
-
let f = u.apply(r, c);
|
|
3624
|
-
return f === !1 && (f = l.apply(r, c)), f;
|
|
3625
|
-
};
|
|
3626
|
-
}
|
|
3627
|
-
s.tokenizer = r;
|
|
3628
|
-
}
|
|
3629
|
-
if (n.hooks) {
|
|
3630
|
-
let r = this.defaults.hooks || new pn();
|
|
3631
|
-
for (let i in n.hooks) {
|
|
3632
|
-
if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
|
|
3633
|
-
if (["options", "block"].includes(i)) continue;
|
|
3634
|
-
let a = i, u = n.hooks[a], l = r[a];
|
|
3635
|
-
pn.passThroughHooks.has(i) ? r[a] = (c) => {
|
|
3636
|
-
if (this.defaults.async && pn.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
3637
|
-
let d = await u.call(r, c);
|
|
3638
|
-
return l.call(r, d);
|
|
3639
|
-
})();
|
|
3640
|
-
let f = u.call(r, c);
|
|
3641
|
-
return l.call(r, f);
|
|
3642
|
-
} : r[a] = (...c) => {
|
|
3643
|
-
if (this.defaults.async) return (async () => {
|
|
3644
|
-
let d = await u.apply(r, c);
|
|
3645
|
-
return d === !1 && (d = await l.apply(r, c)), d;
|
|
3646
|
-
})();
|
|
3647
|
-
let f = u.apply(r, c);
|
|
3648
|
-
return f === !1 && (f = l.apply(r, c)), f;
|
|
3649
|
-
};
|
|
3650
|
-
}
|
|
3651
|
-
s.hooks = r;
|
|
3652
|
-
}
|
|
3653
|
-
if (n.walkTokens) {
|
|
3654
|
-
let r = this.defaults.walkTokens, i = n.walkTokens;
|
|
3655
|
-
s.walkTokens = function(a) {
|
|
3656
|
-
let u = [];
|
|
3657
|
-
return u.push(i.call(this, a)), r && (u = u.concat(r.call(this, a))), u;
|
|
3658
|
-
};
|
|
3659
|
-
}
|
|
3660
|
-
this.defaults = { ...this.defaults, ...s };
|
|
3661
|
-
}), this;
|
|
3662
|
-
}
|
|
3663
|
-
setOptions(t) {
|
|
3664
|
-
return this.defaults = { ...this.defaults, ...t }, this;
|
|
3665
|
-
}
|
|
3666
|
-
lexer(t, e) {
|
|
3667
|
-
return ze.lex(t, e ?? this.defaults);
|
|
3668
|
-
}
|
|
3669
|
-
parser(t, e) {
|
|
3670
|
-
return Ue.parse(t, e ?? this.defaults);
|
|
3671
|
-
}
|
|
3672
|
-
parseMarkdown(t) {
|
|
3673
|
-
return (e, n) => {
|
|
3674
|
-
let s = { ...n }, r = { ...this.defaults, ...s }, i = this.onError(!!r.silent, !!r.async);
|
|
3675
|
-
if (this.defaults.async === !0 && s.async === !1) return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
3676
|
-
if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
3677
|
-
if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
3678
|
-
if (r.hooks && (r.hooks.options = r, r.hooks.block = t), r.async) return (async () => {
|
|
3679
|
-
let a = r.hooks ? await r.hooks.preprocess(e) : e, u = await (r.hooks ? await r.hooks.provideLexer() : t ? ze.lex : ze.lexInline)(a, r), l = r.hooks ? await r.hooks.processAllTokens(u) : u;
|
|
3680
|
-
r.walkTokens && await Promise.all(this.walkTokens(l, r.walkTokens));
|
|
3681
|
-
let c = await (r.hooks ? await r.hooks.provideParser() : t ? Ue.parse : Ue.parseInline)(l, r);
|
|
3682
|
-
return r.hooks ? await r.hooks.postprocess(c) : c;
|
|
3683
|
-
})().catch(i);
|
|
3684
|
-
try {
|
|
3685
|
-
r.hooks && (e = r.hooks.preprocess(e));
|
|
3686
|
-
let a = (r.hooks ? r.hooks.provideLexer() : t ? ze.lex : ze.lexInline)(e, r);
|
|
3687
|
-
r.hooks && (a = r.hooks.processAllTokens(a)), r.walkTokens && this.walkTokens(a, r.walkTokens);
|
|
3688
|
-
let u = (r.hooks ? r.hooks.provideParser() : t ? Ue.parse : Ue.parseInline)(a, r);
|
|
3689
|
-
return r.hooks && (u = r.hooks.postprocess(u)), u;
|
|
3690
|
-
} catch (a) {
|
|
3691
|
-
return i(a);
|
|
3692
|
-
}
|
|
3693
|
-
};
|
|
3694
|
-
}
|
|
3695
|
-
onError(t, e) {
|
|
3696
|
-
return (n) => {
|
|
3697
|
-
if (n.message += `
|
|
3698
|
-
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
3699
|
-
let s = "<p>An error occurred:</p><pre>" + Ke(n.message + "", !0) + "</pre>";
|
|
3700
|
-
return e ? Promise.resolve(s) : s;
|
|
3701
|
-
}
|
|
3702
|
-
if (e) return Promise.reject(n);
|
|
3703
|
-
throw n;
|
|
3704
|
-
};
|
|
3705
|
-
}
|
|
3706
|
-
}, Lt = new xo();
|
|
3707
|
-
function z(t, e) {
|
|
3708
|
-
return Lt.parse(t, e);
|
|
3709
|
-
}
|
|
3710
|
-
z.options = z.setOptions = function(t) {
|
|
3711
|
-
return Lt.setOptions(t), z.defaults = Lt.defaults, Yi(z.defaults), z;
|
|
3712
|
-
};
|
|
3713
|
-
z.getDefaults = Xr;
|
|
3714
|
-
z.defaults = Pt;
|
|
3715
|
-
z.use = function(...t) {
|
|
3716
|
-
return Lt.use(...t), z.defaults = Lt.defaults, Yi(z.defaults), z;
|
|
3717
|
-
};
|
|
3718
|
-
z.walkTokens = function(t, e) {
|
|
3719
|
-
return Lt.walkTokens(t, e);
|
|
3720
|
-
};
|
|
3721
|
-
z.parseInline = Lt.parseInline;
|
|
3722
|
-
z.Parser = Ue;
|
|
3723
|
-
z.parser = Ue.parse;
|
|
3724
|
-
z.Renderer = qn;
|
|
3725
|
-
z.TextRenderer = is;
|
|
3726
|
-
z.Lexer = ze;
|
|
3727
|
-
z.lexer = ze.lex;
|
|
3728
|
-
z.Tokenizer = Wn;
|
|
3729
|
-
z.Hooks = pn;
|
|
3730
|
-
z.parse = z;
|
|
3731
|
-
z.options;
|
|
3732
|
-
z.setOptions;
|
|
3733
|
-
z.use;
|
|
3734
|
-
z.walkTokens;
|
|
3735
|
-
z.parseInline;
|
|
3736
|
-
Ue.parse;
|
|
3737
|
-
ze.lex;
|
|
3738
|
-
/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
|
|
3739
|
-
const {
|
|
3740
|
-
entries: sa,
|
|
3741
|
-
setPrototypeOf: Bs,
|
|
3742
|
-
isFrozen: yo,
|
|
3743
|
-
getPrototypeOf: Eo,
|
|
3744
|
-
getOwnPropertyDescriptor: To
|
|
3745
|
-
} = Object;
|
|
3746
|
-
let {
|
|
3747
|
-
freeze: de,
|
|
3748
|
-
seal: Oe,
|
|
3749
|
-
create: Dr
|
|
3750
|
-
} = Object, {
|
|
3751
|
-
apply: Mr,
|
|
3752
|
-
construct: Pr
|
|
3753
|
-
} = typeof Reflect < "u" && Reflect;
|
|
3754
|
-
de || (de = function(e) {
|
|
3755
|
-
return e;
|
|
3756
|
-
});
|
|
3757
|
-
Oe || (Oe = function(e) {
|
|
3758
|
-
return e;
|
|
3759
|
-
});
|
|
3760
|
-
Mr || (Mr = function(e, n) {
|
|
3761
|
-
for (var s = arguments.length, r = new Array(s > 2 ? s - 2 : 0), i = 2; i < s; i++)
|
|
3762
|
-
r[i - 2] = arguments[i];
|
|
3763
|
-
return e.apply(n, r);
|
|
3764
|
-
});
|
|
3765
|
-
Pr || (Pr = function(e) {
|
|
3766
|
-
for (var n = arguments.length, s = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++)
|
|
3767
|
-
s[r - 1] = arguments[r];
|
|
3768
|
-
return new e(...s);
|
|
3769
|
-
});
|
|
3770
|
-
const Cn = ge(Array.prototype.forEach), Ao = ge(Array.prototype.lastIndexOf), Gs = ge(Array.prototype.pop), ln = ge(Array.prototype.push), So = ge(Array.prototype.splice), Dn = ge(String.prototype.toLowerCase), mr = ge(String.prototype.toString), _r = ge(String.prototype.match), on = ge(String.prototype.replace), Ro = ge(String.prototype.indexOf), $o = ge(String.prototype.trim), Pe = ge(Object.prototype.hasOwnProperty), ce = ge(RegExp.prototype.test), un = Co(TypeError);
|
|
3771
|
-
function ge(t) {
|
|
3772
|
-
return function(e) {
|
|
3773
|
-
e instanceof RegExp && (e.lastIndex = 0);
|
|
3774
|
-
for (var n = arguments.length, s = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++)
|
|
3775
|
-
s[r - 1] = arguments[r];
|
|
3776
|
-
return Mr(t, e, s);
|
|
3777
|
-
};
|
|
3778
|
-
}
|
|
3779
|
-
function Co(t) {
|
|
3780
|
-
return function() {
|
|
3781
|
-
for (var e = arguments.length, n = new Array(e), s = 0; s < e; s++)
|
|
3782
|
-
n[s] = arguments[s];
|
|
3783
|
-
return Pr(t, n);
|
|
3784
|
-
};
|
|
3785
|
-
}
|
|
3786
|
-
function L(t, e) {
|
|
3787
|
-
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Dn;
|
|
3788
|
-
Bs && Bs(t, null);
|
|
3789
|
-
let s = e.length;
|
|
3790
|
-
for (; s--; ) {
|
|
3791
|
-
let r = e[s];
|
|
3792
|
-
if (typeof r == "string") {
|
|
3793
|
-
const i = n(r);
|
|
3794
|
-
i !== r && (yo(e) || (e[s] = i), r = i);
|
|
3795
|
-
}
|
|
3796
|
-
t[r] = !0;
|
|
3797
|
-
}
|
|
3798
|
-
return t;
|
|
3799
|
-
}
|
|
3800
|
-
function Lo(t) {
|
|
3801
|
-
for (let e = 0; e < t.length; e++)
|
|
3802
|
-
Pe(t, e) || (t[e] = null);
|
|
3803
|
-
return t;
|
|
3804
|
-
}
|
|
3805
|
-
function at(t) {
|
|
3806
|
-
const e = Dr(null);
|
|
3807
|
-
for (const [n, s] of sa(t))
|
|
3808
|
-
Pe(t, n) && (Array.isArray(s) ? e[n] = Lo(s) : s && typeof s == "object" && s.constructor === Object ? e[n] = at(s) : e[n] = s);
|
|
3809
|
-
return e;
|
|
3810
|
-
}
|
|
3811
|
-
function cn(t, e) {
|
|
3812
|
-
for (; t !== null; ) {
|
|
3813
|
-
const s = To(t, e);
|
|
3814
|
-
if (s) {
|
|
3815
|
-
if (s.get)
|
|
3816
|
-
return ge(s.get);
|
|
3817
|
-
if (typeof s.value == "function")
|
|
3818
|
-
return ge(s.value);
|
|
3819
|
-
}
|
|
3820
|
-
t = Eo(t);
|
|
3821
|
-
}
|
|
3822
|
-
function n() {
|
|
3823
|
-
return null;
|
|
3824
|
-
}
|
|
3825
|
-
return n;
|
|
3826
|
-
}
|
|
3827
|
-
const Ws = de(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), br = de(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), kr = de(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Io = de(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), wr = de(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Oo = de(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), qs = de(["#text"]), js = de(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), xr = de(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Ys = de(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ln = de(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), No = Oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Do = Oe(/<%[\w\W]*|[\w\W]*%>/gm), Mo = Oe(/\$\{[\w\W]*/gm), Po = Oe(/^data-[\-\w.\u00B7-\uFFFF]+$/), zo = Oe(/^aria-[\-\w]+$/), ia = Oe(
|
|
3828
|
-
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
3829
|
-
// eslint-disable-line no-useless-escape
|
|
3830
|
-
), Uo = Oe(/^(?:\w+script|data):/i), Fo = Oe(
|
|
3831
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
3832
|
-
// eslint-disable-line no-control-regex
|
|
3833
|
-
), aa = Oe(/^html$/i), Ho = Oe(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
3834
|
-
var Vs = /* @__PURE__ */ Object.freeze({
|
|
3835
|
-
__proto__: null,
|
|
3836
|
-
ARIA_ATTR: zo,
|
|
3837
|
-
ATTR_WHITESPACE: Fo,
|
|
3838
|
-
CUSTOM_ELEMENT: Ho,
|
|
3839
|
-
DATA_ATTR: Po,
|
|
3840
|
-
DOCTYPE_NAME: aa,
|
|
3841
|
-
ERB_EXPR: Do,
|
|
3842
|
-
IS_ALLOWED_URI: ia,
|
|
3843
|
-
IS_SCRIPT_OR_DATA: Uo,
|
|
3844
|
-
MUSTACHE_EXPR: No,
|
|
3845
|
-
TMPLIT_EXPR: Mo
|
|
3846
|
-
});
|
|
3847
|
-
const fn = {
|
|
3848
|
-
element: 1,
|
|
3849
|
-
text: 3,
|
|
3850
|
-
// Deprecated
|
|
3851
|
-
progressingInstruction: 7,
|
|
3852
|
-
comment: 8,
|
|
3853
|
-
document: 9
|
|
3854
|
-
}, Bo = function() {
|
|
3855
|
-
return typeof window > "u" ? null : window;
|
|
3856
|
-
}, Go = function(e, n) {
|
|
3857
|
-
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
3858
|
-
return null;
|
|
3859
|
-
let s = null;
|
|
3860
|
-
const r = "data-tt-policy-suffix";
|
|
3861
|
-
n && n.hasAttribute(r) && (s = n.getAttribute(r));
|
|
3862
|
-
const i = "dompurify" + (s ? "#" + s : "");
|
|
3863
|
-
try {
|
|
3864
|
-
return e.createPolicy(i, {
|
|
3865
|
-
createHTML(a) {
|
|
3866
|
-
return a;
|
|
3867
|
-
},
|
|
3868
|
-
createScriptURL(a) {
|
|
3869
|
-
return a;
|
|
3870
|
-
}
|
|
3871
|
-
});
|
|
3872
|
-
} catch {
|
|
3873
|
-
return console.warn("TrustedTypes policy " + i + " could not be created."), null;
|
|
3874
|
-
}
|
|
3875
|
-
}, Zs = function() {
|
|
3876
|
-
return {
|
|
3877
|
-
afterSanitizeAttributes: [],
|
|
3878
|
-
afterSanitizeElements: [],
|
|
3879
|
-
afterSanitizeShadowDOM: [],
|
|
3880
|
-
beforeSanitizeAttributes: [],
|
|
3881
|
-
beforeSanitizeElements: [],
|
|
3882
|
-
beforeSanitizeShadowDOM: [],
|
|
3883
|
-
uponSanitizeAttribute: [],
|
|
3884
|
-
uponSanitizeElement: [],
|
|
3885
|
-
uponSanitizeShadowNode: []
|
|
3886
|
-
};
|
|
3887
|
-
};
|
|
3888
|
-
function la() {
|
|
3889
|
-
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Bo();
|
|
3890
|
-
const e = (y) => la(y);
|
|
3891
|
-
if (e.version = "3.3.0", e.removed = [], !t || !t.document || t.document.nodeType !== fn.document || !t.Element)
|
|
3892
|
-
return e.isSupported = !1, e;
|
|
3893
|
-
let {
|
|
3894
|
-
document: n
|
|
3895
|
-
} = t;
|
|
3896
|
-
const s = n, r = s.currentScript, {
|
|
3897
|
-
DocumentFragment: i,
|
|
3898
|
-
HTMLTemplateElement: a,
|
|
3899
|
-
Node: u,
|
|
3900
|
-
Element: l,
|
|
3901
|
-
NodeFilter: c,
|
|
3902
|
-
NamedNodeMap: f = t.NamedNodeMap || t.MozNamedAttrMap,
|
|
3903
|
-
HTMLFormElement: d,
|
|
3904
|
-
DOMParser: p,
|
|
3905
|
-
trustedTypes: v
|
|
3906
|
-
} = t, h = l.prototype, x = cn(h, "cloneNode"), T = cn(h, "remove"), R = cn(h, "nextSibling"), w = cn(h, "childNodes"), P = cn(h, "parentNode");
|
|
3907
|
-
if (typeof a == "function") {
|
|
3908
|
-
const y = n.createElement("template");
|
|
3909
|
-
y.content && y.content.ownerDocument && (n = y.content.ownerDocument);
|
|
3910
|
-
}
|
|
3911
|
-
let S, k = "";
|
|
3912
|
-
const {
|
|
3913
|
-
implementation: _,
|
|
3914
|
-
createNodeIterator: E,
|
|
3915
|
-
createDocumentFragment: U,
|
|
3916
|
-
getElementsByTagName: J
|
|
3917
|
-
} = n, {
|
|
3918
|
-
importNode: B
|
|
3919
|
-
} = s;
|
|
3920
|
-
let $ = Zs();
|
|
3921
|
-
e.isSupported = typeof sa == "function" && typeof P == "function" && _ && _.createHTMLDocument !== void 0;
|
|
3922
|
-
const {
|
|
3923
|
-
MUSTACHE_EXPR: Y,
|
|
3924
|
-
ERB_EXPR: ve,
|
|
3925
|
-
TMPLIT_EXPR: me,
|
|
3926
|
-
DATA_ATTR: A,
|
|
3927
|
-
ARIA_ATTR: D,
|
|
3928
|
-
IS_SCRIPT_OR_DATA: ee,
|
|
3929
|
-
ATTR_WHITESPACE: ye,
|
|
3930
|
-
CUSTOM_ELEMENT: tt
|
|
3931
|
-
} = Vs;
|
|
3932
|
-
let {
|
|
3933
|
-
IS_ALLOWED_URI: kt
|
|
3934
|
-
} = Vs, G = null;
|
|
3935
|
-
const Ne = L({}, [...Ws, ...br, ...kr, ...wr, ...qs]);
|
|
3936
|
-
let j = null;
|
|
3937
|
-
const nt = L({}, [...js, ...xr, ...Ys, ...Ln]);
|
|
3938
|
-
let H = Object.seal(Dr(null, {
|
|
3939
|
-
tagNameCheck: {
|
|
3940
|
-
writable: !0,
|
|
3941
|
-
configurable: !1,
|
|
3942
|
-
enumerable: !0,
|
|
3943
|
-
value: null
|
|
3944
|
-
},
|
|
3945
|
-
attributeNameCheck: {
|
|
3946
|
-
writable: !0,
|
|
3947
|
-
configurable: !1,
|
|
3948
|
-
enumerable: !0,
|
|
3949
|
-
value: null
|
|
3950
|
-
},
|
|
3951
|
-
allowCustomizedBuiltInElements: {
|
|
3952
|
-
writable: !0,
|
|
3953
|
-
configurable: !1,
|
|
3954
|
-
enumerable: !0,
|
|
3955
|
-
value: !1
|
|
3956
|
-
}
|
|
3957
|
-
})), qe = null, je = null;
|
|
3958
|
-
const V = Object.seal(Dr(null, {
|
|
3959
|
-
tagCheck: {
|
|
3960
|
-
writable: !0,
|
|
3961
|
-
configurable: !1,
|
|
3962
|
-
enumerable: !0,
|
|
3963
|
-
value: null
|
|
3964
|
-
},
|
|
3965
|
-
attributeCheck: {
|
|
3966
|
-
writable: !0,
|
|
3967
|
-
configurable: !1,
|
|
3968
|
-
enumerable: !0,
|
|
3969
|
-
value: null
|
|
3970
|
-
}
|
|
3971
|
-
}));
|
|
3972
|
-
let ht = !0, zt = !0, ie = !1, Ye = !0, Ve = !1, De = !0, Ee = !1, wt = !1, Me = !1, _e = !1, Ut = !1, yn = !1, as = !0, ls = !1;
|
|
3973
|
-
const ca = "user-content-";
|
|
3974
|
-
let lr = !0, tn = !1, Ft = {}, Ht = null;
|
|
3975
|
-
const os = L({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
3976
|
-
let us = null;
|
|
3977
|
-
const cs = L({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
3978
|
-
let or = null;
|
|
3979
|
-
const fs = L({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), En = "http://www.w3.org/1998/Math/MathML", Tn = "http://www.w3.org/2000/svg", rt = "http://www.w3.org/1999/xhtml";
|
|
3980
|
-
let Bt = rt, ur = !1, cr = null;
|
|
3981
|
-
const fa = L({}, [En, Tn, rt], mr);
|
|
3982
|
-
let An = L({}, ["mi", "mo", "mn", "ms", "mtext"]), Sn = L({}, ["annotation-xml"]);
|
|
3983
|
-
const ha = L({}, ["title", "style", "font", "a", "script"]);
|
|
3984
|
-
let nn = null;
|
|
3985
|
-
const pa = ["application/xhtml+xml", "text/html"], da = "text/html";
|
|
3986
|
-
let te = null, Gt = null;
|
|
3987
|
-
const ga = n.createElement("form"), hs = function(o) {
|
|
3988
|
-
return o instanceof RegExp || o instanceof Function;
|
|
3989
|
-
}, fr = function() {
|
|
3990
|
-
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3991
|
-
if (!(Gt && Gt === o)) {
|
|
3992
|
-
if ((!o || typeof o != "object") && (o = {}), o = at(o), nn = // eslint-disable-next-line unicorn/prefer-includes
|
|
3993
|
-
pa.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? da : o.PARSER_MEDIA_TYPE, te = nn === "application/xhtml+xml" ? mr : Dn, G = Pe(o, "ALLOWED_TAGS") ? L({}, o.ALLOWED_TAGS, te) : Ne, j = Pe(o, "ALLOWED_ATTR") ? L({}, o.ALLOWED_ATTR, te) : nt, cr = Pe(o, "ALLOWED_NAMESPACES") ? L({}, o.ALLOWED_NAMESPACES, mr) : fa, or = Pe(o, "ADD_URI_SAFE_ATTR") ? L(at(fs), o.ADD_URI_SAFE_ATTR, te) : fs, us = Pe(o, "ADD_DATA_URI_TAGS") ? L(at(cs), o.ADD_DATA_URI_TAGS, te) : cs, Ht = Pe(o, "FORBID_CONTENTS") ? L({}, o.FORBID_CONTENTS, te) : os, qe = Pe(o, "FORBID_TAGS") ? L({}, o.FORBID_TAGS, te) : at({}), je = Pe(o, "FORBID_ATTR") ? L({}, o.FORBID_ATTR, te) : at({}), Ft = Pe(o, "USE_PROFILES") ? o.USE_PROFILES : !1, ht = o.ALLOW_ARIA_ATTR !== !1, zt = o.ALLOW_DATA_ATTR !== !1, ie = o.ALLOW_UNKNOWN_PROTOCOLS || !1, Ye = o.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ve = o.SAFE_FOR_TEMPLATES || !1, De = o.SAFE_FOR_XML !== !1, Ee = o.WHOLE_DOCUMENT || !1, _e = o.RETURN_DOM || !1, Ut = o.RETURN_DOM_FRAGMENT || !1, yn = o.RETURN_TRUSTED_TYPE || !1, Me = o.FORCE_BODY || !1, as = o.SANITIZE_DOM !== !1, ls = o.SANITIZE_NAMED_PROPS || !1, lr = o.KEEP_CONTENT !== !1, tn = o.IN_PLACE || !1, kt = o.ALLOWED_URI_REGEXP || ia, Bt = o.NAMESPACE || rt, An = o.MATHML_TEXT_INTEGRATION_POINTS || An, Sn = o.HTML_INTEGRATION_POINTS || Sn, H = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && hs(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (H.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && hs(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (H.attributeNameCheck = o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), o.CUSTOM_ELEMENT_HANDLING && typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (H.allowCustomizedBuiltInElements = o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ve && (zt = !1), Ut && (_e = !0), Ft && (G = L({}, qs), j = [], Ft.html === !0 && (L(G, Ws), L(j, js)), Ft.svg === !0 && (L(G, br), L(j, xr), L(j, Ln)), Ft.svgFilters === !0 && (L(G, kr), L(j, xr), L(j, Ln)), Ft.mathMl === !0 && (L(G, wr), L(j, Ys), L(j, Ln))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? V.tagCheck = o.ADD_TAGS : (G === Ne && (G = at(G)), L(G, o.ADD_TAGS, te))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? V.attributeCheck = o.ADD_ATTR : (j === nt && (j = at(j)), L(j, o.ADD_ATTR, te))), o.ADD_URI_SAFE_ATTR && L(or, o.ADD_URI_SAFE_ATTR, te), o.FORBID_CONTENTS && (Ht === os && (Ht = at(Ht)), L(Ht, o.FORBID_CONTENTS, te)), lr && (G["#text"] = !0), Ee && L(G, ["html", "head", "body"]), G.table && (L(G, ["tbody"]), delete qe.tbody), o.TRUSTED_TYPES_POLICY) {
|
|
3994
|
-
if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
3995
|
-
throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
3996
|
-
if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
3997
|
-
throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
3998
|
-
S = o.TRUSTED_TYPES_POLICY, k = S.createHTML("");
|
|
3999
|
-
} else
|
|
4000
|
-
S === void 0 && (S = Go(v, r)), S !== null && typeof k == "string" && (k = S.createHTML(""));
|
|
4001
|
-
de && de(o), Gt = o;
|
|
4002
|
-
}
|
|
4003
|
-
}, ps = L({}, [...br, ...kr, ...Io]), ds = L({}, [...wr, ...Oo]), va = function(o) {
|
|
4004
|
-
let g = P(o);
|
|
4005
|
-
(!g || !g.tagName) && (g = {
|
|
4006
|
-
namespaceURI: Bt,
|
|
4007
|
-
tagName: "template"
|
|
4008
|
-
});
|
|
4009
|
-
const b = Dn(o.tagName), W = Dn(g.tagName);
|
|
4010
|
-
return cr[o.namespaceURI] ? o.namespaceURI === Tn ? g.namespaceURI === rt ? b === "svg" : g.namespaceURI === En ? b === "svg" && (W === "annotation-xml" || An[W]) : !!ps[b] : o.namespaceURI === En ? g.namespaceURI === rt ? b === "math" : g.namespaceURI === Tn ? b === "math" && Sn[W] : !!ds[b] : o.namespaceURI === rt ? g.namespaceURI === Tn && !Sn[W] || g.namespaceURI === En && !An[W] ? !1 : !ds[b] && (ha[b] || !ps[b]) : !!(nn === "application/xhtml+xml" && cr[o.namespaceURI]) : !1;
|
|
4011
|
-
}, Ze = function(o) {
|
|
4012
|
-
ln(e.removed, {
|
|
4013
|
-
element: o
|
|
4014
|
-
});
|
|
4015
|
-
try {
|
|
4016
|
-
P(o).removeChild(o);
|
|
4017
|
-
} catch {
|
|
4018
|
-
T(o);
|
|
4019
|
-
}
|
|
4020
|
-
}, xt = function(o, g) {
|
|
4021
|
-
try {
|
|
4022
|
-
ln(e.removed, {
|
|
4023
|
-
attribute: g.getAttributeNode(o),
|
|
4024
|
-
from: g
|
|
4025
|
-
});
|
|
4026
|
-
} catch {
|
|
4027
|
-
ln(e.removed, {
|
|
4028
|
-
attribute: null,
|
|
4029
|
-
from: g
|
|
4030
|
-
});
|
|
4031
|
-
}
|
|
4032
|
-
if (g.removeAttribute(o), o === "is")
|
|
4033
|
-
if (_e || Ut)
|
|
4034
|
-
try {
|
|
4035
|
-
Ze(g);
|
|
4036
|
-
} catch {
|
|
4037
|
-
}
|
|
4038
|
-
else
|
|
4039
|
-
try {
|
|
4040
|
-
g.setAttribute(o, "");
|
|
4041
|
-
} catch {
|
|
4042
|
-
}
|
|
4043
|
-
}, gs = function(o) {
|
|
4044
|
-
let g = null, b = null;
|
|
4045
|
-
if (Me)
|
|
4046
|
-
o = "<remove></remove>" + o;
|
|
4047
|
-
else {
|
|
4048
|
-
const Z = _r(o, /^[\r\n\t ]+/);
|
|
4049
|
-
b = Z && Z[0];
|
|
4050
|
-
}
|
|
4051
|
-
nn === "application/xhtml+xml" && Bt === rt && (o = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + o + "</body></html>");
|
|
4052
|
-
const W = S ? S.createHTML(o) : o;
|
|
4053
|
-
if (Bt === rt)
|
|
4054
|
-
try {
|
|
4055
|
-
g = new p().parseFromString(W, nn);
|
|
4056
|
-
} catch {
|
|
4057
|
-
}
|
|
4058
|
-
if (!g || !g.documentElement) {
|
|
4059
|
-
g = _.createDocument(Bt, "template", null);
|
|
4060
|
-
try {
|
|
4061
|
-
g.documentElement.innerHTML = ur ? k : W;
|
|
4062
|
-
} catch {
|
|
4063
|
-
}
|
|
4064
|
-
}
|
|
4065
|
-
const ae = g.body || g.documentElement;
|
|
4066
|
-
return o && b && ae.insertBefore(n.createTextNode(b), ae.childNodes[0] || null), Bt === rt ? J.call(g, Ee ? "html" : "body")[0] : Ee ? g.documentElement : ae;
|
|
4067
|
-
}, vs = function(o) {
|
|
4068
|
-
return E.call(
|
|
4069
|
-
o.ownerDocument || o,
|
|
4070
|
-
o,
|
|
4071
|
-
// eslint-disable-next-line no-bitwise
|
|
4072
|
-
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
4073
|
-
null
|
|
4074
|
-
);
|
|
4075
|
-
}, hr = function(o) {
|
|
4076
|
-
return o instanceof d && (typeof o.nodeName != "string" || typeof o.textContent != "string" || typeof o.removeChild != "function" || !(o.attributes instanceof f) || typeof o.removeAttribute != "function" || typeof o.setAttribute != "function" || typeof o.namespaceURI != "string" || typeof o.insertBefore != "function" || typeof o.hasChildNodes != "function");
|
|
4077
|
-
}, ms = function(o) {
|
|
4078
|
-
return typeof u == "function" && o instanceof u;
|
|
4079
|
-
};
|
|
4080
|
-
function st(y, o, g) {
|
|
4081
|
-
Cn(y, (b) => {
|
|
4082
|
-
b.call(e, o, g, Gt);
|
|
4083
|
-
});
|
|
4084
|
-
}
|
|
4085
|
-
const _s = function(o) {
|
|
4086
|
-
let g = null;
|
|
4087
|
-
if (st($.beforeSanitizeElements, o, null), hr(o))
|
|
4088
|
-
return Ze(o), !0;
|
|
4089
|
-
const b = te(o.nodeName);
|
|
4090
|
-
if (st($.uponSanitizeElement, o, {
|
|
4091
|
-
tagName: b,
|
|
4092
|
-
allowedTags: G
|
|
4093
|
-
}), De && o.hasChildNodes() && !ms(o.firstElementChild) && ce(/<[/\w!]/g, o.innerHTML) && ce(/<[/\w!]/g, o.textContent) || o.nodeType === fn.progressingInstruction || De && o.nodeType === fn.comment && ce(/<[/\w]/g, o.data))
|
|
4094
|
-
return Ze(o), !0;
|
|
4095
|
-
if (!(V.tagCheck instanceof Function && V.tagCheck(b)) && (!G[b] || qe[b])) {
|
|
4096
|
-
if (!qe[b] && ks(b) && (H.tagNameCheck instanceof RegExp && ce(H.tagNameCheck, b) || H.tagNameCheck instanceof Function && H.tagNameCheck(b)))
|
|
4097
|
-
return !1;
|
|
4098
|
-
if (lr && !Ht[b]) {
|
|
4099
|
-
const W = P(o) || o.parentNode, ae = w(o) || o.childNodes;
|
|
4100
|
-
if (ae && W) {
|
|
4101
|
-
const Z = ae.length;
|
|
4102
|
-
for (let be = Z - 1; be >= 0; --be) {
|
|
4103
|
-
const it = x(ae[be], !0);
|
|
4104
|
-
it.__removalCount = (o.__removalCount || 0) + 1, W.insertBefore(it, R(o));
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
}
|
|
4108
|
-
return Ze(o), !0;
|
|
4109
|
-
}
|
|
4110
|
-
return o instanceof l && !va(o) || (b === "noscript" || b === "noembed" || b === "noframes") && ce(/<\/no(script|embed|frames)/i, o.innerHTML) ? (Ze(o), !0) : (Ve && o.nodeType === fn.text && (g = o.textContent, Cn([Y, ve, me], (W) => {
|
|
4111
|
-
g = on(g, W, " ");
|
|
4112
|
-
}), o.textContent !== g && (ln(e.removed, {
|
|
4113
|
-
element: o.cloneNode()
|
|
4114
|
-
}), o.textContent = g)), st($.afterSanitizeElements, o, null), !1);
|
|
4115
|
-
}, bs = function(o, g, b) {
|
|
4116
|
-
if (as && (g === "id" || g === "name") && (b in n || b in ga))
|
|
4117
|
-
return !1;
|
|
4118
|
-
if (!(zt && !je[g] && ce(A, g))) {
|
|
4119
|
-
if (!(ht && ce(D, g))) {
|
|
4120
|
-
if (!(V.attributeCheck instanceof Function && V.attributeCheck(g, o))) {
|
|
4121
|
-
if (!j[g] || je[g]) {
|
|
4122
|
-
if (
|
|
4123
|
-
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
4124
|
-
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
4125
|
-
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
4126
|
-
!(ks(o) && (H.tagNameCheck instanceof RegExp && ce(H.tagNameCheck, o) || H.tagNameCheck instanceof Function && H.tagNameCheck(o)) && (H.attributeNameCheck instanceof RegExp && ce(H.attributeNameCheck, g) || H.attributeNameCheck instanceof Function && H.attributeNameCheck(g, o)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
4127
|
-
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
4128
|
-
g === "is" && H.allowCustomizedBuiltInElements && (H.tagNameCheck instanceof RegExp && ce(H.tagNameCheck, b) || H.tagNameCheck instanceof Function && H.tagNameCheck(b)))
|
|
4129
|
-
) return !1;
|
|
4130
|
-
} else if (!or[g]) {
|
|
4131
|
-
if (!ce(kt, on(b, ye, ""))) {
|
|
4132
|
-
if (!((g === "src" || g === "xlink:href" || g === "href") && o !== "script" && Ro(b, "data:") === 0 && us[o])) {
|
|
4133
|
-
if (!(ie && !ce(ee, on(b, ye, "")))) {
|
|
4134
|
-
if (b)
|
|
4135
|
-
return !1;
|
|
4136
|
-
}
|
|
4137
|
-
}
|
|
4138
|
-
}
|
|
4139
|
-
}
|
|
4140
|
-
}
|
|
4141
|
-
}
|
|
4142
|
-
}
|
|
4143
|
-
return !0;
|
|
4144
|
-
}, ks = function(o) {
|
|
4145
|
-
return o !== "annotation-xml" && _r(o, tt);
|
|
4146
|
-
}, ws = function(o) {
|
|
4147
|
-
st($.beforeSanitizeAttributes, o, null);
|
|
4148
|
-
const {
|
|
4149
|
-
attributes: g
|
|
4150
|
-
} = o;
|
|
4151
|
-
if (!g || hr(o))
|
|
4152
|
-
return;
|
|
4153
|
-
const b = {
|
|
4154
|
-
attrName: "",
|
|
4155
|
-
attrValue: "",
|
|
4156
|
-
keepAttr: !0,
|
|
4157
|
-
allowedAttributes: j,
|
|
4158
|
-
forceKeepAttr: void 0
|
|
4159
|
-
};
|
|
4160
|
-
let W = g.length;
|
|
4161
|
-
for (; W--; ) {
|
|
4162
|
-
const ae = g[W], {
|
|
4163
|
-
name: Z,
|
|
4164
|
-
namespaceURI: be,
|
|
4165
|
-
value: it
|
|
4166
|
-
} = ae, Wt = te(Z), pr = it;
|
|
4167
|
-
let ne = Z === "value" ? pr : $o(pr);
|
|
4168
|
-
if (b.attrName = Wt, b.attrValue = ne, b.keepAttr = !0, b.forceKeepAttr = void 0, st($.uponSanitizeAttribute, o, b), ne = b.attrValue, ls && (Wt === "id" || Wt === "name") && (xt(Z, o), ne = ca + ne), De && ce(/((--!?|])>)|<\/(style|title|textarea)/i, ne)) {
|
|
4169
|
-
xt(Z, o);
|
|
4170
|
-
continue;
|
|
4171
|
-
}
|
|
4172
|
-
if (Wt === "attributename" && _r(ne, "href")) {
|
|
4173
|
-
xt(Z, o);
|
|
4174
|
-
continue;
|
|
4175
|
-
}
|
|
4176
|
-
if (b.forceKeepAttr)
|
|
4177
|
-
continue;
|
|
4178
|
-
if (!b.keepAttr) {
|
|
4179
|
-
xt(Z, o);
|
|
4180
|
-
continue;
|
|
4181
|
-
}
|
|
4182
|
-
if (!Ye && ce(/\/>/i, ne)) {
|
|
4183
|
-
xt(Z, o);
|
|
4184
|
-
continue;
|
|
4185
|
-
}
|
|
4186
|
-
Ve && Cn([Y, ve, me], (ys) => {
|
|
4187
|
-
ne = on(ne, ys, " ");
|
|
4188
|
-
});
|
|
4189
|
-
const xs = te(o.nodeName);
|
|
4190
|
-
if (!bs(xs, Wt, ne)) {
|
|
4191
|
-
xt(Z, o);
|
|
4192
|
-
continue;
|
|
4193
|
-
}
|
|
4194
|
-
if (S && typeof v == "object" && typeof v.getAttributeType == "function" && !be)
|
|
4195
|
-
switch (v.getAttributeType(xs, Wt)) {
|
|
4196
|
-
case "TrustedHTML": {
|
|
4197
|
-
ne = S.createHTML(ne);
|
|
4198
|
-
break;
|
|
4199
|
-
}
|
|
4200
|
-
case "TrustedScriptURL": {
|
|
4201
|
-
ne = S.createScriptURL(ne);
|
|
4202
|
-
break;
|
|
4203
|
-
}
|
|
4204
|
-
}
|
|
4205
|
-
if (ne !== pr)
|
|
4206
|
-
try {
|
|
4207
|
-
be ? o.setAttributeNS(be, Z, ne) : o.setAttribute(Z, ne), hr(o) ? Ze(o) : Gs(e.removed);
|
|
4208
|
-
} catch {
|
|
4209
|
-
xt(Z, o);
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
st($.afterSanitizeAttributes, o, null);
|
|
4213
|
-
}, ma = function y(o) {
|
|
4214
|
-
let g = null;
|
|
4215
|
-
const b = vs(o);
|
|
4216
|
-
for (st($.beforeSanitizeShadowDOM, o, null); g = b.nextNode(); )
|
|
4217
|
-
st($.uponSanitizeShadowNode, g, null), _s(g), ws(g), g.content instanceof i && y(g.content);
|
|
4218
|
-
st($.afterSanitizeShadowDOM, o, null);
|
|
4219
|
-
};
|
|
4220
|
-
return e.sanitize = function(y) {
|
|
4221
|
-
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = null, b = null, W = null, ae = null;
|
|
4222
|
-
if (ur = !y, ur && (y = "<!-->"), typeof y != "string" && !ms(y))
|
|
4223
|
-
if (typeof y.toString == "function") {
|
|
4224
|
-
if (y = y.toString(), typeof y != "string")
|
|
4225
|
-
throw un("dirty is not a string, aborting");
|
|
4226
|
-
} else
|
|
4227
|
-
throw un("toString is not a function");
|
|
4228
|
-
if (!e.isSupported)
|
|
4229
|
-
return y;
|
|
4230
|
-
if (wt || fr(o), e.removed = [], typeof y == "string" && (tn = !1), tn) {
|
|
4231
|
-
if (y.nodeName) {
|
|
4232
|
-
const it = te(y.nodeName);
|
|
4233
|
-
if (!G[it] || qe[it])
|
|
4234
|
-
throw un("root node is forbidden and cannot be sanitized in-place");
|
|
4235
|
-
}
|
|
4236
|
-
} else if (y instanceof u)
|
|
4237
|
-
g = gs("<!---->"), b = g.ownerDocument.importNode(y, !0), b.nodeType === fn.element && b.nodeName === "BODY" || b.nodeName === "HTML" ? g = b : g.appendChild(b);
|
|
4238
|
-
else {
|
|
4239
|
-
if (!_e && !Ve && !Ee && // eslint-disable-next-line unicorn/prefer-includes
|
|
4240
|
-
y.indexOf("<") === -1)
|
|
4241
|
-
return S && yn ? S.createHTML(y) : y;
|
|
4242
|
-
if (g = gs(y), !g)
|
|
4243
|
-
return _e ? null : yn ? k : "";
|
|
4244
|
-
}
|
|
4245
|
-
g && Me && Ze(g.firstChild);
|
|
4246
|
-
const Z = vs(tn ? y : g);
|
|
4247
|
-
for (; W = Z.nextNode(); )
|
|
4248
|
-
_s(W), ws(W), W.content instanceof i && ma(W.content);
|
|
4249
|
-
if (tn)
|
|
4250
|
-
return y;
|
|
4251
|
-
if (_e) {
|
|
4252
|
-
if (Ut)
|
|
4253
|
-
for (ae = U.call(g.ownerDocument); g.firstChild; )
|
|
4254
|
-
ae.appendChild(g.firstChild);
|
|
4255
|
-
else
|
|
4256
|
-
ae = g;
|
|
4257
|
-
return (j.shadowroot || j.shadowrootmode) && (ae = B.call(s, ae, !0)), ae;
|
|
4258
|
-
}
|
|
4259
|
-
let be = Ee ? g.outerHTML : g.innerHTML;
|
|
4260
|
-
return Ee && G["!doctype"] && g.ownerDocument && g.ownerDocument.doctype && g.ownerDocument.doctype.name && ce(aa, g.ownerDocument.doctype.name) && (be = "<!DOCTYPE " + g.ownerDocument.doctype.name + `>
|
|
4261
|
-
` + be), Ve && Cn([Y, ve, me], (it) => {
|
|
4262
|
-
be = on(be, it, " ");
|
|
4263
|
-
}), S && yn ? S.createHTML(be) : be;
|
|
4264
|
-
}, e.setConfig = function() {
|
|
4265
|
-
let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
4266
|
-
fr(y), wt = !0;
|
|
4267
|
-
}, e.clearConfig = function() {
|
|
4268
|
-
Gt = null, wt = !1;
|
|
4269
|
-
}, e.isValidAttribute = function(y, o, g) {
|
|
4270
|
-
Gt || fr({});
|
|
4271
|
-
const b = te(y), W = te(o);
|
|
4272
|
-
return bs(b, W, g);
|
|
4273
|
-
}, e.addHook = function(y, o) {
|
|
4274
|
-
typeof o == "function" && ln($[y], o);
|
|
4275
|
-
}, e.removeHook = function(y, o) {
|
|
4276
|
-
if (o !== void 0) {
|
|
4277
|
-
const g = Ao($[y], o);
|
|
4278
|
-
return g === -1 ? void 0 : So($[y], g, 1)[0];
|
|
4279
|
-
}
|
|
4280
|
-
return Gs($[y]);
|
|
4281
|
-
}, e.removeHooks = function(y) {
|
|
4282
|
-
$[y] = [];
|
|
4283
|
-
}, e.removeAllHooks = function() {
|
|
4284
|
-
$ = Zs();
|
|
4285
|
-
}, e;
|
|
4286
|
-
}
|
|
4287
|
-
var Wo = la(), qo = /* @__PURE__ */ se('<div class="user-avatar svelte-19vup0k">AI</div>'), jo = /* @__PURE__ */ se('<img alt="Avatar" class="avatar-img svelte-19vup0k"/>'), Yo = /* @__PURE__ */ se('<div class="user-avatar svelte-19vup0k">U</div>'), Vo = /* @__PURE__ */ se('<div class="message-avatar svelte-19vup0k"><!></div>'), Zo = /* @__PURE__ */ se('<div class="loading svelte-19vup0k"><div class="dot svelte-19vup0k"></div> <div class="dot svelte-19vup0k"></div> <div class="dot svelte-19vup0k"></div></div>'), Ko = /* @__PURE__ */ se('<p class="svelte-19vup0k"><!></p>'), Xo = /* @__PURE__ */ se('<div class="source-breadcrumb svelte-19vup0k"> </div>'), Qo = /* @__PURE__ */ se('<a target="_blank" rel="noopener noreferrer" class="source-item svelte-19vup0k"><svg class="source-icon svelte-19vup0k" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.746 0 3.332.477 4.5 1.253v13C19.832 18.477 18.246 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" class="svelte-19vup0k"></path></svg> <div class="source-text svelte-19vup0k"><!> <div class="source-title svelte-19vup0k"> </div></div></a>'), Jo = /* @__PURE__ */ se('<div class="sources svelte-19vup0k"><div class="sources-label svelte-19vup0k">Sources</div> <!></div>'), eu = /* @__PURE__ */ se('<div class="message-wrapper svelte-19vup0k"><div class="message svelte-19vup0k"><!> <div class="message-content svelte-19vup0k"><!> <!></div></div></div>');
|
|
4288
|
-
const tu = {
|
|
4289
|
-
hash: "svelte-19vup0k",
|
|
4290
|
-
code: `.message-wrapper.svelte-19vup0k {display:flex;flex-direction:column;}.message.svelte-19vup0k {display:flex;gap:1rem;padding:1.25rem 1.5rem;align-items:flex-start;}.message-avatar.svelte-19vup0k {display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;flex-shrink:0;}.avatar-img.svelte-19vup0k {width:100%;height:100%;border-radius:0.25rem;object-fit:cover;}.user-avatar.svelte-19vup0k {width:2rem;height:2rem;border-radius:0.25rem;display:flex;align-items:center;justify-content:center;color:white;font-size:0.875rem;font-weight:500;}.message-content.svelte-19vup0k {flex:1;min-width:0;}.message-content.svelte-19vup0k p {margin:0 0 0.5rem 0;font-size:0.875rem;line-height:1.625;color:#374151;word-wrap:break-word;}.message-content.svelte-19vup0k p:last-child {margin-bottom:0;}.message-content.svelte-19vup0k code {background-color:#f3f4f6;padding:0.125rem 0.375rem;border-radius:0.25rem;font-family:ui-monospace, monospace;font-size:0.8125rem;color:#ef4444;}.message-content.svelte-19vup0k pre {background-color:#1f2937;color:#f9fafb;padding:12px;border-radius:6px;overflow-x:auto;margin:8px 0;}.message-content.svelte-19vup0k pre code {background-color:transparent;padding:0;color:inherit;}.message-content.svelte-19vup0k a {color:#374151;text-decoration:underline;}.message-content.svelte-19vup0k ul,
|
|
4291
|
-
.message-content.svelte-19vup0k ol {margin:8px 0;padding-left:24px;}.message-content.svelte-19vup0k li {margin:4px 0;}.message-content.svelte-19vup0k strong {font-weight:600;color:#111827;}.message-content.svelte-19vup0k em {font-style:italic;}.loading.svelte-19vup0k {display:flex;gap:0.25rem;align-items:center;}.dot.svelte-19vup0k {width:0.5rem;height:0.5rem;background:#9ca3af;border-radius:50%;
|
|
4292
|
-
animation: svelte-19vup0k-bounce 1.4s infinite ease-in-out both;}.dot.svelte-19vup0k:nth-child(2) {animation-delay:0.16s;}.dot.svelte-19vup0k:nth-child(3) {animation-delay:0.32s;}
|
|
4293
|
-
|
|
4294
|
-
@keyframes svelte-19vup0k-bounce {
|
|
4295
|
-
0%,
|
|
4296
|
-
80%,
|
|
4297
|
-
100% {
|
|
4298
|
-
transform: scale(0);
|
|
4299
|
-
}
|
|
4300
|
-
40% {
|
|
4301
|
-
transform: scale(1);
|
|
4302
|
-
}
|
|
4303
|
-
}.sources.svelte-19vup0k {margin-top:0.75rem;}.sources-label.svelte-19vup0k {font-size:0.75rem;font-weight:500;color:#6b7280;margin-bottom:0.5rem;}.source-item.svelte-19vup0k {display:flex;gap:0.5rem;padding:0.5rem 0.75rem;margin-bottom:0.25rem;border:1px solid #e5e7eb;border-radius:0.375rem;background:#f9fafb;text-decoration:none;transition:all 0.15s;}.source-item.svelte-19vup0k:hover {border-color:#d1d5db;background:#f3f4f6;}.source-icon.svelte-19vup0k {width:1rem;height:1rem;color:#6b7280;flex-shrink:0;}.source-text.svelte-19vup0k {flex:1;min-width:0;}.source-breadcrumb.svelte-19vup0k {font-size:0.75rem;color:#6b7280;margin-bottom:0.125rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.source-title.svelte-19vup0k {font-size:0.875rem;font-weight:500;color:#374151;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}`
|
|
4304
|
-
};
|
|
4305
|
-
function oa(t, e) {
|
|
4306
|
-
Xn(e, !0), qi(t, tu);
|
|
4307
|
-
let n = Et(e, "message"), s = Et(e, "isLoading", 7, !1), r = Et(e, "avatarUrl", 7, "/default-avatar.svg"), i = Et(e, "brandColor", 7, "#0d7a7f"), a = Et(e, "showAvatar", 7, !0), u = /* @__PURE__ */ le(!1);
|
|
4308
|
-
function l() {
|
|
4309
|
-
F(u, !0);
|
|
4310
|
-
}
|
|
4311
|
-
z.setOptions({ breaks: !0, gfm: !0 });
|
|
4312
|
-
function c(k) {
|
|
4313
|
-
return k.split(/\n\s*\n/).map((E) => E.trim()).filter((E) => E).map((E) => ({ html: Wo.sanitize(z.parseInline(E)) }));
|
|
4314
|
-
}
|
|
4315
|
-
var f = {
|
|
4316
|
-
get message() {
|
|
4317
|
-
return n();
|
|
4318
|
-
},
|
|
4319
|
-
set message(k) {
|
|
4320
|
-
n(k), ot();
|
|
4321
|
-
},
|
|
4322
|
-
get isLoading() {
|
|
4323
|
-
return s();
|
|
4324
|
-
},
|
|
4325
|
-
set isLoading(k = !1) {
|
|
4326
|
-
s(k), ot();
|
|
4327
|
-
},
|
|
4328
|
-
get avatarUrl() {
|
|
4329
|
-
return r();
|
|
4330
|
-
},
|
|
4331
|
-
set avatarUrl(k = "/default-avatar.svg") {
|
|
4332
|
-
r(k), ot();
|
|
4333
|
-
},
|
|
4334
|
-
get brandColor() {
|
|
4335
|
-
return i();
|
|
4336
|
-
},
|
|
4337
|
-
set brandColor(k = "#0d7a7f") {
|
|
4338
|
-
i(k), ot();
|
|
4339
|
-
},
|
|
4340
|
-
get showAvatar() {
|
|
4341
|
-
return a();
|
|
4342
|
-
},
|
|
4343
|
-
set showAvatar(k = !0) {
|
|
4344
|
-
a(k), ot();
|
|
4345
|
-
}
|
|
4346
|
-
}, d = eu(), p = Q(d), v = Q(p);
|
|
4347
|
-
{
|
|
4348
|
-
var h = (k) => {
|
|
4349
|
-
var _ = Vo(), E = Q(_);
|
|
4350
|
-
{
|
|
4351
|
-
var U = (B) => {
|
|
4352
|
-
var $ = Os(), Y = Un($);
|
|
4353
|
-
{
|
|
4354
|
-
var ve = (A) => {
|
|
4355
|
-
var D = qo();
|
|
4356
|
-
pt(() => Bn(D, `background-color: ${i() ?? ""}`)), K(A, D);
|
|
4357
|
-
}, me = (A) => {
|
|
4358
|
-
var D = jo();
|
|
4359
|
-
pt(() => kn(D, "src", r())), Rr("error", D, l), Ui(D), K(A, D);
|
|
4360
|
-
};
|
|
4361
|
-
lt(Y, (A) => {
|
|
4362
|
-
m(u) ? A(ve) : A(me, !1);
|
|
4363
|
-
});
|
|
4364
|
-
}
|
|
4365
|
-
K(B, $);
|
|
4366
|
-
}, J = (B) => {
|
|
4367
|
-
var $ = Yo();
|
|
4368
|
-
pt(() => Bn($, `background-color: ${i() ?? ""}`)), K(B, $);
|
|
4369
|
-
};
|
|
4370
|
-
lt(E, (B) => {
|
|
4371
|
-
n().role === "assistant" ? B(U) : B(J, !1);
|
|
4372
|
-
});
|
|
4373
|
-
}
|
|
4374
|
-
X(_), K(k, _);
|
|
4375
|
-
};
|
|
4376
|
-
lt(v, (k) => {
|
|
4377
|
-
a() && k(h);
|
|
4378
|
-
});
|
|
4379
|
-
}
|
|
4380
|
-
var x = ke(v, 2), T = Q(x);
|
|
4381
|
-
{
|
|
4382
|
-
var R = (k) => {
|
|
4383
|
-
var _ = Zo();
|
|
4384
|
-
K(k, _);
|
|
4385
|
-
}, w = (k) => {
|
|
4386
|
-
var _ = Os(), E = Un(_);
|
|
4387
|
-
Hn(E, 17, () => c(n().content), Gi, (U, J) => {
|
|
4388
|
-
var B = Ko(), $ = Q(B);
|
|
4389
|
-
Sl($, () => m(J).html), X(B), K(U, B);
|
|
4390
|
-
}), K(k, _);
|
|
4391
|
-
};
|
|
4392
|
-
lt(T, (k) => {
|
|
4393
|
-
!n().content && s() && n().role === "assistant" ? k(R) : k(w, !1);
|
|
4394
|
-
});
|
|
4395
|
-
}
|
|
4396
|
-
var P = ke(T, 2);
|
|
4397
|
-
{
|
|
4398
|
-
var S = (k) => {
|
|
4399
|
-
var _ = Jo(), E = ke(Q(_), 2);
|
|
4400
|
-
Hn(E, 17, () => n().sources.slice(0, 1), (U) => U.url, (U, J) => {
|
|
4401
|
-
var B = Qo(), $ = ke(Q(B), 2), Y = Q($);
|
|
4402
|
-
{
|
|
4403
|
-
var ve = (D) => {
|
|
4404
|
-
var ee = Xo(), ye = Q(ee, !0);
|
|
4405
|
-
X(ee), pt(() => $r(ye, m(J).breadcrumb)), K(D, ee);
|
|
4406
|
-
};
|
|
4407
|
-
lt(Y, (D) => {
|
|
4408
|
-
m(J).breadcrumb && D(ve);
|
|
4409
|
-
});
|
|
4410
|
-
}
|
|
4411
|
-
var me = ke(Y, 2), A = Q(me, !0);
|
|
4412
|
-
X(me), X($), X(B), pt(() => {
|
|
4413
|
-
kn(B, "href", m(J).url), $r(A, m(J).title);
|
|
4414
|
-
}), K(U, B);
|
|
4415
|
-
}), X(_), K(k, _);
|
|
4416
|
-
};
|
|
4417
|
-
lt(P, (k) => {
|
|
4418
|
-
n().sources && n().sources.length > 0 && k(S);
|
|
4419
|
-
});
|
|
4420
|
-
}
|
|
4421
|
-
return X(x), X(p), X(d), K(t, d), Qn(f);
|
|
4422
|
-
}
|
|
4423
|
-
Kr(
|
|
4424
|
-
oa,
|
|
4425
|
-
{
|
|
4426
|
-
message: {},
|
|
4427
|
-
isLoading: {},
|
|
4428
|
-
avatarUrl: {},
|
|
4429
|
-
brandColor: {},
|
|
4430
|
-
showAvatar: {}
|
|
4431
|
-
},
|
|
4432
|
-
[],
|
|
4433
|
-
[],
|
|
4434
|
-
!0
|
|
4435
|
-
);
|
|
4436
|
-
var nu = /* @__PURE__ */ se('<div class="loading-container svelte-7fg7a1"><div class="loading-content svelte-7fg7a1"><div class="spinner-ring svelte-7fg7a1"></div> <p class="loading-text svelte-7fg7a1">Loading chat...</p></div></div>'), ru = /* @__PURE__ */ se('<div class="separator svelte-7fg7a1"></div>'), su = /* @__PURE__ */ se("<!> <!>", 1), iu = (t, e, n) => e(n), au = /* @__PURE__ */ se('<button class="example-btn svelte-7fg7a1"> </button>'), lu = /* @__PURE__ */ se('<div class="examples svelte-7fg7a1"><h3 class="svelte-7fg7a1">Example Questions</h3> <!></div>'), ou = /* @__PURE__ */ se('<div class="header svelte-7fg7a1"><div class="header-content svelte-7fg7a1"><img alt="Avatar" class="avatar-img svelte-7fg7a1"/> <div><h2 class="svelte-7fg7a1">AI Assistant</h2> <span class="badge svelte-7fg7a1">AI powered</span></div></div></div> <div class="messages-container svelte-7fg7a1"><!> <!> <div></div></div> <div class="input-section svelte-7fg7a1"><div class="input-wrapper svelte-7fg7a1"><input type="text" placeholder="Ask me anything..." class="input-field svelte-7fg7a1"/> <button class="send-btn svelte-7fg7a1" aria-label="Send message"><svg class="send-icon svelte-7fg7a1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"></path></svg></button></div> <div class="footer svelte-7fg7a1"><div class="powered-by svelte-7fg7a1"><span>Powered by</span> <span>🪺</span> <span>Knest</span></div></div></div>', 1), uu = /* @__PURE__ */ se('<div class="chat-card svelte-7fg7a1"><!></div>');
|
|
4437
|
-
const cu = {
|
|
4438
|
-
hash: "svelte-7fg7a1",
|
|
4439
|
-
code: `:host {display:block;font-family:system-ui,
|
|
4440
|
-
-apple-system,
|
|
4441
|
-
sans-serif;}.chat-card.svelte-7fg7a1 {display:flex;flex-direction:column;height:600px;background:white;border-radius:1rem;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1);overflow:hidden;}.loading-container.svelte-7fg7a1 {display:flex;align-items:center;justify-content:center;height:100%;background:linear-gradient(135deg, #fdfbf7 0%, #ffffff 100%);}.loading-content.svelte-7fg7a1 {display:flex;flex-direction:column;align-items:center;gap:1.5rem;}.spinner-ring.svelte-7fg7a1 {width:3rem;height:3rem;border:3px solid #f3f4f6;border-top-color:#0d7a7f;border-radius:50%;
|
|
4442
|
-
animation: svelte-7fg7a1-spin 0.8s linear infinite;}
|
|
4443
|
-
|
|
4444
|
-
@keyframes svelte-7fg7a1-spin {
|
|
4445
|
-
to {
|
|
4446
|
-
transform: rotate(360deg);
|
|
4447
|
-
}
|
|
4448
|
-
}.loading-text.svelte-7fg7a1 {font-size:0.875rem;font-weight:500;color:#6b7280;margin:0;}.header.svelte-7fg7a1 {border-bottom:1px solid #f3f4f6;padding:1rem;}.header-content.svelte-7fg7a1 {display:flex;align-items:center;gap:0.75rem;}.avatar-img.svelte-7fg7a1 {width:2rem;height:2rem;object-fit:cover;border-radius:0.25rem;}h2.svelte-7fg7a1 {font-size:1.125rem;font-weight:600;color:#111827;margin:0 0 0.25rem 0;}.badge.svelte-7fg7a1 {display:inline-block;padding:0.25rem 0.5rem;border-radius:9999px;font-size:0.75rem;font-weight:500;color:white;}.messages-container.svelte-7fg7a1 {flex:1;overflow-y:auto;}.separator.svelte-7fg7a1 {margin:0 1.5rem;border-bottom:1px solid #e5e7eb;}.examples.svelte-7fg7a1 {border-top:1px solid #e5e7eb;padding:1.25rem 1.5rem;}.examples.svelte-7fg7a1 h3:where(.svelte-7fg7a1) {font-size:0.75rem;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;color:#6b7280;margin:0 0 1rem 0;}.example-btn.svelte-7fg7a1 {width:100%;padding:0.75rem;margin-bottom:0.75rem;border:1px solid #e5e7eb;border-radius:0.5rem;background:white;text-align:left;font-size:0.875rem;color:#374151;cursor:pointer;transition:background 0.15s;}.example-btn.svelte-7fg7a1:hover {background:#f9fafb;}.input-section.svelte-7fg7a1 {border-top:1px solid #f3f4f6;padding:1rem;}.input-wrapper.svelte-7fg7a1 {display:flex;gap:0.5rem;}.input-field.svelte-7fg7a1 {flex:1;padding:0.75rem 1rem;border:1px solid #e5e7eb;border-radius:0.5rem;background:#f9fafb;font-size:0.875rem;color:#374151;outline:none;}.input-field.svelte-7fg7a1:focus {background:white;border-color:#d1d5db;}.input-field.svelte-7fg7a1:disabled {opacity:0.5;}.send-btn.svelte-7fg7a1 {width:2.5rem;height:2.5rem;display:flex;align-items:center;justify-content:center;border:none;border-radius:0.5rem;background:#e5e7eb;color:#6b7280;cursor:pointer;transition:background 0.15s;}.send-btn.svelte-7fg7a1:hover:not(:disabled) {background:#d1d5db;}.send-btn.svelte-7fg7a1:disabled {opacity:0.5;cursor:not-allowed;}.send-icon.svelte-7fg7a1 {width:1rem;height:1rem;}.footer.svelte-7fg7a1 {margin-top:0.75rem;display:flex;justify-content:center;}.powered-by.svelte-7fg7a1 {display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;color:#6b7280;}`
|
|
4449
|
-
};
|
|
4450
|
-
function ua(t, e) {
|
|
4451
|
-
Xn(e, !0), qi(t, cu);
|
|
4452
|
-
const n = "https://useknest.com/api/v1", s = `${n}/chat-messages`, r = `${n}/widget-config`, i = "Sorry, I didn't get a response.", a = "Unknown error occurred", u = "/default-avatar.svg", l = "#0d7a7f", c = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?", f = [
|
|
4453
|
-
"How do I get started?",
|
|
4454
|
-
"What features are available?",
|
|
4455
|
-
"How do I integrate this?"
|
|
4456
|
-
];
|
|
4457
|
-
let d = Et(e, "publishableApiKey"), p = /* @__PURE__ */ le(null), v = /* @__PURE__ */ le(!0), h = /* @__PURE__ */ rn(() => m(p)?.avatarUrl || u), x = /* @__PURE__ */ rn(() => m(p)?.welcomeMessage || c), T = /* @__PURE__ */ rn(() => m(p)?.exampleQuestions || f), R = /* @__PURE__ */ rn(() => m(p)?.brandColor || l), w = /* @__PURE__ */ le(jt([])), P = /* @__PURE__ */ le(""), S = /* @__PURE__ */ le(!1), k = /* @__PURE__ */ le(void 0), _ = /* @__PURE__ */ le(void 0);
|
|
4458
|
-
El(async () => {
|
|
4459
|
-
try {
|
|
4460
|
-
const A = await fetch(r, { method: "GET", headers: { "X-Api-Key": d() } });
|
|
4461
|
-
if (A.ok)
|
|
4462
|
-
F(p, await A.json(), !0), console.log("Widget config loaded:", m(p));
|
|
4463
|
-
else {
|
|
4464
|
-
const D = await A.text();
|
|
4465
|
-
console.warn("Failed to fetch widget config:", A.status, D);
|
|
4466
|
-
}
|
|
4467
|
-
} catch (A) {
|
|
4468
|
-
console.error("Error fetching widget config:", A);
|
|
4469
|
-
} finally {
|
|
4470
|
-
F(v, !1), F(w, [{ role: "assistant", content: m(x) }], !0);
|
|
4471
|
-
}
|
|
4472
|
-
}), yi(() => {
|
|
4473
|
-
m(w).length > 0 && m(k) && m(k).scrollIntoView({ behavior: "smooth" });
|
|
4474
|
-
});
|
|
4475
|
-
async function E() {
|
|
4476
|
-
if (!m(P).trim() || m(S)) return;
|
|
4477
|
-
const A = m(P).trim();
|
|
4478
|
-
F(P, ""), F(S, !0), F(w, [...m(w), { role: "user", content: A }], !0);
|
|
4479
|
-
const D = m(w).length;
|
|
4480
|
-
F(w, [...m(w), { role: "assistant", content: "" }], !0);
|
|
4481
|
-
try {
|
|
4482
|
-
const ee = { content: A };
|
|
4483
|
-
m(_) && (ee.threadId = m(_));
|
|
4484
|
-
const ye = await fetch(s, {
|
|
4485
|
-
method: "POST",
|
|
4486
|
-
headers: {
|
|
4487
|
-
"Content-Type": "application/json",
|
|
4488
|
-
"X-Api-Key": d()
|
|
4489
|
-
},
|
|
4490
|
-
body: JSON.stringify(ee)
|
|
4491
|
-
});
|
|
4492
|
-
if (!ye.ok) {
|
|
4493
|
-
const nt = await ye.json();
|
|
4494
|
-
throw new Error(nt.error || "Failed to send message");
|
|
4495
|
-
}
|
|
4496
|
-
const tt = ye.body?.getReader(), kt = new TextDecoder();
|
|
4497
|
-
let G = "", Ne = "", j = [];
|
|
4498
|
-
if (!tt)
|
|
4499
|
-
throw new Error("Response body is not readable");
|
|
4500
|
-
for (; ; ) {
|
|
4501
|
-
const { done: nt, value: H } = await tt.read();
|
|
4502
|
-
if (nt) break;
|
|
4503
|
-
G += kt.decode(H, { stream: !0 });
|
|
4504
|
-
const qe = G.split(`
|
|
4505
|
-
`);
|
|
4506
|
-
G = qe.pop() || "";
|
|
4507
|
-
for (const je of qe)
|
|
4508
|
-
if (je.startsWith("data: "))
|
|
4509
|
-
try {
|
|
4510
|
-
const V = JSON.parse(je.slice(6));
|
|
4511
|
-
if (V.type === "init")
|
|
4512
|
-
m(_) || F(_, V.threadId, !0);
|
|
4513
|
-
else if (V.type === "content")
|
|
4514
|
-
Ne += V.content, F(
|
|
4515
|
-
w,
|
|
4516
|
-
[
|
|
4517
|
-
...m(w).slice(0, D),
|
|
4518
|
-
{ role: "assistant", content: Ne },
|
|
4519
|
-
...m(w).slice(D + 1)
|
|
4520
|
-
],
|
|
4521
|
-
!0
|
|
4522
|
-
);
|
|
4523
|
-
else if (V.type === "complete")
|
|
4524
|
-
j = V.sources || [];
|
|
4525
|
-
else if (V.type === "error")
|
|
4526
|
-
throw new Error(V.error || "Unknown error from server");
|
|
4527
|
-
} catch (V) {
|
|
4528
|
-
console.error("Error parsing SSE data:", V, je);
|
|
4529
|
-
}
|
|
4530
|
-
}
|
|
4531
|
-
Ne ? F(
|
|
4532
|
-
w,
|
|
4533
|
-
[
|
|
4534
|
-
...m(w).slice(0, D),
|
|
4535
|
-
{ role: "assistant", content: Ne, sources: j },
|
|
4536
|
-
...m(w).slice(D + 1)
|
|
4537
|
-
],
|
|
4538
|
-
!0
|
|
4539
|
-
) : F(
|
|
4540
|
-
w,
|
|
4541
|
-
[
|
|
4542
|
-
...m(w).slice(0, D),
|
|
4543
|
-
{ role: "assistant", content: i },
|
|
4544
|
-
...m(w).slice(D + 1)
|
|
4545
|
-
],
|
|
4546
|
-
!0
|
|
4547
|
-
);
|
|
4548
|
-
} catch (ee) {
|
|
4549
|
-
console.error("Error sending message:", ee), F(
|
|
4550
|
-
w,
|
|
4551
|
-
[
|
|
4552
|
-
...m(w).slice(0, D),
|
|
4553
|
-
{
|
|
4554
|
-
role: "assistant",
|
|
4555
|
-
content: `Error: ${ee instanceof Error ? ee.message : a}`
|
|
4556
|
-
},
|
|
4557
|
-
...m(w).slice(D + 1)
|
|
4558
|
-
],
|
|
4559
|
-
!0
|
|
4560
|
-
);
|
|
4561
|
-
} finally {
|
|
4562
|
-
F(S, !1);
|
|
4563
|
-
}
|
|
4564
|
-
}
|
|
4565
|
-
function U(A) {
|
|
4566
|
-
A.key === "Enter" && !A.shiftKey && (A.preventDefault(), E());
|
|
4567
|
-
}
|
|
4568
|
-
async function J(A) {
|
|
4569
|
-
F(P, A, !0), await E();
|
|
4570
|
-
}
|
|
4571
|
-
var B = {
|
|
4572
|
-
get publishableApiKey() {
|
|
4573
|
-
return d();
|
|
4574
|
-
},
|
|
4575
|
-
set publishableApiKey(A) {
|
|
4576
|
-
d(A), ot();
|
|
4577
|
-
}
|
|
4578
|
-
}, $ = uu(), Y = Q($);
|
|
4579
|
-
{
|
|
4580
|
-
var ve = (A) => {
|
|
4581
|
-
var D = nu();
|
|
4582
|
-
K(A, D);
|
|
4583
|
-
}, me = (A) => {
|
|
4584
|
-
var D = ou(), ee = Un(D), ye = Q(ee), tt = Q(ye), kt = ke(tt, 2), G = ke(Q(kt), 2);
|
|
4585
|
-
X(kt), X(ye), X(ee);
|
|
4586
|
-
var Ne = ke(ee, 2), j = Q(Ne);
|
|
4587
|
-
Hn(j, 17, () => m(w), Gi, (ie, Ye, Ve) => {
|
|
4588
|
-
var De = su(), Ee = Un(De);
|
|
4589
|
-
{
|
|
4590
|
-
let _e = /* @__PURE__ */ rn(() => !m(Ye).content && m(S) && m(Ye).role === "assistant");
|
|
4591
|
-
oa(Ee, {
|
|
4592
|
-
get message() {
|
|
4593
|
-
return m(Ye);
|
|
4594
|
-
},
|
|
4595
|
-
get isLoading() {
|
|
4596
|
-
return m(_e);
|
|
4597
|
-
},
|
|
4598
|
-
get avatarUrl() {
|
|
4599
|
-
return m(h);
|
|
4600
|
-
},
|
|
4601
|
-
get brandColor() {
|
|
4602
|
-
return m(R);
|
|
4603
|
-
}
|
|
4604
|
-
});
|
|
4605
|
-
}
|
|
4606
|
-
var wt = ke(Ee, 2);
|
|
4607
|
-
{
|
|
4608
|
-
var Me = (_e) => {
|
|
4609
|
-
var Ut = ru();
|
|
4610
|
-
K(_e, Ut);
|
|
4611
|
-
};
|
|
4612
|
-
lt(wt, (_e) => {
|
|
4613
|
-
Ve < m(w).length - 1 && _e(Me);
|
|
4614
|
-
});
|
|
4615
|
-
}
|
|
4616
|
-
K(ie, De);
|
|
4617
|
-
});
|
|
4618
|
-
var nt = ke(j, 2);
|
|
4619
|
-
{
|
|
4620
|
-
var H = (ie) => {
|
|
4621
|
-
var Ye = lu(), Ve = ke(Q(Ye), 2);
|
|
4622
|
-
Hn(Ve, 18, () => m(T), (De) => De, (De, Ee, wt) => {
|
|
4623
|
-
var Me = au();
|
|
4624
|
-
Me.__click = [iu, J, Ee];
|
|
4625
|
-
var _e = Q(Me, !0);
|
|
4626
|
-
X(Me), pt(() => {
|
|
4627
|
-
Bn(Me, m(wt) === 0 ? `border-color: ${m(R)}; border-width: 2px;` : ""), $r(_e, Ee);
|
|
4628
|
-
}), K(De, Me);
|
|
4629
|
-
}), X(Ye), K(ie, Ye);
|
|
4630
|
-
};
|
|
4631
|
-
lt(nt, (ie) => {
|
|
4632
|
-
m(w).length === 1 && !m(v) && ie(H);
|
|
4633
|
-
});
|
|
4634
|
-
}
|
|
4635
|
-
var qe = ke(nt, 2);
|
|
4636
|
-
Dl(qe, (ie) => F(k, ie), () => m(k)), X(Ne);
|
|
4637
|
-
var je = ke(Ne, 2), V = Q(je), ht = Q(V);
|
|
4638
|
-
Ll(ht);
|
|
4639
|
-
var zt = ke(ht, 2);
|
|
4640
|
-
zt.__click = E, X(V), ti(2), X(je), pt(
|
|
4641
|
-
(ie) => {
|
|
4642
|
-
kn(tt, "src", m(h)), Bn(G, `background-color: ${m(R) ?? ""}`), ht.disabled = m(S), zt.disabled = ie;
|
|
4643
|
-
},
|
|
4644
|
-
[() => m(S) || !m(P).trim()]
|
|
4645
|
-
), Rr("error", tt, (ie) => ie.currentTarget.src = u), Ui(tt), Rr("keypress", ht, U), Nl(ht, () => m(P), (ie) => F(P, ie)), K(A, D);
|
|
4646
|
-
};
|
|
4647
|
-
lt(Y, (A) => {
|
|
4648
|
-
m(v) ? A(ve) : A(me, !1);
|
|
4649
|
-
});
|
|
4650
|
-
}
|
|
4651
|
-
return X($), K(t, $), Qn(B);
|
|
4652
|
-
}
|
|
4653
|
-
bl(["click"]);
|
|
4654
|
-
Kr(ua, { publishableApiKey: {} }, [], [], !0);
|
|
4655
|
-
function fu(t, e) {
|
|
4656
|
-
Xn(e, !0);
|
|
4657
|
-
let n = Et(e, "publishableApiKey");
|
|
4658
|
-
var s = {
|
|
4659
|
-
get publishableApiKey() {
|
|
4660
|
-
return n();
|
|
4661
|
-
},
|
|
4662
|
-
set publishableApiKey(r) {
|
|
4663
|
-
n(r), ot();
|
|
4664
|
-
}
|
|
4665
|
-
};
|
|
4666
|
-
return ua(t, {
|
|
4667
|
-
get publishableApiKey() {
|
|
4668
|
-
return n();
|
|
4669
|
-
}
|
|
4670
|
-
}), Qn(s);
|
|
4671
|
-
}
|
|
4672
|
-
customElements.define("knest-chat", Kr(fu, { publishableApiKey: {} }, [], [], !0));
|
|
4673
|
-
export {
|
|
4674
|
-
oa as ChatMessage,
|
|
4675
|
-
fu as ChatWidget,
|
|
4676
|
-
fu as default
|
|
4677
|
-
};
|