@pie-players/pie-section-player 0.3.19 → 0.3.21

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