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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3443 @@
1
+ import { connectToolRuntimeContext as ps, ZIndexLayer as gs } from "@pie-players/pie-assessment-toolkit";
2
+ var bs = Object.defineProperty, Ol = (t) => {
3
+ throw TypeError(t);
4
+ }, ms = (t, e, n) => e in t ? bs(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, I = (t, e, n) => ms(t, typeof e != "symbol" ? e + "" : e, n), Er = (t, e, n) => e.has(t) || Ol("Cannot " + n), f = (t, e, n) => (Er(t, e, "read from private field"), n ? n.call(t) : e.get(t)), E = (t, e, n) => e.has(t) ? Ol("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), T = (t, e, n, r) => (Er(t, e, "write to private field"), e.set(t, n), n), et = (t, e, n) => (Er(t, e, "access private method"), n);
5
+ const ws = "5";
6
+ var hl;
7
+ typeof window < "u" && ((hl = window.__svelte ?? (window.__svelte = {})).v ?? (hl.v = /* @__PURE__ */ new Set())).add(ws);
8
+ const ys = 1, _s = 2, ks = 16, $s = 1, xs = 4, Cs = 8, Ts = 16, Es = 1, Ms = 2, Mr = "[", Nn = "[!", Sr = "]", Fe = {}, V = /* @__PURE__ */ Symbol(), zl = "http://www.w3.org/1999/xhtml", Ss = !1;
9
+ var Ar = Array.isArray, As = Array.prototype.indexOf, Be = Array.prototype.includes, qn = Array.from, On = Object.keys, zn = Object.defineProperty, Ce = Object.getOwnPropertyDescriptor, Ls = Object.getOwnPropertyDescriptors, Rs = Object.prototype, Ps = Array.prototype, Dl = Object.getPrototypeOf, vl = Object.isExtensible;
10
+ const Os = () => {
11
+ };
12
+ function zs(t) {
13
+ for (var e = 0; e < t.length; e++)
14
+ t[e]();
15
+ }
16
+ function jl() {
17
+ var t, e, n = new Promise((r, l) => {
18
+ t = r, e = l;
19
+ });
20
+ return { promise: n, resolve: t, reject: e };
21
+ }
22
+ const H = 2, pn = 4, In = 8, Wl = 1 << 24, Ft = 16, _t = 32, ce = 64, fr = 128, ut = 512, B = 1024, K = 2048, yt = 4096, lt = 8192, qt = 16384, Ye = 32768, Ue = 65536, pl = 1 << 17, Nl = 1 << 18, Re = 1 << 19, Ds = 1 << 20, le = 1 << 25, Me = 65536, dr = 1 << 21, Lr = 1 << 22, se = 1 << 23, Te = /* @__PURE__ */ Symbol("$state"), ql = /* @__PURE__ */ Symbol("legacy props"), js = /* @__PURE__ */ Symbol(""), _e = new class extends Error {
23
+ constructor() {
24
+ super(...arguments), I(this, "name", "StaleReactionError"), I(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
25
+ }
26
+ }(), Il = (
27
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
28
+ !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
29
+ ), Fn = 3, mn = 8;
30
+ function Ws(t) {
31
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
32
+ }
33
+ function Ns() {
34
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
35
+ }
36
+ function qs(t, e, n) {
37
+ throw new Error("https://svelte.dev/e/each_key_duplicate");
38
+ }
39
+ function Is(t) {
40
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
41
+ }
42
+ function Fs() {
43
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
44
+ }
45
+ function Bs(t) {
46
+ throw new Error("https://svelte.dev/e/effect_orphan");
47
+ }
48
+ function Us() {
49
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
50
+ }
51
+ function Vs() {
52
+ throw new Error("https://svelte.dev/e/hydration_failed");
53
+ }
54
+ function Hs(t) {
55
+ throw new Error("https://svelte.dev/e/props_invalid_value");
56
+ }
57
+ function Ks() {
58
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
59
+ }
60
+ function Js() {
61
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
62
+ }
63
+ function Gs() {
64
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
65
+ }
66
+ function Ys() {
67
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
68
+ }
69
+ function Bn(t) {
70
+ console.warn("https://svelte.dev/e/hydration_mismatch");
71
+ }
72
+ function Xs() {
73
+ console.warn("https://svelte.dev/e/select_multiple_invalid_value");
74
+ }
75
+ function Zs() {
76
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
77
+ }
78
+ let R = !1;
79
+ function Wt(t) {
80
+ R = t;
81
+ }
82
+ let P;
83
+ function ot(t) {
84
+ if (t === null)
85
+ throw Bn(), Fe;
86
+ return P = t;
87
+ }
88
+ function Un() {
89
+ return ot(/* @__PURE__ */ Et(P));
90
+ }
91
+ function D(t) {
92
+ if (R) {
93
+ if (/* @__PURE__ */ Et(P) !== null)
94
+ throw Bn(), Fe;
95
+ P = t;
96
+ }
97
+ }
98
+ function Gt(t = 1) {
99
+ if (R) {
100
+ for (var e = t, n = P; e--; )
101
+ n = /** @type {TemplateNode} */
102
+ /* @__PURE__ */ Et(n);
103
+ P = n;
104
+ }
105
+ }
106
+ function Dn(t = !0) {
107
+ for (var e = 0, n = P; ; ) {
108
+ if (n.nodeType === mn) {
109
+ var r = (
110
+ /** @type {Comment} */
111
+ n.data
112
+ );
113
+ if (r === Sr) {
114
+ if (e === 0) return n;
115
+ e -= 1;
116
+ } else (r === Mr || r === Nn || // "[1", "[2", etc. for if blocks
117
+ r[0] === "[" && !isNaN(Number(r.slice(1)))) && (e += 1);
118
+ }
119
+ var l = (
120
+ /** @type {TemplateNode} */
121
+ /* @__PURE__ */ Et(n)
122
+ );
123
+ t && n.remove(), n = l;
124
+ }
125
+ }
126
+ function Fl(t) {
127
+ if (!t || t.nodeType !== mn)
128
+ throw Bn(), Fe;
129
+ return (
130
+ /** @type {Comment} */
131
+ t.data
132
+ );
133
+ }
134
+ function Bl(t) {
135
+ return t === this.v;
136
+ }
137
+ function Qs(t, e) {
138
+ return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
139
+ }
140
+ function Ul(t) {
141
+ return !Qs(t, this.v);
142
+ }
143
+ let ti = !1, st = null;
144
+ function Ve(t) {
145
+ st = t;
146
+ }
147
+ function Rr(t, e = !1, n) {
148
+ st = {
149
+ p: st,
150
+ i: !1,
151
+ c: null,
152
+ e: null,
153
+ s: t,
154
+ x: null,
155
+ l: null
156
+ };
157
+ }
158
+ function Pr(t) {
159
+ var e = (
160
+ /** @type {ComponentContext} */
161
+ st
162
+ ), n = e.e;
163
+ if (n !== null) {
164
+ e.e = null;
165
+ for (var r of n)
166
+ mo(r);
167
+ }
168
+ return t !== void 0 && (e.x = t), e.i = !0, st = e.p, t ?? /** @type {T} */
169
+ {};
170
+ }
171
+ function Vl() {
172
+ return !0;
173
+ }
174
+ let ke = [];
175
+ function Hl() {
176
+ var t = ke;
177
+ ke = [], zs(t);
178
+ }
179
+ function ae(t) {
180
+ if (ke.length === 0 && !fn) {
181
+ var e = ke;
182
+ queueMicrotask(() => {
183
+ e === ke && Hl();
184
+ });
185
+ }
186
+ ke.push(t);
187
+ }
188
+ function ei() {
189
+ for (; ke.length > 0; )
190
+ Hl();
191
+ }
192
+ function Kl(t) {
193
+ var e = A;
194
+ if (e === null)
195
+ return M.f |= se, t;
196
+ if ((e.f & Ye) === 0 && (e.f & pn) === 0)
197
+ throw t;
198
+ He(t, e);
199
+ }
200
+ function He(t, e) {
201
+ for (; e !== null; ) {
202
+ if ((e.f & fr) !== 0) {
203
+ if ((e.f & Ye) === 0)
204
+ throw t;
205
+ try {
206
+ e.b.error(t);
207
+ return;
208
+ } catch (n) {
209
+ t = n;
210
+ }
211
+ }
212
+ e = e.parent;
213
+ }
214
+ throw t;
215
+ }
216
+ const ni = -7169;
217
+ function q(t, e) {
218
+ t.f = t.f & ni | e;
219
+ }
220
+ function Or(t) {
221
+ (t.f & ut) !== 0 || t.deps === null ? q(t, B) : q(t, yt);
222
+ }
223
+ function Jl(t) {
224
+ if (t !== null)
225
+ for (const e of t)
226
+ (e.f & H) === 0 || (e.f & Me) === 0 || (e.f ^= Me, Jl(
227
+ /** @type {Derived} */
228
+ e.deps
229
+ ));
230
+ }
231
+ function Gl(t, e, n) {
232
+ (t.f & K) !== 0 ? e.add(t) : (t.f & yt) !== 0 && n.add(t), Jl(t.deps), q(t, B);
233
+ }
234
+ const En = /* @__PURE__ */ new Set();
235
+ let N = null, wt = null, nt = [], Vn = null, hr = !1, fn = !1;
236
+ var ln, on, Yt, me, sn, jn, Ie, ne, an, we, vr, pr, Yl;
237
+ const ri = class Xl {
238
+ constructor() {
239
+ E(this, we), I(this, "committed", !1), I(this, "current", /* @__PURE__ */ new Map()), I(this, "previous", /* @__PURE__ */ new Map()), E(this, ln, /* @__PURE__ */ new Set()), E(this, on, /* @__PURE__ */ new Set()), E(this, Yt, 0), E(this, me, 0), E(this, sn, null), E(this, jn, /* @__PURE__ */ new Set()), E(this, Ie, /* @__PURE__ */ new Set()), E(this, ne, /* @__PURE__ */ new Map()), I(this, "is_fork", !1), E(this, an, !1);
240
+ }
241
+ is_deferred() {
242
+ return this.is_fork || f(this, me) > 0;
243
+ }
244
+ /**
245
+ * Add an effect to the #skipped_branches map and reset its children
246
+ * @param {Effect} effect
247
+ */
248
+ skip_effect(e) {
249
+ f(this, ne).has(e) || f(this, ne).set(e, { d: [], m: [] });
250
+ }
251
+ /**
252
+ * Remove an effect from the #skipped_branches map and reschedule
253
+ * any tracked dirty/maybe_dirty child effects
254
+ * @param {Effect} effect
255
+ */
256
+ unskip_effect(e) {
257
+ var n = f(this, ne).get(e);
258
+ if (n) {
259
+ f(this, ne).delete(e);
260
+ for (var r of n.d)
261
+ q(r, K), bt(r);
262
+ for (r of n.m)
263
+ q(r, yt), bt(r);
264
+ }
265
+ }
266
+ /**
267
+ *
268
+ * @param {Effect[]} root_effects
269
+ */
270
+ process(e) {
271
+ nt = [], this.apply();
272
+ var n = [], r = [];
273
+ for (const l of e)
274
+ et(this, we, vr).call(this, l, n, r);
275
+ if (this.is_deferred()) {
276
+ et(this, we, pr).call(this, r), et(this, we, pr).call(this, n);
277
+ for (const [l, s] of f(this, ne))
278
+ eo(l, s);
279
+ } else {
280
+ for (const l of f(this, ln)) l();
281
+ f(this, ln).clear(), f(this, Yt) === 0 && et(this, we, Yl).call(this), N = null, gl(r), gl(n), f(this, sn)?.resolve();
282
+ }
283
+ wt = null;
284
+ }
285
+ /**
286
+ * Associate a change to a given source with the current
287
+ * batch, noting its previous and current values
288
+ * @param {Source} source
289
+ * @param {any} value
290
+ */
291
+ capture(e, n) {
292
+ n !== V && !this.previous.has(e) && this.previous.set(e, n), (e.f & se) === 0 && (this.current.set(e, e.v), wt?.set(e, e.v));
293
+ }
294
+ activate() {
295
+ N = this, this.apply();
296
+ }
297
+ deactivate() {
298
+ N === this && (N = null, wt = null);
299
+ }
300
+ flush() {
301
+ if (this.activate(), nt.length > 0) {
302
+ if (Zl(), N !== null && N !== this)
303
+ return;
304
+ } else f(this, Yt) === 0 && this.process([]);
305
+ this.deactivate();
306
+ }
307
+ discard() {
308
+ for (const e of f(this, on)) e(this);
309
+ f(this, on).clear();
310
+ }
311
+ /**
312
+ *
313
+ * @param {boolean} blocking
314
+ */
315
+ increment(e) {
316
+ T(this, Yt, f(this, Yt) + 1), e && T(this, me, f(this, me) + 1);
317
+ }
318
+ /**
319
+ *
320
+ * @param {boolean} blocking
321
+ */
322
+ decrement(e) {
323
+ T(this, Yt, f(this, Yt) - 1), e && T(this, me, f(this, me) - 1), !f(this, an) && (T(this, an, !0), ae(() => {
324
+ T(this, an, !1), this.is_deferred() ? nt.length > 0 && this.flush() : this.revive();
325
+ }));
326
+ }
327
+ revive() {
328
+ for (const e of f(this, jn))
329
+ f(this, Ie).delete(e), q(e, K), bt(e);
330
+ for (const e of f(this, Ie))
331
+ q(e, yt), bt(e);
332
+ this.flush();
333
+ }
334
+ /** @param {() => void} fn */
335
+ oncommit(e) {
336
+ f(this, ln).add(e);
337
+ }
338
+ /** @param {(batch: Batch) => void} fn */
339
+ ondiscard(e) {
340
+ f(this, on).add(e);
341
+ }
342
+ settled() {
343
+ return (f(this, sn) ?? T(this, sn, jl())).promise;
344
+ }
345
+ static ensure() {
346
+ if (N === null) {
347
+ const e = N = new Xl();
348
+ En.add(N), fn || ae(() => {
349
+ N === e && e.flush();
350
+ });
351
+ }
352
+ return N;
353
+ }
354
+ apply() {
355
+ }
356
+ };
357
+ ln = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Yt = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakMap(), sn = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), an = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), /**
358
+ * Traverse the effect tree, executing effects or stashing
359
+ * them for later execution as appropriate
360
+ * @param {Effect} root
361
+ * @param {Effect[]} effects
362
+ * @param {Effect[]} render_effects
363
+ */
364
+ vr = function(t, e, n) {
365
+ t.f ^= B;
366
+ for (var r = t.first, l = null; r !== null; ) {
367
+ var s = r.f, a = (s & (_t | ce)) !== 0, i = a && (s & B) !== 0, u = i || (s & lt) !== 0 || f(this, ne).has(r);
368
+ if (!u && r.fn !== null) {
369
+ a ? r.f ^= B : l !== null && (s & (pn | In | Wl)) !== 0 ? l.b.defer_effect(r) : (s & pn) !== 0 ? e.push(r) : wn(r) && ((s & Ft) !== 0 && f(this, Ie).add(r), Ge(r));
370
+ var c = r.first;
371
+ if (c !== null) {
372
+ r = c;
373
+ continue;
374
+ }
375
+ }
376
+ for (; r !== null; ) {
377
+ r === l && (l = null);
378
+ var h = r.next;
379
+ if (h !== null) {
380
+ r = h;
381
+ break;
382
+ }
383
+ r = r.parent;
384
+ }
385
+ }
386
+ }, /**
387
+ * @param {Effect[]} effects
388
+ */
389
+ pr = function(t) {
390
+ for (var e = 0; e < t.length; e += 1)
391
+ Gl(t[e], f(this, jn), f(this, Ie));
392
+ }, Yl = function() {
393
+ var t;
394
+ if (En.size > 1) {
395
+ this.previous.clear();
396
+ var e = wt, n = !0;
397
+ for (const l of En) {
398
+ if (l === this) {
399
+ n = !1;
400
+ continue;
401
+ }
402
+ const s = [];
403
+ for (const [i, u] of this.current) {
404
+ if (l.current.has(i))
405
+ if (n && u !== l.current.get(i))
406
+ l.current.set(i, u);
407
+ else
408
+ continue;
409
+ s.push(i);
410
+ }
411
+ if (s.length === 0)
412
+ continue;
413
+ const a = [...l.current.keys()].filter((i) => !this.current.has(i));
414
+ if (a.length > 0) {
415
+ var r = nt;
416
+ nt = [];
417
+ const i = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
418
+ for (const c of s)
419
+ Ql(c, a, i, u);
420
+ if (nt.length > 0) {
421
+ N = l, l.apply();
422
+ for (const c of nt)
423
+ et(t = l, we, vr).call(t, c, [], []);
424
+ l.deactivate();
425
+ }
426
+ nt = r;
427
+ }
428
+ }
429
+ N = null, wt = e;
430
+ }
431
+ this.committed = !0, En.delete(this);
432
+ };
433
+ let Se = ri;
434
+ function Nt(t) {
435
+ var e = fn;
436
+ fn = !0;
437
+ try {
438
+ for (var n; ; ) {
439
+ if (ei(), nt.length === 0 && (N?.flush(), nt.length === 0))
440
+ return Vn = null, /** @type {T} */
441
+ n;
442
+ Zl();
443
+ }
444
+ } finally {
445
+ fn = e;
446
+ }
447
+ }
448
+ function Zl() {
449
+ hr = !0;
450
+ try {
451
+ for (var t = 0; nt.length > 0; ) {
452
+ var e = Se.ensure();
453
+ if (t++ > 1e3) {
454
+ var n, r;
455
+ li();
456
+ }
457
+ e.process(nt), ie.clear();
458
+ }
459
+ } finally {
460
+ nt = [], hr = !1, Vn = null;
461
+ }
462
+ }
463
+ function li() {
464
+ try {
465
+ Us();
466
+ } catch (t) {
467
+ He(t, Vn);
468
+ }
469
+ }
470
+ let zt = null;
471
+ function gl(t) {
472
+ var e = t.length;
473
+ if (e !== 0) {
474
+ for (var n = 0; n < e; ) {
475
+ var r = t[n++];
476
+ if ((r.f & (qt | lt)) === 0 && wn(r) && (zt = /* @__PURE__ */ new Set(), Ge(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && _o(r), zt?.size > 0)) {
477
+ ie.clear();
478
+ for (const l of zt) {
479
+ if ((l.f & (qt | lt)) !== 0) continue;
480
+ const s = [l];
481
+ let a = l.parent;
482
+ for (; a !== null; )
483
+ zt.has(a) && (zt.delete(a), s.push(a)), a = a.parent;
484
+ for (let i = s.length - 1; i >= 0; i--) {
485
+ const u = s[i];
486
+ (u.f & (qt | lt)) === 0 && Ge(u);
487
+ }
488
+ }
489
+ zt.clear();
490
+ }
491
+ }
492
+ zt = null;
493
+ }
494
+ }
495
+ function Ql(t, e, n, r) {
496
+ if (!n.has(t) && (n.add(t), t.reactions !== null))
497
+ for (const l of t.reactions) {
498
+ const s = l.f;
499
+ (s & H) !== 0 ? Ql(
500
+ /** @type {Derived} */
501
+ l,
502
+ e,
503
+ n,
504
+ r
505
+ ) : (s & (Lr | Ft)) !== 0 && (s & K) === 0 && to(l, e, r) && (q(l, K), bt(
506
+ /** @type {Effect} */
507
+ l
508
+ ));
509
+ }
510
+ }
511
+ function to(t, e, n) {
512
+ const r = n.get(t);
513
+ if (r !== void 0) return r;
514
+ if (t.deps !== null)
515
+ for (const l of t.deps) {
516
+ if (Be.call(e, l))
517
+ return !0;
518
+ if ((l.f & H) !== 0 && to(
519
+ /** @type {Derived} */
520
+ l,
521
+ e,
522
+ n
523
+ ))
524
+ return n.set(
525
+ /** @type {Derived} */
526
+ l,
527
+ !0
528
+ ), !0;
529
+ }
530
+ return n.set(t, !1), !1;
531
+ }
532
+ function bt(t) {
533
+ for (var e = Vn = t; e.parent !== null; ) {
534
+ e = e.parent;
535
+ var n = e.f;
536
+ if (hr && e === A && (n & Ft) !== 0 && (n & Nl) === 0)
537
+ return;
538
+ if ((n & (ce | _t)) !== 0) {
539
+ if ((n & B) === 0) return;
540
+ e.f ^= B;
541
+ }
542
+ }
543
+ nt.push(e);
544
+ }
545
+ function eo(t, e) {
546
+ if (!((t.f & _t) !== 0 && (t.f & B) !== 0)) {
547
+ (t.f & K) !== 0 ? e.d.push(t) : (t.f & yt) !== 0 && e.m.push(t), q(t, B);
548
+ for (var n = t.first; n !== null; )
549
+ eo(n, e), n = n.next;
550
+ }
551
+ }
552
+ function oi(t) {
553
+ let e = 0, n = Ae(0), r;
554
+ return () => {
555
+ Wr() && (o(n), Nr(() => (e === 0 && (r = Kn(() => t(() => vn(n)))), e += 1, () => {
556
+ ae(() => {
557
+ e -= 1, e === 0 && (r?.(), r = void 0, vn(n));
558
+ });
559
+ })));
560
+ };
561
+ }
562
+ var si = Ue | Re;
563
+ function ii(t, e, n) {
564
+ new ai(t, e, n);
565
+ }
566
+ var gt, Mn, re, Ne, Dt, jt, at, Pt, Xt, ye, Zt, un, dn, hn, Qt, gr, pt, no, ro, br, Wn, mr;
567
+ class ai {
568
+ /**
569
+ * @param {TemplateNode} node
570
+ * @param {BoundaryProps} props
571
+ * @param {((anchor: Node) => void)} children
572
+ */
573
+ constructor(e, n, r) {
574
+ E(this, pt), I(this, "parent"), I(this, "is_pending", !1), E(this, gt), E(this, Mn, R ? P : null), E(this, re), E(this, Ne), E(this, Dt), E(this, jt, null), E(this, at, null), E(this, Pt, null), E(this, Xt, null), E(this, ye, 0), E(this, Zt, 0), E(this, un, !1), E(this, dn, /* @__PURE__ */ new Set()), E(this, hn, /* @__PURE__ */ new Set()), E(this, Qt, null), E(this, gr, oi(() => (T(this, Qt, Ae(f(this, ye))), () => {
575
+ T(this, Qt, null);
576
+ }))), T(this, gt, e), T(this, re, n), T(this, Ne, (l) => {
577
+ var s = (
578
+ /** @type {Effect} */
579
+ A
580
+ );
581
+ s.b = this, s.f |= fr, r(l);
582
+ }), this.parent = /** @type {Effect} */
583
+ A.b, T(this, Dt, qr(() => {
584
+ if (R) {
585
+ const l = (
586
+ /** @type {Comment} */
587
+ f(this, Mn)
588
+ );
589
+ Un(), l.data === Nn ? et(this, pt, ro).call(this) : et(this, pt, no).call(this);
590
+ } else
591
+ et(this, pt, br).call(this);
592
+ }, si)), R && T(this, gt, P);
593
+ }
594
+ /**
595
+ * Defer an effect inside a pending boundary until the boundary resolves
596
+ * @param {Effect} effect
597
+ */
598
+ defer_effect(e) {
599
+ Gl(e, f(this, dn), f(this, hn));
600
+ }
601
+ /**
602
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
603
+ * @returns {boolean}
604
+ */
605
+ is_rendered() {
606
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
607
+ }
608
+ has_pending_snippet() {
609
+ return !!f(this, re).pending;
610
+ }
611
+ /**
612
+ * Update the source that powers `$effect.pending()` inside this boundary,
613
+ * and controls when the current `pending` snippet (if any) is removed.
614
+ * Do not call from inside the class
615
+ * @param {1 | -1} d
616
+ */
617
+ update_pending_count(e) {
618
+ et(this, pt, mr).call(this, e), T(this, ye, f(this, ye) + e), !(!f(this, Qt) || f(this, un)) && (T(this, un, !0), ae(() => {
619
+ T(this, un, !1), f(this, Qt) && Ke(f(this, Qt), f(this, ye));
620
+ }));
621
+ }
622
+ get_effect_pending() {
623
+ return f(this, gr).call(this), o(
624
+ /** @type {Source<number>} */
625
+ f(this, Qt)
626
+ );
627
+ }
628
+ /** @param {unknown} error */
629
+ error(e) {
630
+ var n = f(this, re).onerror;
631
+ let r = f(this, re).failed;
632
+ if (!n && !r)
633
+ throw e;
634
+ f(this, jt) && (Y(f(this, jt)), T(this, jt, null)), f(this, at) && (Y(f(this, at)), T(this, at, null)), f(this, Pt) && (Y(f(this, Pt)), T(this, Pt, null)), R && (ot(
635
+ /** @type {TemplateNode} */
636
+ f(this, Mn)
637
+ ), Gt(), ot(Dn()));
638
+ var l = !1, s = !1;
639
+ const a = () => {
640
+ if (l) {
641
+ Zs();
642
+ return;
643
+ }
644
+ l = !0, s && Ys(), f(this, Pt) !== null && Le(f(this, Pt), () => {
645
+ T(this, Pt, null);
646
+ }), et(this, pt, Wn).call(this, () => {
647
+ Se.ensure(), et(this, pt, br).call(this);
648
+ });
649
+ };
650
+ ae(() => {
651
+ try {
652
+ s = !0, n?.(e, a), s = !1;
653
+ } catch (i) {
654
+ He(i, f(this, Dt) && f(this, Dt).parent);
655
+ }
656
+ r && T(this, Pt, et(this, pt, Wn).call(this, () => {
657
+ Se.ensure();
658
+ try {
659
+ return Ct(() => {
660
+ var i = (
661
+ /** @type {Effect} */
662
+ A
663
+ );
664
+ i.b = this, i.f |= fr, r(
665
+ f(this, gt),
666
+ () => e,
667
+ () => a
668
+ );
669
+ });
670
+ } catch (i) {
671
+ return He(
672
+ i,
673
+ /** @type {Effect} */
674
+ f(this, Dt).parent
675
+ ), null;
676
+ }
677
+ }));
678
+ });
679
+ }
680
+ }
681
+ gt = /* @__PURE__ */ new WeakMap(), Mn = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), Ne = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), jt = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new WeakMap(), dn = /* @__PURE__ */ new WeakMap(), hn = /* @__PURE__ */ new WeakMap(), Qt = /* @__PURE__ */ new WeakMap(), gr = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakSet(), no = function() {
682
+ try {
683
+ T(this, jt, Ct(() => f(this, Ne).call(this, f(this, gt))));
684
+ } catch (t) {
685
+ this.error(t);
686
+ }
687
+ }, ro = function() {
688
+ const t = f(this, re).pending;
689
+ t && (this.is_pending = !0, T(this, at, Ct(() => t(f(this, gt)))), ae(() => {
690
+ var e = T(this, Xt, document.createDocumentFragment()), n = It();
691
+ e.append(n), T(this, jt, et(this, pt, Wn).call(this, () => (Se.ensure(), Ct(() => f(this, Ne).call(this, n))))), f(this, Zt) === 0 && (f(this, gt).before(e), T(this, Xt, null), Le(
692
+ /** @type {Effect} */
693
+ f(this, at),
694
+ () => {
695
+ T(this, at, null);
696
+ }
697
+ ), this.is_pending = !1);
698
+ }));
699
+ }, br = function() {
700
+ try {
701
+ if (this.is_pending = this.has_pending_snippet(), T(this, Zt, 0), T(this, ye, 0), T(this, jt, Ct(() => {
702
+ f(this, Ne).call(this, f(this, gt));
703
+ })), f(this, Zt) > 0) {
704
+ var t = T(this, Xt, document.createDocumentFragment());
705
+ xo(f(this, jt), t);
706
+ const e = (
707
+ /** @type {(anchor: Node) => void} */
708
+ f(this, re).pending
709
+ );
710
+ T(this, at, Ct(() => e(f(this, gt))));
711
+ } else
712
+ this.is_pending = !1;
713
+ } catch (e) {
714
+ this.error(e);
715
+ }
716
+ }, /**
717
+ * @template T
718
+ * @param {() => T} fn
719
+ */
720
+ Wn = function(t) {
721
+ var e = A, n = M, r = st;
722
+ Tt(f(this, Dt)), ft(f(this, Dt)), Ve(f(this, Dt).ctx);
723
+ try {
724
+ return t();
725
+ } catch (l) {
726
+ return Kl(l), null;
727
+ } finally {
728
+ Tt(e), ft(n), Ve(r);
729
+ }
730
+ }, /**
731
+ * Updates the pending count associated with the currently visible pending snippet,
732
+ * if any, such that we can replace the snippet with content once work is done
733
+ * @param {1 | -1} d
734
+ */
735
+ mr = function(t) {
736
+ var e;
737
+ if (!this.has_pending_snippet()) {
738
+ this.parent && et(e = this.parent, pt, mr).call(e, t);
739
+ return;
740
+ }
741
+ if (T(this, Zt, f(this, Zt) + t), f(this, Zt) === 0) {
742
+ this.is_pending = !1;
743
+ for (const n of f(this, dn))
744
+ q(n, K), bt(n);
745
+ for (const n of f(this, hn))
746
+ q(n, yt), bt(n);
747
+ f(this, dn).clear(), f(this, hn).clear(), f(this, at) && Le(f(this, at), () => {
748
+ T(this, at, null);
749
+ }), f(this, Xt) && (f(this, gt).before(f(this, Xt)), T(this, Xt, null));
750
+ }
751
+ };
752
+ function ui(t, e, n, r) {
753
+ const l = Hn;
754
+ var s = t.filter((g) => !g.settled);
755
+ if (n.length === 0 && s.length === 0) {
756
+ r(e.map(l));
757
+ return;
758
+ }
759
+ var a = N, i = (
760
+ /** @type {Effect} */
761
+ A
762
+ ), u = ci(), c = s.length === 1 ? s[0].promise : s.length > 1 ? Promise.all(s.map((g) => g.promise)) : null;
763
+ function h(g) {
764
+ u();
765
+ try {
766
+ r(g);
767
+ } catch (_) {
768
+ (i.f & qt) === 0 && He(_, i);
769
+ }
770
+ a?.deactivate(), wr();
771
+ }
772
+ if (n.length === 0) {
773
+ c.then(() => h(e.map(l)));
774
+ return;
775
+ }
776
+ function p() {
777
+ u(), Promise.all(n.map((g) => /* @__PURE__ */ fi(g))).then((g) => h([...e.map(l), ...g])).catch((g) => He(g, i));
778
+ }
779
+ c ? c.then(p) : p();
780
+ }
781
+ function ci() {
782
+ var t = A, e = M, n = st, r = N;
783
+ return function(l = !0) {
784
+ Tt(t), ft(e), Ve(n), l && r?.activate();
785
+ };
786
+ }
787
+ function wr() {
788
+ Tt(null), ft(null), Ve(null);
789
+ }
790
+ // @__NO_SIDE_EFFECTS__
791
+ function Hn(t) {
792
+ var e = H | K, n = M !== null && (M.f & H) !== 0 ? (
793
+ /** @type {Derived} */
794
+ M
795
+ ) : null;
796
+ return A !== null && (A.f |= Re), {
797
+ ctx: st,
798
+ deps: null,
799
+ effects: null,
800
+ equals: Bl,
801
+ f: e,
802
+ fn: t,
803
+ reactions: null,
804
+ rv: 0,
805
+ v: (
806
+ /** @type {V} */
807
+ V
808
+ ),
809
+ wv: 0,
810
+ parent: n ?? A,
811
+ ac: null
812
+ };
813
+ }
814
+ // @__NO_SIDE_EFFECTS__
815
+ function fi(t, e, n) {
816
+ let r = (
817
+ /** @type {Effect | null} */
818
+ A
819
+ );
820
+ r === null && Ns();
821
+ var l = (
822
+ /** @type {Boundary} */
823
+ r.b
824
+ ), s = (
825
+ /** @type {Promise<V>} */
826
+ /** @type {unknown} */
827
+ void 0
828
+ ), a = Ae(
829
+ /** @type {V} */
830
+ V
831
+ ), i = !M, u = /* @__PURE__ */ new Map();
832
+ return $i(() => {
833
+ var c = jl();
834
+ s = c.promise;
835
+ try {
836
+ Promise.resolve(t()).then(c.resolve, c.reject).then(() => {
837
+ h === N && h.committed && h.deactivate(), wr();
838
+ });
839
+ } catch (_) {
840
+ c.reject(_), wr();
841
+ }
842
+ var h = (
843
+ /** @type {Batch} */
844
+ N
845
+ );
846
+ if (i) {
847
+ var p = l.is_rendered();
848
+ l.update_pending_count(1), h.increment(p), u.get(h)?.reject(_e), u.delete(h), u.set(h, c);
849
+ }
850
+ const g = (_, v = void 0) => {
851
+ if (h.activate(), v)
852
+ v !== _e && (a.f |= se, Ke(a, v));
853
+ else {
854
+ (a.f & se) !== 0 && (a.f ^= se), Ke(a, _);
855
+ for (const [y, C] of u) {
856
+ if (u.delete(y), y === h) break;
857
+ C.reject(_e);
858
+ }
859
+ }
860
+ i && (l.update_pending_count(-1), h.decrement(p));
861
+ };
862
+ c.promise.then(g, (_) => g(null, _ || "unknown"));
863
+ }), bo(() => {
864
+ for (const c of u.values())
865
+ c.reject(_e);
866
+ }), new Promise((c) => {
867
+ function h(p) {
868
+ function g() {
869
+ p === s ? c(a) : h(s);
870
+ }
871
+ p.then(g, g);
872
+ }
873
+ h(s);
874
+ });
875
+ }
876
+ // @__NO_SIDE_EFFECTS__
877
+ function ge(t) {
878
+ const e = /* @__PURE__ */ Hn(t);
879
+ return Co(e), e;
880
+ }
881
+ // @__NO_SIDE_EFFECTS__
882
+ function lo(t) {
883
+ const e = /* @__PURE__ */ Hn(t);
884
+ return e.equals = Ul, e;
885
+ }
886
+ function di(t) {
887
+ var e = t.effects;
888
+ if (e !== null) {
889
+ t.effects = null;
890
+ for (var n = 0; n < e.length; n += 1)
891
+ Y(
892
+ /** @type {Effect} */
893
+ e[n]
894
+ );
895
+ }
896
+ }
897
+ function hi(t) {
898
+ for (var e = t.parent; e !== null; ) {
899
+ if ((e.f & H) === 0)
900
+ return (e.f & qt) === 0 ? (
901
+ /** @type {Effect} */
902
+ e
903
+ ) : null;
904
+ e = e.parent;
905
+ }
906
+ return null;
907
+ }
908
+ function zr(t) {
909
+ var e, n = A;
910
+ Tt(hi(t));
911
+ try {
912
+ t.f &= ~Me, di(t), e = So(t);
913
+ } finally {
914
+ Tt(n);
915
+ }
916
+ return e;
917
+ }
918
+ function oo(t) {
919
+ var e = zr(t);
920
+ if (!t.equals(e) && (t.wv = Eo(), (!N?.is_fork || t.deps === null) && (t.v = e, t.deps === null))) {
921
+ q(t, B);
922
+ return;
923
+ }
924
+ ue || (wt !== null ? (Wr() || N?.is_fork) && wt.set(t, e) : Or(t));
925
+ }
926
+ function vi(t) {
927
+ if (t.effects !== null)
928
+ for (const e of t.effects)
929
+ (e.teardown || e.ac) && (e.teardown?.(), e.ac?.abort(_e), e.teardown = Os, e.ac = null, gn(e, 0), Ir(e));
930
+ }
931
+ function so(t) {
932
+ if (t.effects !== null)
933
+ for (const e of t.effects)
934
+ e.teardown && Ge(e);
935
+ }
936
+ let yr = /* @__PURE__ */ new Set();
937
+ const ie = /* @__PURE__ */ new Map();
938
+ let io = !1;
939
+ function Ae(t, e) {
940
+ var n = {
941
+ f: 0,
942
+ // TODO ideally we could skip this altogether, but it causes type errors
943
+ v: t,
944
+ reactions: null,
945
+ equals: Bl,
946
+ rv: 0,
947
+ wv: 0
948
+ };
949
+ return n;
950
+ }
951
+ // @__NO_SIDE_EFFECTS__
952
+ function S(t, e) {
953
+ const n = Ae(t);
954
+ return Co(n), n;
955
+ }
956
+ // @__NO_SIDE_EFFECTS__
957
+ function ao(t, e = !1, n = !0) {
958
+ const r = Ae(t);
959
+ return e || (r.equals = Ul), r;
960
+ }
961
+ function m(t, e, n = !1) {
962
+ M !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
963
+ // to ensure we error if state is set inside an inspect effect
964
+ (!mt || (M.f & pl) !== 0) && Vl() && (M.f & (H | Ft | Lr | pl)) !== 0 && (ct === null || !Be.call(ct, t)) && Gs();
965
+ let r = n ? $e(e) : e;
966
+ return Ke(t, r);
967
+ }
968
+ function Ke(t, e) {
969
+ if (!t.equals(e)) {
970
+ var n = t.v;
971
+ ue ? ie.set(t, e) : ie.set(t, n), t.v = e;
972
+ var r = Se.ensure();
973
+ if (r.capture(t, n), (t.f & H) !== 0) {
974
+ const l = (
975
+ /** @type {Derived} */
976
+ t
977
+ );
978
+ (t.f & K) !== 0 && zr(l), Or(l);
979
+ }
980
+ t.wv = Eo(), uo(t, K), A !== null && (A.f & B) !== 0 && (A.f & (_t | ce)) === 0 && (it === null ? Ti([t]) : it.push(t)), !r.is_fork && yr.size > 0 && !io && pi();
981
+ }
982
+ return e;
983
+ }
984
+ function pi() {
985
+ io = !1;
986
+ for (const t of yr)
987
+ (t.f & B) !== 0 && q(t, yt), wn(t) && Ge(t);
988
+ yr.clear();
989
+ }
990
+ function vn(t) {
991
+ m(t, t.v + 1);
992
+ }
993
+ function uo(t, e) {
994
+ var n = t.reactions;
995
+ if (n !== null)
996
+ for (var r = n.length, l = 0; l < r; l++) {
997
+ var s = n[l], a = s.f, i = (a & K) === 0;
998
+ if (i && q(s, e), (a & H) !== 0) {
999
+ var u = (
1000
+ /** @type {Derived} */
1001
+ s
1002
+ );
1003
+ wt?.delete(u), (a & Me) === 0 && (a & ut && (s.f |= Me), uo(u, yt));
1004
+ } else i && ((a & Ft) !== 0 && zt !== null && zt.add(
1005
+ /** @type {Effect} */
1006
+ s
1007
+ ), bt(
1008
+ /** @type {Effect} */
1009
+ s
1010
+ ));
1011
+ }
1012
+ }
1013
+ function $e(t) {
1014
+ if (typeof t != "object" || t === null || Te in t)
1015
+ return t;
1016
+ const e = Dl(t);
1017
+ if (e !== Rs && e !== Ps)
1018
+ return t;
1019
+ var n = /* @__PURE__ */ new Map(), r = Ar(t), l = /* @__PURE__ */ S(0), s = Ee, a = (i) => {
1020
+ if (Ee === s)
1021
+ return i();
1022
+ var u = M, c = Ee;
1023
+ ft(null), _l(s);
1024
+ var h = i();
1025
+ return ft(u), _l(c), h;
1026
+ };
1027
+ return r && n.set("length", /* @__PURE__ */ S(
1028
+ /** @type {any[]} */
1029
+ t.length
1030
+ )), new Proxy(
1031
+ /** @type {any} */
1032
+ t,
1033
+ {
1034
+ defineProperty(i, u, c) {
1035
+ (!("value" in c) || c.configurable === !1 || c.enumerable === !1 || c.writable === !1) && Ks();
1036
+ var h = n.get(u);
1037
+ return h === void 0 ? a(() => {
1038
+ var p = /* @__PURE__ */ S(c.value);
1039
+ return n.set(u, p), p;
1040
+ }) : m(h, c.value, !0), !0;
1041
+ },
1042
+ deleteProperty(i, u) {
1043
+ var c = n.get(u);
1044
+ if (c === void 0) {
1045
+ if (u in i) {
1046
+ const h = a(() => /* @__PURE__ */ S(V));
1047
+ n.set(u, h), vn(l);
1048
+ }
1049
+ } else
1050
+ m(c, V), vn(l);
1051
+ return !0;
1052
+ },
1053
+ get(i, u, c) {
1054
+ if (u === Te)
1055
+ return t;
1056
+ var h = n.get(u), p = u in i;
1057
+ if (h === void 0 && (!p || Ce(i, u)?.writable) && (h = a(() => {
1058
+ var _ = $e(p ? i[u] : V), v = /* @__PURE__ */ S(_);
1059
+ return v;
1060
+ }), n.set(u, h)), h !== void 0) {
1061
+ var g = o(h);
1062
+ return g === V ? void 0 : g;
1063
+ }
1064
+ return Reflect.get(i, u, c);
1065
+ },
1066
+ getOwnPropertyDescriptor(i, u) {
1067
+ var c = Reflect.getOwnPropertyDescriptor(i, u);
1068
+ if (c && "value" in c) {
1069
+ var h = n.get(u);
1070
+ h && (c.value = o(h));
1071
+ } else if (c === void 0) {
1072
+ var p = n.get(u), g = p?.v;
1073
+ if (p !== void 0 && g !== V)
1074
+ return {
1075
+ enumerable: !0,
1076
+ configurable: !0,
1077
+ value: g,
1078
+ writable: !0
1079
+ };
1080
+ }
1081
+ return c;
1082
+ },
1083
+ has(i, u) {
1084
+ if (u === Te)
1085
+ return !0;
1086
+ var c = n.get(u), h = c !== void 0 && c.v !== V || Reflect.has(i, u);
1087
+ if (c !== void 0 || A !== null && (!h || Ce(i, u)?.writable)) {
1088
+ c === void 0 && (c = a(() => {
1089
+ var g = h ? $e(i[u]) : V, _ = /* @__PURE__ */ S(g);
1090
+ return _;
1091
+ }), n.set(u, c));
1092
+ var p = o(c);
1093
+ if (p === V)
1094
+ return !1;
1095
+ }
1096
+ return h;
1097
+ },
1098
+ set(i, u, c, h) {
1099
+ var p = n.get(u), g = u in i;
1100
+ if (r && u === "length")
1101
+ for (var _ = c; _ < /** @type {Source<number>} */
1102
+ p.v; _ += 1) {
1103
+ var v = n.get(_ + "");
1104
+ v !== void 0 ? m(v, V) : _ in i && (v = a(() => /* @__PURE__ */ S(V)), n.set(_ + "", v));
1105
+ }
1106
+ if (p === void 0)
1107
+ (!g || Ce(i, u)?.writable) && (p = a(() => /* @__PURE__ */ S(void 0)), m(p, $e(c)), n.set(u, p));
1108
+ else {
1109
+ g = p.v !== V;
1110
+ var y = a(() => $e(c));
1111
+ m(p, y);
1112
+ }
1113
+ var C = Reflect.getOwnPropertyDescriptor(i, u);
1114
+ if (C?.set && C.set.call(h, c), !g) {
1115
+ if (r && typeof u == "string") {
1116
+ var k = (
1117
+ /** @type {Source<number>} */
1118
+ n.get("length")
1119
+ ), b = Number(u);
1120
+ Number.isInteger(b) && b >= k.v && m(k, b + 1);
1121
+ }
1122
+ vn(l);
1123
+ }
1124
+ return !0;
1125
+ },
1126
+ ownKeys(i) {
1127
+ o(l);
1128
+ var u = Reflect.ownKeys(i).filter((p) => {
1129
+ var g = n.get(p);
1130
+ return g === void 0 || g.v !== V;
1131
+ });
1132
+ for (var [c, h] of n)
1133
+ h.v !== V && !(c in i) && u.push(c);
1134
+ return u;
1135
+ },
1136
+ setPrototypeOf() {
1137
+ Js();
1138
+ }
1139
+ }
1140
+ );
1141
+ }
1142
+ function bl(t) {
1143
+ try {
1144
+ if (t !== null && typeof t == "object" && Te in t)
1145
+ return t[Te];
1146
+ } catch {
1147
+ }
1148
+ return t;
1149
+ }
1150
+ function gi(t, e) {
1151
+ return Object.is(bl(t), bl(e));
1152
+ }
1153
+ var ml, co, fo, ho;
1154
+ function _r() {
1155
+ if (ml === void 0) {
1156
+ ml = window, co = /Firefox/.test(navigator.userAgent);
1157
+ var t = Element.prototype, e = Node.prototype, n = Text.prototype;
1158
+ fo = Ce(e, "firstChild").get, ho = Ce(e, "nextSibling").get, vl(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), vl(n) && (n.__t = void 0);
1159
+ }
1160
+ }
1161
+ function It(t = "") {
1162
+ return document.createTextNode(t);
1163
+ }
1164
+ // @__NO_SIDE_EFFECTS__
1165
+ function Je(t) {
1166
+ return (
1167
+ /** @type {TemplateNode | null} */
1168
+ fo.call(t)
1169
+ );
1170
+ }
1171
+ // @__NO_SIDE_EFFECTS__
1172
+ function Et(t) {
1173
+ return (
1174
+ /** @type {TemplateNode | null} */
1175
+ ho.call(t)
1176
+ );
1177
+ }
1178
+ function j(t, e) {
1179
+ if (!R)
1180
+ return /* @__PURE__ */ Je(t);
1181
+ var n = /* @__PURE__ */ Je(P);
1182
+ if (n === null)
1183
+ n = P.appendChild(It());
1184
+ else if (e && n.nodeType !== Fn) {
1185
+ var r = It();
1186
+ return n?.before(r), ot(r), r;
1187
+ }
1188
+ return e && jr(
1189
+ /** @type {Text} */
1190
+ n
1191
+ ), ot(n), n;
1192
+ }
1193
+ function bi(t, e = !1) {
1194
+ if (!R) {
1195
+ var n = /* @__PURE__ */ Je(t);
1196
+ return n instanceof Comment && n.data === "" ? /* @__PURE__ */ Et(n) : n;
1197
+ }
1198
+ if (e) {
1199
+ if (P?.nodeType !== Fn) {
1200
+ var r = It();
1201
+ return P?.before(r), ot(r), r;
1202
+ }
1203
+ jr(
1204
+ /** @type {Text} */
1205
+ P
1206
+ );
1207
+ }
1208
+ return P;
1209
+ }
1210
+ function W(t, e = 1, n = !1) {
1211
+ let r = R ? P : t;
1212
+ for (var l; e--; )
1213
+ l = r, r = /** @type {TemplateNode} */
1214
+ /* @__PURE__ */ Et(r);
1215
+ if (!R)
1216
+ return r;
1217
+ if (n) {
1218
+ if (r?.nodeType !== Fn) {
1219
+ var s = It();
1220
+ return r === null ? l?.after(s) : r.before(s), ot(s), s;
1221
+ }
1222
+ jr(
1223
+ /** @type {Text} */
1224
+ r
1225
+ );
1226
+ }
1227
+ return ot(r), r;
1228
+ }
1229
+ function vo(t) {
1230
+ t.textContent = "";
1231
+ }
1232
+ function po() {
1233
+ return !1;
1234
+ }
1235
+ function Dr(t, e, n) {
1236
+ return (
1237
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
1238
+ document.createElementNS(zl, t, void 0)
1239
+ );
1240
+ }
1241
+ function jr(t) {
1242
+ if (
1243
+ /** @type {string} */
1244
+ t.nodeValue.length < 65536
1245
+ )
1246
+ return;
1247
+ let e = t.nextSibling;
1248
+ for (; e !== null && e.nodeType === Fn; )
1249
+ e.remove(), t.nodeValue += /** @type {string} */
1250
+ e.nodeValue, e = t.nextSibling;
1251
+ }
1252
+ let wl = !1;
1253
+ function mi() {
1254
+ wl || (wl = !0, document.addEventListener(
1255
+ "reset",
1256
+ (t) => {
1257
+ Promise.resolve().then(() => {
1258
+ if (!t.defaultPrevented)
1259
+ for (
1260
+ const e of
1261
+ /**@type {HTMLFormElement} */
1262
+ t.target.elements
1263
+ )
1264
+ e.__on_r?.();
1265
+ });
1266
+ },
1267
+ // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
1268
+ { capture: !0 }
1269
+ ));
1270
+ }
1271
+ function go(t) {
1272
+ var e = M, n = A;
1273
+ ft(null), Tt(null);
1274
+ try {
1275
+ return t();
1276
+ } finally {
1277
+ ft(e), Tt(n);
1278
+ }
1279
+ }
1280
+ function wi(t) {
1281
+ A === null && (M === null && Bs(), Fs()), ue && Is();
1282
+ }
1283
+ function yi(t, e) {
1284
+ var n = e.last;
1285
+ n === null ? e.last = e.first = t : (n.next = t, t.prev = n, e.last = t);
1286
+ }
1287
+ function Mt(t, e, n) {
1288
+ var r = A;
1289
+ r !== null && (r.f & lt) !== 0 && (t |= lt);
1290
+ var l = {
1291
+ ctx: st,
1292
+ deps: null,
1293
+ nodes: null,
1294
+ f: t | K | ut,
1295
+ first: null,
1296
+ fn: e,
1297
+ last: null,
1298
+ next: null,
1299
+ parent: r,
1300
+ b: r && r.b,
1301
+ prev: null,
1302
+ teardown: null,
1303
+ wv: 0,
1304
+ ac: null
1305
+ };
1306
+ if (n)
1307
+ try {
1308
+ Ge(l);
1309
+ } catch (i) {
1310
+ throw Y(l), i;
1311
+ }
1312
+ else e !== null && bt(l);
1313
+ var s = l;
1314
+ if (n && s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
1315
+ (s.f & Re) === 0 && (s = s.first, (t & Ft) !== 0 && (t & Ue) !== 0 && s !== null && (s.f |= Ue)), s !== null && (s.parent = r, r !== null && yi(s, r), M !== null && (M.f & H) !== 0 && (t & ce) === 0)) {
1316
+ var a = (
1317
+ /** @type {Derived} */
1318
+ M
1319
+ );
1320
+ (a.effects ?? (a.effects = [])).push(s);
1321
+ }
1322
+ return l;
1323
+ }
1324
+ function Wr() {
1325
+ return M !== null && !mt;
1326
+ }
1327
+ function bo(t) {
1328
+ const e = Mt(In, null, !1);
1329
+ return q(e, B), e.teardown = t, e;
1330
+ }
1331
+ function Ot(t) {
1332
+ wi();
1333
+ var e = (
1334
+ /** @type {Effect} */
1335
+ A.f
1336
+ ), n = !M && (e & _t) !== 0 && (e & Ye) === 0;
1337
+ if (n) {
1338
+ var r = (
1339
+ /** @type {ComponentContext} */
1340
+ st
1341
+ );
1342
+ (r.e ?? (r.e = [])).push(t);
1343
+ } else
1344
+ return mo(t);
1345
+ }
1346
+ function mo(t) {
1347
+ return Mt(pn | Ds, t, !1);
1348
+ }
1349
+ function _i(t) {
1350
+ Se.ensure();
1351
+ const e = Mt(ce | Re, t, !0);
1352
+ return () => {
1353
+ Y(e);
1354
+ };
1355
+ }
1356
+ function ki(t) {
1357
+ Se.ensure();
1358
+ const e = Mt(ce | Re, t, !0);
1359
+ return (n = {}) => new Promise((r) => {
1360
+ n.outro ? Le(e, () => {
1361
+ Y(e), r(void 0);
1362
+ }) : (Y(e), r(void 0));
1363
+ });
1364
+ }
1365
+ function wo(t) {
1366
+ return Mt(pn, t, !1);
1367
+ }
1368
+ function $i(t) {
1369
+ return Mt(Lr | Re, t, !0);
1370
+ }
1371
+ function Nr(t, e = 0) {
1372
+ return Mt(In | e, t, !0);
1373
+ }
1374
+ function je(t, e = [], n = [], r = []) {
1375
+ ui(r, e, n, (l) => {
1376
+ Mt(In, () => t(...l.map(o)), !0);
1377
+ });
1378
+ }
1379
+ function qr(t, e = 0) {
1380
+ var n = Mt(Ft | e, t, !0);
1381
+ return n;
1382
+ }
1383
+ function Ct(t) {
1384
+ return Mt(_t | Re, t, !0);
1385
+ }
1386
+ function yo(t) {
1387
+ var e = t.teardown;
1388
+ if (e !== null) {
1389
+ const n = ue, r = M;
1390
+ yl(!0), ft(null);
1391
+ try {
1392
+ e.call(null);
1393
+ } finally {
1394
+ yl(n), ft(r);
1395
+ }
1396
+ }
1397
+ }
1398
+ function Ir(t, e = !1) {
1399
+ var n = t.first;
1400
+ for (t.first = t.last = null; n !== null; ) {
1401
+ const l = n.ac;
1402
+ l !== null && go(() => {
1403
+ l.abort(_e);
1404
+ });
1405
+ var r = n.next;
1406
+ (n.f & ce) !== 0 ? n.parent = null : Y(n, e), n = r;
1407
+ }
1408
+ }
1409
+ function xi(t) {
1410
+ for (var e = t.first; e !== null; ) {
1411
+ var n = e.next;
1412
+ (e.f & _t) === 0 && Y(e), e = n;
1413
+ }
1414
+ }
1415
+ function Y(t, e = !0) {
1416
+ var n = !1;
1417
+ (e || (t.f & Nl) !== 0) && t.nodes !== null && t.nodes.end !== null && (Ci(
1418
+ t.nodes.start,
1419
+ /** @type {TemplateNode} */
1420
+ t.nodes.end
1421
+ ), n = !0), Ir(t, e && !n), gn(t, 0), q(t, qt);
1422
+ var r = t.nodes && t.nodes.t;
1423
+ if (r !== null)
1424
+ for (const s of r)
1425
+ s.stop();
1426
+ yo(t);
1427
+ var l = t.parent;
1428
+ l !== null && l.first !== null && _o(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = null;
1429
+ }
1430
+ function Ci(t, e) {
1431
+ for (; t !== null; ) {
1432
+ var n = t === e ? null : /* @__PURE__ */ Et(t);
1433
+ t.remove(), t = n;
1434
+ }
1435
+ }
1436
+ function _o(t) {
1437
+ var e = t.parent, n = t.prev, r = t.next;
1438
+ n !== null && (n.next = r), r !== null && (r.prev = n), e !== null && (e.first === t && (e.first = r), e.last === t && (e.last = n));
1439
+ }
1440
+ function Le(t, e, n = !0) {
1441
+ var r = [];
1442
+ ko(t, r, !0);
1443
+ var l = () => {
1444
+ n && Y(t), e && e();
1445
+ }, s = r.length;
1446
+ if (s > 0) {
1447
+ var a = () => --s || l();
1448
+ for (var i of r)
1449
+ i.out(a);
1450
+ } else
1451
+ l();
1452
+ }
1453
+ function ko(t, e, n) {
1454
+ if ((t.f & lt) === 0) {
1455
+ t.f ^= lt;
1456
+ var r = t.nodes && t.nodes.t;
1457
+ if (r !== null)
1458
+ for (const i of r)
1459
+ (i.is_global || n) && e.push(i);
1460
+ for (var l = t.first; l !== null; ) {
1461
+ var s = l.next, a = (l.f & Ue) !== 0 || // If this is a branch effect without a block effect parent,
1462
+ // it means the parent block effect was pruned. In that case,
1463
+ // transparency information was transferred to the branch effect.
1464
+ (l.f & _t) !== 0 && (t.f & Ft) !== 0;
1465
+ ko(l, e, a ? n : !1), l = s;
1466
+ }
1467
+ }
1468
+ }
1469
+ function Fr(t) {
1470
+ $o(t, !0);
1471
+ }
1472
+ function $o(t, e) {
1473
+ if ((t.f & lt) !== 0) {
1474
+ t.f ^= lt, (t.f & B) === 0 && (q(t, K), bt(t));
1475
+ for (var n = t.first; n !== null; ) {
1476
+ var r = n.next, l = (n.f & Ue) !== 0 || (n.f & _t) !== 0;
1477
+ $o(n, l ? e : !1), n = r;
1478
+ }
1479
+ var s = t.nodes && t.nodes.t;
1480
+ if (s !== null)
1481
+ for (const a of s)
1482
+ (a.is_global || e) && a.in();
1483
+ }
1484
+ }
1485
+ function xo(t, e) {
1486
+ if (t.nodes)
1487
+ for (var n = t.nodes.start, r = t.nodes.end; n !== null; ) {
1488
+ var l = n === r ? null : /* @__PURE__ */ Et(n);
1489
+ e.append(n), n = l;
1490
+ }
1491
+ }
1492
+ let Sn = !1, ue = !1;
1493
+ function yl(t) {
1494
+ ue = t;
1495
+ }
1496
+ let M = null, mt = !1;
1497
+ function ft(t) {
1498
+ M = t;
1499
+ }
1500
+ let A = null;
1501
+ function Tt(t) {
1502
+ A = t;
1503
+ }
1504
+ let ct = null;
1505
+ function Co(t) {
1506
+ M !== null && (ct === null ? ct = [t] : ct.push(t));
1507
+ }
1508
+ let tt = null, rt = 0, it = null;
1509
+ function Ti(t) {
1510
+ it = t;
1511
+ }
1512
+ let To = 1, xe = 0, Ee = xe;
1513
+ function _l(t) {
1514
+ Ee = t;
1515
+ }
1516
+ function Eo() {
1517
+ return ++To;
1518
+ }
1519
+ function wn(t) {
1520
+ var e = t.f;
1521
+ if ((e & K) !== 0)
1522
+ return !0;
1523
+ if (e & H && (t.f &= ~Me), (e & yt) !== 0) {
1524
+ for (var n = (
1525
+ /** @type {Value[]} */
1526
+ t.deps
1527
+ ), r = n.length, l = 0; l < r; l++) {
1528
+ var s = n[l];
1529
+ if (wn(
1530
+ /** @type {Derived} */
1531
+ s
1532
+ ) && oo(
1533
+ /** @type {Derived} */
1534
+ s
1535
+ ), s.wv > t.wv)
1536
+ return !0;
1537
+ }
1538
+ (e & ut) !== 0 && // During time traveling we don't want to reset the status so that
1539
+ // traversal of the graph in the other batches still happens
1540
+ wt === null && q(t, B);
1541
+ }
1542
+ return !1;
1543
+ }
1544
+ function Mo(t, e, n = !0) {
1545
+ var r = t.reactions;
1546
+ if (r !== null && !(ct !== null && Be.call(ct, t)))
1547
+ for (var l = 0; l < r.length; l++) {
1548
+ var s = r[l];
1549
+ (s.f & H) !== 0 ? Mo(
1550
+ /** @type {Derived} */
1551
+ s,
1552
+ e,
1553
+ !1
1554
+ ) : e === s && (n ? q(s, K) : (s.f & B) !== 0 && q(s, yt), bt(
1555
+ /** @type {Effect} */
1556
+ s
1557
+ ));
1558
+ }
1559
+ }
1560
+ function So(t) {
1561
+ var e, n = tt, r = rt, l = it, s = M, a = ct, i = st, u = mt, c = Ee, h = t.f;
1562
+ tt = /** @type {null | Value[]} */
1563
+ null, rt = 0, it = null, M = (h & (_t | ce)) === 0 ? t : null, ct = null, Ve(t.ctx), mt = !1, Ee = ++xe, t.ac !== null && (go(() => {
1564
+ t.ac.abort(_e);
1565
+ }), t.ac = null);
1566
+ try {
1567
+ t.f |= dr;
1568
+ var p = (
1569
+ /** @type {Function} */
1570
+ t.fn
1571
+ ), g = p();
1572
+ t.f |= Ye;
1573
+ var _ = t.deps, v = N?.is_fork;
1574
+ if (tt !== null) {
1575
+ var y;
1576
+ if (v || gn(t, rt), _ !== null && rt > 0)
1577
+ for (_.length = rt + tt.length, y = 0; y < tt.length; y++)
1578
+ _[rt + y] = tt[y];
1579
+ else
1580
+ t.deps = _ = tt;
1581
+ if (Wr() && (t.f & ut) !== 0)
1582
+ for (y = rt; y < _.length; y++)
1583
+ ((e = _[y]).reactions ?? (e.reactions = [])).push(t);
1584
+ } else !v && _ !== null && rt < _.length && (gn(t, rt), _.length = rt);
1585
+ if (Vl() && it !== null && !mt && _ !== null && (t.f & (H | yt | K)) === 0)
1586
+ for (y = 0; y < /** @type {Source[]} */
1587
+ it.length; y++)
1588
+ Mo(
1589
+ it[y],
1590
+ /** @type {Effect} */
1591
+ t
1592
+ );
1593
+ if (s !== null && s !== t) {
1594
+ if (xe++, s.deps !== null)
1595
+ for (let C = 0; C < r; C += 1)
1596
+ s.deps[C].rv = xe;
1597
+ if (n !== null)
1598
+ for (const C of n)
1599
+ C.rv = xe;
1600
+ it !== null && (l === null ? l = it : l.push(.../** @type {Source[]} */
1601
+ it));
1602
+ }
1603
+ return (t.f & se) !== 0 && (t.f ^= se), g;
1604
+ } catch (C) {
1605
+ return Kl(C);
1606
+ } finally {
1607
+ t.f ^= dr, tt = n, rt = r, it = l, M = s, ct = a, Ve(i), mt = u, Ee = c;
1608
+ }
1609
+ }
1610
+ function Ei(t, e) {
1611
+ let n = e.reactions;
1612
+ if (n !== null) {
1613
+ var r = As.call(n, t);
1614
+ if (r !== -1) {
1615
+ var l = n.length - 1;
1616
+ l === 0 ? n = e.reactions = null : (n[r] = n[l], n.pop());
1617
+ }
1618
+ }
1619
+ if (n === null && (e.f & H) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1620
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1621
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1622
+ (tt === null || !Be.call(tt, e))) {
1623
+ var s = (
1624
+ /** @type {Derived} */
1625
+ e
1626
+ );
1627
+ (s.f & ut) !== 0 && (s.f ^= ut, s.f &= ~Me), Or(s), vi(s), gn(s, 0);
1628
+ }
1629
+ }
1630
+ function gn(t, e) {
1631
+ var n = t.deps;
1632
+ if (n !== null)
1633
+ for (var r = e; r < n.length; r++)
1634
+ Ei(t, n[r]);
1635
+ }
1636
+ function Ge(t) {
1637
+ var e = t.f;
1638
+ if ((e & qt) === 0) {
1639
+ q(t, B);
1640
+ var n = A, r = Sn;
1641
+ A = t, Sn = !0;
1642
+ try {
1643
+ (e & (Ft | Wl)) !== 0 ? xi(t) : Ir(t), yo(t);
1644
+ var l = So(t);
1645
+ t.teardown = typeof l == "function" ? l : null, t.wv = To;
1646
+ var s;
1647
+ Ss && ti && (t.f & K) !== 0 && t.deps;
1648
+ } finally {
1649
+ Sn = r, A = n;
1650
+ }
1651
+ }
1652
+ }
1653
+ function o(t) {
1654
+ var e = t.f, n = (e & H) !== 0;
1655
+ if (M !== null && !mt) {
1656
+ var r = A !== null && (A.f & qt) !== 0;
1657
+ if (!r && (ct === null || !Be.call(ct, t))) {
1658
+ var l = M.deps;
1659
+ if ((M.f & dr) !== 0)
1660
+ t.rv < xe && (t.rv = xe, tt === null && l !== null && l[rt] === t ? rt++ : tt === null ? tt = [t] : tt.push(t));
1661
+ else {
1662
+ (M.deps ?? (M.deps = [])).push(t);
1663
+ var s = t.reactions;
1664
+ s === null ? t.reactions = [M] : Be.call(s, M) || s.push(M);
1665
+ }
1666
+ }
1667
+ }
1668
+ if (ue && ie.has(t))
1669
+ return ie.get(t);
1670
+ if (n) {
1671
+ var a = (
1672
+ /** @type {Derived} */
1673
+ t
1674
+ );
1675
+ if (ue) {
1676
+ var i = a.v;
1677
+ return ((a.f & B) === 0 && a.reactions !== null || Lo(a)) && (i = zr(a)), ie.set(a, i), i;
1678
+ }
1679
+ var u = (a.f & ut) === 0 && !mt && M !== null && (Sn || (M.f & ut) !== 0), c = (a.f & Ye) === 0;
1680
+ wn(a) && (u && (a.f |= ut), oo(a)), u && !c && (so(a), Ao(a));
1681
+ }
1682
+ if (wt?.has(t))
1683
+ return wt.get(t);
1684
+ if ((t.f & se) !== 0)
1685
+ throw t.v;
1686
+ return t.v;
1687
+ }
1688
+ function Ao(t) {
1689
+ if (t.f |= ut, t.deps !== null)
1690
+ for (const e of t.deps)
1691
+ (e.reactions ?? (e.reactions = [])).push(t), (e.f & H) !== 0 && (e.f & ut) === 0 && (so(
1692
+ /** @type {Derived} */
1693
+ e
1694
+ ), Ao(
1695
+ /** @type {Derived} */
1696
+ e
1697
+ ));
1698
+ }
1699
+ function Lo(t) {
1700
+ if (t.v === V) return !0;
1701
+ if (t.deps === null) return !1;
1702
+ for (const e of t.deps)
1703
+ if (ie.has(e) || (e.f & H) !== 0 && Lo(
1704
+ /** @type {Derived} */
1705
+ e
1706
+ ))
1707
+ return !0;
1708
+ return !1;
1709
+ }
1710
+ function Kn(t) {
1711
+ var e = mt;
1712
+ try {
1713
+ return mt = !0, t();
1714
+ } finally {
1715
+ mt = e;
1716
+ }
1717
+ }
1718
+ const qe = /* @__PURE__ */ Symbol("events"), Ro = /* @__PURE__ */ new Set(), kr = /* @__PURE__ */ new Set();
1719
+ function J(t, e, n) {
1720
+ (e[qe] ?? (e[qe] = {}))[t] = n;
1721
+ }
1722
+ function Po(t) {
1723
+ for (var e = 0; e < t.length; e++)
1724
+ Ro.add(t[e]);
1725
+ for (var n of kr)
1726
+ n(t);
1727
+ }
1728
+ let kl = null;
1729
+ function $l(t) {
1730
+ var e = this, n = (
1731
+ /** @type {Node} */
1732
+ e.ownerDocument
1733
+ ), r = t.type, l = t.composedPath?.() || [], s = (
1734
+ /** @type {null | Element} */
1735
+ l[0] || t.target
1736
+ );
1737
+ kl = t;
1738
+ var a = 0, i = kl === t && t[qe];
1739
+ if (i) {
1740
+ var u = l.indexOf(i);
1741
+ if (u !== -1 && (e === document || e === /** @type {any} */
1742
+ window)) {
1743
+ t[qe] = e;
1744
+ return;
1745
+ }
1746
+ var c = l.indexOf(e);
1747
+ if (c === -1)
1748
+ return;
1749
+ u <= c && (a = u);
1750
+ }
1751
+ if (s = /** @type {Element} */
1752
+ l[a] || t.target, s !== e) {
1753
+ zn(t, "currentTarget", {
1754
+ configurable: !0,
1755
+ get() {
1756
+ return s || n;
1757
+ }
1758
+ });
1759
+ var h = M, p = A;
1760
+ ft(null), Tt(null);
1761
+ try {
1762
+ for (var g, _ = []; s !== null; ) {
1763
+ var v = s.assignedSlot || s.parentNode || /** @type {any} */
1764
+ s.host || null;
1765
+ try {
1766
+ var y = s[qe]?.[r];
1767
+ y != null && (!/** @type {any} */
1768
+ s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1769
+ // -> the target could not have been disabled because it emits the event in the first place
1770
+ t.target === s) && y.call(s, t);
1771
+ } catch (C) {
1772
+ g ? _.push(C) : g = C;
1773
+ }
1774
+ if (t.cancelBubble || v === e || v === null)
1775
+ break;
1776
+ s = v;
1777
+ }
1778
+ if (g) {
1779
+ for (let C of _)
1780
+ queueMicrotask(() => {
1781
+ throw C;
1782
+ });
1783
+ throw g;
1784
+ }
1785
+ } finally {
1786
+ t[qe] = e, delete t.currentTarget, ft(h), Tt(p);
1787
+ }
1788
+ }
1789
+ }
1790
+ const Mi = (
1791
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
1792
+ globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
1793
+ /** @param {string} html */
1794
+ createHTML: (t) => t
1795
+ })
1796
+ );
1797
+ function Si(t) {
1798
+ return (
1799
+ /** @type {string} */
1800
+ Mi?.createHTML(t) ?? t
1801
+ );
1802
+ }
1803
+ function Ai(t, e = !1) {
1804
+ var n = Dr("template");
1805
+ return t = t.replaceAll("<!>", "<!---->"), n.innerHTML = e ? Si(t) : t, n.content;
1806
+ }
1807
+ function An(t, e) {
1808
+ var n = (
1809
+ /** @type {Effect} */
1810
+ A
1811
+ );
1812
+ n.nodes === null && (n.nodes = { start: t, end: e, a: null, t: null });
1813
+ }
1814
+ // @__NO_SIDE_EFFECTS__
1815
+ function Bt(t, e) {
1816
+ var n = (e & Es) !== 0, r = (e & Ms) !== 0, l, s = !t.startsWith("<!>");
1817
+ return () => {
1818
+ if (R)
1819
+ return An(P, null), P;
1820
+ l === void 0 && (l = Ai(s ? t : "<!>" + t, !0), n || (l = /** @type {TemplateNode} */
1821
+ /* @__PURE__ */ Je(l)));
1822
+ var a = (
1823
+ /** @type {TemplateNode} */
1824
+ r || co ? document.importNode(l, !0) : l.cloneNode(!0)
1825
+ );
1826
+ if (n) {
1827
+ var i = (
1828
+ /** @type {TemplateNode} */
1829
+ /* @__PURE__ */ Je(a)
1830
+ ), u = (
1831
+ /** @type {TemplateNode} */
1832
+ a.lastChild
1833
+ );
1834
+ An(i, u);
1835
+ } else
1836
+ An(a, a);
1837
+ return a;
1838
+ };
1839
+ }
1840
+ function xt(t, e) {
1841
+ if (R) {
1842
+ var n = (
1843
+ /** @type {Effect & { nodes: EffectNodes }} */
1844
+ A
1845
+ );
1846
+ ((n.f & Ye) === 0 || n.nodes.end === null) && (n.nodes.end = P), Un();
1847
+ return;
1848
+ }
1849
+ t !== null && t.before(
1850
+ /** @type {Node} */
1851
+ e
1852
+ );
1853
+ }
1854
+ const Li = ["touchstart", "touchmove"];
1855
+ function Ri(t) {
1856
+ return Li.includes(t);
1857
+ }
1858
+ function cr(t, e) {
1859
+ var n = e == null ? "" : typeof e == "object" ? e + "" : e;
1860
+ n !== (t.__t ?? (t.__t = t.nodeValue)) && (t.__t = n, t.nodeValue = n + "");
1861
+ }
1862
+ function Oo(t, e) {
1863
+ return zo(t, e);
1864
+ }
1865
+ function Pi(t, e) {
1866
+ _r(), e.intro = e.intro ?? !1;
1867
+ const n = e.target, r = R, l = P;
1868
+ try {
1869
+ for (var s = /* @__PURE__ */ Je(n); s && (s.nodeType !== mn || /** @type {Comment} */
1870
+ s.data !== Mr); )
1871
+ s = /* @__PURE__ */ Et(s);
1872
+ if (!s)
1873
+ throw Fe;
1874
+ Wt(!0), ot(
1875
+ /** @type {Comment} */
1876
+ s
1877
+ );
1878
+ const a = zo(t, { ...e, anchor: s });
1879
+ return Wt(!1), /** @type {Exports} */
1880
+ a;
1881
+ } catch (a) {
1882
+ if (a instanceof Error && a.message.split(`
1883
+ `).some((i) => i.startsWith("https://svelte.dev/e/")))
1884
+ throw a;
1885
+ return a !== Fe && console.warn("Failed to hydrate: ", a), e.recover === !1 && Vs(), _r(), vo(n), Wt(!1), Oo(t, e);
1886
+ } finally {
1887
+ Wt(r), ot(l);
1888
+ }
1889
+ }
1890
+ const xn = /* @__PURE__ */ new Map();
1891
+ function zo(t, { target: e, anchor: n, props: r = {}, events: l, context: s, intro: a = !0 }) {
1892
+ _r();
1893
+ var i = void 0, u = ki(() => {
1894
+ var c = n ?? e.appendChild(It());
1895
+ ii(
1896
+ /** @type {TemplateNode} */
1897
+ c,
1898
+ {
1899
+ pending: () => {
1900
+ }
1901
+ },
1902
+ (g) => {
1903
+ Rr({});
1904
+ var _ = (
1905
+ /** @type {ComponentContext} */
1906
+ st
1907
+ );
1908
+ if (s && (_.c = s), l && (r.$$events = l), R && An(
1909
+ /** @type {TemplateNode} */
1910
+ g,
1911
+ null
1912
+ ), i = t(g, r) || {}, R && (A.nodes.end = P, P === null || P.nodeType !== mn || /** @type {Comment} */
1913
+ P.data !== Sr))
1914
+ throw Bn(), Fe;
1915
+ Pr();
1916
+ }
1917
+ );
1918
+ var h = /* @__PURE__ */ new Set(), p = (g) => {
1919
+ for (var _ = 0; _ < g.length; _++) {
1920
+ var v = g[_];
1921
+ if (!h.has(v)) {
1922
+ h.add(v);
1923
+ var y = Ri(v);
1924
+ for (const b of [e, document]) {
1925
+ var C = xn.get(b);
1926
+ C === void 0 && (C = /* @__PURE__ */ new Map(), xn.set(b, C));
1927
+ var k = C.get(v);
1928
+ k === void 0 ? (b.addEventListener(v, $l, { passive: y }), C.set(v, 1)) : C.set(v, k + 1);
1929
+ }
1930
+ }
1931
+ }
1932
+ };
1933
+ return p(qn(Ro)), kr.add(p), () => {
1934
+ for (var g of h)
1935
+ for (const y of [e, document]) {
1936
+ var _ = (
1937
+ /** @type {Map<string, number>} */
1938
+ xn.get(y)
1939
+ ), v = (
1940
+ /** @type {number} */
1941
+ _.get(g)
1942
+ );
1943
+ --v == 0 ? (y.removeEventListener(g, $l), _.delete(g), _.size === 0 && xn.delete(y)) : _.set(g, v);
1944
+ }
1945
+ kr.delete(p), c !== n && c.parentNode?.removeChild(c);
1946
+ };
1947
+ });
1948
+ return $r.set(i, u), i;
1949
+ }
1950
+ let $r = /* @__PURE__ */ new WeakMap();
1951
+ function Oi(t, e) {
1952
+ const n = $r.get(t);
1953
+ return n ? ($r.delete(t), n(e)) : Promise.resolve();
1954
+ }
1955
+ var kt, te, $t, We, Ln, xr, Do;
1956
+ class zi {
1957
+ /**
1958
+ * @param {TemplateNode} anchor
1959
+ * @param {boolean} transition
1960
+ */
1961
+ constructor(e, n = !0) {
1962
+ I(this, "anchor"), E(this, kt, /* @__PURE__ */ new Map()), E(this, te, /* @__PURE__ */ new Map()), E(this, $t, /* @__PURE__ */ new Map()), E(this, We, /* @__PURE__ */ new Set()), E(this, Ln, !0), E(this, xr, () => {
1963
+ var r = (
1964
+ /** @type {Batch} */
1965
+ N
1966
+ );
1967
+ if (f(this, kt).has(r)) {
1968
+ var l = (
1969
+ /** @type {Key} */
1970
+ f(this, kt).get(r)
1971
+ ), s = f(this, te).get(l);
1972
+ if (s)
1973
+ Fr(s), f(this, We).delete(l);
1974
+ else {
1975
+ var a = f(this, $t).get(l);
1976
+ a && (f(this, te).set(l, a.effect), f(this, $t).delete(l), a.fragment.lastChild.remove(), this.anchor.before(a.fragment), s = a.effect);
1977
+ }
1978
+ for (const [i, u] of f(this, kt)) {
1979
+ if (f(this, kt).delete(i), i === r)
1980
+ break;
1981
+ const c = f(this, $t).get(u);
1982
+ c && (Y(c.effect), f(this, $t).delete(u));
1983
+ }
1984
+ for (const [i, u] of f(this, te)) {
1985
+ if (i === l || f(this, We).has(i)) continue;
1986
+ const c = () => {
1987
+ if (Array.from(f(this, kt).values()).includes(i)) {
1988
+ var h = document.createDocumentFragment();
1989
+ xo(u, h), h.append(It()), f(this, $t).set(i, { effect: u, fragment: h });
1990
+ } else
1991
+ Y(u);
1992
+ f(this, We).delete(i), f(this, te).delete(i);
1993
+ };
1994
+ f(this, Ln) || !s ? (f(this, We).add(i), Le(u, c, !1)) : c();
1995
+ }
1996
+ }
1997
+ }), E(this, Do, (r) => {
1998
+ f(this, kt).delete(r);
1999
+ const l = Array.from(f(this, kt).values());
2000
+ for (const [s, a] of f(this, $t))
2001
+ l.includes(s) || (Y(a.effect), f(this, $t).delete(s));
2002
+ }), this.anchor = e, T(this, Ln, n);
2003
+ }
2004
+ /**
2005
+ *
2006
+ * @param {any} key
2007
+ * @param {null | ((target: TemplateNode) => void)} fn
2008
+ */
2009
+ ensure(e, n) {
2010
+ var r = (
2011
+ /** @type {Batch} */
2012
+ N
2013
+ ), l = po();
2014
+ n && !f(this, te).has(e) && !f(this, $t).has(e) && f(this, te).set(
2015
+ e,
2016
+ Ct(() => n(this.anchor))
2017
+ ), f(this, kt).set(r, e), l || (R && (this.anchor = P), f(this, xr).call(this));
2018
+ }
2019
+ }
2020
+ kt = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakMap(), We = /* @__PURE__ */ new WeakMap(), Ln = /* @__PURE__ */ new WeakMap(), xr = /* @__PURE__ */ new WeakMap(), Do = /* @__PURE__ */ new WeakMap();
2021
+ function Di(t) {
2022
+ st === null && Ws(), Ot(() => {
2023
+ const e = Kn(t);
2024
+ if (typeof e == "function") return (
2025
+ /** @type {() => void} */
2026
+ e
2027
+ );
2028
+ });
2029
+ }
2030
+ function be(t, e, n = !1) {
2031
+ R && Un();
2032
+ var r = new zi(t), l = n ? Ue : 0;
2033
+ function s(a, i) {
2034
+ if (R) {
2035
+ const h = Fl(t);
2036
+ var u;
2037
+ if (h === Mr ? u = 0 : h === Nn ? u = !1 : u = parseInt(h.substring(1)), a !== u) {
2038
+ var c = Dn();
2039
+ ot(c), r.anchor = c, Wt(!1), r.ensure(a, i), Wt(!0);
2040
+ return;
2041
+ }
2042
+ }
2043
+ r.ensure(a, i);
2044
+ }
2045
+ qr(() => {
2046
+ var a = !1;
2047
+ e((i, u = 0) => {
2048
+ a = !0, s(u, i);
2049
+ }), a || s(!1, null);
2050
+ }, l);
2051
+ }
2052
+ function ji(t, e, n) {
2053
+ for (var r = [], l = e.length, s, a = e.length, i = 0; i < l; i++) {
2054
+ let p = e[i];
2055
+ Le(
2056
+ p,
2057
+ () => {
2058
+ if (s) {
2059
+ if (s.pending.delete(p), s.done.add(p), s.pending.size === 0) {
2060
+ var g = (
2061
+ /** @type {Set<EachOutroGroup>} */
2062
+ t.outrogroups
2063
+ );
2064
+ Cr(qn(s.done)), g.delete(s), g.size === 0 && (t.outrogroups = null);
2065
+ }
2066
+ } else
2067
+ a -= 1;
2068
+ },
2069
+ !1
2070
+ );
2071
+ }
2072
+ if (a === 0) {
2073
+ var u = r.length === 0 && n !== null;
2074
+ if (u) {
2075
+ var c = (
2076
+ /** @type {Element} */
2077
+ n
2078
+ ), h = (
2079
+ /** @type {Element} */
2080
+ c.parentNode
2081
+ );
2082
+ vo(h), h.append(c), t.items.clear();
2083
+ }
2084
+ Cr(e, !u);
2085
+ } else
2086
+ s = {
2087
+ pending: new Set(e),
2088
+ done: /* @__PURE__ */ new Set()
2089
+ }, (t.outrogroups ?? (t.outrogroups = /* @__PURE__ */ new Set())).add(s);
2090
+ }
2091
+ function Cr(t, e = !0) {
2092
+ for (var n = 0; n < t.length; n++)
2093
+ Y(t[n], e);
2094
+ }
2095
+ var Cn;
2096
+ function Wi(t, e, n, r, l, s = null) {
2097
+ var a = t, i = /* @__PURE__ */ new Map();
2098
+ R && Un();
2099
+ var u = null, c = /* @__PURE__ */ lo(() => {
2100
+ var y = n();
2101
+ return Ar(y) ? y : y == null ? [] : qn(y);
2102
+ }), h, p = !0;
2103
+ function g() {
2104
+ v.fallback = u, Ni(v, h, a, e, r), u !== null && (h.length === 0 ? (u.f & le) === 0 ? Fr(u) : (u.f ^= le, cn(u, null, a)) : Le(u, () => {
2105
+ u = null;
2106
+ }));
2107
+ }
2108
+ var _ = qr(() => {
2109
+ h = /** @type {V[]} */
2110
+ o(c);
2111
+ var y = h.length;
2112
+ let C = !1;
2113
+ if (R) {
2114
+ var k = Fl(a) === Nn;
2115
+ k !== (y === 0) && (a = Dn(), ot(a), Wt(!1), C = !0);
2116
+ }
2117
+ for (var b = /* @__PURE__ */ new Set(), $ = (
2118
+ /** @type {Batch} */
2119
+ N
2120
+ ), O = po(), U = 0; U < y; U += 1) {
2121
+ R && P.nodeType === mn && /** @type {Comment} */
2122
+ P.data === Sr && (a = /** @type {Comment} */
2123
+ P, C = !0, Wt(!1));
2124
+ var dt = h[U], X = r(dt, U), z = p ? null : i.get(X);
2125
+ z ? (z.v && Ke(z.v, dt), z.i && Ke(z.i, U), O && $.unskip_effect(z.e)) : (z = qi(
2126
+ i,
2127
+ p ? a : Cn ?? (Cn = It()),
2128
+ dt,
2129
+ X,
2130
+ U,
2131
+ l,
2132
+ e,
2133
+ n
2134
+ ), p || (z.e.f |= le), i.set(X, z)), b.add(X);
2135
+ }
2136
+ if (y === 0 && s && !u && (p ? u = Ct(() => s(a)) : (u = Ct(() => s(Cn ?? (Cn = It()))), u.f |= le)), y > b.size && qs(), R && y > 0 && ot(Dn()), !p)
2137
+ if (O) {
2138
+ for (const [ht, fe] of i)
2139
+ b.has(ht) || $.skip_effect(fe.e);
2140
+ $.oncommit(g), $.ondiscard(() => {
2141
+ });
2142
+ } else
2143
+ g();
2144
+ C && Wt(!0), o(c);
2145
+ }), v = { effect: _, items: i, outrogroups: null, fallback: u };
2146
+ p = !1, R && (a = P);
2147
+ }
2148
+ function rn(t) {
2149
+ for (; t !== null && (t.f & _t) === 0; )
2150
+ t = t.next;
2151
+ return t;
2152
+ }
2153
+ function Ni(t, e, n, r, l) {
2154
+ var s = e.length, a = t.items, i = rn(t.effect.first), u, c = null, h = [], p = [], g, _, v, y;
2155
+ for (y = 0; y < s; y += 1) {
2156
+ if (g = e[y], _ = l(g, y), v = /** @type {EachItem} */
2157
+ a.get(_).e, t.outrogroups !== null)
2158
+ for (const z of t.outrogroups)
2159
+ z.pending.delete(v), z.done.delete(v);
2160
+ if ((v.f & le) !== 0)
2161
+ if (v.f ^= le, v === i)
2162
+ cn(v, null, n);
2163
+ else {
2164
+ var C = c ? c.next : i;
2165
+ v === t.effect.last && (t.effect.last = v.prev), v.prev && (v.prev.next = v.next), v.next && (v.next.prev = v.prev), Ht(t, c, v), Ht(t, v, C), cn(v, C, n), c = v, h = [], p = [], i = rn(c.next);
2166
+ continue;
2167
+ }
2168
+ if ((v.f & lt) !== 0 && Fr(v), v !== i) {
2169
+ if (u !== void 0 && u.has(v)) {
2170
+ if (h.length < p.length) {
2171
+ var k = p[0], b;
2172
+ c = k.prev;
2173
+ var $ = h[0], O = h[h.length - 1];
2174
+ for (b = 0; b < h.length; b += 1)
2175
+ cn(h[b], k, n);
2176
+ for (b = 0; b < p.length; b += 1)
2177
+ u.delete(p[b]);
2178
+ Ht(t, $.prev, O.next), Ht(t, c, $), Ht(t, O, k), i = k, c = O, y -= 1, h = [], p = [];
2179
+ } else
2180
+ u.delete(v), cn(v, i, n), Ht(t, v.prev, v.next), Ht(t, v, c === null ? t.effect.first : c.next), Ht(t, c, v), c = v;
2181
+ continue;
2182
+ }
2183
+ for (h = [], p = []; i !== null && i !== v; )
2184
+ (u ?? (u = /* @__PURE__ */ new Set())).add(i), p.push(i), i = rn(i.next);
2185
+ if (i === null)
2186
+ continue;
2187
+ }
2188
+ (v.f & le) === 0 && h.push(v), c = v, i = rn(v.next);
2189
+ }
2190
+ if (t.outrogroups !== null) {
2191
+ for (const z of t.outrogroups)
2192
+ z.pending.size === 0 && (Cr(qn(z.done)), t.outrogroups?.delete(z));
2193
+ t.outrogroups.size === 0 && (t.outrogroups = null);
2194
+ }
2195
+ if (i !== null || u !== void 0) {
2196
+ var U = [];
2197
+ if (u !== void 0)
2198
+ for (v of u)
2199
+ (v.f & lt) === 0 && U.push(v);
2200
+ for (; i !== null; )
2201
+ (i.f & lt) === 0 && i !== t.fallback && U.push(i), i = rn(i.next);
2202
+ var dt = U.length;
2203
+ if (dt > 0) {
2204
+ var X = null;
2205
+ ji(t, U, X);
2206
+ }
2207
+ }
2208
+ }
2209
+ function qi(t, e, n, r, l, s, a, i) {
2210
+ var u = (a & ys) !== 0 ? (a & ks) === 0 ? /* @__PURE__ */ ao(n, !1, !1) : Ae(n) : null, c = (a & _s) !== 0 ? Ae(l) : null;
2211
+ return {
2212
+ v: u,
2213
+ i: c,
2214
+ e: Ct(() => (s(e, u ?? n, c ?? l, i), () => {
2215
+ t.delete(r);
2216
+ }))
2217
+ };
2218
+ }
2219
+ function cn(t, e, n) {
2220
+ if (t.nodes)
2221
+ for (var r = t.nodes.start, l = t.nodes.end, s = e && (e.f & le) === 0 ? (
2222
+ /** @type {EffectNodes} */
2223
+ e.nodes.start
2224
+ ) : n; r !== null; ) {
2225
+ var a = (
2226
+ /** @type {TemplateNode} */
2227
+ /* @__PURE__ */ Et(r)
2228
+ );
2229
+ if (s.before(r), r === l)
2230
+ return;
2231
+ r = a;
2232
+ }
2233
+ }
2234
+ function Ht(t, e, n) {
2235
+ e === null ? t.effect.first = n : e.next = n, n === null ? t.effect.last = e : n.prev = e;
2236
+ }
2237
+ function jo(t, e) {
2238
+ wo(() => {
2239
+ var n = t.getRootNode(), r = (
2240
+ /** @type {ShadowRoot} */
2241
+ n.host ? (
2242
+ /** @type {ShadowRoot} */
2243
+ n
2244
+ ) : (
2245
+ /** @type {Document} */
2246
+ n.head ?? /** @type {Document} */
2247
+ n.ownerDocument.head
2248
+ )
2249
+ );
2250
+ if (!r.querySelector("#" + e.hash)) {
2251
+ const l = Dr("style");
2252
+ l.id = e.hash, l.textContent = e.code, r.appendChild(l);
2253
+ }
2254
+ });
2255
+ }
2256
+ const xl = [...`
2257
+ \r\f \v\uFEFF`];
2258
+ function Ii(t, e, n) {
2259
+ var r = "" + t;
2260
+ if (n) {
2261
+ for (var l in n)
2262
+ if (n[l])
2263
+ r = r ? r + " " + l : l;
2264
+ else if (r.length)
2265
+ for (var s = l.length, a = 0; (a = r.indexOf(l, a)) >= 0; ) {
2266
+ var i = a + s;
2267
+ (a === 0 || xl.includes(r[a - 1])) && (i === r.length || xl.includes(r[i])) ? r = (a === 0 ? "" : r.substring(0, a)) + r.substring(i + 1) : a = i;
2268
+ }
2269
+ }
2270
+ return r === "" ? null : r;
2271
+ }
2272
+ function Fi(t, e) {
2273
+ return t == null ? null : String(t);
2274
+ }
2275
+ function Bi(t, e, n, r, l, s) {
2276
+ var a = t.__className;
2277
+ if (R || a !== n || a === void 0) {
2278
+ var i = Ii(n, r, s);
2279
+ (!R || i !== t.getAttribute("class")) && (i == null ? t.removeAttribute("class") : t.className = i), t.__className = n;
2280
+ } else if (s && l !== s)
2281
+ for (var u in s) {
2282
+ var c = !!s[u];
2283
+ (l == null || c !== !!l[u]) && t.classList.toggle(u, c);
2284
+ }
2285
+ return s;
2286
+ }
2287
+ function Ui(t, e, n, r) {
2288
+ var l = t.__style;
2289
+ if (R || l !== e) {
2290
+ var s = Fi(e);
2291
+ (!R || s !== t.getAttribute("style")) && (s == null ? t.removeAttribute("style") : t.style.cssText = s), t.__style = e;
2292
+ }
2293
+ return r;
2294
+ }
2295
+ function Wo(t, e, n = !1) {
2296
+ if (t.multiple) {
2297
+ if (e == null)
2298
+ return;
2299
+ if (!Ar(e))
2300
+ return Xs();
2301
+ for (var r of t.options)
2302
+ r.selected = e.includes(Cl(r));
2303
+ return;
2304
+ }
2305
+ for (r of t.options) {
2306
+ var l = Cl(r);
2307
+ if (gi(l, e)) {
2308
+ r.selected = !0;
2309
+ return;
2310
+ }
2311
+ }
2312
+ (!n || e !== void 0) && (t.selectedIndex = -1);
2313
+ }
2314
+ function Vi(t) {
2315
+ var e = new MutationObserver(() => {
2316
+ Wo(t, t.__value);
2317
+ });
2318
+ e.observe(t, {
2319
+ // Listen to option element changes
2320
+ childList: !0,
2321
+ subtree: !0,
2322
+ // because of <optgroup>
2323
+ // Listen to option element value attribute changes
2324
+ // (doesn't get notified of select value changes,
2325
+ // because that property is not reflected as an attribute)
2326
+ attributes: !0,
2327
+ attributeFilter: ["value"]
2328
+ }), bo(() => {
2329
+ e.disconnect();
2330
+ });
2331
+ }
2332
+ function Cl(t) {
2333
+ return "__value" in t ? t.__value : t.value;
2334
+ }
2335
+ const Hi = /* @__PURE__ */ Symbol("is custom element"), Ki = /* @__PURE__ */ Symbol("is html"), Ji = Il ? "link" : "LINK", Gi = Il ? "progress" : "PROGRESS";
2336
+ function Kt(t) {
2337
+ if (R) {
2338
+ var e = !1, n = () => {
2339
+ if (!e) {
2340
+ if (e = !0, t.hasAttribute("value")) {
2341
+ var r = t.value;
2342
+ bn(t, "value", null), t.value = r;
2343
+ }
2344
+ if (t.hasAttribute("checked")) {
2345
+ var l = t.checked;
2346
+ bn(t, "checked", null), t.checked = l;
2347
+ }
2348
+ }
2349
+ };
2350
+ t.__on_r = n, ae(n), mi();
2351
+ }
2352
+ }
2353
+ function Yi(t, e) {
2354
+ var n = Br(t);
2355
+ n.value === (n.value = // treat null and undefined the same for the initial value
2356
+ e ?? void 0) || // @ts-expect-error
2357
+ // `progress` elements always need their value set when it's `0`
2358
+ t.value === e && (e !== 0 || t.nodeName !== Gi) || (t.value = e ?? "");
2359
+ }
2360
+ function Jt(t, e) {
2361
+ var n = Br(t);
2362
+ n.checked !== (n.checked = // treat null and undefined the same for the initial value
2363
+ e ?? void 0) && (t.checked = e);
2364
+ }
2365
+ function bn(t, e, n, r) {
2366
+ var l = Br(t);
2367
+ R && (l[e] = t.getAttribute(e), e === "src" || e === "srcset" || e === "href" && t.nodeName === Ji) || l[e] !== (l[e] = n) && (e === "loading" && (t[js] = n), n == null ? t.removeAttribute(e) : typeof n != "string" && Xi(t).includes(e) ? t[e] = n : t.setAttribute(e, n));
2368
+ }
2369
+ function Br(t) {
2370
+ return (
2371
+ /** @type {Record<string | symbol, unknown>} **/
2372
+ // @ts-expect-error
2373
+ t.__attributes ?? (t.__attributes = {
2374
+ [Hi]: t.nodeName.includes("-"),
2375
+ [Ki]: t.namespaceURI === zl
2376
+ })
2377
+ );
2378
+ }
2379
+ var Tl = /* @__PURE__ */ new Map();
2380
+ function Xi(t) {
2381
+ var e = t.getAttribute("is") || t.nodeName, n = Tl.get(e);
2382
+ if (n) return n;
2383
+ Tl.set(e, n = []);
2384
+ for (var r, l = t, s = Element.prototype; s !== l; ) {
2385
+ r = Ls(l);
2386
+ for (var a in r)
2387
+ r[a].set && n.push(a);
2388
+ l = Dl(l);
2389
+ }
2390
+ return n;
2391
+ }
2392
+ function El(t, e) {
2393
+ return t === e || t?.[Te] === e;
2394
+ }
2395
+ function Rn(t = {}, e, n, r) {
2396
+ return wo(() => {
2397
+ var l, s;
2398
+ return Nr(() => {
2399
+ l = s, s = [], Kn(() => {
2400
+ t !== n(...s) && (e(t, ...s), l && El(n(...l), t) && e(null, ...l));
2401
+ });
2402
+ }), () => {
2403
+ ae(() => {
2404
+ s && El(n(...s), t) && e(null, ...s);
2405
+ });
2406
+ };
2407
+ }), t;
2408
+ }
2409
+ let Tn = !1;
2410
+ function Zi(t) {
2411
+ var e = Tn;
2412
+ try {
2413
+ return Tn = !1, [t(), Tn];
2414
+ } finally {
2415
+ Tn = e;
2416
+ }
2417
+ }
2418
+ function oe(t, e, n, r) {
2419
+ var l = (n & Cs) !== 0, s = (n & Ts) !== 0, a = (
2420
+ /** @type {V} */
2421
+ r
2422
+ ), i = !0, u = () => (i && (i = !1, a = s ? Kn(
2423
+ /** @type {() => V} */
2424
+ r
2425
+ ) : (
2426
+ /** @type {V} */
2427
+ r
2428
+ )), a), c;
2429
+ if (l) {
2430
+ var h = Te in t || ql in t;
2431
+ c = Ce(t, e)?.set ?? (h && e in t ? (b) => t[e] = b : void 0);
2432
+ }
2433
+ var p, g = !1;
2434
+ l ? [p, g] = Zi(() => (
2435
+ /** @type {V} */
2436
+ t[e]
2437
+ )) : p = /** @type {V} */
2438
+ t[e], p === void 0 && r !== void 0 && (p = u(), c && (Hs(), c(p)));
2439
+ var _;
2440
+ if (_ = () => {
2441
+ var b = (
2442
+ /** @type {V} */
2443
+ t[e]
2444
+ );
2445
+ return b === void 0 ? u() : (i = !0, b);
2446
+ }, (n & xs) === 0)
2447
+ return _;
2448
+ if (c) {
2449
+ var v = t.$$legacy;
2450
+ return (
2451
+ /** @type {() => V} */
2452
+ (function(b, $) {
2453
+ return arguments.length > 0 ? ((!$ || v || g) && c($ ? _() : b), b) : _();
2454
+ })
2455
+ );
2456
+ }
2457
+ var y = !1, C = ((n & $s) !== 0 ? Hn : lo)(() => (y = !1, _()));
2458
+ l && o(C);
2459
+ var k = (
2460
+ /** @type {Effect} */
2461
+ A
2462
+ );
2463
+ return (
2464
+ /** @type {() => V} */
2465
+ (function(b, $) {
2466
+ if (arguments.length > 0) {
2467
+ const O = $ ? o(C) : l ? $e(b) : b;
2468
+ return m(C, O), y = !0, a !== void 0 && (a = O), b;
2469
+ }
2470
+ return ue && y || (k.f & qt) !== 0 ? C.v : o(C);
2471
+ })
2472
+ );
2473
+ }
2474
+ function Qi(t) {
2475
+ return new ta(t);
2476
+ }
2477
+ var ee, vt;
2478
+ class ta {
2479
+ /**
2480
+ * @param {ComponentConstructorOptions & {
2481
+ * component: any;
2482
+ * }} options
2483
+ */
2484
+ constructor(e) {
2485
+ E(this, ee), E(this, vt);
2486
+ var n = /* @__PURE__ */ new Map(), r = (s, a) => {
2487
+ var i = /* @__PURE__ */ ao(a, !1, !1);
2488
+ return n.set(s, i), i;
2489
+ };
2490
+ const l = new Proxy(
2491
+ { ...e.props || {}, $$events: {} },
2492
+ {
2493
+ get(s, a) {
2494
+ return o(n.get(a) ?? r(a, Reflect.get(s, a)));
2495
+ },
2496
+ has(s, a) {
2497
+ return a === ql ? !0 : (o(n.get(a) ?? r(a, Reflect.get(s, a))), Reflect.has(s, a));
2498
+ },
2499
+ set(s, a, i) {
2500
+ return m(n.get(a) ?? r(a, i), i), Reflect.set(s, a, i);
2501
+ }
2502
+ }
2503
+ );
2504
+ T(this, vt, (e.hydrate ? Pi : Oo)(e.component, {
2505
+ target: e.target,
2506
+ anchor: e.anchor,
2507
+ props: l,
2508
+ context: e.context,
2509
+ intro: e.intro ?? !1,
2510
+ recover: e.recover
2511
+ })), (!e?.props?.$$host || e.sync === !1) && Nt(), T(this, ee, l.$$events);
2512
+ for (const s of Object.keys(f(this, vt)))
2513
+ s === "$set" || s === "$destroy" || s === "$on" || zn(this, s, {
2514
+ get() {
2515
+ return f(this, vt)[s];
2516
+ },
2517
+ /** @param {any} value */
2518
+ set(a) {
2519
+ f(this, vt)[s] = a;
2520
+ },
2521
+ enumerable: !0
2522
+ });
2523
+ f(this, vt).$set = /** @param {Record<string, any>} next */
2524
+ (s) => {
2525
+ Object.assign(l, s);
2526
+ }, f(this, vt).$destroy = () => {
2527
+ Oi(f(this, vt));
2528
+ };
2529
+ }
2530
+ /** @param {Record<string, any>} props */
2531
+ $set(e) {
2532
+ f(this, vt).$set(e);
2533
+ }
2534
+ /**
2535
+ * @param {string} event
2536
+ * @param {(...args: any[]) => any} callback
2537
+ * @returns {any}
2538
+ */
2539
+ $on(e, n) {
2540
+ f(this, ee)[e] = f(this, ee)[e] || [];
2541
+ const r = (...l) => n.call(this, ...l);
2542
+ return f(this, ee)[e].push(r), () => {
2543
+ f(this, ee)[e] = f(this, ee)[e].filter(
2544
+ /** @param {any} fn */
2545
+ (l) => l !== r
2546
+ );
2547
+ };
2548
+ }
2549
+ $destroy() {
2550
+ f(this, vt).$destroy();
2551
+ }
2552
+ }
2553
+ ee = /* @__PURE__ */ new WeakMap(), vt = /* @__PURE__ */ new WeakMap();
2554
+ let No;
2555
+ typeof HTMLElement == "function" && (No = class extends HTMLElement {
2556
+ /**
2557
+ * @param {*} $$componentCtor
2558
+ * @param {*} $$slots
2559
+ * @param {ShadowRootInit | undefined} shadow_root_init
2560
+ */
2561
+ constructor(t, e, n) {
2562
+ super(), I(this, "$$ctor"), I(this, "$$s"), I(this, "$$c"), I(this, "$$cn", !1), I(this, "$$d", {}), I(this, "$$r", !1), I(this, "$$p_d", {}), I(this, "$$l", {}), I(this, "$$l_u", /* @__PURE__ */ new Map()), I(this, "$$me"), I(this, "$$shadowRoot", null), this.$$ctor = t, this.$$s = e, n && (this.$$shadowRoot = this.attachShadow(n));
2563
+ }
2564
+ /**
2565
+ * @param {string} type
2566
+ * @param {EventListenerOrEventListenerObject} listener
2567
+ * @param {boolean | AddEventListenerOptions} [options]
2568
+ */
2569
+ addEventListener(t, e, n) {
2570
+ if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(e), this.$$c) {
2571
+ const r = this.$$c.$on(t, e);
2572
+ this.$$l_u.set(e, r);
2573
+ }
2574
+ super.addEventListener(t, e, n);
2575
+ }
2576
+ /**
2577
+ * @param {string} type
2578
+ * @param {EventListenerOrEventListenerObject} listener
2579
+ * @param {boolean | AddEventListenerOptions} [options]
2580
+ */
2581
+ removeEventListener(t, e, n) {
2582
+ if (super.removeEventListener(t, e, n), this.$$c) {
2583
+ const r = this.$$l_u.get(e);
2584
+ r && (r(), this.$$l_u.delete(e));
2585
+ }
2586
+ }
2587
+ async connectedCallback() {
2588
+ if (this.$$cn = !0, !this.$$c) {
2589
+ let t = function(r) {
2590
+ return (l) => {
2591
+ const s = Dr("slot");
2592
+ r !== "default" && (s.name = r), xt(l, s);
2593
+ };
2594
+ };
2595
+ if (await Promise.resolve(), !this.$$cn || this.$$c)
2596
+ return;
2597
+ const e = {}, n = ea(this);
2598
+ for (const r of this.$$s)
2599
+ r in n && (r === "default" && !this.$$d.children ? (this.$$d.children = t(r), e.default = !0) : e[r] = t(r));
2600
+ for (const r of this.attributes) {
2601
+ const l = this.$$g_p(r.name);
2602
+ l in this.$$d || (this.$$d[l] = Pn(l, r.value, this.$$p_d, "toProp"));
2603
+ }
2604
+ for (const r in this.$$p_d)
2605
+ !(r in this.$$d) && this[r] !== void 0 && (this.$$d[r] = this[r], delete this[r]);
2606
+ this.$$c = Qi({
2607
+ component: this.$$ctor,
2608
+ target: this.$$shadowRoot || this,
2609
+ props: {
2610
+ ...this.$$d,
2611
+ $$slots: e,
2612
+ $$host: this
2613
+ }
2614
+ }), this.$$me = _i(() => {
2615
+ Nr(() => {
2616
+ this.$$r = !0;
2617
+ for (const r of On(this.$$c)) {
2618
+ if (!this.$$p_d[r]?.reflect) continue;
2619
+ this.$$d[r] = this.$$c[r];
2620
+ const l = Pn(
2621
+ r,
2622
+ this.$$d[r],
2623
+ this.$$p_d,
2624
+ "toAttribute"
2625
+ );
2626
+ l == null ? this.removeAttribute(this.$$p_d[r].attribute || r) : this.setAttribute(this.$$p_d[r].attribute || r, l);
2627
+ }
2628
+ this.$$r = !1;
2629
+ });
2630
+ });
2631
+ for (const r in this.$$l)
2632
+ for (const l of this.$$l[r]) {
2633
+ const s = this.$$c.$on(r, l);
2634
+ this.$$l_u.set(l, s);
2635
+ }
2636
+ this.$$l = {};
2637
+ }
2638
+ }
2639
+ // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
2640
+ // and setting attributes through setAttribute etc, this is helpful
2641
+ /**
2642
+ * @param {string} attr
2643
+ * @param {string} _oldValue
2644
+ * @param {string} newValue
2645
+ */
2646
+ attributeChangedCallback(t, e, n) {
2647
+ this.$$r || (t = this.$$g_p(t), this.$$d[t] = Pn(t, n, this.$$p_d, "toProp"), this.$$c?.$set({ [t]: this.$$d[t] }));
2648
+ }
2649
+ disconnectedCallback() {
2650
+ this.$$cn = !1, Promise.resolve().then(() => {
2651
+ !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
2652
+ });
2653
+ }
2654
+ /**
2655
+ * @param {string} attribute_name
2656
+ */
2657
+ $$g_p(t) {
2658
+ return On(this.$$p_d).find(
2659
+ (e) => this.$$p_d[e].attribute === t || !this.$$p_d[e].attribute && e.toLowerCase() === t
2660
+ ) || t;
2661
+ }
2662
+ });
2663
+ function Pn(t, e, n, r) {
2664
+ const l = n[t]?.type;
2665
+ if (e = l === "Boolean" && typeof e != "boolean" ? e != null : e, !r || !n[t])
2666
+ return e;
2667
+ if (r === "toAttribute")
2668
+ switch (l) {
2669
+ case "Object":
2670
+ case "Array":
2671
+ return e == null ? null : JSON.stringify(e);
2672
+ case "Boolean":
2673
+ return e ? "" : null;
2674
+ case "Number":
2675
+ return e ?? null;
2676
+ default:
2677
+ return e;
2678
+ }
2679
+ else
2680
+ switch (l) {
2681
+ case "Object":
2682
+ case "Array":
2683
+ return e && JSON.parse(e);
2684
+ case "Boolean":
2685
+ return e;
2686
+ // conversion already handled above
2687
+ case "Number":
2688
+ return e != null ? +e : e;
2689
+ default:
2690
+ return e;
2691
+ }
2692
+ }
2693
+ function ea(t) {
2694
+ const e = {};
2695
+ return t.childNodes.forEach((n) => {
2696
+ e[
2697
+ /** @type {Element} node */
2698
+ n.slot || "default"
2699
+ ] = !0;
2700
+ }), e;
2701
+ }
2702
+ function qo(t, e, n, r, l, s) {
2703
+ let a = class extends No {
2704
+ constructor() {
2705
+ super(t, n, l), this.$$p_d = e;
2706
+ }
2707
+ static get observedAttributes() {
2708
+ return On(e).map(
2709
+ (i) => (e[i].attribute || i).toLowerCase()
2710
+ );
2711
+ }
2712
+ };
2713
+ return On(e).forEach((i) => {
2714
+ zn(a.prototype, i, {
2715
+ get() {
2716
+ return this.$$c && i in this.$$c ? this.$$c[i] : this.$$d[i];
2717
+ },
2718
+ set(u) {
2719
+ u = Pn(i, u, e), this.$$d[i] = u;
2720
+ var c = this.$$c;
2721
+ if (c) {
2722
+ var h = Ce(c, i)?.get;
2723
+ h ? c[i] = u : c.$set({ [i]: u });
2724
+ }
2725
+ }
2726
+ });
2727
+ }), r.forEach((i) => {
2728
+ zn(a.prototype, i, {
2729
+ get() {
2730
+ return this.$$c?.[i];
2731
+ }
2732
+ });
2733
+ }), t.element = /** @type {any} */
2734
+ a, a;
2735
+ }
2736
+ const na = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
2737
+ function Io(t) {
2738
+ try {
2739
+ const e = na?.[t];
2740
+ if (typeof e == "string" && e.length > 0)
2741
+ return e;
2742
+ } catch {
2743
+ }
2744
+ }
2745
+ typeof window < "u" && window.PIE_BUILDER_ORIGIN_URL || Io("PUBLIC_BUILDER_ORIGIN_URL");
2746
+ typeof window < "u" && window.PIE_BUILDER_BUNDLE_URL || Io("PUBLIC_BUILDER_BUNDLE_URL");
2747
+ var Tr;
2748
+ (function(t) {
2749
+ t.player = "player.js", t.clientPlayer = "client-player.js", t.editor = "editor.js";
2750
+ })(Tr || (Tr = {}));
2751
+ var Ml;
2752
+ (function(t) {
2753
+ t.loading = "loading", t.loaded = "loaded";
2754
+ })(Ml || (Ml = {}));
2755
+ typeof window < "u" && !window.pieHelpers && (window.pieHelpers = {
2756
+ loadingScripts: {},
2757
+ loadingPromises: {}
2758
+ });
2759
+ var Sl;
2760
+ (function(t) {
2761
+ t.SAVE = "save", t.MODEL = "model", t.SCORE = "score", t.MANUAL_SCORE = "manual-score";
2762
+ })(Sl || (Sl = {}));
2763
+ var Al;
2764
+ (function(t) {
2765
+ t.AUTO = "auto", t.MANUAL = "manual";
2766
+ })(Al || (Al = {}));
2767
+ var Ll;
2768
+ (function(t) {
2769
+ t.GATHER = "gather", t.VIEW = "view", t.EVALUATE = "evaluate";
2770
+ })(Ll || (Ll = {}));
2771
+ var Rl;
2772
+ (function(t) {
2773
+ t.PENDING = "pending", t.IN_PROGRESS = "in_progress", t.COMPLETED = "completed", t.FAILED = "failed";
2774
+ })(Rl || (Rl = {}));
2775
+ var Pl;
2776
+ (function(t) {
2777
+ t[t.ROOT = 0] = "ROOT", t[t.SUBJECT = 1] = "SUBJECT", t[t.LEVEL = 2] = "LEVEL", t[t.STANDARD = 3] = "STANDARD";
2778
+ })(Pl || (Pl = {}));
2779
+ Tr.player;
2780
+ function ra(t) {
2781
+ const e = typeof document < "u" ? document.activeElement : null;
2782
+ return queueMicrotask(() => {
2783
+ try {
2784
+ t.focus?.();
2785
+ } catch {
2786
+ }
2787
+ }), () => {
2788
+ try {
2789
+ e?.focus?.();
2790
+ } catch {
2791
+ }
2792
+ };
2793
+ }
2794
+ var la = /* @__PURE__ */ Bt('<button type="button" class="tool-settings-button btn btn-ghost btn-sm btn-circle svelte-57plqq"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 svelte-57plqq"><path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"></path><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg></button>');
2795
+ const oa = {
2796
+ hash: "svelte-57plqq",
2797
+ code: ".tool-settings-button.svelte-57plqq {display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0.25rem;border:none;border-radius:9999px;background:transparent;color:inherit;cursor:pointer;}.tool-settings-button.svelte-57plqq:hover {background:rgba(255, 255, 255, 0.1);}.tool-settings-button.svelte-57plqq:focus-visible {outline:2px solid currentColor;outline-offset:2px;}.tool-settings-button.svelte-57plqq svg:where(.svelte-57plqq) {width:20px;height:20px;display:block;}"
2798
+ };
2799
+ function Fo(t, e) {
2800
+ Rr(e, !0), jo(t, oa);
2801
+ let n = oe(e, "buttonEl", 7, null), r = oe(e, "onClick", 7), l = oe(e, "ariaLabel", 7, "Settings"), s = oe(e, "active", 7, !1);
2802
+ var a = {
2803
+ get buttonEl() {
2804
+ return n();
2805
+ },
2806
+ set buttonEl(u = null) {
2807
+ n(u), Nt();
2808
+ },
2809
+ get onClick() {
2810
+ return r();
2811
+ },
2812
+ set onClick(u) {
2813
+ r(u), Nt();
2814
+ },
2815
+ get ariaLabel() {
2816
+ return l();
2817
+ },
2818
+ set ariaLabel(u = "Settings") {
2819
+ l(u), Nt();
2820
+ },
2821
+ get active() {
2822
+ return s();
2823
+ },
2824
+ set active(u = !1) {
2825
+ s(u), Nt();
2826
+ }
2827
+ }, i = la();
2828
+ return Rn(i, (u) => n(u), () => n()), je(() => {
2829
+ bn(i, "aria-label", l()), bn(i, "aria-pressed", s());
2830
+ }), J("click", i, function(...u) {
2831
+ r()?.apply(this, u);
2832
+ }), xt(t, i), Pr(a);
2833
+ }
2834
+ Po(["click"]);
2835
+ qo(Fo, { buttonEl: {}, onClick: {}, ariaLabel: {}, active: {} }, [], [], { mode: "open" });
2836
+ var sa = /* @__PURE__ */ Bt('<div class="pie-tool-calculator__loading svelte-sun9kf">Loading calculator...</div>'), ia = /* @__PURE__ */ Bt('<div class="pie-tool-calculator__error-details svelte-sun9kf"> </div>'), aa = /* @__PURE__ */ Bt('<div class="pie-tool-calculator__loading pie-tool-calculator__loading--error svelte-sun9kf">Calculator failed to initialize. <!></div>'), ua = /* @__PURE__ */ Bt('<label class="svelte-sun9kf"><input type="radio" name="calculator-type" class="svelte-sun9kf"/> <span class="svelte-sun9kf"> </span></label>'), ca = /* @__PURE__ */ Bt('<label class="svelte-sun9kf"><input type="checkbox" class="svelte-sun9kf"/> <span class="svelte-sun9kf">Settings Menu</span></label> <label class="svelte-sun9kf"><input type="checkbox" class="svelte-sun9kf"/> <span class="svelte-sun9kf">Notes</span></label> <label class="svelte-sun9kf"><input type="checkbox" class="svelte-sun9kf"/> <span class="svelte-sun9kf">Folders</span></label> <label class="svelte-sun9kf"><input type="checkbox" class="svelte-sun9kf"/> <span class="svelte-sun9kf">Sliders</span></label> <label class="svelte-sun9kf"><input type="checkbox" class="svelte-sun9kf"/> <span class="svelte-sun9kf">Tables</span></label>', 1), fa = /* @__PURE__ */ Bt('<div class="pie-tool-calculator__settings-overlay svelte-sun9kf"><div class="pie-tool-calculator__settings-panel svelte-sun9kf"><div class="pie-tool-calculator__settings-header svelte-sun9kf"><h2 class="pie-tool-calculator__settings-title svelte-sun9kf">Calculator Settings</h2> <button type="button" class="pie-tool-calculator__settings-close-btn svelte-sun9kf" aria-label="Close settings"><svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 svelte-sun9kf" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" class="svelte-sun9kf"></path></svg></button></div> <div class="pie-tool-calculator__settings-content svelte-sun9kf"><fieldset class="pie-tool-calculator__setting-group svelte-sun9kf"><legend class="svelte-sun9kf">Calculator Type</legend> <!></fieldset> <fieldset class="pie-tool-calculator__setting-group svelte-sun9kf"><legend class="svelte-sun9kf">Configuration</legend> <p style="font-size: 0.75rem; color: #666; margin: 0 0 8px 0;" class="svelte-sun9kf">These settings are useful for testing. They may be hidden or restricted for students in production.</p> <label class="svelte-sun9kf"><input type="checkbox" class="svelte-sun9kf"/> <span class="svelte-sun9kf">Restricted Mode (Test Mode)</span></label> <label class="svelte-sun9kf"><span class="pie-tool-calculator__setting-label svelte-sun9kf">Angle Mode <span class="pie-tool-calculator__setting-value svelte-sun9kf"> </span></span> <select class="svelte-sun9kf"><option class="svelte-sun9kf">Degrees</option><option class="svelte-sun9kf">Radians</option></select></label> <label class="svelte-sun9kf"><input type="checkbox" class="svelte-sun9kf"/> <span class="svelte-sun9kf">QWERTY Keyboard</span></label> <!> <!></fieldset></div></div></div>'), da = /* @__PURE__ */ Bt('<div role="dialog" tabindex="-1" aria-label="Calculator tool - Drag header to move, Escape to close" translate="no"><div class="pie-tool-calculator__header svelte-sun9kf"><span class="pie-tool-calculator__title svelte-sun9kf">Calculator</span> <div class="pie-tool-calculator__header-buttons svelte-sun9kf"><!> <button class="pie-tool-calculator__close-btn svelte-sun9kf" aria-label="Close calculator"><svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 svelte-sun9kf" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" class="svelte-sun9kf"></path></svg></button></div></div> <div class="pie-tool-calculator__container svelte-sun9kf"></div> <!> <!> <!></div>'), ha = /* @__PURE__ */ Bt("<div><!></div>");
2837
+ const va = {
2838
+ hash: "svelte-sun9kf",
2839
+ code: `.pie-tool-calculator.svelte-sun9kf {position:fixed;background:white;box-shadow:0 10px 40px rgba(0, 0, 0, 0.3);user-select:none;touch-action:none;border-radius:12px;overflow:hidden;z-index:2000;min-width:320px;display:flex;flex-direction:column;}.pie-tool-calculator.pie-tool-calculator--dragging.svelte-sun9kf {cursor:move;will-change:transform;}.pie-tool-calculator.pie-tool-calculator--dragging.svelte-sun9kf :where(.svelte-sun9kf) {cursor:move !important;pointer-events:none; /* Prevent hover effects during drag */}.pie-tool-calculator__header.svelte-sun9kf {padding:12px 16px;background:var(--pie-primary-dark, #2c3e50);color:var(--pie-white, white);display:flex;justify-content:space-between;align-items:center;cursor:move;user-select:none;border-radius:12px 12px 0 0;}.pie-tool-calculator__title.svelte-sun9kf {font-weight:600;font-size:16px;color:var(--pie-white, white);}.pie-tool-calculator__header-buttons.svelte-sun9kf {display:flex;gap:8px;align-items:center;}.pie-tool-calculator__close-btn.svelte-sun9kf {background:transparent;border:none;color:var(--pie-white, white);cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:background-color 0.2s;}.pie-tool-calculator__close-btn.svelte-sun9kf:hover {background:rgba(255, 255, 255, 0.1);}.pie-tool-calculator__close-btn.svelte-sun9kf:active {background:rgba(255, 255, 255, 0.2);}.pie-tool-calculator__close-btn.svelte-sun9kf:focus-visible {outline:2px solid var(--pie-primary, #3f51b5);outline-offset:2px;}.pie-tool-calculator__container.svelte-sun9kf {background:white;width:100%;height:100%;min-width:320px;min-height:400px;position:relative;overflow:hidden;}.pie-tool-calculator__loading.svelte-sun9kf {position:absolute;inset:56px 0 0 0;display:flex;align-items:center;justify-content:center;background:rgba(255, 255, 255, 0.9);color:#334155;font-size:0.9rem;z-index:2;}.pie-tool-calculator__loading--error.svelte-sun9kf {color:#b91c1c;flex-direction:column;gap:0.5rem;padding:0.75rem;text-align:center;}.pie-tool-calculator__error-details.svelte-sun9kf {font-size:0.8rem;line-height:1.2;color:#7f1d1d;max-width:95%;word-break:break-word;}.pie-tool-calculator__container[data-calculator-type="ti-84"].svelte-sun9kf,
2840
+ .pie-tool-calculator__container[data-calculator-type="ti-108"].svelte-sun9kf,
2841
+ .pie-tool-calculator__container[data-calculator-type="ti-34-mv"].svelte-sun9kf {width:auto;height:auto;min-width:0;min-height:0;display:flex;align-items:center;justify-content:center;padding:0;overflow:visible;}.pie-tool-calculator__container .dcg-container {width:100% !important;height:100% !important;}.pie-tool-calculator .mathjs-btn {pointer-events:auto;}
2842
+
2843
+ /* Settings overlay and panel */.pie-tool-calculator__settings-overlay.svelte-sun9kf {position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0, 0, 0, 0.5);display:flex;align-items:center;justify-content:center;z-index:10;pointer-events:auto;}.pie-tool-calculator__settings-panel.svelte-sun9kf {background:white;border-radius:8px;box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);width:90%;max-width:400px;max-height:80%;overflow:hidden;display:flex;flex-direction:column;}.pie-tool-calculator__settings-header.svelte-sun9kf {display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid #e0e0e0;background:#f5f5f5;}.pie-tool-calculator__settings-title.svelte-sun9kf {font-weight:600;font-size:14px;margin:0;color:#333;}.pie-tool-calculator__settings-close-btn.svelte-sun9kf {background:transparent;border:none;color:#666;cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:background-color 0.2s;}.pie-tool-calculator__settings-close-btn.svelte-sun9kf:hover {background:rgba(0, 0, 0, 0.05);color:#333;}.pie-tool-calculator__settings-close-btn.svelte-sun9kf:active {background:rgba(0, 0, 0, 0.1);}.pie-tool-calculator__settings-content.svelte-sun9kf {padding:16px;overflow-y:auto;font-size:14px;}.pie-tool-calculator__settings-content.svelte-sun9kf .pie-tool-calculator__setting-group {border:1px solid #e0e0e0;border-radius:4px;padding:12px;margin-bottom:16px;}.pie-tool-calculator__settings-content.svelte-sun9kf .pie-tool-calculator__setting-group:last-child {margin-bottom:0;}.pie-tool-calculator__settings-content.svelte-sun9kf legend {font-weight:600;font-size:13px;color:#333;padding:0 4px;}.pie-tool-calculator__settings-content.svelte-sun9kf label {display:block;margin-bottom:8px;cursor:pointer;font-size:13px;color:#666;}.pie-tool-calculator__settings-content.svelte-sun9kf label:last-child {margin-bottom:0;}.pie-tool-calculator__settings-content.svelte-sun9kf input[type="radio"],
2844
+ .pie-tool-calculator__settings-content.svelte-sun9kf input[type="checkbox"] {margin-right:8px;cursor:pointer;}.pie-tool-calculator__settings-content.svelte-sun9kf select {width:100%;padding:6px;border:1px solid #ccc;border-radius:4px;font-size:13px;margin-top:4px;background:white;cursor:pointer;}.pie-tool-calculator__settings-content.svelte-sun9kf .pie-tool-calculator__setting-label {display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;font-weight:500;color:#333;}.pie-tool-calculator__settings-content.svelte-sun9kf .pie-tool-calculator__setting-value {font-weight:normal;color:#666;font-size:12px;}`
2845
+ };
2846
+ function pa(t, e) {
2847
+ Rr(e, !0), jo(t, va);
2848
+ const n = ["basic", "scientific", "graphing"], r = "pie-tool-calculator-global-styles", l = `
2849
+ .pie-tool-calculator {
2850
+ position: fixed;
2851
+ background: white;
2852
+ box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
2853
+ user-select: none;
2854
+ touch-action: none;
2855
+ border-radius: 12px;
2856
+ overflow: hidden;
2857
+ z-index: 2000;
2858
+ min-width: 320px;
2859
+ display: flex;
2860
+ flex-direction: column;
2861
+ }
2862
+ .pie-tool-calculator__header {
2863
+ padding: 12px 16px;
2864
+ background: var(--pie-primary-dark, #2c3e50);
2865
+ color: var(--pie-white, white);
2866
+ display: flex;
2867
+ justify-content: space-between;
2868
+ align-items: center;
2869
+ }
2870
+ .pie-tool-calculator__container {
2871
+ background: white;
2872
+ width: 100%;
2873
+ height: 100%;
2874
+ min-width: 320px;
2875
+ min-height: 400px;
2876
+ position: relative;
2877
+ overflow: hidden;
2878
+ }
2879
+ .pie-tool-calculator__loading {
2880
+ position: absolute;
2881
+ inset: 56px 0 0 0;
2882
+ display: flex;
2883
+ align-items: center;
2884
+ justify-content: center;
2885
+ background: rgba(255, 255, 255, 0.9);
2886
+ color: #334155;
2887
+ font-size: 0.9rem;
2888
+ z-index: 2;
2889
+ }
2890
+ .pie-tool-calculator__loading--error {
2891
+ color: #b91c1c;
2892
+ flex-direction: column;
2893
+ gap: 0.5rem;
2894
+ padding: 0.75rem;
2895
+ text-align: center;
2896
+ }
2897
+ .pie-tool-calculator__error-details {
2898
+ font-size: 0.8rem;
2899
+ line-height: 1.2;
2900
+ color: #7f1d1d;
2901
+ max-width: 95%;
2902
+ word-break: break-word;
2903
+ }
2904
+ .pie-tool-calculator__container .dcg-container {
2905
+ width: 100% !important;
2906
+ height: 100% !important;
2907
+ }
2908
+ `, s = {
2909
+ basic: { width: 700, height: 600 },
2910
+ scientific: { width: 700, height: 600 },
2911
+ graphing: { width: 700, height: 600 }
2912
+ }, a = {
2913
+ basic: "Basic",
2914
+ scientific: "Scientific",
2915
+ graphing: "Graphing"
2916
+ }, i = typeof window < "u";
2917
+ let u = oe(e, "visible", 7, !1), c = oe(e, "toolId", 7, "calculator"), h = oe(e, "calculatorType", 7, "scientific"), p = oe(e, "availableTypes", 23, () => ["basic", "scientific", "graphing"]), g = /* @__PURE__ */ S(null), _ = /* @__PURE__ */ S(null);
2918
+ const v = /* @__PURE__ */ ge(() => o(_)?.toolkitCoordinator), y = /* @__PURE__ */ ge(() => o(v)?.toolCoordinator);
2919
+ let C = /* @__PURE__ */ ge(() => typeof p() == "string" ? p().split(",").map((d) => d.trim()) : p()), k = /* @__PURE__ */ S(void 0), b = /* @__PURE__ */ S(void 0), $ = /* @__PURE__ */ S(null), O = /* @__PURE__ */ S("scientific"), U = /* @__PURE__ */ S(!1), dt = /* @__PURE__ */ S(null), X = /* @__PURE__ */ S(!1), z = /* @__PURE__ */ S(!1), ht = /* @__PURE__ */ S(!1), fe = /* @__PURE__ */ S(null), Pe = /* @__PURE__ */ S(!1), Oe = /* @__PURE__ */ S(null), St = /* @__PURE__ */ S(null), Ut = /* @__PURE__ */ S(null), Ur = /* @__PURE__ */ S(void 0), Vr = /* @__PURE__ */ S(void 0);
2920
+ const Bo = ".dcg-container,.dcg-calculator-api-container,iframe,canvas";
2921
+ let Xe = /* @__PURE__ */ S(!1), Hr = /* @__PURE__ */ S(0), Kr = /* @__PURE__ */ S(0), Jn = /* @__PURE__ */ S(null), Gn = /* @__PURE__ */ S(null);
2922
+ Ot(() => {
2923
+ if (o(g))
2924
+ return ps(o(g), (d) => {
2925
+ m(_, d, !0);
2926
+ });
2927
+ });
2928
+ function Jr(d) {
2929
+ return n.includes(d);
2930
+ }
2931
+ function Uo() {
2932
+ if (!i || document.getElementById(r)) return;
2933
+ const d = document.createElement("style");
2934
+ d.id = r, d.textContent = l, document.head.appendChild(d);
2935
+ }
2936
+ function Vo() {
2937
+ const d = o(v)?.config?.tools?.providers?.calculator?.provider;
2938
+ return d === "ti" ? "calculator-ti" : d === "mathjs" ? "calculator-mathjs" : "calculator-desmos";
2939
+ }
2940
+ async function Gr(d) {
2941
+ if (console.log("[ToolCalculator] getProvider called", {
2942
+ type: d,
2943
+ hasToolkitCoordinator: !!o(v),
2944
+ hasRegistry: !!o(v)?.toolProviderRegistry
2945
+ }), !o(v)?.toolProviderRegistry)
2946
+ return console.warn("[ToolCalculator] No toolkitCoordinator or registry available"), null;
2947
+ try {
2948
+ const w = Vo();
2949
+ console.log(`[ToolCalculator] Requesting ${w} provider from registry`);
2950
+ const x = await o(v).toolProviderRegistry.getProvider(w);
2951
+ return console.log("[ToolCalculator] Got provider from registry:", x), x;
2952
+ } catch (w) {
2953
+ return console.error("[ToolCalculator] Failed to get provider:", w), null;
2954
+ }
2955
+ }
2956
+ function Ho(d) {
2957
+ return a[d] || d;
2958
+ }
2959
+ function Yn(d) {
2960
+ return d ? d.childElementCount > 0 || !!d.querySelector(Bo) : !1;
2961
+ }
2962
+ function Ko(d) {
2963
+ if (!d) return;
2964
+ const w = [60, 250, 1e3, 2500];
2965
+ for (const x of w)
2966
+ setTimeout(
2967
+ () => {
2968
+ try {
2969
+ d.resize?.();
2970
+ } catch {
2971
+ }
2972
+ },
2973
+ x
2974
+ );
2975
+ }
2976
+ async function Yr(d, w, x = 8e3) {
2977
+ if (!d || !await Jo(d, x)) return !1;
2978
+ m(Pe, !0);
2979
+ try {
2980
+ w?.resize?.();
2981
+ } catch {
2982
+ }
2983
+ return !0;
2984
+ }
2985
+ async function Jo(d, w = 3e3) {
2986
+ if (!d) return !1;
2987
+ const x = Date.now();
2988
+ for (; Date.now() - x < w; ) {
2989
+ if (!d.isConnected) return !1;
2990
+ if (Yn(d)) return !0;
2991
+ await new Promise((F) => setTimeout(F, 100));
2992
+ }
2993
+ return Yn(d);
2994
+ }
2995
+ async function Go(d, w = 2e3) {
2996
+ if (!d) return !1;
2997
+ const x = Date.now();
2998
+ for (; Date.now() - x < w; ) {
2999
+ if (!d.isConnected) return !1;
3000
+ if (d.parentElement === document.body) return !0;
3001
+ await new Promise((F) => requestAnimationFrame(() => F()));
3002
+ }
3003
+ return d.parentElement === document.body;
3004
+ }
3005
+ function Yo(d) {
3006
+ return new Promise((w, x) => {
3007
+ if (d?.aborted) {
3008
+ x(new DOMException("Operation aborted", "AbortError"));
3009
+ return;
3010
+ }
3011
+ "scheduler" in globalThis && "postTask" in globalThis.scheduler ? globalThis.scheduler.postTask(() => w(), { priority: "user-blocking", signal: d }) : requestAnimationFrame(() => w());
3012
+ });
3013
+ }
3014
+ function Xr(d, w) {
3015
+ return new Promise((x) => {
3016
+ let F = d;
3017
+ function de() {
3018
+ if (w?.aborted || F <= 0) {
3019
+ x();
3020
+ return;
3021
+ }
3022
+ F--, requestAnimationFrame(de);
3023
+ }
3024
+ de();
3025
+ });
3026
+ }
3027
+ let Zr = /* @__PURE__ */ ge(() => s[o(O)] ?? s.scientific), Qr = /* @__PURE__ */ ge(() => o(Zr).width), tl = /* @__PURE__ */ ge(() => o(Zr).height), Xn = /* @__PURE__ */ ge(() => i ? o(Jn) !== null && o(Gn) !== null ? {
3028
+ left: `${o(Jn)}px`,
3029
+ top: `${o(Gn)}px`,
3030
+ transform: ""
3031
+ } : { left: "50%", top: "50%", transform: "translate(-50%, -50%)" } : { left: "50%", top: "50%", transform: "translate(-50%, -50%)" });
3032
+ function el(d) {
3033
+ const w = d === "graphing";
3034
+ return {
3035
+ theme: "light",
3036
+ restrictedMode: !1,
3037
+ desmos: {
3038
+ degreeMode: !0,
3039
+ settingsMenu: w,
3040
+ qwertyKeyboard: !1,
3041
+ notes: w,
3042
+ folders: w,
3043
+ sliders: w,
3044
+ tables: w
3045
+ }
3046
+ };
3047
+ }
3048
+ let L = /* @__PURE__ */ S($e(el("scientific")));
3049
+ async function yn() {
3050
+ if (console.log("[ToolCalculator] initCalculator called", {
3051
+ isInitializing: o(X),
3052
+ isSwitching: o(z),
3053
+ hasCalculatorInstance: !!o($),
3054
+ hasContainerEl: !!o(b),
3055
+ initializationFailed: o(ht),
3056
+ hasToolkitCoordinator: !!o(v),
3057
+ hasRegistry: !!o(v)?.toolProviderRegistry
3058
+ }), o(X) || o(z) || o($) || !o(b) || o(ht)) {
3059
+ console.log("[ToolCalculator] Early return from initCalculator");
3060
+ return;
3061
+ }
3062
+ m(X, !0);
3063
+ try {
3064
+ o(C).includes(o(O)) || (console.log("[ToolCalculator] Calculator type not available, using fallback", {
3065
+ requested: o(O),
3066
+ availableTypes: o(C),
3067
+ fallback: o(C)[0] || "scientific"
3068
+ }), m(O, o(C)[0] || "scientific", !0)), console.log("[ToolCalculator] Getting provider for type:", o(O));
3069
+ const d = await Gr(o(O));
3070
+ if (console.log("[ToolCalculator] Got tool provider:", d), !d)
3071
+ throw new Error("Desmos calculator tool provider not available");
3072
+ console.log("[ToolCalculator] Creating calculator provider instance");
3073
+ const w = await d.createInstance();
3074
+ if (console.log("[ToolCalculator] Got calculator provider:", w), !o(b) || o($) || o(z)) {
3075
+ console.log("[ToolCalculator] Aborting due to state change");
3076
+ return;
3077
+ }
3078
+ console.log("[ToolCalculator] Creating calculator with config:", {
3079
+ type: o(O),
3080
+ hasContainer: !!o(b),
3081
+ config: o(L)
3082
+ });
3083
+ const x = o(b);
3084
+ if (!x || !x.isConnected) {
3085
+ console.warn("[ToolCalculator] Calculator container unavailable before mount");
3086
+ return;
3087
+ }
3088
+ if (Jr(o(O)) && !await Go(o(k))) {
3089
+ console.warn("[ToolCalculator] Calculator panel not body-mounted before init");
3090
+ return;
3091
+ }
3092
+ m($, await w.createCalculator(o(O), x, o(L)), !0), await Xr(2), o($)?.resize?.(), Ko(o($)), m(Pe, !1), await Yr(x, o($), 4e3) || (console.warn("[ToolCalculator] Calculator mount pending after init; keeping instance and monitoring"), Yr(x, o($), 12e3)), console.log("[ToolCalculator] Calculator instance created:", o($)), m(ht, !1), m(fe, null), m(Pe, Yn(x), !0), console.log(`[ToolCalculator] ${o(O)} calculator initialized successfully`);
3093
+ } catch (d) {
3094
+ m(ht, !0), m(fe, d instanceof Error ? d.message : String(d), !0), console.error("[ToolCalculator] Failed to initialize calculator:", d), m($, null), m(Pe, !1);
3095
+ } finally {
3096
+ m(X, !1);
3097
+ }
3098
+ }
3099
+ async function nl(d) {
3100
+ if (o(b)) {
3101
+ if (Jr(o(O)) && o(b).parentElement) {
3102
+ const w = o(b).parentElement, x = o(b), F = document.createElement("div");
3103
+ F.className = x.className || "pie-tool-calculator__container", w.replaceChild(F, x), m(b, F, !0), await Yo(d), (o(b) !== F || !o(b).isConnected) && (console.warn("[ToolCalculator] Container binding mismatch, using new container"), m(b, F, !0));
3104
+ } else
3105
+ o(b).removeAttribute("data-desmos-id");
3106
+ if (!o(b)?.isConnected)
3107
+ throw new Error("Container was removed before initialization");
3108
+ }
3109
+ }
3110
+ async function Xo(d) {
3111
+ if (d === o(O) || !o(C).includes(d)) return;
3112
+ o(dt)?.abort(), m(dt, new AbortController(), !0);
3113
+ const w = o(dt).signal;
3114
+ ll(), m(z, !0);
3115
+ try {
3116
+ if (o($))
3117
+ try {
3118
+ o($).destroy(), await Xr(4, w);
3119
+ } catch (kn) {
3120
+ console.warn("[ToolCalculator] Error destroying calculator:", kn);
3121
+ } finally {
3122
+ m($, null);
3123
+ }
3124
+ if (w.aborted || (await nl(w), w.aborted)) return;
3125
+ m(O, d, !0);
3126
+ const x = structuredClone(el(d));
3127
+ if (o(L).restrictedMode && (x.restrictedMode = !0), m(L, x, !0), w.aborted) return;
3128
+ const F = await Gr(d);
3129
+ if (!F)
3130
+ throw new Error("Calculator tool provider not available");
3131
+ const de = await F.createInstance();
3132
+ if (w.aborted) return;
3133
+ if (!o(b)?.isConnected)
3134
+ throw new Error("Container removed during provider initialization");
3135
+ m($, await de.createCalculator(d, o(b), o(L)), !0), m(Ur, void 0), m(Vr, void 0), w.aborted && (o($)?.destroy(), m($, null));
3136
+ } catch (x) {
3137
+ if (x instanceof DOMException && x.name === "AbortError") {
3138
+ console.log("[ToolCalculator] Switch cancelled");
3139
+ return;
3140
+ }
3141
+ console.error("[ToolCalculator] Failed to create calculator:", x), m($, null);
3142
+ } finally {
3143
+ m(z, !1);
3144
+ }
3145
+ }
3146
+ async function Vt() {
3147
+ if (!o($) || !o(b)) return;
3148
+ o(dt)?.abort();
3149
+ const d = new AbortController();
3150
+ m(dt, d, !0);
3151
+ const w = d.signal;
3152
+ try {
3153
+ if (o($).destroy(), m($, null), w.aborted || (await nl(w), w.aborted)) return;
3154
+ await yn();
3155
+ } catch (x) {
3156
+ if (x instanceof DOMException && x.name === "AbortError") {
3157
+ console.log("[ToolCalculator] Config update cancelled");
3158
+ return;
3159
+ }
3160
+ console.error("[ToolCalculator] Failed to update config:", x), m($, null);
3161
+ }
3162
+ }
3163
+ function rl() {
3164
+ if (o($)) {
3165
+ try {
3166
+ o($).destroy();
3167
+ } catch (d) {
3168
+ console.warn("[ToolCalculator] Error destroying calculator on close:", d);
3169
+ }
3170
+ m($, null);
3171
+ }
3172
+ o(b)?.replaceChildren(), o(y)?.hideTool(c());
3173
+ }
3174
+ function Zo() {
3175
+ m(U, !o(U));
3176
+ }
3177
+ function ll() {
3178
+ m(U, !1);
3179
+ }
3180
+ function Qo(d) {
3181
+ d.key === "Escape" && rl();
3182
+ }
3183
+ function ts(d) {
3184
+ const w = d.target;
3185
+ if (w.closest(".pie-tool-calculator__header") && o(k) && (o(y)?.bringToFront(o(k)), !w.closest("button") && !w.closest(".pie-tool-calculator__header-buttons"))) {
3186
+ d.preventDefault(), m(Xe, !0);
3187
+ const x = o(k).getBoundingClientRect();
3188
+ m(Hr, d.clientX - x.left), m(Kr, d.clientY - x.top), o(k).setPointerCapture(d.pointerId);
3189
+ }
3190
+ }
3191
+ function es(d) {
3192
+ if (!o(Xe) || !o(k)) return;
3193
+ d.preventDefault();
3194
+ const w = d.clientX - o(Hr), x = d.clientY - o(Kr);
3195
+ o(k).style.left = `${w}px`, o(k).style.top = `${x}px`, o(k).style.transform = "";
3196
+ }
3197
+ function ns(d) {
3198
+ if (o(Xe) && o(k)) {
3199
+ m(Xe, !1), o(k).releasePointerCapture(d.pointerId);
3200
+ const w = parseFloat(o(k).style.left), x = parseFloat(o(k).style.top);
3201
+ !isNaN(w) && !isNaN(x) && (m(Jn, w, !0), m(Gn, x, !0)), o(k).style.left = "", o(k).style.top = "", o(k).style.transform = "";
3202
+ }
3203
+ }
3204
+ Ot(() => {
3205
+ !h() || !o(C).includes(h()) || m(O, h());
3206
+ }), Ot(() => {
3207
+ !o(y) || !c() || (o(Ut) && o(St) && (o(Ut) !== o(y) || o(St) !== c()) && (o(Ut).unregisterTool(o(St)), m(Ut, null), m(St, null)), o(St) || (o(y).registerTool(c(), "Calculator", o(k), gs.MODAL), m(Ut, o(y), !0), m(St, c())));
3208
+ }), Di(() => (Uo(), u() && yn(), () => {
3209
+ o(Oe)?.(), o($)?.destroy(), o(Ut) && o(St) && (o(Ut).unregisterTool(o(St)), m(Ut, null), m(St, null));
3210
+ })), Ot(() => {
3211
+ o(y) && o(k) && c() && (o(y).updateToolElement(c(), o(k)), o(k).style.zIndex || o(y).bringToFront(o(k)));
3212
+ }), Ot(() => {
3213
+ if (!u()) {
3214
+ if (o($))
3215
+ try {
3216
+ o($).destroy();
3217
+ } catch (d) {
3218
+ console.warn("[ToolCalculator] Error destroying calculator on hide:", d);
3219
+ } finally {
3220
+ m($, null);
3221
+ }
3222
+ m(ht, !1), m(fe, null), m(Pe, !1), m(Ur, void 0), m(Vr, void 0);
3223
+ return;
3224
+ }
3225
+ !o($) && !o(X) && !o(z) && !o(ht) && (o(b)?.isConnected ? yn() : queueMicrotask(() => {
3226
+ u() && o(b)?.isConnected && !o($) && !o(X) && !o(z) && !o(ht) && yn();
3227
+ }));
3228
+ });
3229
+ let Z = null;
3230
+ Ot(() => {
3231
+ if (u() && o(b) && o($) && o(b).isConnected)
3232
+ return Z || (Z = new ResizeObserver((d) => {
3233
+ for (const w of d)
3234
+ if (!w.target.isConnected) {
3235
+ Z?.unobserve(w.target);
3236
+ return;
3237
+ }
3238
+ if (o($)?.resize && o(b)?.isConnected && u())
3239
+ try {
3240
+ o($).resize();
3241
+ } catch (w) {
3242
+ console.warn("[ToolCalculator] Error during resize:", w), Z && o(b) && Z.unobserve(o(b));
3243
+ }
3244
+ })), Z.observe(o(b)), () => {
3245
+ Z && o(b) && Z.unobserve(o(b)), Z?.disconnect(), Z = null;
3246
+ };
3247
+ Z && (o(b) && Z.unobserve(o(b)), Z.disconnect(), Z = null);
3248
+ }), Ot(() => {
3249
+ o(k) && u() ? o(Oe) || m(Oe, ra(o(k)), !0) : !u() && o(Oe) && (o(Oe)(), m(Oe, null));
3250
+ }), Ot(() => {
3251
+ if (!(!i || !u() || !o(k)))
3252
+ return o(k).parentElement !== document.body && document.body.appendChild(o(k)), () => {
3253
+ o(k) && o(k).parentElement === document.body && o(k).remove();
3254
+ };
3255
+ });
3256
+ var rs = {
3257
+ get visible() {
3258
+ return u();
3259
+ },
3260
+ set visible(d = !1) {
3261
+ u(d), Nt();
3262
+ },
3263
+ get toolId() {
3264
+ return c();
3265
+ },
3266
+ set toolId(d = "calculator") {
3267
+ c(d), Nt();
3268
+ },
3269
+ get calculatorType() {
3270
+ return h();
3271
+ },
3272
+ set calculatorType(d = "scientific") {
3273
+ h(d), Nt();
3274
+ },
3275
+ get availableTypes() {
3276
+ return p();
3277
+ },
3278
+ set availableTypes(d = ["basic", "scientific", "graphing"]) {
3279
+ p(d), Nt();
3280
+ }
3281
+ }, _n = ha(), ls = j(_n);
3282
+ {
3283
+ var os = (d) => {
3284
+ var w = da();
3285
+ let x;
3286
+ var F = j(w), de = W(j(F), 2), kn = j(de);
3287
+ Fo(kn, {
3288
+ onClick: Zo,
3289
+ ariaLabel: "Calculator settings",
3290
+ get active() {
3291
+ return o(U);
3292
+ }
3293
+ });
3294
+ var ss = W(kn, 2);
3295
+ D(de), D(F);
3296
+ var Zn = W(F, 2);
3297
+ Rn(Zn, (G) => m(b, G), () => o(b));
3298
+ var ol = W(Zn, 2);
3299
+ {
3300
+ var is = (G) => {
3301
+ var At = sa();
3302
+ xt(G, At);
3303
+ };
3304
+ be(ol, (G) => {
3305
+ (o(X) || o(z) || u() && !o(ht) && !o(Pe)) && G(is);
3306
+ });
3307
+ }
3308
+ var sl = W(ol, 2);
3309
+ {
3310
+ var as = (G) => {
3311
+ var At = aa(), $n = W(j(At));
3312
+ {
3313
+ var Ze = (Qe) => {
3314
+ var ze = ia(), tn = j(ze, !0);
3315
+ D(ze), je(() => cr(tn, o(fe))), xt(Qe, ze);
3316
+ };
3317
+ be($n, (Qe) => {
3318
+ o(fe) && Qe(Ze);
3319
+ });
3320
+ }
3321
+ D(At), xt(G, At);
3322
+ };
3323
+ be(sl, (G) => {
3324
+ o(ht) && G(as);
3325
+ });
3326
+ }
3327
+ var us = W(sl, 2);
3328
+ {
3329
+ var cs = (G) => {
3330
+ var At = fa(), $n = j(At), Ze = j($n), Qe = W(j(Ze), 2);
3331
+ D(Ze);
3332
+ var ze = W(Ze, 2), tn = j(ze), fs = W(j(tn), 2);
3333
+ Wi(fs, 16, () => o(C), (Q) => Q, (Q, ve) => {
3334
+ var pe = ua(), Lt = j(pe);
3335
+ Kt(Lt);
3336
+ var De = W(Lt, 2), en = j(De, !0);
3337
+ D(De), D(pe), je(
3338
+ (nn) => {
3339
+ Yi(Lt, ve), Jt(Lt, o(O) === ve), cr(en, nn);
3340
+ },
3341
+ [() => Ho(ve)]
3342
+ ), J("change", Lt, () => Xo(ve)), xt(Q, pe);
3343
+ }), D(tn);
3344
+ var il = W(tn, 2), Qn = W(j(il), 4), tr = j(Qn);
3345
+ Kt(tr), Gt(2), D(Qn);
3346
+ var er = W(Qn, 2), nr = j(er), al = W(j(nr)), ds = j(al, !0);
3347
+ D(al), D(nr);
3348
+ var he = W(nr, 2), rr = j(he);
3349
+ rr.value = rr.__value = "degree";
3350
+ var ul = W(rr);
3351
+ ul.value = ul.__value = "radian", D(he);
3352
+ var cl;
3353
+ Vi(he), D(er);
3354
+ var lr = W(er, 2), or = j(lr);
3355
+ Kt(or), Gt(2), D(lr);
3356
+ var fl = W(lr, 2);
3357
+ be(fl, (Q) => {
3358
+ });
3359
+ var hs = W(fl, 2);
3360
+ {
3361
+ var vs = (Q) => {
3362
+ var ve = ca(), pe = bi(ve), Lt = j(pe);
3363
+ Kt(Lt), Gt(2), D(pe);
3364
+ var De = W(pe, 2), en = j(De);
3365
+ Kt(en), Gt(2), D(De);
3366
+ var nn = W(De, 2), sr = j(nn);
3367
+ Kt(sr), Gt(2), D(nn);
3368
+ var ir = W(nn, 2), ar = j(ir);
3369
+ Kt(ar), Gt(2), D(ir);
3370
+ var dl = W(ir, 2), ur = j(dl);
3371
+ Kt(ur), Gt(2), D(dl), je(() => {
3372
+ Jt(Lt, o(L).desmos?.settingsMenu ?? !0), Jt(en, o(L).desmos?.notes ?? !0), Jt(sr, o(L).desmos?.folders ?? !0), Jt(ar, o(L).desmos?.sliders ?? !0), Jt(ur, o(L).desmos?.tables ?? !0);
3373
+ }), J("change", Lt, (Rt) => {
3374
+ o(L).desmos = {
3375
+ ...o(L).desmos,
3376
+ settingsMenu: Rt.target.checked
3377
+ }, Vt();
3378
+ }), J("change", en, (Rt) => {
3379
+ o(L).desmos = { ...o(L).desmos, notes: Rt.target.checked }, Vt();
3380
+ }), J("change", sr, (Rt) => {
3381
+ o(L).desmos = { ...o(L).desmos, folders: Rt.target.checked }, Vt();
3382
+ }), J("change", ar, (Rt) => {
3383
+ o(L).desmos = { ...o(L).desmos, sliders: Rt.target.checked }, Vt();
3384
+ }), J("change", ur, (Rt) => {
3385
+ o(L).desmos = { ...o(L).desmos, tables: Rt.target.checked }, Vt();
3386
+ }), xt(Q, ve);
3387
+ };
3388
+ be(hs, (Q) => {
3389
+ o(O) === "graphing" && Q(vs);
3390
+ });
3391
+ }
3392
+ D(il), D(ze), D($n), D(At), je(() => {
3393
+ Jt(tr, o(L).restrictedMode ?? !1), cr(ds, o(L).desmos?.degreeMode === !1 ? "Radians" : "Degrees"), cl !== (cl = o(L).desmos?.degreeMode === !1 ? "radian" : "degree") && (he.value = he.__value = o(L).desmos?.degreeMode === !1 ? "radian" : "degree", Wo(he, o(L).desmos?.degreeMode === !1 ? "radian" : "degree")), Jt(or, o(L).desmos?.qwertyKeyboard ?? !1);
3394
+ }), J("click", Qe, ll), J("change", tr, (Q) => {
3395
+ o(L).restrictedMode = Q.target.checked, Vt();
3396
+ }), J("change", he, (Q) => {
3397
+ o(L).desmos = {
3398
+ ...o(L).desmos,
3399
+ degreeMode: Q.target.value === "degree"
3400
+ }, Vt();
3401
+ }), J("change", or, (Q) => {
3402
+ o(L).desmos = {
3403
+ ...o(L).desmos,
3404
+ qwertyKeyboard: Q.target.checked
3405
+ }, Vt();
3406
+ }), xt(G, At);
3407
+ };
3408
+ be(us, (G) => {
3409
+ o(U) && G(cs);
3410
+ });
3411
+ }
3412
+ D(w), Rn(w, (G) => m(k, G), () => o(k)), je(() => {
3413
+ x = Bi(w, 1, "pie-tool-calculator notranslate svelte-sun9kf", null, x, { "pie-tool-calculator--dragging": o(Xe) }), Ui(w, `left: ${o(Xn).left ?? ""}; top: ${o(Xn).top ?? ""}; ${o(Qr) !== void 0 ? `width: ${o(Qr)}px;` : ""} ${o(tl) !== void 0 ? `height: ${o(tl)}px;` : ""} transform: ${o(Xn).transform ?? ""};`), bn(Zn, "data-calculator-type", o(O));
3414
+ }), J("pointerdown", w, ts), J("pointermove", w, es), J("pointerup", w, ns), J("keydown", w, Qo), J("click", ss, rl), xt(d, w);
3415
+ };
3416
+ be(ls, (d) => {
3417
+ u() && d(os);
3418
+ });
3419
+ }
3420
+ return D(_n), Rn(_n, (d) => m(g, d), () => o(g)), xt(t, _n), Pr(rs);
3421
+ }
3422
+ Po([
3423
+ "pointerdown",
3424
+ "pointermove",
3425
+ "pointerup",
3426
+ "keydown",
3427
+ "click",
3428
+ "change"
3429
+ ]);
3430
+ customElements.define("pie-tool-calculator", qo(
3431
+ pa,
3432
+ {
3433
+ visible: { attribute: "visible", type: "Boolean" },
3434
+ toolId: { attribute: "tool-id", type: "String" },
3435
+ calculatorType: { attribute: "calculator-type", type: "String" },
3436
+ availableTypes: { attribute: "available-types", type: "Array" }
3437
+ },
3438
+ [],
3439
+ []
3440
+ ));
3441
+ export {
3442
+ pa as default
3443
+ };