@pie-players/pie-section-tools-toolbar 0.2.9 → 0.2.10

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.
@@ -0,0 +1,4315 @@
1
+ var Mr = Object.defineProperty, Xi = (e) => {
2
+ throw TypeError(e);
3
+ }, Ar = (e, t, n) => t in e ? Mr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, $ = (e, t, n) => Ar(e, typeof t != "symbol" ? t + "" : t, n), li = (e, t, n) => t.has(e) || Xi("Cannot " + n), d = (e, t, n) => (li(e, t, "read from private field"), n ? n.call(e) : t.get(e)), I = (e, t, n) => t.has(e) ? Xi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), w = (e, t, n, i) => (li(e, t, "write to private field"), t.set(e, n), n), B = (e, t, n) => (li(e, t, "access private method"), n), Oi;
4
+ typeof window < "u" && ((Oi = window.__svelte ?? (window.__svelte = {})).v ?? (Oi.v = /* @__PURE__ */ new Set())).add("5");
5
+ const Lr = 1, Er = 2, Or = 16, Vr = 1, Rr = 2, ai = "[", In = "[!", ui = "]", Tt = {}, z = /* @__PURE__ */ Symbol(), Zi = "http://www.w3.org/1999/xhtml", jr = !1;
6
+ var Qi = Array.isArray, Nr = Array.prototype.indexOf, Ct = Array.prototype.includes, _n = Array.from, yn = Object.keys, wn = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, Pr = Object.getOwnPropertyDescriptors, zr = Object.prototype, Wr = Array.prototype, eo = Object.getPrototypeOf, Vi = Object.isExtensible;
7
+ const to = () => {
8
+ };
9
+ function Hr(e) {
10
+ for (var t = 0; t < e.length; t++)
11
+ e[t]();
12
+ }
13
+ function no() {
14
+ var e, t, n = new Promise((i, r) => {
15
+ e = i, t = r;
16
+ });
17
+ return { promise: n, resolve: e, reject: t };
18
+ }
19
+ const W = 2, en = 4, Tn = 8, io = 1 << 24, je = 16, be = 32, Qe = 64, Gn = 128, ie = 512, N = 1024, H = 2048, ge = 4096, X = 8192, Re = 16384, Ot = 32768, dt = 65536, Ri = 1 << 17, oo = 1 << 18, gt = 1 << 19, qr = 1 << 20, Ye = 1 << 25, ht = 65536, Bn = 1 << 21, ci = 1 << 22, Ue = 1 << 23, cn = /* @__PURE__ */ Symbol("$state"), Dr = /* @__PURE__ */ Symbol("legacy props"), Fr = /* @__PURE__ */ Symbol(""), st = new class extends Error {
20
+ constructor() {
21
+ super(...arguments), $(this, "name", "StaleReactionError"), $(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
22
+ }
23
+ }(), ro = (
24
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
25
+ !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
26
+ ), Cn = 3, nn = 8;
27
+ function Gr(e) {
28
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
29
+ }
30
+ function Br() {
31
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
32
+ }
33
+ function Yr(e, t, n) {
34
+ throw new Error("https://svelte.dev/e/each_key_duplicate");
35
+ }
36
+ function Ur(e) {
37
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
38
+ }
39
+ function Kr() {
40
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
41
+ }
42
+ function Jr(e) {
43
+ throw new Error("https://svelte.dev/e/effect_orphan");
44
+ }
45
+ function Xr() {
46
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
47
+ }
48
+ function Zr() {
49
+ throw new Error("https://svelte.dev/e/hydration_failed");
50
+ }
51
+ function Qr() {
52
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
53
+ }
54
+ function es() {
55
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
56
+ }
57
+ function ts() {
58
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
59
+ }
60
+ function ns() {
61
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
62
+ }
63
+ function Sn(e) {
64
+ console.warn("https://svelte.dev/e/hydration_mismatch");
65
+ }
66
+ function is() {
67
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
68
+ }
69
+ let M = !1;
70
+ function Oe(e) {
71
+ M = e;
72
+ }
73
+ let A;
74
+ function Z(e) {
75
+ if (e === null)
76
+ throw Sn(), Tt;
77
+ return A = e;
78
+ }
79
+ function Mn() {
80
+ return Z(/* @__PURE__ */ _e(A));
81
+ }
82
+ function q(e) {
83
+ if (M) {
84
+ if (/* @__PURE__ */ _e(A) !== null)
85
+ throw Sn(), Tt;
86
+ A = e;
87
+ }
88
+ }
89
+ function dn(e = 1) {
90
+ if (M) {
91
+ for (var t = e, n = A; t--; )
92
+ n = /** @type {TemplateNode} */
93
+ /* @__PURE__ */ _e(n);
94
+ A = n;
95
+ }
96
+ }
97
+ function $n(e = !0) {
98
+ for (var t = 0, n = A; ; ) {
99
+ if (n.nodeType === nn) {
100
+ var i = (
101
+ /** @type {Comment} */
102
+ n.data
103
+ );
104
+ if (i === ui) {
105
+ if (t === 0) return n;
106
+ t -= 1;
107
+ } else (i === ai || i === In || // "[1", "[2", etc. for if blocks
108
+ i[0] === "[" && !isNaN(Number(i.slice(1)))) && (t += 1);
109
+ }
110
+ var r = (
111
+ /** @type {TemplateNode} */
112
+ /* @__PURE__ */ _e(n)
113
+ );
114
+ e && n.remove(), n = r;
115
+ }
116
+ }
117
+ function so(e) {
118
+ if (!e || e.nodeType !== nn)
119
+ throw Sn(), Tt;
120
+ return (
121
+ /** @type {Comment} */
122
+ e.data
123
+ );
124
+ }
125
+ function lo(e) {
126
+ return e === this.v;
127
+ }
128
+ function os(e, t) {
129
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
130
+ }
131
+ function ao(e) {
132
+ return !os(e, this.v);
133
+ }
134
+ let rs = !1, Q = null;
135
+ function St(e) {
136
+ Q = e;
137
+ }
138
+ function An(e, t = !1, n) {
139
+ Q = {
140
+ p: Q,
141
+ i: !1,
142
+ c: null,
143
+ e: null,
144
+ s: e,
145
+ x: null,
146
+ l: null
147
+ };
148
+ }
149
+ function Ln(e) {
150
+ var t = (
151
+ /** @type {ComponentContext} */
152
+ Q
153
+ ), n = t.e;
154
+ if (n !== null) {
155
+ t.e = null;
156
+ for (var i of n)
157
+ Vo(i);
158
+ }
159
+ return e !== void 0 && (t.x = e), t.i = !0, Q = t.p, e ?? /** @type {T} */
160
+ {};
161
+ }
162
+ function uo() {
163
+ return !0;
164
+ }
165
+ let lt = [];
166
+ function co() {
167
+ var e = lt;
168
+ lt = [], Hr(e);
169
+ }
170
+ function Xe(e) {
171
+ if (lt.length === 0 && !Jt) {
172
+ var t = lt;
173
+ queueMicrotask(() => {
174
+ t === lt && co();
175
+ });
176
+ }
177
+ lt.push(e);
178
+ }
179
+ function ss() {
180
+ for (; lt.length > 0; )
181
+ co();
182
+ }
183
+ function ho(e) {
184
+ var t = S;
185
+ if (t === null)
186
+ return T.f |= Ue, e;
187
+ if ((t.f & Ot) === 0 && (t.f & en) === 0)
188
+ throw e;
189
+ Mt(e, t);
190
+ }
191
+ function Mt(e, t) {
192
+ for (; t !== null; ) {
193
+ if ((t.f & Gn) !== 0) {
194
+ if ((t.f & Ot) === 0)
195
+ throw e;
196
+ try {
197
+ t.b.error(e);
198
+ return;
199
+ } catch (n) {
200
+ e = n;
201
+ }
202
+ }
203
+ t = t.parent;
204
+ }
205
+ throw e;
206
+ }
207
+ const ls = -7169;
208
+ function R(e, t) {
209
+ e.f = e.f & ls | t;
210
+ }
211
+ function di(e) {
212
+ (e.f & ie) !== 0 || e.deps === null ? R(e, N) : R(e, ge);
213
+ }
214
+ function fo(e) {
215
+ if (e !== null)
216
+ for (const t of e)
217
+ (t.f & W) === 0 || (t.f & ht) === 0 || (t.f ^= ht, fo(
218
+ /** @type {Derived} */
219
+ t.deps
220
+ ));
221
+ }
222
+ function po(e, t, n) {
223
+ (e.f & H) !== 0 ? t.add(e) : (e.f & ge) !== 0 && n.add(e), fo(e.deps), R(e, N);
224
+ }
225
+ const hn = /* @__PURE__ */ new Set();
226
+ let O = null, ve = null, Y = [], En = null, Yn = !1, Jt = !1;
227
+ var Ft, Gt, Pe, tt, Bt, xn, It, Ge, Yt, nt, Un, Kn, vo;
228
+ const as = class go {
229
+ constructor() {
230
+ I(this, nt), $(this, "committed", !1), $(this, "current", /* @__PURE__ */ new Map()), $(this, "previous", /* @__PURE__ */ new Map()), I(this, Ft, /* @__PURE__ */ new Set()), I(this, Gt, /* @__PURE__ */ new Set()), I(this, Pe, 0), I(this, tt, 0), I(this, Bt, null), I(this, xn, /* @__PURE__ */ new Set()), I(this, It, /* @__PURE__ */ new Set()), I(this, Ge, /* @__PURE__ */ new Map()), $(this, "is_fork", !1), I(this, Yt, !1);
231
+ }
232
+ is_deferred() {
233
+ return this.is_fork || d(this, tt) > 0;
234
+ }
235
+ /**
236
+ * Add an effect to the #skipped_branches map and reset its children
237
+ * @param {Effect} effect
238
+ */
239
+ skip_effect(t) {
240
+ d(this, Ge).has(t) || d(this, Ge).set(t, { d: [], m: [] });
241
+ }
242
+ /**
243
+ * Remove an effect from the #skipped_branches map and reschedule
244
+ * any tracked dirty/maybe_dirty child effects
245
+ * @param {Effect} effect
246
+ */
247
+ unskip_effect(t) {
248
+ var n = d(this, Ge).get(t);
249
+ if (n) {
250
+ d(this, Ge).delete(t);
251
+ for (var i of n.d)
252
+ R(i, H), fe(i);
253
+ for (i of n.m)
254
+ R(i, ge), fe(i);
255
+ }
256
+ }
257
+ /**
258
+ *
259
+ * @param {Effect[]} root_effects
260
+ */
261
+ process(t) {
262
+ Y = [], this.apply();
263
+ var n = [], i = [];
264
+ for (const r of t)
265
+ B(this, nt, Un).call(this, r, n, i);
266
+ if (this.is_deferred()) {
267
+ B(this, nt, Kn).call(this, i), B(this, nt, Kn).call(this, n);
268
+ for (const [r, o] of d(this, Ge))
269
+ wo(r, o);
270
+ } else {
271
+ for (const r of d(this, Ft)) r();
272
+ d(this, Ft).clear(), d(this, Pe) === 0 && B(this, nt, vo).call(this), O = null, ji(i), ji(n), d(this, Bt)?.resolve();
273
+ }
274
+ ve = null;
275
+ }
276
+ /**
277
+ * Associate a change to a given source with the current
278
+ * batch, noting its previous and current values
279
+ * @param {Source} source
280
+ * @param {any} value
281
+ */
282
+ capture(t, n) {
283
+ n !== z && !this.previous.has(t) && this.previous.set(t, n), (t.f & Ue) === 0 && (this.current.set(t, t.v), ve?.set(t, t.v));
284
+ }
285
+ activate() {
286
+ O = this, this.apply();
287
+ }
288
+ deactivate() {
289
+ O === this && (O = null, ve = null);
290
+ }
291
+ flush() {
292
+ if (this.activate(), Y.length > 0) {
293
+ if (bo(), O !== null && O !== this)
294
+ return;
295
+ } else d(this, Pe) === 0 && this.process([]);
296
+ this.deactivate();
297
+ }
298
+ discard() {
299
+ for (const t of d(this, Gt)) t(this);
300
+ d(this, Gt).clear();
301
+ }
302
+ /**
303
+ *
304
+ * @param {boolean} blocking
305
+ */
306
+ increment(t) {
307
+ w(this, Pe, d(this, Pe) + 1), t && w(this, tt, d(this, tt) + 1);
308
+ }
309
+ /**
310
+ *
311
+ * @param {boolean} blocking
312
+ */
313
+ decrement(t) {
314
+ w(this, Pe, d(this, Pe) - 1), t && w(this, tt, d(this, tt) - 1), !d(this, Yt) && (w(this, Yt, !0), Xe(() => {
315
+ w(this, Yt, !1), this.is_deferred() ? Y.length > 0 && this.flush() : this.revive();
316
+ }));
317
+ }
318
+ revive() {
319
+ for (const t of d(this, xn))
320
+ d(this, It).delete(t), R(t, H), fe(t);
321
+ for (const t of d(this, It))
322
+ R(t, ge), fe(t);
323
+ this.flush();
324
+ }
325
+ /** @param {() => void} fn */
326
+ oncommit(t) {
327
+ d(this, Ft).add(t);
328
+ }
329
+ /** @param {(batch: Batch) => void} fn */
330
+ ondiscard(t) {
331
+ d(this, Gt).add(t);
332
+ }
333
+ settled() {
334
+ return (d(this, Bt) ?? w(this, Bt, no())).promise;
335
+ }
336
+ static ensure() {
337
+ if (O === null) {
338
+ const t = O = new go();
339
+ hn.add(O), Jt || Xe(() => {
340
+ O === t && t.flush();
341
+ });
342
+ }
343
+ return O;
344
+ }
345
+ apply() {
346
+ }
347
+ };
348
+ Ft = /* @__PURE__ */ new WeakMap(), Gt = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), Bt = /* @__PURE__ */ new WeakMap(), xn = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Yt = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakSet(), /**
349
+ * Traverse the effect tree, executing effects or stashing
350
+ * them for later execution as appropriate
351
+ * @param {Effect} root
352
+ * @param {Effect[]} effects
353
+ * @param {Effect[]} render_effects
354
+ */
355
+ Un = function(e, t, n) {
356
+ e.f ^= N;
357
+ for (var i = e.first, r = null; i !== null; ) {
358
+ var o = i.f, s = (o & (be | Qe)) !== 0, l = s && (o & N) !== 0, a = l || (o & X) !== 0 || d(this, Ge).has(i);
359
+ if (!a && i.fn !== null) {
360
+ s ? i.f ^= N : r !== null && (o & (en | Tn | io)) !== 0 ? r.b.defer_effect(i) : (o & en) !== 0 ? t.push(i) : on(i) && ((o & je) !== 0 && d(this, It).add(i), Et(i));
361
+ var u = i.first;
362
+ if (u !== null) {
363
+ i = u;
364
+ continue;
365
+ }
366
+ }
367
+ for (; i !== null; ) {
368
+ i === r && (r = null);
369
+ var f = i.next;
370
+ if (f !== null) {
371
+ i = f;
372
+ break;
373
+ }
374
+ i = i.parent;
375
+ }
376
+ }
377
+ }, /**
378
+ * @param {Effect[]} effects
379
+ */
380
+ Kn = function(e) {
381
+ for (var t = 0; t < e.length; t += 1)
382
+ po(e[t], d(this, xn), d(this, It));
383
+ }, vo = function() {
384
+ var e;
385
+ if (hn.size > 1) {
386
+ this.previous.clear();
387
+ var t = ve, n = !0;
388
+ for (const r of hn) {
389
+ if (r === this) {
390
+ n = !1;
391
+ continue;
392
+ }
393
+ const o = [];
394
+ for (const [l, a] of this.current) {
395
+ if (r.current.has(l))
396
+ if (n && a !== r.current.get(l))
397
+ r.current.set(l, a);
398
+ else
399
+ continue;
400
+ o.push(l);
401
+ }
402
+ if (o.length === 0)
403
+ continue;
404
+ const s = [...r.current.keys()].filter((l) => !this.current.has(l));
405
+ if (s.length > 0) {
406
+ var i = Y;
407
+ Y = [];
408
+ const l = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
409
+ for (const u of o)
410
+ mo(u, s, l, a);
411
+ if (Y.length > 0) {
412
+ O = r, r.apply();
413
+ for (const u of Y)
414
+ B(e = r, nt, Un).call(e, u, [], []);
415
+ r.deactivate();
416
+ }
417
+ Y = i;
418
+ }
419
+ }
420
+ O = null, ve = t;
421
+ }
422
+ this.committed = !0, hn.delete(this);
423
+ };
424
+ let ft = as;
425
+ function ne(e) {
426
+ var t = Jt;
427
+ Jt = !0;
428
+ try {
429
+ for (var n; ; ) {
430
+ if (ss(), Y.length === 0 && (O?.flush(), Y.length === 0))
431
+ return En = null, /** @type {T} */
432
+ n;
433
+ bo();
434
+ }
435
+ } finally {
436
+ Jt = t;
437
+ }
438
+ }
439
+ function bo() {
440
+ Yn = !0;
441
+ try {
442
+ for (var e = 0; Y.length > 0; ) {
443
+ var t = ft.ensure();
444
+ if (e++ > 1e3) {
445
+ var n, i;
446
+ us();
447
+ }
448
+ t.process(Y), Ke.clear();
449
+ }
450
+ } finally {
451
+ Y = [], Yn = !1, En = null;
452
+ }
453
+ }
454
+ function us() {
455
+ try {
456
+ Xr();
457
+ } catch (e) {
458
+ Mt(e, En);
459
+ }
460
+ }
461
+ let Ae = null;
462
+ function ji(e) {
463
+ var t = e.length;
464
+ if (t !== 0) {
465
+ for (var n = 0; n < t; ) {
466
+ var i = e[n++];
467
+ if ((i.f & (Re | X)) === 0 && on(i) && (Ae = /* @__PURE__ */ new Set(), Et(i), i.deps === null && i.first === null && i.nodes === null && i.teardown === null && i.ac === null && No(i), Ae?.size > 0)) {
468
+ Ke.clear();
469
+ for (const r of Ae) {
470
+ if ((r.f & (Re | X)) !== 0) continue;
471
+ const o = [r];
472
+ let s = r.parent;
473
+ for (; s !== null; )
474
+ Ae.has(s) && (Ae.delete(s), o.push(s)), s = s.parent;
475
+ for (let l = o.length - 1; l >= 0; l--) {
476
+ const a = o[l];
477
+ (a.f & (Re | X)) === 0 && Et(a);
478
+ }
479
+ }
480
+ Ae.clear();
481
+ }
482
+ }
483
+ Ae = null;
484
+ }
485
+ }
486
+ function mo(e, t, n, i) {
487
+ if (!n.has(e) && (n.add(e), e.reactions !== null))
488
+ for (const r of e.reactions) {
489
+ const o = r.f;
490
+ (o & W) !== 0 ? mo(
491
+ /** @type {Derived} */
492
+ r,
493
+ t,
494
+ n,
495
+ i
496
+ ) : (o & (ci | je)) !== 0 && (o & H) === 0 && yo(r, t, i) && (R(r, H), fe(
497
+ /** @type {Effect} */
498
+ r
499
+ ));
500
+ }
501
+ }
502
+ function yo(e, t, n) {
503
+ const i = n.get(e);
504
+ if (i !== void 0) return i;
505
+ if (e.deps !== null)
506
+ for (const r of e.deps) {
507
+ if (Ct.call(t, r))
508
+ return !0;
509
+ if ((r.f & W) !== 0 && yo(
510
+ /** @type {Derived} */
511
+ r,
512
+ t,
513
+ n
514
+ ))
515
+ return n.set(
516
+ /** @type {Derived} */
517
+ r,
518
+ !0
519
+ ), !0;
520
+ }
521
+ return n.set(e, !1), !1;
522
+ }
523
+ function fe(e) {
524
+ for (var t = En = e; t.parent !== null; ) {
525
+ t = t.parent;
526
+ var n = t.f;
527
+ if (Yn && t === S && (n & je) !== 0 && (n & oo) === 0)
528
+ return;
529
+ if ((n & (Qe | be)) !== 0) {
530
+ if ((n & N) === 0) return;
531
+ t.f ^= N;
532
+ }
533
+ }
534
+ Y.push(t);
535
+ }
536
+ function wo(e, t) {
537
+ if (!((e.f & be) !== 0 && (e.f & N) !== 0)) {
538
+ (e.f & H) !== 0 ? t.d.push(e) : (e.f & ge) !== 0 && t.m.push(e), R(e, N);
539
+ for (var n = e.first; n !== null; )
540
+ wo(n, t), n = n.next;
541
+ }
542
+ }
543
+ function cs(e) {
544
+ let t = 0, n = pt(0), i;
545
+ return () => {
546
+ vi() && (c(n), gi(() => (t === 0 && (i = yi(() => e(() => Qt(n)))), t += 1, () => {
547
+ Xe(() => {
548
+ t -= 1, t === 0 && (i?.(), i = void 0, Qt(n));
549
+ });
550
+ })));
551
+ };
552
+ }
553
+ var ds = dt | gt;
554
+ function hs(e, t, n) {
555
+ new fs(e, t, n);
556
+ }
557
+ var de, fn, Be, $t, Le, Ee, te, Me, ze, it, We, Ut, Xt, Zt, He, Jn, ce, $o, xo, Xn, kn, Zn;
558
+ class fs {
559
+ /**
560
+ * @param {TemplateNode} node
561
+ * @param {BoundaryProps} props
562
+ * @param {((anchor: Node) => void)} children
563
+ */
564
+ constructor(t, n, i) {
565
+ I(this, ce), $(this, "parent"), $(this, "is_pending", !1), I(this, de), I(this, fn, M ? A : null), I(this, Be), I(this, $t), I(this, Le), I(this, Ee, null), I(this, te, null), I(this, Me, null), I(this, ze, null), I(this, it, 0), I(this, We, 0), I(this, Ut, !1), I(this, Xt, /* @__PURE__ */ new Set()), I(this, Zt, /* @__PURE__ */ new Set()), I(this, He, null), I(this, Jn, cs(() => (w(this, He, pt(d(this, it))), () => {
566
+ w(this, He, null);
567
+ }))), w(this, de, t), w(this, Be, n), w(this, $t, (r) => {
568
+ var o = (
569
+ /** @type {Effect} */
570
+ S
571
+ );
572
+ o.b = this, o.f |= Gn, i(r);
573
+ }), this.parent = /** @type {Effect} */
574
+ S.b, w(this, Le, Vn(() => {
575
+ if (M) {
576
+ const r = (
577
+ /** @type {Comment} */
578
+ d(this, fn)
579
+ );
580
+ Mn(), r.data === In ? B(this, ce, xo).call(this) : B(this, ce, $o).call(this);
581
+ } else
582
+ B(this, ce, Xn).call(this);
583
+ }, ds)), M && w(this, de, A);
584
+ }
585
+ /**
586
+ * Defer an effect inside a pending boundary until the boundary resolves
587
+ * @param {Effect} effect
588
+ */
589
+ defer_effect(t) {
590
+ po(t, d(this, Xt), d(this, Zt));
591
+ }
592
+ /**
593
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
594
+ * @returns {boolean}
595
+ */
596
+ is_rendered() {
597
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
598
+ }
599
+ has_pending_snippet() {
600
+ return !!d(this, Be).pending;
601
+ }
602
+ /**
603
+ * Update the source that powers `$effect.pending()` inside this boundary,
604
+ * and controls when the current `pending` snippet (if any) is removed.
605
+ * Do not call from inside the class
606
+ * @param {1 | -1} d
607
+ */
608
+ update_pending_count(t) {
609
+ B(this, ce, Zn).call(this, t), w(this, it, d(this, it) + t), !(!d(this, He) || d(this, Ut)) && (w(this, Ut, !0), Xe(() => {
610
+ w(this, Ut, !1), d(this, He) && At(d(this, He), d(this, it));
611
+ }));
612
+ }
613
+ get_effect_pending() {
614
+ return d(this, Jn).call(this), c(
615
+ /** @type {Source<number>} */
616
+ d(this, He)
617
+ );
618
+ }
619
+ /** @param {unknown} error */
620
+ error(t) {
621
+ var n = d(this, Be).onerror;
622
+ let i = d(this, Be).failed;
623
+ if (!n && !i)
624
+ throw t;
625
+ d(this, Ee) && (F(d(this, Ee)), w(this, Ee, null)), d(this, te) && (F(d(this, te)), w(this, te, null)), d(this, Me) && (F(d(this, Me)), w(this, Me, null)), M && (Z(
626
+ /** @type {TemplateNode} */
627
+ d(this, fn)
628
+ ), dn(), Z($n()));
629
+ var r = !1, o = !1;
630
+ const s = () => {
631
+ if (r) {
632
+ is();
633
+ return;
634
+ }
635
+ r = !0, o && ns(), d(this, Me) !== null && vt(d(this, Me), () => {
636
+ w(this, Me, null);
637
+ }), B(this, ce, kn).call(this, () => {
638
+ ft.ensure(), B(this, ce, Xn).call(this);
639
+ });
640
+ };
641
+ Xe(() => {
642
+ try {
643
+ o = !0, n?.(t, s), o = !1;
644
+ } catch (l) {
645
+ Mt(l, d(this, Le) && d(this, Le).parent);
646
+ }
647
+ i && w(this, Me, B(this, ce, kn).call(this, () => {
648
+ ft.ensure();
649
+ try {
650
+ return xe(() => {
651
+ var l = (
652
+ /** @type {Effect} */
653
+ S
654
+ );
655
+ l.b = this, l.f |= Gn, i(
656
+ d(this, de),
657
+ () => t,
658
+ () => s
659
+ );
660
+ });
661
+ } catch (l) {
662
+ return Mt(
663
+ l,
664
+ /** @type {Effect} */
665
+ d(this, Le).parent
666
+ ), null;
667
+ }
668
+ }));
669
+ });
670
+ }
671
+ }
672
+ de = /* @__PURE__ */ new WeakMap(), fn = /* @__PURE__ */ new WeakMap(), Be = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), Me = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), We = /* @__PURE__ */ new WeakMap(), Ut = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakSet(), $o = function() {
673
+ try {
674
+ w(this, Ee, xe(() => d(this, $t).call(this, d(this, de))));
675
+ } catch (e) {
676
+ this.error(e);
677
+ }
678
+ }, xo = function() {
679
+ const e = d(this, Be).pending;
680
+ e && (this.is_pending = !0, w(this, te, xe(() => e(d(this, de)))), Xe(() => {
681
+ var t = w(this, ze, document.createDocumentFragment()), n = ke();
682
+ t.append(n), w(this, Ee, B(this, ce, kn).call(this, () => (ft.ensure(), xe(() => d(this, $t).call(this, n))))), d(this, We) === 0 && (d(this, de).before(t), w(this, ze, null), vt(
683
+ /** @type {Effect} */
684
+ d(this, te),
685
+ () => {
686
+ w(this, te, null);
687
+ }
688
+ ), this.is_pending = !1);
689
+ }));
690
+ }, Xn = function() {
691
+ try {
692
+ if (this.is_pending = this.has_pending_snippet(), w(this, We, 0), w(this, it, 0), w(this, Ee, xe(() => {
693
+ d(this, $t).call(this, d(this, de));
694
+ })), d(this, We) > 0) {
695
+ var e = w(this, ze, document.createDocumentFragment());
696
+ Wo(d(this, Ee), e);
697
+ const t = (
698
+ /** @type {(anchor: Node) => void} */
699
+ d(this, Be).pending
700
+ );
701
+ w(this, te, xe(() => t(d(this, de))));
702
+ } else
703
+ this.is_pending = !1;
704
+ } catch (t) {
705
+ this.error(t);
706
+ }
707
+ }, /**
708
+ * @template T
709
+ * @param {() => T} fn
710
+ */
711
+ kn = function(e) {
712
+ var t = S, n = T, i = Q;
713
+ Ie(d(this, Le)), re(d(this, Le)), St(d(this, Le).ctx);
714
+ try {
715
+ return e();
716
+ } catch (r) {
717
+ return ho(r), null;
718
+ } finally {
719
+ Ie(t), re(n), St(i);
720
+ }
721
+ }, /**
722
+ * Updates the pending count associated with the currently visible pending snippet,
723
+ * if any, such that we can replace the snippet with content once work is done
724
+ * @param {1 | -1} d
725
+ */
726
+ Zn = function(e) {
727
+ var t;
728
+ if (!this.has_pending_snippet()) {
729
+ this.parent && B(t = this.parent, ce, Zn).call(t, e);
730
+ return;
731
+ }
732
+ if (w(this, We, d(this, We) + e), d(this, We) === 0) {
733
+ this.is_pending = !1;
734
+ for (const n of d(this, Xt))
735
+ R(n, H), fe(n);
736
+ for (const n of d(this, Zt))
737
+ R(n, ge), fe(n);
738
+ d(this, Xt).clear(), d(this, Zt).clear(), d(this, te) && vt(d(this, te), () => {
739
+ w(this, te, null);
740
+ }), d(this, ze) && (d(this, de).before(d(this, ze)), w(this, ze, null));
741
+ }
742
+ };
743
+ function ps(e, t, n, i) {
744
+ const r = On;
745
+ var o = e.filter((p) => !p.settled);
746
+ if (n.length === 0 && o.length === 0) {
747
+ i(t.map(r));
748
+ return;
749
+ }
750
+ var s = O, l = (
751
+ /** @type {Effect} */
752
+ S
753
+ ), a = vs(), u = o.length === 1 ? o[0].promise : o.length > 1 ? Promise.all(o.map((p) => p.promise)) : null;
754
+ function f(p) {
755
+ a();
756
+ try {
757
+ i(p);
758
+ } catch (b) {
759
+ (l.f & Re) === 0 && Mt(b, l);
760
+ }
761
+ s?.deactivate(), Qn();
762
+ }
763
+ if (n.length === 0) {
764
+ u.then(() => f(t.map(r)));
765
+ return;
766
+ }
767
+ function v() {
768
+ a(), Promise.all(n.map((p) => /* @__PURE__ */ gs(p))).then((p) => f([...t.map(r), ...p])).catch((p) => Mt(p, l));
769
+ }
770
+ u ? u.then(v) : v();
771
+ }
772
+ function vs() {
773
+ var e = S, t = T, n = Q, i = O;
774
+ return function(r = !0) {
775
+ Ie(e), re(t), St(n), r && i?.activate();
776
+ };
777
+ }
778
+ function Qn() {
779
+ Ie(null), re(null), St(null);
780
+ }
781
+ // @__NO_SIDE_EFFECTS__
782
+ function On(e) {
783
+ var t = W | H, n = T !== null && (T.f & W) !== 0 ? (
784
+ /** @type {Derived} */
785
+ T
786
+ ) : null;
787
+ return S !== null && (S.f |= gt), {
788
+ ctx: Q,
789
+ deps: null,
790
+ effects: null,
791
+ equals: lo,
792
+ f: t,
793
+ fn: e,
794
+ reactions: null,
795
+ rv: 0,
796
+ v: (
797
+ /** @type {V} */
798
+ z
799
+ ),
800
+ wv: 0,
801
+ parent: n ?? S,
802
+ ac: null
803
+ };
804
+ }
805
+ // @__NO_SIDE_EFFECTS__
806
+ function gs(e, t, n) {
807
+ let i = (
808
+ /** @type {Effect | null} */
809
+ S
810
+ );
811
+ i === null && Br();
812
+ var r = (
813
+ /** @type {Boundary} */
814
+ i.b
815
+ ), o = (
816
+ /** @type {Promise<V>} */
817
+ /** @type {unknown} */
818
+ void 0
819
+ ), s = pt(
820
+ /** @type {V} */
821
+ z
822
+ ), l = !T, a = /* @__PURE__ */ new Map();
823
+ return Ss(() => {
824
+ var u = no();
825
+ o = u.promise;
826
+ try {
827
+ Promise.resolve(e()).then(u.resolve, u.reject).then(() => {
828
+ f === O && f.committed && f.deactivate(), Qn();
829
+ });
830
+ } catch (b) {
831
+ u.reject(b), Qn();
832
+ }
833
+ var f = (
834
+ /** @type {Batch} */
835
+ O
836
+ );
837
+ if (l) {
838
+ var v = r.is_rendered();
839
+ r.update_pending_count(1), f.increment(v), a.get(f)?.reject(st), a.delete(f), a.set(f, u);
840
+ }
841
+ const p = (b, h = void 0) => {
842
+ if (f.activate(), h)
843
+ h !== st && (s.f |= Ue, At(s, h));
844
+ else {
845
+ (s.f & Ue) !== 0 && (s.f ^= Ue), At(s, b);
846
+ for (const [g, m] of a) {
847
+ if (a.delete(g), g === f) break;
848
+ m.reject(st);
849
+ }
850
+ }
851
+ l && (r.update_pending_count(-1), f.decrement(v));
852
+ };
853
+ u.promise.then(p, (b) => p(null, b || "unknown"));
854
+ }), _s(() => {
855
+ for (const u of a.values())
856
+ u.reject(st);
857
+ }), new Promise((u) => {
858
+ function f(v) {
859
+ function p() {
860
+ v === o ? u(s) : f(o);
861
+ }
862
+ v.then(p, p);
863
+ }
864
+ f(o);
865
+ });
866
+ }
867
+ // @__NO_SIDE_EFFECTS__
868
+ function Ni(e) {
869
+ const t = /* @__PURE__ */ On(e);
870
+ return Ho(t), t;
871
+ }
872
+ // @__NO_SIDE_EFFECTS__
873
+ function bs(e) {
874
+ const t = /* @__PURE__ */ On(e);
875
+ return t.equals = ao, t;
876
+ }
877
+ function ms(e) {
878
+ var t = e.effects;
879
+ if (t !== null) {
880
+ e.effects = null;
881
+ for (var n = 0; n < t.length; n += 1)
882
+ F(
883
+ /** @type {Effect} */
884
+ t[n]
885
+ );
886
+ }
887
+ }
888
+ function ys(e) {
889
+ for (var t = e.parent; t !== null; ) {
890
+ if ((t.f & W) === 0)
891
+ return (t.f & Re) === 0 ? (
892
+ /** @type {Effect} */
893
+ t
894
+ ) : null;
895
+ t = t.parent;
896
+ }
897
+ return null;
898
+ }
899
+ function hi(e) {
900
+ var t, n = S;
901
+ Ie(ys(e));
902
+ try {
903
+ e.f &= ~ht, ms(e), t = Go(e);
904
+ } finally {
905
+ Ie(n);
906
+ }
907
+ return t;
908
+ }
909
+ function ko(e) {
910
+ var t = hi(e);
911
+ if (!e.equals(t) && (e.wv = Do(), (!O?.is_fork || e.deps === null) && (e.v = t, e.deps === null))) {
912
+ R(e, N);
913
+ return;
914
+ }
915
+ Ze || (ve !== null ? (vi() || O?.is_fork) && ve.set(e, t) : di(e));
916
+ }
917
+ function ws(e) {
918
+ if (e.effects !== null)
919
+ for (const t of e.effects)
920
+ (t.teardown || t.ac) && (t.teardown?.(), t.ac?.abort(st), t.teardown = to, t.ac = null, tn(t, 0), bi(t));
921
+ }
922
+ function Io(e) {
923
+ if (e.effects !== null)
924
+ for (const t of e.effects)
925
+ t.teardown && Et(t);
926
+ }
927
+ let ei = /* @__PURE__ */ new Set();
928
+ const Ke = /* @__PURE__ */ new Map();
929
+ let _o = !1;
930
+ function pt(e, t) {
931
+ var n = {
932
+ f: 0,
933
+ // TODO ideally we could skip this altogether, but it causes type errors
934
+ v: e,
935
+ reactions: null,
936
+ equals: lo,
937
+ rv: 0,
938
+ wv: 0
939
+ };
940
+ return n;
941
+ }
942
+ // @__NO_SIDE_EFFECTS__
943
+ function L(e, t) {
944
+ const n = pt(e);
945
+ return Ho(n), n;
946
+ }
947
+ // @__NO_SIDE_EFFECTS__
948
+ function To(e, t = !1, n = !0) {
949
+ const i = pt(e);
950
+ return t || (i.equals = ao), i;
951
+ }
952
+ function _(e, t, n = !1) {
953
+ T !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
954
+ // to ensure we error if state is set inside an inspect effect
955
+ (!pe || (T.f & Ri) !== 0) && uo() && (T.f & (W | je | ci | Ri)) !== 0 && (oe === null || !Ct.call(oe, e)) && ts();
956
+ let i = n ? Ve(t) : t;
957
+ return At(e, i);
958
+ }
959
+ function At(e, t) {
960
+ if (!e.equals(t)) {
961
+ var n = e.v;
962
+ Ze ? Ke.set(e, t) : Ke.set(e, n), e.v = t;
963
+ var i = ft.ensure();
964
+ if (i.capture(e, n), (e.f & W) !== 0) {
965
+ const r = (
966
+ /** @type {Derived} */
967
+ e
968
+ );
969
+ (e.f & H) !== 0 && hi(r), di(r);
970
+ }
971
+ e.wv = Do(), Co(e, H), S !== null && (S.f & N) !== 0 && (S.f & (be | Qe)) === 0 && (ee === null ? Ls([e]) : ee.push(e)), !i.is_fork && ei.size > 0 && !_o && $s();
972
+ }
973
+ return t;
974
+ }
975
+ function $s() {
976
+ _o = !1;
977
+ for (const e of ei)
978
+ (e.f & N) !== 0 && R(e, ge), on(e) && Et(e);
979
+ ei.clear();
980
+ }
981
+ function Qt(e) {
982
+ _(e, e.v + 1);
983
+ }
984
+ function Co(e, t) {
985
+ var n = e.reactions;
986
+ if (n !== null)
987
+ for (var i = n.length, r = 0; r < i; r++) {
988
+ var o = n[r], s = o.f, l = (s & H) === 0;
989
+ if (l && R(o, t), (s & W) !== 0) {
990
+ var a = (
991
+ /** @type {Derived} */
992
+ o
993
+ );
994
+ ve?.delete(a), (s & ht) === 0 && (s & ie && (o.f |= ht), Co(a, ge));
995
+ } else l && ((s & je) !== 0 && Ae !== null && Ae.add(
996
+ /** @type {Effect} */
997
+ o
998
+ ), fe(
999
+ /** @type {Effect} */
1000
+ o
1001
+ ));
1002
+ }
1003
+ }
1004
+ function Ve(e) {
1005
+ if (typeof e != "object" || e === null || cn in e)
1006
+ return e;
1007
+ const t = eo(e);
1008
+ if (t !== zr && t !== Wr)
1009
+ return e;
1010
+ var n = /* @__PURE__ */ new Map(), i = Qi(e), r = /* @__PURE__ */ L(0), o = ct, s = (l) => {
1011
+ if (ct === o)
1012
+ return l();
1013
+ var a = T, u = ct;
1014
+ re(null), Hi(o);
1015
+ var f = l();
1016
+ return re(a), Hi(u), f;
1017
+ };
1018
+ return i && n.set("length", /* @__PURE__ */ L(
1019
+ /** @type {any[]} */
1020
+ e.length
1021
+ )), new Proxy(
1022
+ /** @type {any} */
1023
+ e,
1024
+ {
1025
+ defineProperty(l, a, u) {
1026
+ (!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && Qr();
1027
+ var f = n.get(a);
1028
+ return f === void 0 ? s(() => {
1029
+ var v = /* @__PURE__ */ L(u.value);
1030
+ return n.set(a, v), v;
1031
+ }) : _(f, u.value, !0), !0;
1032
+ },
1033
+ deleteProperty(l, a) {
1034
+ var u = n.get(a);
1035
+ if (u === void 0) {
1036
+ if (a in l) {
1037
+ const f = s(() => /* @__PURE__ */ L(z));
1038
+ n.set(a, f), Qt(r);
1039
+ }
1040
+ } else
1041
+ _(u, z), Qt(r);
1042
+ return !0;
1043
+ },
1044
+ get(l, a, u) {
1045
+ if (a === cn)
1046
+ return e;
1047
+ var f = n.get(a), v = a in l;
1048
+ if (f === void 0 && (!v || kt(l, a)?.writable) && (f = s(() => {
1049
+ var b = Ve(v ? l[a] : z), h = /* @__PURE__ */ L(b);
1050
+ return h;
1051
+ }), n.set(a, f)), f !== void 0) {
1052
+ var p = c(f);
1053
+ return p === z ? void 0 : p;
1054
+ }
1055
+ return Reflect.get(l, a, u);
1056
+ },
1057
+ getOwnPropertyDescriptor(l, a) {
1058
+ var u = Reflect.getOwnPropertyDescriptor(l, a);
1059
+ if (u && "value" in u) {
1060
+ var f = n.get(a);
1061
+ f && (u.value = c(f));
1062
+ } else if (u === void 0) {
1063
+ var v = n.get(a), p = v?.v;
1064
+ if (v !== void 0 && p !== z)
1065
+ return {
1066
+ enumerable: !0,
1067
+ configurable: !0,
1068
+ value: p,
1069
+ writable: !0
1070
+ };
1071
+ }
1072
+ return u;
1073
+ },
1074
+ has(l, a) {
1075
+ if (a === cn)
1076
+ return !0;
1077
+ var u = n.get(a), f = u !== void 0 && u.v !== z || Reflect.has(l, a);
1078
+ if (u !== void 0 || S !== null && (!f || kt(l, a)?.writable)) {
1079
+ u === void 0 && (u = s(() => {
1080
+ var p = f ? Ve(l[a]) : z, b = /* @__PURE__ */ L(p);
1081
+ return b;
1082
+ }), n.set(a, u));
1083
+ var v = c(u);
1084
+ if (v === z)
1085
+ return !1;
1086
+ }
1087
+ return f;
1088
+ },
1089
+ set(l, a, u, f) {
1090
+ var v = n.get(a), p = a in l;
1091
+ if (i && a === "length")
1092
+ for (var b = u; b < /** @type {Source<number>} */
1093
+ v.v; b += 1) {
1094
+ var h = n.get(b + "");
1095
+ h !== void 0 ? _(h, z) : b in l && (h = s(() => /* @__PURE__ */ L(z)), n.set(b + "", h));
1096
+ }
1097
+ if (v === void 0)
1098
+ (!p || kt(l, a)?.writable) && (v = s(() => /* @__PURE__ */ L(void 0)), _(v, Ve(u)), n.set(a, v));
1099
+ else {
1100
+ p = v.v !== z;
1101
+ var g = s(() => Ve(u));
1102
+ _(v, g);
1103
+ }
1104
+ var m = Reflect.getOwnPropertyDescriptor(l, a);
1105
+ if (m?.set && m.set.call(f, u), !p) {
1106
+ if (i && typeof a == "string") {
1107
+ var C = (
1108
+ /** @type {Source<number>} */
1109
+ n.get("length")
1110
+ ), x = Number(a);
1111
+ Number.isInteger(x) && x >= C.v && _(C, x + 1);
1112
+ }
1113
+ Qt(r);
1114
+ }
1115
+ return !0;
1116
+ },
1117
+ ownKeys(l) {
1118
+ c(r);
1119
+ var a = Reflect.ownKeys(l).filter((v) => {
1120
+ var p = n.get(v);
1121
+ return p === void 0 || p.v !== z;
1122
+ });
1123
+ for (var [u, f] of n)
1124
+ f.v !== z && !(u in l) && a.push(u);
1125
+ return a;
1126
+ },
1127
+ setPrototypeOf() {
1128
+ es();
1129
+ }
1130
+ }
1131
+ );
1132
+ }
1133
+ var Pi, So, Mo, Ao;
1134
+ function ti() {
1135
+ if (Pi === void 0) {
1136
+ Pi = window, So = /Firefox/.test(navigator.userAgent);
1137
+ var e = Element.prototype, t = Node.prototype, n = Text.prototype;
1138
+ Mo = kt(t, "firstChild").get, Ao = kt(t, "nextSibling").get, Vi(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), Vi(n) && (n.__t = void 0);
1139
+ }
1140
+ }
1141
+ function ke(e = "") {
1142
+ return document.createTextNode(e);
1143
+ }
1144
+ // @__NO_SIDE_EFFECTS__
1145
+ function Lt(e) {
1146
+ return (
1147
+ /** @type {TemplateNode | null} */
1148
+ Mo.call(e)
1149
+ );
1150
+ }
1151
+ // @__NO_SIDE_EFFECTS__
1152
+ function _e(e) {
1153
+ return (
1154
+ /** @type {TemplateNode | null} */
1155
+ Ao.call(e)
1156
+ );
1157
+ }
1158
+ function D(e, t) {
1159
+ if (!M)
1160
+ return /* @__PURE__ */ Lt(e);
1161
+ var n = /* @__PURE__ */ Lt(A);
1162
+ if (n === null)
1163
+ n = A.appendChild(ke());
1164
+ else if (t && n.nodeType !== Cn) {
1165
+ var i = ke();
1166
+ return n?.before(i), Z(i), i;
1167
+ }
1168
+ return t && pi(
1169
+ /** @type {Text} */
1170
+ n
1171
+ ), Z(n), n;
1172
+ }
1173
+ function ot(e, t = !1) {
1174
+ if (!M) {
1175
+ var n = /* @__PURE__ */ Lt(e);
1176
+ return n instanceof Comment && n.data === "" ? /* @__PURE__ */ _e(n) : n;
1177
+ }
1178
+ if (t) {
1179
+ if (A?.nodeType !== Cn) {
1180
+ var i = ke();
1181
+ return A?.before(i), Z(i), i;
1182
+ }
1183
+ pi(
1184
+ /** @type {Text} */
1185
+ A
1186
+ );
1187
+ }
1188
+ return A;
1189
+ }
1190
+ function j(e, t = 1, n = !1) {
1191
+ let i = M ? A : e;
1192
+ for (var r; t--; )
1193
+ r = i, i = /** @type {TemplateNode} */
1194
+ /* @__PURE__ */ _e(i);
1195
+ if (!M)
1196
+ return i;
1197
+ if (n) {
1198
+ if (i?.nodeType !== Cn) {
1199
+ var o = ke();
1200
+ return i === null ? r?.after(o) : i.before(o), Z(o), o;
1201
+ }
1202
+ pi(
1203
+ /** @type {Text} */
1204
+ i
1205
+ );
1206
+ }
1207
+ return Z(i), i;
1208
+ }
1209
+ function Lo(e) {
1210
+ e.textContent = "";
1211
+ }
1212
+ function Eo() {
1213
+ return !1;
1214
+ }
1215
+ function fi(e, t, n) {
1216
+ return (
1217
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
1218
+ document.createElementNS(Zi, e, void 0)
1219
+ );
1220
+ }
1221
+ function pi(e) {
1222
+ if (
1223
+ /** @type {string} */
1224
+ e.nodeValue.length < 65536
1225
+ )
1226
+ return;
1227
+ let t = e.nextSibling;
1228
+ for (; t !== null && t.nodeType === Cn; )
1229
+ t.remove(), e.nodeValue += /** @type {string} */
1230
+ t.nodeValue, t = e.nextSibling;
1231
+ }
1232
+ let zi = !1;
1233
+ function xs() {
1234
+ zi || (zi = !0, document.addEventListener(
1235
+ "reset",
1236
+ (e) => {
1237
+ Promise.resolve().then(() => {
1238
+ if (!e.defaultPrevented)
1239
+ for (
1240
+ const t of
1241
+ /**@type {HTMLFormElement} */
1242
+ e.target.elements
1243
+ )
1244
+ t.__on_r?.();
1245
+ });
1246
+ },
1247
+ // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
1248
+ { capture: !0 }
1249
+ ));
1250
+ }
1251
+ function Oo(e) {
1252
+ var t = T, n = S;
1253
+ re(null), Ie(null);
1254
+ try {
1255
+ return e();
1256
+ } finally {
1257
+ re(t), Ie(n);
1258
+ }
1259
+ }
1260
+ function ks(e) {
1261
+ S === null && (T === null && Jr(), Kr()), Ze && Ur();
1262
+ }
1263
+ function Is(e, t) {
1264
+ var n = t.last;
1265
+ n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
1266
+ }
1267
+ function Te(e, t, n) {
1268
+ var i = S;
1269
+ i !== null && (i.f & X) !== 0 && (e |= X);
1270
+ var r = {
1271
+ ctx: Q,
1272
+ deps: null,
1273
+ nodes: null,
1274
+ f: e | H | ie,
1275
+ first: null,
1276
+ fn: t,
1277
+ last: null,
1278
+ next: null,
1279
+ parent: i,
1280
+ b: i && i.b,
1281
+ prev: null,
1282
+ teardown: null,
1283
+ wv: 0,
1284
+ ac: null
1285
+ };
1286
+ if (n)
1287
+ try {
1288
+ Et(r);
1289
+ } catch (l) {
1290
+ throw F(r), l;
1291
+ }
1292
+ else t !== null && fe(r);
1293
+ var o = r;
1294
+ if (n && o.deps === null && o.teardown === null && o.nodes === null && o.first === o.last && // either `null`, or a singular child
1295
+ (o.f & gt) === 0 && (o = o.first, (e & je) !== 0 && (e & dt) !== 0 && o !== null && (o.f |= dt)), o !== null && (o.parent = i, i !== null && Is(o, i), T !== null && (T.f & W) !== 0 && (e & Qe) === 0)) {
1296
+ var s = (
1297
+ /** @type {Derived} */
1298
+ T
1299
+ );
1300
+ (s.effects ?? (s.effects = [])).push(o);
1301
+ }
1302
+ return r;
1303
+ }
1304
+ function vi() {
1305
+ return T !== null && !pe;
1306
+ }
1307
+ function _s(e) {
1308
+ const t = Te(Tn, null, !1);
1309
+ return R(t, N), t.teardown = e, t;
1310
+ }
1311
+ function at(e) {
1312
+ ks();
1313
+ var t = (
1314
+ /** @type {Effect} */
1315
+ S.f
1316
+ ), n = !T && (t & be) !== 0 && (t & Ot) === 0;
1317
+ if (n) {
1318
+ var i = (
1319
+ /** @type {ComponentContext} */
1320
+ Q
1321
+ );
1322
+ (i.e ?? (i.e = [])).push(e);
1323
+ } else
1324
+ return Vo(e);
1325
+ }
1326
+ function Vo(e) {
1327
+ return Te(en | qr, e, !1);
1328
+ }
1329
+ function Ts(e) {
1330
+ ft.ensure();
1331
+ const t = Te(Qe | gt, e, !0);
1332
+ return () => {
1333
+ F(t);
1334
+ };
1335
+ }
1336
+ function Cs(e) {
1337
+ ft.ensure();
1338
+ const t = Te(Qe | gt, e, !0);
1339
+ return (n = {}) => new Promise((i) => {
1340
+ n.outro ? vt(t, () => {
1341
+ F(t), i(void 0);
1342
+ }) : (F(t), i(void 0));
1343
+ });
1344
+ }
1345
+ function Ro(e) {
1346
+ return Te(en, e, !1);
1347
+ }
1348
+ function Ss(e) {
1349
+ return Te(ci | gt, e, !0);
1350
+ }
1351
+ function gi(e, t = 0) {
1352
+ return Te(Tn | t, e, !0);
1353
+ }
1354
+ function rt(e, t = [], n = [], i = []) {
1355
+ ps(i, t, n, (r) => {
1356
+ Te(Tn, () => e(...r.map(c)), !0);
1357
+ });
1358
+ }
1359
+ function Vn(e, t = 0) {
1360
+ var n = Te(je | t, e, !0);
1361
+ return n;
1362
+ }
1363
+ function xe(e) {
1364
+ return Te(be | gt, e, !0);
1365
+ }
1366
+ function jo(e) {
1367
+ var t = e.teardown;
1368
+ if (t !== null) {
1369
+ const n = Ze, i = T;
1370
+ Wi(!0), re(null);
1371
+ try {
1372
+ t.call(null);
1373
+ } finally {
1374
+ Wi(n), re(i);
1375
+ }
1376
+ }
1377
+ }
1378
+ function bi(e, t = !1) {
1379
+ var n = e.first;
1380
+ for (e.first = e.last = null; n !== null; ) {
1381
+ const r = n.ac;
1382
+ r !== null && Oo(() => {
1383
+ r.abort(st);
1384
+ });
1385
+ var i = n.next;
1386
+ (n.f & Qe) !== 0 ? n.parent = null : F(n, t), n = i;
1387
+ }
1388
+ }
1389
+ function Ms(e) {
1390
+ for (var t = e.first; t !== null; ) {
1391
+ var n = t.next;
1392
+ (t.f & be) === 0 && F(t), t = n;
1393
+ }
1394
+ }
1395
+ function F(e, t = !0) {
1396
+ var n = !1;
1397
+ (t || (e.f & oo) !== 0) && e.nodes !== null && e.nodes.end !== null && (As(
1398
+ e.nodes.start,
1399
+ /** @type {TemplateNode} */
1400
+ e.nodes.end
1401
+ ), n = !0), bi(e, t && !n), tn(e, 0), R(e, Re);
1402
+ var i = e.nodes && e.nodes.t;
1403
+ if (i !== null)
1404
+ for (const o of i)
1405
+ o.stop();
1406
+ jo(e);
1407
+ var r = e.parent;
1408
+ r !== null && r.first !== null && No(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1409
+ }
1410
+ function As(e, t) {
1411
+ for (; e !== null; ) {
1412
+ var n = e === t ? null : /* @__PURE__ */ _e(e);
1413
+ e.remove(), e = n;
1414
+ }
1415
+ }
1416
+ function No(e) {
1417
+ var t = e.parent, n = e.prev, i = e.next;
1418
+ n !== null && (n.next = i), i !== null && (i.prev = n), t !== null && (t.first === e && (t.first = i), t.last === e && (t.last = n));
1419
+ }
1420
+ function vt(e, t, n = !0) {
1421
+ var i = [];
1422
+ Po(e, i, !0);
1423
+ var r = () => {
1424
+ n && F(e), t && t();
1425
+ }, o = i.length;
1426
+ if (o > 0) {
1427
+ var s = () => --o || r();
1428
+ for (var l of i)
1429
+ l.out(s);
1430
+ } else
1431
+ r();
1432
+ }
1433
+ function Po(e, t, n) {
1434
+ if ((e.f & X) === 0) {
1435
+ e.f ^= X;
1436
+ var i = e.nodes && e.nodes.t;
1437
+ if (i !== null)
1438
+ for (const l of i)
1439
+ (l.is_global || n) && t.push(l);
1440
+ for (var r = e.first; r !== null; ) {
1441
+ var o = r.next, s = (r.f & dt) !== 0 || // If this is a branch effect without a block effect parent,
1442
+ // it means the parent block effect was pruned. In that case,
1443
+ // transparency information was transferred to the branch effect.
1444
+ (r.f & be) !== 0 && (e.f & je) !== 0;
1445
+ Po(r, t, s ? n : !1), r = o;
1446
+ }
1447
+ }
1448
+ }
1449
+ function mi(e) {
1450
+ zo(e, !0);
1451
+ }
1452
+ function zo(e, t) {
1453
+ if ((e.f & X) !== 0) {
1454
+ e.f ^= X, (e.f & N) === 0 && (R(e, H), fe(e));
1455
+ for (var n = e.first; n !== null; ) {
1456
+ var i = n.next, r = (n.f & dt) !== 0 || (n.f & be) !== 0;
1457
+ zo(n, r ? t : !1), n = i;
1458
+ }
1459
+ var o = e.nodes && e.nodes.t;
1460
+ if (o !== null)
1461
+ for (const s of o)
1462
+ (s.is_global || t) && s.in();
1463
+ }
1464
+ }
1465
+ function Wo(e, t) {
1466
+ if (e.nodes)
1467
+ for (var n = e.nodes.start, i = e.nodes.end; n !== null; ) {
1468
+ var r = n === i ? null : /* @__PURE__ */ _e(n);
1469
+ t.append(n), n = r;
1470
+ }
1471
+ }
1472
+ let pn = !1, Ze = !1;
1473
+ function Wi(e) {
1474
+ Ze = e;
1475
+ }
1476
+ let T = null, pe = !1;
1477
+ function re(e) {
1478
+ T = e;
1479
+ }
1480
+ let S = null;
1481
+ function Ie(e) {
1482
+ S = e;
1483
+ }
1484
+ let oe = null;
1485
+ function Ho(e) {
1486
+ T !== null && (oe === null ? oe = [e] : oe.push(e));
1487
+ }
1488
+ let G = null, J = 0, ee = null;
1489
+ function Ls(e) {
1490
+ ee = e;
1491
+ }
1492
+ let qo = 1, ut = 0, ct = ut;
1493
+ function Hi(e) {
1494
+ ct = e;
1495
+ }
1496
+ function Do() {
1497
+ return ++qo;
1498
+ }
1499
+ function on(e) {
1500
+ var t = e.f;
1501
+ if ((t & H) !== 0)
1502
+ return !0;
1503
+ if (t & W && (e.f &= ~ht), (t & ge) !== 0) {
1504
+ for (var n = (
1505
+ /** @type {Value[]} */
1506
+ e.deps
1507
+ ), i = n.length, r = 0; r < i; r++) {
1508
+ var o = n[r];
1509
+ if (on(
1510
+ /** @type {Derived} */
1511
+ o
1512
+ ) && ko(
1513
+ /** @type {Derived} */
1514
+ o
1515
+ ), o.wv > e.wv)
1516
+ return !0;
1517
+ }
1518
+ (t & ie) !== 0 && // During time traveling we don't want to reset the status so that
1519
+ // traversal of the graph in the other batches still happens
1520
+ ve === null && R(e, N);
1521
+ }
1522
+ return !1;
1523
+ }
1524
+ function Fo(e, t, n = !0) {
1525
+ var i = e.reactions;
1526
+ if (i !== null && !(oe !== null && Ct.call(oe, e)))
1527
+ for (var r = 0; r < i.length; r++) {
1528
+ var o = i[r];
1529
+ (o.f & W) !== 0 ? Fo(
1530
+ /** @type {Derived} */
1531
+ o,
1532
+ t,
1533
+ !1
1534
+ ) : t === o && (n ? R(o, H) : (o.f & N) !== 0 && R(o, ge), fe(
1535
+ /** @type {Effect} */
1536
+ o
1537
+ ));
1538
+ }
1539
+ }
1540
+ function Go(e) {
1541
+ var t, n = G, i = J, r = ee, o = T, s = oe, l = Q, a = pe, u = ct, f = e.f;
1542
+ G = /** @type {null | Value[]} */
1543
+ null, J = 0, ee = null, T = (f & (be | Qe)) === 0 ? e : null, oe = null, St(e.ctx), pe = !1, ct = ++ut, e.ac !== null && (Oo(() => {
1544
+ e.ac.abort(st);
1545
+ }), e.ac = null);
1546
+ try {
1547
+ e.f |= Bn;
1548
+ var v = (
1549
+ /** @type {Function} */
1550
+ e.fn
1551
+ ), p = v();
1552
+ e.f |= Ot;
1553
+ var b = e.deps, h = O?.is_fork;
1554
+ if (G !== null) {
1555
+ var g;
1556
+ if (h || tn(e, J), b !== null && J > 0)
1557
+ for (b.length = J + G.length, g = 0; g < G.length; g++)
1558
+ b[J + g] = G[g];
1559
+ else
1560
+ e.deps = b = G;
1561
+ if (vi() && (e.f & ie) !== 0)
1562
+ for (g = J; g < b.length; g++)
1563
+ ((t = b[g]).reactions ?? (t.reactions = [])).push(e);
1564
+ } else !h && b !== null && J < b.length && (tn(e, J), b.length = J);
1565
+ if (uo() && ee !== null && !pe && b !== null && (e.f & (W | ge | H)) === 0)
1566
+ for (g = 0; g < /** @type {Source[]} */
1567
+ ee.length; g++)
1568
+ Fo(
1569
+ ee[g],
1570
+ /** @type {Effect} */
1571
+ e
1572
+ );
1573
+ if (o !== null && o !== e) {
1574
+ if (ut++, o.deps !== null)
1575
+ for (let m = 0; m < i; m += 1)
1576
+ o.deps[m].rv = ut;
1577
+ if (n !== null)
1578
+ for (const m of n)
1579
+ m.rv = ut;
1580
+ ee !== null && (r === null ? r = ee : r.push(.../** @type {Source[]} */
1581
+ ee));
1582
+ }
1583
+ return (e.f & Ue) !== 0 && (e.f ^= Ue), p;
1584
+ } catch (m) {
1585
+ return ho(m);
1586
+ } finally {
1587
+ e.f ^= Bn, G = n, J = i, ee = r, T = o, oe = s, St(l), pe = a, ct = u;
1588
+ }
1589
+ }
1590
+ function Es(e, t) {
1591
+ let n = t.reactions;
1592
+ if (n !== null) {
1593
+ var i = Nr.call(n, e);
1594
+ if (i !== -1) {
1595
+ var r = n.length - 1;
1596
+ r === 0 ? n = t.reactions = null : (n[i] = n[r], n.pop());
1597
+ }
1598
+ }
1599
+ if (n === null && (t.f & W) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1600
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1601
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1602
+ (G === null || !Ct.call(G, t))) {
1603
+ var o = (
1604
+ /** @type {Derived} */
1605
+ t
1606
+ );
1607
+ (o.f & ie) !== 0 && (o.f ^= ie, o.f &= ~ht), di(o), ws(o), tn(o, 0);
1608
+ }
1609
+ }
1610
+ function tn(e, t) {
1611
+ var n = e.deps;
1612
+ if (n !== null)
1613
+ for (var i = t; i < n.length; i++)
1614
+ Es(e, n[i]);
1615
+ }
1616
+ function Et(e) {
1617
+ var t = e.f;
1618
+ if ((t & Re) === 0) {
1619
+ R(e, N);
1620
+ var n = S, i = pn;
1621
+ S = e, pn = !0;
1622
+ try {
1623
+ (t & (je | io)) !== 0 ? Ms(e) : bi(e), jo(e);
1624
+ var r = Go(e);
1625
+ e.teardown = typeof r == "function" ? r : null, e.wv = qo;
1626
+ var o;
1627
+ jr && rs && (e.f & H) !== 0 && e.deps;
1628
+ } finally {
1629
+ pn = i, S = n;
1630
+ }
1631
+ }
1632
+ }
1633
+ function c(e) {
1634
+ var t = e.f, n = (t & W) !== 0;
1635
+ if (T !== null && !pe) {
1636
+ var i = S !== null && (S.f & Re) !== 0;
1637
+ if (!i && (oe === null || !Ct.call(oe, e))) {
1638
+ var r = T.deps;
1639
+ if ((T.f & Bn) !== 0)
1640
+ e.rv < ut && (e.rv = ut, G === null && r !== null && r[J] === e ? J++ : G === null ? G = [e] : G.push(e));
1641
+ else {
1642
+ (T.deps ?? (T.deps = [])).push(e);
1643
+ var o = e.reactions;
1644
+ o === null ? e.reactions = [T] : Ct.call(o, T) || o.push(T);
1645
+ }
1646
+ }
1647
+ }
1648
+ if (Ze && Ke.has(e))
1649
+ return Ke.get(e);
1650
+ if (n) {
1651
+ var s = (
1652
+ /** @type {Derived} */
1653
+ e
1654
+ );
1655
+ if (Ze) {
1656
+ var l = s.v;
1657
+ return ((s.f & N) === 0 && s.reactions !== null || Yo(s)) && (l = hi(s)), Ke.set(s, l), l;
1658
+ }
1659
+ var a = (s.f & ie) === 0 && !pe && T !== null && (pn || (T.f & ie) !== 0), u = (s.f & Ot) === 0;
1660
+ on(s) && (a && (s.f |= ie), ko(s)), a && !u && (Io(s), Bo(s));
1661
+ }
1662
+ if (ve?.has(e))
1663
+ return ve.get(e);
1664
+ if ((e.f & Ue) !== 0)
1665
+ throw e.v;
1666
+ return e.v;
1667
+ }
1668
+ function Bo(e) {
1669
+ if (e.f |= ie, e.deps !== null)
1670
+ for (const t of e.deps)
1671
+ (t.reactions ?? (t.reactions = [])).push(e), (t.f & W) !== 0 && (t.f & ie) === 0 && (Io(
1672
+ /** @type {Derived} */
1673
+ t
1674
+ ), Bo(
1675
+ /** @type {Derived} */
1676
+ t
1677
+ ));
1678
+ }
1679
+ function Yo(e) {
1680
+ if (e.v === z) return !0;
1681
+ if (e.deps === null) return !1;
1682
+ for (const t of e.deps)
1683
+ if (Ke.has(t) || (t.f & W) !== 0 && Yo(
1684
+ /** @type {Derived} */
1685
+ t
1686
+ ))
1687
+ return !0;
1688
+ return !1;
1689
+ }
1690
+ function yi(e) {
1691
+ var t = pe;
1692
+ try {
1693
+ return pe = !0, e();
1694
+ } finally {
1695
+ pe = t;
1696
+ }
1697
+ }
1698
+ const xt = /* @__PURE__ */ Symbol("events"), Uo = /* @__PURE__ */ new Set(), ni = /* @__PURE__ */ new Set();
1699
+ function we(e, t, n) {
1700
+ (t[xt] ?? (t[xt] = {}))[e] = n;
1701
+ }
1702
+ function wi(e) {
1703
+ for (var t = 0; t < e.length; t++)
1704
+ Uo.add(e[t]);
1705
+ for (var n of ni)
1706
+ n(e);
1707
+ }
1708
+ let qi = null;
1709
+ function Di(e) {
1710
+ var t = this, n = (
1711
+ /** @type {Node} */
1712
+ t.ownerDocument
1713
+ ), i = e.type, r = e.composedPath?.() || [], o = (
1714
+ /** @type {null | Element} */
1715
+ r[0] || e.target
1716
+ );
1717
+ qi = e;
1718
+ var s = 0, l = qi === e && e[xt];
1719
+ if (l) {
1720
+ var a = r.indexOf(l);
1721
+ if (a !== -1 && (t === document || t === /** @type {any} */
1722
+ window)) {
1723
+ e[xt] = t;
1724
+ return;
1725
+ }
1726
+ var u = r.indexOf(t);
1727
+ if (u === -1)
1728
+ return;
1729
+ a <= u && (s = a);
1730
+ }
1731
+ if (o = /** @type {Element} */
1732
+ r[s] || e.target, o !== t) {
1733
+ wn(e, "currentTarget", {
1734
+ configurable: !0,
1735
+ get() {
1736
+ return o || n;
1737
+ }
1738
+ });
1739
+ var f = T, v = S;
1740
+ re(null), Ie(null);
1741
+ try {
1742
+ for (var p, b = []; o !== null; ) {
1743
+ var h = o.assignedSlot || o.parentNode || /** @type {any} */
1744
+ o.host || null;
1745
+ try {
1746
+ var g = o[xt]?.[i];
1747
+ g != null && (!/** @type {any} */
1748
+ o.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1749
+ // -> the target could not have been disabled because it emits the event in the first place
1750
+ e.target === o) && g.call(o, e);
1751
+ } catch (m) {
1752
+ p ? b.push(m) : p = m;
1753
+ }
1754
+ if (e.cancelBubble || h === t || h === null)
1755
+ break;
1756
+ o = h;
1757
+ }
1758
+ if (p) {
1759
+ for (let m of b)
1760
+ queueMicrotask(() => {
1761
+ throw m;
1762
+ });
1763
+ throw p;
1764
+ }
1765
+ } finally {
1766
+ e[xt] = t, delete e.currentTarget, re(f), Ie(v);
1767
+ }
1768
+ }
1769
+ }
1770
+ const Os = (
1771
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
1772
+ globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
1773
+ /** @param {string} html */
1774
+ createHTML: (e) => e
1775
+ })
1776
+ );
1777
+ function Vs(e) {
1778
+ return (
1779
+ /** @type {string} */
1780
+ Os?.createHTML(e) ?? e
1781
+ );
1782
+ }
1783
+ function Rs(e, t = !1) {
1784
+ var n = fi("template");
1785
+ return e = e.replaceAll("<!>", "<!---->"), n.innerHTML = t ? Vs(e) : e, n.content;
1786
+ }
1787
+ function _t(e, t) {
1788
+ var n = (
1789
+ /** @type {Effect} */
1790
+ S
1791
+ );
1792
+ n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
1793
+ }
1794
+ // @__NO_SIDE_EFFECTS__
1795
+ function bt(e, t) {
1796
+ var n = (t & Vr) !== 0, i = (t & Rr) !== 0, r, o = !e.startsWith("<!>");
1797
+ return () => {
1798
+ if (M)
1799
+ return _t(A, null), A;
1800
+ r === void 0 && (r = Rs(o ? e : "<!>" + e, !0), n || (r = /** @type {TemplateNode} */
1801
+ /* @__PURE__ */ Lt(r)));
1802
+ var s = (
1803
+ /** @type {TemplateNode} */
1804
+ i || So ? document.importNode(r, !0) : r.cloneNode(!0)
1805
+ );
1806
+ if (n) {
1807
+ var l = (
1808
+ /** @type {TemplateNode} */
1809
+ /* @__PURE__ */ Lt(s)
1810
+ ), a = (
1811
+ /** @type {TemplateNode} */
1812
+ s.lastChild
1813
+ );
1814
+ _t(l, a);
1815
+ } else
1816
+ _t(s, s);
1817
+ return s;
1818
+ };
1819
+ }
1820
+ function Ko() {
1821
+ if (M)
1822
+ return _t(A, null), A;
1823
+ var e = document.createDocumentFragment(), t = document.createComment(""), n = ke();
1824
+ return e.append(t, n), _t(t, n), e;
1825
+ }
1826
+ function $e(e, t) {
1827
+ if (M) {
1828
+ var n = (
1829
+ /** @type {Effect & { nodes: EffectNodes }} */
1830
+ S
1831
+ );
1832
+ ((n.f & Ot) === 0 || n.nodes.end === null) && (n.nodes.end = A), Mn();
1833
+ return;
1834
+ }
1835
+ e !== null && e.before(
1836
+ /** @type {Node} */
1837
+ t
1838
+ );
1839
+ }
1840
+ const js = ["touchstart", "touchmove"];
1841
+ function Ns(e) {
1842
+ return js.includes(e);
1843
+ }
1844
+ function vn(e, t) {
1845
+ var n = t == null ? "" : typeof t == "object" ? t + "" : t;
1846
+ n !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = n, e.nodeValue = n + "");
1847
+ }
1848
+ function Jo(e, t) {
1849
+ return Xo(e, t);
1850
+ }
1851
+ function Ps(e, t) {
1852
+ ti(), t.intro = t.intro ?? !1;
1853
+ const n = t.target, i = M, r = A;
1854
+ try {
1855
+ for (var o = /* @__PURE__ */ Lt(n); o && (o.nodeType !== nn || /** @type {Comment} */
1856
+ o.data !== ai); )
1857
+ o = /* @__PURE__ */ _e(o);
1858
+ if (!o)
1859
+ throw Tt;
1860
+ Oe(!0), Z(
1861
+ /** @type {Comment} */
1862
+ o
1863
+ );
1864
+ const s = Xo(e, { ...t, anchor: o });
1865
+ return Oe(!1), /** @type {Exports} */
1866
+ s;
1867
+ } catch (s) {
1868
+ if (s instanceof Error && s.message.split(`
1869
+ `).some((l) => l.startsWith("https://svelte.dev/e/")))
1870
+ throw s;
1871
+ return s !== Tt && console.warn("Failed to hydrate: ", s), t.recover === !1 && Zr(), ti(), Lo(n), Oe(!1), Jo(e, t);
1872
+ } finally {
1873
+ Oe(i), Z(r);
1874
+ }
1875
+ }
1876
+ const ln = /* @__PURE__ */ new Map();
1877
+ function Xo(e, { target: t, anchor: n, props: i = {}, events: r, context: o, intro: s = !0 }) {
1878
+ ti();
1879
+ var l = void 0, a = Cs(() => {
1880
+ var u = n ?? t.appendChild(ke());
1881
+ hs(
1882
+ /** @type {TemplateNode} */
1883
+ u,
1884
+ {
1885
+ pending: () => {
1886
+ }
1887
+ },
1888
+ (p) => {
1889
+ An({});
1890
+ var b = (
1891
+ /** @type {ComponentContext} */
1892
+ Q
1893
+ );
1894
+ if (o && (b.c = o), r && (i.$$events = r), M && _t(
1895
+ /** @type {TemplateNode} */
1896
+ p,
1897
+ null
1898
+ ), l = e(p, i) || {}, M && (S.nodes.end = A, A === null || A.nodeType !== nn || /** @type {Comment} */
1899
+ A.data !== ui))
1900
+ throw Sn(), Tt;
1901
+ Ln();
1902
+ }
1903
+ );
1904
+ var f = /* @__PURE__ */ new Set(), v = (p) => {
1905
+ for (var b = 0; b < p.length; b++) {
1906
+ var h = p[b];
1907
+ if (!f.has(h)) {
1908
+ f.add(h);
1909
+ var g = Ns(h);
1910
+ for (const x of [t, document]) {
1911
+ var m = ln.get(x);
1912
+ m === void 0 && (m = /* @__PURE__ */ new Map(), ln.set(x, m));
1913
+ var C = m.get(h);
1914
+ C === void 0 ? (x.addEventListener(h, Di, { passive: g }), m.set(h, 1)) : m.set(h, C + 1);
1915
+ }
1916
+ }
1917
+ }
1918
+ };
1919
+ return v(_n(Uo)), ni.add(v), () => {
1920
+ for (var p of f)
1921
+ for (const g of [t, document]) {
1922
+ var b = (
1923
+ /** @type {Map<string, number>} */
1924
+ ln.get(g)
1925
+ ), h = (
1926
+ /** @type {number} */
1927
+ b.get(p)
1928
+ );
1929
+ --h == 0 ? (g.removeEventListener(p, Di), b.delete(p), b.size === 0 && ln.delete(g)) : b.set(p, h);
1930
+ }
1931
+ ni.delete(v), u !== n && u.parentNode?.removeChild(u);
1932
+ };
1933
+ });
1934
+ return ii.set(l, a), l;
1935
+ }
1936
+ let ii = /* @__PURE__ */ new WeakMap();
1937
+ function zs(e, t) {
1938
+ const n = ii.get(e);
1939
+ return n ? (ii.delete(e), n(t)) : Promise.resolve();
1940
+ }
1941
+ var me, qe, ye, wt, gn, oi, Zo;
1942
+ class Qo {
1943
+ /**
1944
+ * @param {TemplateNode} anchor
1945
+ * @param {boolean} transition
1946
+ */
1947
+ constructor(t, n = !0) {
1948
+ $(this, "anchor"), I(this, me, /* @__PURE__ */ new Map()), I(this, qe, /* @__PURE__ */ new Map()), I(this, ye, /* @__PURE__ */ new Map()), I(this, wt, /* @__PURE__ */ new Set()), I(this, gn, !0), I(this, oi, () => {
1949
+ var i = (
1950
+ /** @type {Batch} */
1951
+ O
1952
+ );
1953
+ if (d(this, me).has(i)) {
1954
+ var r = (
1955
+ /** @type {Key} */
1956
+ d(this, me).get(i)
1957
+ ), o = d(this, qe).get(r);
1958
+ if (o)
1959
+ mi(o), d(this, wt).delete(r);
1960
+ else {
1961
+ var s = d(this, ye).get(r);
1962
+ s && (d(this, qe).set(r, s.effect), d(this, ye).delete(r), s.fragment.lastChild.remove(), this.anchor.before(s.fragment), o = s.effect);
1963
+ }
1964
+ for (const [l, a] of d(this, me)) {
1965
+ if (d(this, me).delete(l), l === i)
1966
+ break;
1967
+ const u = d(this, ye).get(a);
1968
+ u && (F(u.effect), d(this, ye).delete(a));
1969
+ }
1970
+ for (const [l, a] of d(this, qe)) {
1971
+ if (l === r || d(this, wt).has(l)) continue;
1972
+ const u = () => {
1973
+ if (Array.from(d(this, me).values()).includes(l)) {
1974
+ var f = document.createDocumentFragment();
1975
+ Wo(a, f), f.append(ke()), d(this, ye).set(l, { effect: a, fragment: f });
1976
+ } else
1977
+ F(a);
1978
+ d(this, wt).delete(l), d(this, qe).delete(l);
1979
+ };
1980
+ d(this, gn) || !o ? (d(this, wt).add(l), vt(a, u, !1)) : u();
1981
+ }
1982
+ }
1983
+ }), I(this, Zo, (i) => {
1984
+ d(this, me).delete(i);
1985
+ const r = Array.from(d(this, me).values());
1986
+ for (const [o, s] of d(this, ye))
1987
+ r.includes(o) || (F(s.effect), d(this, ye).delete(o));
1988
+ }), this.anchor = t, w(this, gn, n);
1989
+ }
1990
+ /**
1991
+ *
1992
+ * @param {any} key
1993
+ * @param {null | ((target: TemplateNode) => void)} fn
1994
+ */
1995
+ ensure(t, n) {
1996
+ var i = (
1997
+ /** @type {Batch} */
1998
+ O
1999
+ ), r = Eo();
2000
+ n && !d(this, qe).has(t) && !d(this, ye).has(t) && d(this, qe).set(
2001
+ t,
2002
+ xe(() => n(this.anchor))
2003
+ ), d(this, me).set(i, t), r || (M && (this.anchor = A), d(this, oi).call(this));
2004
+ }
2005
+ }
2006
+ me = /* @__PURE__ */ new WeakMap(), qe = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), gn = /* @__PURE__ */ new WeakMap(), oi = /* @__PURE__ */ new WeakMap(), Zo = /* @__PURE__ */ new WeakMap();
2007
+ function Ws(e, t, ...n) {
2008
+ var i = new Qo(e);
2009
+ Vn(() => {
2010
+ const r = t() ?? null;
2011
+ i.ensure(r, r && ((o) => r(o, ...n)));
2012
+ }, dt);
2013
+ }
2014
+ function er(e) {
2015
+ Q === null && Gr(), at(() => {
2016
+ const t = yi(e);
2017
+ if (typeof t == "function") return (
2018
+ /** @type {() => void} */
2019
+ t
2020
+ );
2021
+ });
2022
+ }
2023
+ function bn(e, t, n = !1) {
2024
+ M && Mn();
2025
+ var i = new Qo(e), r = n ? dt : 0;
2026
+ function o(s, l) {
2027
+ if (M) {
2028
+ const f = so(e);
2029
+ var a;
2030
+ if (f === ai ? a = 0 : f === In ? a = !1 : a = parseInt(f.substring(1)), s !== a) {
2031
+ var u = $n();
2032
+ Z(u), i.anchor = u, Oe(!1), i.ensure(s, l), Oe(!0);
2033
+ return;
2034
+ }
2035
+ }
2036
+ i.ensure(s, l);
2037
+ }
2038
+ Vn(() => {
2039
+ var s = !1;
2040
+ t((l, a = 0) => {
2041
+ s = !0, o(a, l);
2042
+ }), s || o(!1, null);
2043
+ }, r);
2044
+ }
2045
+ function Hs(e, t) {
2046
+ return t;
2047
+ }
2048
+ function qs(e, t, n) {
2049
+ for (var i = [], r = t.length, o, s = t.length, l = 0; l < r; l++) {
2050
+ let v = t[l];
2051
+ vt(
2052
+ v,
2053
+ () => {
2054
+ if (o) {
2055
+ if (o.pending.delete(v), o.done.add(v), o.pending.size === 0) {
2056
+ var p = (
2057
+ /** @type {Set<EachOutroGroup>} */
2058
+ e.outrogroups
2059
+ );
2060
+ ri(_n(o.done)), p.delete(o), p.size === 0 && (e.outrogroups = null);
2061
+ }
2062
+ } else
2063
+ s -= 1;
2064
+ },
2065
+ !1
2066
+ );
2067
+ }
2068
+ if (s === 0) {
2069
+ var a = i.length === 0 && n !== null;
2070
+ if (a) {
2071
+ var u = (
2072
+ /** @type {Element} */
2073
+ n
2074
+ ), f = (
2075
+ /** @type {Element} */
2076
+ u.parentNode
2077
+ );
2078
+ Lo(f), f.append(u), e.items.clear();
2079
+ }
2080
+ ri(t, !a);
2081
+ } else
2082
+ o = {
2083
+ pending: new Set(t),
2084
+ done: /* @__PURE__ */ new Set()
2085
+ }, (e.outrogroups ?? (e.outrogroups = /* @__PURE__ */ new Set())).add(o);
2086
+ }
2087
+ function ri(e, t = !0) {
2088
+ for (var n = 0; n < e.length; n++)
2089
+ F(e[n], t);
2090
+ }
2091
+ var an;
2092
+ function Ds(e, t, n, i, r, o = null) {
2093
+ var s = e, l = /* @__PURE__ */ new Map();
2094
+ M && Mn();
2095
+ var a = null, u = /* @__PURE__ */ bs(() => {
2096
+ var g = n();
2097
+ return Qi(g) ? g : g == null ? [] : _n(g);
2098
+ }), f, v = !0;
2099
+ function p() {
2100
+ h.fallback = a, Fs(h, f, s, t, i), a !== null && (f.length === 0 ? (a.f & Ye) === 0 ? mi(a) : (a.f ^= Ye, Kt(a, null, s)) : vt(a, () => {
2101
+ a = null;
2102
+ }));
2103
+ }
2104
+ var b = Vn(() => {
2105
+ f = /** @type {V[]} */
2106
+ c(u);
2107
+ var g = f.length;
2108
+ let m = !1;
2109
+ if (M) {
2110
+ var C = so(s) === In;
2111
+ C !== (g === 0) && (s = $n(), Z(s), Oe(!1), m = !0);
2112
+ }
2113
+ for (var x = /* @__PURE__ */ new Set(), P = (
2114
+ /** @type {Batch} */
2115
+ O
2116
+ ), le = Eo(), V = 0; V < g; V += 1) {
2117
+ M && A.nodeType === nn && /** @type {Comment} */
2118
+ A.data === ui && (s = /** @type {Comment} */
2119
+ A, m = !0, Oe(!1));
2120
+ var U = f[V], ae = i(U, V), k = v ? null : l.get(ae);
2121
+ k ? (k.v && At(k.v, U), k.i && At(k.i, V), le && P.unskip_effect(k.e)) : (k = Gs(
2122
+ l,
2123
+ v ? s : an ?? (an = ke()),
2124
+ U,
2125
+ ae,
2126
+ V,
2127
+ r,
2128
+ t,
2129
+ n
2130
+ ), v || (k.e.f |= Ye), l.set(ae, k)), x.add(ae);
2131
+ }
2132
+ if (g === 0 && o && !a && (v ? a = xe(() => o(s)) : (a = xe(() => o(an ?? (an = ke()))), a.f |= Ye)), g > x.size && Yr(), M && g > 0 && Z($n()), !v)
2133
+ if (le) {
2134
+ for (const [Nn, rn] of l)
2135
+ x.has(Nn) || P.skip_effect(rn.e);
2136
+ P.oncommit(p), P.ondiscard(() => {
2137
+ });
2138
+ } else
2139
+ p();
2140
+ m && Oe(!0), c(u);
2141
+ }), h = { effect: b, items: l, outrogroups: null, fallback: a };
2142
+ v = !1, M && (s = A);
2143
+ }
2144
+ function Dt(e) {
2145
+ for (; e !== null && (e.f & be) === 0; )
2146
+ e = e.next;
2147
+ return e;
2148
+ }
2149
+ function Fs(e, t, n, i, r) {
2150
+ var o = t.length, s = e.items, l = Dt(e.effect.first), a, u = null, f = [], v = [], p, b, h, g;
2151
+ for (g = 0; g < o; g += 1) {
2152
+ if (p = t[g], b = r(p, g), h = /** @type {EachItem} */
2153
+ s.get(b).e, e.outrogroups !== null)
2154
+ for (const k of e.outrogroups)
2155
+ k.pending.delete(h), k.done.delete(h);
2156
+ if ((h.f & Ye) !== 0)
2157
+ if (h.f ^= Ye, h === l)
2158
+ Kt(h, null, n);
2159
+ else {
2160
+ var m = u ? u.next : l;
2161
+ h === e.effect.last && (e.effect.last = h.prev), h.prev && (h.prev.next = h.next), h.next && (h.next.prev = h.prev), Ne(e, u, h), Ne(e, h, m), Kt(h, m, n), u = h, f = [], v = [], l = Dt(u.next);
2162
+ continue;
2163
+ }
2164
+ if ((h.f & X) !== 0 && mi(h), h !== l) {
2165
+ if (a !== void 0 && a.has(h)) {
2166
+ if (f.length < v.length) {
2167
+ var C = v[0], x;
2168
+ u = C.prev;
2169
+ var P = f[0], le = f[f.length - 1];
2170
+ for (x = 0; x < f.length; x += 1)
2171
+ Kt(f[x], C, n);
2172
+ for (x = 0; x < v.length; x += 1)
2173
+ a.delete(v[x]);
2174
+ Ne(e, P.prev, le.next), Ne(e, u, P), Ne(e, le, C), l = C, u = le, g -= 1, f = [], v = [];
2175
+ } else
2176
+ a.delete(h), Kt(h, l, n), Ne(e, h.prev, h.next), Ne(e, h, u === null ? e.effect.first : u.next), Ne(e, u, h), u = h;
2177
+ continue;
2178
+ }
2179
+ for (f = [], v = []; l !== null && l !== h; )
2180
+ (a ?? (a = /* @__PURE__ */ new Set())).add(l), v.push(l), l = Dt(l.next);
2181
+ if (l === null)
2182
+ continue;
2183
+ }
2184
+ (h.f & Ye) === 0 && f.push(h), u = h, l = Dt(h.next);
2185
+ }
2186
+ if (e.outrogroups !== null) {
2187
+ for (const k of e.outrogroups)
2188
+ k.pending.size === 0 && (ri(_n(k.done)), e.outrogroups?.delete(k));
2189
+ e.outrogroups.size === 0 && (e.outrogroups = null);
2190
+ }
2191
+ if (l !== null || a !== void 0) {
2192
+ var V = [];
2193
+ if (a !== void 0)
2194
+ for (h of a)
2195
+ (h.f & X) === 0 && V.push(h);
2196
+ for (; l !== null; )
2197
+ (l.f & X) === 0 && l !== e.fallback && V.push(l), l = Dt(l.next);
2198
+ var U = V.length;
2199
+ if (U > 0) {
2200
+ var ae = null;
2201
+ qs(e, V, ae);
2202
+ }
2203
+ }
2204
+ }
2205
+ function Gs(e, t, n, i, r, o, s, l) {
2206
+ var a = (s & Lr) !== 0 ? (s & Or) === 0 ? /* @__PURE__ */ To(n, !1, !1) : pt(n) : null, u = (s & Er) !== 0 ? pt(r) : null;
2207
+ return {
2208
+ v: a,
2209
+ i: u,
2210
+ e: xe(() => (o(t, a ?? n, u ?? r, l), () => {
2211
+ e.delete(i);
2212
+ }))
2213
+ };
2214
+ }
2215
+ function Kt(e, t, n) {
2216
+ if (e.nodes)
2217
+ for (var i = e.nodes.start, r = e.nodes.end, o = t && (t.f & Ye) === 0 ? (
2218
+ /** @type {EffectNodes} */
2219
+ t.nodes.start
2220
+ ) : n; i !== null; ) {
2221
+ var s = (
2222
+ /** @type {TemplateNode} */
2223
+ /* @__PURE__ */ _e(i)
2224
+ );
2225
+ if (o.before(i), i === r)
2226
+ return;
2227
+ i = s;
2228
+ }
2229
+ }
2230
+ function Ne(e, t, n) {
2231
+ t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
2232
+ }
2233
+ function tr(e, t) {
2234
+ Ro(() => {
2235
+ var n = e.getRootNode(), i = (
2236
+ /** @type {ShadowRoot} */
2237
+ n.host ? (
2238
+ /** @type {ShadowRoot} */
2239
+ n
2240
+ ) : (
2241
+ /** @type {Document} */
2242
+ n.head ?? /** @type {Document} */
2243
+ n.ownerDocument.head
2244
+ )
2245
+ );
2246
+ if (!i.querySelector("#" + t.hash)) {
2247
+ const r = fi("style");
2248
+ r.id = t.hash, r.textContent = t.code, i.appendChild(r);
2249
+ }
2250
+ });
2251
+ }
2252
+ const Fi = [...`
2253
+ \r\f \v\uFEFF`];
2254
+ function Bs(e, t, n) {
2255
+ var i = "" + e;
2256
+ if (n) {
2257
+ for (var r in n)
2258
+ if (n[r])
2259
+ i = i ? i + " " + r : r;
2260
+ else if (i.length)
2261
+ for (var o = r.length, s = 0; (s = i.indexOf(r, s)) >= 0; ) {
2262
+ var l = s + o;
2263
+ (s === 0 || Fi.includes(i[s - 1])) && (l === i.length || Fi.includes(i[l])) ? i = (s === 0 ? "" : i.substring(0, s)) + i.substring(l + 1) : s = l;
2264
+ }
2265
+ }
2266
+ return i === "" ? null : i;
2267
+ }
2268
+ function Ys(e, t) {
2269
+ return e == null ? null : String(e);
2270
+ }
2271
+ function Us(e, t, n, i, r, o) {
2272
+ var s = e.__className;
2273
+ if (M || s !== n || s === void 0) {
2274
+ var l = Bs(n, i, o);
2275
+ (!M || l !== e.getAttribute("class")) && (l == null ? e.removeAttribute("class") : e.className = l), e.__className = n;
2276
+ } else if (o && r !== o)
2277
+ for (var a in o) {
2278
+ var u = !!o[a];
2279
+ (r == null || u !== !!r[a]) && e.classList.toggle(a, u);
2280
+ }
2281
+ return o;
2282
+ }
2283
+ function De(e, t, n, i) {
2284
+ var r = e.__style;
2285
+ if (M || r !== t) {
2286
+ var o = Ys(t);
2287
+ (!M || o !== e.getAttribute("style")) && (o == null ? e.removeAttribute("style") : e.style.cssText = o), e.__style = t;
2288
+ }
2289
+ return i;
2290
+ }
2291
+ const Ks = /* @__PURE__ */ Symbol("is custom element"), Js = /* @__PURE__ */ Symbol("is html"), Xs = ro ? "link" : "LINK", Zs = ro ? "progress" : "PROGRESS";
2292
+ function un(e) {
2293
+ if (M) {
2294
+ var t = !1, n = () => {
2295
+ if (!t) {
2296
+ if (t = !0, e.hasAttribute("value")) {
2297
+ var i = e.value;
2298
+ Je(e, "value", null), e.value = i;
2299
+ }
2300
+ if (e.hasAttribute("checked")) {
2301
+ var r = e.checked;
2302
+ Je(e, "checked", null), e.checked = r;
2303
+ }
2304
+ }
2305
+ };
2306
+ e.__on_r = n, Xe(n), xs();
2307
+ }
2308
+ }
2309
+ function Gi(e, t) {
2310
+ var n = $i(e);
2311
+ n.value === (n.value = // treat null and undefined the same for the initial value
2312
+ t ?? void 0) || // @ts-expect-error
2313
+ // `progress` elements always need their value set when it's `0`
2314
+ e.value === t && (t !== 0 || e.nodeName !== Zs) || (e.value = t ?? "");
2315
+ }
2316
+ function Fn(e, t) {
2317
+ var n = $i(e);
2318
+ n.checked !== (n.checked = // treat null and undefined the same for the initial value
2319
+ t ?? void 0) && (e.checked = t);
2320
+ }
2321
+ function Je(e, t, n, i) {
2322
+ var r = $i(e);
2323
+ M && (r[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === Xs) || r[t] !== (r[t] = n) && (t === "loading" && (e[Fr] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && Qs(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
2324
+ }
2325
+ function $i(e) {
2326
+ return (
2327
+ /** @type {Record<string | symbol, unknown>} **/
2328
+ // @ts-expect-error
2329
+ e.__attributes ?? (e.__attributes = {
2330
+ [Ks]: e.nodeName.includes("-"),
2331
+ [Js]: e.namespaceURI === Zi
2332
+ })
2333
+ );
2334
+ }
2335
+ var Bi = /* @__PURE__ */ new Map();
2336
+ function Qs(e) {
2337
+ var t = e.getAttribute("is") || e.nodeName, n = Bi.get(t);
2338
+ if (n) return n;
2339
+ Bi.set(t, n = []);
2340
+ for (var i, r = e, o = Element.prototype; o !== r; ) {
2341
+ i = Pr(r);
2342
+ for (var s in i)
2343
+ i[s].set && n.push(s);
2344
+ r = eo(r);
2345
+ }
2346
+ return n;
2347
+ }
2348
+ function Yi(e, t) {
2349
+ return e === t || e?.[cn] === t;
2350
+ }
2351
+ function xi(e = {}, t, n, i) {
2352
+ return Ro(() => {
2353
+ var r, o;
2354
+ return gi(() => {
2355
+ r = o, o = [], yi(() => {
2356
+ e !== n(...o) && (t(e, ...o), r && Yi(n(...r), e) && t(null, ...r));
2357
+ });
2358
+ }), () => {
2359
+ Xe(() => {
2360
+ o && Yi(n(...o), e) && t(null, ...o);
2361
+ });
2362
+ };
2363
+ }), e;
2364
+ }
2365
+ function he(e, t, n, i) {
2366
+ var r = (
2367
+ /** @type {V} */
2368
+ i
2369
+ ), o = !0, s = () => (o && (o = !1, r = /** @type {V} */
2370
+ i), r), l;
2371
+ l = /** @type {V} */
2372
+ e[t], l === void 0 && i !== void 0 && (l = s());
2373
+ var a;
2374
+ a = () => {
2375
+ var p = (
2376
+ /** @type {V} */
2377
+ e[t]
2378
+ );
2379
+ return p === void 0 ? s() : (o = !0, p);
2380
+ };
2381
+ var u = !1, f = /* @__PURE__ */ On(() => (u = !1, a())), v = (
2382
+ /** @type {Effect} */
2383
+ S
2384
+ );
2385
+ return (
2386
+ /** @type {() => V} */
2387
+ (function(p, b) {
2388
+ if (arguments.length > 0) {
2389
+ const h = b ? c(f) : p;
2390
+ return _(f, h), u = !0, r !== void 0 && (r = h), p;
2391
+ }
2392
+ return Ze && u || (v.f & Re) !== 0 ? f.v : c(f);
2393
+ })
2394
+ );
2395
+ }
2396
+ function el(e) {
2397
+ return new tl(e);
2398
+ }
2399
+ var Fe, ue;
2400
+ class tl {
2401
+ /**
2402
+ * @param {ComponentConstructorOptions & {
2403
+ * component: any;
2404
+ * }} options
2405
+ */
2406
+ constructor(t) {
2407
+ I(this, Fe), I(this, ue);
2408
+ var n = /* @__PURE__ */ new Map(), i = (o, s) => {
2409
+ var l = /* @__PURE__ */ To(s, !1, !1);
2410
+ return n.set(o, l), l;
2411
+ };
2412
+ const r = new Proxy(
2413
+ { ...t.props || {}, $$events: {} },
2414
+ {
2415
+ get(o, s) {
2416
+ return c(n.get(s) ?? i(s, Reflect.get(o, s)));
2417
+ },
2418
+ has(o, s) {
2419
+ return s === Dr ? !0 : (c(n.get(s) ?? i(s, Reflect.get(o, s))), Reflect.has(o, s));
2420
+ },
2421
+ set(o, s, l) {
2422
+ return _(n.get(s) ?? i(s, l), l), Reflect.set(o, s, l);
2423
+ }
2424
+ }
2425
+ );
2426
+ w(this, ue, (t.hydrate ? Ps : Jo)(t.component, {
2427
+ target: t.target,
2428
+ anchor: t.anchor,
2429
+ props: r,
2430
+ context: t.context,
2431
+ intro: t.intro ?? !1,
2432
+ recover: t.recover
2433
+ })), (!t?.props?.$$host || t.sync === !1) && ne(), w(this, Fe, r.$$events);
2434
+ for (const o of Object.keys(d(this, ue)))
2435
+ o === "$set" || o === "$destroy" || o === "$on" || wn(this, o, {
2436
+ get() {
2437
+ return d(this, ue)[o];
2438
+ },
2439
+ /** @param {any} value */
2440
+ set(s) {
2441
+ d(this, ue)[o] = s;
2442
+ },
2443
+ enumerable: !0
2444
+ });
2445
+ d(this, ue).$set = /** @param {Record<string, any>} next */
2446
+ (o) => {
2447
+ Object.assign(r, o);
2448
+ }, d(this, ue).$destroy = () => {
2449
+ zs(d(this, ue));
2450
+ };
2451
+ }
2452
+ /** @param {Record<string, any>} props */
2453
+ $set(t) {
2454
+ d(this, ue).$set(t);
2455
+ }
2456
+ /**
2457
+ * @param {string} event
2458
+ * @param {(...args: any[]) => any} callback
2459
+ * @returns {any}
2460
+ */
2461
+ $on(t, n) {
2462
+ d(this, Fe)[t] = d(this, Fe)[t] || [];
2463
+ const i = (...r) => n.call(this, ...r);
2464
+ return d(this, Fe)[t].push(i), () => {
2465
+ d(this, Fe)[t] = d(this, Fe)[t].filter(
2466
+ /** @param {any} fn */
2467
+ (r) => r !== i
2468
+ );
2469
+ };
2470
+ }
2471
+ $destroy() {
2472
+ d(this, ue).$destroy();
2473
+ }
2474
+ }
2475
+ Fe = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakMap();
2476
+ let nr;
2477
+ typeof HTMLElement == "function" && (nr = class extends HTMLElement {
2478
+ /**
2479
+ * @param {*} $$componentCtor
2480
+ * @param {*} $$slots
2481
+ * @param {ShadowRootInit | undefined} shadow_root_init
2482
+ */
2483
+ constructor(e, t, n) {
2484
+ super(), $(this, "$$ctor"), $(this, "$$s"), $(this, "$$c"), $(this, "$$cn", !1), $(this, "$$d", {}), $(this, "$$r", !1), $(this, "$$p_d", {}), $(this, "$$l", {}), $(this, "$$l_u", /* @__PURE__ */ new Map()), $(this, "$$me"), $(this, "$$shadowRoot", null), this.$$ctor = e, this.$$s = t, n && (this.$$shadowRoot = this.attachShadow(n));
2485
+ }
2486
+ /**
2487
+ * @param {string} type
2488
+ * @param {EventListenerOrEventListenerObject} listener
2489
+ * @param {boolean | AddEventListenerOptions} [options]
2490
+ */
2491
+ addEventListener(e, t, n) {
2492
+ if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
2493
+ const i = this.$$c.$on(e, t);
2494
+ this.$$l_u.set(t, i);
2495
+ }
2496
+ super.addEventListener(e, t, n);
2497
+ }
2498
+ /**
2499
+ * @param {string} type
2500
+ * @param {EventListenerOrEventListenerObject} listener
2501
+ * @param {boolean | AddEventListenerOptions} [options]
2502
+ */
2503
+ removeEventListener(e, t, n) {
2504
+ if (super.removeEventListener(e, t, n), this.$$c) {
2505
+ const i = this.$$l_u.get(t);
2506
+ i && (i(), this.$$l_u.delete(t));
2507
+ }
2508
+ }
2509
+ async connectedCallback() {
2510
+ if (this.$$cn = !0, !this.$$c) {
2511
+ let e = function(i) {
2512
+ return (r) => {
2513
+ const o = fi("slot");
2514
+ i !== "default" && (o.name = i), $e(r, o);
2515
+ };
2516
+ };
2517
+ if (await Promise.resolve(), !this.$$cn || this.$$c)
2518
+ return;
2519
+ const t = {}, n = nl(this);
2520
+ for (const i of this.$$s)
2521
+ i in n && (i === "default" && !this.$$d.children ? (this.$$d.children = e(i), t.default = !0) : t[i] = e(i));
2522
+ for (const i of this.attributes) {
2523
+ const r = this.$$g_p(i.name);
2524
+ r in this.$$d || (this.$$d[r] = mn(r, i.value, this.$$p_d, "toProp"));
2525
+ }
2526
+ for (const i in this.$$p_d)
2527
+ !(i in this.$$d) && this[i] !== void 0 && (this.$$d[i] = this[i], delete this[i]);
2528
+ this.$$c = el({
2529
+ component: this.$$ctor,
2530
+ target: this.$$shadowRoot || this,
2531
+ props: {
2532
+ ...this.$$d,
2533
+ $$slots: t,
2534
+ $$host: this
2535
+ }
2536
+ }), this.$$me = Ts(() => {
2537
+ gi(() => {
2538
+ this.$$r = !0;
2539
+ for (const i of yn(this.$$c)) {
2540
+ if (!this.$$p_d[i]?.reflect) continue;
2541
+ this.$$d[i] = this.$$c[i];
2542
+ const r = mn(
2543
+ i,
2544
+ this.$$d[i],
2545
+ this.$$p_d,
2546
+ "toAttribute"
2547
+ );
2548
+ r == null ? this.removeAttribute(this.$$p_d[i].attribute || i) : this.setAttribute(this.$$p_d[i].attribute || i, r);
2549
+ }
2550
+ this.$$r = !1;
2551
+ });
2552
+ });
2553
+ for (const i in this.$$l)
2554
+ for (const r of this.$$l[i]) {
2555
+ const o = this.$$c.$on(i, r);
2556
+ this.$$l_u.set(r, o);
2557
+ }
2558
+ this.$$l = {};
2559
+ }
2560
+ }
2561
+ // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
2562
+ // and setting attributes through setAttribute etc, this is helpful
2563
+ /**
2564
+ * @param {string} attr
2565
+ * @param {string} _oldValue
2566
+ * @param {string} newValue
2567
+ */
2568
+ attributeChangedCallback(e, t, n) {
2569
+ this.$$r || (e = this.$$g_p(e), this.$$d[e] = mn(e, n, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
2570
+ }
2571
+ disconnectedCallback() {
2572
+ this.$$cn = !1, Promise.resolve().then(() => {
2573
+ !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
2574
+ });
2575
+ }
2576
+ /**
2577
+ * @param {string} attribute_name
2578
+ */
2579
+ $$g_p(e) {
2580
+ return yn(this.$$p_d).find(
2581
+ (t) => this.$$p_d[t].attribute === e || !this.$$p_d[t].attribute && t.toLowerCase() === e
2582
+ ) || e;
2583
+ }
2584
+ });
2585
+ function mn(e, t, n, i) {
2586
+ const r = n[e]?.type;
2587
+ if (t = r === "Boolean" && typeof t != "boolean" ? t != null : t, !i || !n[e])
2588
+ return t;
2589
+ if (i === "toAttribute")
2590
+ switch (r) {
2591
+ case "Object":
2592
+ case "Array":
2593
+ return t == null ? null : JSON.stringify(t);
2594
+ case "Boolean":
2595
+ return t ? "" : null;
2596
+ case "Number":
2597
+ return t ?? null;
2598
+ default:
2599
+ return t;
2600
+ }
2601
+ else
2602
+ switch (r) {
2603
+ case "Object":
2604
+ case "Array":
2605
+ return t && JSON.parse(t);
2606
+ case "Boolean":
2607
+ return t;
2608
+ // conversion already handled above
2609
+ case "Number":
2610
+ return t != null ? +t : t;
2611
+ default:
2612
+ return t;
2613
+ }
2614
+ }
2615
+ function nl(e) {
2616
+ const t = {};
2617
+ return e.childNodes.forEach((n) => {
2618
+ t[
2619
+ /** @type {Element} node */
2620
+ n.slot || "default"
2621
+ ] = !0;
2622
+ }), t;
2623
+ }
2624
+ function ki(e, t, n, i, r, o) {
2625
+ let s = class extends nr {
2626
+ constructor() {
2627
+ super(e, n, r), this.$$p_d = t;
2628
+ }
2629
+ static get observedAttributes() {
2630
+ return yn(t).map(
2631
+ (l) => (t[l].attribute || l).toLowerCase()
2632
+ );
2633
+ }
2634
+ };
2635
+ return yn(t).forEach((l) => {
2636
+ wn(s.prototype, l, {
2637
+ get() {
2638
+ return this.$$c && l in this.$$c ? this.$$c[l] : this.$$d[l];
2639
+ },
2640
+ set(a) {
2641
+ a = mn(l, a, t), this.$$d[l] = a;
2642
+ var u = this.$$c;
2643
+ if (u) {
2644
+ var f = kt(u, l)?.get;
2645
+ f ? u[l] = a : u.$set({ [l]: a });
2646
+ }
2647
+ }
2648
+ });
2649
+ }), i.forEach((l) => {
2650
+ wn(s.prototype, l, {
2651
+ get() {
2652
+ return this.$$c?.[l];
2653
+ }
2654
+ });
2655
+ }), e.element = /** @type {any} */
2656
+ s, s;
2657
+ }
2658
+ class il extends Event {
2659
+ constructor(t, n, i, r) {
2660
+ super("context-request", { bubbles: !0, composed: !0 }), $(this, "context"), $(this, "contextTarget"), $(this, "callback"), $(this, "subscribe"), this.context = t, this.contextTarget = n, this.callback = i, this.subscribe = r ?? !1;
2661
+ }
2662
+ }
2663
+ class ol {
2664
+ constructor(t, n) {
2665
+ $(this, "host"), $(this, "context"), $(this, "subscribe"), $(this, "onValue"), $(this, "isConnected", !1), $(this, "unsubscribe"), $(this, "currentValue"), $(this, "handleValue", (i, r) => {
2666
+ r !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = r), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = i, this.onValue?.(i);
2667
+ }), this.host = t, this.context = n.context, this.subscribe = n.subscribe ?? !0, this.onValue = n.onValue;
2668
+ }
2669
+ connect() {
2670
+ this.isConnected || (this.isConnected = !0, this.requestValue());
2671
+ }
2672
+ disconnect() {
2673
+ this.isConnected && (this.isConnected = !1, this.unsubscribe?.(), this.unsubscribe = void 0);
2674
+ }
2675
+ get value() {
2676
+ return this.currentValue;
2677
+ }
2678
+ requestValue() {
2679
+ this.host.dispatchEvent(new il(this.context, this.host, this.handleValue, this.subscribe));
2680
+ }
2681
+ }
2682
+ const rl = (e) => e, sl = rl(/* @__PURE__ */ Symbol.for("pie.assessmentToolkit.runtimeContext"));
2683
+ function ll(e, t, n) {
2684
+ let i = !1;
2685
+ const r = new ol(e, {
2686
+ context: t,
2687
+ subscribe: !0,
2688
+ onValue: (u) => {
2689
+ i = !0, n(u);
2690
+ }
2691
+ });
2692
+ r.connect();
2693
+ const o = (u) => {
2694
+ u.context === t && r.requestValue();
2695
+ };
2696
+ e.addEventListener("context-provider", o);
2697
+ let s = 0;
2698
+ const l = 200, a = globalThis.setInterval(() => {
2699
+ if (i || s >= l) {
2700
+ globalThis.clearInterval(a);
2701
+ return;
2702
+ }
2703
+ s += 1, r.requestValue();
2704
+ }, 50);
2705
+ return () => {
2706
+ globalThis.clearInterval(a), e.removeEventListener("context-provider", o), r.disconnect();
2707
+ };
2708
+ }
2709
+ function al(e, t) {
2710
+ return ll(e, sl, t);
2711
+ }
2712
+ function ul(e, t) {
2713
+ return al(e, t);
2714
+ }
2715
+ var Ui;
2716
+ (function(e) {
2717
+ e.TTS_WORD = "tts-word", e.TTS_SENTENCE = "tts-sentence", e.ANNOTATION = "annotation";
2718
+ })(Ui || (Ui = {}));
2719
+ var Ki;
2720
+ (function(e) {
2721
+ e.YELLOW = "yellow", e.GREEN = "green", e.BLUE = "blue", e.PINK = "pink", e.ORANGE = "orange", e.UNDERLINE = "underline";
2722
+ })(Ki || (Ki = {}));
2723
+ class cl {
2724
+ constructor() {
2725
+ $(this, "tools", /* @__PURE__ */ new Map()), $(this, "pnpIndex", /* @__PURE__ */ new Map()), $(this, "componentOverrides", {}), $(this, "moduleLoaders", /* @__PURE__ */ new Map()), $(this, "loadedToolModules", /* @__PURE__ */ new Set()), $(this, "moduleLoadPromises", /* @__PURE__ */ new Map());
2726
+ }
2727
+ /**
2728
+ * Normalize a single tool alias to canonical toolId.
2729
+ */
2730
+ normalizeToolId(t) {
2731
+ return t === "tts" ? "textToSpeech" : t;
2732
+ }
2733
+ /**
2734
+ * Normalize a list of tool aliases to canonical toolIds.
2735
+ */
2736
+ normalizeToolIds(t) {
2737
+ return t.map((n) => this.normalizeToolId(n));
2738
+ }
2739
+ /**
2740
+ * Register a tool
2741
+ *
2742
+ * @param registration - Tool registration
2743
+ * @throws Error if toolId is already registered
2744
+ */
2745
+ register(t) {
2746
+ if (this.tools.has(t.toolId))
2747
+ throw new Error(`Tool '${t.toolId}' is already registered`);
2748
+ if (this.tools.set(t.toolId, t), t.pnpSupportIds)
2749
+ for (const n of t.pnpSupportIds)
2750
+ this.pnpIndex.has(n) || this.pnpIndex.set(n, /* @__PURE__ */ new Set()), this.pnpIndex.get(n).add(t.toolId);
2751
+ }
2752
+ /**
2753
+ * Override an existing tool registration
2754
+ *
2755
+ * @param registration - New tool registration (must have existing toolId)
2756
+ */
2757
+ override(t) {
2758
+ if (!this.tools.has(t.toolId))
2759
+ throw new Error(`Cannot override non-existent tool '${t.toolId}'`);
2760
+ const n = this.tools.get(t.toolId);
2761
+ if (n.pnpSupportIds)
2762
+ for (const i of n.pnpSupportIds)
2763
+ this.pnpIndex.get(i)?.delete(t.toolId);
2764
+ if (this.tools.set(t.toolId, t), t.pnpSupportIds)
2765
+ for (const i of t.pnpSupportIds)
2766
+ this.pnpIndex.has(i) || this.pnpIndex.set(i, /* @__PURE__ */ new Set()), this.pnpIndex.get(i).add(t.toolId);
2767
+ }
2768
+ /**
2769
+ * Unregister a tool
2770
+ *
2771
+ * @param toolId - Tool ID to remove
2772
+ */
2773
+ unregister(t) {
2774
+ const n = this.tools.get(t);
2775
+ if (n) {
2776
+ if (n.pnpSupportIds)
2777
+ for (const i of n.pnpSupportIds)
2778
+ this.pnpIndex.get(i)?.delete(t);
2779
+ this.tools.delete(t);
2780
+ }
2781
+ }
2782
+ /**
2783
+ * Get a tool registration by ID
2784
+ *
2785
+ * @param toolId - Tool ID
2786
+ * @returns Tool registration or undefined
2787
+ */
2788
+ get(t) {
2789
+ return this.tools.get(t);
2790
+ }
2791
+ /**
2792
+ * Check if a tool is registered
2793
+ *
2794
+ * @param toolId - Tool ID
2795
+ * @returns true if registered
2796
+ */
2797
+ has(t) {
2798
+ return this.tools.has(t);
2799
+ }
2800
+ /**
2801
+ * Get all registered tool IDs
2802
+ *
2803
+ * @returns Array of tool IDs
2804
+ */
2805
+ getAllToolIds() {
2806
+ return Array.from(this.tools.keys());
2807
+ }
2808
+ /**
2809
+ * Get all tool registrations
2810
+ *
2811
+ * @returns Array of tool registrations
2812
+ */
2813
+ getAllTools() {
2814
+ return Array.from(this.tools.values());
2815
+ }
2816
+ /**
2817
+ * Find tool IDs that support a given PNP support ID
2818
+ *
2819
+ * @param pnpSupportId - PNP support ID (e.g., 'calculator')
2820
+ * @returns Set of tool IDs that support this PNP ID
2821
+ */
2822
+ getToolsByPNPSupport(t) {
2823
+ return this.pnpIndex.get(t) || /* @__PURE__ */ new Set();
2824
+ }
2825
+ /**
2826
+ * Get tools that support a specific level
2827
+ *
2828
+ * @param level - Tool level (assessment, section, item, passage, element)
2829
+ * @returns Array of tool registrations that support this level
2830
+ */
2831
+ getToolsByLevel(t) {
2832
+ return this.getAllTools().filter((n) => n.supportedLevels.includes(t));
2833
+ }
2834
+ /**
2835
+ * Filter tools by visibility in a given context
2836
+ *
2837
+ * Pass 2 of the two-pass model: Given a list of allowed tool IDs (from Pass 1),
2838
+ * ask each tool if it's relevant in this context.
2839
+ *
2840
+ * @param allowedToolIds - Tool IDs that passed Pass 1 (orchestrator approval)
2841
+ * @param context - Context to evaluate
2842
+ * @returns Array of visible tool registrations
2843
+ */
2844
+ filterVisibleInContext(t, n) {
2845
+ const i = [];
2846
+ for (const r of t) {
2847
+ const o = this.get(r);
2848
+ if (!o) {
2849
+ console.warn(`Tool '${r}' is allowed but not registered`);
2850
+ continue;
2851
+ }
2852
+ if (o.supportedLevels.includes(n.level))
2853
+ try {
2854
+ o.isVisibleInContext(n) && i.push(o);
2855
+ } catch (s) {
2856
+ console.error(`Error evaluating visibility for tool '${r}':`, s);
2857
+ }
2858
+ }
2859
+ return i;
2860
+ }
2861
+ /**
2862
+ * Get tool metadata for building UIs
2863
+ * Useful for building PNP configuration interfaces
2864
+ *
2865
+ * @returns Array of tool metadata (id, name, description, pnpSupportIds)
2866
+ */
2867
+ getToolMetadata() {
2868
+ return this.getAllTools().map((t) => ({
2869
+ toolId: t.toolId,
2870
+ name: t.name,
2871
+ description: t.description,
2872
+ pnpSupportIds: t.pnpSupportIds || [],
2873
+ supportedLevels: t.supportedLevels
2874
+ }));
2875
+ }
2876
+ /**
2877
+ * Generate PNP support IDs from enabled tools
2878
+ * Useful for creating PNP profiles
2879
+ *
2880
+ * @param enabledToolIds - Tool IDs to enable
2881
+ * @returns Array of unique PNP support IDs
2882
+ */
2883
+ generatePNPSupportsFromTools(t) {
2884
+ const n = /* @__PURE__ */ new Set();
2885
+ for (const i of t) {
2886
+ const r = this.get(i);
2887
+ if (r?.pnpSupportIds)
2888
+ for (const o of r.pnpSupportIds)
2889
+ n.add(o);
2890
+ }
2891
+ return Array.from(n);
2892
+ }
2893
+ /**
2894
+ * Clear all registrations (useful for testing)
2895
+ */
2896
+ clear() {
2897
+ this.tools.clear(), this.pnpIndex.clear();
2898
+ }
2899
+ /**
2900
+ * Configure global component overrides used by tool instance creation.
2901
+ */
2902
+ setComponentOverrides(t) {
2903
+ this.componentOverrides = t;
2904
+ }
2905
+ /**
2906
+ * Register lazy module loaders by toolId.
2907
+ * Toolbars call ensureToolModuleLoaded(toolId) before instance creation.
2908
+ */
2909
+ setToolModuleLoaders(t) {
2910
+ for (const [n, i] of Object.entries(t))
2911
+ i && this.moduleLoaders.set(n, i);
2912
+ }
2913
+ /**
2914
+ * Ensure tool module side-effects are loaded exactly once.
2915
+ * Safe to call repeatedly; concurrent callers share the same promise.
2916
+ */
2917
+ async ensureToolModuleLoaded(t) {
2918
+ if (this.loadedToolModules.has(t))
2919
+ return;
2920
+ const n = this.moduleLoadPromises.get(t);
2921
+ if (n) {
2922
+ await n;
2923
+ return;
2924
+ }
2925
+ const i = this.moduleLoaders.get(t);
2926
+ if (!i)
2927
+ return;
2928
+ const r = (async () => {
2929
+ await i(), this.loadedToolModules.add(t);
2930
+ })();
2931
+ this.moduleLoadPromises.set(t, r);
2932
+ try {
2933
+ await r;
2934
+ } finally {
2935
+ this.moduleLoadPromises.delete(t);
2936
+ }
2937
+ }
2938
+ /**
2939
+ * Ensure a set of tool modules are loaded.
2940
+ */
2941
+ async ensureToolModulesLoaded(t) {
2942
+ await Promise.all(t.map((n) => this.ensureToolModuleLoaded(n)));
2943
+ }
2944
+ /**
2945
+ * Whether a tool module has already been loaded.
2946
+ */
2947
+ isToolModuleLoaded(t) {
2948
+ return this.loadedToolModules.has(t);
2949
+ }
2950
+ /**
2951
+ * Render a tool for toolbar use with component overrides attached.
2952
+ */
2953
+ renderForToolbar(t, n, i) {
2954
+ const r = this.get(t);
2955
+ if (!r)
2956
+ throw new Error(`Tool '${t}' is not registered`);
2957
+ const o = {
2958
+ ...i,
2959
+ componentOverrides: {
2960
+ ...this.componentOverrides || {},
2961
+ ...i.componentOverrides || {}
2962
+ }
2963
+ };
2964
+ return r.renderToolbar(n, o);
2965
+ }
2966
+ }
2967
+ function ir(e) {
2968
+ return e.level === "item";
2969
+ }
2970
+ function dl(e) {
2971
+ return e.level === "passage";
2972
+ }
2973
+ function hl(e) {
2974
+ return e.level === "rubric";
2975
+ }
2976
+ function or(e) {
2977
+ return e.level === "element";
2978
+ }
2979
+ function Ii(e) {
2980
+ if (or(e)) {
2981
+ const t = e.item.config;
2982
+ if (!t)
2983
+ return "";
2984
+ const n = [], i = (l) => l.replace(/<[^>]*>/g, " ").trim(), r = t.elements?.[e.elementId];
2985
+ r && typeof r == "string" && n.push(i(r));
2986
+ const o = t.models, s = (Array.isArray(o) ? o : o && typeof o == "object" ? Object.values(o) : []).find((l) => l && typeof l == "object" && l.id === e.elementId);
2987
+ if (s) {
2988
+ for (const l of Object.values(s))
2989
+ if (typeof l == "string" && n.push(i(l)), Array.isArray(l)) {
2990
+ for (const a of l)
2991
+ if (a && typeof a == "object")
2992
+ for (const u of Object.values(a))
2993
+ typeof u == "string" && n.push(i(u));
2994
+ }
2995
+ }
2996
+ return n.filter(Boolean).join(" ").trim();
2997
+ }
2998
+ if (ir(e)) {
2999
+ const t = e.item;
3000
+ if (!t?.config)
3001
+ return "";
3002
+ const n = t.config, i = [], r = (a) => a.replace(/<[^>]*>/g, " ").trim();
3003
+ typeof n.markup == "string" && i.push(r(n.markup));
3004
+ const o = n.elements;
3005
+ if (o && typeof o == "object")
3006
+ for (const a of Object.values(o))
3007
+ typeof a == "string" && i.push(r(a));
3008
+ const s = n.models, l = Array.isArray(s) ? s : s && typeof s == "object" ? Object.values(s) : [];
3009
+ for (const a of l)
3010
+ if (!(!a || typeof a != "object")) {
3011
+ for (const u of Object.values(a))
3012
+ if (typeof u == "string" && i.push(r(u)), Array.isArray(u)) {
3013
+ for (const f of u)
3014
+ if (f && typeof f == "object")
3015
+ for (const v of Object.values(f))
3016
+ typeof v == "string" && i.push(r(v));
3017
+ }
3018
+ }
3019
+ return i.filter(Boolean).join(" ").trim();
3020
+ }
3021
+ if (dl(e)) {
3022
+ const t = e.passage;
3023
+ return t?.config ? (t.config.markup || "").replace(/<[^>]*>/g, " ").trim() : "";
3024
+ }
3025
+ if (hl(e)) {
3026
+ const t = e.rubricBlock;
3027
+ return t.passage?.config ? (t.passage.config.markup || "").replace(/<[^>]*>/g, " ").trim() : (t.content || "").replace(/<[^>]*>/g, " ").trim();
3028
+ }
3029
+ return "";
3030
+ }
3031
+ function Rn(e) {
3032
+ const t = Ii(e);
3033
+ return [
3034
+ /<math[>\s]/i,
3035
+ // MathML
3036
+ /\\\[([^\]]+)\\\]/,
3037
+ // LaTeX display math
3038
+ /\$\$[^$]+\$\$/,
3039
+ // LaTeX display math ($$...$$)
3040
+ /\\\(/,
3041
+ // LaTeX inline math
3042
+ /[+\-*/=<>≤≥∑∫√π]/,
3043
+ // Math symbols
3044
+ /\d+\s*[+\-*/=]\s*\d+/
3045
+ // Simple arithmetic
3046
+ ].some((n) => n.test(t));
3047
+ }
3048
+ function fl(e) {
3049
+ const t = [
3050
+ "pie-multiple-choice",
3051
+ "pie-inline-choice",
3052
+ "pie-select-text",
3053
+ "multiple-choice",
3054
+ "inline-choice",
3055
+ "select-text"
3056
+ ];
3057
+ if (or(e)) {
3058
+ const n = e.item.config;
3059
+ if (!n?.models)
3060
+ return !1;
3061
+ const i = (Array.isArray(n.models) ? n.models : Object.values(n.models)).find((o) => o && typeof o == "object" && o.id === e.elementId);
3062
+ if (!i)
3063
+ return !1;
3064
+ const r = i.element || "";
3065
+ return t.includes(r);
3066
+ }
3067
+ if (ir(e)) {
3068
+ const n = e.item.config?.models;
3069
+ return (Array.isArray(n) ? n : n && typeof n == "object" ? Object.values(n) : []).some((i) => {
3070
+ if (!i || typeof i != "object")
3071
+ return !1;
3072
+ const r = i.element || "";
3073
+ return t.includes(r) ? !0 : Array.isArray(i.choices) && i.choices.length > 0;
3074
+ });
3075
+ }
3076
+ return !1;
3077
+ }
3078
+ function jn(e) {
3079
+ return Ii(e).trim().length >= 10;
3080
+ }
3081
+ function pl(e) {
3082
+ const t = Ii(e);
3083
+ return [
3084
+ /chemistry|chemical|element|atom|molecule|compound/i,
3085
+ /periodic\s+table/i,
3086
+ /H₂O|CO₂|NaCl|O₂|N₂/i,
3087
+ // Chemical formulas
3088
+ /\b[A-Z][a-z]?\d*\b/,
3089
+ // Element symbols (H, He, Li, etc.)
3090
+ /biology|organism|cell|DNA|RNA|protein/i,
3091
+ /physics|force|energy|velocity|acceleration/i
3092
+ ].some((n) => n.test(t));
3093
+ }
3094
+ const vl = [
3095
+ "assessment",
3096
+ "section",
3097
+ "item",
3098
+ "passage",
3099
+ "rubric"
3100
+ ], gl = new Set(vl);
3101
+ function bl(e) {
3102
+ return gl.has(e);
3103
+ }
3104
+ function se(e, t, n, i = "overlay") {
3105
+ const r = e.trim(), o = n.trim();
3106
+ if (!r || !o)
3107
+ throw new Error("Tool instance ids require non-empty tool and scope ids");
3108
+ if (!bl(t))
3109
+ throw new Error(`Unknown tool scope level '${t}'. Register custom levels with registerToolScopeLevel().`);
3110
+ return i === "inline" ? `${r}:${t}:${o}:inline` : `${r}:${t}:${o}`;
3111
+ }
3112
+ const ml = /* @__PURE__ */ new Set([
3113
+ "annotation-xml",
3114
+ "color-profile",
3115
+ "font-face",
3116
+ "font-face-src",
3117
+ "font-face-uri",
3118
+ "font-face-format",
3119
+ "font-face-name",
3120
+ "missing-glyph"
3121
+ ]), yl = /^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/, wl = (e, t = "custom element tag") => {
3122
+ if (!e || typeof e != "string")
3123
+ throw new Error(`Invalid ${t}: expected a non-empty string`);
3124
+ const n = e.trim();
3125
+ if (!n)
3126
+ throw new Error(`Invalid ${t}: tag is empty`);
3127
+ if (n !== n.toLowerCase())
3128
+ throw new Error(`Invalid ${t} "${n}": custom element names must be lowercase`);
3129
+ if (!n.includes("-"))
3130
+ throw new Error(`Invalid ${t} "${n}": custom element names must include a hyphen`);
3131
+ if (ml.has(n))
3132
+ throw new Error(`Invalid ${t} "${n}": this name is reserved by the HTML spec`);
3133
+ if (!yl.test(n))
3134
+ throw new Error(`Invalid ${t} "${n}": allowed characters are lowercase letters, numbers, ".", "_" and "-"`);
3135
+ return n;
3136
+ }, rr = {
3137
+ calculator: "pie-tool-calculator",
3138
+ textToSpeech: "pie-tool-text-to-speech",
3139
+ ruler: "pie-tool-ruler",
3140
+ protractor: "pie-tool-protractor",
3141
+ answerEliminator: "pie-tool-answer-eliminator",
3142
+ highlighter: "pie-tool-annotation-toolbar",
3143
+ lineReader: "pie-tool-line-reader",
3144
+ colorScheme: "pie-tool-color-scheme",
3145
+ annotationToolbar: "pie-tool-annotation-toolbar",
3146
+ graph: "pie-tool-graph",
3147
+ periodicTable: "pie-tool-periodic-table"
3148
+ }, $l = (e, t) => {
3149
+ const n = t?.toolTagMap?.[e] ?? rr[e] ?? e;
3150
+ return wl(n, `tool component tag for "${e}"`);
3151
+ }, xl = (e) => document.createElement(e), Ce = (e, t, n, i) => {
3152
+ const r = $l(e, i), o = i?.toolComponentFactories?.[e] ?? i?.toolComponentFactory;
3153
+ return o ? o({ toolId: e, tagName: r, context: t, toolbarContext: n }) : xl(r);
3154
+ }, kl = {
3155
+ toolId: "calculator",
3156
+ name: "Calculator",
3157
+ description: "Multi-type calculator (basic, scientific, graphing)",
3158
+ icon: "calculator",
3159
+ // Calculator is item-level in this player architecture.
3160
+ supportedLevels: ["item"],
3161
+ // PNP support IDs that enable this tool
3162
+ // Maps to QTI 3.0 standard features: calculator, graphingCalculator
3163
+ pnpSupportIds: [
3164
+ "calculator",
3165
+ // QTI 3.0 standard (cognitive.calculator)
3166
+ "graphingCalculator",
3167
+ // QTI 3.0 standard (assessment.graphingCalculator)
3168
+ "basicCalculator",
3169
+ // Common variant
3170
+ "scientificCalculator"
3171
+ // Common variant
3172
+ ],
3173
+ /**
3174
+ * Pass 2: Determine if calculator is relevant in this context
3175
+ *
3176
+ * Calculator is relevant when context contains mathematical content
3177
+ * (MathML, LaTeX, arithmetic markers).
3178
+ */
3179
+ isVisibleInContext(e) {
3180
+ return Rn(e);
3181
+ },
3182
+ renderToolbar(e, t) {
3183
+ const n = se(this.toolId, "item", t.itemId), i = t.componentOverrides, r = Ce(this.toolId, e, t, i);
3184
+ r.setAttribute("tool-id", n);
3185
+ const o = document.createElement("pie-tool-calculator-inline");
3186
+ return o.setAttribute("tool-id", se(this.toolId, "item", t.itemId, "inline")), o.setAttribute("target-tool-id", n), o.setAttribute("calculator-type", "scientific"), o.setAttribute("available-types", "basic,scientific,graphing"), o.setAttribute("size", t.ui?.size || "md"), {
3187
+ toolId: this.toolId,
3188
+ inlineElement: o,
3189
+ overlayElement: r,
3190
+ button: null,
3191
+ sync: () => {
3192
+ const s = t.isToolVisible(n);
3193
+ r.visible = s;
3194
+ },
3195
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3196
+ s(t.isToolVisible(n));
3197
+ }) : () => {
3198
+ }
3199
+ };
3200
+ }
3201
+ }, Il = {
3202
+ toolId: "textToSpeech",
3203
+ name: "Text to Speech",
3204
+ description: "Read content aloud",
3205
+ icon: "volume-up",
3206
+ // TTS can appear at all levels except assessment and element.
3207
+ supportedLevels: ["section", "item", "passage", "rubric"],
3208
+ // PNP support IDs that enable this tool
3209
+ // Maps to QTI 3.0 standard features: textToSpeech, readAloud
3210
+ pnpSupportIds: [
3211
+ "textToSpeech",
3212
+ // QTI 3.0 standard (auditory.textToSpeech)
3213
+ "readAloud",
3214
+ // QTI 3.0 standard (auditory.readAloud)
3215
+ "tts",
3216
+ // Common abbreviation
3217
+ "speechOutput"
3218
+ // Common variant
3219
+ ],
3220
+ /**
3221
+ * Pass 2: Determine if TTS is relevant in this context
3222
+ *
3223
+ * TTS is relevant when:
3224
+ * - Context contains readable text (at least 10 characters)
3225
+ */
3226
+ isVisibleInContext(e) {
3227
+ return jn(e);
3228
+ },
3229
+ renderToolbar(e, t) {
3230
+ const n = se(this.toolId, "item", t.itemId, "inline"), i = document.createElement("pie-tool-tts-inline");
3231
+ i.setAttribute("tool-id", n), i.setAttribute("catalog-id", t.catalogId || t.itemId), i.setAttribute("language", t.language), i.setAttribute("size", t.ui?.size || "md");
3232
+ let r = !1;
3233
+ return {
3234
+ toolId: this.toolId,
3235
+ inlineElement: i,
3236
+ sync: () => {
3237
+ i.setAttribute("catalog-id", t.catalogId || t.itemId), i.setAttribute("language", t.language), i.setAttribute("size", t.ui?.size || "md"), t.ttsService && (i.ttsService = t.ttsService), !r && t.ensureTTSReady && (r = !0, t.ensureTTSReady().catch((o) => {
3238
+ console.error("[ttsToolRegistration] Failed to initialize TTS service:", o);
3239
+ }));
3240
+ }
3241
+ };
3242
+ }
3243
+ }, _l = {
3244
+ toolId: "ruler",
3245
+ name: "Ruler",
3246
+ description: "On-screen ruler for measurements",
3247
+ icon: "ruler",
3248
+ // Ruler typically appears at item/element level
3249
+ supportedLevels: ["item", "element"],
3250
+ // PNP support IDs
3251
+ // Maps to QTI 3.0 standard feature: ruler
3252
+ pnpSupportIds: [
3253
+ "ruler",
3254
+ // QTI 3.0 standard (assessment.ruler)
3255
+ "measurement"
3256
+ // Common variant
3257
+ ],
3258
+ /**
3259
+ * Pass 2: Ruler is relevant when math content is present
3260
+ */
3261
+ isVisibleInContext(e) {
3262
+ return Rn(e);
3263
+ },
3264
+ renderToolbar(e, t) {
3265
+ const n = se(this.toolId, "item", t.itemId), i = {
3266
+ toolId: this.toolId,
3267
+ label: this.name,
3268
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3269
+ disabled: !1,
3270
+ ariaLabel: "Open ruler tool",
3271
+ tooltip: "Ruler",
3272
+ onClick: () => t.toggleTool(this.toolId),
3273
+ active: t.isToolVisible(n)
3274
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3275
+ return o.setAttribute("tool-id", n), {
3276
+ toolId: this.toolId,
3277
+ button: i,
3278
+ overlayElement: o,
3279
+ sync: () => {
3280
+ const s = t.isToolVisible(n);
3281
+ i.active = s, o.visible = s, t.toolkitCoordinator && (o.toolkitCoordinator = t.toolkitCoordinator);
3282
+ },
3283
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3284
+ s(t.isToolVisible(n));
3285
+ }) : () => {
3286
+ }
3287
+ };
3288
+ }
3289
+ }, Tl = {
3290
+ toolId: "protractor",
3291
+ name: "Protractor",
3292
+ description: "On-screen protractor for angle measurements",
3293
+ icon: "protractor",
3294
+ // Protractor typically appears at item/element level
3295
+ supportedLevels: ["item", "element"],
3296
+ // PNP support IDs
3297
+ // Maps to QTI 3.0 standard feature: protractor
3298
+ pnpSupportIds: [
3299
+ "protractor",
3300
+ // QTI 3.0 standard (assessment.protractor)
3301
+ "angleMeasurement"
3302
+ // Common variant
3303
+ ],
3304
+ /**
3305
+ * Pass 2: Protractor is relevant when math content is present
3306
+ */
3307
+ isVisibleInContext(e) {
3308
+ return Rn(e);
3309
+ },
3310
+ renderToolbar(e, t) {
3311
+ const n = se(this.toolId, "item", t.itemId), i = {
3312
+ toolId: this.toolId,
3313
+ label: this.name,
3314
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3315
+ disabled: !1,
3316
+ ariaLabel: "Open protractor tool",
3317
+ tooltip: "Protractor",
3318
+ onClick: () => t.toggleTool(this.toolId),
3319
+ active: t.isToolVisible(n)
3320
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3321
+ return o.setAttribute("tool-id", n), {
3322
+ toolId: this.toolId,
3323
+ button: i,
3324
+ overlayElement: o,
3325
+ sync: () => {
3326
+ const s = t.isToolVisible(n);
3327
+ i.active = s, o.visible = s, t.toolkitCoordinator && (o.toolkitCoordinator = t.toolkitCoordinator);
3328
+ },
3329
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3330
+ s(t.isToolVisible(n));
3331
+ }) : () => {
3332
+ }
3333
+ };
3334
+ }
3335
+ }, Cl = {
3336
+ toolId: "answerEliminator",
3337
+ name: "Answer Eliminator",
3338
+ description: "Strike through answer choices",
3339
+ icon: "strikethrough",
3340
+ // Answer eliminator appears at item level only
3341
+ supportedLevels: ["item"],
3342
+ // PNP support IDs
3343
+ // Maps to QTI 3.0 standard feature: answerMasking
3344
+ pnpSupportIds: [
3345
+ "answerMasking",
3346
+ // QTI 3.0 standard (assessment.answerMasking)
3347
+ "answerEliminator",
3348
+ // QTI 3.0 standard (assessment.answerEliminator)
3349
+ "strikethrough",
3350
+ // Common variant
3351
+ "choiceMasking"
3352
+ // Common variant
3353
+ ],
3354
+ /**
3355
+ * Pass 2: Answer eliminator is relevant only for choice-based questions
3356
+ */
3357
+ isVisibleInContext(e) {
3358
+ return fl(e);
3359
+ },
3360
+ renderToolbar(e, t) {
3361
+ const n = se(this.toolId, "item", t.itemId), i = t.componentOverrides ?? {}, r = Ce(this.toolId, e, t, i);
3362
+ r.setAttribute("tool-id", n), r.setAttribute("strategy", "strikethrough"), r.setAttribute("button-alignment", "inline");
3363
+ const o = {
3364
+ toolId: this.toolId,
3365
+ label: this.name,
3366
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M19,3H16.3H7.7H5A2,2 0 0,0 3,5V7.7V16.4V19A2,2 0 0,0 5,21H7.7H16.4H19A2,2 0 0,0 21,19V16.3V7.7V5A2,2 0 0,0 19,3M15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4L13.4,12L17,15.6L15.6,17Z"/></svg>',
3367
+ disabled: !1,
3368
+ ariaLabel: "Answer eliminator - Strike through choices",
3369
+ tooltip: "Strike Through",
3370
+ onClick: () => t.toggleTool(this.toolId),
3371
+ active: t.isToolVisible(n)
3372
+ };
3373
+ return {
3374
+ toolId: this.toolId,
3375
+ button: o,
3376
+ overlayElement: r,
3377
+ sync: () => {
3378
+ const s = t.isToolVisible(n);
3379
+ o.active = s, r.visible = s, t.toolCoordinator && (r.coordinator = t.toolCoordinator), r.scopeElement = t.getScopeElement?.() || null, t.elementToolStateStore && (r.elementToolStateStore = t.elementToolStateStore);
3380
+ const l = t.getGlobalElementId?.();
3381
+ l && (r.globalElementId = l);
3382
+ },
3383
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3384
+ s(t.isToolVisible(n));
3385
+ }) : () => {
3386
+ }
3387
+ };
3388
+ }
3389
+ }, Sl = {
3390
+ toolId: "highlighter",
3391
+ name: "Highlighter",
3392
+ description: "Highlight text",
3393
+ icon: "highlighter",
3394
+ // Highlighter appears at passage, rubric, item, and element levels
3395
+ supportedLevels: ["passage", "rubric", "item", "element"],
3396
+ // PNP support IDs
3397
+ pnpSupportIds: ["highlighter", "textHighlight", "annotation"],
3398
+ /**
3399
+ * Pass 2: Highlighter is relevant when readable text is available
3400
+ */
3401
+ isVisibleInContext(e) {
3402
+ return jn(e);
3403
+ },
3404
+ renderToolbar(e, t) {
3405
+ const n = se(this.toolId, "item", t.itemId), i = {
3406
+ toolId: this.toolId,
3407
+ label: this.name,
3408
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3409
+ disabled: !1,
3410
+ ariaLabel: "Highlighter - Highlight text",
3411
+ tooltip: "Highlight",
3412
+ onClick: () => t.toggleTool(this.toolId),
3413
+ active: t.isToolVisible(n)
3414
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3415
+ return o.setAttribute("tool-id", n), {
3416
+ toolId: this.toolId,
3417
+ button: i,
3418
+ overlayElement: o,
3419
+ sync: () => {
3420
+ const s = t.isToolVisible(n);
3421
+ i.active = s, o.enabled = s, o.visible = s, t.ttsService && (o.ttsService = t.ttsService);
3422
+ },
3423
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3424
+ s(t.isToolVisible(n));
3425
+ }) : () => {
3426
+ }
3427
+ };
3428
+ }
3429
+ }, Ml = {
3430
+ toolId: "lineReader",
3431
+ name: "Line Reader",
3432
+ description: "Reading guide overlay",
3433
+ icon: "bars-3",
3434
+ // Line reader appears where there's text to read
3435
+ supportedLevels: ["passage", "rubric", "item"],
3436
+ // PNP support IDs
3437
+ // Maps to QTI 3.0 standard features: readingMask, readingGuide, readingRuler
3438
+ pnpSupportIds: [
3439
+ "readingMask",
3440
+ // QTI 3.0 standard (reading.readingMask)
3441
+ "readingGuide",
3442
+ // QTI 3.0 standard (reading.readingGuide)
3443
+ "readingRuler",
3444
+ // QTI 3.0 standard (reading.readingRuler)
3445
+ "lineReader",
3446
+ // Common variant
3447
+ "trackingGuide"
3448
+ // Common variant
3449
+ ],
3450
+ /**
3451
+ * Pass 2: Line reader is relevant when readable text is present
3452
+ */
3453
+ isVisibleInContext(e) {
3454
+ return jn(e);
3455
+ },
3456
+ renderToolbar(e, t) {
3457
+ const n = se(this.toolId, "item", t.itemId), i = {
3458
+ toolId: this.toolId,
3459
+ label: this.name,
3460
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3461
+ disabled: !1,
3462
+ ariaLabel: "Line reader - Reading guide",
3463
+ tooltip: "Line Reader",
3464
+ onClick: () => t.toggleTool(this.toolId),
3465
+ active: t.isToolVisible(n)
3466
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3467
+ return o.setAttribute("tool-id", n), {
3468
+ toolId: this.toolId,
3469
+ button: i,
3470
+ overlayElement: o,
3471
+ sync: () => {
3472
+ const s = t.isToolVisible(n);
3473
+ i.active = s, o.visible = s, t.toolkitCoordinator && (o.toolkitCoordinator = t.toolkitCoordinator);
3474
+ },
3475
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3476
+ s(t.isToolVisible(n));
3477
+ }) : () => {
3478
+ }
3479
+ };
3480
+ }
3481
+ }, Al = {
3482
+ toolId: "colorScheme",
3483
+ name: "Color Scheme",
3484
+ description: "Accessible color themes and contrast",
3485
+ icon: "swatch",
3486
+ // Color scheme is assessment-wide
3487
+ supportedLevels: ["assessment", "section"],
3488
+ // PNP support IDs
3489
+ // Maps to QTI 3.0 standard features: highContrastDisplay, colorContrast, invertColors
3490
+ pnpSupportIds: [
3491
+ "highContrastDisplay",
3492
+ // QTI 3.0 standard (visual.highContrastDisplay)
3493
+ "colorContrast",
3494
+ // QTI 3.0 standard (visual.colorContrast)
3495
+ "invertColors",
3496
+ // QTI 3.0 standard (visual.invertColors)
3497
+ "colorScheme",
3498
+ // Common variant
3499
+ "highContrast",
3500
+ // Common variant
3501
+ "customColors"
3502
+ // Common variant
3503
+ ],
3504
+ /**
3505
+ * Pass 2: Color scheme is always relevant when allowed
3506
+ */
3507
+ isVisibleInContext(e) {
3508
+ return !0;
3509
+ },
3510
+ renderToolbar(e, t) {
3511
+ const n = se(this.toolId, "item", t.itemId), i = {
3512
+ toolId: this.toolId,
3513
+ label: this.name,
3514
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3515
+ disabled: !1,
3516
+ ariaLabel: "Color scheme - Change colors and contrast",
3517
+ tooltip: "Color Scheme",
3518
+ onClick: () => t.toggleTool(this.toolId),
3519
+ active: t.isToolVisible(n)
3520
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3521
+ return o.setAttribute("tool-id", n), {
3522
+ toolId: this.toolId,
3523
+ button: i,
3524
+ overlayElement: o,
3525
+ sync: () => {
3526
+ const s = t.isToolVisible(n);
3527
+ i.active = s, o.visible = s, t.toolkitCoordinator && (o.toolkitCoordinator = t.toolkitCoordinator);
3528
+ },
3529
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3530
+ s(t.isToolVisible(n));
3531
+ }) : () => {
3532
+ }
3533
+ };
3534
+ }
3535
+ }, Ll = {
3536
+ toolId: "annotationToolbar",
3537
+ name: "Highlighter",
3538
+ description: "Highlight and annotate text",
3539
+ icon: "highlighter",
3540
+ // Annotation appears where there's text content
3541
+ supportedLevels: ["passage", "rubric", "item", "element"],
3542
+ // PNP support IDs
3543
+ // Maps to QTI 3.0 standard features: highlighting, annotations
3544
+ pnpSupportIds: [
3545
+ "highlighting",
3546
+ // QTI 3.0 standard (cognitive.highlighting / reading.wordHighlighting)
3547
+ "annotations",
3548
+ // QTI 3.0 standard (cognitive.annotations)
3549
+ "highlighter",
3550
+ // Common variant
3551
+ "textHighlight",
3552
+ // Common variant
3553
+ "annotation"
3554
+ // Common variant
3555
+ ],
3556
+ /**
3557
+ * Pass 2: Annotation is relevant when readable text is present
3558
+ */
3559
+ isVisibleInContext(e) {
3560
+ return jn(e);
3561
+ },
3562
+ renderToolbar(e, t) {
3563
+ const n = se(this.toolId, "item", t.itemId), i = {
3564
+ toolId: this.toolId,
3565
+ label: this.name,
3566
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3567
+ disabled: !1,
3568
+ ariaLabel: "Annotation toolbar - Highlight text",
3569
+ tooltip: "Highlight",
3570
+ onClick: () => t.toggleTool(this.toolId),
3571
+ active: t.isToolVisible(n)
3572
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3573
+ return o.setAttribute("tool-id", n), {
3574
+ toolId: this.toolId,
3575
+ button: i,
3576
+ overlayElement: o,
3577
+ sync: () => {
3578
+ const s = t.isToolVisible(n);
3579
+ i.active = s, o.visible = s, t.toolkitCoordinator && (o.toolkitCoordinator = t.toolkitCoordinator);
3580
+ },
3581
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3582
+ s(t.isToolVisible(n));
3583
+ }) : () => {
3584
+ }
3585
+ };
3586
+ }
3587
+ }, El = {
3588
+ toolId: "graph",
3589
+ name: "Graph",
3590
+ description: "Graphing calculator and coordinate plane",
3591
+ icon: "chart-bar",
3592
+ // Graph appears at item and element level where graphing might be needed
3593
+ supportedLevels: ["item", "element"],
3594
+ // PNP support IDs
3595
+ // Maps to QTI 3.0 standard features: graph, graphingCalculator
3596
+ pnpSupportIds: [
3597
+ "graph",
3598
+ // QTI 3.0 standard (assessment.graph)
3599
+ "graphingCalculator",
3600
+ // QTI 3.0 standard (assessment.graphingCalculator)
3601
+ "coordinatePlane",
3602
+ // Common variant
3603
+ "graphingTool"
3604
+ // Common variant
3605
+ ],
3606
+ /**
3607
+ * Pass 2: Graph is relevant when math content is present
3608
+ */
3609
+ isVisibleInContext(e) {
3610
+ return Rn(e);
3611
+ },
3612
+ renderToolbar(e, t) {
3613
+ const n = se(this.toolId, "item", t.itemId), i = {
3614
+ toolId: this.toolId,
3615
+ label: this.name,
3616
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3617
+ disabled: !1,
3618
+ ariaLabel: "Graph - Graphing calculator",
3619
+ tooltip: "Graph",
3620
+ onClick: () => t.toggleTool(this.toolId),
3621
+ active: t.isToolVisible(n)
3622
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3623
+ return o.setAttribute("tool-id", n), {
3624
+ toolId: this.toolId,
3625
+ button: i,
3626
+ overlayElement: o,
3627
+ sync: () => {
3628
+ const s = t.isToolVisible(n);
3629
+ i.active = s, o.visible = s, t.toolkitCoordinator && (o.toolkitCoordinator = t.toolkitCoordinator);
3630
+ },
3631
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3632
+ s(t.isToolVisible(n));
3633
+ }) : () => {
3634
+ }
3635
+ };
3636
+ }
3637
+ }, Ol = {
3638
+ toolId: "periodicTable",
3639
+ name: "Periodic Table",
3640
+ description: "Chemistry periodic table reference",
3641
+ icon: "beaker",
3642
+ // Periodic table appears at item and element level
3643
+ supportedLevels: ["item", "element"],
3644
+ // PNP support IDs
3645
+ // Maps to QTI 3.0 standard feature: periodicTable
3646
+ pnpSupportIds: [
3647
+ "periodicTable",
3648
+ // QTI 3.0 standard (assessment.periodicTable)
3649
+ "chemistryReference",
3650
+ // Common variant
3651
+ "elementReference"
3652
+ // Common variant
3653
+ ],
3654
+ /**
3655
+ * Pass 2: Periodic table is relevant when science content is present
3656
+ */
3657
+ isVisibleInContext(e) {
3658
+ return pl(e);
3659
+ },
3660
+ renderToolbar(e, t) {
3661
+ const n = se(this.toolId, "item", t.itemId), i = {
3662
+ toolId: this.toolId,
3663
+ label: this.name,
3664
+ icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
3665
+ disabled: !1,
3666
+ ariaLabel: "Periodic table - Chemistry reference",
3667
+ tooltip: "Periodic Table",
3668
+ onClick: () => t.toggleTool(this.toolId),
3669
+ active: t.isToolVisible(n)
3670
+ }, r = t.componentOverrides ?? {}, o = Ce(this.toolId, e, t, r);
3671
+ return o.setAttribute("tool-id", n), {
3672
+ toolId: this.toolId,
3673
+ button: i,
3674
+ overlayElement: o,
3675
+ sync: () => {
3676
+ const s = t.isToolVisible(n);
3677
+ i.active = s, o.visible = s, t.toolkitCoordinator && (o.toolkitCoordinator = t.toolkitCoordinator);
3678
+ },
3679
+ subscribeActive: (s) => t.subscribeVisibility ? t.subscribeVisibility(() => {
3680
+ s(t.isToolVisible(n));
3681
+ }) : () => {
3682
+ }
3683
+ };
3684
+ }
3685
+ };
3686
+ function Vl(e = {}) {
3687
+ const t = new cl(), n = {
3688
+ toolTagMap: {
3689
+ ...rr,
3690
+ ...e.toolTagMap || {}
3691
+ },
3692
+ toolComponentFactory: e.toolComponentFactory,
3693
+ toolComponentFactories: e.toolComponentFactories
3694
+ }, i = (r) => e.overrides?.[r.toolId] || r;
3695
+ return t.register(i(kl)), t.register(i(Il)), t.register(i(_l)), t.register(i(Tl)), t.register(i(Cl)), t.register(i(Sl)), t.register(i(Ml)), t.register(i(Al)), t.register(i(Ll)), t.register(i(El)), t.register(i(Ol)), e.toolModuleLoaders && Object.keys(e.toolModuleLoaders).length > 0 && t.setToolModuleLoaders(e.toolModuleLoaders), t.setComponentOverrides(n), t;
3696
+ }
3697
+ function Rl() {
3698
+ const e = Vl(), t = /* @__PURE__ */ new Set();
3699
+ for (const n of e.getAllTools())
3700
+ for (const i of n.pnpSupportIds || [])
3701
+ t.add(i);
3702
+ return [...t].sort();
3703
+ }
3704
+ Rl();
3705
+ const jl = {
3706
+ /**
3707
+ * Visual accessibility features
3708
+ * For students with low vision, color blindness, or visual processing needs
3709
+ */
3710
+ visual: {
3711
+ // Magnification and zoom
3712
+ magnification: "magnification",
3713
+ screenMagnifier: "screenMagnifier",
3714
+ zoomable: "zoomable",
3715
+ // Color and contrast
3716
+ highContrastDisplay: "highContrastDisplay",
3717
+ highContrastAudio: "highContrastAudio",
3718
+ colorContrast: "colorContrast",
3719
+ invertColors: "invertColors",
3720
+ // Display customization
3721
+ displayTransformability: "displayTransformability",
3722
+ largePrint: "largePrint",
3723
+ fontEnlargement: "fontEnlargement",
3724
+ resizeText: "resizeText",
3725
+ // Visual alternatives
3726
+ alternativeText: "alternativeText",
3727
+ longDescription: "longDescription",
3728
+ describedMath: "describedMath",
3729
+ tactileGraphic: "tactileGraphic",
3730
+ tactileObject: "tactileObject"
3731
+ },
3732
+ /**
3733
+ * Auditory accessibility features
3734
+ * For students who are deaf, hard of hearing, or benefit from audio
3735
+ */
3736
+ auditory: {
3737
+ // Audio output
3738
+ audioDescription: "audioDescription",
3739
+ textToSpeech: "textToSpeech",
3740
+ readAloud: "readAloud",
3741
+ humanVoice: "humanVoice",
3742
+ syntheticVoice: "syntheticVoice",
3743
+ // Speech control
3744
+ speechRate: "speechRate",
3745
+ speechVolume: "speechVolume",
3746
+ voicePitch: "voicePitch",
3747
+ // Visual alternatives for audio
3748
+ captions: "captions",
3749
+ closedCaptions: "closedCaptions",
3750
+ openCaptions: "openCaptions",
3751
+ transcript: "transcript",
3752
+ signLanguage: "signLanguage",
3753
+ subtitles: "subtitles",
3754
+ // Audio adjustments
3755
+ audioControl: "audioControl",
3756
+ noBackgroundAudio: "noBackgroundAudio"
3757
+ },
3758
+ /**
3759
+ * Motor/physical accessibility features
3760
+ * For students with limited mobility or motor control
3761
+ */
3762
+ motor: {
3763
+ // Input alternatives
3764
+ keyboardControl: "keyboardControl",
3765
+ mouseControl: "mouseControl",
3766
+ touchControl: "touchControl",
3767
+ voiceControl: "voiceControl",
3768
+ switchControl: "switchControl",
3769
+ eyeGazeControl: "eyeGazeControl",
3770
+ // Keyboard features
3771
+ singleSwitchAccess: "singleSwitchAccess",
3772
+ stickyKeys: "stickyKeys",
3773
+ keyboardShortcuts: "keyboardShortcuts",
3774
+ // Timing
3775
+ timingControl: "timingControl",
3776
+ unlimitedTime: "unlimitedTime",
3777
+ extendedTime: "extendedTime",
3778
+ pauseControl: "pauseControl"
3779
+ },
3780
+ /**
3781
+ * Cognitive/learning accessibility features
3782
+ * For students with learning disabilities, ADHD, autism, etc.
3783
+ */
3784
+ cognitive: {
3785
+ // Content simplification
3786
+ simplifiedLanguage: "simplifiedLanguage",
3787
+ reducedComplexity: "reducedComplexity",
3788
+ structuralNavigation: "structuralNavigation",
3789
+ tableOfContents: "tableOfContents",
3790
+ // Focus and attention
3791
+ reducedDistraction: "reducedDistraction",
3792
+ noFlashing: "noFlashing",
3793
+ pauseAnimation: "pauseAnimation",
3794
+ // Organization and support
3795
+ annotations: "annotations",
3796
+ bookmarking: "bookmarking",
3797
+ highlighting: "highlighting",
3798
+ guidedNavigation: "guidedNavigation",
3799
+ // Tools
3800
+ calculator: "calculator",
3801
+ thesaurus: "thesaurus",
3802
+ spellingAssistance: "spellingAssistance",
3803
+ grammarAssistance: "grammarAssistance"
3804
+ },
3805
+ /**
3806
+ * Reading support features
3807
+ * For students with dyslexia or reading challenges
3808
+ */
3809
+ reading: {
3810
+ // Text presentation
3811
+ lineSpacing: "lineSpacing",
3812
+ wordSpacing: "wordSpacing",
3813
+ letterSpacing: "letterSpacing",
3814
+ fontFamily: "fontFamily",
3815
+ readingMask: "readingMask",
3816
+ readingGuide: "readingGuide",
3817
+ readingRuler: "readingRuler",
3818
+ // Highlighting and emphasis
3819
+ wordHighlighting: "wordHighlighting",
3820
+ lineHighlighting: "lineHighlighting",
3821
+ focusIndicator: "focusIndicator",
3822
+ // Content support
3823
+ printableResource: "printableResource",
3824
+ braille: "braille",
3825
+ nemeth: "nemeth",
3826
+ refreshableBraille: "refreshableBraille"
3827
+ },
3828
+ /**
3829
+ * Navigation features
3830
+ * For efficient content navigation
3831
+ */
3832
+ navigation: {
3833
+ // Structure
3834
+ index: "index",
3835
+ pageNavigation: "pageNavigation",
3836
+ skipContent: "skipContent",
3837
+ breadcrumbs: "breadcrumbs",
3838
+ // Search
3839
+ searchable: "searchable",
3840
+ fullTextSearch: "fullTextSearch"
3841
+ },
3842
+ /**
3843
+ * Linguistic features
3844
+ * For language support
3845
+ */
3846
+ linguistic: {
3847
+ // Languages
3848
+ multilingualText: "multilingualText",
3849
+ translatedText: "translatedText",
3850
+ glossary: "glossary",
3851
+ // Sign language
3852
+ signLanguageInterpretation: "signLanguageInterpretation",
3853
+ visualLanguage: "visualLanguage"
3854
+ },
3855
+ /**
3856
+ * Assessment-specific features
3857
+ * Features specific to test-taking environments
3858
+ */
3859
+ assessment: {
3860
+ // Tools
3861
+ protractor: "protractor",
3862
+ ruler: "ruler",
3863
+ graph: "graph",
3864
+ graphingCalculator: "graphingCalculator",
3865
+ periodicTable: "periodicTable",
3866
+ formulaSheet: "formulaSheet",
3867
+ // Answer support
3868
+ answerMasking: "answerMasking",
3869
+ answerEliminator: "answerEliminator",
3870
+ strikethrough: "strikethrough",
3871
+ // Item features
3872
+ itemGlossary: "itemGlossary",
3873
+ tutorialAvailable: "tutorialAvailable"
3874
+ }
3875
+ };
3876
+ Object.values(jl).flatMap((e) => Object.values(e));
3877
+ var si;
3878
+ (function(e) {
3879
+ e[e.BASE = 0] = "BASE", e[e.TOOL = 1e3] = "TOOL", e[e.MODAL = 2e3] = "MODAL", e[e.CONTROL = 3e3] = "CONTROL", e[e.HIGHLIGHT = 4e3] = "HIGHLIGHT";
3880
+ })(si || (si = {}));
3881
+ var Ji;
3882
+ (function(e) {
3883
+ e.IDLE = "idle", e.LOADING = "loading", e.PLAYING = "playing", e.PAUSED = "paused", e.ERROR = "error";
3884
+ })(Ji || (Ji = {}));
3885
+ var Nl = /* @__PURE__ */ bt('<button type="button" class="tool-settings-button btn btn-ghost btn-sm btn-circle svelte-57plqq"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 svelte-57plqq"><path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"></path><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg></button>');
3886
+ const Pl = {
3887
+ hash: "svelte-57plqq",
3888
+ code: ".tool-settings-button.svelte-57plqq {display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0.25rem;border:none;border-radius:9999px;background:transparent;color:inherit;cursor:pointer;}.tool-settings-button.svelte-57plqq:hover {background:rgba(255, 255, 255, 0.1);}.tool-settings-button.svelte-57plqq:focus-visible {outline:2px solid currentColor;outline-offset:2px;}.tool-settings-button.svelte-57plqq svg:where(.svelte-57plqq) {width:20px;height:20px;display:block;}"
3889
+ };
3890
+ function sr(e, t) {
3891
+ An(t, !0), tr(e, Pl);
3892
+ let n = he(t, "buttonEl", 7, null), i = he(t, "onClick"), r = he(t, "ariaLabel", 7, "Settings"), o = he(t, "active", 7, !1);
3893
+ var s = {
3894
+ get buttonEl() {
3895
+ return n();
3896
+ },
3897
+ set buttonEl(a = null) {
3898
+ n(a), ne();
3899
+ },
3900
+ get onClick() {
3901
+ return i();
3902
+ },
3903
+ set onClick(a) {
3904
+ i(a), ne();
3905
+ },
3906
+ get ariaLabel() {
3907
+ return r();
3908
+ },
3909
+ set ariaLabel(a = "Settings") {
3910
+ r(a), ne();
3911
+ },
3912
+ get active() {
3913
+ return o();
3914
+ },
3915
+ set active(a = !1) {
3916
+ o(a), ne();
3917
+ }
3918
+ }, l = Nl();
3919
+ return xi(l, (a) => n(a), () => n()), rt(() => {
3920
+ Je(l, "aria-label", r()), Je(l, "aria-pressed", o());
3921
+ }), we("click", l, function(...a) {
3922
+ i()?.apply(this, a);
3923
+ }), $e(e, l), Ln(s);
3924
+ }
3925
+ wi(["click"]);
3926
+ ki(sr, { buttonEl: {}, onClick: {}, ariaLabel: {}, active: {} }, [], [], { mode: "open" });
3927
+ var zl = /* @__PURE__ */ bt('<div class="fixed inset-0" aria-hidden="true" style="z-index: 4000;"></div> <div class="tool-settings-panel fixed w-80 rounded-box bg-base-100 shadow p-3 text-base-content" role="dialog" tabindex="-1"><div class="flex items-center justify-between gap-2 mb-2"><h2 class="font-semibold text-sm"> </h2> <button type="button" class="btn btn-ghost btn-xs" aria-label="Close settings">Close</button></div> <div class="text-sm"><!></div></div>', 1);
3928
+ function lr(e, t) {
3929
+ An(t, !0);
3930
+ let n = he(t, "open"), i = he(t, "title", 7, "Settings"), r = he(t, "onClose"), o = he(t, "anchorEl", 7, null), s = he(t, "children"), l = /* @__PURE__ */ L(null), a = /* @__PURE__ */ L(null);
3931
+ function u(h) {
3932
+ h.key === "Escape" && r()();
3933
+ }
3934
+ at(() => {
3935
+ n() && queueMicrotask(() => c(l)?.focus?.());
3936
+ }), at(() => {
3937
+ if (n() && o()) {
3938
+ const h = o().getBoundingClientRect(), g = 320, m = 8, C = h.right + m;
3939
+ C + g <= window.innerWidth ? _(a, { top: h.top, left: C }, !0) : _(
3940
+ a,
3941
+ {
3942
+ top: h.top,
3943
+ right: window.innerWidth - h.left + m
3944
+ },
3945
+ !0
3946
+ );
3947
+ } else
3948
+ _(a, null);
3949
+ }), er(() => {
3950
+ const h = (g) => {
3951
+ if (!n()) return;
3952
+ const m = g.target;
3953
+ m && (c(l)?.contains(m) || o()?.contains(m) || r()());
3954
+ };
3955
+ return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
3956
+ });
3957
+ var f = {
3958
+ get open() {
3959
+ return n();
3960
+ },
3961
+ set open(h) {
3962
+ n(h), ne();
3963
+ },
3964
+ get title() {
3965
+ return i();
3966
+ },
3967
+ set title(h = "Settings") {
3968
+ i(h), ne();
3969
+ },
3970
+ get onClose() {
3971
+ return r();
3972
+ },
3973
+ set onClose(h) {
3974
+ r(h), ne();
3975
+ },
3976
+ get anchorEl() {
3977
+ return o();
3978
+ },
3979
+ set anchorEl(h = null) {
3980
+ o(h), ne();
3981
+ },
3982
+ get children() {
3983
+ return s();
3984
+ },
3985
+ set children(h) {
3986
+ s(h), ne();
3987
+ }
3988
+ }, v = Ko(), p = ot(v);
3989
+ {
3990
+ var b = (h) => {
3991
+ var g = zl(), m = ot(g), C = j(m, 2), x = D(C), P = D(x), le = D(P, !0);
3992
+ q(P);
3993
+ var V = j(P, 2);
3994
+ q(x);
3995
+ var U = j(x, 2), ae = D(U);
3996
+ Ws(ae, () => s() ?? to), q(U), q(C), xi(C, (k) => _(l, k), () => c(l)), rt(() => {
3997
+ Je(C, "aria-label", i()), De(C, `z-index: 4100; ${c(a) ? `top: ${c(a).top}px; ${c(a).left !== void 0 ? `left: ${c(a).left}px;` : `right: ${c(a).right}px;`}` : "top: 4rem; right: 1rem;"}`), vn(le, i());
3998
+ }), we("mousedown", m, function(...k) {
3999
+ r()?.apply(this, k);
4000
+ }), we("keydown", C, u), we("click", V, function(...k) {
4001
+ r()?.apply(this, k);
4002
+ }), $e(h, g);
4003
+ };
4004
+ bn(p, (h) => {
4005
+ n() && h(b);
4006
+ });
4007
+ }
4008
+ return $e(e, v), Ln(f);
4009
+ }
4010
+ wi(["mousedown", "keydown", "click"]);
4011
+ ki(lr, { open: {}, title: {}, onClose: {}, anchorEl: {}, children: {} }, [], [], { mode: "open" });
4012
+ var Wl = /* @__PURE__ */ bt('<div class="pie-tool-line-reader__mask pie-tool-line-reader__mask--top svelte-1a3d6dx" aria-hidden="true"></div> <div class="pie-tool-line-reader__mask pie-tool-line-reader__mask--bottom svelte-1a3d6dx" aria-hidden="true"></div> <div class="pie-tool-line-reader__mask pie-tool-line-reader__mask--left svelte-1a3d6dx" aria-hidden="true"></div> <div class="pie-tool-line-reader__mask pie-tool-line-reader__mask--right svelte-1a3d6dx" aria-hidden="true"></div>', 1), Hl = /* @__PURE__ */ bt('<label><input type="radio" name="color"/> <div class="color-swatch"></div> <span> </span></label>'), ql = /* @__PURE__ */ bt('<fieldset class="setting-group"><legend>Color</legend> <!></fieldset> <div class="setting-group"><div class="setting-label"><span>Opacity</span> <span class="setting-value" aria-live="polite"> </span></div> <input type="range" min="10" max="90" step="5" aria-label="Opacity" aria-valuemin="10" aria-valuemax="90"/></div>', 1), Dl = /* @__PURE__ */ bt('<fieldset class="setting-group"><legend>Mode</legend> <label><input type="radio" name="mode" value="highlight"/> <span>Highlight</span></label> <label><input type="radio" name="mode" value="obscure"/> <span>Masking</span></label></fieldset> <!>', 1), Fl = /* @__PURE__ */ bt('<div class="pie-sr-only svelte-1a3d6dx" role="status" aria-live="polite" aria-atomic="true"> </div> <!> <div role="application" tabindex="0" aria-roledescription="Draggable and resizable reading guide overlay"><div class="pie-tool-line-reader__container svelte-1a3d6dx"><!></div> <div class="pie-tool-line-reader__resize-handle pie-tool-line-reader__resize-handle--bottom svelte-1a3d6dx" title="Drag to resize height" role="button" tabindex="-1" aria-label="Resize handle - drag to adjust height"><svg width="20" height="8" viewBox="0 0 20 8" aria-hidden="true"><rect x="8" y="3" width="4" height="2" fill="#4CAF50" rx="1"></rect></svg></div></div> <!>', 1);
4013
+ const Gl = {
4014
+ hash: "svelte-1a3d6dx",
4015
+ code: `.pie-sr-only.svelte-1a3d6dx {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;}.pie-tool-line-reader.svelte-1a3d6dx {border:2px solid rgba(76, 175, 80, 0.8);cursor:move;overflow:visible;position:absolute;transform:translate(-50%, -50%);user-select:none;pointer-events:auto;touch-action:none;}.pie-tool-line-reader.svelte-1a3d6dx:focus {outline:3px solid #4A90E2;outline-offset:2px;}.pie-tool-line-reader.svelte-1a3d6dx:focus-visible {outline:3px solid #4A90E2;outline-offset:2px;}.pie-tool-line-reader__container.svelte-1a3d6dx {width:100%;height:100%;position:relative;transition:background-color 0.2s ease;}.pie-tool-line-reader__resize-handle.svelte-1a3d6dx {position:absolute;cursor:ns-resize;z-index:10;display:flex;align-items:center;justify-content:center;}.pie-tool-line-reader__resize-handle--bottom.svelte-1a3d6dx {bottom:-10px;left:50%;transform:translateX(-50%);width:40px;height:16px;background-color:rgba(255, 255, 255, 0.9);border-radius:8px;border:2px solid #4CAF50;}.pie-tool-line-reader__resize-handle.svelte-1a3d6dx:hover {background-color:rgba(76, 175, 80, 0.2);}.pie-tool-line-reader__resize-handle.svelte-1a3d6dx:active {cursor:ns-resize;}.pie-tool-line-reader.svelte-1a3d6dx:active {cursor:grabbing;}
4016
+
4017
+ /* Masking overlays for obscure mode - 4 rectangles covering all areas except line reader window */.pie-tool-line-reader__mask.svelte-1a3d6dx {position:fixed;background:rgba(0, 0, 0, 0.85);z-index:999;pointer-events:none;}.pie-tool-line-reader__mask--top.svelte-1a3d6dx {top:0;left:0;right:0;
4018
+ /* Height set via inline style */}.pie-tool-line-reader__mask--bottom.svelte-1a3d6dx {
4019
+ /* Top set via inline style */left:0;right:0;bottom:0;}.pie-tool-line-reader__mask--left.svelte-1a3d6dx {
4020
+ /* Top, height, and width set via inline style */left:0;}.pie-tool-line-reader__mask--right.svelte-1a3d6dx {
4021
+ /* Top, height, and left set via inline style */right:0;}
4022
+
4023
+ /* In masking mode, change the window appearance */.pie-tool-line-reader.pie-tool-line-reader--masking-mode.svelte-1a3d6dx {border-color:rgba(76, 175, 80, 1);box-shadow:0 0 0 3px rgba(76, 175, 80, 0.8), 0 0 20px rgba(76, 175, 80, 0.4);}
4024
+
4025
+ /* In masking mode, the window should be transparent to show content underneath */.pie-tool-line-reader.pie-tool-line-reader--masking-mode.svelte-1a3d6dx .pie-tool-line-reader__container:where(.svelte-1a3d6dx) {background-color:transparent !important;}`
4026
+ };
4027
+ function Bl(e, t) {
4028
+ An(t, !0), tr(e, Gl);
4029
+ let n = he(t, "visible", 7, !1), i = he(t, "toolId", 7, "lineReader");
4030
+ const r = typeof window < "u";
4031
+ let o = /* @__PURE__ */ L(void 0), s = /* @__PURE__ */ L(null);
4032
+ const l = /* @__PURE__ */ Ni(() => c(s)?.toolCoordinator);
4033
+ let a = /* @__PURE__ */ L(void 0), u = /* @__PURE__ */ L(!1), f = /* @__PURE__ */ L(!1), v = /* @__PURE__ */ L(Ve({
4034
+ x: r ? window.innerWidth / 2 : 400,
4035
+ y: r ? window.innerHeight / 2 : 300
4036
+ })), p = /* @__PURE__ */ L(Ve({ width: 600, height: 60 })), b = /* @__PURE__ */ L(Ve({ x: 0, y: 0 })), h = /* @__PURE__ */ L(Ve({ width: 0, height: 0, mouseY: 0 })), g = /* @__PURE__ */ L(""), m = /* @__PURE__ */ L(
4037
+ "#ffff00"
4038
+ // Yellow
4039
+ ), C = /* @__PURE__ */ L(0.3), x = /* @__PURE__ */ L("highlight"), P = /* @__PURE__ */ L(!1), le = /* @__PURE__ */ L(!1);
4040
+ const V = [
4041
+ { name: "Yellow", value: "#ffff00" },
4042
+ { name: "Blue", value: "#00bfff" },
4043
+ { name: "Pink", value: "#ff69b4" },
4044
+ { name: "Green", value: "#00ff7f" },
4045
+ { name: "Orange", value: "#ffa500" }
4046
+ ], U = 10, ae = 10;
4047
+ at(() => {
4048
+ if (c(o))
4049
+ return ul(c(o), (y) => {
4050
+ _(s, y, !0);
4051
+ });
4052
+ });
4053
+ function k(y) {
4054
+ _(g, y, !0), setTimeout(() => _(g, ""), 1e3);
4055
+ }
4056
+ function Nn() {
4057
+ const y = (V.findIndex((E) => E.value === c(m)) + 1) % V.length;
4058
+ _(m, V[y].value, !0), k(`Color changed to ${V[y].name}`);
4059
+ }
4060
+ function rn(y) {
4061
+ _(C, Math.max(0.1, Math.min(0.9, c(C) + y)), !0), k(`Opacity ${Math.round(c(C) * 100)}%`);
4062
+ }
4063
+ function ar() {
4064
+ _(x, c(x) === "highlight" ? "obscure" : "highlight", !0), k(`Mode changed to ${c(x) === "highlight" ? "highlight" : "masking"}`);
4065
+ }
4066
+ function ur() {
4067
+ _(P, !c(P));
4068
+ }
4069
+ function cr() {
4070
+ _(P, !1);
4071
+ }
4072
+ function dr(y) {
4073
+ _(m, y, !0);
4074
+ const E = V.find((Vt) => Vt.value === y)?.name || "Unknown";
4075
+ k(`Color changed to ${E}`);
4076
+ }
4077
+ function hr(y) {
4078
+ const E = y.target;
4079
+ if (E.closest(".resize-handle"))
4080
+ pr(y);
4081
+ else {
4082
+ if (E.closest(".tool-settings-button") || E.closest(".tool-settings-panel"))
4083
+ return;
4084
+ fr(y);
4085
+ }
4086
+ }
4087
+ function fr(y) {
4088
+ c(o) && (c(o).setPointerCapture(y.pointerId), _(u, !0), _(
4089
+ b,
4090
+ {
4091
+ x: y.clientX - c(v).x,
4092
+ y: y.clientY - c(v).y
4093
+ },
4094
+ !0
4095
+ ), c(l)?.bringToFront(c(o)), c(o).addEventListener("pointermove", Pn), c(o).addEventListener("pointerup", zn), y.preventDefault());
4096
+ }
4097
+ function pr(y) {
4098
+ c(o) && (c(o).setPointerCapture(y.pointerId), _(f, !0), _(
4099
+ h,
4100
+ {
4101
+ width: c(p).width,
4102
+ height: c(p).height,
4103
+ mouseY: y.clientY
4104
+ },
4105
+ !0
4106
+ ), c(l)?.bringToFront(c(o)), c(o).addEventListener("pointermove", Pn), c(o).addEventListener("pointerup", zn), y.preventDefault(), y.stopPropagation());
4107
+ }
4108
+ function Pn(y) {
4109
+ if (c(u))
4110
+ _(
4111
+ v,
4112
+ {
4113
+ x: y.clientX - c(b).x,
4114
+ y: y.clientY - c(b).y
4115
+ },
4116
+ !0
4117
+ );
4118
+ else if (c(f)) {
4119
+ const E = y.clientY - c(h).mouseY;
4120
+ c(p).height = Math.max(20, Math.min(400, c(h).height + E));
4121
+ }
4122
+ }
4123
+ function zn(y) {
4124
+ c(o) && (c(o).releasePointerCapture(y.pointerId), c(o).removeEventListener("pointermove", Pn), c(o).removeEventListener("pointerup", zn), _(u, !1), _(f, !1));
4125
+ }
4126
+ function vr(y) {
4127
+ let E = !1;
4128
+ switch (y.key) {
4129
+ case "ArrowUp":
4130
+ c(v).y -= U, k(`Moved up to ${Math.round(c(v).y)}`), E = !0;
4131
+ break;
4132
+ case "ArrowDown":
4133
+ c(v).y += U, k(`Moved down to ${Math.round(c(v).y)}`), E = !0;
4134
+ break;
4135
+ case "ArrowLeft":
4136
+ c(v).x -= U, k(`Moved left to ${Math.round(c(v).x)}`), E = !0;
4137
+ break;
4138
+ case "ArrowRight":
4139
+ c(v).x += U, k(`Moved right to ${Math.round(c(v).x)}`), E = !0;
4140
+ break;
4141
+ case "+":
4142
+ case "=":
4143
+ c(p).height = Math.min(400, c(p).height + ae), k(`Height ${c(p).height} pixels`), E = !0;
4144
+ break;
4145
+ case "-":
4146
+ case "_":
4147
+ c(p).height = Math.max(20, c(p).height - ae), k(`Height ${c(p).height} pixels`), E = !0;
4148
+ break;
4149
+ case "c":
4150
+ case "C":
4151
+ Nn(), E = !0;
4152
+ break;
4153
+ case "]":
4154
+ rn(0.1), E = !0;
4155
+ break;
4156
+ case "[":
4157
+ rn(-0.1), E = !0;
4158
+ break;
4159
+ case "m":
4160
+ case "M":
4161
+ ar(), E = !0;
4162
+ break;
4163
+ }
4164
+ E && y.preventDefault();
4165
+ }
4166
+ at(() => {
4167
+ c(l) && i() && !c(le) && (c(l).registerTool(i(), "Line Reader", void 0, si.TOOL), _(le, !0));
4168
+ }), er(() => () => {
4169
+ c(l) && i() && c(l).unregisterTool(i());
4170
+ }), at(() => {
4171
+ c(l) && c(o) && i() && c(l).updateToolElement(i(), c(o));
4172
+ }), at(() => {
4173
+ n() && c(o) && setTimeout(() => c(o)?.focus(), 100);
4174
+ });
4175
+ let gr = /* @__PURE__ */ Ni(() => c(m) + Math.round(c(C) * 255).toString(16).padStart(2, "0"));
4176
+ var br = {
4177
+ get visible() {
4178
+ return n();
4179
+ },
4180
+ set visible(y = !1) {
4181
+ n(y), ne();
4182
+ },
4183
+ get toolId() {
4184
+ return i();
4185
+ },
4186
+ set toolId(y = "lineReader") {
4187
+ i(y), ne();
4188
+ }
4189
+ }, _i = Ko(), mr = ot(_i);
4190
+ {
4191
+ var yr = (y) => {
4192
+ var E = Fl(), Vt = ot(E), wr = D(Vt, !0);
4193
+ q(Vt);
4194
+ var Ti = j(Vt, 2);
4195
+ {
4196
+ var $r = (K) => {
4197
+ var Rt = Wl(), jt = ot(Rt), mt = j(jt, 2), yt = j(mt, 2), Nt = j(yt, 2);
4198
+ rt(
4199
+ (sn, Pt) => {
4200
+ De(jt, `height: ${sn ?? ""}px;`), De(mt, `top: ${c(v).y + c(p).height / 2}px;`), De(yt, `top: ${c(v).y - c(p).height / 2}px; height: ${c(p).height ?? ""}px; width: ${Pt ?? ""}px;`), De(Nt, `top: ${c(v).y - c(p).height / 2}px; height: ${c(p).height ?? ""}px; left: ${c(v).x + c(p).width / 2}px;`);
4201
+ },
4202
+ [
4203
+ () => Math.max(0, c(v).y - c(p).height / 2),
4204
+ () => Math.max(0, c(v).x - c(p).width / 2)
4205
+ ]
4206
+ ), $e(K, Rt);
4207
+ };
4208
+ bn(Ti, (K) => {
4209
+ c(x) === "obscure" && K($r);
4210
+ });
4211
+ }
4212
+ var Se = j(Ti, 2);
4213
+ let Ci;
4214
+ var Wn = D(Se), xr = D(Wn);
4215
+ sr(xr, {
4216
+ onClick: ur,
4217
+ ariaLabel: "Line reader settings",
4218
+ get active() {
4219
+ return c(P);
4220
+ },
4221
+ get buttonEl() {
4222
+ return c(a);
4223
+ },
4224
+ set buttonEl(K) {
4225
+ _(a, K, !0);
4226
+ }
4227
+ }), q(Wn), dn(2), q(Se), xi(Se, (K) => _(o, K), () => c(o));
4228
+ var kr = j(Se, 2);
4229
+ lr(kr, {
4230
+ get open() {
4231
+ return c(P);
4232
+ },
4233
+ title: "Line Reader Settings",
4234
+ onClose: cr,
4235
+ get anchorEl() {
4236
+ return c(a);
4237
+ },
4238
+ children: (K, Rt) => {
4239
+ var jt = Dl(), mt = ot(jt), yt = j(D(mt), 2), Nt = D(yt);
4240
+ un(Nt), dn(2), q(yt);
4241
+ var sn = j(yt, 2), Pt = D(sn);
4242
+ un(Pt), dn(2), q(sn), q(mt);
4243
+ var Ir = j(mt, 2);
4244
+ {
4245
+ var _r = (Hn) => {
4246
+ var Si = ql(), qn = ot(Si), Tr = j(D(qn), 2);
4247
+ Ds(Tr, 17, () => V, Hs, (Wt, et) => {
4248
+ var Ht = Hl(), qt = D(Ht);
4249
+ un(qt);
4250
+ var Li = j(qt, 2), Ei = j(Li, 2), Sr = D(Ei, !0);
4251
+ q(Ei), q(Ht), rt(() => {
4252
+ Gi(qt, c(et).value), Fn(qt, c(m) === c(et).value), De(Li, `background-color: ${c(et).value ?? ""};`), vn(Sr, c(et).name);
4253
+ }), we("change", qt, () => dr(c(et).value)), $e(Wt, Ht);
4254
+ }), q(qn);
4255
+ var Mi = j(qn, 2), Dn = D(Mi), Ai = j(D(Dn), 2), Cr = D(Ai);
4256
+ q(Ai), q(Dn);
4257
+ var zt = j(Dn, 2);
4258
+ un(zt), q(Mi), rt(
4259
+ (Wt, et, Ht) => {
4260
+ vn(Cr, `${Wt ?? ""}%`), Gi(zt, c(C) * 100), Je(zt, "aria-valuenow", et), Je(zt, "aria-valuetext", `${Ht ?? ""} percent`);
4261
+ },
4262
+ [
4263
+ () => Math.round(c(C) * 100),
4264
+ () => Math.round(c(C) * 100),
4265
+ () => Math.round(c(C) * 100)
4266
+ ]
4267
+ ), we("input", zt, (Wt) => {
4268
+ _(C, Number(Wt.currentTarget.value) / 100), k(`Opacity ${Math.round(c(C) * 100)}%`);
4269
+ }), $e(Hn, Si);
4270
+ };
4271
+ bn(Ir, (Hn) => {
4272
+ c(x) === "highlight" && Hn(_r);
4273
+ });
4274
+ }
4275
+ rt(() => {
4276
+ Fn(Nt, c(x) === "highlight"), Fn(Pt, c(x) === "obscure");
4277
+ }), we("change", Nt, () => {
4278
+ _(x, "highlight"), k("Mode changed to highlight");
4279
+ }), we("change", Pt, () => {
4280
+ _(x, "obscure"), k("Mode changed to masking");
4281
+ }), $e(K, jt);
4282
+ },
4283
+ $$slots: { default: !0 }
4284
+ }), rt(
4285
+ (K, Rt) => {
4286
+ vn(wr, c(g)), Ci = Us(Se, 1, "pie-tool-line-reader svelte-1a3d6dx", null, Ci, {
4287
+ "pie-tool-line-reader--masking-mode": c(x) === "obscure"
4288
+ }), De(Se, `left: ${c(v).x ?? ""}px; top: ${c(v).y ?? ""}px; width: ${c(p).width ?? ""}px; height: ${c(p).height ?? ""}px;`), Je(Se, "aria-label", `Line Reader tool. Mode: ${c(x) === "highlight" ? "Highlight" : "Masking"}. Use arrow keys to move, +/- to resize height, C to change color, [ and ] to adjust opacity, M to toggle mode. Current color: ${K ?? ""}, Opacity: ${Rt ?? ""}%`), De(Wn, `background-color: ${c(gr) ?? ""};`);
4289
+ },
4290
+ [
4291
+ () => V.find((K) => K.value === c(m))?.name,
4292
+ () => Math.round(c(C) * 100)
4293
+ ]
4294
+ ), we("pointerdown", Se, hr), we("keydown", Se, vr), $e(y, E);
4295
+ };
4296
+ bn(mr, (y) => {
4297
+ n() && y(yr);
4298
+ });
4299
+ }
4300
+ return $e(e, _i), Ln(br);
4301
+ }
4302
+ wi(["pointerdown", "keydown", "change", "input"]);
4303
+ customElements.define("pie-tool-line-reader", ki(
4304
+ Bl,
4305
+ {
4306
+ visible: { attribute: "visible", type: "Boolean" },
4307
+ toolId: { attribute: "tool-id", type: "String" }
4308
+ },
4309
+ [],
4310
+ [],
4311
+ { mode: "open" }
4312
+ ));
4313
+ export {
4314
+ Bl as default
4315
+ };