@pie-players/pie-tool-tts-inline 0.1.1

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,2704 @@
1
+ import { ZIndexLayer as Qn } from "@pie-players/pie-assessment-toolkit";
2
+ const er = "5";
3
+ typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(er);
4
+ const tr = 2, Wt = "[", pt = "[!", Kt = "]", ke = {}, x = /* @__PURE__ */ Symbol(), nr = "http://www.w3.org/1999/xhtml", at = !1;
5
+ var rr = Array.isArray, ir = Array.prototype.indexOf, ze = Array.prototype.includes, sr = Array.from, Ke = Object.keys, Je = Object.defineProperty, xe = Object.getOwnPropertyDescriptor, lr = Object.getOwnPropertyDescriptors, or = Object.prototype, ar = Array.prototype, Jt = Object.getPrototypeOf, Rt = Object.isExtensible;
6
+ function fr(e) {
7
+ for (var t = 0; t < e.length; t++)
8
+ e[t]();
9
+ }
10
+ function Zt() {
11
+ var e, t, n = new Promise((r, i) => {
12
+ e = r, t = i;
13
+ });
14
+ return { promise: n, resolve: e, reject: t };
15
+ }
16
+ const k = 2, Ze = 4, et = 8, Xt = 1 << 24, re = 16, W = 32, ce = 64, gt = 128, D = 512, S = 1024, z = 2048, ie = 4096, U = 8192, Q = 16384, tt = 32768, Ae = 65536, Nt = 1 << 17, Qt = 1 << 18, be = 1 << 19, ur = 1 << 20, ge = 32768, ft = 1 << 21, mt = 1 << 22, ae = 1 << 23, Ue = /* @__PURE__ */ Symbol("$state"), cr = /* @__PURE__ */ Symbol("legacy props"), hr = /* @__PURE__ */ Symbol(""), Te = new class extends Error {
17
+ name = "StaleReactionError";
18
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
19
+ }(), nt = 3, je = 8;
20
+ function dr() {
21
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
22
+ }
23
+ function vr(e) {
24
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
25
+ }
26
+ function _r() {
27
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
28
+ }
29
+ function pr(e) {
30
+ throw new Error("https://svelte.dev/e/effect_orphan");
31
+ }
32
+ function gr() {
33
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
34
+ }
35
+ function mr() {
36
+ throw new Error("https://svelte.dev/e/hydration_failed");
37
+ }
38
+ function wr() {
39
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
40
+ }
41
+ function br() {
42
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
43
+ }
44
+ function yr() {
45
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
46
+ }
47
+ function $r() {
48
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
49
+ }
50
+ function rt(e) {
51
+ console.warn("https://svelte.dev/e/hydration_mismatch");
52
+ }
53
+ function Er() {
54
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
55
+ }
56
+ let b = !1;
57
+ function Se(e) {
58
+ b = e;
59
+ }
60
+ let m;
61
+ function Y(e) {
62
+ if (e === null)
63
+ throw rt(), ke;
64
+ return m = e;
65
+ }
66
+ function wt() {
67
+ return Y(/* @__PURE__ */ se(m));
68
+ }
69
+ function lt(e) {
70
+ if (b) {
71
+ if (/* @__PURE__ */ se(m) !== null)
72
+ throw rt(), ke;
73
+ m = e;
74
+ }
75
+ }
76
+ function Tr(e = 1) {
77
+ if (b) {
78
+ for (var t = e, n = m; t--; )
79
+ n = /** @type {TemplateNode} */
80
+ /* @__PURE__ */ se(n);
81
+ m = n;
82
+ }
83
+ }
84
+ function en(e = !0) {
85
+ for (var t = 0, n = m; ; ) {
86
+ if (n.nodeType === je) {
87
+ var r = (
88
+ /** @type {Comment} */
89
+ n.data
90
+ );
91
+ if (r === Kt) {
92
+ if (t === 0) return n;
93
+ t -= 1;
94
+ } else (r === Wt || r === pt) && (t += 1);
95
+ }
96
+ var i = (
97
+ /** @type {TemplateNode} */
98
+ /* @__PURE__ */ se(n)
99
+ );
100
+ e && n.remove(), n = i;
101
+ }
102
+ }
103
+ function Sr(e) {
104
+ if (!e || e.nodeType !== je)
105
+ throw rt(), ke;
106
+ return (
107
+ /** @type {Comment} */
108
+ e.data
109
+ );
110
+ }
111
+ function tn(e) {
112
+ return e === this.v;
113
+ }
114
+ function xr(e, t) {
115
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
116
+ }
117
+ function kr(e) {
118
+ return !xr(e, this.v);
119
+ }
120
+ let zr = !1, L = null;
121
+ function Ce(e) {
122
+ L = e;
123
+ }
124
+ function nn(e, t = !1, n) {
125
+ L = {
126
+ p: L,
127
+ i: !1,
128
+ c: null,
129
+ e: null,
130
+ s: e,
131
+ x: null,
132
+ l: null
133
+ };
134
+ }
135
+ function rn(e) {
136
+ var t = (
137
+ /** @type {ComponentContext} */
138
+ L
139
+ ), n = t.e;
140
+ if (n !== null) {
141
+ t.e = null;
142
+ for (var r of n)
143
+ $n(r);
144
+ }
145
+ return e !== void 0 && (t.x = e), t.i = !0, L = t.p, e ?? /** @type {T} */
146
+ {};
147
+ }
148
+ function sn() {
149
+ return !0;
150
+ }
151
+ let de = [];
152
+ function ln() {
153
+ var e = de;
154
+ de = [], fr(e);
155
+ }
156
+ function _e(e) {
157
+ if (de.length === 0 && !De) {
158
+ var t = de;
159
+ queueMicrotask(() => {
160
+ t === de && ln();
161
+ });
162
+ }
163
+ de.push(e);
164
+ }
165
+ function Ar() {
166
+ for (; de.length > 0; )
167
+ ln();
168
+ }
169
+ function on(e) {
170
+ var t = g;
171
+ if (t === null)
172
+ return _.f |= ae, e;
173
+ if ((t.f & tt) === 0) {
174
+ if ((t.f & gt) === 0)
175
+ throw e;
176
+ t.b.error(e);
177
+ } else
178
+ Re(e, t);
179
+ }
180
+ function Re(e, t) {
181
+ for (; t !== null; ) {
182
+ if ((t.f & gt) !== 0)
183
+ try {
184
+ t.b.error(e);
185
+ return;
186
+ } catch (n) {
187
+ e = n;
188
+ }
189
+ t = t.parent;
190
+ }
191
+ throw e;
192
+ }
193
+ const Cr = -7169;
194
+ function T(e, t) {
195
+ e.f = e.f & Cr | t;
196
+ }
197
+ function bt(e) {
198
+ (e.f & D) !== 0 || e.deps === null ? T(e, S) : T(e, ie);
199
+ }
200
+ function an(e) {
201
+ if (e !== null)
202
+ for (const t of e)
203
+ (t.f & k) === 0 || (t.f & ge) === 0 || (t.f ^= ge, an(
204
+ /** @type {Derived} */
205
+ t.deps
206
+ ));
207
+ }
208
+ function fn(e, t, n) {
209
+ (e.f & z) !== 0 ? t.add(e) : (e.f & ie) !== 0 && n.add(e), an(e.deps), T(e, S);
210
+ }
211
+ const Ve = /* @__PURE__ */ new Set();
212
+ let y = null, V = null, N = [], it = null, ut = !1, De = !1;
213
+ class ee {
214
+ committed = !1;
215
+ /**
216
+ * The current values of any sources that are updated in this batch
217
+ * They keys of this map are identical to `this.#previous`
218
+ * @type {Map<Source, any>}
219
+ */
220
+ current = /* @__PURE__ */ new Map();
221
+ /**
222
+ * The values of any sources that are updated in this batch _before_ those updates took place.
223
+ * They keys of this map are identical to `this.#current`
224
+ * @type {Map<Source, any>}
225
+ */
226
+ previous = /* @__PURE__ */ new Map();
227
+ /**
228
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
229
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
230
+ * @type {Set<() => void>}
231
+ */
232
+ #e = /* @__PURE__ */ new Set();
233
+ /**
234
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
235
+ * @type {Set<(batch: Batch) => void>}
236
+ */
237
+ #t = /* @__PURE__ */ new Set();
238
+ /**
239
+ * The number of async effects that are currently in flight
240
+ */
241
+ #n = 0;
242
+ /**
243
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
244
+ */
245
+ #s = 0;
246
+ /**
247
+ * A deferred that resolves when the batch is committed, used with `settled()`
248
+ * TODO replace with Promise.withResolvers once supported widely enough
249
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
250
+ */
251
+ #l = null;
252
+ /**
253
+ * Deferred effects (which run after async work has completed) that are DIRTY
254
+ * @type {Set<Effect>}
255
+ */
256
+ #i = /* @__PURE__ */ new Set();
257
+ /**
258
+ * Deferred effects that are MAYBE_DIRTY
259
+ * @type {Set<Effect>}
260
+ */
261
+ #r = /* @__PURE__ */ new Set();
262
+ /**
263
+ * A set of branches that still exist, but will be destroyed when this batch
264
+ * is committed — we skip over these during `process`
265
+ * @type {Set<Effect>}
266
+ */
267
+ skipped_effects = /* @__PURE__ */ new Set();
268
+ is_fork = !1;
269
+ #o = !1;
270
+ is_deferred() {
271
+ return this.is_fork || this.#s > 0;
272
+ }
273
+ /**
274
+ *
275
+ * @param {Effect[]} root_effects
276
+ */
277
+ process(t) {
278
+ N = [], this.apply();
279
+ var n = [], r = [];
280
+ for (const i of t)
281
+ this.#a(i, n, r);
282
+ if (this.is_deferred()) {
283
+ this.#f(r), this.#f(n);
284
+ for (const i of this.skipped_effects)
285
+ dn(i);
286
+ } else {
287
+ for (const i of this.#e) i();
288
+ this.#e.clear(), this.#n === 0 && this.#u(), y = null, Ot(r), Ot(n), this.#l?.resolve();
289
+ }
290
+ V = null;
291
+ }
292
+ /**
293
+ * Traverse the effect tree, executing effects or stashing
294
+ * them for later execution as appropriate
295
+ * @param {Effect} root
296
+ * @param {Effect[]} effects
297
+ * @param {Effect[]} render_effects
298
+ */
299
+ #a(t, n, r) {
300
+ t.f ^= S;
301
+ for (var i = t.first, s = null; i !== null; ) {
302
+ var l = i.f, o = (l & (W | ce)) !== 0, a = o && (l & S) !== 0, f = a || (l & U) !== 0 || this.skipped_effects.has(i);
303
+ if (!f && i.fn !== null) {
304
+ o ? i.f ^= S : s !== null && (l & (Ze | et | Xt)) !== 0 ? s.b.defer_effect(i) : (l & Ze) !== 0 ? n.push(i) : He(i) && ((l & re) !== 0 && this.#r.add(i), Fe(i));
305
+ var c = i.first;
306
+ if (c !== null) {
307
+ i = c;
308
+ continue;
309
+ }
310
+ }
311
+ var d = i.parent;
312
+ for (i = i.next; i === null && d !== null; )
313
+ d === s && (s = null), i = d.next, d = d.parent;
314
+ }
315
+ }
316
+ /**
317
+ * @param {Effect[]} effects
318
+ */
319
+ #f(t) {
320
+ for (var n = 0; n < t.length; n += 1)
321
+ fn(t[n], this.#i, this.#r);
322
+ }
323
+ /**
324
+ * Associate a change to a given source with the current
325
+ * batch, noting its previous and current values
326
+ * @param {Source} source
327
+ * @param {any} value
328
+ */
329
+ capture(t, n) {
330
+ n !== x && !this.previous.has(t) && this.previous.set(t, n), (t.f & ae) === 0 && (this.current.set(t, t.v), V?.set(t, t.v));
331
+ }
332
+ activate() {
333
+ y = this, this.apply();
334
+ }
335
+ deactivate() {
336
+ y === this && (y = null, V = null);
337
+ }
338
+ flush() {
339
+ if (this.activate(), N.length > 0) {
340
+ if (un(), y !== null && y !== this)
341
+ return;
342
+ } else this.#n === 0 && this.process([]);
343
+ this.deactivate();
344
+ }
345
+ discard() {
346
+ for (const t of this.#t) t(this);
347
+ this.#t.clear();
348
+ }
349
+ #u() {
350
+ if (Ve.size > 1) {
351
+ this.previous.clear();
352
+ var t = V, n = !0;
353
+ for (const i of Ve) {
354
+ if (i === this) {
355
+ n = !1;
356
+ continue;
357
+ }
358
+ const s = [];
359
+ for (const [o, a] of this.current) {
360
+ if (i.current.has(o))
361
+ if (n && a !== i.current.get(o))
362
+ i.current.set(o, a);
363
+ else
364
+ continue;
365
+ s.push(o);
366
+ }
367
+ if (s.length === 0)
368
+ continue;
369
+ const l = [...i.current.keys()].filter((o) => !this.current.has(o));
370
+ if (l.length > 0) {
371
+ var r = N;
372
+ N = [];
373
+ const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
374
+ for (const f of s)
375
+ cn(f, l, o, a);
376
+ if (N.length > 0) {
377
+ y = i, i.apply();
378
+ for (const f of N)
379
+ i.#a(f, [], []);
380
+ i.deactivate();
381
+ }
382
+ N = r;
383
+ }
384
+ }
385
+ y = null, V = t;
386
+ }
387
+ this.committed = !0, Ve.delete(this);
388
+ }
389
+ /**
390
+ *
391
+ * @param {boolean} blocking
392
+ */
393
+ increment(t) {
394
+ this.#n += 1, t && (this.#s += 1);
395
+ }
396
+ /**
397
+ *
398
+ * @param {boolean} blocking
399
+ */
400
+ decrement(t) {
401
+ this.#n -= 1, t && (this.#s -= 1), !this.#o && (this.#o = !0, _e(() => {
402
+ this.#o = !1, this.is_deferred() ? N.length > 0 && this.flush() : this.revive();
403
+ }));
404
+ }
405
+ revive() {
406
+ for (const t of this.#i)
407
+ this.#r.delete(t), T(t, z), te(t);
408
+ for (const t of this.#r)
409
+ T(t, ie), te(t);
410
+ this.flush();
411
+ }
412
+ /** @param {() => void} fn */
413
+ oncommit(t) {
414
+ this.#e.add(t);
415
+ }
416
+ /** @param {(batch: Batch) => void} fn */
417
+ ondiscard(t) {
418
+ this.#t.add(t);
419
+ }
420
+ settled() {
421
+ return (this.#l ??= Zt()).promise;
422
+ }
423
+ static ensure() {
424
+ if (y === null) {
425
+ const t = y = new ee();
426
+ Ve.add(y), De || _e(() => {
427
+ y === t && t.flush();
428
+ });
429
+ }
430
+ return y;
431
+ }
432
+ apply() {
433
+ }
434
+ }
435
+ function le(e) {
436
+ var t = De;
437
+ De = !0;
438
+ try {
439
+ for (var n; ; ) {
440
+ if (Ar(), N.length === 0 && (y?.flush(), N.length === 0))
441
+ return it = null, /** @type {T} */
442
+ n;
443
+ un();
444
+ }
445
+ } finally {
446
+ De = t;
447
+ }
448
+ }
449
+ function un() {
450
+ ut = !0;
451
+ var e = null;
452
+ try {
453
+ for (var t = 0; N.length > 0; ) {
454
+ var n = ee.ensure();
455
+ if (t++ > 1e3) {
456
+ var r, i;
457
+ Rr();
458
+ }
459
+ n.process(N), fe.clear();
460
+ }
461
+ } finally {
462
+ ut = !1, it = null;
463
+ }
464
+ }
465
+ function Rr() {
466
+ try {
467
+ gr();
468
+ } catch (e) {
469
+ Re(e, it);
470
+ }
471
+ }
472
+ let Z = null;
473
+ function Ot(e) {
474
+ var t = e.length;
475
+ if (t !== 0) {
476
+ for (var n = 0; n < t; ) {
477
+ var r = e[n++];
478
+ if ((r.f & (Q | U)) === 0 && He(r) && (Z = /* @__PURE__ */ new Set(), Fe(r), r.deps === null && r.first === null && r.nodes === null && (r.teardown === null && r.ac === null ? kn(r) : r.fn = null), Z?.size > 0)) {
479
+ fe.clear();
480
+ for (const i of Z) {
481
+ if ((i.f & (Q | U)) !== 0) continue;
482
+ const s = [i];
483
+ let l = i.parent;
484
+ for (; l !== null; )
485
+ Z.has(l) && (Z.delete(l), s.push(l)), l = l.parent;
486
+ for (let o = s.length - 1; o >= 0; o--) {
487
+ const a = s[o];
488
+ (a.f & (Q | U)) === 0 && Fe(a);
489
+ }
490
+ }
491
+ Z.clear();
492
+ }
493
+ }
494
+ Z = null;
495
+ }
496
+ }
497
+ function cn(e, t, n, r) {
498
+ if (!n.has(e) && (n.add(e), e.reactions !== null))
499
+ for (const i of e.reactions) {
500
+ const s = i.f;
501
+ (s & k) !== 0 ? cn(
502
+ /** @type {Derived} */
503
+ i,
504
+ t,
505
+ n,
506
+ r
507
+ ) : (s & (mt | re)) !== 0 && (s & z) === 0 && hn(i, t, r) && (T(i, z), te(
508
+ /** @type {Effect} */
509
+ i
510
+ ));
511
+ }
512
+ }
513
+ function hn(e, t, n) {
514
+ const r = n.get(e);
515
+ if (r !== void 0) return r;
516
+ if (e.deps !== null)
517
+ for (const i of e.deps) {
518
+ if (ze.call(t, i))
519
+ return !0;
520
+ if ((i.f & k) !== 0 && hn(
521
+ /** @type {Derived} */
522
+ i,
523
+ t,
524
+ n
525
+ ))
526
+ return n.set(
527
+ /** @type {Derived} */
528
+ i,
529
+ !0
530
+ ), !0;
531
+ }
532
+ return n.set(e, !1), !1;
533
+ }
534
+ function te(e) {
535
+ for (var t = it = e; t.parent !== null; ) {
536
+ t = t.parent;
537
+ var n = t.f;
538
+ if (ut && t === g && (n & re) !== 0 && (n & Qt) === 0)
539
+ return;
540
+ if ((n & (ce | W)) !== 0) {
541
+ if ((n & S) === 0) return;
542
+ t.f ^= S;
543
+ }
544
+ }
545
+ N.push(t);
546
+ }
547
+ function dn(e) {
548
+ if (!((e.f & W) !== 0 && (e.f & S) !== 0)) {
549
+ T(e, S);
550
+ for (var t = e.first; t !== null; )
551
+ dn(t), t = t.next;
552
+ }
553
+ }
554
+ function Nr(e) {
555
+ let t = 0, n = Be(0), r;
556
+ return () => {
557
+ Tt() && (p(n), St(() => (t === 0 && (r = Ln(() => e(() => Pe(n)))), t += 1, () => {
558
+ _e(() => {
559
+ t -= 1, t === 0 && (r?.(), r = void 0, Pe(n));
560
+ });
561
+ })));
562
+ };
563
+ }
564
+ var Or = Ae | be | gt;
565
+ function Ir(e, t, n) {
566
+ new Mr(e, t, n);
567
+ }
568
+ class Mr {
569
+ /** @type {Boundary | null} */
570
+ parent;
571
+ is_pending = !1;
572
+ /** @type {TemplateNode} */
573
+ #e;
574
+ /** @type {TemplateNode | null} */
575
+ #t = b ? m : null;
576
+ /** @type {BoundaryProps} */
577
+ #n;
578
+ /** @type {((anchor: Node) => void)} */
579
+ #s;
580
+ /** @type {Effect} */
581
+ #l;
582
+ /** @type {Effect | null} */
583
+ #i = null;
584
+ /** @type {Effect | null} */
585
+ #r = null;
586
+ /** @type {Effect | null} */
587
+ #o = null;
588
+ /** @type {DocumentFragment | null} */
589
+ #a = null;
590
+ /** @type {TemplateNode | null} */
591
+ #f = null;
592
+ #u = 0;
593
+ #c = 0;
594
+ #v = !1;
595
+ #d = !1;
596
+ /** @type {Set<Effect>} */
597
+ #_ = /* @__PURE__ */ new Set();
598
+ /** @type {Set<Effect>} */
599
+ #p = /* @__PURE__ */ new Set();
600
+ /**
601
+ * A source containing the number of pending async deriveds/expressions.
602
+ * Only created if `$effect.pending()` is used inside the boundary,
603
+ * otherwise updating the source results in needless `Batch.ensure()`
604
+ * calls followed by no-op flushes
605
+ * @type {Source<number> | null}
606
+ */
607
+ #h = null;
608
+ #y = Nr(() => (this.#h = Be(this.#u), () => {
609
+ this.#h = null;
610
+ }));
611
+ /**
612
+ * @param {TemplateNode} node
613
+ * @param {BoundaryProps} props
614
+ * @param {((anchor: Node) => void)} children
615
+ */
616
+ constructor(t, n, r) {
617
+ this.#e = t, this.#n = n, this.#s = r, this.parent = /** @type {Effect} */
618
+ g.b, this.is_pending = !!this.#n.pending, this.#l = Tn(() => {
619
+ if (g.b = this, b) {
620
+ const s = this.#t;
621
+ wt(), /** @type {Comment} */
622
+ s.nodeType === je && /** @type {Comment} */
623
+ s.data === pt ? this.#E() : (this.#$(), this.#c === 0 && (this.is_pending = !1));
624
+ } else {
625
+ var i = this.#w();
626
+ try {
627
+ this.#i = X(() => r(i));
628
+ } catch (s) {
629
+ this.error(s);
630
+ }
631
+ this.#c > 0 ? this.#m() : this.is_pending = !1;
632
+ }
633
+ return () => {
634
+ this.#f?.remove();
635
+ };
636
+ }, Or), b && (this.#e = m);
637
+ }
638
+ #$() {
639
+ try {
640
+ this.#i = X(() => this.#s(this.#e));
641
+ } catch (t) {
642
+ this.error(t);
643
+ }
644
+ }
645
+ #E() {
646
+ const t = this.#n.pending;
647
+ t && (this.#r = X(() => t(this.#e)), _e(() => {
648
+ var n = this.#w();
649
+ this.#i = this.#g(() => (ee.ensure(), X(() => this.#s(n)))), this.#c > 0 ? this.#m() : (Le(
650
+ /** @type {Effect} */
651
+ this.#r,
652
+ () => {
653
+ this.#r = null;
654
+ }
655
+ ), this.is_pending = !1);
656
+ }));
657
+ }
658
+ #w() {
659
+ var t = this.#e;
660
+ return this.is_pending && (this.#f = ne(), this.#e.before(this.#f), t = this.#f), t;
661
+ }
662
+ /**
663
+ * Defer an effect inside a pending boundary until the boundary resolves
664
+ * @param {Effect} effect
665
+ */
666
+ defer_effect(t) {
667
+ fn(t, this.#_, this.#p);
668
+ }
669
+ /**
670
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
671
+ * @returns {boolean}
672
+ */
673
+ is_rendered() {
674
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
675
+ }
676
+ has_pending_snippet() {
677
+ return !!this.#n.pending;
678
+ }
679
+ /**
680
+ * @param {() => Effect | null} fn
681
+ */
682
+ #g(t) {
683
+ var n = g, r = _, i = L;
684
+ G(this.#l), F(this.#l), Ce(this.#l.ctx);
685
+ try {
686
+ return t();
687
+ } catch (s) {
688
+ return on(s), null;
689
+ } finally {
690
+ G(n), F(r), Ce(i);
691
+ }
692
+ }
693
+ #m() {
694
+ const t = (
695
+ /** @type {(anchor: Node) => void} */
696
+ this.#n.pending
697
+ );
698
+ this.#i !== null && (this.#a = document.createDocumentFragment(), this.#a.append(
699
+ /** @type {TemplateNode} */
700
+ this.#f
701
+ ), Cn(this.#i, this.#a)), this.#r === null && (this.#r = X(() => t(this.#e)));
702
+ }
703
+ /**
704
+ * Updates the pending count associated with the currently visible pending snippet,
705
+ * if any, such that we can replace the snippet with content once work is done
706
+ * @param {1 | -1} d
707
+ */
708
+ #b(t) {
709
+ if (!this.has_pending_snippet()) {
710
+ this.parent && this.parent.#b(t);
711
+ return;
712
+ }
713
+ if (this.#c += t, this.#c === 0) {
714
+ this.is_pending = !1;
715
+ for (const n of this.#_)
716
+ T(n, z), te(n);
717
+ for (const n of this.#p)
718
+ T(n, ie), te(n);
719
+ this.#_.clear(), this.#p.clear(), this.#r && Le(this.#r, () => {
720
+ this.#r = null;
721
+ }), this.#a && (this.#e.before(this.#a), this.#a = null);
722
+ }
723
+ }
724
+ /**
725
+ * Update the source that powers `$effect.pending()` inside this boundary,
726
+ * and controls when the current `pending` snippet (if any) is removed.
727
+ * Do not call from inside the class
728
+ * @param {1 | -1} d
729
+ */
730
+ update_pending_count(t) {
731
+ this.#b(t), this.#u += t, !(!this.#h || this.#v) && (this.#v = !0, _e(() => {
732
+ this.#v = !1, this.#h && Xe(this.#h, this.#u);
733
+ }));
734
+ }
735
+ get_effect_pending() {
736
+ return this.#y(), p(
737
+ /** @type {Source<number>} */
738
+ this.#h
739
+ );
740
+ }
741
+ /** @param {unknown} error */
742
+ error(t) {
743
+ var n = this.#n.onerror;
744
+ let r = this.#n.failed;
745
+ if (this.#d || !n && !r)
746
+ throw t;
747
+ this.#i && (C(this.#i), this.#i = null), this.#r && (C(this.#r), this.#r = null), this.#o && (C(this.#o), this.#o = null), b && (Y(
748
+ /** @type {TemplateNode} */
749
+ this.#t
750
+ ), Tr(), Y(en()));
751
+ var i = !1, s = !1;
752
+ const l = () => {
753
+ if (i) {
754
+ Er();
755
+ return;
756
+ }
757
+ i = !0, s && $r(), ee.ensure(), this.#u = 0, this.#o !== null && Le(this.#o, () => {
758
+ this.#o = null;
759
+ }), this.is_pending = this.has_pending_snippet(), this.#i = this.#g(() => (this.#d = !1, X(() => this.#s(this.#e)))), this.#c > 0 ? this.#m() : this.is_pending = !1;
760
+ };
761
+ _e(() => {
762
+ try {
763
+ s = !0, n?.(t, l), s = !1;
764
+ } catch (o) {
765
+ Re(o, this.#l && this.#l.parent);
766
+ }
767
+ r && (this.#o = this.#g(() => {
768
+ ee.ensure(), this.#d = !0;
769
+ try {
770
+ return X(() => {
771
+ r(
772
+ this.#e,
773
+ () => t,
774
+ () => l
775
+ );
776
+ });
777
+ } catch (o) {
778
+ return Re(
779
+ o,
780
+ /** @type {Effect} */
781
+ this.#l.parent
782
+ ), null;
783
+ } finally {
784
+ this.#d = !1;
785
+ }
786
+ }));
787
+ });
788
+ }
789
+ }
790
+ function Dr(e, t, n, r) {
791
+ const i = yt;
792
+ var s = e.filter((u) => !u.settled);
793
+ if (n.length === 0 && s.length === 0) {
794
+ r(t.map(i));
795
+ return;
796
+ }
797
+ var l = y, o = (
798
+ /** @type {Effect} */
799
+ g
800
+ ), a = Pr(), f = s.length === 1 ? s[0].promise : s.length > 1 ? Promise.all(s.map((u) => u.promise)) : null;
801
+ function c(u) {
802
+ a();
803
+ try {
804
+ r(u);
805
+ } catch (h) {
806
+ (o.f & Q) === 0 && Re(h, o);
807
+ }
808
+ l?.deactivate(), ct();
809
+ }
810
+ if (n.length === 0) {
811
+ f.then(() => c(t.map(i)));
812
+ return;
813
+ }
814
+ function d() {
815
+ a(), Promise.all(n.map((u) => /* @__PURE__ */ Lr(u))).then((u) => c([...t.map(i), ...u])).catch((u) => Re(u, o));
816
+ }
817
+ f ? f.then(d) : d();
818
+ }
819
+ function Pr() {
820
+ var e = g, t = _, n = L, r = y;
821
+ return function(s = !0) {
822
+ G(e), F(t), Ce(n), s && r?.activate();
823
+ };
824
+ }
825
+ function ct() {
826
+ G(null), F(null), Ce(null);
827
+ }
828
+ // @__NO_SIDE_EFFECTS__
829
+ function yt(e) {
830
+ var t = k | z, n = _ !== null && (_.f & k) !== 0 ? (
831
+ /** @type {Derived} */
832
+ _
833
+ ) : null;
834
+ return g !== null && (g.f |= be), {
835
+ ctx: L,
836
+ deps: null,
837
+ effects: null,
838
+ equals: tn,
839
+ f: t,
840
+ fn: e,
841
+ reactions: null,
842
+ rv: 0,
843
+ v: (
844
+ /** @type {V} */
845
+ x
846
+ ),
847
+ wv: 0,
848
+ parent: n ?? g,
849
+ ac: null
850
+ };
851
+ }
852
+ // @__NO_SIDE_EFFECTS__
853
+ function Lr(e, t, n) {
854
+ let r = (
855
+ /** @type {Effect | null} */
856
+ g
857
+ );
858
+ r === null && dr();
859
+ var i = (
860
+ /** @type {Boundary} */
861
+ r.b
862
+ ), s = (
863
+ /** @type {Promise<V>} */
864
+ /** @type {unknown} */
865
+ void 0
866
+ ), l = Be(
867
+ /** @type {V} */
868
+ x
869
+ ), o = !_, a = /* @__PURE__ */ new Map();
870
+ return Jr(() => {
871
+ var f = Zt();
872
+ s = f.promise;
873
+ try {
874
+ Promise.resolve(e()).then(f.resolve, f.reject).then(() => {
875
+ c === y && c.committed && c.deactivate(), ct();
876
+ });
877
+ } catch (h) {
878
+ f.reject(h), ct();
879
+ }
880
+ var c = (
881
+ /** @type {Batch} */
882
+ y
883
+ );
884
+ if (o) {
885
+ var d = i.is_rendered();
886
+ i.update_pending_count(1), c.increment(d), a.get(c)?.reject(Te), a.delete(c), a.set(c, f);
887
+ }
888
+ const u = (h, v = void 0) => {
889
+ if (c.activate(), v)
890
+ v !== Te && (l.f |= ae, Xe(l, v));
891
+ else {
892
+ (l.f & ae) !== 0 && (l.f ^= ae), Xe(l, h);
893
+ for (const [E, j] of a) {
894
+ if (a.delete(E), E === c) break;
895
+ j.reject(Te);
896
+ }
897
+ }
898
+ o && (i.update_pending_count(-1), c.decrement(d));
899
+ };
900
+ f.promise.then(u, (h) => u(null, h || "unknown"));
901
+ }), Gr(() => {
902
+ for (const f of a.values())
903
+ f.reject(Te);
904
+ }), new Promise((f) => {
905
+ function c(d) {
906
+ function u() {
907
+ d === s ? f(l) : c(s);
908
+ }
909
+ d.then(u, u);
910
+ }
911
+ c(s);
912
+ });
913
+ }
914
+ // @__NO_SIDE_EFFECTS__
915
+ function Fr(e) {
916
+ const t = /* @__PURE__ */ yt(e);
917
+ return Rn(t), t;
918
+ }
919
+ function vn(e) {
920
+ var t = e.effects;
921
+ if (t !== null) {
922
+ e.effects = null;
923
+ for (var n = 0; n < t.length; n += 1)
924
+ C(
925
+ /** @type {Effect} */
926
+ t[n]
927
+ );
928
+ }
929
+ }
930
+ function jr(e) {
931
+ for (var t = e.parent; t !== null; ) {
932
+ if ((t.f & k) === 0)
933
+ return (t.f & Q) === 0 ? (
934
+ /** @type {Effect} */
935
+ t
936
+ ) : null;
937
+ t = t.parent;
938
+ }
939
+ return null;
940
+ }
941
+ function $t(e) {
942
+ var t, n = g;
943
+ G(jr(e));
944
+ try {
945
+ e.f &= ~ge, vn(e), t = Mn(e);
946
+ } finally {
947
+ G(n);
948
+ }
949
+ return t;
950
+ }
951
+ function _n(e) {
952
+ var t = $t(e);
953
+ if (!e.equals(t) && (e.wv = On(), (!y?.is_fork || e.deps === null) && (e.v = t, e.deps === null))) {
954
+ T(e, S);
955
+ return;
956
+ }
957
+ ue || (V !== null ? (Tt() || y?.is_fork) && V.set(e, t) : bt(e));
958
+ }
959
+ let ht = /* @__PURE__ */ new Set();
960
+ const fe = /* @__PURE__ */ new Map();
961
+ let pn = !1;
962
+ function Be(e, t) {
963
+ var n = {
964
+ f: 0,
965
+ // TODO ideally we could skip this altogether, but it causes type errors
966
+ v: e,
967
+ reactions: null,
968
+ equals: tn,
969
+ rv: 0,
970
+ wv: 0
971
+ };
972
+ return n;
973
+ }
974
+ // @__NO_SIDE_EFFECTS__
975
+ function O(e, t) {
976
+ const n = Be(e);
977
+ return Rn(n), n;
978
+ }
979
+ // @__NO_SIDE_EFFECTS__
980
+ function Br(e, t = !1, n = !0) {
981
+ const r = Be(e);
982
+ return t || (r.equals = kr), r;
983
+ }
984
+ function w(e, t, n = !1) {
985
+ _ !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
986
+ // to ensure we error if state is set inside an inspect effect
987
+ (!q || (_.f & Nt) !== 0) && sn() && (_.f & (k | re | mt | Nt)) !== 0 && (P === null || !ze.call(P, e)) && yr();
988
+ let r = n ? Me(t) : t;
989
+ return Xe(e, r);
990
+ }
991
+ function Xe(e, t) {
992
+ if (!e.equals(t)) {
993
+ var n = e.v;
994
+ ue ? fe.set(e, t) : fe.set(e, n), e.v = t;
995
+ var r = ee.ensure();
996
+ if (r.capture(e, n), (e.f & k) !== 0) {
997
+ const i = (
998
+ /** @type {Derived} */
999
+ e
1000
+ );
1001
+ (e.f & z) !== 0 && $t(i), bt(i);
1002
+ }
1003
+ e.wv = On(), gn(e, z), g !== null && (g.f & S) !== 0 && (g.f & (W | ce)) === 0 && (M === null ? ei([e]) : M.push(e)), !r.is_fork && ht.size > 0 && !pn && Hr();
1004
+ }
1005
+ return t;
1006
+ }
1007
+ function Hr() {
1008
+ pn = !1;
1009
+ for (const e of ht)
1010
+ (e.f & S) !== 0 && T(e, ie), He(e) && Fe(e);
1011
+ ht.clear();
1012
+ }
1013
+ function Pe(e) {
1014
+ w(e, e.v + 1);
1015
+ }
1016
+ function gn(e, t) {
1017
+ var n = e.reactions;
1018
+ if (n !== null)
1019
+ for (var r = n.length, i = 0; i < r; i++) {
1020
+ var s = n[i], l = s.f, o = (l & z) === 0;
1021
+ if (o && T(s, t), (l & k) !== 0) {
1022
+ var a = (
1023
+ /** @type {Derived} */
1024
+ s
1025
+ );
1026
+ V?.delete(a), (l & ge) === 0 && (l & D && (s.f |= ge), gn(a, ie));
1027
+ } else o && ((l & re) !== 0 && Z !== null && Z.add(
1028
+ /** @type {Effect} */
1029
+ s
1030
+ ), te(
1031
+ /** @type {Effect} */
1032
+ s
1033
+ ));
1034
+ }
1035
+ }
1036
+ function Me(e) {
1037
+ if (typeof e != "object" || e === null || Ue in e)
1038
+ return e;
1039
+ const t = Jt(e);
1040
+ if (t !== or && t !== ar)
1041
+ return e;
1042
+ var n = /* @__PURE__ */ new Map(), r = rr(e), i = /* @__PURE__ */ O(0), s = pe, l = (o) => {
1043
+ if (pe === s)
1044
+ return o();
1045
+ var a = _, f = pe;
1046
+ F(null), jt(s);
1047
+ var c = o();
1048
+ return F(a), jt(f), c;
1049
+ };
1050
+ return r && n.set("length", /* @__PURE__ */ O(
1051
+ /** @type {any[]} */
1052
+ e.length
1053
+ )), new Proxy(
1054
+ /** @type {any} */
1055
+ e,
1056
+ {
1057
+ defineProperty(o, a, f) {
1058
+ (!("value" in f) || f.configurable === !1 || f.enumerable === !1 || f.writable === !1) && wr();
1059
+ var c = n.get(a);
1060
+ return c === void 0 ? c = l(() => {
1061
+ var d = /* @__PURE__ */ O(f.value);
1062
+ return n.set(a, d), d;
1063
+ }) : w(c, f.value, !0), !0;
1064
+ },
1065
+ deleteProperty(o, a) {
1066
+ var f = n.get(a);
1067
+ if (f === void 0) {
1068
+ if (a in o) {
1069
+ const c = l(() => /* @__PURE__ */ O(x));
1070
+ n.set(a, c), Pe(i);
1071
+ }
1072
+ } else
1073
+ w(f, x), Pe(i);
1074
+ return !0;
1075
+ },
1076
+ get(o, a, f) {
1077
+ if (a === Ue)
1078
+ return e;
1079
+ var c = n.get(a), d = a in o;
1080
+ if (c === void 0 && (!d || xe(o, a)?.writable) && (c = l(() => {
1081
+ var h = Me(d ? o[a] : x), v = /* @__PURE__ */ O(h);
1082
+ return v;
1083
+ }), n.set(a, c)), c !== void 0) {
1084
+ var u = p(c);
1085
+ return u === x ? void 0 : u;
1086
+ }
1087
+ return Reflect.get(o, a, f);
1088
+ },
1089
+ getOwnPropertyDescriptor(o, a) {
1090
+ var f = Reflect.getOwnPropertyDescriptor(o, a);
1091
+ if (f && "value" in f) {
1092
+ var c = n.get(a);
1093
+ c && (f.value = p(c));
1094
+ } else if (f === void 0) {
1095
+ var d = n.get(a), u = d?.v;
1096
+ if (d !== void 0 && u !== x)
1097
+ return {
1098
+ enumerable: !0,
1099
+ configurable: !0,
1100
+ value: u,
1101
+ writable: !0
1102
+ };
1103
+ }
1104
+ return f;
1105
+ },
1106
+ has(o, a) {
1107
+ if (a === Ue)
1108
+ return !0;
1109
+ var f = n.get(a), c = f !== void 0 && f.v !== x || Reflect.has(o, a);
1110
+ if (f !== void 0 || g !== null && (!c || xe(o, a)?.writable)) {
1111
+ f === void 0 && (f = l(() => {
1112
+ var u = c ? Me(o[a]) : x, h = /* @__PURE__ */ O(u);
1113
+ return h;
1114
+ }), n.set(a, f));
1115
+ var d = p(f);
1116
+ if (d === x)
1117
+ return !1;
1118
+ }
1119
+ return c;
1120
+ },
1121
+ set(o, a, f, c) {
1122
+ var d = n.get(a), u = a in o;
1123
+ if (r && a === "length")
1124
+ for (var h = f; h < /** @type {Source<number>} */
1125
+ d.v; h += 1) {
1126
+ var v = n.get(h + "");
1127
+ v !== void 0 ? w(v, x) : h in o && (v = l(() => /* @__PURE__ */ O(x)), n.set(h + "", v));
1128
+ }
1129
+ if (d === void 0)
1130
+ (!u || xe(o, a)?.writable) && (d = l(() => /* @__PURE__ */ O(void 0)), w(d, Me(f)), n.set(a, d));
1131
+ else {
1132
+ u = d.v !== x;
1133
+ var E = l(() => Me(f));
1134
+ w(d, E);
1135
+ }
1136
+ var j = Reflect.getOwnPropertyDescriptor(o, a);
1137
+ if (j?.set && j.set.call(c, f), !u) {
1138
+ if (r && typeof a == "string") {
1139
+ var Ne = (
1140
+ /** @type {Source<number>} */
1141
+ n.get("length")
1142
+ ), Oe = Number(a);
1143
+ Number.isInteger(Oe) && Oe >= Ne.v && w(Ne, Oe + 1);
1144
+ }
1145
+ Pe(i);
1146
+ }
1147
+ return !0;
1148
+ },
1149
+ ownKeys(o) {
1150
+ p(i);
1151
+ var a = Reflect.ownKeys(o).filter((d) => {
1152
+ var u = n.get(d);
1153
+ return u === void 0 || u.v !== x;
1154
+ });
1155
+ for (var [f, c] of n)
1156
+ c.v !== x && !(f in o) && a.push(f);
1157
+ return a;
1158
+ },
1159
+ setPrototypeOf() {
1160
+ br();
1161
+ }
1162
+ }
1163
+ );
1164
+ }
1165
+ var It, mn, wn, bn;
1166
+ function dt() {
1167
+ if (It === void 0) {
1168
+ It = window, mn = /Firefox/.test(navigator.userAgent);
1169
+ var e = Element.prototype, t = Node.prototype, n = Text.prototype;
1170
+ wn = xe(t, "firstChild").get, bn = xe(t, "nextSibling").get, Rt(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), Rt(n) && (n.__t = void 0);
1171
+ }
1172
+ }
1173
+ function ne(e = "") {
1174
+ return document.createTextNode(e);
1175
+ }
1176
+ // @__NO_SIDE_EFFECTS__
1177
+ function me(e) {
1178
+ return (
1179
+ /** @type {TemplateNode | null} */
1180
+ wn.call(e)
1181
+ );
1182
+ }
1183
+ // @__NO_SIDE_EFFECTS__
1184
+ function se(e) {
1185
+ return (
1186
+ /** @type {TemplateNode | null} */
1187
+ bn.call(e)
1188
+ );
1189
+ }
1190
+ function ot(e, t) {
1191
+ if (!b)
1192
+ return /* @__PURE__ */ me(e);
1193
+ var n = /* @__PURE__ */ me(m);
1194
+ if (n === null)
1195
+ n = m.appendChild(ne());
1196
+ else if (t && n.nodeType !== nt) {
1197
+ var r = ne();
1198
+ return n?.before(r), Y(r), r;
1199
+ }
1200
+ return t && Et(
1201
+ /** @type {Text} */
1202
+ n
1203
+ ), Y(n), n;
1204
+ }
1205
+ function Mt(e, t = !1) {
1206
+ if (!b) {
1207
+ var n = /* @__PURE__ */ me(e);
1208
+ return n instanceof Comment && n.data === "" ? /* @__PURE__ */ se(n) : n;
1209
+ }
1210
+ if (t) {
1211
+ if (m?.nodeType !== nt) {
1212
+ var r = ne();
1213
+ return m?.before(r), Y(r), r;
1214
+ }
1215
+ Et(
1216
+ /** @type {Text} */
1217
+ m
1218
+ );
1219
+ }
1220
+ return m;
1221
+ }
1222
+ function Dt(e, t = 1, n = !1) {
1223
+ let r = b ? m : e;
1224
+ for (var i; t--; )
1225
+ i = r, r = /** @type {TemplateNode} */
1226
+ /* @__PURE__ */ se(r);
1227
+ if (!b)
1228
+ return r;
1229
+ if (n) {
1230
+ if (r?.nodeType !== nt) {
1231
+ var s = ne();
1232
+ return r === null ? i?.after(s) : r.before(s), Y(s), s;
1233
+ }
1234
+ Et(
1235
+ /** @type {Text} */
1236
+ r
1237
+ );
1238
+ }
1239
+ return Y(r), r;
1240
+ }
1241
+ function Vr(e) {
1242
+ e.textContent = "";
1243
+ }
1244
+ function qr() {
1245
+ return !1;
1246
+ }
1247
+ function Et(e) {
1248
+ if (
1249
+ /** @type {string} */
1250
+ e.nodeValue.length < 65536
1251
+ )
1252
+ return;
1253
+ let t = e.nextSibling;
1254
+ for (; t !== null && t.nodeType === nt; )
1255
+ t.remove(), e.nodeValue += /** @type {string} */
1256
+ t.nodeValue, t = e.nextSibling;
1257
+ }
1258
+ function yn(e) {
1259
+ var t = _, n = g;
1260
+ F(null), G(null);
1261
+ try {
1262
+ return e();
1263
+ } finally {
1264
+ F(t), G(n);
1265
+ }
1266
+ }
1267
+ function Yr(e) {
1268
+ g === null && (_ === null && pr(), _r()), ue && vr();
1269
+ }
1270
+ function Ur(e, t) {
1271
+ var n = t.last;
1272
+ n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
1273
+ }
1274
+ function K(e, t, n) {
1275
+ var r = g;
1276
+ r !== null && (r.f & U) !== 0 && (e |= U);
1277
+ var i = {
1278
+ ctx: L,
1279
+ deps: null,
1280
+ nodes: null,
1281
+ f: e | z | D,
1282
+ first: null,
1283
+ fn: t,
1284
+ last: null,
1285
+ next: null,
1286
+ parent: r,
1287
+ b: r && r.b,
1288
+ prev: null,
1289
+ teardown: null,
1290
+ wv: 0,
1291
+ ac: null
1292
+ };
1293
+ if (n)
1294
+ try {
1295
+ Fe(i), i.f |= tt;
1296
+ } catch (o) {
1297
+ throw C(i), o;
1298
+ }
1299
+ else t !== null && te(i);
1300
+ var s = i;
1301
+ if (n && s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
1302
+ (s.f & be) === 0 && (s = s.first, (e & re) !== 0 && (e & Ae) !== 0 && s !== null && (s.f |= Ae)), s !== null && (s.parent = r, r !== null && Ur(s, r), _ !== null && (_.f & k) !== 0 && (e & ce) === 0)) {
1303
+ var l = (
1304
+ /** @type {Derived} */
1305
+ _
1306
+ );
1307
+ (l.effects ??= []).push(s);
1308
+ }
1309
+ return i;
1310
+ }
1311
+ function Tt() {
1312
+ return _ !== null && !q;
1313
+ }
1314
+ function Gr(e) {
1315
+ const t = K(et, null, !1);
1316
+ return T(t, S), t.teardown = e, t;
1317
+ }
1318
+ function Pt(e) {
1319
+ Yr();
1320
+ var t = (
1321
+ /** @type {Effect} */
1322
+ g.f
1323
+ ), n = !_ && (t & W) !== 0 && (t & tt) === 0;
1324
+ if (n) {
1325
+ var r = (
1326
+ /** @type {ComponentContext} */
1327
+ L
1328
+ );
1329
+ (r.e ??= []).push(e);
1330
+ } else
1331
+ return $n(e);
1332
+ }
1333
+ function $n(e) {
1334
+ return K(Ze | ur, e, !1);
1335
+ }
1336
+ function Wr(e) {
1337
+ ee.ensure();
1338
+ const t = K(ce | be, e, !0);
1339
+ return () => {
1340
+ C(t);
1341
+ };
1342
+ }
1343
+ function Kr(e) {
1344
+ ee.ensure();
1345
+ const t = K(ce | be, e, !0);
1346
+ return (n = {}) => new Promise((r) => {
1347
+ n.outro ? Le(t, () => {
1348
+ C(t), r(void 0);
1349
+ }) : (C(t), r(void 0));
1350
+ });
1351
+ }
1352
+ function En(e) {
1353
+ return K(Ze, e, !1);
1354
+ }
1355
+ function Jr(e) {
1356
+ return K(mt | be, e, !0);
1357
+ }
1358
+ function St(e, t = 0) {
1359
+ return K(et | t, e, !0);
1360
+ }
1361
+ function Lt(e, t = [], n = [], r = []) {
1362
+ Dr(r, t, n, (i) => {
1363
+ K(et, () => e(...i.map(p)), !0);
1364
+ });
1365
+ }
1366
+ function Tn(e, t = 0) {
1367
+ var n = K(re | t, e, !0);
1368
+ return n;
1369
+ }
1370
+ function X(e) {
1371
+ return K(W | be, e, !0);
1372
+ }
1373
+ function Sn(e) {
1374
+ var t = e.teardown;
1375
+ if (t !== null) {
1376
+ const n = ue, r = _;
1377
+ Ft(!0), F(null);
1378
+ try {
1379
+ t.call(null);
1380
+ } finally {
1381
+ Ft(n), F(r);
1382
+ }
1383
+ }
1384
+ }
1385
+ function xn(e, t = !1) {
1386
+ var n = e.first;
1387
+ for (e.first = e.last = null; n !== null; ) {
1388
+ const i = n.ac;
1389
+ i !== null && yn(() => {
1390
+ i.abort(Te);
1391
+ });
1392
+ var r = n.next;
1393
+ (n.f & ce) !== 0 ? n.parent = null : C(n, t), n = r;
1394
+ }
1395
+ }
1396
+ function Zr(e) {
1397
+ for (var t = e.first; t !== null; ) {
1398
+ var n = t.next;
1399
+ (t.f & W) === 0 && C(t), t = n;
1400
+ }
1401
+ }
1402
+ function C(e, t = !0) {
1403
+ var n = !1;
1404
+ (t || (e.f & Qt) !== 0) && e.nodes !== null && e.nodes.end !== null && (Xr(
1405
+ e.nodes.start,
1406
+ /** @type {TemplateNode} */
1407
+ e.nodes.end
1408
+ ), n = !0), xn(e, t && !n), Qe(e, 0), T(e, Q);
1409
+ var r = e.nodes && e.nodes.t;
1410
+ if (r !== null)
1411
+ for (const s of r)
1412
+ s.stop();
1413
+ Sn(e);
1414
+ var i = e.parent;
1415
+ i !== null && i.first !== null && kn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1416
+ }
1417
+ function Xr(e, t) {
1418
+ for (; e !== null; ) {
1419
+ var n = e === t ? null : /* @__PURE__ */ se(e);
1420
+ e.remove(), e = n;
1421
+ }
1422
+ }
1423
+ function kn(e) {
1424
+ var t = e.parent, n = e.prev, r = e.next;
1425
+ n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
1426
+ }
1427
+ function Le(e, t, n = !0) {
1428
+ var r = [];
1429
+ zn(e, r, !0);
1430
+ var i = () => {
1431
+ n && C(e), t && t();
1432
+ }, s = r.length;
1433
+ if (s > 0) {
1434
+ var l = () => --s || i();
1435
+ for (var o of r)
1436
+ o.out(l);
1437
+ } else
1438
+ i();
1439
+ }
1440
+ function zn(e, t, n) {
1441
+ if ((e.f & U) === 0) {
1442
+ e.f ^= U;
1443
+ var r = e.nodes && e.nodes.t;
1444
+ if (r !== null)
1445
+ for (const o of r)
1446
+ (o.is_global || n) && t.push(o);
1447
+ for (var i = e.first; i !== null; ) {
1448
+ var s = i.next, l = (i.f & Ae) !== 0 || // If this is a branch effect without a block effect parent,
1449
+ // it means the parent block effect was pruned. In that case,
1450
+ // transparency information was transferred to the branch effect.
1451
+ (i.f & W) !== 0 && (e.f & re) !== 0;
1452
+ zn(i, t, l ? n : !1), i = s;
1453
+ }
1454
+ }
1455
+ }
1456
+ function Qr(e) {
1457
+ An(e, !0);
1458
+ }
1459
+ function An(e, t) {
1460
+ if ((e.f & U) !== 0) {
1461
+ e.f ^= U, (e.f & S) === 0 && (T(e, z), te(e));
1462
+ for (var n = e.first; n !== null; ) {
1463
+ var r = n.next, i = (n.f & Ae) !== 0 || (n.f & W) !== 0;
1464
+ An(n, i ? t : !1), n = r;
1465
+ }
1466
+ var s = e.nodes && e.nodes.t;
1467
+ if (s !== null)
1468
+ for (const l of s)
1469
+ (l.is_global || t) && l.in();
1470
+ }
1471
+ }
1472
+ function Cn(e, t) {
1473
+ if (e.nodes)
1474
+ for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
1475
+ var i = n === r ? null : /* @__PURE__ */ se(n);
1476
+ t.append(n), n = i;
1477
+ }
1478
+ }
1479
+ let Ge = !1, ue = !1;
1480
+ function Ft(e) {
1481
+ ue = e;
1482
+ }
1483
+ let _ = null, q = !1;
1484
+ function F(e) {
1485
+ _ = e;
1486
+ }
1487
+ let g = null;
1488
+ function G(e) {
1489
+ g = e;
1490
+ }
1491
+ let P = null;
1492
+ function Rn(e) {
1493
+ _ !== null && (P === null ? P = [e] : P.push(e));
1494
+ }
1495
+ let A = null, R = 0, M = null;
1496
+ function ei(e) {
1497
+ M = e;
1498
+ }
1499
+ let Nn = 1, ve = 0, pe = ve;
1500
+ function jt(e) {
1501
+ pe = e;
1502
+ }
1503
+ function On() {
1504
+ return ++Nn;
1505
+ }
1506
+ function He(e) {
1507
+ var t = e.f;
1508
+ if ((t & z) !== 0)
1509
+ return !0;
1510
+ if (t & k && (e.f &= ~ge), (t & ie) !== 0) {
1511
+ for (var n = (
1512
+ /** @type {Value[]} */
1513
+ e.deps
1514
+ ), r = n.length, i = 0; i < r; i++) {
1515
+ var s = n[i];
1516
+ if (He(
1517
+ /** @type {Derived} */
1518
+ s
1519
+ ) && _n(
1520
+ /** @type {Derived} */
1521
+ s
1522
+ ), s.wv > e.wv)
1523
+ return !0;
1524
+ }
1525
+ (t & D) !== 0 && // During time traveling we don't want to reset the status so that
1526
+ // traversal of the graph in the other batches still happens
1527
+ V === null && T(e, S);
1528
+ }
1529
+ return !1;
1530
+ }
1531
+ function In(e, t, n = !0) {
1532
+ var r = e.reactions;
1533
+ if (r !== null && !(P !== null && ze.call(P, e)))
1534
+ for (var i = 0; i < r.length; i++) {
1535
+ var s = r[i];
1536
+ (s.f & k) !== 0 ? In(
1537
+ /** @type {Derived} */
1538
+ s,
1539
+ t,
1540
+ !1
1541
+ ) : t === s && (n ? T(s, z) : (s.f & S) !== 0 && T(s, ie), te(
1542
+ /** @type {Effect} */
1543
+ s
1544
+ ));
1545
+ }
1546
+ }
1547
+ function Mn(e) {
1548
+ var t = A, n = R, r = M, i = _, s = P, l = L, o = q, a = pe, f = e.f;
1549
+ A = /** @type {null | Value[]} */
1550
+ null, R = 0, M = null, _ = (f & (W | ce)) === 0 ? e : null, P = null, Ce(e.ctx), q = !1, pe = ++ve, e.ac !== null && (yn(() => {
1551
+ e.ac.abort(Te);
1552
+ }), e.ac = null);
1553
+ try {
1554
+ e.f |= ft;
1555
+ var c = (
1556
+ /** @type {Function} */
1557
+ e.fn
1558
+ ), d = c(), u = e.deps, h = y?.is_fork;
1559
+ if (A !== null) {
1560
+ var v;
1561
+ if (h || Qe(e, R), u !== null && R > 0)
1562
+ for (u.length = R + A.length, v = 0; v < A.length; v++)
1563
+ u[R + v] = A[v];
1564
+ else
1565
+ e.deps = u = A;
1566
+ if (Tt() && (e.f & D) !== 0)
1567
+ for (v = R; v < u.length; v++)
1568
+ (u[v].reactions ??= []).push(e);
1569
+ } else !h && u !== null && R < u.length && (Qe(e, R), u.length = R);
1570
+ if (sn() && M !== null && !q && u !== null && (e.f & (k | ie | z)) === 0)
1571
+ for (v = 0; v < /** @type {Source[]} */
1572
+ M.length; v++)
1573
+ In(
1574
+ M[v],
1575
+ /** @type {Effect} */
1576
+ e
1577
+ );
1578
+ if (i !== null && i !== e) {
1579
+ if (ve++, i.deps !== null)
1580
+ for (let E = 0; E < n; E += 1)
1581
+ i.deps[E].rv = ve;
1582
+ if (t !== null)
1583
+ for (const E of t)
1584
+ E.rv = ve;
1585
+ M !== null && (r === null ? r = M : r.push(.../** @type {Source[]} */
1586
+ M));
1587
+ }
1588
+ return (e.f & ae) !== 0 && (e.f ^= ae), d;
1589
+ } catch (E) {
1590
+ return on(E);
1591
+ } finally {
1592
+ e.f ^= ft, A = t, R = n, M = r, _ = i, P = s, Ce(l), q = o, pe = a;
1593
+ }
1594
+ }
1595
+ function ti(e, t) {
1596
+ let n = t.reactions;
1597
+ if (n !== null) {
1598
+ var r = ir.call(n, e);
1599
+ if (r !== -1) {
1600
+ var i = n.length - 1;
1601
+ i === 0 ? n = t.reactions = null : (n[r] = n[i], n.pop());
1602
+ }
1603
+ }
1604
+ if (n === null && (t.f & k) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1605
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1606
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1607
+ (A === null || !ze.call(A, t))) {
1608
+ var s = (
1609
+ /** @type {Derived} */
1610
+ t
1611
+ );
1612
+ (s.f & D) !== 0 && (s.f ^= D, s.f &= ~ge), bt(s), vn(s), Qe(s, 0);
1613
+ }
1614
+ }
1615
+ function Qe(e, t) {
1616
+ var n = e.deps;
1617
+ if (n !== null)
1618
+ for (var r = t; r < n.length; r++)
1619
+ ti(e, n[r]);
1620
+ }
1621
+ function Fe(e) {
1622
+ var t = e.f;
1623
+ if ((t & Q) === 0) {
1624
+ T(e, S);
1625
+ var n = g, r = Ge;
1626
+ g = e, Ge = !0;
1627
+ try {
1628
+ (t & (re | Xt)) !== 0 ? Zr(e) : xn(e), Sn(e);
1629
+ var i = Mn(e);
1630
+ e.teardown = typeof i == "function" ? i : null, e.wv = Nn;
1631
+ var s;
1632
+ at && zr && (e.f & z) !== 0 && e.deps;
1633
+ } finally {
1634
+ Ge = r, g = n;
1635
+ }
1636
+ }
1637
+ }
1638
+ function p(e) {
1639
+ var t = e.f, n = (t & k) !== 0;
1640
+ if (_ !== null && !q) {
1641
+ var r = g !== null && (g.f & Q) !== 0;
1642
+ if (!r && (P === null || !ze.call(P, e))) {
1643
+ var i = _.deps;
1644
+ if ((_.f & ft) !== 0)
1645
+ e.rv < ve && (e.rv = ve, A === null && i !== null && i[R] === e ? R++ : A === null ? A = [e] : A.push(e));
1646
+ else {
1647
+ (_.deps ??= []).push(e);
1648
+ var s = e.reactions;
1649
+ s === null ? e.reactions = [_] : ze.call(s, _) || s.push(_);
1650
+ }
1651
+ }
1652
+ }
1653
+ if (ue && fe.has(e))
1654
+ return fe.get(e);
1655
+ if (n) {
1656
+ var l = (
1657
+ /** @type {Derived} */
1658
+ e
1659
+ );
1660
+ if (ue) {
1661
+ var o = l.v;
1662
+ return ((l.f & S) === 0 && l.reactions !== null || Pn(l)) && (o = $t(l)), fe.set(l, o), o;
1663
+ }
1664
+ var a = (l.f & D) === 0 && !q && _ !== null && (Ge || (_.f & D) !== 0), f = l.deps === null;
1665
+ He(l) && (a && (l.f |= D), _n(l)), a && !f && Dn(l);
1666
+ }
1667
+ if (V?.has(e))
1668
+ return V.get(e);
1669
+ if ((e.f & ae) !== 0)
1670
+ throw e.v;
1671
+ return e.v;
1672
+ }
1673
+ function Dn(e) {
1674
+ if (e.deps !== null) {
1675
+ e.f |= D;
1676
+ for (const t of e.deps)
1677
+ (t.reactions ??= []).push(e), (t.f & k) !== 0 && (t.f & D) === 0 && Dn(
1678
+ /** @type {Derived} */
1679
+ t
1680
+ );
1681
+ }
1682
+ }
1683
+ function Pn(e) {
1684
+ if (e.v === x) return !0;
1685
+ if (e.deps === null) return !1;
1686
+ for (const t of e.deps)
1687
+ if (fe.has(t) || (t.f & k) !== 0 && Pn(
1688
+ /** @type {Derived} */
1689
+ t
1690
+ ))
1691
+ return !0;
1692
+ return !1;
1693
+ }
1694
+ function Ln(e) {
1695
+ var t = q;
1696
+ try {
1697
+ return q = !0, e();
1698
+ } finally {
1699
+ q = t;
1700
+ }
1701
+ }
1702
+ const Fn = /* @__PURE__ */ new Set(), vt = /* @__PURE__ */ new Set();
1703
+ function ni(e) {
1704
+ for (var t = 0; t < e.length; t++)
1705
+ Fn.add(e[t]);
1706
+ for (var n of vt)
1707
+ n(e);
1708
+ }
1709
+ let Bt = null;
1710
+ function qe(e) {
1711
+ var t = this, n = (
1712
+ /** @type {Node} */
1713
+ t.ownerDocument
1714
+ ), r = e.type, i = e.composedPath?.() || [], s = (
1715
+ /** @type {null | Element} */
1716
+ i[0] || e.target
1717
+ );
1718
+ Bt = e;
1719
+ var l = 0, o = Bt === e && e.__root;
1720
+ if (o) {
1721
+ var a = i.indexOf(o);
1722
+ if (a !== -1 && (t === document || t === /** @type {any} */
1723
+ window)) {
1724
+ e.__root = t;
1725
+ return;
1726
+ }
1727
+ var f = i.indexOf(t);
1728
+ if (f === -1)
1729
+ return;
1730
+ a <= f && (l = a);
1731
+ }
1732
+ if (s = /** @type {Element} */
1733
+ i[l] || e.target, s !== t) {
1734
+ Je(e, "currentTarget", {
1735
+ configurable: !0,
1736
+ get() {
1737
+ return s || n;
1738
+ }
1739
+ });
1740
+ var c = _, d = g;
1741
+ F(null), G(null);
1742
+ try {
1743
+ for (var u, h = []; s !== null; ) {
1744
+ var v = s.assignedSlot || s.parentNode || /** @type {any} */
1745
+ s.host || null;
1746
+ try {
1747
+ var E = s["__" + r];
1748
+ E != null && (!/** @type {any} */
1749
+ s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1750
+ // -> the target could not have been disabled because it emits the event in the first place
1751
+ e.target === s) && E.call(s, e);
1752
+ } catch (j) {
1753
+ u ? h.push(j) : u = j;
1754
+ }
1755
+ if (e.cancelBubble || v === t || v === null)
1756
+ break;
1757
+ s = v;
1758
+ }
1759
+ if (u) {
1760
+ for (let j of h)
1761
+ queueMicrotask(() => {
1762
+ throw j;
1763
+ });
1764
+ throw u;
1765
+ }
1766
+ } finally {
1767
+ e.__root = t, delete e.currentTarget, F(c), G(d);
1768
+ }
1769
+ }
1770
+ }
1771
+ function jn(e) {
1772
+ var t = document.createElement("template");
1773
+ return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
1774
+ }
1775
+ function we(e, t) {
1776
+ var n = (
1777
+ /** @type {Effect} */
1778
+ g
1779
+ );
1780
+ n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
1781
+ }
1782
+ // @__NO_SIDE_EFFECTS__
1783
+ function Bn(e, t) {
1784
+ var n = (t & tr) !== 0, r, i = !e.startsWith("<!>");
1785
+ return () => {
1786
+ if (b)
1787
+ return we(m, null), m;
1788
+ r === void 0 && (r = jn(i ? e : "<!>" + e), r = /** @type {TemplateNode} */
1789
+ /* @__PURE__ */ me(r));
1790
+ var s = (
1791
+ /** @type {TemplateNode} */
1792
+ n || mn ? document.importNode(r, !0) : r.cloneNode(!0)
1793
+ );
1794
+ return we(s, s), s;
1795
+ };
1796
+ }
1797
+ // @__NO_SIDE_EFFECTS__
1798
+ function ri(e, t, n = "svg") {
1799
+ var r = !e.startsWith("<!>"), i = `<${n}>${r ? e : "<!>" + e}</${n}>`, s;
1800
+ return () => {
1801
+ if (b)
1802
+ return we(m, null), m;
1803
+ if (!s) {
1804
+ var l = (
1805
+ /** @type {DocumentFragment} */
1806
+ jn(i)
1807
+ ), o = (
1808
+ /** @type {Element} */
1809
+ /* @__PURE__ */ me(l)
1810
+ );
1811
+ s = /** @type {Element} */
1812
+ /* @__PURE__ */ me(o);
1813
+ }
1814
+ var a = (
1815
+ /** @type {TemplateNode} */
1816
+ s.cloneNode(!0)
1817
+ );
1818
+ return we(a, a), a;
1819
+ };
1820
+ }
1821
+ // @__NO_SIDE_EFFECTS__
1822
+ function xt(e, t) {
1823
+ return /* @__PURE__ */ ri(e, t, "svg");
1824
+ }
1825
+ function Ht() {
1826
+ if (b)
1827
+ return we(m, null), m;
1828
+ var e = document.createDocumentFragment(), t = document.createComment(""), n = ne();
1829
+ return e.append(t, n), we(t, n), e;
1830
+ }
1831
+ function oe(e, t) {
1832
+ if (b) {
1833
+ var n = (
1834
+ /** @type {Effect & { nodes: EffectNodes }} */
1835
+ g
1836
+ );
1837
+ ((n.f & tt) === 0 || n.nodes.end === null) && (n.nodes.end = m), wt();
1838
+ return;
1839
+ }
1840
+ e !== null && e.before(
1841
+ /** @type {Node} */
1842
+ t
1843
+ );
1844
+ }
1845
+ const ii = ["touchstart", "touchmove"];
1846
+ function si(e) {
1847
+ return ii.includes(e);
1848
+ }
1849
+ function li(e, t) {
1850
+ var n = t == null ? "" : typeof t == "object" ? t + "" : t;
1851
+ n !== (e.__t ??= e.nodeValue) && (e.__t = n, e.nodeValue = n + "");
1852
+ }
1853
+ function Hn(e, t) {
1854
+ return Vn(e, t);
1855
+ }
1856
+ function oi(e, t) {
1857
+ dt(), t.intro = t.intro ?? !1;
1858
+ const n = t.target, r = b, i = m;
1859
+ try {
1860
+ for (var s = /* @__PURE__ */ me(n); s && (s.nodeType !== je || /** @type {Comment} */
1861
+ s.data !== Wt); )
1862
+ s = /* @__PURE__ */ se(s);
1863
+ if (!s)
1864
+ throw ke;
1865
+ Se(!0), Y(
1866
+ /** @type {Comment} */
1867
+ s
1868
+ );
1869
+ const l = Vn(e, { ...t, anchor: s });
1870
+ return Se(!1), /** @type {Exports} */
1871
+ l;
1872
+ } catch (l) {
1873
+ if (l instanceof Error && l.message.split(`
1874
+ `).some((o) => o.startsWith("https://svelte.dev/e/")))
1875
+ throw l;
1876
+ return l !== ke && console.warn("Failed to hydrate: ", l), t.recover === !1 && mr(), dt(), Vr(n), Se(!1), Hn(e, t);
1877
+ } finally {
1878
+ Se(r), Y(i);
1879
+ }
1880
+ }
1881
+ const Ee = /* @__PURE__ */ new Map();
1882
+ function Vn(e, { target: t, anchor: n, props: r = {}, events: i, context: s, intro: l = !0 }) {
1883
+ dt();
1884
+ var o = /* @__PURE__ */ new Set(), a = (d) => {
1885
+ for (var u = 0; u < d.length; u++) {
1886
+ var h = d[u];
1887
+ if (!o.has(h)) {
1888
+ o.add(h);
1889
+ var v = si(h);
1890
+ t.addEventListener(h, qe, { passive: v });
1891
+ var E = Ee.get(h);
1892
+ E === void 0 ? (document.addEventListener(h, qe, { passive: v }), Ee.set(h, 1)) : Ee.set(h, E + 1);
1893
+ }
1894
+ }
1895
+ };
1896
+ a(sr(Fn)), vt.add(a);
1897
+ var f = void 0, c = Kr(() => {
1898
+ var d = n ?? t.appendChild(ne());
1899
+ return Ir(
1900
+ /** @type {TemplateNode} */
1901
+ d,
1902
+ {
1903
+ pending: () => {
1904
+ }
1905
+ },
1906
+ (u) => {
1907
+ if (s) {
1908
+ nn({});
1909
+ var h = (
1910
+ /** @type {ComponentContext} */
1911
+ L
1912
+ );
1913
+ h.c = s;
1914
+ }
1915
+ if (i && (r.$$events = i), b && we(
1916
+ /** @type {TemplateNode} */
1917
+ u,
1918
+ null
1919
+ ), f = e(u, r) || {}, b && (g.nodes.end = m, m === null || m.nodeType !== je || /** @type {Comment} */
1920
+ m.data !== Kt))
1921
+ throw rt(), ke;
1922
+ s && rn();
1923
+ }
1924
+ ), () => {
1925
+ for (var u of o) {
1926
+ t.removeEventListener(u, qe);
1927
+ var h = (
1928
+ /** @type {number} */
1929
+ Ee.get(u)
1930
+ );
1931
+ --h === 0 ? (document.removeEventListener(u, qe), Ee.delete(u)) : Ee.set(u, h);
1932
+ }
1933
+ vt.delete(a), d !== n && d.parentNode?.removeChild(d);
1934
+ };
1935
+ });
1936
+ return _t.set(f, c), f;
1937
+ }
1938
+ let _t = /* @__PURE__ */ new WeakMap();
1939
+ function ai(e, t) {
1940
+ const n = _t.get(e);
1941
+ return n ? (_t.delete(e), n(t)) : Promise.resolve();
1942
+ }
1943
+ class fi {
1944
+ /** @type {TemplateNode} */
1945
+ anchor;
1946
+ /** @type {Map<Batch, Key>} */
1947
+ #e = /* @__PURE__ */ new Map();
1948
+ /**
1949
+ * Map of keys to effects that are currently rendered in the DOM.
1950
+ * These effects are visible and actively part of the document tree.
1951
+ * Example:
1952
+ * ```
1953
+ * {#if condition}
1954
+ * foo
1955
+ * {:else}
1956
+ * bar
1957
+ * {/if}
1958
+ * ```
1959
+ * Can result in the entries `true->Effect` and `false->Effect`
1960
+ * @type {Map<Key, Effect>}
1961
+ */
1962
+ #t = /* @__PURE__ */ new Map();
1963
+ /**
1964
+ * Similar to #onscreen with respect to the keys, but contains branches that are not yet
1965
+ * in the DOM, because their insertion is deferred.
1966
+ * @type {Map<Key, Branch>}
1967
+ */
1968
+ #n = /* @__PURE__ */ new Map();
1969
+ /**
1970
+ * Keys of effects that are currently outroing
1971
+ * @type {Set<Key>}
1972
+ */
1973
+ #s = /* @__PURE__ */ new Set();
1974
+ /**
1975
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
1976
+ * This is necessary for `<svelte:element>`
1977
+ */
1978
+ #l = !0;
1979
+ /**
1980
+ * @param {TemplateNode} anchor
1981
+ * @param {boolean} transition
1982
+ */
1983
+ constructor(t, n = !0) {
1984
+ this.anchor = t, this.#l = n;
1985
+ }
1986
+ #i = () => {
1987
+ var t = (
1988
+ /** @type {Batch} */
1989
+ y
1990
+ );
1991
+ if (this.#e.has(t)) {
1992
+ var n = (
1993
+ /** @type {Key} */
1994
+ this.#e.get(t)
1995
+ ), r = this.#t.get(n);
1996
+ if (r)
1997
+ Qr(r), this.#s.delete(n);
1998
+ else {
1999
+ var i = this.#n.get(n);
2000
+ i && (this.#t.set(n, i.effect), this.#n.delete(n), i.fragment.lastChild.remove(), this.anchor.before(i.fragment), r = i.effect);
2001
+ }
2002
+ for (const [s, l] of this.#e) {
2003
+ if (this.#e.delete(s), s === t)
2004
+ break;
2005
+ const o = this.#n.get(l);
2006
+ o && (C(o.effect), this.#n.delete(l));
2007
+ }
2008
+ for (const [s, l] of this.#t) {
2009
+ if (s === n || this.#s.has(s)) continue;
2010
+ const o = () => {
2011
+ if (Array.from(this.#e.values()).includes(s)) {
2012
+ var f = document.createDocumentFragment();
2013
+ Cn(l, f), f.append(ne()), this.#n.set(s, { effect: l, fragment: f });
2014
+ } else
2015
+ C(l);
2016
+ this.#s.delete(s), this.#t.delete(s);
2017
+ };
2018
+ this.#l || !r ? (this.#s.add(s), Le(l, o, !1)) : o();
2019
+ }
2020
+ }
2021
+ };
2022
+ /**
2023
+ * @param {Batch} batch
2024
+ */
2025
+ #r = (t) => {
2026
+ this.#e.delete(t);
2027
+ const n = Array.from(this.#e.values());
2028
+ for (const [r, i] of this.#n)
2029
+ n.includes(r) || (C(i.effect), this.#n.delete(r));
2030
+ };
2031
+ /**
2032
+ *
2033
+ * @param {any} key
2034
+ * @param {null | ((target: TemplateNode) => void)} fn
2035
+ */
2036
+ ensure(t, n) {
2037
+ var r = (
2038
+ /** @type {Batch} */
2039
+ y
2040
+ ), i = qr();
2041
+ if (n && !this.#t.has(t) && !this.#n.has(t))
2042
+ if (i) {
2043
+ var s = document.createDocumentFragment(), l = ne();
2044
+ s.append(l), this.#n.set(t, {
2045
+ effect: X(() => n(l)),
2046
+ fragment: s
2047
+ });
2048
+ } else
2049
+ this.#t.set(
2050
+ t,
2051
+ X(() => n(this.anchor))
2052
+ );
2053
+ if (this.#e.set(r, t), i) {
2054
+ for (const [o, a] of this.#t)
2055
+ o === t ? r.skipped_effects.delete(a) : r.skipped_effects.add(a);
2056
+ for (const [o, a] of this.#n)
2057
+ o === t ? r.skipped_effects.delete(a.effect) : r.skipped_effects.add(a.effect);
2058
+ r.oncommit(this.#i), r.ondiscard(this.#r);
2059
+ } else
2060
+ b && (this.anchor = m), this.#i();
2061
+ }
2062
+ }
2063
+ function Ye(e, t, n = !1) {
2064
+ b && wt();
2065
+ var r = new fi(e), i = n ? Ae : 0;
2066
+ function s(l, o) {
2067
+ if (b) {
2068
+ const f = Sr(e) === pt;
2069
+ if (l === f) {
2070
+ var a = en();
2071
+ Y(a), r.anchor = a, Se(!1), r.ensure(l, o), Se(!0);
2072
+ return;
2073
+ }
2074
+ }
2075
+ r.ensure(l, o);
2076
+ }
2077
+ Tn(() => {
2078
+ var l = !1;
2079
+ t((o, a = !0) => {
2080
+ l = !0, s(a, o);
2081
+ }), l || s(!1, null);
2082
+ }, i);
2083
+ }
2084
+ function ui(e, t) {
2085
+ En(() => {
2086
+ var n = e.getRootNode(), r = (
2087
+ /** @type {ShadowRoot} */
2088
+ n.host ? (
2089
+ /** @type {ShadowRoot} */
2090
+ n
2091
+ ) : (
2092
+ /** @type {Document} */
2093
+ n.head ?? /** @type {Document} */
2094
+ n.ownerDocument.head
2095
+ )
2096
+ );
2097
+ if (!r.querySelector("#" + t.hash)) {
2098
+ const i = document.createElement("style");
2099
+ i.id = t.hash, i.textContent = t.code, r.appendChild(i);
2100
+ }
2101
+ });
2102
+ }
2103
+ const Vt = [...`
2104
+ \r\f \v\uFEFF`];
2105
+ function ci(e, t, n) {
2106
+ var r = e == null ? "" : "" + e;
2107
+ if (r = r ? r + " " + t : t, n) {
2108
+ for (var i in n)
2109
+ if (n[i])
2110
+ r = r ? r + " " + i : i;
2111
+ else if (r.length)
2112
+ for (var s = i.length, l = 0; (l = r.indexOf(i, l)) >= 0; ) {
2113
+ var o = l + s;
2114
+ (l === 0 || Vt.includes(r[l - 1])) && (o === r.length || Vt.includes(r[o])) ? r = (l === 0 ? "" : r.substring(0, l)) + r.substring(o + 1) : l = o;
2115
+ }
2116
+ }
2117
+ return r === "" ? null : r;
2118
+ }
2119
+ function qt(e, t, n, r, i, s) {
2120
+ var l = e.__className;
2121
+ if (b || l !== n || l === void 0) {
2122
+ var o = ci(n, r, s);
2123
+ (!b || o !== e.getAttribute("class")) && (o == null ? e.removeAttribute("class") : e.className = o), e.__className = n;
2124
+ } else if (s && i !== s)
2125
+ for (var a in s) {
2126
+ var f = !!s[a];
2127
+ (i == null || f !== !!i[a]) && e.classList.toggle(a, f);
2128
+ }
2129
+ return s;
2130
+ }
2131
+ const hi = /* @__PURE__ */ Symbol("is custom element"), di = /* @__PURE__ */ Symbol("is html");
2132
+ function Yt(e, t, n, r) {
2133
+ var i = vi(e);
2134
+ b && (i[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === "LINK") || i[t] !== (i[t] = n) && (t === "loading" && (e[hr] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && _i(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
2135
+ }
2136
+ function vi(e) {
2137
+ return (
2138
+ /** @type {Record<string | symbol, unknown>} **/
2139
+ // @ts-expect-error
2140
+ e.__attributes ??= {
2141
+ [hi]: e.nodeName.includes("-"),
2142
+ [di]: e.namespaceURI === nr
2143
+ }
2144
+ );
2145
+ }
2146
+ var Ut = /* @__PURE__ */ new Map();
2147
+ function _i(e) {
2148
+ var t = e.getAttribute("is") || e.nodeName, n = Ut.get(t);
2149
+ if (n) return n;
2150
+ Ut.set(t, n = []);
2151
+ for (var r, i = e, s = Element.prototype; s !== i; ) {
2152
+ r = lr(i);
2153
+ for (var l in r)
2154
+ r[l].set && n.push(l);
2155
+ i = Jt(i);
2156
+ }
2157
+ return n;
2158
+ }
2159
+ function Gt(e, t) {
2160
+ return e === t || e?.[Ue] === t;
2161
+ }
2162
+ function pi(e = {}, t, n, r) {
2163
+ return En(() => {
2164
+ var i, s;
2165
+ return St(() => {
2166
+ i = s, s = [], Ln(() => {
2167
+ e !== n(...s) && (t(e, ...s), i && Gt(n(...i), e) && t(null, ...i));
2168
+ });
2169
+ }), () => {
2170
+ _e(() => {
2171
+ s && Gt(n(...s), e) && t(null, ...s);
2172
+ });
2173
+ };
2174
+ }), e;
2175
+ }
2176
+ function he(e, t, n, r) {
2177
+ var i = (
2178
+ /** @type {V} */
2179
+ r
2180
+ ), s = !0, l = () => (s && (s = !1, i = /** @type {V} */
2181
+ r), i), o;
2182
+ o = /** @type {V} */
2183
+ e[t], o === void 0 && r !== void 0 && (o = l());
2184
+ var a;
2185
+ a = () => {
2186
+ var u = (
2187
+ /** @type {V} */
2188
+ e[t]
2189
+ );
2190
+ return u === void 0 ? l() : (s = !0, u);
2191
+ };
2192
+ var f = !1, c = /* @__PURE__ */ yt(() => (f = !1, a())), d = (
2193
+ /** @type {Effect} */
2194
+ g
2195
+ );
2196
+ return (
2197
+ /** @type {() => V} */
2198
+ (function(u, h) {
2199
+ if (arguments.length > 0) {
2200
+ const v = h ? p(c) : u;
2201
+ return w(c, v), f = !0, i !== void 0 && (i = v), u;
2202
+ }
2203
+ return ue && f || (d.f & Q) !== 0 ? c.v : p(c);
2204
+ })
2205
+ );
2206
+ }
2207
+ function gi(e) {
2208
+ return new mi(e);
2209
+ }
2210
+ class mi {
2211
+ /** @type {any} */
2212
+ #e;
2213
+ /** @type {Record<string, any>} */
2214
+ #t;
2215
+ /**
2216
+ * @param {ComponentConstructorOptions & {
2217
+ * component: any;
2218
+ * }} options
2219
+ */
2220
+ constructor(t) {
2221
+ var n = /* @__PURE__ */ new Map(), r = (s, l) => {
2222
+ var o = /* @__PURE__ */ Br(l, !1, !1);
2223
+ return n.set(s, o), o;
2224
+ };
2225
+ const i = new Proxy(
2226
+ { ...t.props || {}, $$events: {} },
2227
+ {
2228
+ get(s, l) {
2229
+ return p(n.get(l) ?? r(l, Reflect.get(s, l)));
2230
+ },
2231
+ has(s, l) {
2232
+ return l === cr ? !0 : (p(n.get(l) ?? r(l, Reflect.get(s, l))), Reflect.has(s, l));
2233
+ },
2234
+ set(s, l, o) {
2235
+ return w(n.get(l) ?? r(l, o), o), Reflect.set(s, l, o);
2236
+ }
2237
+ }
2238
+ );
2239
+ this.#t = (t.hydrate ? oi : Hn)(t.component, {
2240
+ target: t.target,
2241
+ anchor: t.anchor,
2242
+ props: i,
2243
+ context: t.context,
2244
+ intro: t.intro ?? !1,
2245
+ recover: t.recover
2246
+ }), (!t?.props?.$$host || t.sync === !1) && le(), this.#e = i.$$events;
2247
+ for (const s of Object.keys(this.#t))
2248
+ s === "$set" || s === "$destroy" || s === "$on" || Je(this, s, {
2249
+ get() {
2250
+ return this.#t[s];
2251
+ },
2252
+ /** @param {any} value */
2253
+ set(l) {
2254
+ this.#t[s] = l;
2255
+ },
2256
+ enumerable: !0
2257
+ });
2258
+ this.#t.$set = /** @param {Record<string, any>} next */
2259
+ (s) => {
2260
+ Object.assign(i, s);
2261
+ }, this.#t.$destroy = () => {
2262
+ ai(this.#t);
2263
+ };
2264
+ }
2265
+ /** @param {Record<string, any>} props */
2266
+ $set(t) {
2267
+ this.#t.$set(t);
2268
+ }
2269
+ /**
2270
+ * @param {string} event
2271
+ * @param {(...args: any[]) => any} callback
2272
+ * @returns {any}
2273
+ */
2274
+ $on(t, n) {
2275
+ this.#e[t] = this.#e[t] || [];
2276
+ const r = (...i) => n.call(this, ...i);
2277
+ return this.#e[t].push(r), () => {
2278
+ this.#e[t] = this.#e[t].filter(
2279
+ /** @param {any} fn */
2280
+ (i) => i !== r
2281
+ );
2282
+ };
2283
+ }
2284
+ $destroy() {
2285
+ this.#t.$destroy();
2286
+ }
2287
+ }
2288
+ let qn;
2289
+ typeof HTMLElement == "function" && (qn = class extends HTMLElement {
2290
+ /** The Svelte component constructor */
2291
+ $$ctor;
2292
+ /** Slots */
2293
+ $$s;
2294
+ /** @type {any} The Svelte component instance */
2295
+ $$c;
2296
+ /** Whether or not the custom element is connected */
2297
+ $$cn = !1;
2298
+ /** @type {Record<string, any>} Component props data */
2299
+ $$d = {};
2300
+ /** `true` if currently in the process of reflecting component props back to attributes */
2301
+ $$r = !1;
2302
+ /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
2303
+ $$p_d = {};
2304
+ /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
2305
+ $$l = {};
2306
+ /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
2307
+ $$l_u = /* @__PURE__ */ new Map();
2308
+ /** @type {any} The managed render effect for reflecting attributes */
2309
+ $$me;
2310
+ /** @type {ShadowRoot | null} The ShadowRoot of the custom element */
2311
+ $$shadowRoot = null;
2312
+ /**
2313
+ * @param {*} $$componentCtor
2314
+ * @param {*} $$slots
2315
+ * @param {ShadowRootInit | undefined} shadow_root_init
2316
+ */
2317
+ constructor(e, t, n) {
2318
+ super(), this.$$ctor = e, this.$$s = t, n && (this.$$shadowRoot = this.attachShadow(n));
2319
+ }
2320
+ /**
2321
+ * @param {string} type
2322
+ * @param {EventListenerOrEventListenerObject} listener
2323
+ * @param {boolean | AddEventListenerOptions} [options]
2324
+ */
2325
+ addEventListener(e, t, n) {
2326
+ if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
2327
+ const r = this.$$c.$on(e, t);
2328
+ this.$$l_u.set(t, r);
2329
+ }
2330
+ super.addEventListener(e, t, n);
2331
+ }
2332
+ /**
2333
+ * @param {string} type
2334
+ * @param {EventListenerOrEventListenerObject} listener
2335
+ * @param {boolean | AddEventListenerOptions} [options]
2336
+ */
2337
+ removeEventListener(e, t, n) {
2338
+ if (super.removeEventListener(e, t, n), this.$$c) {
2339
+ const r = this.$$l_u.get(t);
2340
+ r && (r(), this.$$l_u.delete(t));
2341
+ }
2342
+ }
2343
+ async connectedCallback() {
2344
+ if (this.$$cn = !0, !this.$$c) {
2345
+ let e = function(r) {
2346
+ return (i) => {
2347
+ const s = document.createElement("slot");
2348
+ r !== "default" && (s.name = r), oe(i, s);
2349
+ };
2350
+ };
2351
+ if (await Promise.resolve(), !this.$$cn || this.$$c)
2352
+ return;
2353
+ const t = {}, n = wi(this);
2354
+ for (const r of this.$$s)
2355
+ r in n && (r === "default" && !this.$$d.children ? (this.$$d.children = e(r), t.default = !0) : t[r] = e(r));
2356
+ for (const r of this.attributes) {
2357
+ const i = this.$$g_p(r.name);
2358
+ i in this.$$d || (this.$$d[i] = We(i, r.value, this.$$p_d, "toProp"));
2359
+ }
2360
+ for (const r in this.$$p_d)
2361
+ !(r in this.$$d) && this[r] !== void 0 && (this.$$d[r] = this[r], delete this[r]);
2362
+ this.$$c = gi({
2363
+ component: this.$$ctor,
2364
+ target: this.$$shadowRoot || this,
2365
+ props: {
2366
+ ...this.$$d,
2367
+ $$slots: t,
2368
+ $$host: this
2369
+ }
2370
+ }), this.$$me = Wr(() => {
2371
+ St(() => {
2372
+ this.$$r = !0;
2373
+ for (const r of Ke(this.$$c)) {
2374
+ if (!this.$$p_d[r]?.reflect) continue;
2375
+ this.$$d[r] = this.$$c[r];
2376
+ const i = We(
2377
+ r,
2378
+ this.$$d[r],
2379
+ this.$$p_d,
2380
+ "toAttribute"
2381
+ );
2382
+ i == null ? this.removeAttribute(this.$$p_d[r].attribute || r) : this.setAttribute(this.$$p_d[r].attribute || r, i);
2383
+ }
2384
+ this.$$r = !1;
2385
+ });
2386
+ });
2387
+ for (const r in this.$$l)
2388
+ for (const i of this.$$l[r]) {
2389
+ const s = this.$$c.$on(r, i);
2390
+ this.$$l_u.set(i, s);
2391
+ }
2392
+ this.$$l = {};
2393
+ }
2394
+ }
2395
+ // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
2396
+ // and setting attributes through setAttribute etc, this is helpful
2397
+ /**
2398
+ * @param {string} attr
2399
+ * @param {string} _oldValue
2400
+ * @param {string} newValue
2401
+ */
2402
+ attributeChangedCallback(e, t, n) {
2403
+ this.$$r || (e = this.$$g_p(e), this.$$d[e] = We(e, n, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
2404
+ }
2405
+ disconnectedCallback() {
2406
+ this.$$cn = !1, Promise.resolve().then(() => {
2407
+ !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
2408
+ });
2409
+ }
2410
+ /**
2411
+ * @param {string} attribute_name
2412
+ */
2413
+ $$g_p(e) {
2414
+ return Ke(this.$$p_d).find(
2415
+ (t) => this.$$p_d[t].attribute === e || !this.$$p_d[t].attribute && t.toLowerCase() === e
2416
+ ) || e;
2417
+ }
2418
+ });
2419
+ function We(e, t, n, r) {
2420
+ const i = n[e]?.type;
2421
+ if (t = i === "Boolean" && typeof t != "boolean" ? t != null : t, !r || !n[e])
2422
+ return t;
2423
+ if (r === "toAttribute")
2424
+ switch (i) {
2425
+ case "Object":
2426
+ case "Array":
2427
+ return t == null ? null : JSON.stringify(t);
2428
+ case "Boolean":
2429
+ return t ? "" : null;
2430
+ case "Number":
2431
+ return t ?? null;
2432
+ default:
2433
+ return t;
2434
+ }
2435
+ else
2436
+ switch (i) {
2437
+ case "Object":
2438
+ case "Array":
2439
+ return t && JSON.parse(t);
2440
+ case "Boolean":
2441
+ return t;
2442
+ // conversion already handled above
2443
+ case "Number":
2444
+ return t != null ? +t : t;
2445
+ default:
2446
+ return t;
2447
+ }
2448
+ }
2449
+ function wi(e) {
2450
+ const t = {};
2451
+ return e.childNodes.forEach((n) => {
2452
+ t[
2453
+ /** @type {Element} node */
2454
+ n.slot || "default"
2455
+ ] = !0;
2456
+ }), t;
2457
+ }
2458
+ function bi(e, t, n, r, i, s) {
2459
+ let l = class extends qn {
2460
+ constructor() {
2461
+ super(e, n, i), this.$$p_d = t;
2462
+ }
2463
+ static get observedAttributes() {
2464
+ return Ke(t).map(
2465
+ (o) => (t[o].attribute || o).toLowerCase()
2466
+ );
2467
+ }
2468
+ };
2469
+ return Ke(t).forEach((o) => {
2470
+ Je(l.prototype, o, {
2471
+ get() {
2472
+ return this.$$c && o in this.$$c ? this.$$c[o] : this.$$d[o];
2473
+ },
2474
+ set(a) {
2475
+ a = We(o, a, t), this.$$d[o] = a;
2476
+ var f = this.$$c;
2477
+ if (f) {
2478
+ var c = xe(f, o)?.get;
2479
+ c ? f[o] = a : f.$set({ [o]: a });
2480
+ }
2481
+ }
2482
+ });
2483
+ }), r.forEach((o) => {
2484
+ Je(l.prototype, o, {
2485
+ get() {
2486
+ return this.$$c?.[o];
2487
+ }
2488
+ });
2489
+ }), e.element = /** @type {any} */
2490
+ l, l;
2491
+ }
2492
+ var yi = /* @__PURE__ */ xt('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M8 5v14l11-7z" class="svelte-18mzc0g"></path></svg>'), $i = /* @__PURE__ */ xt('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z" class="svelte-18mzc0g"></path></svg>'), Ei = /* @__PURE__ */ xt('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z" class="svelte-18mzc0g"></path></svg>'), Ti = /* @__PURE__ */ Bn('<button type="button" aria-label="Stop reading"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M6 6h12v12H6z" class="svelte-18mzc0g"></path></svg></button>'), Si = /* @__PURE__ */ Bn('<div class="tts-inline-controls svelte-18mzc0g"><button type="button"><!></button> <!> <div class="sr-only svelte-18mzc0g" role="status" aria-live="polite" aria-atomic="true"> </div></div>');
2493
+ const xi = {
2494
+ hash: "svelte-18mzc0g",
2495
+ code: `.tts-inline-controls.svelte-18mzc0g {display:inline-flex;align-items:center;gap:0.25rem;}.tts-inline.svelte-18mzc0g {display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--pie-border, #ccc);background-color:var(--pie-background, white);color:var(--pie-text, #333);border-radius:4px;cursor:pointer;transition:background-color 0.15s ease,
2496
+ transform 0.1s ease,
2497
+ box-shadow 0.15s ease;padding:0.25rem;position:relative;}.tts-inline.svelte-18mzc0g:hover:not(:disabled) {background-color:var(--pie-secondary-background, #f5f5f5);transform:translateY(-1px);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);}.tts-inline.svelte-18mzc0g:active:not(:disabled) {transform:translateY(0);box-shadow:none;}
2498
+
2499
+ /* Focus indicator - WCAG 2.4.7, 2.4.13 */.tts-inline.svelte-18mzc0g:focus-visible {outline:2px solid #0066cc;outline-offset:2px;box-shadow:0 0 0 4px rgba(0, 102, 204, 0.2);z-index:1;}.tts-inline--speaking.svelte-18mzc0g {background-color:var(--pie-primary, #1976d2);color:white;border-color:var(--pie-primary, #1976d2);
2500
+ animation: svelte-18mzc0g-pulse 1.5s ease-in-out infinite;}.tts-inline--paused.svelte-18mzc0g {background-color:rgba(255, 152, 0, 0.15);}.tts-inline--stop.svelte-18mzc0g {background-color:transparent;}.tts-inline--stop.svelte-18mzc0g:hover:not(:disabled) {background-color:rgba(244, 67, 54, 0.1);}.tts-inline--stop.svelte-18mzc0g .tts-inline__icon:where(.svelte-18mzc0g) {color:#c62828; /* Darker red for better contrast - WCAG 1.4.11 */}.tts-inline.svelte-18mzc0g:disabled {cursor:not-allowed;opacity:0.6;}
2501
+
2502
+ /* Size variants */.tts-inline--sm.svelte-18mzc0g {width:1.5rem;height:1.5rem;
2503
+ /* Increase padding to meet 44px touch target - WCAG 2.5.2 */padding:0.625rem;}.tts-inline--sm.svelte-18mzc0g .tts-inline__icon:where(.svelte-18mzc0g) {width:1rem;height:1rem;}.tts-inline--md.svelte-18mzc0g {width:2rem;height:2rem;}.tts-inline--md.svelte-18mzc0g .tts-inline__icon:where(.svelte-18mzc0g) {width:1.25rem;height:1.25rem;}.tts-inline--lg.svelte-18mzc0g {width:2.5rem;height:2.5rem;}.tts-inline--lg.svelte-18mzc0g .tts-inline__icon:where(.svelte-18mzc0g) {width:1.5rem;height:1.5rem;}.tts-inline__icon.svelte-18mzc0g {fill:currentColor;color:#555;}.tts-inline.svelte-18mzc0g:hover:not(:disabled) .tts-inline__icon:where(.svelte-18mzc0g) {color:#667eea;}.tts-inline--speaking.svelte-18mzc0g .tts-inline__icon:where(.svelte-18mzc0g) {color:#667eea;}
2504
+
2505
+ @keyframes svelte-18mzc0g-pulse {
2506
+ 0%,
2507
+ 100% {
2508
+ opacity: 1;
2509
+ }
2510
+ 50% {
2511
+ opacity: 0.7;
2512
+ }
2513
+ }
2514
+
2515
+ /* Screen reader only content */.sr-only.svelte-18mzc0g {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}
2516
+
2517
+ /* Accessibility */
2518
+ @media (prefers-reduced-motion: reduce) {.tts-inline.svelte-18mzc0g,
2519
+ .tts-inline--speaking.svelte-18mzc0g {
2520
+ animation: none !important;transition:none !important;}
2521
+ }`
2522
+ };
2523
+ function ki(e, t) {
2524
+ nn(t, !0), ui(e, xi);
2525
+ let n = he(t, "toolId", 7, "tts-inline"), r = he(
2526
+ t,
2527
+ "catalogId",
2528
+ 7,
2529
+ ""
2530
+ // Explicit catalog ID
2531
+ ), i = he(t, "language", 7, "en-US"), s = he(t, "size", 7, "md"), l = he(t, "coordinator"), o = he(t, "ttsService"), a = he(t, "highlightCoordinator");
2532
+ const f = typeof window < "u";
2533
+ let c = /* @__PURE__ */ O(void 0), d = /* @__PURE__ */ O(!1), u = /* @__PURE__ */ O(!1), h = /* @__PURE__ */ O(!1), v = /* @__PURE__ */ O("");
2534
+ Pt(() => {
2535
+ l() && n() && p(c) && !p(d) && (l().registerTool(n(), "TTS Inline", p(c), Qn.TOOL), w(d, !0));
2536
+ }), Pt(() => () => {
2537
+ l() && n() && l().unregisterTool(n());
2538
+ });
2539
+ async function E() {
2540
+ if (o()) {
2541
+ if (p(h)) {
2542
+ o().resume(), w(h, !1), w(v, "Reading resumed");
2543
+ return;
2544
+ }
2545
+ if (p(u) && !p(h)) {
2546
+ o().pause(), w(h, !0), w(v, "Reading paused");
2547
+ return;
2548
+ }
2549
+ try {
2550
+ w(u, !0), w(h, !1), w(v, "Reading started");
2551
+ const $ = p(c)?.closest(".passage-header, .item-header");
2552
+ let B = null;
2553
+ if ($ && (B = $.parentElement?.querySelector(".passage-content, .item-content") || null), B || (B = p(c)?.closest(".passage-content, .item-content") || null), !B) {
2554
+ console.warn("[TTS Inline] No target container found"), w(u, !1);
2555
+ return;
2556
+ }
2557
+ const H = document.createRange();
2558
+ H.selectNodeContents(B);
2559
+ const Ie = H.toString(), ye = Ie.trim().replace(/\s+/g, " ");
2560
+ if (console.log("[TTS Inline] Text extraction:", {
2561
+ rawLength: Ie.length,
2562
+ normalizedLength: ye.length,
2563
+ preview: ye.substring(0, 100)
2564
+ }), !ye) {
2565
+ console.warn("[TTS Inline] No text content found"), w(u, !1);
2566
+ return;
2567
+ }
2568
+ a() && o().setHighlightCoordinator && o().setHighlightCoordinator(a()), await o().speak(ye, {
2569
+ catalogId: r() || void 0,
2570
+ language: i(),
2571
+ contentElement: B
2572
+ }), w(u, !1), w(h, !1), a() && a().clearTTS();
2573
+ } catch ($) {
2574
+ console.error("[TTS Inline] Error:", $), w(u, !1), w(h, !1), a() && a().clearTTS();
2575
+ }
2576
+ }
2577
+ }
2578
+ function j() {
2579
+ o() && (o().stop(), w(u, !1), w(h, !1), w(v, "Reading stopped"), a() && a().clearTTS());
2580
+ }
2581
+ const Ne = /* @__PURE__ */ Fr(() => s() === "sm" ? "tts-inline--sm" : s() === "lg" ? "tts-inline--lg" : "tts-inline--md");
2582
+ var Oe = {
2583
+ get toolId() {
2584
+ return n();
2585
+ },
2586
+ set toolId($ = "tts-inline") {
2587
+ n($), le();
2588
+ },
2589
+ get catalogId() {
2590
+ return r();
2591
+ },
2592
+ set catalogId($ = "") {
2593
+ r($), le();
2594
+ },
2595
+ get language() {
2596
+ return i();
2597
+ },
2598
+ set language($ = "en-US") {
2599
+ i($), le();
2600
+ },
2601
+ get size() {
2602
+ return s();
2603
+ },
2604
+ set size($ = "md") {
2605
+ s($), le();
2606
+ },
2607
+ get coordinator() {
2608
+ return l();
2609
+ },
2610
+ set coordinator($) {
2611
+ l($), le();
2612
+ },
2613
+ get ttsService() {
2614
+ return o();
2615
+ },
2616
+ set ttsService($) {
2617
+ o($), le();
2618
+ },
2619
+ get highlightCoordinator() {
2620
+ return a();
2621
+ },
2622
+ set highlightCoordinator($) {
2623
+ a($), le();
2624
+ }
2625
+ }, kt = Ht(), Yn = Mt(kt);
2626
+ {
2627
+ var Un = ($) => {
2628
+ var B = Si(), H = ot(B);
2629
+ let Ie;
2630
+ H.__click = E;
2631
+ var ye = ot(H);
2632
+ {
2633
+ var zt = (I) => {
2634
+ var J = yi();
2635
+ oe(I, J);
2636
+ }, Gn = (I) => {
2637
+ var J = Ht(), Jn = Mt(J);
2638
+ {
2639
+ var Zn = ($e) => {
2640
+ var st = $i();
2641
+ oe($e, st);
2642
+ }, Xn = ($e) => {
2643
+ var st = Ei();
2644
+ oe($e, st);
2645
+ };
2646
+ Ye(
2647
+ Jn,
2648
+ ($e) => {
2649
+ p(u) ? $e(Zn) : $e(Xn, !1);
2650
+ },
2651
+ !0
2652
+ );
2653
+ }
2654
+ oe(I, J);
2655
+ };
2656
+ Ye(ye, (I) => {
2657
+ p(h) ? I(zt) : I(Gn, !1);
2658
+ });
2659
+ }
2660
+ lt(H);
2661
+ var At = Dt(H, 2);
2662
+ {
2663
+ var Wn = (I) => {
2664
+ var J = Ti();
2665
+ J.__click = j, Lt(() => {
2666
+ qt(J, 1, `tts-inline tts-inline--stop ${p(Ne) ?? ""}`, "svelte-18mzc0g"), J.disabled = !o();
2667
+ }), oe(I, J);
2668
+ };
2669
+ Ye(At, (I) => {
2670
+ (p(u) || p(h)) && I(Wn);
2671
+ });
2672
+ }
2673
+ var Ct = Dt(At, 2), Kn = ot(Ct, !0);
2674
+ lt(Ct), lt(B), pi(B, (I) => w(c, I), () => p(c)), Lt(() => {
2675
+ Ie = qt(H, 1, `tts-inline ${p(Ne) ?? ""}`, "svelte-18mzc0g", Ie, {
2676
+ "tts-inline--speaking": p(u),
2677
+ "tts-inline--paused": p(h)
2678
+ }), Yt(H, "aria-label", p(h) ? "Resume reading" : p(u) ? "Pause reading" : "Read aloud"), Yt(H, "aria-pressed", p(u) || p(h)), H.disabled = !o(), li(Kn, p(v));
2679
+ }), oe($, B);
2680
+ };
2681
+ Ye(Yn, ($) => {
2682
+ f && $(Un);
2683
+ });
2684
+ }
2685
+ return oe(e, kt), rn(Oe);
2686
+ }
2687
+ ni(["click"]);
2688
+ customElements.define("pie-tool-tts-inline", bi(
2689
+ ki,
2690
+ {
2691
+ toolId: { attribute: "tool-id", type: "String" },
2692
+ catalogId: { attribute: "catalog-id", type: "String" },
2693
+ language: { attribute: "language", type: "String" },
2694
+ size: { attribute: "size", type: "String" },
2695
+ coordinator: { type: "Object" },
2696
+ ttsService: { type: "Object" },
2697
+ highlightCoordinator: { type: "Object" }
2698
+ },
2699
+ [],
2700
+ []
2701
+ ));
2702
+ export {
2703
+ ki as default
2704
+ };