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