@pie-players/pie-tool-answer-eliminator 1.0.0-beta.0 → 1.0.0-beta.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.
@@ -1,2744 +1,13 @@
1
- import { coerceBooleanAttributes as xn } from "@pie-players/pie-players-shared/ui/attribute-coercion";
2
- import { connectToolRuntimeContext as Hn, connectToolShellContext as Nn } from "@pie-players/pie-assessment-toolkit/tools/registration";
3
- import { parseVersionedTagName as Pn } from "@pie-players/pie-players-shared/pie/tag-names";
4
- if (typeof window < "u") {
5
- var hr, dr;
6
- ((hr = (dr = window).__svelte ?? (dr.__svelte = {})).v ?? (hr.v = /* @__PURE__ */ new Set())).add("5");
7
- }
8
- var gt = {}, N = /* @__PURE__ */ Symbol("uninitialized");
9
- var Bn = Array.isArray, Fn = Array.prototype.indexOf, yt = Array.prototype.includes, Gn = Array.from, bt = Object.keys, Ze = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, Kn = Object.prototype, Wn = Array.prototype, Dn = Object.getPrototypeOf, vr = Object.isExtensible, jn = () => {
10
- };
11
- function qn(t) {
12
- for (var e = 0; e < t.length; e++) t[e]();
13
- }
14
- function Yn() {
15
- var t, e;
16
- return {
17
- promise: new Promise((r, n) => {
18
- t = r, e = n;
19
- }),
20
- resolve: t,
21
- reject: e
22
- };
23
- }
24
- function et(t) {
25
- "@babel/helpers - typeof";
26
- return et = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
27
- return typeof e;
28
- } : function(e) {
29
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
30
- }, et(t);
31
- }
32
- function Vn(t, e) {
33
- if (et(t) != "object" || !t) return t;
34
- var r = t[Symbol.toPrimitive];
35
- if (r !== void 0) {
36
- var n = r.call(t, e || "default");
37
- if (et(n) != "object") return n;
38
- throw new TypeError("@@toPrimitive must return a primitive value.");
39
- }
40
- return (e === "string" ? String : Number)(t);
41
- }
42
- function zn(t) {
43
- var e = Vn(t, "string");
44
- return et(e) == "symbol" ? e : e + "";
45
- }
46
- function o(t, e, r) {
47
- return (e = zn(e)) in t ? Object.defineProperty(t, e, {
48
- value: r,
49
- enumerable: !0,
50
- configurable: !0,
51
- writable: !0
52
- }) : t[e] = r, t;
53
- }
54
- var Ls = 1 << 24, ne = 1024, z = 2048, Oe = 4096, Mr = 8192, Xn = 16384, xr = 32768, _r = 1 << 25, Hr = 65536, Os = 1 << 17, Is = 1 << 18, st = 1 << 19, Un = 1 << 20, pr = 1 << 21, Ms = 1 << 22, Nr = 1 << 23, Ue = /* @__PURE__ */ Symbol("$state"), Pr = /* @__PURE__ */ Symbol("component"), Br = /* @__PURE__ */ Symbol("legacy props"), Qn = /* @__PURE__ */ Symbol("proxy path"), Jn = /* @__PURE__ */ Symbol("attributes"), Zn = /* @__PURE__ */ Symbol("class"), ei = /* @__PURE__ */ Symbol("style"), ti = /* @__PURE__ */ Symbol("text"), It = new class extends Error {
55
- constructor(...e) {
56
- super(...e), o(this, "name", "StaleReactionError"), o(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
57
- }
58
- }(), Hs = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
59
- function ri() {
60
- console.warn("https://svelte.dev/e/derived_inert");
61
- }
62
- function Fr(t) {
63
- console.warn("https://svelte.dev/e/hydration_mismatch");
64
- }
65
- function ni() {
66
- console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
67
- }
68
- var J = !1;
69
- function lt(t) {
70
- J = t;
71
- }
72
- var G;
73
- function tt(t) {
74
- if (t === null)
75
- throw Fr(), gt;
76
- return G = t;
77
- }
78
- function Gr() {
79
- return tt(/* @__PURE__ */ qe(G));
80
- }
81
- function ii(t = 1) {
82
- if (J) {
83
- for (var e = t, r = G; e--; ) r = /* @__PURE__ */ qe(r);
84
- G = r;
85
- }
86
- }
87
- function si(t = !0) {
88
- for (var e = 0, r = G; ; ) {
89
- if (r.nodeType === 8) {
90
- var n = r.data;
91
- if (n === "]") {
92
- if (e === 0) return r;
93
- e -= 1;
94
- } else (n === "[" || n === "[!" || n[0] === "[" && !isNaN(Number(n.slice(1)))) && (e += 1);
95
- }
96
- var i = /* @__PURE__ */ qe(r);
97
- t && r.remove(), r = i;
98
- }
99
- }
100
- function Kr(t) {
101
- return t === this.v;
102
- }
103
- function ai(t, e) {
104
- return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
105
- }
106
- function Wr(t) {
107
- return !ai(t, this.v);
108
- }
109
- function li(t) {
110
- throw new Error("https://svelte.dev/e/effect_in_teardown");
111
- }
112
- function oi() {
113
- throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
114
- }
115
- function ui(t) {
116
- throw new Error("https://svelte.dev/e/effect_orphan");
117
- }
118
- function fi() {
119
- throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
120
- }
121
- function ci() {
122
- throw new Error("https://svelte.dev/e/hydration_failed");
123
- }
124
- function hi(t) {
125
- throw new Error("https://svelte.dev/e/props_invalid_value");
126
- }
127
- function di() {
128
- throw new Error("https://svelte.dev/e/state_descriptors_fixed");
129
- }
130
- function vi() {
131
- throw new Error("https://svelte.dev/e/state_prototype_fixed");
132
- }
133
- function _i() {
134
- throw new Error("https://svelte.dev/e/state_unsafe_mutation");
135
- }
136
- function pi() {
137
- throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
138
- }
139
- var Ie = !1, Mt = !1;
140
- function mr(t, e) {
141
- return t.label = e, mi(t.v, e), t;
142
- }
143
- function mi(t, e) {
144
- return t?.[Qn]?.(e), t;
145
- }
146
- var M = null;
147
- function wt(t) {
148
- M = t;
149
- }
150
- function Dr(t, e = !1, r) {
151
- M = {
152
- p: M,
153
- i: !1,
154
- c: null,
155
- e: null,
156
- s: t,
157
- x: null,
158
- r: $,
159
- l: Mt && !e ? {
160
- s: null,
161
- u: null,
162
- $: []
163
- } : null
164
- };
165
- }
166
- function jr(t) {
167
- var e = M, r = e.e;
168
- if (r !== null) {
169
- e.e = null;
170
- for (var n of r) dn(n);
171
- }
172
- return t !== void 0 && (e.x = t), e.i = !0, M = e.p, er(t);
173
- }
174
- function er(t = {}) {
175
- return Ze(t, Pr, { value: !0 }), t;
176
- }
177
- function xt() {
178
- return !Mt || M !== null && M.l === null;
179
- }
180
- var we = [];
181
- function qr() {
182
- var t = we;
183
- we = [], qn(t);
184
- }
185
- function ke(t) {
186
- if (we.length === 0 && !Qe) {
187
- var e = we;
188
- queueMicrotask(() => {
189
- e === we && qr();
190
- });
191
- }
192
- we.push(t);
193
- }
194
- function gi() {
195
- for (; we.length > 0; ) qr();
196
- }
197
- var yi = ~(z | Oe | ne);
198
- function O(t, e) {
199
- t.f = t.f & yi | e;
200
- }
201
- function tr(t) {
202
- (t.f & 512) !== 0 || t.deps === null ? O(t, ne) : O(t, Oe);
203
- }
204
- function Yr(t, e, r) {
205
- (t.f & 2048) !== 0 ? e.add(t) : (t.f & 4096) !== 0 && r.add(t), O(t, ne);
206
- }
207
- function Ht(t) {
208
- var e = E, r = $;
209
- le(null), _e(null);
210
- try {
211
- return t();
212
- } finally {
213
- le(e), _e(r);
214
- }
215
- }
216
- // @__NO_SIDE_EFFECTS__
217
- function St(t) {
218
- var e = 2 | z;
219
- return $ !== null && ($.f |= st), {
220
- ctx: M,
221
- deps: null,
222
- effects: null,
223
- equals: Kr,
224
- f: e,
225
- fn: t,
226
- reactions: null,
227
- rv: 0,
228
- v: N,
229
- wv: 0,
230
- parent: $,
231
- ac: null
232
- };
233
- }
234
- var bi = /* @__PURE__ */ Symbol("obsolete");
235
- // @__NO_SIDE_EFFECTS__
236
- function gr(t) {
237
- const e = /* @__PURE__ */ St(t);
238
- return Ie || mn(e), e;
239
- }
240
- // @__NO_SIDE_EFFECTS__
241
- function wi(t) {
242
- const e = /* @__PURE__ */ St(t);
243
- return e.equals = Wr, e;
244
- }
245
- function Si(t) {
246
- var e = t.effects;
247
- if (e !== null) {
248
- t.effects = null;
249
- for (var r = 0; r < e.length; r += 1) Z(e[r]);
250
- }
251
- }
252
- function rr(t) {
253
- var e, r = $, n = t.parent;
254
- if (!ce && n !== null && t.v !== N && (n.f & 24576) !== 0)
255
- return ri(), t.v;
256
- _e(n);
257
- try {
258
- Si(t), e = wn(t);
259
- } finally {
260
- _e(r);
261
- }
262
- return e;
263
- }
264
- function Vr(t) {
265
- var e = rr(t);
266
- if (!t.equals(e) && (t.wv = yn(), (!T?.is_fork || t.deps === null) && (T !== null ? (T.capture(t, e, !0), jt?.capture(t, e, !0)) : t.v = e, t.deps === null))) {
267
- O(t, ne);
268
- return;
269
- }
270
- ce || (F !== null ? (ar() || T?.is_fork) && F.set(t, e) : tr(t));
271
- }
272
- function Ai(t) {
273
- if (t.effects !== null)
274
- for (const e of t.effects) (e.teardown || e.ac) && (e.teardown?.(), e.ac !== null && Ht(() => {
275
- e.ac.abort(It), e.ac = null;
276
- }), e.fn !== null && (e.teardown = jn), nt(e, 0), or(e));
277
- }
278
- function zr(t) {
279
- if (t.effects !== null)
280
- for (const e of t.effects) e.teardown && e.fn !== null && De(e);
281
- }
282
- function Xr(t, e) {
283
- if (e.has(t)) throw new TypeError("Cannot initialize the same private elements twice on an object");
284
- }
285
- function nr(t, e) {
286
- Xr(t, e), e.add(t);
287
- }
288
- function S(t, e, r) {
289
- Xr(t, e), e.set(t, r);
290
- }
291
- function g(t, e, r) {
292
- if (typeof t == "function" ? t === e : t.has(e)) return arguments.length < 3 ? e : r;
293
- throw new TypeError("Private element is not present on this object");
294
- }
295
- function m(t, e, r) {
296
- return t.set(g(t, e), r), r;
297
- }
298
- function a(t, e) {
299
- return t.get(g(t, e));
300
- }
301
- var Ur, At = null, Pe = null, T = null, jt = null, F = null, qt = null, Qe = !1, Ft = !1, rt = null, Et = null, Qr = 0;
302
- var Ei = 1, Tt = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), Be = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), Yt = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakSet(), je = class Jr {
303
- constructor() {
304
- nr(this, C), o(this, "id", Ei++), S(this, Tt, !1), o(this, "linked", !0), S(this, Te, null), S(this, Se, null), o(this, "async_deriveds", /* @__PURE__ */ new Map()), o(this, "current", /* @__PURE__ */ new Map()), o(this, "previous", /* @__PURE__ */ new Map()), S(this, $t, /* @__PURE__ */ new Set()), S(this, ot, /* @__PURE__ */ new Set()), S(this, Be, 0), S(this, ye, /* @__PURE__ */ new Map()), S(this, Ve, null), S(this, X, []), S(this, Yt, []), S(this, Re, /* @__PURE__ */ new Set()), S(this, fe, /* @__PURE__ */ new Set()), S(this, he, /* @__PURE__ */ new Map()), S(this, dt, /* @__PURE__ */ new Set()), o(this, "is_fork", !1), S(this, ze, !1), Pe === null ? At = Pe = this : (m(Se, Pe, this), m(Te, this, Pe)), Pe = this;
305
- }
306
- skip_effect(e) {
307
- a(he, this).has(e) || a(he, this).set(e, {
308
- d: [],
309
- m: []
310
- }), a(dt, this).delete(e);
311
- }
312
- unskip_effect(e, r = (n) => this.schedule(n)) {
313
- var n = a(he, this).get(e);
314
- if (n) {
315
- a(he, this).delete(e);
316
- for (var i of n.d)
317
- O(i, z), r(i);
318
- for (i of n.m)
319
- O(i, Oe), r(i);
320
- }
321
- a(dt, this).add(e);
322
- }
323
- capture(e, r, n = !1) {
324
- e.v !== N && !this.previous.has(e) && this.previous.set(e, e.v), (e.f & 8388608) === 0 && (this.current.set(e, [r, n]), F?.set(e, r)), this.is_fork || (e.v = r);
325
- }
326
- activate() {
327
- T = this;
328
- }
329
- deactivate() {
330
- T = null, F = null;
331
- }
332
- flush() {
333
- try {
334
- Ft = !0, T = this, g(C, this, Ct).call(this);
335
- } finally {
336
- Qr = 0, qt = null, rt = null, Et = null, Ft = !1, T = null, F = null, ae.clear();
337
- }
338
- }
339
- discard() {
340
- for (const e of a(ot, this)) e(this);
341
- a(ot, this).clear();
342
- for (const e of this.async_deriveds.values()) e.reject(bi);
343
- g(C, this, kt).call(this), a(Ve, this)?.resolve();
344
- }
345
- register_created_effect(e) {
346
- a(Yt, this).push(e);
347
- }
348
- increment(e, r) {
349
- if (m(Be, this, a(Be, this) + 1), e) {
350
- let n = a(ye, this).get(r) ?? 0;
351
- a(ye, this).set(r, n + 1);
352
- }
353
- }
354
- decrement(e, r) {
355
- if (m(Be, this, a(Be, this) - 1), e) {
356
- let n = a(ye, this).get(r) ?? 0;
357
- n === 1 ? a(ye, this).delete(r) : a(ye, this).set(r, n - 1);
358
- }
359
- a(ze, this) || (m(ze, this, !0), ke(() => {
360
- m(ze, this, !1), this.linked && this.flush();
361
- }));
362
- }
363
- transfer_effects(e, r) {
364
- for (const n of e) a(Re, this).add(n);
365
- for (const n of r) a(fe, this).add(n);
366
- e.clear(), r.clear();
367
- }
368
- oncommit(e) {
369
- a($t, this).add(e);
370
- }
371
- ondiscard(e) {
372
- a(ot, this).add(e);
373
- }
374
- settled() {
375
- return (a(Ve, this) ?? m(Ve, this, Yn())).promise;
376
- }
377
- static ensure() {
378
- if (T === null) {
379
- const e = T = new Jr();
380
- !Ft && !Qe && ke(() => {
381
- a(Tt, e) || e.flush();
382
- });
383
- }
384
- return T;
385
- }
386
- apply() {
387
- if (!Ie || !this.is_fork && a(Te, this) === null && a(Se, this) === null) {
388
- F = null;
389
- return;
390
- }
391
- F = /* @__PURE__ */ new Map();
392
- for (const [r, [n]] of this.current) F.set(r, n);
393
- for (let r = At; r !== null; r = a(Se, r))
394
- if (!(r === this || r.is_fork)) {
395
- var e = !1;
396
- if (r.id < this.id) {
397
- for (const [n, [, i]] of r.current)
398
- if (!i && this.current.has(n)) {
399
- e = !0;
400
- break;
401
- }
402
- }
403
- if (!e)
404
- for (const [n, i] of r.previous) F.has(n) || F.set(n, i);
405
- }
406
- }
407
- schedule(e) {
408
- if (qt = e, e.b?.is_pending && (e.f & 16777228) !== 0 && (e.f & 32768) === 0) {
409
- e.b.defer_effect(e);
410
- return;
411
- }
412
- a(X, this).push(e);
413
- }
414
- };
415
- Ur = je;
416
- function yr() {
417
- if (this.is_fork) return !0;
418
- for (const r of a(ye, this).keys()) {
419
- for (var t = r, e = !1; t.parent !== null; ) {
420
- if (a(he, this).has(t)) {
421
- e = !0;
422
- break;
423
- }
424
- t = t.parent;
425
- }
426
- if (!e) return !0;
427
- }
428
- return !1;
429
- }
430
- function Zr() {
431
- var t = [];
432
- for (const i of a(X, this))
433
- if (!((i.f & 16384) !== 0 || (i.f & 6144) === 0)) {
434
- for (var e = i, r = !1; e.parent !== null; ) {
435
- e = e.parent;
436
- var n = e.f;
437
- if ((n & 96) !== 0) {
438
- if ((n & 1024) === 0) {
439
- r = !0;
440
- break;
441
- }
442
- e.f ^= ne;
443
- }
444
- }
445
- r || t.push(e);
446
- }
447
- return m(X, this, []), t;
448
- }
449
- function Ct() {
450
- m(Tt, this, !0);
451
- for (const l of a(Re, this))
452
- a(fe, this).delete(l), O(l, z), this.schedule(l);
453
- for (const l of a(fe, this))
454
- O(l, Oe), this.schedule(l);
455
- this.apply();
456
- for (var t = rt = [], e = [], r = Et = []; a(X, this).length > 0; ) {
457
- Qr++ > 1e3 && (g(C, this, kt).call(this), ki());
458
- for (const l of g(C, this, Zr).call(this)) try {
459
- g(C, this, en).call(this, l, t, e);
460
- } catch (u) {
461
- throw nn(l), g(C, this, yr).call(this) || this.discard(), u;
462
- }
463
- }
464
- if (T = null, r.length > 0) {
465
- var n = Ur.ensure();
466
- for (const l of r) n.schedule(l);
467
- }
468
- if (rt = null, Et = null, g(C, this, yr).call(this)) {
469
- g(C, this, Xe).call(this, e), g(C, this, Xe).call(this, t);
470
- for (const [l, u] of a(he, this)) rn(l, u);
471
- r.length > 0 && g(C, T, Ct).call(T);
472
- return;
473
- }
474
- const i = g(C, this, Ti).call(this);
475
- if (i) {
476
- g(C, this, Xe).call(this, e), g(C, this, Xe).call(this, t), g(C, i, $i).call(i, this);
477
- return;
478
- }
479
- a(Re, this).clear(), a(fe, this).clear();
480
- for (const l of a($t, this)) l(this);
481
- a($t, this).clear(), jt = this, br(e), br(t), jt = null, a(Ve, this)?.resolve();
482
- var s = T;
483
- if (a(Be, this) === 0 && (a(X, this).length === 0 || s !== null) && (g(C, this, kt).call(this), Ie && (g(C, this, Ci).call(this), T = s)), a(X, this).length > 0)
484
- if (s !== null) {
485
- for (const l of a(X, this)) a(X, s).push(l);
486
- m(X, this, []);
487
- } else s = this;
488
- s !== null && (ae.clear(), g(C, s, Ct).call(s));
489
- }
490
- function en(t, e, r) {
491
- t.f ^= ne;
492
- for (var n = t.first; n !== null; ) {
493
- var i = n.f, s = (i & 96) !== 0;
494
- if (!(s && (i & 1024) !== 0 || (i & 8192) !== 0 || a(he, this).has(n)) && n.fn !== null) {
495
- s ? n.f ^= ne : (i & 4) !== 0 ? e.push(n) : Ie && (i & 16777224) !== 0 ? r.push(n) : at(n) && ((i & 16) !== 0 && a(fe, this).add(n), De(n));
496
- var l = n.first;
497
- if (l !== null) {
498
- n = l;
499
- continue;
500
- }
501
- }
502
- for (; n !== null; ) {
503
- var u = n.next;
504
- if (u !== null) {
505
- n = u;
506
- break;
507
- }
508
- n = n.parent;
509
- }
510
- }
511
- }
512
- function Ti() {
513
- for (var t = a(Te, this); t !== null; ) {
514
- if (!t.is_fork) {
515
- for (const [e, [, r]] of this.current) if (t.current.has(e) && !r) return t;
516
- }
517
- t = a(Te, t);
518
- }
519
- return null;
520
- }
521
- function $i(t) {
522
- for (const [r, n] of t.current)
523
- !this.previous.has(r) && t.previous.has(r) && this.previous.set(r, t.previous.get(r)), this.current.set(r, n);
524
- for (const [r, n] of t.async_deriveds) {
525
- const i = this.async_deriveds.get(r);
526
- i && n.promise.then(i.resolve).catch(i.reject);
527
- }
528
- t.async_deriveds.clear(), this.transfer_effects(a(Re, t), a(fe, t));
529
- const e = (r) => {
530
- var n = r.reactions;
531
- if (n !== null && !((r.f & 2) !== 0 && (r.f & 6144) === 0))
532
- for (const l of n) {
533
- var i = l.f;
534
- if ((i & 2) !== 0) e(l);
535
- else {
536
- var s = l;
537
- i & 4194320 && !this.async_deriveds.has(s) && (a(fe, this).delete(s), O(s, z), this.schedule(s));
538
- }
539
- }
540
- };
541
- for (const r of this.current.keys()) e(r);
542
- this.oncommit(() => t.discard()), g(C, t, kt).call(t), T = this, g(C, this, Ct).call(this);
543
- }
544
- function Xe(t) {
545
- for (var e = 0; e < t.length; e += 1) Yr(t[e], a(Re, this), a(fe, this));
546
- }
547
- function Ci() {
548
- for (let v = At; v !== null; v = a(Se, v)) {
549
- var t = v.id < this.id, e = [];
550
- for (const [f, [d, c]] of this.current) {
551
- if (v.current.has(f)) {
552
- var r = v.current.get(f)[0];
553
- if (t && d !== r) v.current.set(f, [d, c]);
554
- else continue;
555
- }
556
- e.push(f);
557
- }
558
- if (t) for (const [f, d] of this.async_deriveds) {
559
- const c = v.async_deriveds.get(f);
560
- c && d.promise.then(c.resolve).catch(c.reject);
561
- }
562
- var n = [...v.current.keys()].filter((f) => !v.current.get(f)[1]);
563
- if (!(!a(Tt, v) || n.length === 0)) {
564
- var i = n.filter((f) => !this.current.has(f));
565
- if (i.length === 0)
566
- t && v.discard();
567
- else if (e.length > 0) {
568
- if (t) for (const f of a(dt, this)) v.unskip_effect(f, (d) => {
569
- (d.f & 4194320) !== 0 ? v.schedule(d) : g(C, v, Xe).call(v, [d]);
570
- });
571
- v.activate();
572
- var s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
573
- for (var u of e) tn(u, i, s, l);
574
- l = /* @__PURE__ */ new Map();
575
- var h = [...v.current].filter(([f, d]) => {
576
- const c = this.current.get(f);
577
- return c ? c[0] !== d[0] || c[1] !== d[1] : !0;
578
- }).map(([f]) => f);
579
- if (h.length > 0)
580
- for (const f of a(Yt, this)) (f.f & 155648) === 0 && ir(f, h, l) && ((f.f & 4194320) !== 0 ? (O(f, z), v.schedule(f)) : a(Re, v).add(f));
581
- if (a(X, v).length > 0 && !a(ze, v)) {
582
- v.apply();
583
- for (var b of g(C, v, Zr).call(v)) g(C, v, en).call(v, b, [], []);
584
- }
585
- v.deactivate();
586
- }
587
- }
588
- }
589
- }
590
- function kt() {
591
- if (this.linked) {
592
- var t = a(Te, this), e = a(Se, this);
593
- t === null ? At = e : m(Se, t, e), e === null ? Pe = t : m(Te, e, t), this.linked = !1;
594
- }
595
- }
596
- function Fe(t) {
597
- var e = Qe;
598
- Qe = !0;
599
- try {
600
- var r;
601
- for (t && (T !== null && !T.is_fork && T.flush(), r = t()); ; ) {
602
- if (gi(), T === null) return r;
603
- T.flush();
604
- }
605
- } finally {
606
- Qe = e;
607
- }
608
- }
609
- function ki() {
610
- if (0) {
611
- var t;
612
- for (const r of T.current.keys()) for (const [n, i] of r.updated ?? [])
613
- var e;
614
- }
615
- try {
616
- fi();
617
- } catch (r) {
618
- de(r, qt);
619
- }
620
- }
621
- var ue = null;
622
- function br(t) {
623
- var e = t.length;
624
- if (e !== 0) {
625
- for (var r = 0; r < e; ) {
626
- var n = t[r++];
627
- if ((n.f & 24576) === 0 && at(n) && (ue = /* @__PURE__ */ new Set(), De(n), n.deps === null && n.first === null && n.nodes === null && n.teardown === null && n.ac === null && _n(n), ue?.size > 0)) {
628
- ae.clear();
629
- for (const i of ue) {
630
- if ((i.f & 24576) !== 0) continue;
631
- const s = [i];
632
- let l = i.parent;
633
- for (; l !== null; )
634
- ue.has(l) && (ue.delete(l), s.push(l)), l = l.parent;
635
- for (let u = s.length - 1; u >= 0; u--) {
636
- const h = s[u];
637
- (h.f & 24576) === 0 && De(h);
638
- }
639
- }
640
- ue.clear();
641
- }
642
- }
643
- ue = null;
644
- }
645
- }
646
- function tn(t, e, r, n) {
647
- if (!r.has(t) && (r.add(t), t.reactions !== null))
648
- for (const i of t.reactions) {
649
- const s = i.f;
650
- (s & 2) !== 0 ? tn(i, e, r, n) : (s & 4194320) !== 0 && (s & 2048) === 0 && ir(i, e, n) && (O(i, z), sr(i));
651
- }
652
- }
653
- function ir(t, e, r) {
654
- const n = r.get(t);
655
- if (n !== void 0) return n;
656
- if (t.deps !== null) for (const i of t.deps) {
657
- if (yt.call(e, i)) return !0;
658
- if ((i.f & 2) !== 0 && ir(i, e, r))
659
- return r.set(i, !0), !0;
660
- }
661
- return r.set(t, !1), !1;
662
- }
663
- function sr(t) {
664
- T.schedule(t);
665
- }
666
- function rn(t, e) {
667
- if (!((t.f & 32) !== 0 && (t.f & 1024) !== 0)) {
668
- (t.f & 2048) !== 0 ? e.d.push(t) : (t.f & 4096) !== 0 && e.m.push(t), O(t, ne);
669
- for (var r = t.first; r !== null; )
670
- rn(r, e), r = r.next;
671
- }
672
- }
673
- function nn(t) {
674
- O(t, ne);
675
- for (var e = t.first; e !== null; )
676
- nn(e), e = e.next;
677
- }
678
- var Rt = /* @__PURE__ */ new Set(), ae = /* @__PURE__ */ new Map();
679
- var sn = !1;
680
- function Nt(t, e) {
681
- var r = {
682
- f: 0,
683
- v: t,
684
- reactions: null,
685
- equals: Kr,
686
- rv: 0,
687
- wv: 0
688
- };
689
- return r;
690
- }
691
- // @__NO_SIDE_EFFECTS__
692
- function D(t, e) {
693
- const r = Nt(t, e);
694
- return mn(r), r;
695
- }
696
- // @__NO_SIDE_EFFECTS__
697
- function Ri(t, e = !1, r = !0) {
698
- const n = Nt(t);
699
- if (e || (n.equals = Wr), Mt && r && M !== null && M.l !== null) {
700
- var i;
701
- ((i = M.l).s ?? (i.s = [])).push(n);
702
- }
703
- return n;
704
- }
705
- function P(t, e, r = !1) {
706
- E !== null && (!U || (E.f & 131072) !== 0) && xt() && (E.f & 4325394) !== 0 && (ee === null || !ee.has(t)) && _i();
707
- let n = r ? We(e) : e;
708
- return an(t, n, Et);
709
- }
710
- var be = null, Vt = 0;
711
- function an(t, e, r = null) {
712
- if (!t.equals(e)) {
713
- ce ? ae.set(t, e) : ae.has(t) || ae.set(t, t.v);
714
- var n = je.ensure();
715
- if (n.capture(t, e), (t.f & 2) !== 0) {
716
- const i = t;
717
- (t.f & 2048) !== 0 && rr(i), F === null && tr(i);
718
- }
719
- t.wv = yn(), be = null, Vt = 0, ln(t, z, r), be = null, xt() && $ !== null && ($.f & 1024) !== 0 && ($.f & 96) === 0 && (V === null ? Yi([t]) : V.push(t)), !n.is_fork && Rt.size > 0 && !sn && Li();
720
- }
721
- return e;
722
- }
723
- function Li() {
724
- sn = !1;
725
- for (const t of Rt) {
726
- (t.f & 1024) !== 0 && O(t, Oe);
727
- let e;
728
- try {
729
- e = at(t);
730
- } catch {
731
- e = !0;
732
- }
733
- e && De(t);
734
- }
735
- Rt.clear();
736
- }
737
- function Je(t) {
738
- P(t, t.v + 1);
739
- }
740
- function ln(t, e, r) {
741
- var n = t.reactions;
742
- if (n !== null) {
743
- var i = xt(), s = n.length;
744
- if (Vt += s, Vt > 1e5 && be === null && (be = /* @__PURE__ */ new Set()), be !== null) {
745
- if (be.has(t)) return;
746
- be.add(t);
747
- }
748
- for (var l = 0; l < s; l++) {
749
- var u = n[l], h = u.f;
750
- if (!(!i && u === $)) {
751
- var b = (h & z) === 0;
752
- if (b && O(u, e), (h & 131072) !== 0) Rt.add(u);
753
- else if ((h & 2) !== 0) {
754
- var v = u;
755
- F?.delete(v), ln(v, Oe, r);
756
- } else if (b) {
757
- var f = u;
758
- (h & 16) !== 0 && ue !== null && ue.add(f), r !== null ? r.push(f) : sr(f);
759
- }
760
- }
761
- }
762
- }
763
- }
764
- var Oi = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
765
- function We(t) {
766
- if (typeof t != "object" || t === null || Ue in t || Pr in t) return t;
767
- const e = Dn(t);
768
- if (e !== Kn && e !== Wn) return t;
769
- var r = /* @__PURE__ */ new Map(), n = Bn(t), i = /* @__PURE__ */ D(0), s = null, l = $e, u = (f) => {
770
- if ($e === l) return f();
771
- var d = E, c = $e;
772
- le(null), Ar(l);
773
- var _ = f();
774
- return le(d), Ar(c), _;
775
- };
776
- n && r.set("length", /* @__PURE__ */ D(t.length, s));
777
- var h = "";
778
- let b = !1;
779
- function v(f) {
780
- if (!b) {
781
- b = !0, h = f, mr(i, `${h} version`);
782
- for (const [d, c] of r) mr(c, Ii(h, d));
783
- b = !1;
784
- }
785
- }
786
- return new Proxy(t, {
787
- defineProperty(f, d, c) {
788
- (!("value" in c) || c.configurable === !1 || c.enumerable === !1 || c.writable === !1) && di();
789
- var _ = r.get(d);
790
- return _ === void 0 ? u(() => {
791
- var p = /* @__PURE__ */ D(c.value, s);
792
- return r.set(d, p), p;
793
- }) : P(_, c.value, !0), !0;
794
- },
795
- deleteProperty(f, d) {
796
- var c = r.get(d);
797
- if (c === void 0) {
798
- if (d in f) {
799
- const _ = u(() => /* @__PURE__ */ D(N, s));
800
- r.set(d, _), Je(i);
801
- }
802
- } else
803
- P(c, N), Je(i);
804
- return !0;
805
- },
806
- get(f, d, c) {
807
- if (d === Ue) return t;
808
- var _ = r.get(d), p = d in f;
809
- if (_ === void 0 && (!p || Ee(f, d)?.writable) && (_ = u(() => {
810
- var L = We(p ? f[d] : N), x = /* @__PURE__ */ D(L, s);
811
- return x;
812
- }), r.set(d, _)), _ !== void 0) {
813
- var R = A(_);
814
- return R === N ? void 0 : R;
815
- }
816
- return Reflect.get(f, d, c);
817
- },
818
- getOwnPropertyDescriptor(f, d) {
819
- this.has?.(f, d);
820
- var c = Reflect.getOwnPropertyDescriptor(f, d), _ = r.get(d);
821
- if (_ !== void 0) {
822
- var p = A(_);
823
- if (p === N) return;
824
- if (c && "value" in c) c.value = p;
825
- else return {
826
- enumerable: !0,
827
- configurable: !0,
828
- value: p,
829
- writable: !0
830
- };
831
- }
832
- return c;
833
- },
834
- has(f, d) {
835
- if (d === Ue) return !0;
836
- var c = r.get(d), _ = c !== void 0 && c.v !== N || Reflect.has(f, d);
837
- return (c !== void 0 || $ !== null && (!_ || Ee(f, d)?.writable)) && (c === void 0 && (c = u(() => {
838
- var p = _ ? We(f[d]) : N, R = /* @__PURE__ */ D(p, s);
839
- return R;
840
- }), r.set(d, c)), A(c) === N) ? !1 : _;
841
- },
842
- set(f, d, c, _) {
843
- var p = r.get(d), R = d in f;
844
- if (n && d === "length") for (var L = c; L < p.v; L += 1) {
845
- var x = r.get(L + "");
846
- x !== void 0 ? P(x, N) : L in f && (x = u(() => /* @__PURE__ */ D(N, s)), r.set(L + "", x));
847
- }
848
- if (p === void 0)
849
- (!R || Ee(f, d)?.writable) && (p = u(() => /* @__PURE__ */ D(void 0, s)), P(p, We(c)), r.set(d, p));
850
- else {
851
- R = p.v !== N;
852
- var w = u(() => We(c));
853
- P(p, w);
854
- }
855
- var H = Reflect.getOwnPropertyDescriptor(f, d);
856
- if (H?.set && H.set.call(_, c), !R) {
857
- if (n && typeof d == "string") {
858
- var pe = r.get("length"), He = Number(d);
859
- Number.isInteger(He) && He >= pe.v && P(pe, He + 1);
860
- }
861
- Je(i);
862
- }
863
- return !0;
864
- },
865
- ownKeys(f) {
866
- A(i);
867
- var d = Reflect.ownKeys(f).filter((p) => {
868
- var R = r.get(p);
869
- return R === void 0 || R.v !== N;
870
- });
871
- for (var [c, _] of r) _.v !== N && !(c in f) && d.push(c);
872
- return d;
873
- },
874
- setPrototypeOf() {
875
- vi();
876
- }
877
- });
878
- }
879
- function Ii(t, e) {
880
- return typeof e == "symbol" ? `${t}[Symbol(${e.description ?? ""})]` : Oi.test(e) ? `${t}.${e}` : /^\d+$/.test(e) ? `${t}[${e}]` : `${t}['${e}']`;
881
- }
882
- var wr, Mi, on, un, fn;
883
- function zt() {
884
- if (wr === void 0) {
885
- wr = window, Mi = document, on = /Firefox/.test(navigator.userAgent);
886
- var t = Element.prototype, e = Node.prototype, r = Text.prototype;
887
- un = Ee(e, "firstChild").get, fn = Ee(e, "nextSibling").get, vr(t) && (t[Zn] = void 0, t[Jn] = null, t[ei] = void 0, t.__e = void 0), vr(r) && (r[ti] = void 0);
888
- }
889
- }
890
- function cn(t = "") {
891
- return document.createTextNode(t);
892
- }
893
- // @__NO_SIDE_EFFECTS__
894
- function Xt(t) {
895
- return un.call(t);
896
- }
897
- // @__NO_SIDE_EFFECTS__
898
- function qe(t) {
899
- return fn.call(t);
900
- }
901
- function xi(t) {
902
- t.textContent = "";
903
- }
904
- function hn(t, e, r) {
905
- return e == null || e === "http://www.w3.org/1999/xhtml" ? r ? document.createElement(t, { is: r }) : document.createElement(t) : r ? document.createElementNS(e, t, { is: r }) : document.createElementNS(e, t);
906
- }
907
- function Hi(t) {
908
- var e = $;
909
- if (e === null)
910
- return E.f |= Nr, t;
911
- if ((e.f & 32768) === 0 && (e.f & 4) === 0)
912
- throw t;
913
- de(t, e);
914
- }
915
- function de(t, e) {
916
- if (!(e !== null && (e.f & 16384) !== 0)) {
917
- for (; e !== null; ) {
918
- if ((e.f & 128) !== 0 && (e.f & 33570816) === 0) {
919
- if ((e.f & 32768) === 0) throw t;
920
- try {
921
- e.b.error(t);
922
- return;
923
- } catch (r) {
924
- t = r;
925
- }
926
- }
927
- e = e.parent;
928
- }
929
- throw t;
930
- }
931
- }
932
- function Ni(t) {
933
- $ === null && (E === null && ui(t), oi()), ce && li(t);
934
- }
935
- function Pi(t, e) {
936
- var r = e.last;
937
- r === null ? e.last = e.first = t : (r.next = t, t.prev = r, e.last = t);
938
- }
939
- function Me(t, e) {
940
- var r = $;
941
- r !== null && (r.f & 8192) !== 0 && (t |= Mr);
942
- var n = {
943
- ctx: M,
944
- deps: null,
945
- nodes: null,
946
- f: t | z | 512,
947
- first: null,
948
- fn: e,
949
- last: null,
950
- next: null,
951
- parent: r,
952
- b: r && r.b,
953
- prev: null,
954
- teardown: null,
955
- wv: 0,
956
- ac: null
957
- };
958
- T?.register_created_effect(n);
959
- var i = n;
960
- if ((t & 4) !== 0)
961
- rt !== null ? rt.push(n) : je.ensure().schedule(n);
962
- else if (e !== null) {
963
- try {
964
- De(n);
965
- } catch (l) {
966
- throw Z(n), l;
967
- }
968
- i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && (i.f & 524288) === 0 && (i = i.first, (t & 16) !== 0 && (t & 65536) !== 0 && i !== null && (i.f |= Hr));
969
- }
970
- if (i !== null && (i.parent = r, r !== null && Pi(i, r), E !== null && (E.f & 2) !== 0 && (t & 64) === 0)) {
971
- var s = E;
972
- (s.effects ?? (s.effects = [])).push(i);
973
- }
974
- return n;
975
- }
976
- function ar() {
977
- return E !== null && !U;
978
- }
979
- function Ne(t) {
980
- Ni("$effect");
981
- var e = $.f;
982
- if (!E && (e & 32) !== 0 && M !== null && !M.i) {
983
- var r = M;
984
- (r.e ?? (r.e = [])).push(t);
985
- } else return dn(t);
986
- }
987
- function dn(t) {
988
- return Me(4 | Un, t);
989
- }
990
- function Bi(t) {
991
- je.ensure();
992
- const e = Me(64 | st, t);
993
- return () => {
994
- Z(e);
995
- };
996
- }
997
- function Fi(t) {
998
- je.ensure();
999
- const e = Me(64 | st, t);
1000
- return (r = {}) => new Promise((n) => {
1001
- r.outro ? Pt(e, () => {
1002
- Z(e), n(void 0);
1003
- }) : (Z(e), n(void 0));
1004
- });
1005
- }
1006
- function Gi(t) {
1007
- return Me(4, t);
1008
- }
1009
- function lr(t, e = 0) {
1010
- return Me(8 | e, t);
1011
- }
1012
- function Ki(t, e = 0) {
1013
- var r = Me(16 | e, t);
1014
- return r;
1015
- }
1016
- function Le(t) {
1017
- return Me(32 | st, t);
1018
- }
1019
- function vn(t) {
1020
- var e = t.teardown;
1021
- if (e !== null) {
1022
- const r = ce, n = E;
1023
- Sr(!0), le(null);
1024
- try {
1025
- e.call(null);
1026
- } catch (i) {
1027
- de(i, t.parent);
1028
- } finally {
1029
- Sr(r), le(n);
1030
- }
1031
- }
1032
- }
1033
- function or(t, e = !1) {
1034
- var r = t.first;
1035
- for (t.first = t.last = null; r !== null; ) {
1036
- const i = r.ac;
1037
- i !== null && Ht(() => {
1038
- i.abort(It);
1039
- });
1040
- var n = r.next;
1041
- (r.f & 64) !== 0 ? r.parent = null : Z(r, e), r = n;
1042
- }
1043
- }
1044
- function Wi(t) {
1045
- for (var e = t.first; e !== null; ) {
1046
- var r = e.next;
1047
- (e.f & 32) === 0 && Z(e), e = r;
1048
- }
1049
- }
1050
- function Z(t, e = !0) {
1051
- var r = !1;
1052
- (e || (t.f & 262144) !== 0) && t.nodes !== null && t.nodes.end !== null && (Di(t.nodes.start, t.nodes.end), r = !0), t.f |= _r, or(t, e && !r), nt(t, 0);
1053
- var n = t.nodes && t.nodes.t;
1054
- if (n !== null) for (const s of n) s.stop();
1055
- vn(t), t.f ^= _r, t.f |= Xn;
1056
- var i = t.parent;
1057
- i !== null && i.first !== null && _n(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = t.b = null;
1058
- }
1059
- function Di(t, e) {
1060
- for (; t !== null; ) {
1061
- var r = t === e ? null : /* @__PURE__ */ qe(t);
1062
- t.remove(), t = r;
1063
- }
1064
- }
1065
- function _n(t) {
1066
- var e = t.parent, r = t.prev, n = t.next;
1067
- r !== null && (r.next = n), n !== null && (n.prev = r), e !== null && (e.first === t && (e.first = n), e.last === t && (e.last = r));
1068
- }
1069
- function Pt(t, e, r = !0) {
1070
- var n = [];
1071
- t.f |= 256, pn(t, n, !0);
1072
- var i = () => {
1073
- r && Z(t), e && e();
1074
- }, s = n.length;
1075
- if (s > 0) {
1076
- var l = () => --s || i();
1077
- for (var u of n) u.out(l);
1078
- } else i();
1079
- }
1080
- function pn(t, e, r) {
1081
- if ((t.f & 8192) === 0) {
1082
- t.f ^= Mr;
1083
- var n = t.nodes && t.nodes.t;
1084
- if (n !== null)
1085
- for (const u of n) (u.is_global || r) && e.push(u);
1086
- for (var i = t.first; i !== null; ) {
1087
- var s = i.next;
1088
- if ((i.f & 64) === 0) {
1089
- var l = (i.f & 65536) !== 0 || (i.f & 32) !== 0 && (t.f & 16) !== 0;
1090
- pn(i, e, l ? r : !1);
1091
- }
1092
- i = s;
1093
- }
1094
- }
1095
- }
1096
- function ji(t, e) {
1097
- if (t.nodes)
1098
- for (var r = t.nodes.start, n = t.nodes.end; r !== null; ) {
1099
- var i = r === n ? null : /* @__PURE__ */ qe(r);
1100
- e.append(r), r = i;
1101
- }
1102
- }
1103
- var qi = null, vt = !1, ce = !1;
1104
- function Sr(t) {
1105
- ce = t;
1106
- }
1107
- var E = null, U = !1;
1108
- function le(t) {
1109
- E = t;
1110
- }
1111
- var $ = null;
1112
- function _e(t) {
1113
- $ = t;
1114
- }
1115
- var ee = null;
1116
- function mn(t) {
1117
- E !== null && (!Ie && (E.f & 2097152) !== 0 || (E.f & 2) !== 0) && (ee ?? (ee = /* @__PURE__ */ new Set())).add(t);
1118
- }
1119
- var K = null, j = 0, V = null;
1120
- function Yi(t) {
1121
- V = t;
1122
- }
1123
- var gn = 1, Ae = 0, $e = Ae;
1124
- function Ar(t) {
1125
- $e = t;
1126
- }
1127
- function yn() {
1128
- return ++gn;
1129
- }
1130
- function at(t) {
1131
- var e = t.f;
1132
- if ((e & 2048) !== 0) return !0;
1133
- if ((e & 4096) !== 0) {
1134
- for (var r = t.deps, n = r.length, i = 0; i < n; i++) {
1135
- var s = r[i];
1136
- if (at(s) && Vr(s), s.wv > t.wv) return !0;
1137
- }
1138
- (e & 512) !== 0 && F === null && O(t, ne);
1139
- }
1140
- return !1;
1141
- }
1142
- function bn(t, e, r = !0) {
1143
- var n = t.reactions;
1144
- if (n !== null && !(!Ie && ee !== null && ee.has(t)))
1145
- for (var i = 0; i < n.length; i++) {
1146
- var s = n[i];
1147
- (s.f & 2) !== 0 ? bn(s, e, !1) : e === s && (r ? O(s, z) : (s.f & 1024) !== 0 && O(s, Oe), sr(s));
1148
- }
1149
- }
1150
- function wn(t) {
1151
- var e = K, r = j, n = V, i = E, s = ee, l = M, u = U, h = $e, b = t.f;
1152
- K = null, j = 0, V = null, E = (b & 96) === 0 ? t : null, ee = null, wt(t.ctx), U = !1, $e = ++Ae, t.ac !== null && (Ht(() => {
1153
- t.ac.abort(It);
1154
- }), t.ac = null);
1155
- try {
1156
- t.f |= pr;
1157
- var v = t.fn, f = v();
1158
- t.f |= xr;
1159
- var d = Er(t);
1160
- if (xt() && V !== null && !U && d !== null && (t.f & 6146) === 0) for (var c = 0; c < V.length; c++) bn(V[c], t);
1161
- if (i !== null && i !== t) {
1162
- if (Ae++, i.deps !== null) for (let _ = 0; _ < r; _ += 1) i.deps[_].rv = Ae;
1163
- if (e !== null) for (const _ of e) _.rv = Ae;
1164
- V !== null && (n === null ? n = V : n.push(...V));
1165
- }
1166
- return (t.f & 8388608) !== 0 && (t.f ^= Nr), f;
1167
- } catch (_) {
1168
- return Er(t), Hi(_);
1169
- } finally {
1170
- t.f ^= pr, K = e, j = r, V = n, E = i, ee = s, wt(l), U = u, $e = h;
1171
- }
1172
- }
1173
- function Er(t) {
1174
- var e = t.deps, r = T?.is_fork;
1175
- if (K !== null) {
1176
- var n;
1177
- if (r || nt(t, j), e !== null && j > 0)
1178
- for (e.length = j + K.length, n = 0; n < K.length; n++) e[j + n] = K[n];
1179
- else t.deps = e = K;
1180
- if (ar() && (t.f & 512) !== 0) for (n = j; n < e.length; n++) {
1181
- var i;
1182
- ((i = e[n]).reactions ?? (i.reactions = [])).push(t);
1183
- }
1184
- } else !r && e !== null && j < e.length && (nt(t, j), e.length = j);
1185
- return e;
1186
- }
1187
- function Vi(t, e) {
1188
- let r = e.reactions;
1189
- if (r !== null) {
1190
- var n = Fn.call(r, t);
1191
- if (n !== -1) {
1192
- var i = r.length - 1;
1193
- i === 0 ? r = e.reactions = null : (r[n] = r[i], r.pop());
1194
- }
1195
- }
1196
- if (r === null && (e.f & 2) !== 0 && (K === null || !yt.call(K, e))) {
1197
- var s = e;
1198
- (s.f & 512) !== 0 && (s.f ^= 512), s.v !== N && tr(s), s.ac !== null && Ht(() => {
1199
- s.ac.abort(It), s.ac = null, O(s, z);
1200
- }), Ai(s), nt(s, 0);
1201
- }
1202
- }
1203
- function nt(t, e) {
1204
- var r = t.deps;
1205
- if (r !== null)
1206
- for (var n = e; n < r.length; n++) Vi(t, r[n]);
1207
- }
1208
- function De(t) {
1209
- var e = t.f;
1210
- if ((e & 16384) === 0) {
1211
- O(t, ne);
1212
- var r = $, n = vt;
1213
- if ($ = t, vt = (e & 96) === 0, 0)
1214
- var i, s;
1215
- try {
1216
- (e & 16777232) !== 0 ? Wi(t) : or(t), vn(t);
1217
- var l = wn(t);
1218
- if (t.teardown = typeof l == "function" ? l : null, t.wv = gn, 0)
1219
- for (var u of t.deps) ;
1220
- } finally {
1221
- vt = n, $ = r;
1222
- }
1223
- }
1224
- }
1225
- function A(t) {
1226
- var e = (t.f & 2) !== 0;
1227
- if (qi?.add(t), E !== null && !U && !($ !== null && ($.f & 16384) !== 0) && (ee === null || !ee.has(t))) {
1228
- var r = E.deps;
1229
- if ((E.f & 2097152) !== 0)
1230
- t.rv < Ae && (t.rv = Ae, K === null && r !== null && r[j] === t ? j++ : K === null ? K = [t] : K.push(t));
1231
- else {
1232
- var n;
1233
- (n = E).deps ?? (n.deps = []), yt.call(E.deps, t) || E.deps.push(t);
1234
- var i = t.reactions;
1235
- i === null ? t.reactions = [E] : yt.call(i, E) || i.push(E);
1236
- }
1237
- }
1238
- if (0) {
1239
- if (!U && reactivity_loss_tracker && T === null && jt === null && !reactivity_loss_tracker.warned && (reactivity_loss_tracker.effect.f & 2097152) === 0 && !reactivity_loss_tracker.effect_deps.has(t))
1240
- var s;
1241
- if (tracing_mode_flag && !U && tracing_expressions !== null && E !== null && tracing_expressions.reaction === E && !t.trace) {
1242
- if (s)
1243
- var l, u;
1244
- }
1245
- }
1246
- if (ce && ae.has(t)) return ae.get(t);
1247
- if (e) {
1248
- var h = t;
1249
- if (ce) {
1250
- var b = h.v;
1251
- return ((h.f & 1024) === 0 && h.reactions !== null || An(h)) && (b = rr(h)), ae.set(h, b), b;
1252
- }
1253
- var v = (h.f & 512) === 0 && !U && E !== null && (vt || (E.f & 512) !== 0), f = (h.f & xr) === 0;
1254
- at(h) && (v && (h.f |= 512), Vr(h)), v && !f && (zr(h), Sn(h));
1255
- }
1256
- if (F?.has(t)) return F.get(t);
1257
- if ((t.f & 8388608) !== 0) throw t.v;
1258
- return t.v;
1259
- }
1260
- function Sn(t) {
1261
- if (t.f |= 512, t.deps !== null)
1262
- for (const e of t.deps)
1263
- (e.reactions ?? (e.reactions = [])).push(t), (e.f & 2) !== 0 && (e.f & 512) === 0 && (zr(e), Sn(e));
1264
- }
1265
- function An(t) {
1266
- if (t.v === N) return !0;
1267
- if (t.deps === null) return !1;
1268
- for (const e of t.deps)
1269
- if (ae.has(e) || (e.f & 2) !== 0 && An(e)) return !0;
1270
- return !1;
1271
- }
1272
- function Bt(t) {
1273
- var e = U;
1274
- try {
1275
- return U = !0, t();
1276
- } finally {
1277
- U = e;
1278
- }
1279
- }
1280
- var ut = /* @__PURE__ */ Symbol("events"), zi = /* @__PURE__ */ new Set(), Tr = /* @__PURE__ */ new Set(), Gt = null, Kt = !1;
1281
- function $r(t) {
1282
- var e = this, r = e.ownerDocument, n = t.type, i = t.composedPath?.() || [], s = i[0] || t.target;
1283
- Gt = t, Kt || (Kt = !0, setTimeout(() => {
1284
- Kt = !1, Gt = null;
1285
- }));
1286
- var l = 0, u = Gt === t && t[ut];
1287
- if (u) {
1288
- var h = i.indexOf(u);
1289
- if (h !== -1 && (e === document || e === window)) {
1290
- t[ut] = e;
1291
- return;
1292
- }
1293
- var b = i.indexOf(e);
1294
- if (b === -1) return;
1295
- h <= b && (l = h);
1296
- }
1297
- if (s = i[l] || t.target, s !== e) {
1298
- Ze(t, "currentTarget", {
1299
- configurable: !0,
1300
- get() {
1301
- return s || r;
1302
- }
1303
- });
1304
- var v = E, f = $;
1305
- le(null), _e(null);
1306
- try {
1307
- for (var d, c = []; s !== null && s !== e; ) {
1308
- try {
1309
- var _ = s[ut]?.[n];
1310
- _ != null && (!s.disabled || t.target === s) && _.call(s, t);
1311
- } catch (p) {
1312
- d ? c.push(p) : d = p;
1313
- }
1314
- if (t.cancelBubble) break;
1315
- l++, s = l < i.length ? i[l] : null;
1316
- }
1317
- if (d) {
1318
- for (let p of c) queueMicrotask(() => {
1319
- throw p;
1320
- });
1321
- throw d;
1322
- }
1323
- } finally {
1324
- t[ut] = e, delete t.currentTarget, le(v), _e(f);
1325
- }
1326
- }
1327
- }
1328
- var Xi = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (t) => t });
1329
- function Ui(t) {
1330
- return Xi?.createHTML(t) ?? t;
1331
- }
1332
- function Qi(t) {
1333
- var e = hn("template");
1334
- return e.innerHTML = Ui(t.replaceAll("<!>", "<!---->")), e.content;
1335
- }
1336
- function _t(t, e) {
1337
- var r = $;
1338
- r.nodes === null && (r.nodes = {
1339
- start: t,
1340
- end: e,
1341
- a: null,
1342
- t: null
1343
- });
1344
- }
1345
- // @__NO_SIDE_EFFECTS__
1346
- function Ji(t, e) {
1347
- var r = (e & 1) !== 0, n = (e & 2) !== 0, i, s = !t.startsWith("<!>");
1348
- return () => {
1349
- if (J)
1350
- return _t(G, null), G;
1351
- i === void 0 && (i = Qi(s ? t : "<!>" + t), r || (i = /* @__PURE__ */ Xt(i)));
1352
- var l = n || on ? document.importNode(i, !0) : i.cloneNode(!0);
1353
- if (r) {
1354
- var u = /* @__PURE__ */ Xt(l), h = l.lastChild;
1355
- _t(u, h);
1356
- } else _t(l, l);
1357
- return l;
1358
- };
1359
- }
1360
- function En(t, e) {
1361
- if (J) {
1362
- var r = $;
1363
- ((r.f & 32768) === 0 || r.nodes.end === null) && (r.nodes.end = G), Gr();
1364
- return;
1365
- }
1366
- t !== null && t.before(e);
1367
- }
1368
- var Zi = [
1369
- "allowfullscreen",
1370
- "async",
1371
- "autofocus",
1372
- "autoplay",
1373
- "checked",
1374
- "controls",
1375
- "default",
1376
- "disabled",
1377
- "formnovalidate",
1378
- "indeterminate",
1379
- "inert",
1380
- "ismap",
1381
- "loop",
1382
- "multiple",
1383
- "muted",
1384
- "nomodule",
1385
- "novalidate",
1386
- "open",
1387
- "playsinline",
1388
- "readonly",
1389
- "required",
1390
- "reversed",
1391
- "seamless",
1392
- "selected",
1393
- "webkitdirectory",
1394
- "defer",
1395
- "disablepictureinpicture",
1396
- "disableremoteplayback"
1397
- ], Ns = [
1398
- ...Zi,
1399
- "formNoValidate",
1400
- "isMap",
1401
- "noModule",
1402
- "playsInline",
1403
- "readOnly",
1404
- "value",
1405
- "volume",
1406
- "defaultValue",
1407
- "defaultChecked",
1408
- "srcObject",
1409
- "noValidate",
1410
- "allowFullscreen",
1411
- "disablePictureInPicture",
1412
- "disableRemotePlayback"
1413
- ], es = ["touchstart", "touchmove"];
1414
- function ts(t) {
1415
- return es.includes(t);
1416
- }
1417
- var rs = [
1418
- "$state",
1419
- "$state.raw",
1420
- "$derived",
1421
- "$derived.by"
1422
- ], Ps = [
1423
- ...rs,
1424
- "$state.eager",
1425
- "$state.snapshot",
1426
- "$props",
1427
- "$props.id",
1428
- "$bindable",
1429
- "$effect",
1430
- "$effect.pre",
1431
- "$effect.tracking",
1432
- "$effect.root",
1433
- "$effect.pending",
1434
- "$inspect",
1435
- "$inspect().with",
1436
- "$inspect.trace",
1437
- "$host"
1438
- ];
1439
- function ns(t) {
1440
- let e = 0, r = Nt(0), n;
1441
- return () => {
1442
- ar() && (A(r), lr(() => (e === 0 && (n = Bt(() => t(() => Je(r)))), e += 1, () => {
1443
- ke(() => {
1444
- e -= 1, e === 0 && (n?.(), n = void 0, Je(r));
1445
- });
1446
- })));
1447
- };
1448
- }
1449
- var is = Hr | st;
1450
- function ss(t, e, r, n) {
1451
- new as(t, e, r, n);
1452
- }
1453
- var te = /* @__PURE__ */ new WeakMap(), Ut = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Ce = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Qt = /* @__PURE__ */ new WeakMap(), Jt = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakMap(), Cr = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakSet(), as = class {
1454
- constructor(t, e, r, n) {
1455
- nr(this, I), o(this, "parent", void 0), o(this, "is_pending", !1), o(this, "transform_error", void 0), S(this, te, void 0), S(this, Ut, J ? G : null), S(this, se, void 0), S(this, it, void 0), S(this, q, void 0), S(this, re, null), S(this, Y, null), S(this, Q, null), S(this, ve, null), S(this, Ge, 0), S(this, Ce, 0), S(this, ft, !1), S(this, Qt, /* @__PURE__ */ new Set()), S(this, Jt, /* @__PURE__ */ new Set()), S(this, me, null), S(this, Cr, ns(() => (m(me, this, Nt(a(Ge, this))), () => {
1456
- m(me, this, null);
1457
- }))), m(te, this, t), m(se, this, e), m(it, this, (i) => {
1458
- var s = $;
1459
- s.b = this, s.f |= 128, r(i);
1460
- }), this.parent = $.b, this.transform_error = n ?? this.parent?.transform_error ?? ((i) => i), m(q, this, Ki(() => {
1461
- if (J) {
1462
- const i = a(Ut, this);
1463
- Gr();
1464
- const s = i.data === "[!";
1465
- if (i.data.startsWith("[?")) {
1466
- const l = JSON.parse(i.data.slice(2));
1467
- g(I, this, os).call(this, l);
1468
- } else s ? g(I, this, us).call(this) : g(I, this, ls).call(this);
1469
- } else g(I, this, $n).call(this);
1470
- }, is)), J && m(te, this, G);
1471
- }
1472
- defer_effect(t) {
1473
- Yr(t, a(Qt, this), a(Jt, this));
1474
- }
1475
- is_rendered() {
1476
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1477
- }
1478
- has_pending_snippet() {
1479
- return !!a(se, this).pending;
1480
- }
1481
- update_pending_count(t, e) {
1482
- g(I, this, Cn).call(this, t, e), m(Ge, this, a(Ge, this) + t), !(!a(me, this) || a(ft, this)) && (m(ft, this, !0), ke(() => {
1483
- m(ft, this, !1), a(me, this) && an(a(me, this), a(Ge, this));
1484
- }));
1485
- }
1486
- get_effect_pending() {
1487
- return a(Cr, this).call(this), A(a(me, this));
1488
- }
1489
- error(t) {
1490
- if (!a(se, this).onerror && !a(se, this).failed) throw t;
1491
- T?.is_fork ? (a(re, this) && T.skip_effect(a(re, this)), a(Y, this) && T.skip_effect(a(Y, this)), a(Q, this) && T.skip_effect(a(Q, this)), T.oncommit(() => {
1492
- g(I, this, kr).call(this, t);
1493
- })) : g(I, this, kr).call(this, t);
1494
- }
1495
- };
1496
- function ls() {
1497
- try {
1498
- m(re, this, Le(() => a(it, this).call(this, a(te, this))));
1499
- } catch (t) {
1500
- this.error(t);
1501
- }
1502
- }
1503
- function os(t) {
1504
- const e = a(se, this).failed, { reset: r, invoke_onerror: n } = g(I, this, Tn).call(this, t);
1505
- ke(n), e && m(Q, this, Le(() => {
1506
- e(a(te, this), () => t, () => r);
1507
- }));
1508
- }
1509
- function Tn(t) {
1510
- var e = !1, r = !1;
1511
- const n = () => {
1512
- if (e) {
1513
- ni();
1514
- return;
1515
- }
1516
- e = !0, r && pi(), a(Q, this) !== null && Pt(a(Q, this), () => {
1517
- m(Q, this, null);
1518
- }), g(I, this, ur).call(this, () => {
1519
- g(I, this, $n).call(this);
1520
- });
1521
- };
1522
- return {
1523
- reset: n,
1524
- invoke_onerror: () => {
1525
- try {
1526
- r = !0, a(se, this).onerror?.(t, n), r = !1;
1527
- } catch (s) {
1528
- de(s, a(q, this) && a(q, this).parent);
1529
- }
1530
- }
1531
- };
1532
- }
1533
- function us() {
1534
- const t = a(se, this).pending;
1535
- t && (this.is_pending = !0, m(Y, this, Le(() => t(a(te, this)))), ke(() => {
1536
- var e = m(ve, this, document.createDocumentFragment()), r = cn(), n = !1;
1537
- if (e.append(r), m(re, this, g(I, this, ur).call(this, () => {
1538
- try {
1539
- return Le(() => a(it, this).call(this, r));
1540
- } catch (i) {
1541
- try {
1542
- this.error(i), n = !0;
1543
- } catch (s) {
1544
- de(s, a(q, this).parent);
1545
- }
1546
- return null;
1547
- }
1548
- })), a(re, this) === null) {
1549
- m(ve, this, null), n && g(I, this, Lt).call(this, T);
1550
- return;
1551
- }
1552
- a(Ce, this) === 0 && (a(te, this).before(e), m(ve, this, null), Pt(a(Y, this), () => {
1553
- m(Y, this, null);
1554
- }), g(I, this, Lt).call(this, T));
1555
- }));
1556
- }
1557
- function $n() {
1558
- try {
1559
- if (this.is_pending = this.has_pending_snippet(), m(Ce, this, 0), m(Ge, this, 0), m(re, this, Le(() => {
1560
- a(it, this).call(this, a(te, this));
1561
- })), a(Ce, this) > 0) {
1562
- var t = m(ve, this, document.createDocumentFragment());
1563
- ji(a(re, this), t);
1564
- const e = a(se, this).pending;
1565
- m(Y, this, Le(() => e(a(te, this))));
1566
- } else g(I, this, Lt).call(this, T);
1567
- } catch (e) {
1568
- this.error(e);
1569
- }
1570
- }
1571
- function Lt(t) {
1572
- this.is_pending = !1, t.transfer_effects(a(Qt, this), a(Jt, this));
1573
- }
1574
- function ur(t) {
1575
- var e = $, r = E, n = M;
1576
- _e(a(q, this)), le(a(q, this)), wt(a(q, this).ctx);
1577
- try {
1578
- return je.ensure(), t();
1579
- } finally {
1580
- _e(e), le(r), wt(n);
1581
- }
1582
- }
1583
- function Cn(t, e) {
1584
- if (!this.has_pending_snippet()) {
1585
- if (this.parent) {
1586
- var r;
1587
- g(I, r = this.parent, Cn).call(r, t, e);
1588
- }
1589
- return;
1590
- }
1591
- m(Ce, this, a(Ce, this) + t), a(Ce, this) === 0 && (g(I, this, Lt).call(this, e), a(Y, this) && Pt(a(Y, this), () => {
1592
- m(Y, this, null);
1593
- }), a(ve, this) && (a(te, this).before(a(ve, this)), m(ve, this, null)));
1594
- }
1595
- function kr(t) {
1596
- a(re, this) && (Z(a(re, this)), m(re, this, null)), a(Y, this) && (Z(a(Y, this)), m(Y, this, null)), a(Q, this) && (Z(a(Q, this)), m(Q, this, null)), J && (tt(a(Ut, this)), ii(), tt(si()));
1597
- let e = a(se, this).failed;
1598
- const r = (n) => {
1599
- const { reset: i, invoke_onerror: s } = g(I, this, Tn).call(this, n);
1600
- s(), e && m(Q, this, g(I, this, ur).call(this, () => {
1601
- try {
1602
- return Le(() => {
1603
- var l = $;
1604
- l.b = this, l.f |= 128, e(a(te, this), () => n, () => i);
1605
- });
1606
- } catch (l) {
1607
- return de(l, a(q, this).parent), null;
1608
- }
1609
- }));
1610
- };
1611
- ke(() => {
1612
- var n;
1613
- try {
1614
- n = this.transform_error(t);
1615
- } catch (i) {
1616
- de(i, a(q, this) && a(q, this).parent);
1617
- return;
1618
- }
1619
- n !== null && typeof n == "object" && typeof n.then == "function" ? n.then(r, (i) => de(i, a(q, this) && a(q, this).parent)) : r(n);
1620
- });
1621
- }
1622
- var Rr = !0;
1623
- function kn(t, e) {
1624
- return Rn(t, e);
1625
- }
1626
- function fs(t, e) {
1627
- zt(), e.intro = e.intro ?? !1;
1628
- const r = e.target, n = J, i = G;
1629
- try {
1630
- for (var s = /* @__PURE__ */ Xt(r); s && (s.nodeType !== 8 || s.data !== "["); ) s = /* @__PURE__ */ qe(s);
1631
- if (!s) throw gt;
1632
- lt(!0), tt(s);
1633
- const l = Rn(t, {
1634
- ...e,
1635
- anchor: s
1636
- });
1637
- return lt(!1), l;
1638
- } catch (l) {
1639
- if (l instanceof Error && l.message.split(`
1640
- `).some((u) => u.startsWith("https://svelte.dev/e/"))) throw l;
1641
- return l !== gt && console.warn("Failed to hydrate: ", l), e.recover === !1 && ci(), zt(), xi(r), lt(!1), kn(t, e);
1642
- } finally {
1643
- lt(n), tt(i);
1644
- }
1645
- }
1646
- var ct = /* @__PURE__ */ new Map();
1647
- function Rn(t, { target: e, anchor: r, props: n = {}, events: i, context: s, intro: l = !0, transformError: u }) {
1648
- zt();
1649
- var h = void 0, b = Fi(() => {
1650
- var v = r ?? e.appendChild(cn());
1651
- ss(v, { pending: () => {
1652
- } }, (c) => {
1653
- Dr({});
1654
- var _ = M;
1655
- if (s && (_.c = s), i && (n.$$events = i), J && _t(c, null), Rr = l, h = t(c, n) || er(), Rr = !0, J && ($.nodes.end = G, G === null || G.nodeType !== 8 || G.data !== "]"))
1656
- throw Fr(), gt;
1657
- jr();
1658
- }, u);
1659
- var f = /* @__PURE__ */ new Set(), d = (c) => {
1660
- for (var _ = 0; _ < c.length; _++) {
1661
- var p = c[_];
1662
- if (!f.has(p)) {
1663
- f.add(p);
1664
- var R = ts(p);
1665
- for (const w of [e, document]) {
1666
- var L = ct.get(w);
1667
- L === void 0 && (L = /* @__PURE__ */ new Map(), ct.set(w, L));
1668
- var x = L.get(p);
1669
- x === void 0 ? (w.addEventListener(p, $r, { passive: R }), L.set(p, 1)) : L.set(p, x + 1);
1670
- }
1671
- }
1672
- }
1673
- };
1674
- return d(Gn(zi)), Tr.add(d), () => {
1675
- for (var c of f) for (const R of [e, document]) {
1676
- var _ = ct.get(R), p = _.get(c);
1677
- --p == 0 ? (R.removeEventListener(c, $r), _.delete(c), _.size === 0 && ct.delete(R)) : _.set(c, p);
1678
- }
1679
- Tr.delete(d), v !== r && v.parentNode?.removeChild(v);
1680
- };
1681
- });
1682
- return Zt.set(h, b), h;
1683
- }
1684
- var Zt = /* @__PURE__ */ new WeakMap();
1685
- function cs(t, e) {
1686
- const r = Zt.get(t);
1687
- return r ? (Zt.delete(t), r(e)) : Promise.resolve();
1688
- }
1689
- var Ln, Ke = /* @__PURE__ */ new WeakMap(), Ot = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), Lr = /* @__PURE__ */ new WeakSet(), On = class {
1690
- constructor(t) {
1691
- nr(this, Lr), S(this, Ke, /* @__PURE__ */ new WeakMap()), S(this, Ot, void 0), S(this, Wt, void 0), m(Wt, this, t);
1692
- }
1693
- observe(t, e) {
1694
- var r = a(Ke, this).get(t) || /* @__PURE__ */ new Set();
1695
- return r.add(e), a(Ke, this).set(t, r), g(Lr, this, hs).call(this).observe(t, a(Wt, this)), () => {
1696
- var n = a(Ke, this).get(t);
1697
- n.delete(e), n.size === 0 && (a(Ke, this).delete(t), a(Ot, this).unobserve(t));
1698
- };
1699
- }
1700
- };
1701
- Ln = On;
1702
- function hs() {
1703
- return a(Ot, this) ?? m(Ot, this, new ResizeObserver((t) => {
1704
- for (var e of t) {
1705
- Ln.entries.set(e.target, e);
1706
- for (var r of a(Ke, this).get(e.target) || []) r(e);
1707
- }
1708
- }));
1709
- }
1710
- o(On, "entries", /* @__PURE__ */ new WeakMap());
1711
- function Dt(t, e) {
1712
- return t === e || t?.[Ue] === e;
1713
- }
1714
- function ds(t = er(), e, r, n) {
1715
- var i = M.r, s = $;
1716
- return Gi(() => {
1717
- var l, u;
1718
- return lr(() => {
1719
- l = u, u = n?.() || [], Bt(() => {
1720
- Dt(r(...u), t) || (e(t, ...u), l && Dt(r(...l), t) && e(null, ...l));
1721
- });
1722
- }), () => {
1723
- let h = s;
1724
- for (; h !== i && h.parent !== null && h.parent.f & 33554432; ) h = h.parent;
1725
- const b = () => {
1726
- u && Dt(r(...u), t) && e(null, ...u);
1727
- }, v = h.teardown;
1728
- h.teardown = () => {
1729
- b(), v?.();
1730
- };
1731
- };
1732
- }), t;
1733
- }
1734
- var ht = !1;
1735
- function vs(t) {
1736
- var e = ht;
1737
- try {
1738
- return ht = !1, [t(), ht];
1739
- } finally {
1740
- ht = e;
1741
- }
1742
- }
1743
- function Ye(t, e, r, n) {
1744
- var i = !Mt || (r & 2) !== 0, s = (r & 8) !== 0, l = (r & 16) !== 0, u = n, h = !0, b = void 0, v = () => l && i ? (b ?? (b = /* @__PURE__ */ St(n)), A(b)) : (h && (h = !1, u = l ? Bt(n) : n), u);
1745
- let f;
1746
- if (s) {
1747
- var d = Ue in t || Br in t;
1748
- f = Ee(t, e)?.set ?? (d && e in t ? (H) => t[e] = H : void 0);
1749
- }
1750
- var c, _ = !1;
1751
- s ? [c, _] = vs(() => t[e]) : c = t[e], c === void 0 && n !== void 0 && (c = v(), f && (i && hi(e), f(c)));
1752
- var p;
1753
- if (i ? p = () => {
1754
- var H = t[e];
1755
- return H === void 0 ? v() : (h = !0, H);
1756
- } : p = () => {
1757
- var H = t[e];
1758
- return H !== void 0 && (u = void 0), H === void 0 ? u : H;
1759
- }, i && (r & 4) === 0) return p;
1760
- if (f) {
1761
- var R = t.$$legacy;
1762
- return (function(H, pe) {
1763
- return arguments.length > 0 ? ((!i || !pe || R || _) && f(pe ? p() : H), H) : p();
1764
- });
1765
- }
1766
- var L = !1, x = ((r & 1) !== 0 ? St : wi)(() => (L = !1, p()));
1767
- s && A(x);
1768
- var w = $;
1769
- return (function(H, pe) {
1770
- if (arguments.length > 0) {
1771
- const He = pe ? A(x) : i && s ? We(H) : H;
1772
- return P(x, He), L = !0, u !== void 0 && (u = He), H;
1773
- }
1774
- return ce && L || (w.f & 16384) !== 0 ? x.v : A(x);
1775
- });
1776
- }
1777
- function _s(t) {
1778
- return new ps(t);
1779
- }
1780
- var ge = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), ps = class {
1781
- constructor(t) {
1782
- S(this, ge, void 0), S(this, ie, void 0);
1783
- var e = /* @__PURE__ */ new Map(), r = (i, s) => {
1784
- var l = /* @__PURE__ */ Ri(s, !1, !1);
1785
- return e.set(i, l), l;
1786
- };
1787
- const n = new Proxy({
1788
- ...t.props || {},
1789
- $$events: {}
1790
- }, {
1791
- get(i, s) {
1792
- return A(e.get(s) ?? r(s, Reflect.get(i, s)));
1793
- },
1794
- has(i, s) {
1795
- return s === Br ? !0 : (A(e.get(s) ?? r(s, Reflect.get(i, s))), Reflect.has(i, s));
1796
- },
1797
- set(i, s, l) {
1798
- return P(e.get(s) ?? r(s, l), l), Reflect.set(i, s, l);
1799
- }
1800
- });
1801
- m(ie, this, (t.hydrate ? fs : kn)(t.component, {
1802
- target: t.target,
1803
- anchor: t.anchor,
1804
- props: n,
1805
- context: t.context,
1806
- intro: t.intro ?? !1,
1807
- recover: t.recover,
1808
- transformError: t.transformError
1809
- })), !Ie && (!t?.props?.$$host || t.sync === !1) && Fe(), m(ge, this, n.$$events);
1810
- for (const i of Object.keys(a(ie, this)))
1811
- i === "$set" || i === "$destroy" || i === "$on" || Ze(this, i, {
1812
- get() {
1813
- return a(ie, this)[i];
1814
- },
1815
- set(s) {
1816
- a(ie, this)[i] = s;
1817
- },
1818
- enumerable: !0
1819
- });
1820
- a(ie, this).$set = (i) => {
1821
- Object.assign(n, i);
1822
- }, a(ie, this).$destroy = () => {
1823
- cs(a(ie, this));
1824
- };
1825
- }
1826
- $set(t) {
1827
- a(ie, this).$set(t);
1828
- }
1829
- $on(t, e) {
1830
- a(ge, this)[t] = a(ge, this)[t] || [];
1831
- const r = (...n) => e.call(this, ...n);
1832
- return a(ge, this)[t].push(r), () => {
1833
- a(ge, this)[t] = a(ge, this)[t].filter((n) => n !== r);
1834
- };
1835
- }
1836
- $destroy() {
1837
- a(ie, this).$destroy();
1838
- }
1839
- }, In;
1840
- typeof HTMLElement == "function" && (In = class extends HTMLElement {
1841
- constructor(t, e, r) {
1842
- super(), o(this, "$$ctor", void 0), o(this, "$$s", void 0), o(this, "$$c", void 0), o(this, "$$cn", !1), o(this, "$$d", {}), o(this, "$$r", !1), o(this, "$$p_d", {}), o(this, "$$l", {}), o(this, "$$l_u", /* @__PURE__ */ new Map()), o(this, "$$me", void 0), o(this, "$$shadowRoot", null), this.$$ctor = t, this.$$s = e, r && (this.$$shadowRoot = this.attachShadow(r));
1843
- }
1844
- addEventListener(t, e, r) {
1845
- if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(e), this.$$c) {
1846
- const n = this.$$c.$on(t, e);
1847
- this.$$l_u.set(e, n);
1848
- }
1849
- super.addEventListener(t, e, r);
1850
- }
1851
- removeEventListener(t, e, r) {
1852
- if (super.removeEventListener(t, e, r), this.$$c) {
1853
- const n = this.$$l_u.get(e);
1854
- n && (n(), this.$$l_u.delete(e));
1855
- }
1856
- }
1857
- async connectedCallback() {
1858
- if (this.$$cn = !0, !this.$$c) {
1859
- let t = function(n) {
1860
- return (i) => {
1861
- const s = hn("slot");
1862
- n !== "default" && (s.name = n), En(i, s);
1863
- };
1864
- };
1865
- if (await Promise.resolve(), !this.$$cn || this.$$c) return;
1866
- const e = {}, r = ms(this);
1867
- for (const n of this.$$s) n in r && (n === "default" && !this.$$d.children ? (this.$$d.children = t(n), e.default = !0) : e[n] = t(n));
1868
- for (const n of this.attributes) {
1869
- const i = this.$$g_p(n.name);
1870
- i in this.$$d || (this.$$d[i] = pt(i, n.value, this.$$p_d, "toProp"));
1871
- }
1872
- for (const n in this.$$p_d) !(n in this.$$d) && this[n] !== void 0 && (this.$$d[n] = this[n], delete this[n]);
1873
- this.$$c = _s({
1874
- component: this.$$ctor,
1875
- target: this.$$shadowRoot || this,
1876
- props: {
1877
- ...this.$$d,
1878
- $$slots: e,
1879
- $$host: this
1880
- }
1881
- }), this.$$me = Bi(() => {
1882
- lr(() => {
1883
- this.$$r = !0;
1884
- for (const n of bt(this.$$c)) {
1885
- if (!this.$$p_d[n]?.reflect) continue;
1886
- this.$$d[n] = this.$$c[n];
1887
- const i = pt(n, this.$$d[n], this.$$p_d, "toAttribute");
1888
- i == null ? this.removeAttribute(this.$$p_d[n].attribute || n) : this.setAttribute(this.$$p_d[n].attribute || n, i);
1889
- }
1890
- this.$$r = !1;
1891
- });
1892
- });
1893
- for (const n in this.$$l) for (const i of this.$$l[n]) {
1894
- const s = this.$$c.$on(n, i);
1895
- this.$$l_u.set(i, s);
1896
- }
1897
- this.$$l = {};
1898
- }
1899
- }
1900
- attributeChangedCallback(t, e, r) {
1901
- this.$$r || (t = this.$$g_p(t), this.$$d[t] = pt(t, r, this.$$p_d, "toProp"), this.$$c?.$set({ [t]: this.$$d[t] }));
1902
- }
1903
- disconnectedCallback() {
1904
- this.$$cn = !1, Promise.resolve().then(() => {
1905
- !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
1906
- });
1907
- }
1908
- $$g_p(t) {
1909
- return bt(this.$$p_d).find((e) => this.$$p_d[e].attribute === t || !this.$$p_d[e].attribute && e.toLowerCase() === t) || t;
1910
- }
1911
- });
1912
- function pt(t, e, r, n) {
1913
- const i = r[t]?.type;
1914
- if (e = i === "Boolean" && typeof e != "boolean" ? e != null : e, !n || !r[t]) return e;
1915
- if (n === "toAttribute") switch (i) {
1916
- case "Object":
1917
- case "Array":
1918
- return e == null ? null : JSON.stringify(e);
1919
- case "Boolean":
1920
- return e ? "" : null;
1921
- case "Number":
1922
- return e ?? null;
1923
- default:
1924
- return e;
1925
- }
1926
- else switch (i) {
1927
- case "Object":
1928
- case "Array":
1929
- return e && JSON.parse(e);
1930
- case "Boolean":
1931
- return e;
1932
- case "Number":
1933
- return e != null ? +e : e;
1934
- default:
1935
- return e;
1936
- }
1937
- }
1938
- function ms(t) {
1939
- const e = {};
1940
- return t.childNodes.forEach((r) => {
1941
- e[r.slot || "default"] = !0;
1942
- }), e;
1943
- }
1944
- function gs(t, e, r, n, i, s) {
1945
- let l = class extends In {
1946
- constructor() {
1947
- super(t, r, i), this.$$p_d = e;
1948
- }
1949
- static get observedAttributes() {
1950
- return bt(e).map((u) => (e[u].attribute || u).toLowerCase());
1951
- }
1952
- };
1953
- return bt(e).forEach((u) => {
1954
- Ze(l.prototype, u, {
1955
- get() {
1956
- return this.$$c && u in this.$$c ? this.$$c[u] : this.$$d[u];
1957
- },
1958
- set(h) {
1959
- h = pt(u, h, e), this.$$d[u] = h;
1960
- var b = this.$$c;
1961
- b && (Ee(b, u)?.get ? b[u] = h : b.$set({ [u]: h }));
1962
- }
1963
- });
1964
- }), n.forEach((u) => {
1965
- Ze(l.prototype, u, { get() {
1966
- return this.$$c?.[u];
1967
- } });
1968
- }), s && (l = s(l)), t.element = l, l;
1969
- }
1970
- var Mn, oe = class W {
1971
- constructor() {
1972
- o(this, "elementType", "multiple-choice"), o(this, "priority", 100);
1973
- }
1974
- canHandle(e) {
1975
- return e.tagName.toLowerCase() === "multiple-choice" || e.classList.contains("multiple-choice");
1976
- }
1977
- findChoices(e) {
1978
- e.setAttribute(W.ROOT_HOOK_ATTR, "true");
1979
- const r = Array.from(e.querySelectorAll(W.CHOICE_SELECTOR));
1980
- for (const n of r) this.annotateChoice(n);
1981
- return this.annotateFeedbackTicks(e), r;
1982
- }
1983
- createChoiceRange(e) {
1984
- const r = this.resolveLabelElement(e);
1985
- if (!r) return null;
1986
- const n = document.createRange();
1987
- return n.selectNodeContents(r), n;
1988
- }
1989
- getChoiceId(e) {
1990
- const r = e.querySelector('input[type="checkbox"], input[type="radio"]');
1991
- return r?.getAttribute("value") || r?.id || this.generateFallbackId(e);
1992
- }
1993
- getChoiceLabel(e) {
1994
- return this.resolveLabelElement(e)?.textContent?.trim() || "Unlabeled choice";
1995
- }
1996
- isSelected(e) {
1997
- const r = e.querySelector('input[type="checkbox"], input[type="radio"]');
1998
- return r ? r.checked || r.getAttribute("aria-checked") === "true" : !1;
1999
- }
2000
- canEliminate(e) {
2001
- const r = e.querySelector('input[type="checkbox"], input[type="radio"]');
2002
- return !(!r || this.isSelected(e) || r.disabled || (e.closest(`[${W.ROOT_HOOK_ATTR}="true"]`) || e.closest("multiple-choice"))?.querySelector(`[${W.FEEDBACK_HOOK_ATTR}="true"]`));
2003
- }
2004
- setSelectable(e, r) {
2005
- const n = e.querySelector('input[type="checkbox"], input[type="radio"]');
2006
- if (!n) return;
2007
- n.disabled = !r, r ? n.removeAttribute("aria-disabled") : n.setAttribute("aria-disabled", "true");
2008
- const i = n.closest(W.MUI_BUTTON_SELECTOR);
2009
- i && i.classList.toggle(W.MUI_DISABLED_CLASS, !r);
2010
- }
2011
- getButtonContainer(e) {
2012
- return e;
2013
- }
2014
- generateFallbackId(e) {
2015
- const r = (e.closest(`[${W.ROOT_HOOK_ATTR}="true"]`) || e.closest("multiple-choice"))?.querySelectorAll(`[${W.CHOICE_HOOK_ATTR}="true"]`) || [];
2016
- return `choice-${Array.from(r).indexOf(e)}`;
2017
- }
2018
- annotateChoice(e) {
2019
- e.setAttribute(W.CHOICE_HOOK_ATTR, "true");
2020
- const r = this.resolveLabelElement(e);
2021
- r && r.setAttribute(W.LABEL_HOOK_ATTR, "true");
2022
- }
2023
- resolveLabelElement(e) {
2024
- return e.querySelector(`[${W.LABEL_HOOK_ATTR}="true"]`) || e.querySelector("label") || e.querySelector("span");
2025
- }
2026
- annotateFeedbackTicks(e) {
2027
- for (const r of e.querySelectorAll(".feedback-tick")) r.setAttribute(W.FEEDBACK_HOOK_ATTR, "true");
2028
- }
2029
- };
2030
- Mn = oe;
2031
- o(oe, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice");
2032
- o(oe, "LABEL_HOOK_ATTR", "data-pie-answer-eliminator-label");
2033
- o(oe, "ROOT_HOOK_ATTR", "data-pie-answer-eliminator-root");
2034
- o(oe, "FEEDBACK_HOOK_ATTR", "data-pie-answer-eliminator-feedback-tick");
2035
- o(oe, "CHOICE_SELECTOR", `[${Mn.CHOICE_HOOK_ATTR}="true"], .corespring-checkbox, .corespring-radio-button`);
2036
- o(oe, "MUI_BUTTON_SELECTOR", ".MuiButtonBase-root, .MuiRadio-root, .MuiCheckbox-root");
2037
- o(oe, "MUI_DISABLED_CLASS", "Mui-disabled");
2038
- var ys = "ebsr-multiple-choice", fr = (t) => t instanceof HTMLElement && Pn(t.tagName.toLowerCase()).baseName === ys, Or = (t, e) => Array.from(t.querySelectorAll(`[id="${e}"]`)).find(fr) ?? null, bs = (t) => {
2039
- let e = t.parentElement;
2040
- for (; e !== null; ) {
2041
- if (fr(e)) return e;
2042
- e = e.parentElement;
2043
- }
2044
- return null;
2045
- }, ws = class {
2046
- constructor() {
2047
- o(this, "elementType", "ebsr"), o(this, "priority", 110), o(this, "mcAdapter", new oe());
2048
- }
2049
- canHandle(t) {
2050
- return t.tagName.toLowerCase() === "ebsr" || Array.from(t.querySelectorAll("*")).some(fr);
2051
- }
2052
- findChoices(t) {
2053
- const e = Or(t, "a"), r = Or(t, "b"), n = [];
2054
- return e && n.push(...this.mcAdapter.findChoices(e)), r && n.push(...this.mcAdapter.findChoices(r)), n;
2055
- }
2056
- createChoiceRange(t) {
2057
- return this.mcAdapter.createChoiceRange(t);
2058
- }
2059
- getChoiceId(t) {
2060
- return `${bs(t)?.id || "unknown"}-${this.mcAdapter.getChoiceId(t)}`;
2061
- }
2062
- getChoiceLabel(t) {
2063
- return this.mcAdapter.getChoiceLabel(t);
2064
- }
2065
- isSelected(t) {
2066
- return this.mcAdapter.isSelected(t);
2067
- }
2068
- canEliminate(t) {
2069
- return this.mcAdapter.canEliminate(t);
2070
- }
2071
- setSelectable(t, e) {
2072
- this.mcAdapter.setSelectable(t, e);
2073
- }
2074
- getButtonContainer(t) {
2075
- return this.mcAdapter.getButtonContainer(t);
2076
- }
2077
- }, Ss = class {
2078
- constructor() {
2079
- o(this, "elementType", "inline-dropdown"), o(this, "priority", 90);
2080
- }
2081
- canHandle(t) {
2082
- return t.tagName.toLowerCase() === "inline-dropdown" || t.querySelector('[role="combobox"]') !== null;
2083
- }
2084
- findChoices(t) {
2085
- return Array.from(t.querySelectorAll('[role="option"]'));
2086
- }
2087
- createChoiceRange(t) {
2088
- const e = document.createRange();
2089
- return e.selectNodeContents(t), e;
2090
- }
2091
- getChoiceId(t) {
2092
- return t.id || t.getAttribute("data-value") || "";
2093
- }
2094
- getChoiceLabel(t) {
2095
- return t.textContent?.trim() || "Unlabeled option";
2096
- }
2097
- canEliminate(t) {
2098
- return t.getAttribute("aria-selected") !== "true";
2099
- }
2100
- getButtonContainer(t) {
2101
- return t;
2102
- }
2103
- }, As = class {
2104
- constructor() {
2105
- o(this, "adapters", void 0), this.adapters = [
2106
- new oe(),
2107
- new ws(),
2108
- new Ss()
2109
- ].sort((t, e) => e.priority - t.priority);
2110
- }
2111
- findAdapter(t) {
2112
- return this.adapters.find((e) => e.canHandle(t)) || null;
2113
- }
2114
- findAllChoicesWithAdapters(t) {
2115
- const e = [], r = /* @__PURE__ */ new Set();
2116
- for (const n of this.adapters) {
2117
- const i = n.findChoices(t);
2118
- for (const s of i)
2119
- r.has(s) || (r.add(s), e.push({
2120
- choice: s,
2121
- adapter: n
2122
- }));
2123
- }
2124
- return e;
2125
- }
2126
- registerAdapter(t) {
2127
- this.adapters.push(t), this.adapters.sort((e, r) => r.priority - e.priority);
2128
- }
2129
- }, xe = class B {
2130
- constructor() {
2131
- o(this, "name", "mask"), o(this, "highlights", /* @__PURE__ */ new Map()), o(this, "ranges", /* @__PURE__ */ new Map()), o(this, "fallbackContainers", /* @__PURE__ */ new Map());
2132
- }
2133
- initialize() {
2134
- }
2135
- destroy() {
2136
- this.clearAll();
2137
- }
2138
- apply(e, r) {
2139
- if (!this.isSupported()) {
2140
- this.applyFallback(e, r);
2141
- return;
2142
- }
2143
- this.injectHighlightCSS(e);
2144
- const n = new Highlight(r);
2145
- CSS.highlights.set(`${B.HIGHLIGHT_NAME_PREFIX}${e}`, n), this.highlights.set(e, n), this.ranges.set(e, r), this.addAriaAttributes(r);
2146
- }
2147
- remove(e) {
2148
- if (!this.isSupported()) {
2149
- this.removeFallback(e);
2150
- return;
2151
- }
2152
- CSS.highlights.delete(`${B.HIGHLIGHT_NAME_PREFIX}${e}`), this.removeHighlightCSS(e);
2153
- const r = this.ranges.get(e);
2154
- r && this.removeAriaAttributes(r), this.highlights.delete(e), this.ranges.delete(e), this.fallbackContainers.delete(e);
2155
- }
2156
- isEliminated(e) {
2157
- return this.highlights.has(e) || this.fallbackContainers.has(e);
2158
- }
2159
- clearAll() {
2160
- for (const e of this.getEliminatedIds()) this.remove(e);
2161
- this.fallbackContainers.clear();
2162
- }
2163
- getEliminatedIds() {
2164
- return Array.from(/* @__PURE__ */ new Set([...this.highlights.keys(), ...this.fallbackContainers.keys()]));
2165
- }
2166
- isSupported() {
2167
- return typeof CSS < "u" && "highlights" in CSS;
2168
- }
2169
- injectHighlightCSS(e) {
2170
- const r = `${B.HIGHLIGHT_STYLE_PREFIX}${e}`;
2171
- if (document.getElementById(r)) return;
2172
- const n = document.createElement("style");
2173
- n.id = r, n.textContent = `
2174
- ::highlight(${B.HIGHLIGHT_NAME_PREFIX}${e}) {
1
+ import{coerceBooleanAttributes as Bi}from"@pie-players/pie-players-shared/ui/attribute-coercion";import{resolveInterfaceI18n as Kt,stampInterfaceLocale as hr}from"@pie-players/pie-players-shared/i18n/provider";import{connectToolRuntimeContext as Pi,connectToolShellContext as Fi}from"@pie-players/pie-assessment-toolkit/tools/registration";import{parseVersionedTagName as Gi}from"@pie-players/pie-players-shared/pie/tag-names";if(typeof window<"u"){var dr,vr;((dr=(vr=window).__svelte??(vr.__svelte={})).v??(dr.v=new Set)).add("5")}var be={},H=Symbol("uninitialized"),Di=Array.isArray,Wi=Array.prototype.indexOf,Ve=Array.prototype.includes,qi=Array.from,ut=Object.keys,Ye=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,ji=Object.prototype,zi=Array.prototype,Vi=Object.getPrototypeOf,pr=Object.isExtensible,Yi=()=>{};function Xi(t){for(var e=0;e<t.length;e++)t[e]()}function Ui(){var t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}function Xe(t){"@babel/helpers - typeof";return Xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xe(t)}function Ji(t,e){if(Xe(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(Xe(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qi(t){var e=Ji(t,"string");return Xe(e)=="symbol"?e:e+""}function u(t,e,r){return(e=Qi(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var U=1024,D=2048,he=4096,_r=8192,mr=16384,gr=32768,Bt=1<<25,yr=65536,Ue=1<<19,Zi=1<<20,Sr=1<<21,br=1<<23,Je=Symbol("$state"),Ar=Symbol("component"),Er=Symbol("legacy props"),en=Symbol("attributes"),tn=Symbol("class"),rn=Symbol("style"),nn=Symbol("text"),ft=new class extends Error{constructor(...e){super(...e),u(this,"name","StaleReactionError"),u(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};globalThis.document?.contentType;function sn(){console.warn("https://svelte.dev/e/derived_inert")}function Pt(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function an(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var J=!1;function ct(t){J=t}var K;function Qe(t){if(t===null)throw Pt(),be;return K=t}function wr(){return Qe(De(K))}function ln(t=1){if(J){for(var e=t,r=K;e--;)r=De(r);K=r}}function on(t=!0){for(var e=0,r=K;;){if(r.nodeType===8){var i=r.data;if(i==="]"){if(e===0)return r;e-=1}else(i==="["||i==="[!"||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=De(r);t&&r.remove(),r=n}}function un(t){if(!t||t.nodeType!==8)throw Pt(),be;return t.data}function Cr(t){return t===this.v}function fn(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Tr(t){return!fn(t,this.v)}function cn(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function hn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function dn(t){throw new Error("https://svelte.dev/e/effect_orphan")}function vn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function pn(){throw new Error("https://svelte.dev/e/hydration_failed")}function _n(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function mn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function gn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function yn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Sn(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var Ee=!1,ht=!1,I=null;function dt(t){I=t}function $r(t,e=!1,r){I={p:I,i:!1,c:null,e:null,s:t,x:null,r:C,l:ht&&!e?{s:null,u:null,$:[]}:null}}function kr(t){var e=I,r=e.e;if(r!==null){e.e=null;for(var i of r)Zr(i)}return t!==void 0&&(e.x=t),e.i=!0,I=e.p,Ft(t)}function Ft(t={}){return Ye(t,Ar,{value:!0}),t}function vt(){return!ht||I!==null&&I.l===null}var we=[];function Lr(){var t=we;we=[],Xi(t)}function Ce(t){if(we.length===0&&!Ze){var e=we;queueMicrotask(()=>{e===we&&Lr()})}we.push(t)}function bn(){for(;we.length>0;)Lr()}var An=~(D|he|U);function O(t,e){t.f=t.f&An|e}function Gt(t){(t.f&512)!==0||t.deps===null?O(t,U):O(t,he)}function Rr(t,e){(t.f&2048)!==0?e.set(t,D):(t.f&4096)!==0&&e.get(t)!==2048&&e.set(t,he),O(t,U)}function pt(t){var e=A,r=C;se(null),ge(null);try{return t()}finally{se(e),ge(r)}}function _t(t){var e=2|D;return C!==null&&(C.f|=Ue),{ctx:I,deps:null,effects:null,equals:Cr,f:e,fn:t,reactions:null,rv:0,v:H,wv:0,parent:C,ac:null}}var En=Symbol("obsolete");function Dt(t){const e=_t(t);return Ee||ni(e),e}function wn(t){const e=_t(t);return e.equals=Tr,e}function Cn(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)Q(e[r])}}function Wt(t){var e,r=C,i=t.parent;if(!fe&&i!==null&&t.v!==H&&(i.f&24576)!==0)return sn(),t.v;ge(i);try{Cn(t),e=ui(t)}finally{ge(r)}return e}function Ir(t){var e=Wt(t);if(!t.equals(e)&&(t.wv=li(),(!T?.is_fork||t.deps===null)&&(T!==null?(T.capture(t,e,!0),Be?.capture(t,e,!0)):t.v=e,t.deps===null))){O(t,U);return}fe||(B!==null?(Zt()||T?.is_fork)&&B.set(t,e):Gt(t))}function Tn(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&pt(()=>{e.ac.abort(ft),e.ac=null}),e.fn!==null&&(e.teardown=Yi),at(e,0),tr(e))}function Or(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&We(e)}function Mr(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function qt(t,e){Mr(t,e),e.add(t)}function w(t,e,r){Mr(t,e),e.set(t,r)}function p(t,e,r){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}function l(t,e){return t.get(p(t,e))}function g(t,e,r){return t.set(p(t,e),r),r}var Hr,mt=null,Ke=null,T=null,Be=null,B=null,jt=null,Ze=!1,zt=!1,et=null,gt=null,xr=0,$n=1,yt=new WeakMap,St=new WeakMap,Pe=new WeakMap,Te=new WeakMap,tt=new WeakMap,$e=new WeakMap,Vt=new WeakMap,de=new WeakMap,ve=new WeakMap,bt=new WeakMap,rt=new WeakMap,$=new WeakSet,Fe=class Ki{constructor(){qt(this,$),u(this,"id",$n++),u(this,"started",!1),u(this,"linked",!0),u(this,"prev",null),u(this,"next",null),u(this,"async_deriveds",new Map),u(this,"current",new Map),u(this,"previous",new Map),w(this,yt,new Set),w(this,St,new Set),w(this,Pe,0),w(this,Te,new Map),w(this,tt,null),w(this,$e,[]),w(this,Vt,[]),w(this,de,new Map),w(this,ve,new Map),w(this,bt,new Set),u(this,"is_fork",!1),w(this,rt,!1),Ke===null?mt=Ke=this:(Ke.next=this,this.prev=Ke),Ke=this}skip_effect(e){l(ve,this).has(e)||l(ve,this).set(e,{d:[],m:[]}),l(bt,this).delete(e)}unskip_effect(e,r=i=>this.schedule(i)){var i=l(ve,this).get(e);if(i){l(ve,this).delete(e);for(var n of i.d)O(n,D),r(n);for(n of i.m)O(n,he),r(n)}l(bt,this).add(e)}capture(e,r,i=!1){e.v!==H&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&8388608)===0&&(this.current.set(e,[r,i]),B?.set(e,r)),this.is_fork||(e.v=r)}activate(){T=this}deactivate(){T=null,B=null}flush(){try{zt=!0,T=this,p($,this,At).call(this)}finally{xr=0,jt=null,et=null,gt=null,zt=!1,T=null,B=null,ne.clear()}}discard(){for(const e of l(St,this))e(this);l(St,this).clear();for(const e of this.async_deriveds.values())e.reject(En);p($,this,Et).call(this),l(tt,this)?.resolve()}register_created_effect(e){l(Vt,this).push(e)}increment(e,r){if(g(Pe,this,l(Pe,this)+1),e){let i=l(Te,this).get(r)??0;l(Te,this).set(r,i+1)}}decrement(e,r){if(g(Pe,this,l(Pe,this)-1),e){let i=l(Te,this).get(r)??0;i===1?l(Te,this).delete(r):l(Te,this).set(r,i-1)}l(rt,this)||(g(rt,this,!0),Ce(()=>{g(rt,this,!1),this.linked&&this.flush()}))}transfer_reactions(e){for(const[r,i]of e)this.add_dirty_reaction(r,i);e.clear()}add_dirty_reaction(e,r){(r===2048||l(de,this).get(e)!==2048)&&l(de,this).set(e,r)}oncommit(e){l(yt,this).add(e)}ondiscard(e){l(St,this).add(e)}settled(){return(l(tt,this)??g(tt,this,Ui())).promise}static ensure(){if(T===null){const e=T=new Ki;!zt&&!Ze&&Ce(()=>{e.started||e.flush()})}return T}apply(){if(!Ee||!this.is_fork&&this.prev===null&&this.next===null){B=null;return}B=new Map;for(const[e,[r]]of this.current)B.set(e,r);for(let e=mt;e!==null;e=e.next)if(!(e===this||e.is_fork)&&(e.id>=this.id||!p($,e,Pr).call(e,this)))for(const[r,i]of e.previous)B.has(r)||B.set(r,i)}schedule(e){if(jt=e,e.b?.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}l($e,this).push(e)}};Hr=Fe;function Nr(){if(this.is_fork)return!0;for(const t of l(Te,this).keys())if(!p($,this,kn).call(this,t))return!0;return!1}function kn(t){for(var e=t;e!==null;e=e.parent)if(l(ve,this).has(e))return!0;return!1}function Kr(){var t=[];for(const n of l($e,this))if(!((n.f&16384)!==0||(n.f&6144)===0)){for(var e=n,r=!1;e.parent!==null;){e=e.parent;var i=e.f;if((i&96)!==0){if((i&1024)===0){r=!0;break}e.f^=U}}r||t.push(e)}return g($e,this,[]),t}function At(){this.started=!0;for(const[a,o]of l(de,this))O(a,o),this.schedule(a);this.apply();for(var t=et=[],e=[],r=gt=[];l($e,this).length>0;){xr++>1e3&&(p($,this,Et).call(this),On());for(const a of p($,this,Kr).call(this))try{p($,this,Br).call(this,a,t,e)}catch(o){throw Wr(a),p($,this,Nr).call(this)||this.discard(),o}}if(T=null,r.length>0){var i=Hr.ensure();for(const a of r)i.schedule(a)}if(et=null,gt=null,p($,this,Nr).call(this)){p($,this,it).call(this,e),p($,this,it).call(this,t);for(const[a,o]of l(ve,this))Dr(a,o);r.length>0&&p($,T,At).call(T);return}const n=p($,this,Ln).call(this);if(n){p($,this,it).call(this,e),p($,this,it).call(this,t),p($,n,Rn).call(n,this);return}l(de,this).clear();for(const a of l(yt,this))a(this);l(yt,this).clear(),Be=this,Fr(e),Fr(t),Be=null,l(tt,this)?.resolve();var s=T;l(Pe,this)===0&&(l($e,this).length===0||s!==null)&&(p($,this,Et).call(this),Ee&&(p($,this,In).call(this),T=s)),s!==null&&(ne.clear(),p($,s,At).call(s))}function Br(t,e,r){t.f^=U;for(var i=t.first;i!==null;){var n=i.f,s=(n&96)!==0;if(!(s&&(n&1024)!==0||(n&8192)!==0||l(ve,this).has(i))&&i.fn!==null){s?i.f^=U:(n&4)!==0?e.push(i):Ee&&(n&16777224)!==0?r.push(i):st(i)&&((n&16)!==0&&this.add_dirty_reaction(i,he),We(i));var a=i.first;if(a!==null){i=a;continue}}for(;i!==null;){var o=i.next;if(o!==null){i=o;break}i=i.parent}}}function Ln(){for(var t=this.prev;t!==null;t=t.prev)if(!t.is_fork&&p($,this,Pr).call(this,t))return t;return null}function Pr(t){for(const[e,[,r]]of this.current)if(!r&&t.current.has(e))return!0;return!1}function Rn(t){for(const[r,i]of t.current)!this.previous.has(r)&&t.previous.has(r)&&this.previous.set(r,t.previous.get(r)),this.current.set(r,i);for(const[r,i]of t.async_deriveds){const n=this.async_deriveds.get(r);n&&i.promise.then(n.resolve).catch(n.reject)}t.async_deriveds.clear(),this.transfer_reactions(l(de,t));const e=r=>{var i=r.reactions;if(i!==null&&!((r.f&2)!==0&&(r.f&6144)===0))for(const a of i){var n=a.f;if((n&2)!==0)e(a);else{var s=a;n&4194320&&!this.async_deriveds.has(s)&&(l(de,this).delete(s),O(s,D),this.schedule(s))}}};for(const r of this.current.keys())e(r);this.oncommit(()=>t.discard()),p($,t,Et).call(t),T=this,p($,this,At).call(this)}function it(t){for(var e=0;e<t.length;e+=1)Rr(t[e],l(de,this))}function In(){for(let c=mt;c!==null;c=c.next){var t=c.id<this.id,e=[];for(const[d,[v,_]]of this.current){if(c.current.has(d)){var r=c.current.get(d)[0];if(t&&v!==r)c.current.set(d,[v,_]);else continue}e.push(d)}if(t)for(const[d,v]of this.async_deriveds){const _=c.async_deriveds.get(d);_&&v.promise.then(_.resolve).catch(_.reject)}var i=[...c.current.keys()].filter(d=>!c.current.get(d)[1]);if(!(!c.started||i.length===0)){var n=i.filter(d=>!this.current.has(d));if(n.length===0)t&&c.discard();else if(e.length>0){if(t)for(const d of l(bt,this))c.unskip_effect(d,v=>{(v.f&4194320)!==0?c.schedule(v):p($,c,it).call(c,[v])});c.activate();var s=new Set,a=new Map;for(var o of e)Gr(o,n,s,a);a=new Map;var f=[...c.current].filter(([d,v])=>{const _=this.current.get(d);return _?_[0]!==v[0]||_[1]!==v[1]:!0}).map(([d])=>d);if(f.length>0)for(const d of l(Vt,this))(d.f&155648)===0&&Yt(d,f,a)&&((d.f&4194320)!==0?(O(d,D),c.schedule(d)):c.add_dirty_reaction(d,D));if(l($e,c).length>0&&!l(rt,c)){c.apply();for(var h of p($,c,Kr).call(c))p($,c,Br).call(c,h,[],[])}c.deactivate()}}}}function Et(){if(this.linked){var t=this.prev,e=this.next;t===null?mt=e:t.next=e,e===null?Ke=t:e.prev=t,this.linked=!1}}function pe(t){var e=Ze,r=Be;Be=null,Ze=!0;try{var i;for(t&&(pe(),i=t());;){if(bn(),T===null)return i;T.flush()}}finally{Ze=e,Be=r}}function On(){try{vn()}catch(t){_e(t,jt)}}var ue=null;function Fr(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var i=t[r++];if((i.f&24576)===0&&st(i)&&(ue=new Set,We(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&ti(i),ue?.size>0)){ne.clear();for(const n of ue){if((n.f&24576)!==0)continue;const s=[n];let a=n.parent;for(;a!==null;)ue.has(a)&&(ue.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){const f=s[o];(f.f&24576)===0&&We(f)}}ue.clear()}}ue=null}}function Gr(t,e,r,i){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(const n of t.reactions){const s=n.f;(s&2)!==0?Gr(n,e,r,i):(s&4194320)!==0&&(s&2048)===0&&Yt(n,e,i)&&(O(n,D),Xt(n))}}function Yt(t,e,r){const i=r.get(t);if(i!==void 0)return i;if(t.deps!==null)for(const n of t.deps){if(Ve.call(e,n))return!0;if((n.f&2)!==0&&Yt(n,e,r))return r.set(n,!0),!0}return r.set(t,!1),!1}function Xt(t){T.schedule(t)}function Dr(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):(t.f&4096)!==0&&e.m.push(t),O(t,U);for(var r=t.first;r!==null;)Dr(r,e),r=r.next}}function Wr(t){O(t,U);for(var e=t.first;e!==null;)Wr(e),e=e.next}var wt=new Set,ne=new Map,qr=!1;function Ct(t,e){return{f:0,v:t,reactions:null,equals:Cr,rv:0,wv:0}}function W(t,e){const r=Ct(t,e);return ni(r),r}function Mn(t,e=!1,r=!0){const i=Ct(t);if(e||(i.equals=Tr),ht&&r&&I!==null&&I.l!==null){var n;((n=I.l).s??(n.s=[])).push(i)}return i}function N(t,e,r=!1){return A!==null&&(!Z||(A.f&131072)!==0)&&vt()&&(A.f&4325394)!==0&&(ee===null||!ee.has(t))&&yn(),jr(t,r?Ge(e):e,gt)}var ke=null,Ut=0;function jr(t,e,r=null){if(!t.equals(e)){fe?ne.set(t,e):ne.has(t)||ne.set(t,t.v);var i=Fe.ensure();if(i.capture(t,e),(t.f&2)!==0){const n=t;(t.f&2048)!==0&&Wt(n),B===null&&Gt(n)}t.wv=li(),ke=null,Ut=0,zr(t,D,r),ke=null,vt()&&C!==null&&(C.f&1024)!==0&&(C.f&96)===0&&(Y===null?Vn([t]):Y.push(t)),!i.is_fork&&wt.size>0&&!qr&&Hn()}return e}function Hn(){qr=!1;for(const t of wt){(t.f&1024)!==0&&O(t,he);let e;try{e=st(t)}catch{e=!0}e&&We(t)}wt.clear()}function nt(t){N(t,t.v+1)}function zr(t,e,r){var i=t.reactions;if(i!==null){var n=vt(),s=i.length;if(Ut+=s,Ut>1e5&&ke===null&&(ke=new Set),ke!==null){if(ke.has(t))return;ke.add(t)}for(var a=0;a<s;a++){var o=i[a],f=o.f;if(!(!n&&o===C)){var h=(f&D)===0;if(h&&O(o,e),(f&131072)!==0)wt.add(o);else if((f&2)!==0){var c=o;B?.delete(c),zr(c,he,r)}else if(h){var d=o;(f&16)!==0&&ue!==null&&ue.add(d),r!==null?r.push(d):Xt(d)}}}}}function Ge(t){if(typeof t!="object"||t===null||Je in t||Ar in t)return t;const e=Vi(t);if(e!==ji&&e!==zi)return t;var r=new Map,i=Di(t),n=W(0),s=null,a=Oe,o=f=>{if(Oe===a)return f();var h=A,c=Oe;se(null),ai(a);var d=f();return se(h),ai(c),d};return i&&r.set("length",W(t.length,s)),new Proxy(t,{defineProperty(f,h,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&mn();var d=r.get(h);return d===void 0?o(()=>{var v=W(c.value,s);return r.set(h,v),v}):N(d,c.value,!0),!0},deleteProperty(f,h){var c=r.get(h);if(c===void 0){if(h in f){const d=o(()=>W(H,s));r.set(h,d),nt(n)}}else N(c,H),nt(n);return!0},get(f,h,c){if(h===Je)return t;var d=r.get(h),v=h in f;if(d===void 0&&(!v||Ae(f,h)?.writable)&&(d=o(()=>W(Ge(v?f[h]:H),s)),r.set(h,d)),d!==void 0){var _=S(d);return _===H?void 0:_}return Reflect.get(f,h,c)},getOwnPropertyDescriptor(f,h){this.has?.(f,h);var c=Reflect.getOwnPropertyDescriptor(f,h),d=r.get(h);if(d!==void 0){var v=S(d);if(v===H)return;if(c&&"value"in c)c.value=v;else return{enumerable:!0,configurable:!0,value:v,writable:!0}}return c},has(f,h){if(h===Je)return!0;var c=r.get(h),d=c!==void 0&&c.v!==H||Reflect.has(f,h);return(c!==void 0||(C!==null||A!==null)&&(!d||Ae(f,h)?.writable))&&(c===void 0&&(c=o(()=>W(d?Ge(f[h]):H,s)),r.set(h,c)),S(c)===H)?!1:d},set(f,h,c,d){var v=r.get(h),_=h in f;if(i&&h==="length")for(var b=c;b<v.v;b+=1){var E=r.get(b+"");E!==void 0?N(E,H):b in f&&(E=o(()=>W(H,s)),r.set(b+"",E))}if(v===void 0)(!_||Ae(f,h)?.writable)&&(v=o(()=>W(void 0,s)),N(v,Ge(c)),r.set(h,v));else{_=v.v!==H;var X=o(()=>Ge(c));N(v,X)}var M=Reflect.getOwnPropertyDescriptor(f,h);if(M?.set&&M.set.call(d,c),!_){if(i&&typeof h=="string"){var G=r.get("length"),V=Number(h);Number.isInteger(V)&&V>=G.v&&N(G,V+1)}nt(n)}return!0},ownKeys(f){S(n);var h=Reflect.ownKeys(f).filter(v=>{var _=r.get(v);return _===void 0||_.v!==H});for(var[c,d]of r)d.v!==H&&!(c in f)&&h.push(c);return h},setPrototypeOf(){gn()}})}var Vr,Yr,Xr,Ur;function Jt(){if(Vr===void 0){Vr=window,Yr=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;Xr=Ae(e,"firstChild").get,Ur=Ae(e,"nextSibling").get,pr(t)&&(t[tn]=void 0,t[en]=null,t[rn]=void 0,t.__e=void 0),pr(r)&&(r[nn]=void 0)}}function Jr(t=""){return document.createTextNode(t)}function Qt(t){return Xr.call(t)}function De(t){return Ur.call(t)}function xn(t){t.textContent=""}function Qr(t,e,r){return e==null||e==="http://www.w3.org/1999/xhtml"?r?document.createElement(t,{is:r}):document.createElement(t):r?document.createElementNS(e,t,{is:r}):document.createElementNS(e,t)}function Nn(t){var e=C;if(e===null)return A.f|=br,t;if((e.f&32768)===0&&(e.f&4)===0)throw t;_e(t,e)}function _e(t,e){if(t===be)throw t;if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw t}}function Kn(t){C===null&&(A===null&&dn(t),hn()),fe&&cn(t)}function Bn(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Le(t,e){var r=C;r!==null&&(r.f&8192)!==0&&(t|=_r);var i={ctx:I,deps:null,nodes:null,f:t|D|512,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};T?.register_created_effect(i);var n=i;if((t&4)!==0)et!==null?et.push(i):Fe.ensure().schedule(i);else if(e!==null){try{We(i)}catch(a){throw Q(i),a}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&524288)===0&&(n=n.first,(t&16)!==0&&(t&65536)!==0&&n!==null&&(n.f|=yr))}if(n!==null&&(n.parent=r,r!==null&&Bn(n,r),A!==null&&(A.f&2)!==0&&(t&64)===0)){var s=A;(s.effects??(s.effects=[])).push(n)}return i}function Zt(){return A!==null&&!Z}function me(t){Kn("$effect");var e=C.f;if(!A&&(e&32)!==0&&I!==null&&!I.i){var r=I;(r.e??(r.e=[])).push(t)}else return Zr(t)}function Zr(t){return Le(4|Zi,t)}function Pn(t){Fe.ensure();const e=Le(64|Ue,t);return()=>{Q(e)}}function Fn(t){Fe.ensure();const e=Le(64|Ue,t);return(r={})=>new Promise(i=>{r.outro?Tt(e,()=>{Q(e),i(void 0)}):(Q(e),i(void 0))})}function Gn(t){return Le(4,t)}function er(t,e=0){return Le(8|e,t)}function Dn(t,e=0){return Le(16|e,t)}function Re(t){return Le(32|Ue,t)}function ei(t){var e=t.teardown;if(e!==null){const r=fe,i=A;ii(!0),se(null);try{e.call(null)}catch(n){_e(n,t.parent)}finally{ii(r),se(i)}}}function tr(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const n=r.ac;n!==null&&pt(()=>{n.abort(ft)});var i=r.next;(r.f&64)!==0?r.parent=null:Q(r,e),r=i}}function Wn(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&32)===0&&Q(e),e=r}}function Q(t,e=!0){var r=!1;(e||(t.f&262144)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(qn(t.nodes.start,t.nodes.end),r=!0),t.f|=Bt,tr(t,e&&!r),at(t,0);var i=t.nodes&&t.nodes.t;if(i!==null)for(const s of i)s.stop();ei(t),t.f^=Bt,t.f|=mr;var n=t.parent;n!==null&&n.first!==null&&ti(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function qn(t,e){for(;t!==null;){var r=t===e?null:De(t);t.remove(),t=r}}function ti(t){var e=t.parent,r=t.prev,i=t.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),e!==null&&(e.first===t&&(e.first=i),e.last===t&&(e.last=r))}function Tt(t,e,r=!0){var i=[];t.f|=256,ri(t,i,!0);var n=()=>{r&&Q(t),e&&e()},s=i.length;if(s>0){var a=()=>--s||n();for(var o of i)o.out(a)}else n()}function ri(t,e,r){if((t.f&8192)===0){t.f^=_r;var i=t.nodes&&t.nodes.t;if(i!==null)for(const o of i)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var s=n.next;if((n.f&64)===0){var a=(n.f&65536)!==0||(n.f&32)!==0&&(t.f&16)!==0;ri(n,e,a?r:!1)}n=s}}}function jn(t,e){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end;r!==null;){var n=r===i?null:De(r);e.append(r),r=n}}var zn=null,fe=!1;function ii(t){fe=t}var A=null,Z=!1;function se(t){A=t}var C=null;function ge(t){C=t}var ee=null;function ni(t){A!==null&&(!Ee&&(A.f&2097152)!==0||(A.f&2)!==0)&&(ee??(ee=new Set)).add(t)}var P=null,q=0,Y=null;function Vn(t){Y=t}var si=1,Ie=0,Oe=Ie;function ai(t){Oe=t}function li(){return++si}function st(t){var e=t.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var r=t.deps,i=r.length,n=0;n<i;n++){var s=r[n];if(st(s)&&Ir(s),s.wv>t.wv)return!0}(e&512)!==0&&B===null&&O(t,U)}return!1}function oi(t,e,r=!0){var i=t.reactions;if(i!==null&&!(!Ee&&ee!==null&&ee.has(t)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&2)!==0?oi(s,e,!1):e===s&&(r?O(s,D):(s.f&1024)!==0&&O(s,he),Xt(s))}}function ui(t){var e=P,r=q,i=Y,n=A,s=ee,a=I,o=Z,f=Oe,h=t.f;P=null,q=0,Y=null,A=(h&96)===0?t:null,ee=null,dt(t.ctx),Z=!1,Oe=++Ie,t.ac!==null&&(pt(()=>{t.ac.abort(ft)}),t.ac=null);try{t.f|=Sr;var c=t.fn,d=c();t.f|=gr;var v=fi(t);if(vt()&&Y!==null&&!Z&&v!==null&&(t.f&6146)===0)for(var _=0;_<Y.length;_++)oi(Y[_],t);if(n!==null&&n!==t){if(Ie++,n.deps!==null)for(let b=0;b<r;b+=1)n.deps[b].rv=Ie;if(e!==null)for(const b of e)b.rv=Ie;Y!==null&&(i===null?i=Y:i.push(...Y))}return(t.f&8388608)!==0&&(t.f^=br),d}catch(b){return fi(t),Nn(b)}finally{t.f^=Sr,P=e,q=r,Y=i,A=n,ee=s,dt(a),Z=o,Oe=f}}function fi(t){var e=t.deps,r=T?.is_fork;if(P!==null){var i;if(r||at(t,q),e!==null&&q>0)for(e.length=q+P.length,i=0;i<P.length;i++)e[q+i]=P[i];else t.deps=e=P;if(Zt()&&(t.f&512)!==0)for(i=q;i<e.length;i++){var n;((n=e[i]).reactions??(n.reactions=[])).push(t)}}else!r&&e!==null&&q<e.length&&(at(t,q),e.length=q);return e}function Yn(t,e){let r=e.reactions;if(r!==null){var i=Wi.call(r,t);if(i!==-1){var n=r.length-1;n===0?r=e.reactions=null:(r[i]=r[n],r.pop())}}if(r===null&&(e.f&2)!==0&&(P===null||!Ve.call(P,e))){var s=e;(s.f&512)!==0&&(s.f^=512),s.v!==H&&Gt(s),s.ac!==null&&pt(()=>{s.ac.abort(ft),s.ac=null,O(s,D)}),Tn(s),at(s,0)}}function at(t,e){var r=t.deps;if(r!==null)for(var i=e;i<r.length;i++)Yn(t,r[i])}function We(t){var e=t.f;if((e&16384)===0){O(t,U);var r=C;C=t;try{(e&16777232)!==0?Wn(t):tr(t),ei(t);var i=ui(t);t.teardown=typeof i=="function"?i:null,t.wv=si}finally{C=r}}}function S(t){var e=(t.f&2)!==0;if(zn?.add(t),A!==null&&!Z&&!(C!==null&&(C.f&16384)!==0)&&(ee===null||!ee.has(t))){var r=A.deps;if((A.f&2097152)!==0)t.rv<Ie&&(t.rv=Ie,P===null&&r!==null&&r[q]===t?q++:P===null?P=[t]:P.push(t));else{var i;(i=A).deps??(i.deps=[]),Ve.call(A.deps,t)||A.deps.push(t);var n=t.reactions;n===null?t.reactions=[A]:Ve.call(n,A)||n.push(A)}}if(fe&&ne.has(t))return ne.get(t);if(e){var s=t;if(fe){var a=s.v;return((s.f&1024)===0&&s.reactions!==null||hi(s))&&(a=Wt(s)),ne.set(s,a),a}var o=(s.f&512)===0&&!Z&&A!==null&&(A.f&512)!==0,f=(s.f&gr)===0;st(s)&&(o&&(s.f|=512),Ir(s)),o&&!f&&(Or(s),ci(s))}if(B?.has(t))return B.get(t);if((t.f&8388608)!==0)throw t.v;return t.v}function ci(t){if(t.f|=512,t.deps!==null)for(const r of t.deps){var e=r.reactions;e===null?r.reactions=[t]:Ve.call(e,t)||e.push(t),(r.f&2)!==0&&(r.f&512)===0&&(Or(r),ci(r))}}function hi(t){if(t.v===H)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(ne.has(e)||(e.f&2)!==0&&hi(e))return!0;return!1}function lt(t){var e=Z;try{return Z=!0,t()}finally{Z=e}}var $t=Symbol("events"),Xn=new Set,di=new Set,rr=null,ir=!1;function vi(t){var e=this,r=e.ownerDocument,i=t.type,n=t.composedPath?.()||[],s=n[0]||t.target;rr=t,ir||(ir=!0,setTimeout(()=>{ir=!1,rr=null}));var a=0,o=rr===t&&t[$t];if(o){var f=n.indexOf(o);if(f!==-1&&(e===document||e===window)){t[$t]=e;return}var h=n.indexOf(e);if(h===-1)return;f<=h&&(a=f)}if(s=n[a]||t.target,s!==e){Ye(t,"currentTarget",{configurable:!0,get(){return s||r}});var c=A,d=C;se(null),ge(null);try{for(var v,_=[];s!==null&&s!==e;){try{var b=s[$t]?.[i];b!=null&&(!s.disabled||t.target===s)&&b.call(s,t)}catch(E){v?_.push(E):v=E}if(t.cancelBubble)break;a++,s=a<n.length?n[a]:null}if(v){for(let E of _)queueMicrotask(()=>{throw E});throw v}}finally{t[$t]=e,delete t.currentTarget,se(c),ge(d)}}}var Un=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Jn(t){return Un?.createHTML(t)??t}function Qn(t){var e=Qr("template");return e.innerHTML=Jn(t.replaceAll("<!>","<!---->")),e.content}function kt(t,e){var r=C;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function Zn(t,e){var r=(e&1)!==0,i=(e&2)!==0,n,s=!t.startsWith("<!>");return()=>{if(J)return kt(K,null),K;n===void 0&&(n=Qn(s?t:"<!>"+t),r||(n=Qt(n)));var a=i||Yr?document.importNode(n,!0):n.cloneNode(!0);if(r){var o=Qt(a),f=a.lastChild;kt(o,f)}else kt(a,a);return a}}function pi(t,e){if(J){var r=C;((r.f&32768)===0||r.nodes.end===null)&&(r.nodes.end=K),wr();return}t!==null&&t.before(e)}var es=["touchstart","touchmove"];function ts(t){return es.includes(t)}function rs(t){let e=0,r=Ct(0),i;return()=>{Zt()&&(S(r),er(()=>(e===0&&(i=lt(()=>t(()=>nt(r)))),e+=1,()=>{Ce(()=>{e-=1,e===0&&(i?.(),i=void 0,nt(r))})})))}}var is=yr|Ue;function ns(t,e,r,i){new ss(t,e,r,i)}var te=new WeakMap,nr=new WeakMap,ae=new WeakMap,ot=new WeakMap,F=new WeakMap,re=new WeakMap,j=new WeakMap,ie=new WeakMap,ye=new WeakMap,qe=new WeakMap,Me=new WeakMap,Lt=new WeakMap,sr=new WeakMap,He=new WeakMap,_i=new WeakMap,k=new WeakSet,ss=class{constructor(t,e,r,i){qt(this,k),u(this,"parent",void 0),u(this,"is_pending",!1),u(this,"transform_error",void 0),w(this,te,void 0),w(this,nr,J?K:null),w(this,ae,void 0),w(this,ot,void 0),w(this,F,void 0),w(this,re,null),w(this,j,null),w(this,ie,null),w(this,ye,null),w(this,qe,0),w(this,Me,0),w(this,Lt,!1),w(this,sr,new Map),w(this,He,null),w(this,_i,rs(()=>(g(He,this,Ct(l(qe,this))),()=>{g(He,this,null)}))),g(te,this,t),g(ae,this,e),g(ot,this,n=>{var s=C;s.b=this,s.f|=128,r(n)}),this.parent=C.b,this.transform_error=i??this.parent?.transform_error??(n=>n),g(F,this,Dn(()=>{if(J){const n=un(l(nr,this));wr();const s=n==="[!";if(n.startsWith("[?")){const a=JSON.parse(n.slice(2));p(k,this,ls).call(this,a)}else s?p(k,this,os).call(this):p(k,this,as).call(this)}else p(k,this,gi).call(this)},is)),J&&g(te,this,K)}defer_effect(t){Rr(t,l(sr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!l(ae,this).pending}update_pending_count(t,e){p(k,this,yi).call(this,t,e),g(qe,this,l(qe,this)+t),!(!l(He,this)||l(Lt,this))&&(g(Lt,this,!0),Ce(()=>{g(Lt,this,!1),l(He,this)&&jr(l(He,this),l(qe,this))}))}get_effect_pending(){return l(_i,this).call(this),S(l(He,this))}error(t){if(t===be||!l(ae,this).onerror&&!l(ae,this).failed)throw t;T?.is_fork?(l(re,this)&&T.skip_effect(l(re,this)),l(j,this)&&T.skip_effect(l(j,this)),l(ie,this)&&T.skip_effect(l(ie,this)),T.oncommit(()=>{p(k,this,xe).call(this)||p(k,this,Si).call(this,t)})):p(k,this,Si).call(this,t)}};function as(){try{g(re,this,Re(()=>l(ot,this).call(this,l(te,this))))}catch(t){this.error(t)}}function ls(t){const e=l(ae,this).failed,{reset:r,invoke_onerror:i}=p(k,this,mi).call(this,t);Ce(i),e&&g(ie,this,Re(()=>{e(l(te,this),()=>t,()=>r)}))}function mi(t){var e=!1,r=!1;const i=()=>{if(!p(k,this,xe).call(this)){if(e){an();return}e=!0,r&&Sn(),l(ie,this)!==null&&Tt(l(ie,this),()=>{g(ie,this,null)}),p(k,this,ar).call(this,()=>{p(k,this,gi).call(this)})}};return{reset:i,invoke_onerror:()=>{if(!p(k,this,xe).call(this))try{r=!0,l(ae,this).onerror?.(t,i),r=!1}catch(s){_e(s,l(F,this)&&l(F,this).parent)}}}}function xe(){return(l(F,this).f&(mr|Bt))!==0}function os(){const t=l(ae,this).pending;t&&(this.is_pending=!0,g(j,this,Re(()=>t(l(te,this)))),Ce(()=>{if(!p(k,this,xe).call(this)){var e=g(ye,this,document.createDocumentFragment()),r=Jr(),i=!1;if(e.append(r),g(re,this,p(k,this,ar).call(this,()=>{try{return Re(()=>l(ot,this).call(this,r))}catch(n){try{this.error(n),i=!0}catch(s){_e(s,l(F,this).parent)}return null}})),l(re,this)===null){g(ye,this,null),i&&p(k,this,Rt).call(this,T);return}l(Me,this)===0&&(l(te,this).before(e),g(ye,this,null),Tt(l(j,this),()=>{g(j,this,null)}),p(k,this,Rt).call(this,T))}}))}function gi(){try{if(this.is_pending=this.has_pending_snippet(),g(Me,this,0),g(qe,this,0),g(re,this,Re(()=>{l(ot,this).call(this,l(te,this))})),l(Me,this)>0){var t=g(ye,this,document.createDocumentFragment());jn(l(re,this),t);const e=l(ae,this).pending;g(j,this,Re(()=>e(l(te,this))))}else p(k,this,Rt).call(this,T)}catch(e){this.error(e)}}function Rt(t){this.is_pending=!1,t.transfer_reactions(l(sr,this))}function ar(t){var e=C,r=A,i=I;ge(l(F,this)),se(l(F,this)),dt(l(F,this).ctx);try{return Fe.ensure(),t()}finally{ge(e),se(r),dt(i)}}function yi(t,e){if(!this.has_pending_snippet()){if(this.parent){var r;p(k,r=this.parent,yi).call(r,t,e)}return}g(Me,this,l(Me,this)+t),l(Me,this)===0&&(p(k,this,Rt).call(this,e),l(j,this)&&Tt(l(j,this),()=>{g(j,this,null)}),l(ye,this)&&(l(te,this).before(l(ye,this)),g(ye,this,null)))}function Si(t){l(re,this)&&(Q(l(re,this)),g(re,this,null)),l(j,this)&&(Q(l(j,this)),g(j,this,null)),l(ie,this)&&(Q(l(ie,this)),g(ie,this,null)),J&&(Qe(l(nr,this)),ln(),Qe(on()));let e=l(ae,this).failed;const r=i=>{if(p(k,this,xe).call(this))return;const{reset:n,invoke_onerror:s}=p(k,this,mi).call(this,i);s(),e&&!p(k,this,xe).call(this)&&g(ie,this,p(k,this,ar).call(this,()=>{try{return Re(()=>{var a=C;a.b=this,a.f|=128,e(l(te,this),()=>i,()=>n)})}catch(a){return _e(a,l(F,this).parent),null}}))};Ce(()=>{if(!p(k,this,xe).call(this)){var i;try{i=this.transform_error(t)}catch(n){_e(n,l(F,this)&&l(F,this).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,n=>_e(n,l(F,this)&&l(F,this).parent)):r(i)}})}function bi(t,e){return Ai(t,e)}function us(t,e){Jt(),e.intro=e.intro??!1;const r=e.target,i=J,n=K;try{for(var s=Qt(r);s&&(s.nodeType!==8||s.data!=="[");)s=De(s);if(!s)throw be;ct(!0),Qe(s);const a=Ai(t,{...e,anchor:s});return ct(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
2
+ `).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==be&&console.warn("Failed to hydrate: ",a),e.recover===!1&&pn(),Jt(),xn(r),ct(!1),bi(t,e)}finally{ct(i),Qe(n)}}var It=new Map;function Ai(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){Jt();var f=void 0,h=Fn(()=>{var c=r??e.appendChild(Jr());ns(c,{pending:()=>{}},_=>{$r({});var b=I;if(s&&(b.c=s),n&&(i.$$events=n),J&&kt(_,null),f=t(_,i)||Ft(),J&&(C.nodes.end=K,K===null||K.nodeType!==8||K.data!=="]"))throw Pt(),be;kr()},o);var d=new Set,v=_=>{for(var b=0;b<_.length;b++){var E=_[b];if(!d.has(E)){d.add(E);var X=ts(E);for(const V of[e,document]){var M=It.get(V);M===void 0&&(M=new Map,It.set(V,M));var G=M.get(E);G===void 0?(V.addEventListener(E,vi,{passive:X}),M.set(E,1)):M.set(E,G+1)}}}};return v(qi(Xn)),di.add(v),()=>{for(var _ of d)for(const X of[e,document]){var b=It.get(X),E=b.get(_);--E==0?(X.removeEventListener(_,vi),b.delete(_),b.size===0&&It.delete(X)):b.set(_,E)}di.delete(v),c!==r&&c.parentNode?.removeChild(c)}});return lr.set(f,h),f}var lr=new WeakMap;function fs(t,e){const r=lr.get(t);return r?(lr.delete(t),r(e)):Promise.resolve()}var Ei,je=new WeakMap,Ot=new WeakMap,or=new WeakMap,wi=new WeakSet,Ci=class{constructor(t){qt(this,wi),w(this,je,new WeakMap),w(this,Ot,void 0),w(this,or,void 0),g(or,this,t)}observe(t,e){var r=l(je,this).get(t)||new Set;return r.add(e),l(je,this).set(t,r),p(wi,this,cs).call(this).observe(t,l(or,this)),()=>{var i=l(je,this).get(t);i.delete(e),i.size===0&&(l(je,this).delete(t),l(Ot,this).unobserve(t))}}};Ei=Ci;function cs(){return l(Ot,this)??g(Ot,this,new ResizeObserver(t=>{for(var e of t){Ei.entries.set(e.target,e);for(var r of l(je,this).get(e.target)||[])r(e)}}))}u(Ci,"entries",new WeakMap);function ur(t,e){return t===e||t?.[Je]===e}function hs(t=Ft(),e,r,i){var n=I.r,s=C;return Gn(()=>{var a,o;return er(()=>{a=o,o=i?.()||[],lt(()=>{ur(r(...o),t)||(e(t,...o),a&&ur(r(...a),t)&&e(null,...a))})}),()=>{let f=s;for(;f!==n&&f.parent!==null&&f.parent.f&33554432;)f=f.parent;const h=()=>{o&&ur(r(...o),t)&&e(null,...o)},c=f.teardown;f.teardown=()=>{h(),c?.()}}}),t}var Mt=!1;function ds(t){var e=Mt;try{return Mt=!1,[t(),Mt]}finally{Mt=e}}function ze(t,e,r,i){var n=!ht||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,f=!0,h=void 0,c=()=>a&&n?(h??(h=_t(i)),S(h)):(f&&(f=!1,o=a?lt(i):i),o);let d;if(s){var v=Je in t||Er in t;d=Ae(t,e)?.set??(v&&e in t?x=>t[e]=x:void 0)}var _,b=!1;s?[_,b]=ds(()=>t[e]):_=t[e],_===void 0&&i!==void 0&&(_=c(),d&&(n&&_n(e),d(_)));var E;if(n?E=()=>{var x=t[e];return x===void 0?c():(f=!0,x)}:E=()=>{var x=t[e];return x!==void 0&&(o=void 0),x===void 0?o:x},n&&(r&4)===0)return E;if(d){var X=t.$$legacy;return(function(x,Se){return arguments.length>0?((!n||!Se||X||b)&&d(Se?E():x),x):E()})}var M=!1,G=((r&1)!==0?_t:wn)(()=>(M=!1,E()));s&&S(G);var V=C;return(function(x,Se){if(arguments.length>0){const y=Se?S(G):n&&s?Ge(x):x;return N(G,y),M=!0,o!==void 0&&(o=y),x}return fe&&M||(V.f&16384)!==0?G.v:S(G)})}function vs(t){return new ps(t)}var Ne=new WeakMap,le=new WeakMap,ps=class{constructor(t){w(this,Ne,void 0),w(this,le,void 0);var e=new Map,r=(n,s)=>{var a=Mn(s,!1,!1);return e.set(n,a),a};const i=new Proxy({...t.props||{},$$events:{}},{get(n,s){return S(e.get(s)??r(s,Reflect.get(n,s)))},has(n,s){return s===Er?!0:(S(e.get(s)??r(s,Reflect.get(n,s))),Reflect.has(n,s))},set(n,s,a){return N(e.get(s)??r(s,a),a),Reflect.set(n,s,a)}});g(le,this,(t.hydrate?us:bi)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),!Ee&&(!t?.props?.$$host||t.sync===!1)&&pe(),g(Ne,this,i.$$events);for(const n of Object.keys(l(le,this)))n==="$set"||n==="$destroy"||n==="$on"||Ye(this,n,{get(){return l(le,this)[n]},set(s){l(le,this)[n]=s},enumerable:!0});l(le,this).$set=n=>{Object.assign(i,n)},l(le,this).$destroy=()=>{fs(l(le,this))}}$set(t){l(le,this).$set(t)}$on(t,e){l(Ne,this)[t]=l(Ne,this)[t]||[];const r=(...i)=>e.call(this,...i);return l(Ne,this)[t].push(r),()=>{l(Ne,this)[t]=l(Ne,this)[t].filter(i=>i!==r)}}$destroy(){l(le,this).$destroy()}},Ti;typeof HTMLElement=="function"&&(Ti=class extends HTMLElement{constructor(t,e,r){super(),u(this,"$$ctor",void 0),u(this,"$$s",void 0),u(this,"$$c",void 0),u(this,"$$cn",!1),u(this,"$$d",{}),u(this,"$$r",!1),u(this,"$$p_d",{}),u(this,"$$l",{}),u(this,"$$l_u",new Map),u(this,"$$me",void 0),u(this,"$$shadowRoot",null),this.$$ctor=t,this.$$s=e,r&&(this.$$shadowRoot=this.attachShadow(r))}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const i=this.$$c.$on(t,e);this.$$l_u.set(e,i)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){const i=this.$$l_u.get(e);i&&(i(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(i){return n=>{const s=Qr("slot");i!=="default"&&(s.name=i),pi(n,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},r=_s(this);for(const i of this.$$s)i in r&&(i==="default"&&!this.$$d.children?(this.$$d.children=t(i),e.default=!0):e[i]=t(i));for(const i of this.attributes){const n=this.$$g_p(i.name);n in this.$$d||(this.$$d[n]=Ht(n,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=vs({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Pn(()=>{er(()=>{this.$$r=!0;for(const i of ut(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const n=Ht(i,this.$$d[i],this.$$p_d,"toAttribute");n==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,n)}this.$$r=!1})});for(const i in this.$$l)for(const n of this.$$l[i]){const s=this.$$c.$on(i,n);this.$$l_u.set(n,s)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Ht(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return ut(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Ht(t,e,r,i){const n=r[t]?.type;if(e=n==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!r[t])return e;if(i==="toAttribute")switch(n){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(n){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function _s(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}function ms(t,e,r,i,n,s){let a=class extends Ti{constructor(){super(t,r,n),this.$$p_d=e}static get observedAttributes(){return ut(e).map(o=>(e[o].attribute||o).toLowerCase())}};return ut(e).forEach(o=>{Ye(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(f){f=Ht(o,f,e),this.$$d[o]=f;var h=this.$$c;h&&(Ae(h,o)?.get?h[o]=f:h.$set({[o]:f}))}})}),i.forEach(o=>{Ye(a.prototype,o,{get(){return this.$$c?.[o]}})}),s&&(a=s(a)),t.element=a,a}var $i,oe=class z{findChoices(e){e.setAttribute(z.ROOT_HOOK_ATTR,"true");const r=Array.from(e.querySelectorAll(z.CHOICE_SELECTOR));for(const i of r)this.annotateChoice(i);return this.annotateFeedbackTicks(e),r}createChoiceRange(e){const r=this.resolveLabelElement(e);if(!r)return null;const i=document.createRange();return i.selectNodeContents(r),i}getChoiceId(e){const r=e.querySelector('input[type="checkbox"], input[type="radio"]');return r?.getAttribute("value")||r?.id||this.generateFallbackId(e)}getChoiceLabel(e){return this.resolveLabelElement(e)?.textContent?.trim()||""}isSelected(e){const r=e.querySelector('input[type="checkbox"], input[type="radio"]');return r?r.checked||r.getAttribute("aria-checked")==="true":!1}canEliminate(e){const r=e.querySelector('input[type="checkbox"], input[type="radio"]');return!(!r||this.isSelected(e)||r.disabled||(e.closest(`[${z.ROOT_HOOK_ATTR}="true"]`)||e.closest("multiple-choice"))?.querySelector(`[${z.FEEDBACK_HOOK_ATTR}="true"]`))}setSelectable(e,r){const i=e.querySelector('input[type="checkbox"], input[type="radio"]');if(!i)return;i.disabled=!r,r?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true");const n=i.closest(z.MUI_BUTTON_SELECTOR);n&&n.classList.toggle(z.MUI_DISABLED_CLASS,!r)}generateFallbackId(e){const r=(e.closest(`[${z.ROOT_HOOK_ATTR}="true"]`)||e.closest("multiple-choice"))?.querySelectorAll(`[${z.CHOICE_HOOK_ATTR}="true"]`)||[];return`choice-${Array.from(r).indexOf(e)}`}annotateChoice(e){e.setAttribute(z.CHOICE_HOOK_ATTR,"true");const r=this.resolveLabelElement(e);r&&r.setAttribute(z.LABEL_HOOK_ATTR,"true")}resolveLabelElement(e){return e.querySelector(`[${z.LABEL_HOOK_ATTR}="true"]`)||e.querySelector("label")||e.querySelector("span")}annotateFeedbackTicks(e){for(const r of e.querySelectorAll(".feedback-tick"))r.setAttribute(z.FEEDBACK_HOOK_ATTR,"true")}};$i=oe,u(oe,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice"),u(oe,"LABEL_HOOK_ATTR","data-pie-answer-eliminator-label"),u(oe,"ROOT_HOOK_ATTR","data-pie-answer-eliminator-root"),u(oe,"FEEDBACK_HOOK_ATTR","data-pie-answer-eliminator-feedback-tick"),u(oe,"CHOICE_SELECTOR",`[${$i.CHOICE_HOOK_ATTR}="true"], .corespring-checkbox, .corespring-radio-button`),u(oe,"MUI_BUTTON_SELECTOR",".MuiButtonBase-root, .MuiRadio-root, .MuiCheckbox-root"),u(oe,"MUI_DISABLED_CLASS","Mui-disabled");var gs="ebsr-multiple-choice",ki=t=>t instanceof HTMLElement&&Gi(t.tagName.toLowerCase()).baseName===gs,Li=(t,e)=>Array.from(t.querySelectorAll(`[id="${e}"]`)).find(ki)??null,ys=t=>{let e=t.parentElement;for(;e!==null;){if(ki(e))return e;e=e.parentElement}return null},Ss=class{constructor(){u(this,"mcAdapter",new oe)}findChoices(t){const e=Li(t,"a"),r=Li(t,"b"),i=[];return e&&i.push(...this.mcAdapter.findChoices(e)),r&&i.push(...this.mcAdapter.findChoices(r)),i}createChoiceRange(t){return this.mcAdapter.createChoiceRange(t)}getChoiceId(t){return`${ys(t)?.id||"unknown"}-${this.mcAdapter.getChoiceId(t)}`}getChoiceLabel(t){return this.mcAdapter.getChoiceLabel(t)}isSelected(t){return this.mcAdapter.isSelected(t)}canEliminate(t){return this.mcAdapter.canEliminate(t)}setSelectable(t,e){this.mcAdapter.setSelectable(t,e)}},Ri="answer-masking",bs="data-pie-answer-eliminator-choice",As="data-pie-answer-eliminator-label";function Ii(t){if(!t.localName.includes("-"))return null;try{const e=t.constructor.pieSupports;return Array.isArray(e)?e:null}catch{return null}}function Es(t){const e=[];for(const r of[t,...t.querySelectorAll("*")])Ii(r)&&(e.some(i=>i.contains(r))||e.push(r));return e}function xt(t,e,r){try{return t()}catch(i){return console.error(`[AnswerEliminator] ${r} threw:`,i),e}}function ws(t){if(!t||typeof t!="object")return null;const e=t,{id:r,label:i,container:n,content:s}=e,{isSelected:a,isEliminable:o,setEliminated:f}=e;return typeof r!="string"||!r||typeof i!="string"||!(n instanceof HTMLElement)||!(s instanceof Element)||!n.contains(s)||typeof a!="function"||typeof o!="function"||typeof f!="function"?null:{target:{id:r,label:i.trim()||s.textContent?.trim()||"",container:n,createRange(){const h=document.createRange();return h.selectNodeContents(s),h},isSelected:()=>xt(()=>a.call(t)===!0,!1,"isSelected"),canEliminate:()=>xt(()=>o.call(t)===!0,!1,"isEliminable"),setEliminated:h=>xt(()=>f.call(t,h),void 0,"setEliminated")},content:s}}function Oi(t,e){t.getAttribute(e)!=="true"&&t.setAttribute(e,"true")}function Cs(t){if(!Ii(t)?.includes("answer-masking"))return[];const e=t.pieSupportTargets;if(typeof e!="function")return console.warn(`[AnswerEliminator] <${t.localName}> declares ${Ri} but has no pieSupportTargets()`),[];const r=xt(()=>e.call(t,Ri),[],`<${t.localName}>.pieSupportTargets`);if(!Array.isArray(r))return[];const i=[],n=new Set;for(const s of r){const a=ws(s);if(!a||n.has(a.target.id)){console.warn(`[AnswerEliminator] <${t.localName}> supplied a choice that is malformed or repeats an id`,s);continue}const{target:o,content:f}=a;n.add(o.id),Oi(o.container,bs),Oi(f,As),i.push({target:o,owner:t})}return i}var Ts=[new Ss,new oe];function $s(t,e){return{id:e.getChoiceId(t),label:e.getChoiceLabel(t),container:t,createRange:()=>e.createChoiceRange(t),isSelected:()=>e.isSelected(t),canEliminate:()=>e.canEliminate(t),setEliminated:r=>e.setSelectable(t,!r)}}function ks(t,e,r){const i=[],n=new Set(r.map(({target:s})=>s.container));for(const s of Ts)for(const a of s.findChoices(t))n.has(a)||(n.add(a),!e.some(o=>o.contains(a))&&i.push({target:$s(a,s),owner:null}));return i}function Mi(t){const e=Es(t),r=e.flatMap(Cs);return[...r,...ks(t,e,r)]}var Hi=()=>({eliminatedText:"(eliminated)",stamp:()=>{}}),ce=class R{constructor(){u(this,"name","mask"),u(this,"highlights",new Map),u(this,"ranges",new Map),u(this,"fallbackContainers",new Map),u(this,"chrome",Hi())}initialize(){}setChrome(e){this.chrome=e;const r=[...Array.from(this.ranges.values(),i=>this.findChoiceContainer(i)),...this.fallbackContainers.values()];for(const i of r){const n=i?.querySelector(`.${R.SR_CLASS}`);n&&this.labelAnnouncement(n)}}labelAnnouncement(e){e.textContent=` ${this.chrome.eliminatedText}`,this.chrome.stamp(e)}destroy(){this.clearAll()}apply(e,r){if(!this.isSupported()){this.applyFallback(e,r);return}this.injectHighlightCSS(e);const i=new Highlight(r);CSS.highlights.set(`${R.HIGHLIGHT_NAME_PREFIX}${e}`,i),this.highlights.set(e,i),this.ranges.set(e,r),this.addAriaAttributes(r)}remove(e){if(!this.isSupported()){this.removeFallback(e);return}CSS.highlights.delete(`${R.HIGHLIGHT_NAME_PREFIX}${e}`),this.removeHighlightCSS(e);const r=this.ranges.get(e);r&&this.removeAriaAttributes(r),this.highlights.delete(e),this.ranges.delete(e),this.fallbackContainers.delete(e)}isEliminated(e){return this.highlights.has(e)||this.fallbackContainers.has(e)}clearAll(){for(const e of this.getEliminatedIds())this.remove(e);this.fallbackContainers.clear()}getEliminatedIds(){return Array.from(new Set([...this.highlights.keys(),...this.fallbackContainers.keys()]))}isSupported(){return typeof CSS<"u"&&"highlights"in CSS}injectHighlightCSS(e){const r=`${R.HIGHLIGHT_STYLE_PREFIX}${e}`;if(document.getElementById(r))return;const i=document.createElement("style");i.id=r,i.textContent=`
3
+ ::highlight(${R.HIGHLIGHT_NAME_PREFIX}${e}) {
2175
4
  opacity: 0.2;
2176
5
  filter: blur(2px);
2177
6
  }
2178
- `, document.head.appendChild(n);
2179
- }
2180
- removeHighlightCSS(e) {
2181
- document.getElementById(`${B.HIGHLIGHT_STYLE_PREFIX}${e}`)?.remove();
2182
- }
2183
- addAriaAttributes(e) {
2184
- const r = this.findChoiceContainer(e);
2185
- r && (r.setAttribute(B.ELIMINATED_ATTR, "true"), r.setAttribute("aria-hidden", "true"));
2186
- }
2187
- removeAriaAttributes(e) {
2188
- const r = this.findChoiceContainer(e);
2189
- r && (r.removeAttribute(B.ELIMINATED_ATTR), r.removeAttribute("aria-hidden"));
2190
- }
2191
- findChoiceContainer(e) {
2192
- let r = e.startContainer;
2193
- for (r.nodeType === Node.TEXT_NODE && (r = r.parentElement); r && r !== document.body; ) {
2194
- if (r.getAttribute(B.CHOICE_HOOK_ATTR) === "true") return r;
2195
- r = r.parentElement;
2196
- }
2197
- return null;
2198
- }
2199
- applyFallback(e, r) {
2200
- const n = this.findChoiceContainer(r);
2201
- n && (n.classList.add(B.FALLBACK_CLASS), n.setAttribute(B.ELIMINATED_ATTR, "true"), n.setAttribute(B.ELIMINATED_ID_ATTR, e), this.fallbackContainers.set(e, n), this.addAriaAttributes(r));
2202
- }
2203
- removeFallback(e) {
2204
- const r = this.fallbackContainers.get(e);
2205
- if (!r) return;
2206
- r.classList.remove(B.FALLBACK_CLASS), r.removeAttribute(B.ELIMINATED_ATTR), r.removeAttribute(B.ELIMINATED_ID_ATTR);
2207
- const n = document.createRange();
2208
- n.selectNodeContents(r), this.removeAriaAttributes(n), this.fallbackContainers.delete(e);
2209
- }
2210
- };
2211
- o(xe, "HIGHLIGHT_STYLE_PREFIX", "pie-answer-eliminator-mask-highlight-");
2212
- o(xe, "HIGHLIGHT_NAME_PREFIX", "pie-answer-masked-");
2213
- o(xe, "FALLBACK_CLASS", "pie-answer-masked-fallback");
2214
- o(xe, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice");
2215
- o(xe, "ELIMINATED_ATTR", "data-pie-answer-eliminated");
2216
- o(xe, "ELIMINATED_ID_ATTR", "data-pie-answer-eliminated-id");
2217
- var k = class y {
2218
- constructor() {
2219
- o(this, "name", "strikethrough"), o(this, "highlights", /* @__PURE__ */ new Map()), o(this, "ranges", /* @__PURE__ */ new Map()), o(this, "fallbackContainers", /* @__PURE__ */ new Map()), o(this, "imageWrappers", /* @__PURE__ */ new Map()), o(this, "mathTargets", /* @__PURE__ */ new Map());
2220
- }
2221
- initialize() {
2222
- this.isSupported() || console.warn("CSS Custom Highlight API not supported, using fallback");
2223
- }
2224
- destroy() {
2225
- this.clearAll();
2226
- }
2227
- apply(e, r) {
2228
- if (this.isSupported()) {
2229
- this.injectHighlightCSS(e);
2230
- const n = new Highlight(r);
2231
- CSS.highlights.set(`${y.HIGHLIGHT_NAME_PREFIX}${e}`, n), this.highlights.set(e, n), this.ranges.set(e, r), this.addAriaAttributes(r);
2232
- } else this.applyFallback(e, r);
2233
- this.strikeImages(e, r), this.strikeMath(e, r);
2234
- }
2235
- remove(e) {
2236
- if (this.unstrikeImages(e), this.unstrikeMath(e), !this.isSupported()) {
2237
- this.removeFallback(e);
2238
- return;
2239
- }
2240
- CSS.highlights.delete(`${y.HIGHLIGHT_NAME_PREFIX}${e}`), this.removeHighlightCSS(e);
2241
- const r = this.ranges.get(e);
2242
- r && this.removeAriaAttributes(r), this.highlights.delete(e), this.ranges.delete(e), this.fallbackContainers.delete(e);
2243
- }
2244
- isEliminated(e) {
2245
- return this.highlights.has(e) || this.fallbackContainers.has(e);
2246
- }
2247
- clearAll() {
2248
- const e = /* @__PURE__ */ new Set([
2249
- ...this.highlights.keys(),
2250
- ...this.fallbackContainers.keys(),
2251
- ...this.imageWrappers.keys(),
2252
- ...this.mathTargets.keys()
2253
- ]);
2254
- for (const r of e) this.remove(r);
2255
- this.fallbackContainers.clear(), this.imageWrappers.clear(), this.mathTargets.clear();
2256
- }
2257
- getEliminatedIds() {
2258
- return Array.from(/* @__PURE__ */ new Set([...this.highlights.keys(), ...this.fallbackContainers.keys()]));
2259
- }
2260
- isSupported() {
2261
- return typeof CSS < "u" && "highlights" in CSS;
2262
- }
2263
- injectHighlightCSS(e) {
2264
- const r = `${y.HIGHLIGHT_STYLE_PREFIX}${e}`;
2265
- if (document.getElementById(r)) return;
2266
- const n = document.createElement("style");
2267
- n.id = r, n.textContent = `
2268
- ::highlight(${y.HIGHLIGHT_NAME_PREFIX}${e}) {
7
+ `,document.head.appendChild(i)}removeHighlightCSS(e){document.getElementById(`${R.HIGHLIGHT_STYLE_PREFIX}${e}`)?.remove()}addAriaAttributes(e){const r=this.findChoiceContainer(e);if(!r)return;r.setAttribute(R.ELIMINATED_ATTR,"true"),r.setAttribute("aria-disabled","true");const i=this.resolveLabelElement(r);if(i&&!i.querySelector(`.${R.SR_CLASS}`)){const n=document.createElement("span");n.className=R.SR_CLASS,this.labelAnnouncement(n),i.appendChild(n)}}removeAriaAttributes(e){const r=this.findChoiceContainer(e);r&&(r.removeAttribute(R.ELIMINATED_ATTR),r.removeAttribute("aria-disabled"),r.querySelector(`.${R.SR_CLASS}`)?.remove())}resolveLabelElement(e){return e.querySelector(`[${R.LABEL_HOOK_ATTR}="true"]`)||e.querySelector("label")}findChoiceContainer(e){let r=e.startContainer;for(r.nodeType===Node.TEXT_NODE&&(r=r.parentElement);r&&r!==document.body;){if(r.getAttribute(R.CHOICE_HOOK_ATTR)==="true")return r;r=r.parentElement}return null}applyFallback(e,r){const i=this.findChoiceContainer(r);i&&(i.classList.add(R.FALLBACK_CLASS),i.setAttribute(R.ELIMINATED_ATTR,"true"),i.setAttribute(R.ELIMINATED_ID_ATTR,e),this.fallbackContainers.set(e,i),this.addAriaAttributes(r))}removeFallback(e){const r=this.fallbackContainers.get(e);if(!r)return;r.classList.remove(R.FALLBACK_CLASS),r.removeAttribute(R.ELIMINATED_ATTR),r.removeAttribute(R.ELIMINATED_ID_ATTR);const i=document.createRange();i.selectNodeContents(r),this.removeAriaAttributes(i),this.fallbackContainers.delete(e)}};u(ce,"HIGHLIGHT_STYLE_PREFIX","pie-answer-eliminator-mask-highlight-"),u(ce,"HIGHLIGHT_NAME_PREFIX","pie-answer-masked-"),u(ce,"FALLBACK_CLASS","pie-answer-masked-fallback"),u(ce,"SR_CLASS","pie-answer-eliminator-sr-announcement"),u(ce,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice"),u(ce,"LABEL_HOOK_ATTR","data-pie-answer-eliminator-label"),u(ce,"ELIMINATED_ATTR","data-pie-answer-eliminated"),u(ce,"ELIMINATED_ID_ATTR","data-pie-answer-eliminated-id");var L=class m{constructor(){u(this,"name","strikethrough"),u(this,"highlights",new Map),u(this,"ranges",new Map),u(this,"fallbackContainers",new Map),u(this,"imageWrappers",new Map),u(this,"mathTargets",new Map),u(this,"chrome",Hi())}initialize(){this.isSupported()||console.warn("CSS Custom Highlight API not supported, using fallback")}destroy(){this.clearAll()}setChrome(e){this.chrome=e;const r=[...Array.from(this.ranges.values(),i=>this.findChoiceContainer(i)),...this.fallbackContainers.values()];for(const i of r){const n=i?.querySelector(`.${m.SR_CLASS}`);n&&this.labelAnnouncement(n)}}labelAnnouncement(e){e.textContent=` ${this.chrome.eliminatedText}`,this.chrome.stamp(e)}apply(e,r){if(this.isSupported()){this.injectHighlightCSS(e);const i=new Highlight(r);CSS.highlights.set(`${m.HIGHLIGHT_NAME_PREFIX}${e}`,i),this.highlights.set(e,i),this.ranges.set(e,r),this.addAriaAttributes(r)}else this.applyFallback(e,r);this.strikeImages(e,r),this.strikeMath(e,r)}remove(e){if(this.unstrikeImages(e),this.unstrikeMath(e),!this.isSupported()){this.removeFallback(e);return}CSS.highlights.delete(`${m.HIGHLIGHT_NAME_PREFIX}${e}`),this.removeHighlightCSS(e);const r=this.ranges.get(e);r&&this.removeAriaAttributes(r),this.highlights.delete(e),this.ranges.delete(e),this.fallbackContainers.delete(e)}isEliminated(e){return this.highlights.has(e)||this.fallbackContainers.has(e)}clearAll(){const e=new Set([...this.highlights.keys(),...this.fallbackContainers.keys(),...this.imageWrappers.keys(),...this.mathTargets.keys()]);for(const r of e)this.remove(r);this.fallbackContainers.clear(),this.imageWrappers.clear(),this.mathTargets.clear()}getEliminatedIds(){return Array.from(new Set([...this.highlights.keys(),...this.fallbackContainers.keys()]))}isSupported(){return typeof CSS<"u"&&"highlights"in CSS}injectHighlightCSS(e){const r=`${m.HIGHLIGHT_STYLE_PREFIX}${e}`;if(document.getElementById(r))return;const i=document.createElement("style");i.id=r,i.textContent=`
8
+ ::highlight(${m.HIGHLIGHT_NAME_PREFIX}${e}) {
2269
9
  text-decoration: line-through;
2270
10
  text-decoration-thickness: 2px;
2271
11
  text-decoration-color: var(--pie-answer-eliminator-strike-color, var(--pie-incorrect, #ff9800));
2272
12
  }
2273
- `, document.head.appendChild(n);
2274
- }
2275
- removeHighlightCSS(e) {
2276
- document.getElementById(`${y.HIGHLIGHT_STYLE_PREFIX}${e}`)?.remove();
2277
- }
2278
- addAriaAttributes(e) {
2279
- const r = this.findChoiceContainer(e);
2280
- if (!r) return;
2281
- r.setAttribute(y.ELIMINATED_ATTR, "true"), r.setAttribute("aria-disabled", "true");
2282
- const n = this.resolveLabelElement(r);
2283
- if (n && !n.querySelector(`.${y.SR_CLASS}`)) {
2284
- const i = document.createElement("span");
2285
- i.className = y.SR_CLASS, i.textContent = " (eliminated)", n.appendChild(i);
2286
- }
2287
- }
2288
- removeAriaAttributes(e) {
2289
- const r = this.findChoiceContainer(e);
2290
- r && (r.removeAttribute(y.ELIMINATED_ATTR), r.removeAttribute("aria-disabled"), r.querySelector(`.${y.SR_CLASS}`)?.remove());
2291
- }
2292
- findChoiceContainer(e) {
2293
- let r = e.startContainer;
2294
- for (r.nodeType === Node.TEXT_NODE && (r = r.parentElement); r && r !== document.body; ) {
2295
- if (r.getAttribute(y.CHOICE_HOOK_ATTR) === "true") return r;
2296
- r = r.parentElement;
2297
- }
2298
- return null;
2299
- }
2300
- applyFallback(e, r) {
2301
- const n = this.findChoiceContainer(r);
2302
- n && (n.classList.add(y.FALLBACK_CLASS), n.setAttribute(y.ELIMINATED_ATTR, "true"), n.setAttribute(y.ELIMINATED_ID_ATTR, e), this.fallbackContainers.set(e, n), this.addAriaAttributes(r));
2303
- }
2304
- removeFallback(e) {
2305
- const r = this.fallbackContainers.get(e);
2306
- if (!r) return;
2307
- r.classList.remove(y.FALLBACK_CLASS), r.removeAttribute(y.ELIMINATED_ATTR), r.removeAttribute(y.ELIMINATED_ID_ATTR);
2308
- const n = document.createRange();
2309
- n.selectNodeContents(r), this.removeAriaAttributes(n), this.fallbackContainers.delete(e);
2310
- }
2311
- strikeImages(e, r) {
2312
- const n = this.resolveImageScope(r);
2313
- if (!n) return;
2314
- const i = [];
2315
- for (const s of Array.from(n.querySelectorAll("img"))) {
2316
- const l = this.wrapImage(s);
2317
- l && i.push(l);
2318
- }
2319
- i.length > 0 && this.imageWrappers.set(e, i);
2320
- }
2321
- unstrikeImages(e) {
2322
- const r = this.imageWrappers.get(e);
2323
- if (r) {
2324
- for (const n of r) this.unwrapImage(n);
2325
- this.imageWrappers.delete(e);
2326
- }
2327
- }
2328
- strikeMath(e, r) {
2329
- const n = this.resolveImageScope(r);
2330
- if (!n) return;
2331
- const i = [];
2332
- for (const s of n.querySelectorAll(y.MATH_SELECTOR)) {
2333
- const l = s.querySelector(y.MATH_BOX_SELECTOR) ?? s, u = !!l.querySelector(y.MATH_STACKED_SELECTOR);
2334
- l.classList.add(y.MATH_STRIKE_CLASS, u ? y.MATH_STRIKE_CROSS_CLASS : y.MATH_STRIKE_LINE_CLASS), l.setAttribute(y.MATH_STRIKE_ATTR, u ? "cross" : "line"), i.push(l);
2335
- }
2336
- i.length > 0 && this.mathTargets.set(e, i);
2337
- }
2338
- unstrikeMath(e) {
2339
- const r = this.mathTargets.get(e);
2340
- if (r) {
2341
- for (const n of r)
2342
- n.classList.remove(y.MATH_STRIKE_CLASS, y.MATH_STRIKE_LINE_CLASS, y.MATH_STRIKE_CROSS_CLASS), n.removeAttribute(y.MATH_STRIKE_ATTR);
2343
- this.mathTargets.delete(e);
2344
- }
2345
- }
2346
- resolveImageScope(e) {
2347
- const r = e.commonAncestorContainer;
2348
- return (r.nodeType === Node.TEXT_NODE ? r.parentElement : r) ?? this.findChoiceContainer(e);
2349
- }
2350
- wrapImage(e) {
2351
- const r = e.parentElement;
2352
- if (!r) return null;
2353
- if (r.classList.contains(y.IMAGE_WRAPPER_CLASS) || r.hasAttribute(y.IMAGE_WRAPPER_ATTR)) return r;
2354
- const n = document.createElement("span");
2355
- return n.className = y.IMAGE_WRAPPER_CLASS, n.setAttribute(y.IMAGE_WRAPPER_ATTR, "true"), this.fillsParentWidth(e, r) ? n.style.display = "block" : y.BLOCK_DISPLAYS.has(getComputedStyle(e).display) && (n.style.display = "block", n.style.width = "fit-content"), r.insertBefore(n, e), n.appendChild(e), n.appendChild(this.createImageStrikeOverlay()), n;
2356
- }
2357
- fillsParentWidth(e, r) {
2358
- const n = e.getBoundingClientRect().width, i = r.clientWidth;
2359
- return n === 0 || i === 0 ? !1 : n >= i - 1;
2360
- }
2361
- unwrapImage(e) {
2362
- e.querySelector(`.${y.IMAGE_OVERLAY_CLASS}`)?.remove();
2363
- const r = e.parentElement;
2364
- if (r) {
2365
- for (; e.firstChild; ) r.insertBefore(e.firstChild, e);
2366
- e.remove();
2367
- }
2368
- }
2369
- createImageStrikeOverlay() {
2370
- const e = document.createElementNS(y.SVG_NS, "svg");
2371
- e.setAttribute("class", y.IMAGE_OVERLAY_CLASS), e.setAttribute("viewBox", "0 0 100 100"), e.setAttribute("preserveAspectRatio", "none"), e.setAttribute("aria-hidden", "true"), e.setAttribute("focusable", "false");
2372
- const r = [{
2373
- x1: "0",
2374
- y1: "0",
2375
- x2: "100",
2376
- y2: "100"
2377
- }, {
2378
- x1: "0",
2379
- y1: "100",
2380
- x2: "100",
2381
- y2: "0"
2382
- }];
2383
- for (const n of [y.IMAGE_CASING_CLASS, y.IMAGE_LINE_CLASS]) for (const { x1: i, y1: s, x2: l, y2: u } of r) {
2384
- const h = document.createElementNS(y.SVG_NS, "line");
2385
- h.setAttribute("class", n), h.setAttribute("x1", i), h.setAttribute("y1", s), h.setAttribute("x2", l), h.setAttribute("y2", u), h.setAttribute("vector-effect", "non-scaling-stroke"), e.appendChild(h);
2386
- }
2387
- return e;
2388
- }
2389
- resolveLabelElement(e) {
2390
- return e.querySelector(`[${y.LABEL_HOOK_ATTR}="true"]`) || e.querySelector("label");
2391
- }
2392
- };
2393
- o(k, "HIGHLIGHT_STYLE_PREFIX", "pie-answer-eliminator-highlight-");
2394
- o(k, "HIGHLIGHT_NAME_PREFIX", "pie-answer-eliminated-");
2395
- o(k, "FALLBACK_CLASS", "pie-answer-eliminator-eliminated-fallback");
2396
- o(k, "SR_CLASS", "pie-answer-eliminator-sr-announcement");
2397
- o(k, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice");
2398
- o(k, "LABEL_HOOK_ATTR", "data-pie-answer-eliminator-label");
2399
- o(k, "ELIMINATED_ATTR", "data-pie-answer-eliminated");
2400
- o(k, "ELIMINATED_ID_ATTR", "data-pie-answer-eliminated-id");
2401
- o(k, "IMAGE_WRAPPER_CLASS", "pie-answer-eliminator-image-strike");
2402
- o(k, "IMAGE_WRAPPER_ATTR", "data-pie-answer-eliminator-image-strike");
2403
- o(k, "IMAGE_OVERLAY_CLASS", "pie-answer-eliminator-image-strike-overlay");
2404
- o(k, "IMAGE_LINE_CLASS", "pie-answer-eliminator-image-strike-line");
2405
- o(k, "IMAGE_CASING_CLASS", "pie-answer-eliminator-image-strike-casing");
2406
- o(k, "MATH_STRIKE_CLASS", "pie-answer-eliminator-math-strike");
2407
- o(k, "MATH_STRIKE_LINE_CLASS", "pie-answer-eliminator-math-strike--line");
2408
- o(k, "MATH_STRIKE_CROSS_CLASS", "pie-answer-eliminator-math-strike--cross");
2409
- o(k, "MATH_STRIKE_ATTR", "data-pie-answer-eliminator-math-strike");
2410
- o(k, "MATH_STACKED_SELECTOR", "mjx-mfrac, mjx-mtable");
2411
- o(k, "MATH_BOX_SELECTOR", "mjx-math");
2412
- o(k, "MATH_SELECTOR", "mjx-container");
2413
- o(k, "SVG_NS", "http://www.w3.org/2000/svg");
2414
- o(k, "BLOCK_DISPLAYS", /* @__PURE__ */ new Set([
2415
- "block",
2416
- "flex",
2417
- "grid",
2418
- "table",
2419
- "flow-root",
2420
- "list-item"
2421
- ]));
2422
- var Ir = "answerEliminator", cr = class mt {
2423
- constructor(e = "strikethrough", r = "right") {
2424
- o(this, "registry", void 0), o(this, "strategy", void 0), o(this, "choices", /* @__PURE__ */ new Map()), o(this, "eliminated", /* @__PURE__ */ new Set()), o(this, "strategyKeys", /* @__PURE__ */ new Map()), o(this, "anonymousGroups", /* @__PURE__ */ new WeakMap()), o(this, "nextToken", 0), o(this, "buttonAlignment", "right"), o(this, "shouldRestoreState", !0), o(this, "active", !0), o(this, "questionRoot", null), o(this, "selectionChangeHandler", null), o(this, "selectionObserver", null), o(this, "selectionRefreshFrame", null), o(this, "store", null), o(this, "elementStateKeys", {}), this.registry = new As(), this.strategy = this.createStrategy(e), this.strategy.initialize(), this.buttonAlignment = r;
2425
- }
2426
- createStrategy(e) {
2427
- return e === "mask" ? new xe() : new k();
2428
- }
2429
- initializeForQuestion(e) {
2430
- this.active = !0;
2431
- const r = new Set(this.eliminated);
2432
- this.restoreAllSelectable(), this.strategy.clearAll(), this.eliminated.clear(), this.cleanupButtons();
2433
- const n = this.registry.findAllChoicesWithAdapters(e);
2434
- for (const { choice: s, adapter: l } of n) this.initializeChoice(s, l, e);
2435
- const i = this.readPersistedEliminations();
2436
- for (const [s, l] of this.choices) (i.has(l.group) ? i.get(l.group)?.has(l.choiceId) : r.has(s)) && this.applyElimination(s, l);
2437
- this.attachSelectionListener(e);
2438
- }
2439
- trackingKey(e, r) {
2440
- return `${e}\0${r}`;
2441
- }
2442
- resolveGroup(e, r) {
2443
- let n = null;
2444
- for (let l = e.parentElement; l !== null; l = l === r ? null : l.parentElement) {
2445
- if (l.id && Object.hasOwn(this.elementStateKeys, l.id)) return l.id;
2446
- n === null && l.localName.includes("-") && (n = l);
2447
- }
2448
- const i = n ?? r;
2449
- let s = this.anonymousGroups.get(i);
2450
- return s || (s = `\0anonymous-${this.nextToken++}`, this.anonymousGroups.set(i, s)), s;
2451
- }
2452
- strategyKeyFor(e) {
2453
- let r = this.strategyKeys.get(e);
2454
- return r || (r = `choice-${this.nextToken++}`, this.strategyKeys.set(e, r)), r;
2455
- }
2456
- initializeChoice(e, r, n) {
2457
- const i = r.getChoiceId(e), s = this.resolveGroup(e, n), l = this.trackingKey(s, i), u = {
2458
- choiceId: i,
2459
- group: s,
2460
- strategyKey: this.strategyKeyFor(l),
2461
- element: e,
2462
- adapter: r,
2463
- button: null
2464
- };
2465
- this.choices.set(l, u);
2466
- const h = this.createToggleButton(l, u);
2467
- u.button = h, this.updateButtonVisibility(l);
2468
- const b = r.getButtonContainer(e);
2469
- b && (b.style.position = "relative", b.appendChild(h));
2470
- }
2471
- createToggleButton(e, r) {
2472
- const n = r.adapter.getChoiceLabel(r.element), i = document.createElement("button");
2473
- i.type = "button", i.className = mt.TOGGLE_CLASS, i.setAttribute("aria-label", `Toggle elimination for ${n}`), i.setAttribute("aria-pressed", "false"), i.setAttribute("data-choice-id", r.choiceId);
2474
- const s = document.createElement("span");
2475
- return s.setAttribute("aria-hidden", "true"), s.textContent = "⊗", i.appendChild(s), this.applyButtonAlignment(i), i.dataset.pieShownDisplay = i.style.display, i.addEventListener("click", (l) => {
2476
- l.preventDefault(), l.stopPropagation(), this.toggleElimination(e);
2477
- }), i;
2478
- }
2479
- toggleElimination(e) {
2480
- const r = this.choices.get(e);
2481
- if (r) {
2482
- if (this.eliminated.has(e)) this.restoreChoice(e);
2483
- else {
2484
- if (!r.adapter.canEliminate(r.element)) {
2485
- console.warn("Cannot eliminate this choice (already selected or in evaluate mode)");
2486
- return;
2487
- }
2488
- if (!this.applyElimination(e, r)) {
2489
- console.error("Failed to create range for choice");
2490
- return;
2491
- }
2492
- }
2493
- this.saveState(r.group);
2494
- }
2495
- }
2496
- applyElimination(e, r) {
2497
- if (r.adapter.isSelected?.(r.element)) return !1;
2498
- const n = r.adapter.createChoiceRange(r.element);
2499
- return n ? (this.strategy.apply(r.strategyKey, n), this.eliminated.add(e), r.adapter.setSelectable?.(r.element, !1), r.button && (r.button.classList.add(mt.TOGGLE_ACTIVE_CLASS), r.button.setAttribute("aria-pressed", "true")), this.updateButtonVisibility(e), !0) : !1;
2500
- }
2501
- restoreChoice(e) {
2502
- const r = this.choices.get(e);
2503
- this.eliminated.delete(e), r && (this.strategy.remove(r.strategyKey), r.adapter.setSelectable?.(r.element, !0), r.button && (r.button.classList.remove(mt.TOGGLE_ACTIVE_CLASS), r.button.setAttribute("aria-pressed", "false")), this.updateButtonVisibility(e));
2504
- }
2505
- resetAll() {
2506
- if (this.eliminated.size === 0) return;
2507
- const e = /* @__PURE__ */ new Set();
2508
- for (const r of Array.from(this.eliminated)) {
2509
- const n = this.choices.get(r)?.group;
2510
- n !== void 0 && e.add(n), this.restoreChoice(r);
2511
- }
2512
- for (const r of e) this.saveState(r);
2513
- }
2514
- getEliminatedCount() {
2515
- return this.eliminated.size;
2516
- }
2517
- setStoreIntegration(e, r) {
2518
- this.store = e, this.elementStateKeys = r;
2519
- }
2520
- saveState(e) {
2521
- if (!this.store || !Object.hasOwn(this.elementStateKeys, e)) return;
2522
- const r = [];
2523
- for (const n of this.eliminated) {
2524
- const i = this.choices.get(n);
2525
- i?.group === e && r.push(i.choiceId);
2526
- }
2527
- this.store.setState(this.elementStateKeys[e], Ir, { eliminatedChoices: r });
2528
- }
2529
- readPersistedEliminations() {
2530
- const e = /* @__PURE__ */ new Map();
2531
- if (!this.store || !this.shouldRestoreState) return e;
2532
- for (const { group: r } of this.choices.values())
2533
- if (!(e.has(r) || !Object.hasOwn(this.elementStateKeys, r)))
2534
- try {
2535
- const n = this.store.getState(this.elementStateKeys[r], Ir), i = Array.isArray(n?.eliminatedChoices) ? n.eliminatedChoices.filter((s) => typeof s == "string") : [];
2536
- e.set(r, new Set(i));
2537
- } catch (n) {
2538
- console.error("Failed to restore eliminator state:", n);
2539
- }
2540
- return e;
2541
- }
2542
- restoreAllSelectable() {
2543
- for (const e of this.eliminated) {
2544
- const r = this.choices.get(e);
2545
- r?.adapter.setSelectable?.(r.element, !0);
2546
- }
2547
- }
2548
- setButtonHidden(e, r) {
2549
- const n = r ? "none" : e.dataset.pieShownDisplay ?? "";
2550
- e.style.display !== n && (e.style.display = n);
2551
- }
2552
- shouldHideButton(e, r) {
2553
- return this.eliminated.has(e) ? !1 : this.active ? r.adapter.isSelected?.(r.element) ?? !1 : !0;
2554
- }
2555
- updateButtonVisibility(e) {
2556
- const r = this.choices.get(e);
2557
- r?.button && this.setButtonHidden(r.button, this.shouldHideButton(e, r));
2558
- }
2559
- refreshSelectionState() {
2560
- for (const e of this.choices.keys()) this.updateButtonVisibility(e);
2561
- }
2562
- scheduleSelectionRefresh() {
2563
- this.selectionRefreshFrame === null && (this.selectionRefreshFrame = requestAnimationFrame(() => {
2564
- this.selectionRefreshFrame = null, this.refreshSelectionState();
2565
- }));
2566
- }
2567
- attachSelectionListener(e) {
2568
- this.detachSelectionListener(), this.questionRoot = e, this.selectionChangeHandler = () => this.scheduleSelectionRefresh(), e.addEventListener("change", this.selectionChangeHandler), typeof MutationObserver < "u" && (this.selectionObserver = new MutationObserver((r) => {
2569
- const n = /* @__PURE__ */ new Set();
2570
- for (const { button: i } of this.choices.values()) i && n.add(i);
2571
- r.some((i) => !n.has(i.target)) && this.scheduleSelectionRefresh();
2572
- }), this.selectionObserver.observe(e, {
2573
- subtree: !0,
2574
- childList: !0,
2575
- attributes: !0
2576
- }));
2577
- }
2578
- detachSelectionListener() {
2579
- this.selectionRefreshFrame !== null && (cancelAnimationFrame(this.selectionRefreshFrame), this.selectionRefreshFrame = null), this.selectionObserver && (this.selectionObserver.disconnect(), this.selectionObserver = null), this.questionRoot && this.selectionChangeHandler && this.questionRoot.removeEventListener("change", this.selectionChangeHandler), this.questionRoot = null, this.selectionChangeHandler = null;
2580
- }
2581
- cleanupButtons() {
2582
- this.detachSelectionListener();
2583
- for (const { button: e } of this.choices.values()) e?.remove();
2584
- this.choices.clear();
2585
- }
2586
- applyButtonAlignment(e) {
2587
- switch (this.buttonAlignment) {
2588
- case "right":
2589
- Object.assign(e.style, {
2590
- position: "absolute",
2591
- right: "8px",
2592
- top: "50%",
2593
- transform: "translateY(-50%)"
2594
- });
2595
- break;
2596
- case "left":
2597
- Object.assign(e.style, {
2598
- position: "absolute",
2599
- left: "8px",
2600
- top: "50%",
2601
- transform: "translateY(-50%)"
2602
- });
2603
- break;
2604
- case "inline":
2605
- Object.assign(e.style, {
2606
- position: "relative",
2607
- marginLeft: "8px",
2608
- marginRight: "8px",
2609
- display: "inline-flex",
2610
- verticalAlign: "middle"
2611
- });
2612
- }
2613
- }
2614
- enableStateRestoration() {
2615
- this.shouldRestoreState = !0;
2616
- }
2617
- disableStateRestoration() {
2618
- this.shouldRestoreState = !1;
2619
- }
2620
- cleanup() {
2621
- this.active = !1, this.refreshSelectionState();
2622
- }
2623
- destroy() {
2624
- this.restoreAllSelectable(), this.eliminated.clear(), this.cleanupButtons(), this.strategy.destroy();
2625
- }
2626
- };
2627
- o(cr, "TOGGLE_CLASS", "pie-answer-eliminator-toggle");
2628
- o(cr, "TOGGLE_ACTIVE_CLASS", "pie-answer-eliminator-toggle--active");
2629
- var Es = /* @__PURE__ */ Ji('<div style="display: none;" aria-hidden="true"></div>');
2630
- function Ts(t, e) {
2631
- Dr(e, !0);
2632
- let r = Ye(e, "visible", 7, !1), n = Ye(e, "strategy", 7, "strikethrough"), i = Ye(e, "alwaysOn", 7, !1), s = Ye(e, "buttonAlignment", 7, "right"), l = Ye(e, "elementStateKeys", 23, () => ({})), u = /* @__PURE__ */ D(null), h = /* @__PURE__ */ D(null), b = /* @__PURE__ */ D(null);
2633
- const v = /* @__PURE__ */ gr(() => A(h)?.elementToolStateStore ?? null);
2634
- let f = /* @__PURE__ */ D(null), d = /* @__PURE__ */ D(null), c = /* @__PURE__ */ gr(() => i() || r());
2635
- Ne(() => {
2636
- if (A(u))
2637
- return Hn(A(u), (w) => {
2638
- P(h, w, !0);
2639
- });
2640
- }), Ne(() => {
2641
- if (A(u))
2642
- return Nn(A(u), (w) => {
2643
- P(b, w, !0);
2644
- });
2645
- });
2646
- function _() {
2647
- return A(b)?.scopeElement || null;
2648
- }
2649
- function p() {
2650
- if (!A(c) || !A(f)) return;
2651
- const w = _();
2652
- if (!w) {
2653
- console.warn("[AnswerEliminator] Missing shell scope context for question root");
2654
- return;
2655
- }
2656
- A(f).initializeForQuestion(w);
2657
- }
2658
- function R() {
2659
- requestAnimationFrame(() => {
2660
- requestAnimationFrame(() => {
2661
- p();
2662
- });
2663
- });
2664
- }
2665
- Ne(() => {
2666
- A(f)?.setStoreIntegration(A(v), l() ?? {});
2667
- }), Ne(() => {
2668
- const w = new cr(n(), s());
2669
- return Bt(() => {
2670
- w.setStoreIntegration(A(v), l() ?? {}), P(f, w, !0), A(c) ? p() : w.cleanup();
2671
- }), () => {
2672
- w.destroy(), A(f) === w && P(f, null);
2673
- };
2674
- }), Ne(() => {
2675
- const w = A(b)?.contextVersion ?? null;
2676
- if (w !== null) {
2677
- if (A(d) === null) {
2678
- P(d, w, !0);
2679
- return;
2680
- }
2681
- w !== A(d) && (P(d, w, !0), R());
2682
- }
2683
- }), Ne(() => {
2684
- A(f) && (A(c) ? (A(f).enableStateRestoration(), p()) : A(f).cleanup());
2685
- });
2686
- var L = {
2687
- get visible() {
2688
- return r();
2689
- },
2690
- set visible(w = !1) {
2691
- r(w), Fe();
2692
- },
2693
- get strategy() {
2694
- return n();
2695
- },
2696
- set strategy(w = "strikethrough") {
2697
- n(w), Fe();
2698
- },
2699
- get alwaysOn() {
2700
- return i();
2701
- },
2702
- set alwaysOn(w = !1) {
2703
- i(w), Fe();
2704
- },
2705
- get buttonAlignment() {
2706
- return s();
2707
- },
2708
- set buttonAlignment(w = "right") {
2709
- s(w), Fe();
2710
- },
2711
- get elementStateKeys() {
2712
- return l();
2713
- },
2714
- set elementStateKeys(w = {}) {
2715
- l(w), Fe();
2716
- }
2717
- }, x = Es();
2718
- return ds(x, (w) => P(u, w), () => A(u)), En(t, x), jr(L);
2719
- }
2720
- $s("pie-tool-answer-eliminator", gs(Ts, {
2721
- visible: {
2722
- attribute: "visible",
2723
- type: "Boolean"
2724
- },
2725
- strategy: {
2726
- attribute: "strategy",
2727
- type: "String"
2728
- },
2729
- alwaysOn: {
2730
- attribute: "always-on",
2731
- type: "Boolean"
2732
- },
2733
- buttonAlignment: {
2734
- attribute: "button-alignment",
2735
- type: "String"
2736
- },
2737
- elementStateKeys: { type: "Object" }
2738
- }, [], [], { mode: "open" }, xn));
2739
- function $s(t, e) {
2740
- customElements.get(t) || customElements.define(t, e);
2741
- }
2742
- export {
2743
- Ts as default
2744
- };
13
+ `,document.head.appendChild(i)}removeHighlightCSS(e){document.getElementById(`${m.HIGHLIGHT_STYLE_PREFIX}${e}`)?.remove()}addAriaAttributes(e){const r=this.findChoiceContainer(e);if(!r)return;r.setAttribute(m.ELIMINATED_ATTR,"true"),r.setAttribute("aria-disabled","true");const i=this.resolveLabelElement(r);if(i&&!i.querySelector(`.${m.SR_CLASS}`)){const n=document.createElement("span");n.className=m.SR_CLASS,this.labelAnnouncement(n),i.appendChild(n)}}removeAriaAttributes(e){const r=this.findChoiceContainer(e);r&&(r.removeAttribute(m.ELIMINATED_ATTR),r.removeAttribute("aria-disabled"),r.querySelector(`.${m.SR_CLASS}`)?.remove())}findChoiceContainer(e){let r=e.startContainer;for(r.nodeType===Node.TEXT_NODE&&(r=r.parentElement);r&&r!==document.body;){if(r.getAttribute(m.CHOICE_HOOK_ATTR)==="true")return r;r=r.parentElement}return null}applyFallback(e,r){const i=this.findChoiceContainer(r);i&&(i.classList.add(m.FALLBACK_CLASS),i.setAttribute(m.ELIMINATED_ATTR,"true"),i.setAttribute(m.ELIMINATED_ID_ATTR,e),this.fallbackContainers.set(e,i),this.addAriaAttributes(r))}removeFallback(e){const r=this.fallbackContainers.get(e);if(!r)return;r.classList.remove(m.FALLBACK_CLASS),r.removeAttribute(m.ELIMINATED_ATTR),r.removeAttribute(m.ELIMINATED_ID_ATTR);const i=document.createRange();i.selectNodeContents(r),this.removeAriaAttributes(i),this.fallbackContainers.delete(e)}strikeImages(e,r){const i=this.resolveImageScope(r);if(!i)return;const n=[];for(const s of Array.from(i.querySelectorAll("img"))){const a=this.wrapImage(s);a&&n.push(a)}n.length>0&&this.imageWrappers.set(e,n)}unstrikeImages(e){const r=this.imageWrappers.get(e);if(r){for(const i of r)this.unwrapImage(i);this.imageWrappers.delete(e)}}strikeMath(e,r){const i=this.resolveImageScope(r);if(!i)return;const n=[];for(const s of i.querySelectorAll(m.MATH_SELECTOR)){const a=s.querySelector(m.MATH_BOX_SELECTOR)??s,o=!!a.querySelector(m.MATH_STACKED_SELECTOR);a.classList.add(m.MATH_STRIKE_CLASS,o?m.MATH_STRIKE_CROSS_CLASS:m.MATH_STRIKE_LINE_CLASS),a.setAttribute(m.MATH_STRIKE_ATTR,o?"cross":"line"),n.push(a)}n.length>0&&this.mathTargets.set(e,n)}unstrikeMath(e){const r=this.mathTargets.get(e);if(r){for(const i of r)i.classList.remove(m.MATH_STRIKE_CLASS,m.MATH_STRIKE_LINE_CLASS,m.MATH_STRIKE_CROSS_CLASS),i.removeAttribute(m.MATH_STRIKE_ATTR);this.mathTargets.delete(e)}}resolveImageScope(e){const r=e.commonAncestorContainer;return(r.nodeType===Node.TEXT_NODE?r.parentElement:r)??this.findChoiceContainer(e)}wrapImage(e){const r=e.parentElement;if(!r)return null;if(r.classList.contains(m.IMAGE_WRAPPER_CLASS)||r.hasAttribute(m.IMAGE_WRAPPER_ATTR))return r;const i=document.createElement("span");return i.className=m.IMAGE_WRAPPER_CLASS,i.setAttribute(m.IMAGE_WRAPPER_ATTR,"true"),this.fillsParentWidth(e,r)?i.style.display="block":m.BLOCK_DISPLAYS.has(getComputedStyle(e).display)&&(i.style.display="block",i.style.width="fit-content"),r.insertBefore(i,e),i.appendChild(e),i.appendChild(this.createImageStrikeOverlay()),i}fillsParentWidth(e,r){const i=e.getBoundingClientRect().width,n=r.clientWidth;return i===0||n===0?!1:i>=n-1}unwrapImage(e){e.querySelector(`.${m.IMAGE_OVERLAY_CLASS}`)?.remove();const r=e.parentElement;if(r){for(;e.firstChild;)r.insertBefore(e.firstChild,e);e.remove()}}createImageStrikeOverlay(){const e=document.createElementNS(m.SVG_NS,"svg");e.setAttribute("class",m.IMAGE_OVERLAY_CLASS),e.setAttribute("viewBox","0 0 100 100"),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");const r=[{x1:"0",y1:"0",x2:"100",y2:"100"},{x1:"0",y1:"100",x2:"100",y2:"0"}];for(const i of[m.IMAGE_CASING_CLASS,m.IMAGE_LINE_CLASS])for(const{x1:n,y1:s,x2:a,y2:o}of r){const f=document.createElementNS(m.SVG_NS,"line");f.setAttribute("class",i),f.setAttribute("x1",n),f.setAttribute("y1",s),f.setAttribute("x2",a),f.setAttribute("y2",o),f.setAttribute("vector-effect","non-scaling-stroke"),e.appendChild(f)}return e}resolveLabelElement(e){return e.querySelector(`[${m.LABEL_HOOK_ATTR}="true"]`)||e.querySelector("label")}};u(L,"HIGHLIGHT_STYLE_PREFIX","pie-answer-eliminator-highlight-"),u(L,"HIGHLIGHT_NAME_PREFIX","pie-answer-eliminated-"),u(L,"FALLBACK_CLASS","pie-answer-eliminator-eliminated-fallback"),u(L,"SR_CLASS","pie-answer-eliminator-sr-announcement"),u(L,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice"),u(L,"LABEL_HOOK_ATTR","data-pie-answer-eliminator-label"),u(L,"ELIMINATED_ATTR","data-pie-answer-eliminated"),u(L,"ELIMINATED_ID_ATTR","data-pie-answer-eliminated-id"),u(L,"IMAGE_WRAPPER_CLASS","pie-answer-eliminator-image-strike"),u(L,"IMAGE_WRAPPER_ATTR","data-pie-answer-eliminator-image-strike"),u(L,"IMAGE_OVERLAY_CLASS","pie-answer-eliminator-image-strike-overlay"),u(L,"IMAGE_LINE_CLASS","pie-answer-eliminator-image-strike-line"),u(L,"IMAGE_CASING_CLASS","pie-answer-eliminator-image-strike-casing"),u(L,"MATH_STRIKE_CLASS","pie-answer-eliminator-math-strike"),u(L,"MATH_STRIKE_LINE_CLASS","pie-answer-eliminator-math-strike--line"),u(L,"MATH_STRIKE_CROSS_CLASS","pie-answer-eliminator-math-strike--cross"),u(L,"MATH_STRIKE_ATTR","data-pie-answer-eliminator-math-strike"),u(L,"MATH_STACKED_SELECTOR","mjx-mfrac, mjx-mtable"),u(L,"MATH_BOX_SELECTOR","mjx-math"),u(L,"MATH_SELECTOR","mjx-container"),u(L,"SVG_NS","http://www.w3.org/2000/svg"),u(L,"BLOCK_DISPLAYS",new Set(["block","flex","grid","table","flow-root","list-item"]));function Ls(t){switch(t){case"start":case"left":return"start";case"end":case"right":return"end";default:return"inline"}}var xi="answerEliminator",fr=class Nt{constructor(e="strikethrough",r="inline"){u(this,"strategy",void 0),u(this,"choices",new Map),u(this,"eliminated",new Set),u(this,"strategyKeys",new Map),u(this,"anonymousGroups",new WeakMap),u(this,"nextToken",0),u(this,"buttonAlignment","inline"),u(this,"i18n",Kt(null)),u(this,"shouldRestoreState",!0),u(this,"active",!0),u(this,"questionRoot",null),u(this,"selectionChangeHandler",null),u(this,"selectionObserver",null),u(this,"selectionRefreshFrame",null),u(this,"focusedKey",null),u(this,"store",null),u(this,"elementStateKeys",{}),u(this,"elementIds",null),this.strategy=this.createStrategy(e),this.strategy.initialize(),this.applyStrategyChrome(),this.buttonAlignment=Ls(r)}setInterfaceI18n(e){this.i18n=e??Kt(null);for(const r of this.choices.values())r.button&&this.labelToggle(r.button,r);this.applyStrategyChrome()}applyStrategyChrome(){this.strategy.setChrome?.({eliminatedText:this.i18n.t("tools.answerEliminator.eliminatedA11y"),stamp:e=>hr(e,this.i18n)})}labelToggle(e,r){const i=r.target.label||this.i18n.t("tools.answerEliminator.unlabeledChoice");e.setAttribute("aria-label",this.i18n.t("tools.answerEliminator.toggleA11y",{choice:i})),hr(e,this.i18n)}createStrategy(e){return e==="mask"?new ce:new L}initializeForQuestion(e){this.active=!0;const r=new Set(this.eliminated);this.restoreAllSelectable(),this.strategy.clearAll(),this.eliminated.clear(),this.cleanupButtons();for(const n of Mi(e))this.initializeChoice(n,e);const i=this.readPersistedEliminations();for(const[n,s]of this.choices)(i.has(s.group)?i.get(s.group)?.has(s.choiceId):r.has(n))&&this.applyElimination(n,s);this.attachSelectionListener(e)}trackingKey(e,r){return`${e}\0${r}`}resolveGroup({target:e,owner:r},i){let n=r;for(let o=r??e.container.parentElement;o!==null;o=o===i?null:o.parentElement){if(o.id&&Object.hasOwn(this.elementStateKeys,o.id))return o.id;n===null&&o.localName.includes("-")&&(n=o)}const s=n??i;let a=this.anonymousGroups.get(s);return a||(a=`\0anonymous-${this.nextToken++}`,this.anonymousGroups.set(s,a)),a}isEligible({target:e,owner:r},i){const n=this.elementIds;if(n===null)return!0;for(let s=r??e.container;s!==null;s=s===i?null:s.parentElement)if(s.id&&n.has(s.id))return!0;return!1}strategyKeyFor(e){let r=this.strategyKeys.get(e);return r||(r=`choice-${this.nextToken++}`,this.strategyKeys.set(e,r)),r}initializeChoice(e,r){if(!this.isEligible(e,r))return;const{target:i,owner:n}=e,s=i.id,a=this.resolveGroup(e,r),o=this.trackingKey(a,s),f={choiceId:s,group:a,strategyKey:this.strategyKeyFor(o),target:i,owner:n,button:null};this.choices.set(o,f);const h=this.createToggleButton(o,f,this.alignmentFor(i.container));f.button=h,this.updateButtonVisibility(o),i.container.style.position="relative",i.container.appendChild(h)}alignmentFor(e){return this.buttonAlignment==="inline"||getComputedStyle(e).display==="inline"?"inline":this.buttonAlignment}createToggleButton(e,r,i){const n=document.createElement("button");n.type="button",n.className=Nt.TOGGLE_CLASS,this.labelToggle(n,r),n.setAttribute("aria-pressed","false"),n.setAttribute("data-choice-id",r.choiceId);const s=document.createElement("span");return s.setAttribute("aria-hidden","true"),s.textContent="⊗",n.appendChild(s),this.applyButtonAlignment(n,i,r.target.container),n.dataset.pieShownDisplay=n.style.display,n.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.toggleElimination(e)}),n.addEventListener("focus",()=>{this.focusedKey=e}),n.addEventListener("blur",()=>{queueMicrotask(()=>{n.isConnected&&this.focusedKey===e&&(this.focusedKey=null)})}),n}toggleElimination(e){const r=this.choices.get(e);if(r){if(this.eliminated.has(e))this.restoreChoice(e);else{if(!r.target.canEliminate()){console.warn("Cannot eliminate this choice (already selected or in evaluate mode)");return}if(!this.applyElimination(e,r)){console.error("Failed to create range for choice");return}}this.saveState(r.group)}}applyElimination(e,r,i=!0){if(r.target.isSelected())return!1;const n=r.target.createRange();return n?(this.strategy.apply(r.strategyKey,n),this.eliminated.add(e),i&&r.target.setEliminated(!0),r.button&&(r.button.classList.add(Nt.TOGGLE_ACTIVE_CLASS),r.button.setAttribute("aria-pressed","true")),this.updateButtonVisibility(e),!0):!1}restoreChoice(e){const r=this.choices.get(e);this.eliminated.delete(e),r&&(this.strategy.remove(r.strategyKey),r.target.setEliminated(!1),r.button&&(r.button.classList.remove(Nt.TOGGLE_ACTIVE_CLASS),r.button.setAttribute("aria-pressed","false")),this.updateButtonVisibility(e))}resetAll(){if(this.eliminated.size===0)return;const e=new Set;for(const r of Array.from(this.eliminated)){const i=this.choices.get(r)?.group;i!==void 0&&e.add(i),this.restoreChoice(r)}for(const r of e)this.saveState(r)}getEliminatedCount(){return this.eliminated.size}setElementIds(e){this.elementIds=e?new Set(e):null}setStoreIntegration(e,r){this.store=e,this.elementStateKeys=r}saveState(e){if(!this.store||!Object.hasOwn(this.elementStateKeys,e))return;const r=[];for(const i of this.eliminated){const n=this.choices.get(i);n?.group===e&&r.push(n.choiceId)}this.store.setState(this.elementStateKeys[e],xi,{eliminatedChoices:r})}readPersistedEliminations(){const e=new Map;if(!this.store||!this.shouldRestoreState)return e;for(const{group:r}of this.choices.values())if(!(e.has(r)||!Object.hasOwn(this.elementStateKeys,r)))try{const i=this.store.getState(this.elementStateKeys[r],xi),n=Array.isArray(i?.eliminatedChoices)?i.eliminatedChoices.filter(s=>typeof s=="string"):[];e.set(r,new Set(n))}catch(i){console.error("Failed to restore eliminator state:",i)}return e}restoreAllSelectable(){for(const e of this.eliminated)this.choices.get(e)?.target.setEliminated(!1)}setButtonHidden(e,r){const i=r?"none":e.dataset.pieShownDisplay??"";e.style.display!==i&&(e.style.display=i)}shouldHideButton(e,r){return this.eliminated.has(e)?!1:this.active?r.target.isSelected():!0}updateButtonVisibility(e){const r=this.choices.get(e);r?.button&&this.setButtonHidden(r.button,this.shouldHideButton(e,r))}refreshSelectionState(){for(const e of this.choices.keys())this.updateButtonVisibility(e)}hasDetachedChoice(){for(const{target:e}of this.choices.values())if(!e.container.isConnected)return!0;return!1}rescan(){const e=this.questionRoot;if(!e)return;const r=this.focusedKey!==null&&!this.choices.get(this.focusedKey)?.button?.isConnected&&(document.activeElement===null||document.activeElement===document.body)?this.focusedKey:null,i=this.choices,n=new Set(this.eliminated);this.strategy.clearAll(),this.eliminated.clear();for(const{button:s}of i.values())s?.remove();this.choices=new Map;for(const s of Mi(e))this.initializeChoice(s,e);for(const s of n){const a=i.get(s),o=this.choices.get(s),f=!!a?.owner&&o?.owner===a.owner;o&&this.applyElimination(s,o,!f)||(o??a)?.target.setEliminated(!1)}r&&this.choices.get(r)?.button?.focus({preventScroll:!0})}scheduleSelectionRefresh(){this.selectionRefreshFrame===null&&(this.selectionRefreshFrame=requestAnimationFrame(()=>{this.selectionRefreshFrame=null,this.refreshSelectionState()}))}attachSelectionListener(e){this.detachSelectionListener(),this.questionRoot=e,this.selectionChangeHandler=()=>this.scheduleSelectionRefresh(),e.addEventListener("change",this.selectionChangeHandler),typeof MutationObserver<"u"&&(this.selectionObserver=new MutationObserver(r=>{const i=new Set;for(const{button:n}of this.choices.values())n&&i.add(n);r.some(n=>!i.has(n.target))&&(this.hasDetachedChoice()?this.rescan():this.scheduleSelectionRefresh())}),this.selectionObserver.observe(e,{subtree:!0,childList:!0,attributes:!0}))}detachSelectionListener(){this.selectionRefreshFrame!==null&&(cancelAnimationFrame(this.selectionRefreshFrame),this.selectionRefreshFrame=null),this.selectionObserver&&(this.selectionObserver.disconnect(),this.selectionObserver=null),this.questionRoot&&this.selectionChangeHandler&&this.questionRoot.removeEventListener("change",this.selectionChangeHandler),this.questionRoot=null,this.selectionChangeHandler=null}cleanupButtons(){this.detachSelectionListener(),this.focusedKey=null;for(const{button:e}of this.choices.values())e?.remove();this.choices.clear()}applyButtonAlignment(e,r,i){switch(r){case"start":case"end":{const n=getComputedStyle(i).direction==="rtl",s=r==="end"===n?"left":"right";Object.assign(e.style,{position:"absolute",[s]:"8px",top:"50%",transform:"translateY(-50%)"});break}case"inline":Object.assign(e.style,{position:"relative",marginLeft:"8px",marginRight:"8px",display:"inline-flex",verticalAlign:"middle"})}}enableStateRestoration(){this.shouldRestoreState=!0}disableStateRestoration(){this.shouldRestoreState=!1}cleanup(){this.active=!1,this.refreshSelectionState()}destroy(){this.restoreAllSelectable(),this.eliminated.clear(),this.cleanupButtons(),this.strategy.destroy()}};u(fr,"TOGGLE_CLASS","pie-answer-eliminator-toggle"),u(fr,"TOGGLE_ACTIVE_CLASS","pie-answer-eliminator-toggle--active");var Rs=Zn('<div style="display: none;" aria-hidden="true"></div>');function Ni(t,e){$r(e,!0);let r=ze(e,"visible",7,!1),i=ze(e,"strategy",7,"strikethrough"),n=ze(e,"alwaysOn",7,!1),s=ze(e,"buttonAlignment",7,"inline"),a=ze(e,"elementStateKeys",23,()=>({})),o=ze(e,"elementIds",7,void 0),f=W(null),h=W(null),c=W(null);const d=Dt(()=>S(h)?.elementToolStateStore??null);let v=W(null);const _=Dt(()=>Kt(S(h)));let b=W(null),E=Dt(()=>n()||r());me(()=>{if(S(f))return Pi(S(f),y=>{N(h,y,!0)})}),me(()=>{if(S(f))return Fi(S(f),y=>{N(c,y,!0)})});function X(){return S(c)?.scopeElement||null}function M(){if(!S(E)||!S(v))return;const y=X();if(!y){console.warn("[AnswerEliminator] Missing shell scope context for question root");return}S(v).initializeForQuestion(y)}function G(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{M()})})}me(()=>{S(v)?.setInterfaceI18n(S(_))}),me(()=>{S(v)?.setStoreIntegration(S(d),a()??{})});let V=null;me(()=>{const y=o()?[...o()]:null,cr=y?JSON.stringify(y):null;lt(()=>{S(v)&&(S(v).setElementIds(y),cr!==V&&(V=cr,M()))})}),me(()=>{const y=new fr(i(),s());return lt(()=>{y.setStoreIntegration(S(d),a()??{}),y.setElementIds(o()?[...o()]:null),y.setInterfaceI18n(S(_)),N(v,y,!0),S(E)?M():y.cleanup()}),()=>{y.destroy(),S(v)===y&&N(v,null)}}),me(()=>{const y=S(c)?.contextVersion??null;if(y!==null){if(S(b)===null){N(b,y,!0);return}y!==S(b)&&(N(b,y,!0),G())}}),me(()=>{S(v)&&(S(E)?(S(v).enableStateRestoration(),M()):S(v).cleanup())});var x={get visible(){return r()},set visible(y=!1){r(y),pe()},get strategy(){return i()},set strategy(y="strikethrough"){i(y),pe()},get alwaysOn(){return n()},set alwaysOn(y=!1){n(y),pe()},get buttonAlignment(){return s()},set buttonAlignment(y="inline"){s(y),pe()},get elementStateKeys(){return a()},set elementStateKeys(y={}){a(y),pe()},get elementIds(){return o()},set elementIds(y=void 0){o(y),pe()}},Se=Rs();return hs(Se,y=>N(f,y),()=>S(f)),pi(t,Se),kr(x)}Is("pie-tool-answer-eliminator",ms(Ni,{visible:{attribute:"visible",type:"Boolean"},strategy:{attribute:"strategy",type:"String"},alwaysOn:{attribute:"always-on",type:"Boolean"},buttonAlignment:{attribute:"button-alignment",type:"String"},elementStateKeys:{type:"Object"},elementIds:{type:"Array"}},[],[],{mode:"open"},Bi));function Is(t,e){customElements.get(t)||customElements.define(t,e)}export{Ni as default};