@pie-players/pie-tool-answer-eliminator 1.0.0-beta.1 → 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,2790 +1,13 @@
1
- import { coerceBooleanAttributes as Bn } from "@pie-players/pie-players-shared/ui/attribute-coercion";
2
- import { connectToolRuntimeContext as Fn, connectToolShellContext as Gn } from "@pie-players/pie-assessment-toolkit/tools/registration";
3
- import { parseVersionedTagName as Dn } 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 yt = {}, N = /* @__PURE__ */ Symbol("uninitialized");
9
- var Wn = Array.isArray, jn = Array.prototype.indexOf, bt = Array.prototype.includes, qn = Array.from, wt = Object.keys, Ze = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, Yn = Object.prototype, zn = Array.prototype, Vn = Object.getPrototypeOf, vr = Object.isExtensible, Xn = () => {
10
- };
11
- function Un(t) {
12
- for (var e = 0; e < t.length; e++) t[e]();
13
- }
14
- function Qn() {
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 Jn(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 = Jn(t, "string");
44
- return et(e) == "symbol" ? e : e + "";
45
- }
46
- function u(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 Gs = 1 << 24, ne = 1024, V = 2048, Oe = 4096, Nr = 8192, ei = 16384, Pr = 32768, _r = 1 << 25, Kr = 65536, Ds = 1 << 17, Ws = 1 << 18, st = 1 << 19, ti = 1 << 20, pr = 1 << 21, js = 1 << 22, Br = 1 << 23, Ue = /* @__PURE__ */ Symbol("$state"), Fr = /* @__PURE__ */ Symbol("component"), Gr = /* @__PURE__ */ Symbol("legacy props"), ri = /* @__PURE__ */ Symbol("proxy path"), ni = /* @__PURE__ */ Symbol("attributes"), ii = /* @__PURE__ */ Symbol("class"), si = /* @__PURE__ */ Symbol("style"), ai = /* @__PURE__ */ Symbol("text"), It = new class extends Error {
55
- constructor(...e) {
56
- super(...e), u(this, "name", "StaleReactionError"), u(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
57
- }
58
- }(), Ys = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
59
- function li() {
60
- console.warn("https://svelte.dev/e/derived_inert");
61
- }
62
- function Dr(t) {
63
- console.warn("https://svelte.dev/e/hydration_mismatch");
64
- }
65
- function oi() {
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 F;
73
- function tt(t) {
74
- if (t === null)
75
- throw Dr(), yt;
76
- return F = t;
77
- }
78
- function Wr() {
79
- return tt(/* @__PURE__ */ qe(F));
80
- }
81
- function ui(t = 1) {
82
- if (J) {
83
- for (var e = t, r = F; e--; ) r = /* @__PURE__ */ qe(r);
84
- F = r;
85
- }
86
- }
87
- function ci(t = !0) {
88
- for (var e = 0, r = F; ; ) {
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 jr(t) {
101
- return t === this.v;
102
- }
103
- function fi(t, e) {
104
- return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
105
- }
106
- function qr(t) {
107
- return !fi(t, this.v);
108
- }
109
- function hi(t) {
110
- throw new Error("https://svelte.dev/e/effect_in_teardown");
111
- }
112
- function di() {
113
- throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
114
- }
115
- function vi(t) {
116
- throw new Error("https://svelte.dev/e/effect_orphan");
117
- }
118
- function _i() {
119
- throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
120
- }
121
- function pi() {
122
- throw new Error("https://svelte.dev/e/hydration_failed");
123
- }
124
- function mi(t) {
125
- throw new Error("https://svelte.dev/e/props_invalid_value");
126
- }
127
- function gi() {
128
- throw new Error("https://svelte.dev/e/state_descriptors_fixed");
129
- }
130
- function yi() {
131
- throw new Error("https://svelte.dev/e/state_prototype_fixed");
132
- }
133
- function bi() {
134
- throw new Error("https://svelte.dev/e/state_unsafe_mutation");
135
- }
136
- function wi() {
137
- throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
138
- }
139
- var Me = !1, xt = !1;
140
- function mr(t, e) {
141
- return t.label = e, Si(t.v, e), t;
142
- }
143
- function Si(t, e) {
144
- return t?.[ri]?.(e), t;
145
- }
146
- var I = null;
147
- function St(t) {
148
- I = t;
149
- }
150
- function Yr(t, e = !1, r) {
151
- I = {
152
- p: I,
153
- i: !1,
154
- c: null,
155
- e: null,
156
- s: t,
157
- x: null,
158
- r: $,
159
- l: xt && !e ? {
160
- s: null,
161
- u: null,
162
- $: []
163
- } : null
164
- };
165
- }
166
- function zr(t) {
167
- var e = I, r = e.e;
168
- if (r !== null) {
169
- e.e = null;
170
- for (var n of r) pn(n);
171
- }
172
- return t !== void 0 && (e.x = t), e.i = !0, I = e.p, tr(t);
173
- }
174
- function tr(t = {}) {
175
- return Ze(t, Fr, { value: !0 }), t;
176
- }
177
- function Ht() {
178
- return !xt || I !== null && I.l === null;
179
- }
180
- var we = [];
181
- function Vr() {
182
- var t = we;
183
- we = [], Un(t);
184
- }
185
- function Ce(t) {
186
- if (we.length === 0 && !Qe) {
187
- var e = we;
188
- queueMicrotask(() => {
189
- e === we && Vr();
190
- });
191
- }
192
- we.push(t);
193
- }
194
- function Ai() {
195
- for (; we.length > 0; ) Vr();
196
- }
197
- var Ei = ~(V | Oe | ne);
198
- function O(t, e) {
199
- t.f = t.f & Ei | e;
200
- }
201
- function rr(t) {
202
- (t.f & 512) !== 0 || t.deps === null ? O(t, ne) : O(t, Oe);
203
- }
204
- function Xr(t, e, r) {
205
- (t.f & 2048) !== 0 ? e.add(t) : (t.f & 4096) !== 0 && r.add(t), O(t, ne);
206
- }
207
- function Nt(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 At(t) {
218
- var e = 2 | V;
219
- return $ !== null && ($.f |= st), {
220
- ctx: I,
221
- deps: null,
222
- effects: null,
223
- equals: jr,
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 Ti = /* @__PURE__ */ Symbol("obsolete");
235
- // @__NO_SIDE_EFFECTS__
236
- function gr(t) {
237
- const e = /* @__PURE__ */ At(t);
238
- return Me || bn(e), e;
239
- }
240
- // @__NO_SIDE_EFFECTS__
241
- function $i(t) {
242
- const e = /* @__PURE__ */ At(t);
243
- return e.equals = qr, e;
244
- }
245
- function ki(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 nr(t) {
253
- var e, r = $, n = t.parent;
254
- if (!fe && n !== null && t.v !== N && (n.f & 24576) !== 0)
255
- return li(), t.v;
256
- _e(n);
257
- try {
258
- ki(t), e = En(t);
259
- } finally {
260
- _e(r);
261
- }
262
- return e;
263
- }
264
- function Ur(t) {
265
- var e = nr(t);
266
- if (!t.equals(e) && (t.wv = Sn(), (!T?.is_fork || t.deps === null) && (T !== null ? (T.capture(t, e, !0), qt?.capture(t, e, !0)) : t.v = e, t.deps === null))) {
267
- O(t, ne);
268
- return;
269
- }
270
- fe || (B !== null ? (lr() || T?.is_fork) && B.set(t, e) : rr(t));
271
- }
272
- function Ci(t) {
273
- if (t.effects !== null)
274
- for (const e of t.effects) (e.teardown || e.ac) && (e.teardown?.(), e.ac !== null && Nt(() => {
275
- e.ac.abort(It), e.ac = null;
276
- }), e.fn !== null && (e.teardown = Xn), nt(e, 0), ur(e));
277
- }
278
- function Qr(t) {
279
- if (t.effects !== null)
280
- for (const e of t.effects) e.teardown && e.fn !== null && We(e);
281
- }
282
- function Jr(t, e) {
283
- if (e.has(t)) throw new TypeError("Cannot initialize the same private elements twice on an object");
284
- }
285
- function ir(t, e) {
286
- Jr(t, e), e.add(t);
287
- }
288
- function S(t, e, r) {
289
- Jr(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 Zr, Et = null, Pe = null, T = null, qt = null, B = null, Yt = null, Qe = !1, Ft = !1, rt = null, Tt = null, en = 0;
302
- var Ri = 1, $t = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), zt = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakSet(), je = class tn {
303
- constructor() {
304
- ir(this, k), u(this, "id", Ri++), S(this, $t, !1), u(this, "linked", !0), S(this, Te, null), S(this, Se, null), u(this, "async_deriveds", /* @__PURE__ */ new Map()), u(this, "current", /* @__PURE__ */ new Map()), u(this, "previous", /* @__PURE__ */ new Map()), S(this, kt, /* @__PURE__ */ new Set()), S(this, ot, /* @__PURE__ */ new Set()), S(this, Ke, 0), S(this, ye, /* @__PURE__ */ new Map()), S(this, ze, null), S(this, X, []), S(this, zt, []), S(this, Re, /* @__PURE__ */ new Set()), S(this, ce, /* @__PURE__ */ new Set()), S(this, he, /* @__PURE__ */ new Map()), S(this, dt, /* @__PURE__ */ new Set()), u(this, "is_fork", !1), S(this, Ve, !1), Pe === null ? Et = 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, V), 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]), B?.set(e, r)), this.is_fork || (e.v = r);
325
- }
326
- activate() {
327
- T = this;
328
- }
329
- deactivate() {
330
- T = null, B = null;
331
- }
332
- flush() {
333
- try {
334
- Ft = !0, T = this, g(k, this, Ct).call(this);
335
- } finally {
336
- en = 0, Yt = null, rt = null, Tt = null, Ft = !1, T = null, B = 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(Ti);
343
- g(k, this, Rt).call(this), a(ze, this)?.resolve();
344
- }
345
- register_created_effect(e) {
346
- a(zt, this).push(e);
347
- }
348
- increment(e, r) {
349
- if (m(Ke, this, a(Ke, 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(Ke, this, a(Ke, 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(Ve, this) || (m(Ve, this, !0), Ce(() => {
360
- m(Ve, 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(ce, this).add(n);
366
- e.clear(), r.clear();
367
- }
368
- oncommit(e) {
369
- a(kt, this).add(e);
370
- }
371
- ondiscard(e) {
372
- a(ot, this).add(e);
373
- }
374
- settled() {
375
- return (a(ze, this) ?? m(ze, this, Qn())).promise;
376
- }
377
- static ensure() {
378
- if (T === null) {
379
- const e = T = new tn();
380
- !Ft && !Qe && Ce(() => {
381
- a($t, e) || e.flush();
382
- });
383
- }
384
- return T;
385
- }
386
- apply() {
387
- if (!Me || !this.is_fork && a(Te, this) === null && a(Se, this) === null) {
388
- B = null;
389
- return;
390
- }
391
- B = /* @__PURE__ */ new Map();
392
- for (const [r, [n]] of this.current) B.set(r, n);
393
- for (let r = Et; 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) B.has(n) || B.set(n, i);
405
- }
406
- }
407
- schedule(e) {
408
- if (Yt = 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
- Zr = 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 rn() {
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($t, this, !0);
451
- for (const l of a(Re, this))
452
- a(ce, this).delete(l), O(l, V), this.schedule(l);
453
- for (const l of a(ce, this))
454
- O(l, Oe), this.schedule(l);
455
- this.apply();
456
- for (var t = rt = [], e = [], r = Tt = []; a(X, this).length > 0; ) {
457
- en++ > 1e3 && (g(k, this, Rt).call(this), Ii());
458
- for (const l of g(k, this, rn).call(this)) try {
459
- g(k, this, nn).call(this, l, t, e);
460
- } catch (o) {
461
- throw ln(l), g(k, this, yr).call(this) || this.discard(), o;
462
- }
463
- }
464
- if (T = null, r.length > 0) {
465
- var n = Zr.ensure();
466
- for (const l of r) n.schedule(l);
467
- }
468
- if (rt = null, Tt = null, g(k, this, yr).call(this)) {
469
- g(k, this, Xe).call(this, e), g(k, this, Xe).call(this, t);
470
- for (const [l, o] of a(he, this)) an(l, o);
471
- r.length > 0 && g(k, T, Ct).call(T);
472
- return;
473
- }
474
- const i = g(k, this, Li).call(this);
475
- if (i) {
476
- g(k, this, Xe).call(this, e), g(k, this, Xe).call(this, t), g(k, i, Oi).call(i, this);
477
- return;
478
- }
479
- a(Re, this).clear(), a(ce, this).clear();
480
- for (const l of a(kt, this)) l(this);
481
- a(kt, this).clear(), qt = this, br(e), br(t), qt = null, a(ze, this)?.resolve();
482
- var s = T;
483
- if (a(Ke, this) === 0 && (a(X, this).length === 0 || s !== null) && (g(k, this, Rt).call(this), Me && (g(k, this, Mi).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(k, s, Ct).call(s));
489
- }
490
- function nn(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) : Me && (i & 16777224) !== 0 ? r.push(n) : at(n) && ((i & 16) !== 0 && a(ce, this).add(n), We(n));
496
- var l = n.first;
497
- if (l !== null) {
498
- n = l;
499
- continue;
500
- }
501
- }
502
- for (; n !== null; ) {
503
- var o = n.next;
504
- if (o !== null) {
505
- n = o;
506
- break;
507
- }
508
- n = n.parent;
509
- }
510
- }
511
- }
512
- function Li() {
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 Oi(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(ce, 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(ce, this).delete(s), O(s, V), this.schedule(s));
538
- }
539
- }
540
- };
541
- for (const r of this.current.keys()) e(r);
542
- this.oncommit(() => t.discard()), g(k, t, Rt).call(t), T = this, g(k, this, Ct).call(this);
543
- }
544
- function Xe(t) {
545
- for (var e = 0; e < t.length; e += 1) Xr(t[e], a(Re, this), a(ce, this));
546
- }
547
- function Mi() {
548
- for (let v = Et; v !== null; v = a(Se, v)) {
549
- var t = v.id < this.id, e = [];
550
- for (const [c, [d, h]] of this.current) {
551
- if (v.current.has(c)) {
552
- var r = v.current.get(c)[0];
553
- if (t && d !== r) v.current.set(c, [d, h]);
554
- else continue;
555
- }
556
- e.push(c);
557
- }
558
- if (t) for (const [c, d] of this.async_deriveds) {
559
- const h = v.async_deriveds.get(c);
560
- h && d.promise.then(h.resolve).catch(h.reject);
561
- }
562
- var n = [...v.current.keys()].filter((c) => !v.current.get(c)[1]);
563
- if (!(!a($t, v) || n.length === 0)) {
564
- var i = n.filter((c) => !this.current.has(c));
565
- if (i.length === 0)
566
- t && v.discard();
567
- else if (e.length > 0) {
568
- if (t) for (const c of a(dt, this)) v.unskip_effect(c, (d) => {
569
- (d.f & 4194320) !== 0 ? v.schedule(d) : g(k, v, Xe).call(v, [d]);
570
- });
571
- v.activate();
572
- var s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
573
- for (var o of e) sn(o, i, s, l);
574
- l = /* @__PURE__ */ new Map();
575
- var f = [...v.current].filter(([c, d]) => {
576
- const h = this.current.get(c);
577
- return h ? h[0] !== d[0] || h[1] !== d[1] : !0;
578
- }).map(([c]) => c);
579
- if (f.length > 0)
580
- for (const c of a(zt, this)) (c.f & 155648) === 0 && sr(c, f, l) && ((c.f & 4194320) !== 0 ? (O(c, V), v.schedule(c)) : a(Re, v).add(c));
581
- if (a(X, v).length > 0 && !a(Ve, v)) {
582
- v.apply();
583
- for (var y of g(k, v, rn).call(v)) g(k, v, nn).call(v, y, [], []);
584
- }
585
- v.deactivate();
586
- }
587
- }
588
- }
589
- }
590
- function Rt() {
591
- if (this.linked) {
592
- var t = a(Te, this), e = a(Se, this);
593
- t === null ? Et = e : m(Se, t, e), e === null ? Pe = t : m(Te, e, t), this.linked = !1;
594
- }
595
- }
596
- function Be(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 (Ai(), T === null) return r;
603
- T.flush();
604
- }
605
- } finally {
606
- Qe = e;
607
- }
608
- }
609
- function Ii() {
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
- _i();
617
- } catch (r) {
618
- de(r, Yt);
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(), We(n), n.deps === null && n.first === null && n.nodes === null && n.teardown === null && n.ac === null && gn(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 o = s.length - 1; o >= 0; o--) {
636
- const f = s[o];
637
- (f.f & 24576) === 0 && We(f);
638
- }
639
- }
640
- ue.clear();
641
- }
642
- }
643
- ue = null;
644
- }
645
- }
646
- function sn(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 ? sn(i, e, r, n) : (s & 4194320) !== 0 && (s & 2048) === 0 && sr(i, e, n) && (O(i, V), ar(i));
651
- }
652
- }
653
- function sr(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 (bt.call(e, i)) return !0;
658
- if ((i.f & 2) !== 0 && sr(i, e, r))
659
- return r.set(i, !0), !0;
660
- }
661
- return r.set(t, !1), !1;
662
- }
663
- function ar(t) {
664
- T.schedule(t);
665
- }
666
- function an(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
- an(r, e), r = r.next;
671
- }
672
- }
673
- function ln(t) {
674
- O(t, ne);
675
- for (var e = t.first; e !== null; )
676
- ln(e), e = e.next;
677
- }
678
- var Lt = /* @__PURE__ */ new Set(), ae = /* @__PURE__ */ new Map();
679
- var on = !1;
680
- function Pt(t, e) {
681
- var r = {
682
- f: 0,
683
- v: t,
684
- reactions: null,
685
- equals: jr,
686
- rv: 0,
687
- wv: 0
688
- };
689
- return r;
690
- }
691
- // @__NO_SIDE_EFFECTS__
692
- function W(t, e) {
693
- const r = Pt(t, e);
694
- return bn(r), r;
695
- }
696
- // @__NO_SIDE_EFFECTS__
697
- function xi(t, e = !1, r = !0) {
698
- const n = Pt(t);
699
- if (e || (n.equals = qr), xt && r && I !== null && I.l !== null) {
700
- var i;
701
- ((i = I.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) && Ht() && (E.f & 4325394) !== 0 && (ee === null || !ee.has(t)) && bi();
707
- let n = r ? De(e) : e;
708
- return un(t, n, Tt);
709
- }
710
- var be = null, Vt = 0;
711
- function un(t, e, r = null) {
712
- if (!t.equals(e)) {
713
- fe ? 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 && nr(i), B === null && rr(i);
718
- }
719
- t.wv = Sn(), be = null, Vt = 0, cn(t, V, r), be = null, Ht() && $ !== null && ($.f & 1024) !== 0 && ($.f & 96) === 0 && (z === null ? Qi([t]) : z.push(t)), !n.is_fork && Lt.size > 0 && !on && Hi();
720
- }
721
- return e;
722
- }
723
- function Hi() {
724
- on = !1;
725
- for (const t of Lt) {
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 && We(t);
734
- }
735
- Lt.clear();
736
- }
737
- function Je(t) {
738
- P(t, t.v + 1);
739
- }
740
- function cn(t, e, r) {
741
- var n = t.reactions;
742
- if (n !== null) {
743
- var i = Ht(), 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 o = n[l], f = o.f;
750
- if (!(!i && o === $)) {
751
- var y = (f & V) === 0;
752
- if (y && O(o, e), (f & 131072) !== 0) Lt.add(o);
753
- else if ((f & 2) !== 0) {
754
- var v = o;
755
- B?.delete(v), cn(v, Oe, r);
756
- } else if (y) {
757
- var c = o;
758
- (f & 16) !== 0 && ue !== null && ue.add(c), r !== null ? r.push(c) : ar(c);
759
- }
760
- }
761
- }
762
- }
763
- }
764
- var Ni = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
765
- function De(t) {
766
- if (typeof t != "object" || t === null || Ue in t || Fr in t) return t;
767
- const e = Vn(t);
768
- if (e !== Yn && e !== zn) return t;
769
- var r = /* @__PURE__ */ new Map(), n = Wn(t), i = /* @__PURE__ */ W(0), s = null, l = $e, o = (c) => {
770
- if ($e === l) return c();
771
- var d = E, h = $e;
772
- le(null), Ar(l);
773
- var _ = c();
774
- return le(d), Ar(h), _;
775
- };
776
- n && r.set("length", /* @__PURE__ */ W(t.length, s));
777
- var f = "";
778
- let y = !1;
779
- function v(c) {
780
- if (!y) {
781
- y = !0, f = c, mr(i, `${f} version`);
782
- for (const [d, h] of r) mr(h, Pi(f, d));
783
- y = !1;
784
- }
785
- }
786
- return new Proxy(t, {
787
- defineProperty(c, d, h) {
788
- (!("value" in h) || h.configurable === !1 || h.enumerable === !1 || h.writable === !1) && gi();
789
- var _ = r.get(d);
790
- return _ === void 0 ? o(() => {
791
- var p = /* @__PURE__ */ W(h.value, s);
792
- return r.set(d, p), p;
793
- }) : P(_, h.value, !0), !0;
794
- },
795
- deleteProperty(c, d) {
796
- var h = r.get(d);
797
- if (h === void 0) {
798
- if (d in c) {
799
- const _ = o(() => /* @__PURE__ */ W(N, s));
800
- r.set(d, _), Je(i);
801
- }
802
- } else
803
- P(h, N), Je(i);
804
- return !0;
805
- },
806
- get(c, d, h) {
807
- if (d === Ue) return t;
808
- var _ = r.get(d), p = d in c;
809
- if (_ === void 0 && (!p || Ee(c, d)?.writable) && (_ = o(() => {
810
- var L = De(p ? c[d] : N), x = /* @__PURE__ */ W(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(c, d, h);
817
- },
818
- getOwnPropertyDescriptor(c, d) {
819
- this.has?.(c, d);
820
- var h = Reflect.getOwnPropertyDescriptor(c, d), _ = r.get(d);
821
- if (_ !== void 0) {
822
- var p = A(_);
823
- if (p === N) return;
824
- if (h && "value" in h) h.value = p;
825
- else return {
826
- enumerable: !0,
827
- configurable: !0,
828
- value: p,
829
- writable: !0
830
- };
831
- }
832
- return h;
833
- },
834
- has(c, d) {
835
- if (d === Ue) return !0;
836
- var h = r.get(d), _ = h !== void 0 && h.v !== N || Reflect.has(c, d);
837
- return (h !== void 0 || $ !== null && (!_ || Ee(c, d)?.writable)) && (h === void 0 && (h = o(() => {
838
- var p = _ ? De(c[d]) : N, R = /* @__PURE__ */ W(p, s);
839
- return R;
840
- }), r.set(d, h)), A(h) === N) ? !1 : _;
841
- },
842
- set(c, d, h, _) {
843
- var p = r.get(d), R = d in c;
844
- if (n && d === "length") for (var L = h; L < p.v; L += 1) {
845
- var x = r.get(L + "");
846
- x !== void 0 ? P(x, N) : L in c && (x = o(() => /* @__PURE__ */ W(N, s)), r.set(L + "", x));
847
- }
848
- if (p === void 0)
849
- (!R || Ee(c, d)?.writable) && (p = o(() => /* @__PURE__ */ W(void 0, s)), P(p, De(h)), r.set(d, p));
850
- else {
851
- R = p.v !== N;
852
- var w = o(() => De(h));
853
- P(p, w);
854
- }
855
- var H = Reflect.getOwnPropertyDescriptor(c, d);
856
- if (H?.set && H.set.call(_, h), !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(c) {
866
- A(i);
867
- var d = Reflect.ownKeys(c).filter((p) => {
868
- var R = r.get(p);
869
- return R === void 0 || R.v !== N;
870
- });
871
- for (var [h, _] of r) _.v !== N && !(h in c) && d.push(h);
872
- return d;
873
- },
874
- setPrototypeOf() {
875
- yi();
876
- }
877
- });
878
- }
879
- function Pi(t, e) {
880
- return typeof e == "symbol" ? `${t}[Symbol(${e.description ?? ""})]` : Ni.test(e) ? `${t}.${e}` : /^\d+$/.test(e) ? `${t}[${e}]` : `${t}['${e}']`;
881
- }
882
- var wr, Ki, fn, hn, dn;
883
- function Xt() {
884
- if (wr === void 0) {
885
- wr = window, Ki = document, fn = /Firefox/.test(navigator.userAgent);
886
- var t = Element.prototype, e = Node.prototype, r = Text.prototype;
887
- hn = Ee(e, "firstChild").get, dn = Ee(e, "nextSibling").get, vr(t) && (t[ii] = void 0, t[ni] = null, t[si] = void 0, t.__e = void 0), vr(r) && (r[ai] = void 0);
888
- }
889
- }
890
- function vn(t = "") {
891
- return document.createTextNode(t);
892
- }
893
- // @__NO_SIDE_EFFECTS__
894
- function Ut(t) {
895
- return hn.call(t);
896
- }
897
- // @__NO_SIDE_EFFECTS__
898
- function qe(t) {
899
- return dn.call(t);
900
- }
901
- function Bi(t) {
902
- t.textContent = "";
903
- }
904
- function _n(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 Fi(t) {
908
- var e = $;
909
- if (e === null)
910
- return E.f |= Br, 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 Gi(t) {
933
- $ === null && (E === null && vi(t), di()), fe && hi(t);
934
- }
935
- function Di(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 Ie(t, e) {
940
- var r = $;
941
- r !== null && (r.f & 8192) !== 0 && (t |= Nr);
942
- var n = {
943
- ctx: I,
944
- deps: null,
945
- nodes: null,
946
- f: t | V | 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
- We(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 |= Kr));
969
- }
970
- if (i !== null && (i.parent = r, r !== null && Di(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 lr() {
977
- return E !== null && !U;
978
- }
979
- function Ne(t) {
980
- Gi("$effect");
981
- var e = $.f;
982
- if (!E && (e & 32) !== 0 && I !== null && !I.i) {
983
- var r = I;
984
- (r.e ?? (r.e = [])).push(t);
985
- } else return pn(t);
986
- }
987
- function pn(t) {
988
- return Ie(4 | ti, t);
989
- }
990
- function Wi(t) {
991
- je.ensure();
992
- const e = Ie(64 | st, t);
993
- return () => {
994
- Z(e);
995
- };
996
- }
997
- function ji(t) {
998
- je.ensure();
999
- const e = Ie(64 | st, t);
1000
- return (r = {}) => new Promise((n) => {
1001
- r.outro ? Kt(e, () => {
1002
- Z(e), n(void 0);
1003
- }) : (Z(e), n(void 0));
1004
- });
1005
- }
1006
- function qi(t) {
1007
- return Ie(4, t);
1008
- }
1009
- function or(t, e = 0) {
1010
- return Ie(8 | e, t);
1011
- }
1012
- function Yi(t, e = 0) {
1013
- var r = Ie(16 | e, t);
1014
- return r;
1015
- }
1016
- function Le(t) {
1017
- return Ie(32 | st, t);
1018
- }
1019
- function mn(t) {
1020
- var e = t.teardown;
1021
- if (e !== null) {
1022
- const r = fe, 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 ur(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 && Nt(() => {
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 zi(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 && (Vi(t.nodes.start, t.nodes.end), r = !0), t.f |= _r, ur(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
- mn(t), t.f ^= _r, t.f |= ei;
1056
- var i = t.parent;
1057
- i !== null && i.first !== null && gn(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = t.b = null;
1058
- }
1059
- function Vi(t, e) {
1060
- for (; t !== null; ) {
1061
- var r = t === e ? null : /* @__PURE__ */ qe(t);
1062
- t.remove(), t = r;
1063
- }
1064
- }
1065
- function gn(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 Kt(t, e, r = !0) {
1070
- var n = [];
1071
- t.f |= 256, yn(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 o of n) o.out(l);
1078
- } else i();
1079
- }
1080
- function yn(t, e, r) {
1081
- if ((t.f & 8192) === 0) {
1082
- t.f ^= Nr;
1083
- var n = t.nodes && t.nodes.t;
1084
- if (n !== null)
1085
- for (const o of n) (o.is_global || r) && e.push(o);
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
- yn(i, e, l ? r : !1);
1091
- }
1092
- i = s;
1093
- }
1094
- }
1095
- }
1096
- function Xi(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 Ui = null, vt = !1, fe = !1;
1104
- function Sr(t) {
1105
- fe = 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 bn(t) {
1117
- E !== null && (!Me && (E.f & 2097152) !== 0 || (E.f & 2) !== 0) && (ee ?? (ee = /* @__PURE__ */ new Set())).add(t);
1118
- }
1119
- var G = null, j = 0, z = null;
1120
- function Qi(t) {
1121
- z = t;
1122
- }
1123
- var wn = 1, Ae = 0, $e = Ae;
1124
- function Ar(t) {
1125
- $e = t;
1126
- }
1127
- function Sn() {
1128
- return ++wn;
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) && Ur(s), s.wv > t.wv) return !0;
1137
- }
1138
- (e & 512) !== 0 && B === null && O(t, ne);
1139
- }
1140
- return !1;
1141
- }
1142
- function An(t, e, r = !0) {
1143
- var n = t.reactions;
1144
- if (n !== null && !(!Me && ee !== null && ee.has(t)))
1145
- for (var i = 0; i < n.length; i++) {
1146
- var s = n[i];
1147
- (s.f & 2) !== 0 ? An(s, e, !1) : e === s && (r ? O(s, V) : (s.f & 1024) !== 0 && O(s, Oe), ar(s));
1148
- }
1149
- }
1150
- function En(t) {
1151
- var e = G, r = j, n = z, i = E, s = ee, l = I, o = U, f = $e, y = t.f;
1152
- G = null, j = 0, z = null, E = (y & 96) === 0 ? t : null, ee = null, St(t.ctx), U = !1, $e = ++Ae, t.ac !== null && (Nt(() => {
1153
- t.ac.abort(It);
1154
- }), t.ac = null);
1155
- try {
1156
- t.f |= pr;
1157
- var v = t.fn, c = v();
1158
- t.f |= Pr;
1159
- var d = Er(t);
1160
- if (Ht() && z !== null && !U && d !== null && (t.f & 6146) === 0) for (var h = 0; h < z.length; h++) An(z[h], 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
- z !== null && (n === null ? n = z : n.push(...z));
1165
- }
1166
- return (t.f & 8388608) !== 0 && (t.f ^= Br), c;
1167
- } catch (_) {
1168
- return Er(t), Fi(_);
1169
- } finally {
1170
- t.f ^= pr, G = e, j = r, z = n, E = i, ee = s, St(l), U = o, $e = f;
1171
- }
1172
- }
1173
- function Er(t) {
1174
- var e = t.deps, r = T?.is_fork;
1175
- if (G !== null) {
1176
- var n;
1177
- if (r || nt(t, j), e !== null && j > 0)
1178
- for (e.length = j + G.length, n = 0; n < G.length; n++) e[j + n] = G[n];
1179
- else t.deps = e = G;
1180
- if (lr() && (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 Ji(t, e) {
1188
- let r = e.reactions;
1189
- if (r !== null) {
1190
- var n = jn.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 && (G === null || !bt.call(G, e))) {
1197
- var s = e;
1198
- (s.f & 512) !== 0 && (s.f ^= 512), s.v !== N && rr(s), s.ac !== null && Nt(() => {
1199
- s.ac.abort(It), s.ac = null, O(s, V);
1200
- }), Ci(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++) Ji(t, r[n]);
1207
- }
1208
- function We(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 ? zi(t) : ur(t), mn(t);
1217
- var l = En(t);
1218
- if (t.teardown = typeof l == "function" ? l : null, t.wv = wn, 0)
1219
- for (var o 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 (Ui?.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, G === null && r !== null && r[j] === t ? j++ : G === null ? G = [t] : G.push(t));
1231
- else {
1232
- var n;
1233
- (n = E).deps ?? (n.deps = []), bt.call(E.deps, t) || E.deps.push(t);
1234
- var i = t.reactions;
1235
- i === null ? t.reactions = [E] : bt.call(i, E) || i.push(E);
1236
- }
1237
- }
1238
- if (0) {
1239
- if (!U && reactivity_loss_tracker && T === null && qt === 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, o;
1244
- }
1245
- }
1246
- if (fe && ae.has(t)) return ae.get(t);
1247
- if (e) {
1248
- var f = t;
1249
- if (fe) {
1250
- var y = f.v;
1251
- return ((f.f & 1024) === 0 && f.reactions !== null || $n(f)) && (y = nr(f)), ae.set(f, y), y;
1252
- }
1253
- var v = (f.f & 512) === 0 && !U && E !== null && (vt || (E.f & 512) !== 0), c = (f.f & Pr) === 0;
1254
- at(f) && (v && (f.f |= 512), Ur(f)), v && !c && (Qr(f), Tn(f));
1255
- }
1256
- if (B?.has(t)) return B.get(t);
1257
- if ((t.f & 8388608) !== 0) throw t.v;
1258
- return t.v;
1259
- }
1260
- function Tn(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 && (Qr(e), Tn(e));
1264
- }
1265
- function $n(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 && $n(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, Dt = !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, Dt || (Dt = !0, setTimeout(() => {
1284
- Dt = !1, Gt = null;
1285
- }));
1286
- var l = 0, o = Gt === t && t[ut];
1287
- if (o) {
1288
- var f = i.indexOf(o);
1289
- if (f !== -1 && (e === document || e === window)) {
1290
- t[ut] = e;
1291
- return;
1292
- }
1293
- var y = i.indexOf(e);
1294
- if (y === -1) return;
1295
- f <= y && (l = f);
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, c = $;
1305
- le(null), _e(null);
1306
- try {
1307
- for (var d, h = []; 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 ? h.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 h) queueMicrotask(() => {
1319
- throw p;
1320
- });
1321
- throw d;
1322
- }
1323
- } finally {
1324
- t[ut] = e, delete t.currentTarget, le(v), _e(c);
1325
- }
1326
- }
1327
- }
1328
- var es = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (t) => t });
1329
- function ts(t) {
1330
- return es?.createHTML(t) ?? t;
1331
- }
1332
- function rs(t) {
1333
- var e = _n("template");
1334
- return e.innerHTML = ts(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 ns(t, e) {
1347
- var r = (e & 1) !== 0, n = (e & 2) !== 0, i, s = !t.startsWith("<!>");
1348
- return () => {
1349
- if (J)
1350
- return _t(F, null), F;
1351
- i === void 0 && (i = rs(s ? t : "<!>" + t), r || (i = /* @__PURE__ */ Ut(i)));
1352
- var l = n || fn ? document.importNode(i, !0) : i.cloneNode(!0);
1353
- if (r) {
1354
- var o = /* @__PURE__ */ Ut(l), f = l.lastChild;
1355
- _t(o, f);
1356
- } else _t(l, l);
1357
- return l;
1358
- };
1359
- }
1360
- function kn(t, e) {
1361
- if (J) {
1362
- var r = $;
1363
- ((r.f & 32768) === 0 || r.nodes.end === null) && (r.nodes.end = F), Wr();
1364
- return;
1365
- }
1366
- t !== null && t.before(e);
1367
- }
1368
- var is = [
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
- ], zs = [
1398
- ...is,
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
- ], ss = ["touchstart", "touchmove"];
1414
- function as(t) {
1415
- return ss.includes(t);
1416
- }
1417
- var ls = [
1418
- "$state",
1419
- "$state.raw",
1420
- "$derived",
1421
- "$derived.by"
1422
- ], Vs = [
1423
- ...ls,
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 os(t) {
1440
- let e = 0, r = Pt(0), n;
1441
- return () => {
1442
- lr() && (A(r), or(() => (e === 0 && (n = Bt(() => t(() => Je(r)))), e += 1, () => {
1443
- Ce(() => {
1444
- e -= 1, e === 0 && (n?.(), n = void 0, Je(r));
1445
- });
1446
- })));
1447
- };
1448
- }
1449
- var us = Kr | st;
1450
- function cs(t, e, r, n) {
1451
- new fs(t, e, r, n);
1452
- }
1453
- var te = /* @__PURE__ */ new WeakMap(), Qt = /* @__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(), Fe = /* @__PURE__ */ new WeakMap(), ke = /* @__PURE__ */ new WeakMap(), ct = /* @__PURE__ */ new WeakMap(), Jt = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakMap(), kr = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakSet(), fs = class {
1454
- constructor(t, e, r, n) {
1455
- ir(this, M), u(this, "parent", void 0), u(this, "is_pending", !1), u(this, "transform_error", void 0), S(this, te, void 0), S(this, Qt, J ? F : 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, Fe, 0), S(this, ke, 0), S(this, ct, !1), S(this, Jt, /* @__PURE__ */ new Set()), S(this, Zt, /* @__PURE__ */ new Set()), S(this, me, null), S(this, kr, os(() => (m(me, this, Pt(a(Fe, 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, Yi(() => {
1461
- if (J) {
1462
- const i = a(Qt, this);
1463
- Wr();
1464
- const s = i.data === "[!";
1465
- if (i.data.startsWith("[?")) {
1466
- const l = JSON.parse(i.data.slice(2));
1467
- g(M, this, ds).call(this, l);
1468
- } else s ? g(M, this, vs).call(this) : g(M, this, hs).call(this);
1469
- } else g(M, this, Rn).call(this);
1470
- }, us)), J && m(te, this, F);
1471
- }
1472
- defer_effect(t) {
1473
- Xr(t, a(Jt, this), a(Zt, 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(M, this, Ln).call(this, t, e), m(Fe, this, a(Fe, this) + t), !(!a(me, this) || a(ct, this)) && (m(ct, this, !0), Ce(() => {
1483
- m(ct, this, !1), a(me, this) && un(a(me, this), a(Fe, this));
1484
- }));
1485
- }
1486
- get_effect_pending() {
1487
- return a(kr, 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(M, this, Cr).call(this, t);
1493
- })) : g(M, this, Cr).call(this, t);
1494
- }
1495
- };
1496
- function hs() {
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 ds(t) {
1504
- const e = a(se, this).failed, { reset: r, invoke_onerror: n } = g(M, this, Cn).call(this, t);
1505
- Ce(n), e && m(Q, this, Le(() => {
1506
- e(a(te, this), () => t, () => r);
1507
- }));
1508
- }
1509
- function Cn(t) {
1510
- var e = !1, r = !1;
1511
- const n = () => {
1512
- if (e) {
1513
- oi();
1514
- return;
1515
- }
1516
- e = !0, r && wi(), a(Q, this) !== null && Kt(a(Q, this), () => {
1517
- m(Q, this, null);
1518
- }), g(M, this, cr).call(this, () => {
1519
- g(M, this, Rn).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 vs() {
1534
- const t = a(se, this).pending;
1535
- t && (this.is_pending = !0, m(Y, this, Le(() => t(a(te, this)))), Ce(() => {
1536
- var e = m(ve, this, document.createDocumentFragment()), r = vn(), n = !1;
1537
- if (e.append(r), m(re, this, g(M, this, cr).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(M, this, Ot).call(this, T);
1550
- return;
1551
- }
1552
- a(ke, this) === 0 && (a(te, this).before(e), m(ve, this, null), Kt(a(Y, this), () => {
1553
- m(Y, this, null);
1554
- }), g(M, this, Ot).call(this, T));
1555
- }));
1556
- }
1557
- function Rn() {
1558
- try {
1559
- if (this.is_pending = this.has_pending_snippet(), m(ke, this, 0), m(Fe, this, 0), m(re, this, Le(() => {
1560
- a(it, this).call(this, a(te, this));
1561
- })), a(ke, this) > 0) {
1562
- var t = m(ve, this, document.createDocumentFragment());
1563
- Xi(a(re, this), t);
1564
- const e = a(se, this).pending;
1565
- m(Y, this, Le(() => e(a(te, this))));
1566
- } else g(M, this, Ot).call(this, T);
1567
- } catch (e) {
1568
- this.error(e);
1569
- }
1570
- }
1571
- function Ot(t) {
1572
- this.is_pending = !1, t.transfer_effects(a(Jt, this), a(Zt, this));
1573
- }
1574
- function cr(t) {
1575
- var e = $, r = E, n = I;
1576
- _e(a(q, this)), le(a(q, this)), St(a(q, this).ctx);
1577
- try {
1578
- return je.ensure(), t();
1579
- } finally {
1580
- _e(e), le(r), St(n);
1581
- }
1582
- }
1583
- function Ln(t, e) {
1584
- if (!this.has_pending_snippet()) {
1585
- if (this.parent) {
1586
- var r;
1587
- g(M, r = this.parent, Ln).call(r, t, e);
1588
- }
1589
- return;
1590
- }
1591
- m(ke, this, a(ke, this) + t), a(ke, this) === 0 && (g(M, this, Ot).call(this, e), a(Y, this) && Kt(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 Cr(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(Qt, this)), ui(), tt(ci()));
1597
- let e = a(se, this).failed;
1598
- const r = (n) => {
1599
- const { reset: i, invoke_onerror: s } = g(M, this, Cn).call(this, n);
1600
- s(), e && m(Q, this, g(M, this, cr).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
- Ce(() => {
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 On(t, e) {
1624
- return Mn(t, e);
1625
- }
1626
- function _s(t, e) {
1627
- Xt(), e.intro = e.intro ?? !1;
1628
- const r = e.target, n = J, i = F;
1629
- try {
1630
- for (var s = /* @__PURE__ */ Ut(r); s && (s.nodeType !== 8 || s.data !== "["); ) s = /* @__PURE__ */ qe(s);
1631
- if (!s) throw yt;
1632
- lt(!0), tt(s);
1633
- const l = Mn(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((o) => o.startsWith("https://svelte.dev/e/"))) throw l;
1641
- return l !== yt && console.warn("Failed to hydrate: ", l), e.recover === !1 && pi(), Xt(), Bi(r), lt(!1), On(t, e);
1642
- } finally {
1643
- lt(n), tt(i);
1644
- }
1645
- }
1646
- var ft = /* @__PURE__ */ new Map();
1647
- function Mn(t, { target: e, anchor: r, props: n = {}, events: i, context: s, intro: l = !0, transformError: o }) {
1648
- Xt();
1649
- var f = void 0, y = ji(() => {
1650
- var v = r ?? e.appendChild(vn());
1651
- cs(v, { pending: () => {
1652
- } }, (h) => {
1653
- Yr({});
1654
- var _ = I;
1655
- if (s && (_.c = s), i && (n.$$events = i), J && _t(h, null), Rr = l, f = t(h, n) || tr(), Rr = !0, J && ($.nodes.end = F, F === null || F.nodeType !== 8 || F.data !== "]"))
1656
- throw Dr(), yt;
1657
- zr();
1658
- }, o);
1659
- var c = /* @__PURE__ */ new Set(), d = (h) => {
1660
- for (var _ = 0; _ < h.length; _++) {
1661
- var p = h[_];
1662
- if (!c.has(p)) {
1663
- c.add(p);
1664
- var R = as(p);
1665
- for (const w of [e, document]) {
1666
- var L = ft.get(w);
1667
- L === void 0 && (L = /* @__PURE__ */ new Map(), ft.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(qn(Zi)), Tr.add(d), () => {
1675
- for (var h of c) for (const R of [e, document]) {
1676
- var _ = ft.get(R), p = _.get(h);
1677
- --p == 0 ? (R.removeEventListener(h, $r), _.delete(h), _.size === 0 && ft.delete(R)) : _.set(h, p);
1678
- }
1679
- Tr.delete(d), v !== r && v.parentNode?.removeChild(v);
1680
- };
1681
- });
1682
- return er.set(f, y), f;
1683
- }
1684
- var er = /* @__PURE__ */ new WeakMap();
1685
- function ps(t, e) {
1686
- const r = er.get(t);
1687
- return r ? (er.delete(t), r(e)) : Promise.resolve();
1688
- }
1689
- var In, Ge = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), Lr = /* @__PURE__ */ new WeakSet(), xn = class {
1690
- constructor(t) {
1691
- ir(this, Lr), S(this, Ge, /* @__PURE__ */ new WeakMap()), S(this, Mt, void 0), S(this, Wt, void 0), m(Wt, this, t);
1692
- }
1693
- observe(t, e) {
1694
- var r = a(Ge, this).get(t) || /* @__PURE__ */ new Set();
1695
- return r.add(e), a(Ge, this).set(t, r), g(Lr, this, ms).call(this).observe(t, a(Wt, this)), () => {
1696
- var n = a(Ge, this).get(t);
1697
- n.delete(e), n.size === 0 && (a(Ge, this).delete(t), a(Mt, this).unobserve(t));
1698
- };
1699
- }
1700
- };
1701
- In = xn;
1702
- function ms() {
1703
- return a(Mt, this) ?? m(Mt, this, new ResizeObserver((t) => {
1704
- for (var e of t) {
1705
- In.entries.set(e.target, e);
1706
- for (var r of a(Ge, this).get(e.target) || []) r(e);
1707
- }
1708
- }));
1709
- }
1710
- u(xn, "entries", /* @__PURE__ */ new WeakMap());
1711
- function jt(t, e) {
1712
- return t === e || t?.[Ue] === e;
1713
- }
1714
- function gs(t = tr(), e, r, n) {
1715
- var i = I.r, s = $;
1716
- return qi(() => {
1717
- var l, o;
1718
- return or(() => {
1719
- l = o, o = n?.() || [], Bt(() => {
1720
- jt(r(...o), t) || (e(t, ...o), l && jt(r(...l), t) && e(null, ...l));
1721
- });
1722
- }), () => {
1723
- let f = s;
1724
- for (; f !== i && f.parent !== null && f.parent.f & 33554432; ) f = f.parent;
1725
- const y = () => {
1726
- o && jt(r(...o), t) && e(null, ...o);
1727
- }, v = f.teardown;
1728
- f.teardown = () => {
1729
- y(), v?.();
1730
- };
1731
- };
1732
- }), t;
1733
- }
1734
- var ht = !1;
1735
- function ys(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 = !xt || (r & 2) !== 0, s = (r & 8) !== 0, l = (r & 16) !== 0, o = n, f = !0, y = void 0, v = () => l && i ? (y ?? (y = /* @__PURE__ */ At(n)), A(y)) : (f && (f = !1, o = l ? Bt(n) : n), o);
1745
- let c;
1746
- if (s) {
1747
- var d = Ue in t || Gr in t;
1748
- c = Ee(t, e)?.set ?? (d && e in t ? (H) => t[e] = H : void 0);
1749
- }
1750
- var h, _ = !1;
1751
- s ? [h, _] = ys(() => t[e]) : h = t[e], h === void 0 && n !== void 0 && (h = v(), c && (i && mi(e), c(h)));
1752
- var p;
1753
- if (i ? p = () => {
1754
- var H = t[e];
1755
- return H === void 0 ? v() : (f = !0, H);
1756
- } : p = () => {
1757
- var H = t[e];
1758
- return H !== void 0 && (o = void 0), H === void 0 ? o : H;
1759
- }, i && (r & 4) === 0) return p;
1760
- if (c) {
1761
- var R = t.$$legacy;
1762
- return (function(H, pe) {
1763
- return arguments.length > 0 ? ((!i || !pe || R || _) && c(pe ? p() : H), H) : p();
1764
- });
1765
- }
1766
- var L = !1, x = ((r & 1) !== 0 ? At : $i)(() => (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 ? De(H) : H;
1772
- return P(x, He), L = !0, o !== void 0 && (o = He), H;
1773
- }
1774
- return fe && L || (w.f & 16384) !== 0 ? x.v : A(x);
1775
- });
1776
- }
1777
- function bs(t) {
1778
- return new ws(t);
1779
- }
1780
- var ge = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), ws = 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__ */ xi(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 === Gr ? !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 ? _s : On)(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
- })), !Me && (!t?.props?.$$host || t.sync === !1) && Be(), 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
- ps(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
- }, Hn;
1840
- typeof HTMLElement == "function" && (Hn = class extends HTMLElement {
1841
- constructor(t, e, r) {
1842
- 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", /* @__PURE__ */ new Map()), u(this, "$$me", void 0), u(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 = _n("slot");
1862
- n !== "default" && (s.name = n), kn(i, s);
1863
- };
1864
- };
1865
- if (await Promise.resolve(), !this.$$cn || this.$$c) return;
1866
- const e = {}, r = Ss(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 = bs({
1874
- component: this.$$ctor,
1875
- target: this.$$shadowRoot || this,
1876
- props: {
1877
- ...this.$$d,
1878
- $$slots: e,
1879
- $$host: this
1880
- }
1881
- }), this.$$me = Wi(() => {
1882
- or(() => {
1883
- this.$$r = !0;
1884
- for (const n of wt(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 wt(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 Ss(t) {
1939
- const e = {};
1940
- return t.childNodes.forEach((r) => {
1941
- e[r.slot || "default"] = !0;
1942
- }), e;
1943
- }
1944
- function As(t, e, r, n, i, s) {
1945
- let l = class extends Hn {
1946
- constructor() {
1947
- super(t, r, i), this.$$p_d = e;
1948
- }
1949
- static get observedAttributes() {
1950
- return wt(e).map((o) => (e[o].attribute || o).toLowerCase());
1951
- }
1952
- };
1953
- return wt(e).forEach((o) => {
1954
- Ze(l.prototype, o, {
1955
- get() {
1956
- return this.$$c && o in this.$$c ? this.$$c[o] : this.$$d[o];
1957
- },
1958
- set(f) {
1959
- f = pt(o, f, e), this.$$d[o] = f;
1960
- var y = this.$$c;
1961
- y && (Ee(y, o)?.get ? y[o] = f : y.$set({ [o]: f }));
1962
- }
1963
- });
1964
- }), n.forEach((o) => {
1965
- Ze(l.prototype, o, { get() {
1966
- return this.$$c?.[o];
1967
- } });
1968
- }), s && (l = s(l)), t.element = l, l;
1969
- }
1970
- var Nn, oe = class D {
1971
- findChoices(e) {
1972
- e.setAttribute(D.ROOT_HOOK_ATTR, "true");
1973
- const r = Array.from(e.querySelectorAll(D.CHOICE_SELECTOR));
1974
- for (const n of r) this.annotateChoice(n);
1975
- return this.annotateFeedbackTicks(e), r;
1976
- }
1977
- createChoiceRange(e) {
1978
- const r = this.resolveLabelElement(e);
1979
- if (!r) return null;
1980
- const n = document.createRange();
1981
- return n.selectNodeContents(r), n;
1982
- }
1983
- getChoiceId(e) {
1984
- const r = e.querySelector('input[type="checkbox"], input[type="radio"]');
1985
- return r?.getAttribute("value") || r?.id || this.generateFallbackId(e);
1986
- }
1987
- getChoiceLabel(e) {
1988
- return this.resolveLabelElement(e)?.textContent?.trim() || "Unlabeled choice";
1989
- }
1990
- isSelected(e) {
1991
- const r = e.querySelector('input[type="checkbox"], input[type="radio"]');
1992
- return r ? r.checked || r.getAttribute("aria-checked") === "true" : !1;
1993
- }
1994
- canEliminate(e) {
1995
- const r = e.querySelector('input[type="checkbox"], input[type="radio"]');
1996
- return !(!r || this.isSelected(e) || r.disabled || (e.closest(`[${D.ROOT_HOOK_ATTR}="true"]`) || e.closest("multiple-choice"))?.querySelector(`[${D.FEEDBACK_HOOK_ATTR}="true"]`));
1997
- }
1998
- setSelectable(e, r) {
1999
- const n = e.querySelector('input[type="checkbox"], input[type="radio"]');
2000
- if (!n) return;
2001
- n.disabled = !r, r ? n.removeAttribute("aria-disabled") : n.setAttribute("aria-disabled", "true");
2002
- const i = n.closest(D.MUI_BUTTON_SELECTOR);
2003
- i && i.classList.toggle(D.MUI_DISABLED_CLASS, !r);
2004
- }
2005
- generateFallbackId(e) {
2006
- const r = (e.closest(`[${D.ROOT_HOOK_ATTR}="true"]`) || e.closest("multiple-choice"))?.querySelectorAll(`[${D.CHOICE_HOOK_ATTR}="true"]`) || [];
2007
- return `choice-${Array.from(r).indexOf(e)}`;
2008
- }
2009
- annotateChoice(e) {
2010
- e.setAttribute(D.CHOICE_HOOK_ATTR, "true");
2011
- const r = this.resolveLabelElement(e);
2012
- r && r.setAttribute(D.LABEL_HOOK_ATTR, "true");
2013
- }
2014
- resolveLabelElement(e) {
2015
- return e.querySelector(`[${D.LABEL_HOOK_ATTR}="true"]`) || e.querySelector("label") || e.querySelector("span");
2016
- }
2017
- annotateFeedbackTicks(e) {
2018
- for (const r of e.querySelectorAll(".feedback-tick")) r.setAttribute(D.FEEDBACK_HOOK_ATTR, "true");
2019
- }
2020
- };
2021
- Nn = oe;
2022
- u(oe, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice");
2023
- u(oe, "LABEL_HOOK_ATTR", "data-pie-answer-eliminator-label");
2024
- u(oe, "ROOT_HOOK_ATTR", "data-pie-answer-eliminator-root");
2025
- u(oe, "FEEDBACK_HOOK_ATTR", "data-pie-answer-eliminator-feedback-tick");
2026
- u(oe, "CHOICE_SELECTOR", `[${Nn.CHOICE_HOOK_ATTR}="true"], .corespring-checkbox, .corespring-radio-button`);
2027
- u(oe, "MUI_BUTTON_SELECTOR", ".MuiButtonBase-root, .MuiRadio-root, .MuiCheckbox-root");
2028
- u(oe, "MUI_DISABLED_CLASS", "Mui-disabled");
2029
- var Es = "ebsr-multiple-choice", Pn = (t) => t instanceof HTMLElement && Dn(t.tagName.toLowerCase()).baseName === Es, Or = (t, e) => Array.from(t.querySelectorAll(`[id="${e}"]`)).find(Pn) ?? null, Ts = (t) => {
2030
- let e = t.parentElement;
2031
- for (; e !== null; ) {
2032
- if (Pn(e)) return e;
2033
- e = e.parentElement;
2034
- }
2035
- return null;
2036
- }, $s = class {
2037
- constructor() {
2038
- u(this, "mcAdapter", new oe());
2039
- }
2040
- findChoices(t) {
2041
- const e = Or(t, "a"), r = Or(t, "b"), n = [];
2042
- return e && n.push(...this.mcAdapter.findChoices(e)), r && n.push(...this.mcAdapter.findChoices(r)), n;
2043
- }
2044
- createChoiceRange(t) {
2045
- return this.mcAdapter.createChoiceRange(t);
2046
- }
2047
- getChoiceId(t) {
2048
- return `${Ts(t)?.id || "unknown"}-${this.mcAdapter.getChoiceId(t)}`;
2049
- }
2050
- getChoiceLabel(t) {
2051
- return this.mcAdapter.getChoiceLabel(t);
2052
- }
2053
- isSelected(t) {
2054
- return this.mcAdapter.isSelected(t);
2055
- }
2056
- canEliminate(t) {
2057
- return this.mcAdapter.canEliminate(t);
2058
- }
2059
- setSelectable(t, e) {
2060
- this.mcAdapter.setSelectable(t, e);
2061
- }
2062
- }, Mr = "answer-masking", ks = "data-pie-answer-eliminator-choice", Cs = "data-pie-answer-eliminator-label";
2063
- function Kn(t) {
2064
- if (!t.localName.includes("-")) return null;
2065
- try {
2066
- const e = t.constructor.pieSupports;
2067
- return Array.isArray(e) ? e : null;
2068
- } catch {
2069
- return null;
2070
- }
2071
- }
2072
- function Rs(t) {
2073
- const e = [];
2074
- for (const r of [t, ...t.querySelectorAll("*")])
2075
- Kn(r) && (e.some((n) => n.contains(r)) || e.push(r));
2076
- return e;
2077
- }
2078
- function mt(t, e, r) {
2079
- try {
2080
- return t();
2081
- } catch (n) {
2082
- return console.error(`[AnswerEliminator] ${r} threw:`, n), e;
2083
- }
2084
- }
2085
- function Ls(t) {
2086
- if (!t || typeof t != "object") return null;
2087
- const e = t, { id: r, label: n, container: i, content: s } = e, { isSelected: l, isEliminable: o, setEliminated: f } = e;
2088
- return typeof r != "string" || !r || typeof n != "string" || !(i instanceof HTMLElement) || !(s instanceof Element) || !i.contains(s) || typeof l != "function" || typeof o != "function" || typeof f != "function" ? null : {
2089
- target: {
2090
- id: r,
2091
- label: n.trim() || s.textContent?.trim() || "Unlabeled choice",
2092
- container: i,
2093
- createRange() {
2094
- const y = document.createRange();
2095
- return y.selectNodeContents(s), y;
2096
- },
2097
- isSelected: () => mt(() => l.call(t) === !0, !1, "isSelected"),
2098
- canEliminate: () => mt(() => o.call(t) === !0, !1, "isEliminable"),
2099
- setEliminated: (y) => mt(() => f.call(t, y), void 0, "setEliminated")
2100
- },
2101
- content: s
2102
- };
2103
- }
2104
- function Ir(t, e) {
2105
- t.getAttribute(e) !== "true" && t.setAttribute(e, "true");
2106
- }
2107
- function Os(t) {
2108
- if (!Kn(t)?.includes("answer-masking")) return [];
2109
- const e = t.pieSupportTargets;
2110
- if (typeof e != "function")
2111
- return console.warn(`[AnswerEliminator] <${t.localName}> declares ${Mr} but has no pieSupportTargets()`), [];
2112
- const r = mt(() => e.call(t, Mr), [], `<${t.localName}>.pieSupportTargets`);
2113
- if (!Array.isArray(r)) return [];
2114
- const n = [], i = /* @__PURE__ */ new Set();
2115
- for (const s of r) {
2116
- const l = Ls(s);
2117
- if (!l || i.has(l.target.id)) {
2118
- console.warn(`[AnswerEliminator] <${t.localName}> supplied a choice that is malformed or repeats an id`, s);
2119
- continue;
2120
- }
2121
- const { target: o, content: f } = l;
2122
- i.add(o.id), Ir(o.container, ks), Ir(f, Cs), n.push({
2123
- target: o,
2124
- owner: t
2125
- });
2126
- }
2127
- return n;
2128
- }
2129
- var Ms = [new $s(), new oe()];
2130
- function Is(t, e) {
2131
- return {
2132
- id: e.getChoiceId(t),
2133
- label: e.getChoiceLabel(t),
2134
- container: t,
2135
- createRange: () => e.createChoiceRange(t),
2136
- isSelected: () => e.isSelected(t),
2137
- canEliminate: () => e.canEliminate(t),
2138
- setEliminated: (r) => e.setSelectable(t, !r)
2139
- };
2140
- }
2141
- function xs(t, e, r) {
2142
- const n = [], i = new Set(r.map(({ target: s }) => s.container));
2143
- for (const s of Ms) for (const l of s.findChoices(t))
2144
- i.has(l) || (i.add(l), !e.some((o) => o.contains(l)) && n.push({
2145
- target: Is(l, s),
2146
- owner: null
2147
- }));
2148
- return n;
2149
- }
2150
- function xr(t) {
2151
- const e = Rs(t), r = e.flatMap(Os);
2152
- return [...r, ...xs(t, e, r)];
2153
- }
2154
- var xe = class K {
2155
- constructor() {
2156
- u(this, "name", "mask"), u(this, "highlights", /* @__PURE__ */ new Map()), u(this, "ranges", /* @__PURE__ */ new Map()), u(this, "fallbackContainers", /* @__PURE__ */ new Map());
2157
- }
2158
- initialize() {
2159
- }
2160
- destroy() {
2161
- this.clearAll();
2162
- }
2163
- apply(e, r) {
2164
- if (!this.isSupported()) {
2165
- this.applyFallback(e, r);
2166
- return;
2167
- }
2168
- this.injectHighlightCSS(e);
2169
- const n = new Highlight(r);
2170
- CSS.highlights.set(`${K.HIGHLIGHT_NAME_PREFIX}${e}`, n), this.highlights.set(e, n), this.ranges.set(e, r), this.addAriaAttributes(r);
2171
- }
2172
- remove(e) {
2173
- if (!this.isSupported()) {
2174
- this.removeFallback(e);
2175
- return;
2176
- }
2177
- CSS.highlights.delete(`${K.HIGHLIGHT_NAME_PREFIX}${e}`), this.removeHighlightCSS(e);
2178
- const r = this.ranges.get(e);
2179
- r && this.removeAriaAttributes(r), this.highlights.delete(e), this.ranges.delete(e), this.fallbackContainers.delete(e);
2180
- }
2181
- isEliminated(e) {
2182
- return this.highlights.has(e) || this.fallbackContainers.has(e);
2183
- }
2184
- clearAll() {
2185
- for (const e of this.getEliminatedIds()) this.remove(e);
2186
- this.fallbackContainers.clear();
2187
- }
2188
- getEliminatedIds() {
2189
- return Array.from(/* @__PURE__ */ new Set([...this.highlights.keys(), ...this.fallbackContainers.keys()]));
2190
- }
2191
- isSupported() {
2192
- return typeof CSS < "u" && "highlights" in CSS;
2193
- }
2194
- injectHighlightCSS(e) {
2195
- const r = `${K.HIGHLIGHT_STYLE_PREFIX}${e}`;
2196
- if (document.getElementById(r)) return;
2197
- const n = document.createElement("style");
2198
- n.id = r, n.textContent = `
2199
- ::highlight(${K.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}) {
2200
4
  opacity: 0.2;
2201
5
  filter: blur(2px);
2202
6
  }
2203
- `, document.head.appendChild(n);
2204
- }
2205
- removeHighlightCSS(e) {
2206
- document.getElementById(`${K.HIGHLIGHT_STYLE_PREFIX}${e}`)?.remove();
2207
- }
2208
- addAriaAttributes(e) {
2209
- const r = this.findChoiceContainer(e);
2210
- r && (r.setAttribute(K.ELIMINATED_ATTR, "true"), r.setAttribute("aria-hidden", "true"));
2211
- }
2212
- removeAriaAttributes(e) {
2213
- const r = this.findChoiceContainer(e);
2214
- r && (r.removeAttribute(K.ELIMINATED_ATTR), r.removeAttribute("aria-hidden"));
2215
- }
2216
- findChoiceContainer(e) {
2217
- let r = e.startContainer;
2218
- for (r.nodeType === Node.TEXT_NODE && (r = r.parentElement); r && r !== document.body; ) {
2219
- if (r.getAttribute(K.CHOICE_HOOK_ATTR) === "true") return r;
2220
- r = r.parentElement;
2221
- }
2222
- return null;
2223
- }
2224
- applyFallback(e, r) {
2225
- const n = this.findChoiceContainer(r);
2226
- n && (n.classList.add(K.FALLBACK_CLASS), n.setAttribute(K.ELIMINATED_ATTR, "true"), n.setAttribute(K.ELIMINATED_ID_ATTR, e), this.fallbackContainers.set(e, n), this.addAriaAttributes(r));
2227
- }
2228
- removeFallback(e) {
2229
- const r = this.fallbackContainers.get(e);
2230
- if (!r) return;
2231
- r.classList.remove(K.FALLBACK_CLASS), r.removeAttribute(K.ELIMINATED_ATTR), r.removeAttribute(K.ELIMINATED_ID_ATTR);
2232
- const n = document.createRange();
2233
- n.selectNodeContents(r), this.removeAriaAttributes(n), this.fallbackContainers.delete(e);
2234
- }
2235
- };
2236
- u(xe, "HIGHLIGHT_STYLE_PREFIX", "pie-answer-eliminator-mask-highlight-");
2237
- u(xe, "HIGHLIGHT_NAME_PREFIX", "pie-answer-masked-");
2238
- u(xe, "FALLBACK_CLASS", "pie-answer-masked-fallback");
2239
- u(xe, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice");
2240
- u(xe, "ELIMINATED_ATTR", "data-pie-answer-eliminated");
2241
- u(xe, "ELIMINATED_ID_ATTR", "data-pie-answer-eliminated-id");
2242
- var C = class b {
2243
- constructor() {
2244
- u(this, "name", "strikethrough"), u(this, "highlights", /* @__PURE__ */ new Map()), u(this, "ranges", /* @__PURE__ */ new Map()), u(this, "fallbackContainers", /* @__PURE__ */ new Map()), u(this, "imageWrappers", /* @__PURE__ */ new Map()), u(this, "mathTargets", /* @__PURE__ */ new Map());
2245
- }
2246
- initialize() {
2247
- this.isSupported() || console.warn("CSS Custom Highlight API not supported, using fallback");
2248
- }
2249
- destroy() {
2250
- this.clearAll();
2251
- }
2252
- apply(e, r) {
2253
- if (this.isSupported()) {
2254
- this.injectHighlightCSS(e);
2255
- const n = new Highlight(r);
2256
- CSS.highlights.set(`${b.HIGHLIGHT_NAME_PREFIX}${e}`, n), this.highlights.set(e, n), this.ranges.set(e, r), this.addAriaAttributes(r);
2257
- } else this.applyFallback(e, r);
2258
- this.strikeImages(e, r), this.strikeMath(e, r);
2259
- }
2260
- remove(e) {
2261
- if (this.unstrikeImages(e), this.unstrikeMath(e), !this.isSupported()) {
2262
- this.removeFallback(e);
2263
- return;
2264
- }
2265
- CSS.highlights.delete(`${b.HIGHLIGHT_NAME_PREFIX}${e}`), this.removeHighlightCSS(e);
2266
- const r = this.ranges.get(e);
2267
- r && this.removeAriaAttributes(r), this.highlights.delete(e), this.ranges.delete(e), this.fallbackContainers.delete(e);
2268
- }
2269
- isEliminated(e) {
2270
- return this.highlights.has(e) || this.fallbackContainers.has(e);
2271
- }
2272
- clearAll() {
2273
- const e = /* @__PURE__ */ new Set([
2274
- ...this.highlights.keys(),
2275
- ...this.fallbackContainers.keys(),
2276
- ...this.imageWrappers.keys(),
2277
- ...this.mathTargets.keys()
2278
- ]);
2279
- for (const r of e) this.remove(r);
2280
- this.fallbackContainers.clear(), this.imageWrappers.clear(), this.mathTargets.clear();
2281
- }
2282
- getEliminatedIds() {
2283
- return Array.from(/* @__PURE__ */ new Set([...this.highlights.keys(), ...this.fallbackContainers.keys()]));
2284
- }
2285
- isSupported() {
2286
- return typeof CSS < "u" && "highlights" in CSS;
2287
- }
2288
- injectHighlightCSS(e) {
2289
- const r = `${b.HIGHLIGHT_STYLE_PREFIX}${e}`;
2290
- if (document.getElementById(r)) return;
2291
- const n = document.createElement("style");
2292
- n.id = r, n.textContent = `
2293
- ::highlight(${b.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}) {
2294
9
  text-decoration: line-through;
2295
10
  text-decoration-thickness: 2px;
2296
11
  text-decoration-color: var(--pie-answer-eliminator-strike-color, var(--pie-incorrect, #ff9800));
2297
12
  }
2298
- `, document.head.appendChild(n);
2299
- }
2300
- removeHighlightCSS(e) {
2301
- document.getElementById(`${b.HIGHLIGHT_STYLE_PREFIX}${e}`)?.remove();
2302
- }
2303
- addAriaAttributes(e) {
2304
- const r = this.findChoiceContainer(e);
2305
- if (!r) return;
2306
- r.setAttribute(b.ELIMINATED_ATTR, "true"), r.setAttribute("aria-disabled", "true");
2307
- const n = this.resolveLabelElement(r);
2308
- if (n && !n.querySelector(`.${b.SR_CLASS}`)) {
2309
- const i = document.createElement("span");
2310
- i.className = b.SR_CLASS, i.textContent = " (eliminated)", n.appendChild(i);
2311
- }
2312
- }
2313
- removeAriaAttributes(e) {
2314
- const r = this.findChoiceContainer(e);
2315
- r && (r.removeAttribute(b.ELIMINATED_ATTR), r.removeAttribute("aria-disabled"), r.querySelector(`.${b.SR_CLASS}`)?.remove());
2316
- }
2317
- findChoiceContainer(e) {
2318
- let r = e.startContainer;
2319
- for (r.nodeType === Node.TEXT_NODE && (r = r.parentElement); r && r !== document.body; ) {
2320
- if (r.getAttribute(b.CHOICE_HOOK_ATTR) === "true") return r;
2321
- r = r.parentElement;
2322
- }
2323
- return null;
2324
- }
2325
- applyFallback(e, r) {
2326
- const n = this.findChoiceContainer(r);
2327
- 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));
2328
- }
2329
- removeFallback(e) {
2330
- const r = this.fallbackContainers.get(e);
2331
- if (!r) return;
2332
- r.classList.remove(b.FALLBACK_CLASS), r.removeAttribute(b.ELIMINATED_ATTR), r.removeAttribute(b.ELIMINATED_ID_ATTR);
2333
- const n = document.createRange();
2334
- n.selectNodeContents(r), this.removeAriaAttributes(n), this.fallbackContainers.delete(e);
2335
- }
2336
- strikeImages(e, r) {
2337
- const n = this.resolveImageScope(r);
2338
- if (!n) return;
2339
- const i = [];
2340
- for (const s of Array.from(n.querySelectorAll("img"))) {
2341
- const l = this.wrapImage(s);
2342
- l && i.push(l);
2343
- }
2344
- i.length > 0 && this.imageWrappers.set(e, i);
2345
- }
2346
- unstrikeImages(e) {
2347
- const r = this.imageWrappers.get(e);
2348
- if (r) {
2349
- for (const n of r) this.unwrapImage(n);
2350
- this.imageWrappers.delete(e);
2351
- }
2352
- }
2353
- strikeMath(e, r) {
2354
- const n = this.resolveImageScope(r);
2355
- if (!n) return;
2356
- const i = [];
2357
- for (const s of n.querySelectorAll(b.MATH_SELECTOR)) {
2358
- const l = s.querySelector(b.MATH_BOX_SELECTOR) ?? s, o = !!l.querySelector(b.MATH_STACKED_SELECTOR);
2359
- l.classList.add(b.MATH_STRIKE_CLASS, o ? b.MATH_STRIKE_CROSS_CLASS : b.MATH_STRIKE_LINE_CLASS), l.setAttribute(b.MATH_STRIKE_ATTR, o ? "cross" : "line"), i.push(l);
2360
- }
2361
- i.length > 0 && this.mathTargets.set(e, i);
2362
- }
2363
- unstrikeMath(e) {
2364
- const r = this.mathTargets.get(e);
2365
- if (r) {
2366
- for (const n of r)
2367
- n.classList.remove(b.MATH_STRIKE_CLASS, b.MATH_STRIKE_LINE_CLASS, b.MATH_STRIKE_CROSS_CLASS), n.removeAttribute(b.MATH_STRIKE_ATTR);
2368
- this.mathTargets.delete(e);
2369
- }
2370
- }
2371
- resolveImageScope(e) {
2372
- const r = e.commonAncestorContainer;
2373
- return (r.nodeType === Node.TEXT_NODE ? r.parentElement : r) ?? this.findChoiceContainer(e);
2374
- }
2375
- wrapImage(e) {
2376
- const r = e.parentElement;
2377
- if (!r) return null;
2378
- if (r.classList.contains(b.IMAGE_WRAPPER_CLASS) || r.hasAttribute(b.IMAGE_WRAPPER_ATTR)) return r;
2379
- const n = document.createElement("span");
2380
- return n.className = b.IMAGE_WRAPPER_CLASS, n.setAttribute(b.IMAGE_WRAPPER_ATTR, "true"), this.fillsParentWidth(e, r) ? n.style.display = "block" : b.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;
2381
- }
2382
- fillsParentWidth(e, r) {
2383
- const n = e.getBoundingClientRect().width, i = r.clientWidth;
2384
- return n === 0 || i === 0 ? !1 : n >= i - 1;
2385
- }
2386
- unwrapImage(e) {
2387
- e.querySelector(`.${b.IMAGE_OVERLAY_CLASS}`)?.remove();
2388
- const r = e.parentElement;
2389
- if (r) {
2390
- for (; e.firstChild; ) r.insertBefore(e.firstChild, e);
2391
- e.remove();
2392
- }
2393
- }
2394
- createImageStrikeOverlay() {
2395
- const e = document.createElementNS(b.SVG_NS, "svg");
2396
- e.setAttribute("class", b.IMAGE_OVERLAY_CLASS), e.setAttribute("viewBox", "0 0 100 100"), e.setAttribute("preserveAspectRatio", "none"), e.setAttribute("aria-hidden", "true"), e.setAttribute("focusable", "false");
2397
- const r = [{
2398
- x1: "0",
2399
- y1: "0",
2400
- x2: "100",
2401
- y2: "100"
2402
- }, {
2403
- x1: "0",
2404
- y1: "100",
2405
- x2: "100",
2406
- y2: "0"
2407
- }];
2408
- for (const n of [b.IMAGE_CASING_CLASS, b.IMAGE_LINE_CLASS]) for (const { x1: i, y1: s, x2: l, y2: o } of r) {
2409
- const f = document.createElementNS(b.SVG_NS, "line");
2410
- f.setAttribute("class", n), f.setAttribute("x1", i), f.setAttribute("y1", s), f.setAttribute("x2", l), f.setAttribute("y2", o), f.setAttribute("vector-effect", "non-scaling-stroke"), e.appendChild(f);
2411
- }
2412
- return e;
2413
- }
2414
- resolveLabelElement(e) {
2415
- return e.querySelector(`[${b.LABEL_HOOK_ATTR}="true"]`) || e.querySelector("label");
2416
- }
2417
- };
2418
- u(C, "HIGHLIGHT_STYLE_PREFIX", "pie-answer-eliminator-highlight-");
2419
- u(C, "HIGHLIGHT_NAME_PREFIX", "pie-answer-eliminated-");
2420
- u(C, "FALLBACK_CLASS", "pie-answer-eliminator-eliminated-fallback");
2421
- u(C, "SR_CLASS", "pie-answer-eliminator-sr-announcement");
2422
- u(C, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice");
2423
- u(C, "LABEL_HOOK_ATTR", "data-pie-answer-eliminator-label");
2424
- u(C, "ELIMINATED_ATTR", "data-pie-answer-eliminated");
2425
- u(C, "ELIMINATED_ID_ATTR", "data-pie-answer-eliminated-id");
2426
- u(C, "IMAGE_WRAPPER_CLASS", "pie-answer-eliminator-image-strike");
2427
- u(C, "IMAGE_WRAPPER_ATTR", "data-pie-answer-eliminator-image-strike");
2428
- u(C, "IMAGE_OVERLAY_CLASS", "pie-answer-eliminator-image-strike-overlay");
2429
- u(C, "IMAGE_LINE_CLASS", "pie-answer-eliminator-image-strike-line");
2430
- u(C, "IMAGE_CASING_CLASS", "pie-answer-eliminator-image-strike-casing");
2431
- u(C, "MATH_STRIKE_CLASS", "pie-answer-eliminator-math-strike");
2432
- u(C, "MATH_STRIKE_LINE_CLASS", "pie-answer-eliminator-math-strike--line");
2433
- u(C, "MATH_STRIKE_CROSS_CLASS", "pie-answer-eliminator-math-strike--cross");
2434
- u(C, "MATH_STRIKE_ATTR", "data-pie-answer-eliminator-math-strike");
2435
- u(C, "MATH_STACKED_SELECTOR", "mjx-mfrac, mjx-mtable");
2436
- u(C, "MATH_BOX_SELECTOR", "mjx-math");
2437
- u(C, "MATH_SELECTOR", "mjx-container");
2438
- u(C, "SVG_NS", "http://www.w3.org/2000/svg");
2439
- u(C, "BLOCK_DISPLAYS", /* @__PURE__ */ new Set([
2440
- "block",
2441
- "flex",
2442
- "grid",
2443
- "table",
2444
- "flow-root",
2445
- "list-item"
2446
- ]));
2447
- var Hr = "answerEliminator", fr = class gt {
2448
- constructor(e = "strikethrough", r = "right") {
2449
- u(this, "strategy", void 0), u(this, "choices", /* @__PURE__ */ new Map()), u(this, "eliminated", /* @__PURE__ */ new Set()), u(this, "strategyKeys", /* @__PURE__ */ new Map()), u(this, "anonymousGroups", /* @__PURE__ */ new WeakMap()), u(this, "nextToken", 0), u(this, "buttonAlignment", "right"), 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", {}), this.strategy = this.createStrategy(e), this.strategy.initialize(), this.buttonAlignment = r;
2450
- }
2451
- createStrategy(e) {
2452
- return e === "mask" ? new xe() : new C();
2453
- }
2454
- initializeForQuestion(e) {
2455
- this.active = !0;
2456
- const r = new Set(this.eliminated);
2457
- this.restoreAllSelectable(), this.strategy.clearAll(), this.eliminated.clear(), this.cleanupButtons();
2458
- for (const i of xr(e)) this.initializeChoice(i, e);
2459
- const n = this.readPersistedEliminations();
2460
- for (const [i, s] of this.choices) (n.has(s.group) ? n.get(s.group)?.has(s.choiceId) : r.has(i)) && this.applyElimination(i, s);
2461
- this.attachSelectionListener(e);
2462
- }
2463
- trackingKey(e, r) {
2464
- return `${e}\0${r}`;
2465
- }
2466
- resolveGroup({ target: e, owner: r }, n) {
2467
- let i = r;
2468
- for (let o = r ?? e.container.parentElement; o !== null; o = o === n ? null : o.parentElement) {
2469
- if (o.id && Object.hasOwn(this.elementStateKeys, o.id)) return o.id;
2470
- i === null && o.localName.includes("-") && (i = o);
2471
- }
2472
- const s = i ?? n;
2473
- let l = this.anonymousGroups.get(s);
2474
- return l || (l = `\0anonymous-${this.nextToken++}`, this.anonymousGroups.set(s, l)), l;
2475
- }
2476
- strategyKeyFor(e) {
2477
- let r = this.strategyKeys.get(e);
2478
- return r || (r = `choice-${this.nextToken++}`, this.strategyKeys.set(e, r)), r;
2479
- }
2480
- initializeChoice(e, r) {
2481
- const { target: n, owner: i } = e, s = n.id, l = this.resolveGroup(e, r), o = this.trackingKey(l, s), f = {
2482
- choiceId: s,
2483
- group: l,
2484
- strategyKey: this.strategyKeyFor(o),
2485
- target: n,
2486
- owner: i,
2487
- button: null
2488
- };
2489
- this.choices.set(o, f);
2490
- const y = this.createToggleButton(o, f, this.alignmentFor(n.container));
2491
- f.button = y, this.updateButtonVisibility(o), n.container.style.position = "relative", n.container.appendChild(y);
2492
- }
2493
- alignmentFor(e) {
2494
- return this.buttonAlignment === "inline" || getComputedStyle(e).display === "inline" ? "inline" : this.buttonAlignment;
2495
- }
2496
- createToggleButton(e, r, n) {
2497
- const i = r.target.label, s = document.createElement("button");
2498
- s.type = "button", s.className = gt.TOGGLE_CLASS, s.setAttribute("aria-label", `Toggle elimination for ${i}`), s.setAttribute("aria-pressed", "false"), s.setAttribute("data-choice-id", r.choiceId);
2499
- const l = document.createElement("span");
2500
- return l.setAttribute("aria-hidden", "true"), l.textContent = "⊗", s.appendChild(l), this.applyButtonAlignment(s, n), s.dataset.pieShownDisplay = s.style.display, s.addEventListener("click", (o) => {
2501
- o.preventDefault(), o.stopPropagation(), this.toggleElimination(e);
2502
- }), s.addEventListener("focus", () => {
2503
- this.focusedKey = e;
2504
- }), s.addEventListener("blur", () => {
2505
- queueMicrotask(() => {
2506
- s.isConnected && this.focusedKey === e && (this.focusedKey = null);
2507
- });
2508
- }), s;
2509
- }
2510
- toggleElimination(e) {
2511
- const r = this.choices.get(e);
2512
- if (r) {
2513
- if (this.eliminated.has(e)) this.restoreChoice(e);
2514
- else {
2515
- if (!r.target.canEliminate()) {
2516
- console.warn("Cannot eliminate this choice (already selected or in evaluate mode)");
2517
- return;
2518
- }
2519
- if (!this.applyElimination(e, r)) {
2520
- console.error("Failed to create range for choice");
2521
- return;
2522
- }
2523
- }
2524
- this.saveState(r.group);
2525
- }
2526
- }
2527
- applyElimination(e, r, n = !0) {
2528
- if (r.target.isSelected()) return !1;
2529
- const i = r.target.createRange();
2530
- return i ? (this.strategy.apply(r.strategyKey, i), this.eliminated.add(e), n && r.target.setEliminated(!0), r.button && (r.button.classList.add(gt.TOGGLE_ACTIVE_CLASS), r.button.setAttribute("aria-pressed", "true")), this.updateButtonVisibility(e), !0) : !1;
2531
- }
2532
- restoreChoice(e) {
2533
- const r = this.choices.get(e);
2534
- this.eliminated.delete(e), r && (this.strategy.remove(r.strategyKey), r.target.setEliminated(!1), r.button && (r.button.classList.remove(gt.TOGGLE_ACTIVE_CLASS), r.button.setAttribute("aria-pressed", "false")), this.updateButtonVisibility(e));
2535
- }
2536
- resetAll() {
2537
- if (this.eliminated.size === 0) return;
2538
- const e = /* @__PURE__ */ new Set();
2539
- for (const r of Array.from(this.eliminated)) {
2540
- const n = this.choices.get(r)?.group;
2541
- n !== void 0 && e.add(n), this.restoreChoice(r);
2542
- }
2543
- for (const r of e) this.saveState(r);
2544
- }
2545
- getEliminatedCount() {
2546
- return this.eliminated.size;
2547
- }
2548
- setStoreIntegration(e, r) {
2549
- this.store = e, this.elementStateKeys = r;
2550
- }
2551
- saveState(e) {
2552
- if (!this.store || !Object.hasOwn(this.elementStateKeys, e)) return;
2553
- const r = [];
2554
- for (const n of this.eliminated) {
2555
- const i = this.choices.get(n);
2556
- i?.group === e && r.push(i.choiceId);
2557
- }
2558
- this.store.setState(this.elementStateKeys[e], Hr, { eliminatedChoices: r });
2559
- }
2560
- readPersistedEliminations() {
2561
- const e = /* @__PURE__ */ new Map();
2562
- if (!this.store || !this.shouldRestoreState) return e;
2563
- for (const { group: r } of this.choices.values())
2564
- if (!(e.has(r) || !Object.hasOwn(this.elementStateKeys, r)))
2565
- try {
2566
- const n = this.store.getState(this.elementStateKeys[r], Hr), i = Array.isArray(n?.eliminatedChoices) ? n.eliminatedChoices.filter((s) => typeof s == "string") : [];
2567
- e.set(r, new Set(i));
2568
- } catch (n) {
2569
- console.error("Failed to restore eliminator state:", n);
2570
- }
2571
- return e;
2572
- }
2573
- restoreAllSelectable() {
2574
- for (const e of this.eliminated) this.choices.get(e)?.target.setEliminated(!1);
2575
- }
2576
- setButtonHidden(e, r) {
2577
- const n = r ? "none" : e.dataset.pieShownDisplay ?? "";
2578
- e.style.display !== n && (e.style.display = n);
2579
- }
2580
- shouldHideButton(e, r) {
2581
- return this.eliminated.has(e) ? !1 : this.active ? r.target.isSelected() : !0;
2582
- }
2583
- updateButtonVisibility(e) {
2584
- const r = this.choices.get(e);
2585
- r?.button && this.setButtonHidden(r.button, this.shouldHideButton(e, r));
2586
- }
2587
- refreshSelectionState() {
2588
- for (const e of this.choices.keys()) this.updateButtonVisibility(e);
2589
- }
2590
- hasDetachedChoice() {
2591
- for (const { target: e } of this.choices.values()) if (!e.container.isConnected) return !0;
2592
- return !1;
2593
- }
2594
- rescan() {
2595
- const e = this.questionRoot;
2596
- if (!e) return;
2597
- const r = this.focusedKey !== null && !this.choices.get(this.focusedKey)?.button?.isConnected && (document.activeElement === null || document.activeElement === document.body) ? this.focusedKey : null, n = this.choices, i = new Set(this.eliminated);
2598
- this.strategy.clearAll(), this.eliminated.clear();
2599
- for (const { button: s } of n.values()) s?.remove();
2600
- this.choices = /* @__PURE__ */ new Map();
2601
- for (const s of xr(e)) this.initializeChoice(s, e);
2602
- for (const s of i) {
2603
- const l = n.get(s), o = this.choices.get(s), f = !!l?.owner && o?.owner === l.owner;
2604
- o && this.applyElimination(s, o, !f) || (o ?? l)?.target.setEliminated(!1);
2605
- }
2606
- r && this.choices.get(r)?.button?.focus({ preventScroll: !0 });
2607
- }
2608
- scheduleSelectionRefresh() {
2609
- this.selectionRefreshFrame === null && (this.selectionRefreshFrame = requestAnimationFrame(() => {
2610
- this.selectionRefreshFrame = null, this.refreshSelectionState();
2611
- }));
2612
- }
2613
- attachSelectionListener(e) {
2614
- this.detachSelectionListener(), this.questionRoot = e, this.selectionChangeHandler = () => this.scheduleSelectionRefresh(), e.addEventListener("change", this.selectionChangeHandler), typeof MutationObserver < "u" && (this.selectionObserver = new MutationObserver((r) => {
2615
- const n = /* @__PURE__ */ new Set();
2616
- for (const { button: i } of this.choices.values()) i && n.add(i);
2617
- r.some((i) => !n.has(i.target)) && (this.hasDetachedChoice() ? this.rescan() : this.scheduleSelectionRefresh());
2618
- }), this.selectionObserver.observe(e, {
2619
- subtree: !0,
2620
- childList: !0,
2621
- attributes: !0
2622
- }));
2623
- }
2624
- detachSelectionListener() {
2625
- 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;
2626
- }
2627
- cleanupButtons() {
2628
- this.detachSelectionListener(), this.focusedKey = null;
2629
- for (const { button: e } of this.choices.values()) e?.remove();
2630
- this.choices.clear();
2631
- }
2632
- applyButtonAlignment(e, r) {
2633
- switch (r) {
2634
- case "right":
2635
- Object.assign(e.style, {
2636
- position: "absolute",
2637
- right: "8px",
2638
- top: "50%",
2639
- transform: "translateY(-50%)"
2640
- });
2641
- break;
2642
- case "left":
2643
- Object.assign(e.style, {
2644
- position: "absolute",
2645
- left: "8px",
2646
- top: "50%",
2647
- transform: "translateY(-50%)"
2648
- });
2649
- break;
2650
- case "inline":
2651
- Object.assign(e.style, {
2652
- position: "relative",
2653
- marginLeft: "8px",
2654
- marginRight: "8px",
2655
- display: "inline-flex",
2656
- verticalAlign: "middle"
2657
- });
2658
- }
2659
- }
2660
- enableStateRestoration() {
2661
- this.shouldRestoreState = !0;
2662
- }
2663
- disableStateRestoration() {
2664
- this.shouldRestoreState = !1;
2665
- }
2666
- cleanup() {
2667
- this.active = !1, this.refreshSelectionState();
2668
- }
2669
- destroy() {
2670
- this.restoreAllSelectable(), this.eliminated.clear(), this.cleanupButtons(), this.strategy.destroy();
2671
- }
2672
- };
2673
- u(fr, "TOGGLE_CLASS", "pie-answer-eliminator-toggle");
2674
- u(fr, "TOGGLE_ACTIVE_CLASS", "pie-answer-eliminator-toggle--active");
2675
- var Hs = /* @__PURE__ */ ns('<div style="display: none;" aria-hidden="true"></div>');
2676
- function Ns(t, e) {
2677
- Yr(e, !0);
2678
- 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, () => ({})), o = /* @__PURE__ */ W(null), f = /* @__PURE__ */ W(null), y = /* @__PURE__ */ W(null);
2679
- const v = /* @__PURE__ */ gr(() => A(f)?.elementToolStateStore ?? null);
2680
- let c = /* @__PURE__ */ W(null), d = /* @__PURE__ */ W(null), h = /* @__PURE__ */ gr(() => i() || r());
2681
- Ne(() => {
2682
- if (A(o))
2683
- return Fn(A(o), (w) => {
2684
- P(f, w, !0);
2685
- });
2686
- }), Ne(() => {
2687
- if (A(o))
2688
- return Gn(A(o), (w) => {
2689
- P(y, w, !0);
2690
- });
2691
- });
2692
- function _() {
2693
- return A(y)?.scopeElement || null;
2694
- }
2695
- function p() {
2696
- if (!A(h) || !A(c)) return;
2697
- const w = _();
2698
- if (!w) {
2699
- console.warn("[AnswerEliminator] Missing shell scope context for question root");
2700
- return;
2701
- }
2702
- A(c).initializeForQuestion(w);
2703
- }
2704
- function R() {
2705
- requestAnimationFrame(() => {
2706
- requestAnimationFrame(() => {
2707
- p();
2708
- });
2709
- });
2710
- }
2711
- Ne(() => {
2712
- A(c)?.setStoreIntegration(A(v), l() ?? {});
2713
- }), Ne(() => {
2714
- const w = new fr(n(), s());
2715
- return Bt(() => {
2716
- w.setStoreIntegration(A(v), l() ?? {}), P(c, w, !0), A(h) ? p() : w.cleanup();
2717
- }), () => {
2718
- w.destroy(), A(c) === w && P(c, null);
2719
- };
2720
- }), Ne(() => {
2721
- const w = A(y)?.contextVersion ?? null;
2722
- if (w !== null) {
2723
- if (A(d) === null) {
2724
- P(d, w, !0);
2725
- return;
2726
- }
2727
- w !== A(d) && (P(d, w, !0), R());
2728
- }
2729
- }), Ne(() => {
2730
- A(c) && (A(h) ? (A(c).enableStateRestoration(), p()) : A(c).cleanup());
2731
- });
2732
- var L = {
2733
- get visible() {
2734
- return r();
2735
- },
2736
- set visible(w = !1) {
2737
- r(w), Be();
2738
- },
2739
- get strategy() {
2740
- return n();
2741
- },
2742
- set strategy(w = "strikethrough") {
2743
- n(w), Be();
2744
- },
2745
- get alwaysOn() {
2746
- return i();
2747
- },
2748
- set alwaysOn(w = !1) {
2749
- i(w), Be();
2750
- },
2751
- get buttonAlignment() {
2752
- return s();
2753
- },
2754
- set buttonAlignment(w = "right") {
2755
- s(w), Be();
2756
- },
2757
- get elementStateKeys() {
2758
- return l();
2759
- },
2760
- set elementStateKeys(w = {}) {
2761
- l(w), Be();
2762
- }
2763
- }, x = Hs();
2764
- return gs(x, (w) => P(o, w), () => A(o)), kn(t, x), zr(L);
2765
- }
2766
- Ps("pie-tool-answer-eliminator", As(Ns, {
2767
- visible: {
2768
- attribute: "visible",
2769
- type: "Boolean"
2770
- },
2771
- strategy: {
2772
- attribute: "strategy",
2773
- type: "String"
2774
- },
2775
- alwaysOn: {
2776
- attribute: "always-on",
2777
- type: "Boolean"
2778
- },
2779
- buttonAlignment: {
2780
- attribute: "button-alignment",
2781
- type: "String"
2782
- },
2783
- elementStateKeys: { type: "Object" }
2784
- }, [], [], { mode: "open" }, Bn));
2785
- function Ps(t, e) {
2786
- customElements.get(t) || customElements.define(t, e);
2787
- }
2788
- export {
2789
- Ns as default
2790
- };
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};