@pie-players/pie-tool-answer-eliminator 0.2.9 → 0.2.11

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,126 +1,126 @@
1
- var Sn = Object.defineProperty;
2
- var Zt = (t) => {
1
+ var Rn = Object.defineProperty;
2
+ var li = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var An = (t, e, i) => e in t ? Sn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
6
- var f = (t, e, i) => An(t, typeof e != "symbol" ? e + "" : e, i), Ct = (t, e, i) => e.has(t) || Zt("Cannot " + i);
7
- var c = (t, e, i) => (Ct(t, e, "read from private field"), i ? i.call(t) : e.get(t)), w = (t, e, i) => e.has(t) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), v = (t, e, i, n) => (Ct(t, e, "write to private field"), n ? n.call(t, i) : e.set(t, i), i), V = (t, e, i) => (Ct(t, e, "access private method"), i);
8
- var pi;
9
- typeof window < "u" && ((pi = window.__svelte ?? (window.__svelte = {})).v ?? (pi.v = /* @__PURE__ */ new Set())).add("5");
10
- const In = 2, gi = "[", mi = "[!", vi = "]", mt = {}, k = /* @__PURE__ */ Symbol(), En = "http://www.w3.org/1999/xhtml", kt = !1;
11
- var $n = Array.isArray, Cn = Array.prototype.indexOf, Ge = Array.prototype.includes, kn = Array.from, vt = Object.keys, bt = Object.defineProperty, De = Object.getOwnPropertyDescriptor, Rn = Object.prototype, On = Array.prototype, Ln = Object.getPrototypeOf, ei = Object.isExtensible;
12
- const Vn = () => {
5
+ var On = (t, e, i) => e in t ? Rn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
6
+ var f = (t, e, i) => On(t, typeof e != "symbol" ? e + "" : e, i), Ht = (t, e, i) => e.has(t) || li("Cannot " + i);
7
+ var c = (t, e, i) => (Ht(t, e, "read from private field"), i ? i.call(t) : e.get(t)), A = (t, e, i) => e.has(t) ? li("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), _ = (t, e, i, n) => (Ht(t, e, "write to private field"), n ? n.call(t, i) : e.set(t, i), i), D = (t, e, i) => (Ht(t, e, "access private method"), i);
8
+ var Ai;
9
+ typeof window < "u" && ((Ai = window.__svelte ?? (window.__svelte = {})).v ?? (Ai.v = /* @__PURE__ */ new Set())).add("5");
10
+ const kn = 2, Ii = "[", Ei = "[!", wi = "]", yt = {}, N = /* @__PURE__ */ Symbol(), Hn = "http://www.w3.org/1999/xhtml", Nt = !1;
11
+ var Nn = Array.isArray, Vn = Array.prototype.indexOf, Xe = Array.prototype.includes, Mn = Array.from, Tt = Object.keys, At = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, Fn = Object.prototype, Dn = Array.prototype, Pn = Object.getPrototypeOf, ai = Object.isExtensible;
12
+ const Bn = () => {
13
13
  };
14
- function Nn(t) {
14
+ function Gn(t) {
15
15
  for (var e = 0; e < t.length; e++)
16
16
  t[e]();
17
17
  }
18
- function Mn() {
19
- var t, e, i = new Promise((n, r) => {
20
- t = n, e = r;
18
+ function jn() {
19
+ var t, e, i = new Promise((n, s) => {
20
+ t = n, e = s;
21
21
  });
22
22
  return { promise: i, resolve: t, reject: e };
23
23
  }
24
- const C = 2, Ze = 4, bi = 8, yi = 1 << 24, ge = 16, me = 32, Ae = 64, Rt = 128, z = 512, R = 1024, L = 2048, Z = 4096, ye = 8192, _e = 16384, Ye = 32768, yt = 65536, ti = 1 << 17, _i = 1 << 18, We = 1 << 19, Fn = 1 << 20, Ne = 65536, Ot = 1 << 21, wi = 1 << 22, et = 1 << 23, ft = /* @__PURE__ */ Symbol("$state"), Dn = /* @__PURE__ */ Symbol("legacy props"), Ht = new class extends Error {
24
+ const H = 2, nt = 4, Si = 8, $i = 1 << 24, be = 16, _e = 32, Ce = 64, Vt = 128, x = 512, V = 1024, F = 2048, te = 4096, Ie = 8192, Ee = 16384, Qe = 32768, It = 65536, ci = 1 << 17, Ci = 1 << 18, Je = 1 << 19, qn = 1 << 20, De = 65536, Mt = 1 << 21, Li = 1 << 22, st = 1 << 23, gt = /* @__PURE__ */ Symbol("$state"), Kn = /* @__PURE__ */ Symbol("legacy props"), Wt = new class extends Error {
25
25
  constructor() {
26
26
  super(...arguments);
27
27
  f(this, "name", "StaleReactionError");
28
28
  f(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
29
29
  }
30
- }(), qt = 8;
31
- function Pn(t) {
30
+ }(), Qt = 8;
31
+ function zn(t) {
32
32
  throw new Error("https://svelte.dev/e/lifecycle_outside_component");
33
33
  }
34
- function xn(t) {
34
+ function Yn(t) {
35
35
  throw new Error("https://svelte.dev/e/effect_in_teardown");
36
36
  }
37
- function jn() {
37
+ function Un() {
38
38
  throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
39
39
  }
40
- function Bn(t) {
40
+ function xn(t) {
41
41
  throw new Error("https://svelte.dev/e/effect_orphan");
42
42
  }
43
- function Hn() {
43
+ function Xn() {
44
44
  throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
45
45
  }
46
- function qn() {
46
+ function Wn() {
47
47
  throw new Error("https://svelte.dev/e/hydration_failed");
48
48
  }
49
- function zn() {
49
+ function Qn() {
50
50
  throw new Error("https://svelte.dev/e/state_descriptors_fixed");
51
51
  }
52
- function Gn() {
52
+ function Jn() {
53
53
  throw new Error("https://svelte.dev/e/state_prototype_fixed");
54
54
  }
55
- function Un() {
55
+ function Zn() {
56
56
  throw new Error("https://svelte.dev/e/state_unsafe_mutation");
57
57
  }
58
- function Yn() {
58
+ function es() {
59
59
  throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
60
60
  }
61
- function Ti(t) {
61
+ function Ri(t) {
62
62
  console.warn("https://svelte.dev/e/hydration_mismatch");
63
63
  }
64
- function Wn() {
64
+ function ts() {
65
65
  console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
66
66
  }
67
- let Q = !1;
68
- function lt(t) {
69
- Q = t;
67
+ let J = !1;
68
+ function ft(t) {
69
+ J = t;
70
70
  }
71
- let M;
72
- function tt(t) {
71
+ let B;
72
+ function rt(t) {
73
73
  if (t === null)
74
- throw Ti(), mt;
75
- return M = t;
74
+ throw Ri(), yt;
75
+ return B = t;
76
76
  }
77
- function Si() {
78
- return tt(/* @__PURE__ */ Ke(M));
77
+ function Oi() {
78
+ return rt(/* @__PURE__ */ Ze(B));
79
79
  }
80
- function Kn(t = 1) {
81
- if (Q) {
82
- for (var e = t, i = M; e--; )
80
+ function is(t = 1) {
81
+ if (J) {
82
+ for (var e = t, i = B; e--; )
83
83
  i = /** @type {TemplateNode} */
84
- /* @__PURE__ */ Ke(i);
85
- M = i;
84
+ /* @__PURE__ */ Ze(i);
85
+ B = i;
86
86
  }
87
87
  }
88
- function Qn(t = !0) {
89
- for (var e = 0, i = M; ; ) {
90
- if (i.nodeType === qt) {
88
+ function ns(t = !0) {
89
+ for (var e = 0, i = B; ; ) {
90
+ if (i.nodeType === Qt) {
91
91
  var n = (
92
92
  /** @type {Comment} */
93
93
  i.data
94
94
  );
95
- if (n === vi) {
95
+ if (n === wi) {
96
96
  if (e === 0) return i;
97
97
  e -= 1;
98
- } else (n === gi || n === mi || // "[1", "[2", etc. for if blocks
98
+ } else (n === Ii || n === Ei || // "[1", "[2", etc. for if blocks
99
99
  n[0] === "[" && !isNaN(Number(n.slice(1)))) && (e += 1);
100
100
  }
101
- var r = (
101
+ var s = (
102
102
  /** @type {TemplateNode} */
103
- /* @__PURE__ */ Ke(i)
103
+ /* @__PURE__ */ Ze(i)
104
104
  );
105
- t && i.remove(), i = r;
105
+ t && i.remove(), i = s;
106
106
  }
107
107
  }
108
- function Ai(t) {
108
+ function ki(t) {
109
109
  return t === this.v;
110
110
  }
111
- function Jn(t, e) {
111
+ function ss(t, e) {
112
112
  return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
113
113
  }
114
- function Xn(t) {
115
- return !Jn(t, this.v);
114
+ function rs(t) {
115
+ return !ss(t, this.v);
116
116
  }
117
- let Zn = !1, U = null;
118
- function _t(t) {
119
- U = t;
117
+ let os = !1, W = null;
118
+ function Et(t) {
119
+ W = t;
120
120
  }
121
- function Ii(t, e = !1, i) {
122
- U = {
123
- p: U,
121
+ function Hi(t, e = !1, i) {
122
+ W = {
123
+ p: W,
124
124
  i: !1,
125
125
  c: null,
126
126
  e: null,
@@ -129,52 +129,52 @@ function Ii(t, e = !1, i) {
129
129
  l: null
130
130
  };
131
131
  }
132
- function Ei(t) {
132
+ function Ni(t) {
133
133
  var e = (
134
134
  /** @type {ComponentContext} */
135
- U
135
+ W
136
136
  ), i = e.e;
137
137
  if (i !== null) {
138
138
  e.e = null;
139
139
  for (var n of i)
140
- Xi(n);
140
+ ln(n);
141
141
  }
142
- return t !== void 0 && (e.x = t), e.i = !0, U = e.p, t ?? /** @type {T} */
142
+ return t !== void 0 && (e.x = t), e.i = !0, W = e.p, t ?? /** @type {T} */
143
143
  {};
144
144
  }
145
- function $i() {
145
+ function Vi() {
146
146
  return !0;
147
147
  }
148
- let Ee = [];
149
- function Ci() {
150
- var t = Ee;
151
- Ee = [], Nn(t);
148
+ let Re = [];
149
+ function Mi() {
150
+ var t = Re;
151
+ Re = [], Gn(t);
152
152
  }
153
- function Le(t) {
154
- if (Ee.length === 0 && !Je) {
155
- var e = Ee;
153
+ function Me(t) {
154
+ if (Re.length === 0 && !tt) {
155
+ var e = Re;
156
156
  queueMicrotask(() => {
157
- e === Ee && Ci();
157
+ e === Re && Mi();
158
158
  });
159
159
  }
160
- Ee.push(t);
160
+ Re.push(t);
161
161
  }
162
- function er() {
163
- for (; Ee.length > 0; )
164
- Ci();
162
+ function ls() {
163
+ for (; Re.length > 0; )
164
+ Mi();
165
165
  }
166
- function ki(t) {
167
- var e = S;
166
+ function Fi(t) {
167
+ var e = E;
168
168
  if (e === null)
169
- return b.f |= et, t;
170
- if ((e.f & Ye) === 0 && (e.f & Ze) === 0)
169
+ return y.f |= st, t;
170
+ if ((e.f & Qe) === 0 && (e.f & nt) === 0)
171
171
  throw t;
172
172
  wt(t, e);
173
173
  }
174
174
  function wt(t, e) {
175
175
  for (; e !== null; ) {
176
- if ((e.f & Rt) !== 0) {
177
- if ((e.f & Ye) === 0)
176
+ if ((e.f & Vt) !== 0) {
177
+ if ((e.f & Qe) === 0)
178
178
  throw t;
179
179
  try {
180
180
  e.b.error(t);
@@ -187,30 +187,30 @@ function wt(t, e) {
187
187
  }
188
188
  throw t;
189
189
  }
190
- const tr = -7169;
191
- function I(t, e) {
192
- t.f = t.f & tr | e;
190
+ const as = -7169;
191
+ function R(t, e) {
192
+ t.f = t.f & as | e;
193
193
  }
194
- function zt(t) {
195
- (t.f & z) !== 0 || t.deps === null ? I(t, R) : I(t, Z);
194
+ function Jt(t) {
195
+ (t.f & x) !== 0 || t.deps === null ? R(t, V) : R(t, te);
196
196
  }
197
- function Ri(t) {
197
+ function Di(t) {
198
198
  if (t !== null)
199
199
  for (const e of t)
200
- (e.f & C) === 0 || (e.f & Ne) === 0 || (e.f ^= Ne, Ri(
200
+ (e.f & H) === 0 || (e.f & De) === 0 || (e.f ^= De, Di(
201
201
  /** @type {Derived} */
202
202
  e.deps
203
203
  ));
204
204
  }
205
- function Oi(t, e, i) {
206
- (t.f & L) !== 0 ? e.add(t) : (t.f & Z) !== 0 && i.add(t), Ri(t.deps), I(t, R);
205
+ function Pi(t, e, i) {
206
+ (t.f & F) !== 0 ? e.add(t) : (t.f & te) !== 0 && i.add(t), Di(t.deps), R(t, V);
207
207
  }
208
- const at = /* @__PURE__ */ new Set();
209
- let $ = null, K = null, D = [], St = null, Lt = !1, Je = !1;
210
- var Pe, xe, Ce, je, nt, rt, ke, ce, Be, se, Vt, Nt, Li;
211
- const Jt = class Jt {
208
+ const dt = /* @__PURE__ */ new Set();
209
+ let k = null, Q = null, G = [], Ct = null, Ft = !1, tt = !1;
210
+ var je, qe, ke, Ke, lt, at, He, de, ze, ae, Dt, Pt, Bi;
211
+ const ri = class ri {
212
212
  constructor() {
213
- w(this, se);
213
+ A(this, ae);
214
214
  f(this, "committed", !1);
215
215
  /**
216
216
  * The current values of any sources that are updated in this batch
@@ -229,36 +229,36 @@ const Jt = class Jt {
229
229
  * and append new ones by calling the functions added inside (if/each/key/etc) blocks
230
230
  * @type {Set<() => void>}
231
231
  */
232
- w(this, Pe, /* @__PURE__ */ new Set());
232
+ A(this, je, /* @__PURE__ */ new Set());
233
233
  /**
234
234
  * If a fork is discarded, we need to destroy any effects that are no longer needed
235
235
  * @type {Set<(batch: Batch) => void>}
236
236
  */
237
- w(this, xe, /* @__PURE__ */ new Set());
237
+ A(this, qe, /* @__PURE__ */ new Set());
238
238
  /**
239
239
  * The number of async effects that are currently in flight
240
240
  */
241
- w(this, Ce, 0);
241
+ A(this, ke, 0);
242
242
  /**
243
243
  * The number of async effects that are currently in flight, _not_ inside a pending boundary
244
244
  */
245
- w(this, je, 0);
245
+ A(this, Ke, 0);
246
246
  /**
247
247
  * A deferred that resolves when the batch is committed, used with `settled()`
248
248
  * TODO replace with Promise.withResolvers once supported widely enough
249
249
  * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
250
250
  */
251
- w(this, nt, null);
251
+ A(this, lt, null);
252
252
  /**
253
253
  * Deferred effects (which run after async work has completed) that are DIRTY
254
254
  * @type {Set<Effect>}
255
255
  */
256
- w(this, rt, /* @__PURE__ */ new Set());
256
+ A(this, at, /* @__PURE__ */ new Set());
257
257
  /**
258
258
  * Deferred effects that are MAYBE_DIRTY
259
259
  * @type {Set<Effect>}
260
260
  */
261
- w(this, ke, /* @__PURE__ */ new Set());
261
+ A(this, He, /* @__PURE__ */ new Set());
262
262
  /**
263
263
  * A map of branches that still exist, but will be destroyed when this batch
264
264
  * is committed — we skip over these during `process`.
@@ -266,19 +266,19 @@ const Jt = class Jt {
266
266
  * so they can be rescheduled if the branch survives.
267
267
  * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
268
268
  */
269
- w(this, ce, /* @__PURE__ */ new Map());
269
+ A(this, de, /* @__PURE__ */ new Map());
270
270
  f(this, "is_fork", !1);
271
- w(this, Be, !1);
271
+ A(this, ze, !1);
272
272
  }
273
273
  is_deferred() {
274
- return this.is_fork || c(this, je) > 0;
274
+ return this.is_fork || c(this, Ke) > 0;
275
275
  }
276
276
  /**
277
277
  * Add an effect to the #skipped_branches map and reset its children
278
278
  * @param {Effect} effect
279
279
  */
280
280
  skip_effect(e) {
281
- c(this, ce).has(e) || c(this, ce).set(e, { d: [], m: [] });
281
+ c(this, de).has(e) || c(this, de).set(e, { d: [], m: [] });
282
282
  }
283
283
  /**
284
284
  * Remove an effect from the #skipped_branches map and reschedule
@@ -286,13 +286,13 @@ const Jt = class Jt {
286
286
  * @param {Effect} effect
287
287
  */
288
288
  unskip_effect(e) {
289
- var i = c(this, ce).get(e);
289
+ var i = c(this, de).get(e);
290
290
  if (i) {
291
- c(this, ce).delete(e);
291
+ c(this, de).delete(e);
292
292
  for (var n of i.d)
293
- I(n, L), ne(n);
293
+ R(n, F), oe(n);
294
294
  for (n of i.m)
295
- I(n, Z), ne(n);
295
+ R(n, te), oe(n);
296
296
  }
297
297
  }
298
298
  /**
@@ -300,19 +300,19 @@ const Jt = class Jt {
300
300
  * @param {Effect[]} root_effects
301
301
  */
302
302
  process(e) {
303
- D = [], this.apply();
303
+ G = [], this.apply();
304
304
  var i = [], n = [];
305
- for (const r of e)
306
- V(this, se, Vt).call(this, r, i, n);
305
+ for (const s of e)
306
+ D(this, ae, Dt).call(this, s, i, n);
307
307
  if (this.is_deferred()) {
308
- V(this, se, Nt).call(this, n), V(this, se, Nt).call(this, i);
309
- for (const [r, s] of c(this, ce))
310
- Fi(r, s);
308
+ D(this, ae, Pt).call(this, n), D(this, ae, Pt).call(this, i);
309
+ for (const [s, r] of c(this, de))
310
+ Ki(s, r);
311
311
  } else {
312
- for (const r of c(this, Pe)) r();
313
- c(this, Pe).clear(), c(this, Ce) === 0 && V(this, se, Li).call(this), $ = null, ii(n), ii(i), c(this, nt)?.resolve();
312
+ for (const s of c(this, je)) s();
313
+ c(this, je).clear(), c(this, ke) === 0 && D(this, ae, Bi).call(this), k = null, ui(n), ui(i), c(this, lt)?.resolve();
314
314
  }
315
- K = null;
315
+ Q = null;
316
316
  }
317
317
  /**
318
318
  * Associate a change to a given source with the current
@@ -321,318 +321,318 @@ const Jt = class Jt {
321
321
  * @param {any} value
322
322
  */
323
323
  capture(e, i) {
324
- i !== k && !this.previous.has(e) && this.previous.set(e, i), (e.f & et) === 0 && (this.current.set(e, e.v), K?.set(e, e.v));
324
+ i !== N && !this.previous.has(e) && this.previous.set(e, i), (e.f & st) === 0 && (this.current.set(e, e.v), Q?.set(e, e.v));
325
325
  }
326
326
  activate() {
327
- $ = this, this.apply();
327
+ k = this, this.apply();
328
328
  }
329
329
  deactivate() {
330
- $ === this && ($ = null, K = null);
330
+ k === this && (k = null, Q = null);
331
331
  }
332
332
  flush() {
333
- if (this.activate(), D.length > 0) {
334
- if (Vi(), $ !== null && $ !== this)
333
+ if (this.activate(), G.length > 0) {
334
+ if (Gi(), k !== null && k !== this)
335
335
  return;
336
- } else c(this, Ce) === 0 && this.process([]);
336
+ } else c(this, ke) === 0 && this.process([]);
337
337
  this.deactivate();
338
338
  }
339
339
  discard() {
340
- for (const e of c(this, xe)) e(this);
341
- c(this, xe).clear();
340
+ for (const e of c(this, qe)) e(this);
341
+ c(this, qe).clear();
342
342
  }
343
343
  /**
344
344
  *
345
345
  * @param {boolean} blocking
346
346
  */
347
347
  increment(e) {
348
- v(this, Ce, c(this, Ce) + 1), e && v(this, je, c(this, je) + 1);
348
+ _(this, ke, c(this, ke) + 1), e && _(this, Ke, c(this, Ke) + 1);
349
349
  }
350
350
  /**
351
351
  *
352
352
  * @param {boolean} blocking
353
353
  */
354
354
  decrement(e) {
355
- v(this, Ce, c(this, Ce) - 1), e && v(this, je, c(this, je) - 1), !c(this, Be) && (v(this, Be, !0), Le(() => {
356
- v(this, Be, !1), this.is_deferred() ? D.length > 0 && this.flush() : this.revive();
355
+ _(this, ke, c(this, ke) - 1), e && _(this, Ke, c(this, Ke) - 1), !c(this, ze) && (_(this, ze, !0), Me(() => {
356
+ _(this, ze, !1), this.is_deferred() ? G.length > 0 && this.flush() : this.revive();
357
357
  }));
358
358
  }
359
359
  revive() {
360
- for (const e of c(this, rt))
361
- c(this, ke).delete(e), I(e, L), ne(e);
362
- for (const e of c(this, ke))
363
- I(e, Z), ne(e);
360
+ for (const e of c(this, at))
361
+ c(this, He).delete(e), R(e, F), oe(e);
362
+ for (const e of c(this, He))
363
+ R(e, te), oe(e);
364
364
  this.flush();
365
365
  }
366
366
  /** @param {() => void} fn */
367
367
  oncommit(e) {
368
- c(this, Pe).add(e);
368
+ c(this, je).add(e);
369
369
  }
370
370
  /** @param {(batch: Batch) => void} fn */
371
371
  ondiscard(e) {
372
- c(this, xe).add(e);
372
+ c(this, qe).add(e);
373
373
  }
374
374
  settled() {
375
- return (c(this, nt) ?? v(this, nt, Mn())).promise;
375
+ return (c(this, lt) ?? _(this, lt, jn())).promise;
376
376
  }
377
377
  static ensure() {
378
- if ($ === null) {
379
- const e = $ = new Jt();
380
- at.add($), Je || Le(() => {
381
- $ === e && e.flush();
378
+ if (k === null) {
379
+ const e = k = new ri();
380
+ dt.add(k), tt || Me(() => {
381
+ k === e && e.flush();
382
382
  });
383
383
  }
384
- return $;
384
+ return k;
385
385
  }
386
386
  apply() {
387
387
  }
388
388
  };
389
- Pe = new WeakMap(), xe = new WeakMap(), Ce = new WeakMap(), je = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), ke = new WeakMap(), ce = new WeakMap(), Be = new WeakMap(), se = new WeakSet(), /**
389
+ je = new WeakMap(), qe = new WeakMap(), ke = new WeakMap(), Ke = new WeakMap(), lt = new WeakMap(), at = new WeakMap(), He = new WeakMap(), de = new WeakMap(), ze = new WeakMap(), ae = new WeakSet(), /**
390
390
  * Traverse the effect tree, executing effects or stashing
391
391
  * them for later execution as appropriate
392
392
  * @param {Effect} root
393
393
  * @param {Effect[]} effects
394
394
  * @param {Effect[]} render_effects
395
395
  */
396
- Vt = function(e, i, n) {
397
- e.f ^= R;
398
- for (var r = e.first, s = null; r !== null; ) {
399
- var o = r.f, l = (o & (me | Ae)) !== 0, a = l && (o & R) !== 0, u = a || (o & ye) !== 0 || c(this, ce).has(r);
400
- if (!u && r.fn !== null) {
401
- l ? r.f ^= R : s !== null && (o & (Ze | bi | yi)) !== 0 ? s.b.defer_effect(r) : (o & Ze) !== 0 ? i.push(r) : ot(r) && ((o & ge) !== 0 && c(this, ke).add(r), Ue(r));
402
- var d = r.first;
396
+ Dt = function(e, i, n) {
397
+ e.f ^= V;
398
+ for (var s = e.first, r = null; s !== null; ) {
399
+ var o = s.f, l = (o & (_e | Ce)) !== 0, a = l && (o & V) !== 0, u = a || (o & Ie) !== 0 || c(this, de).has(s);
400
+ if (!u && s.fn !== null) {
401
+ l ? s.f ^= V : r !== null && (o & (nt | Si | $i)) !== 0 ? r.b.defer_effect(s) : (o & nt) !== 0 ? i.push(s) : ut(s) && ((o & be) !== 0 && c(this, He).add(s), We(s));
402
+ var d = s.first;
403
403
  if (d !== null) {
404
- r = d;
404
+ s = d;
405
405
  continue;
406
406
  }
407
407
  }
408
- for (; r !== null; ) {
409
- r === s && (s = null);
410
- var m = r.next;
411
- if (m !== null) {
412
- r = m;
408
+ for (; s !== null; ) {
409
+ s === r && (r = null);
410
+ var v = s.next;
411
+ if (v !== null) {
412
+ s = v;
413
413
  break;
414
414
  }
415
- r = r.parent;
415
+ s = s.parent;
416
416
  }
417
417
  }
418
418
  }, /**
419
419
  * @param {Effect[]} effects
420
420
  */
421
- Nt = function(e) {
421
+ Pt = function(e) {
422
422
  for (var i = 0; i < e.length; i += 1)
423
- Oi(e[i], c(this, rt), c(this, ke));
424
- }, Li = function() {
425
- var r;
426
- if (at.size > 1) {
423
+ Pi(e[i], c(this, at), c(this, He));
424
+ }, Bi = function() {
425
+ var s;
426
+ if (dt.size > 1) {
427
427
  this.previous.clear();
428
- var e = K, i = !0;
429
- for (const s of at) {
430
- if (s === this) {
428
+ var e = Q, i = !0;
429
+ for (const r of dt) {
430
+ if (r === this) {
431
431
  i = !1;
432
432
  continue;
433
433
  }
434
434
  const o = [];
435
435
  for (const [a, u] of this.current) {
436
- if (s.current.has(a))
437
- if (i && u !== s.current.get(a))
438
- s.current.set(a, u);
436
+ if (r.current.has(a))
437
+ if (i && u !== r.current.get(a))
438
+ r.current.set(a, u);
439
439
  else
440
440
  continue;
441
441
  o.push(a);
442
442
  }
443
443
  if (o.length === 0)
444
444
  continue;
445
- const l = [...s.current.keys()].filter((a) => !this.current.has(a));
445
+ const l = [...r.current.keys()].filter((a) => !this.current.has(a));
446
446
  if (l.length > 0) {
447
- var n = D;
448
- D = [];
447
+ var n = G;
448
+ G = [];
449
449
  const a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
450
450
  for (const d of o)
451
- Ni(d, l, a, u);
452
- if (D.length > 0) {
453
- $ = s, s.apply();
454
- for (const d of D)
455
- V(r = s, se, Vt).call(r, d, [], []);
456
- s.deactivate();
451
+ ji(d, l, a, u);
452
+ if (G.length > 0) {
453
+ k = r, r.apply();
454
+ for (const d of G)
455
+ D(s = r, ae, Dt).call(s, d, [], []);
456
+ r.deactivate();
457
457
  }
458
- D = n;
458
+ G = n;
459
459
  }
460
460
  }
461
- $ = null, K = e;
461
+ k = null, Q = e;
462
462
  }
463
- this.committed = !0, at.delete(this);
463
+ this.committed = !0, dt.delete(this);
464
464
  };
465
- let pe = Jt;
466
- function le(t) {
467
- var e = Je;
468
- Je = !0;
465
+ let ve = ri;
466
+ function ue(t) {
467
+ var e = tt;
468
+ tt = !0;
469
469
  try {
470
470
  for (var i; ; ) {
471
- if (er(), D.length === 0 && ($?.flush(), D.length === 0))
472
- return St = null, /** @type {T} */
471
+ if (ls(), G.length === 0 && (k?.flush(), G.length === 0))
472
+ return Ct = null, /** @type {T} */
473
473
  i;
474
- Vi();
474
+ Gi();
475
475
  }
476
476
  } finally {
477
- Je = e;
477
+ tt = e;
478
478
  }
479
479
  }
480
- function Vi() {
481
- Lt = !0;
480
+ function Gi() {
481
+ Ft = !0;
482
482
  var t = null;
483
483
  try {
484
- for (var e = 0; D.length > 0; ) {
485
- var i = pe.ensure();
484
+ for (var e = 0; G.length > 0; ) {
485
+ var i = ve.ensure();
486
486
  if (e++ > 1e3) {
487
- var n, r;
488
- ir();
487
+ var n, s;
488
+ cs();
489
489
  }
490
- i.process(D), we.clear();
490
+ i.process(G), we.clear();
491
491
  }
492
492
  } finally {
493
- D = [], Lt = !1, St = null;
493
+ G = [], Ft = !1, Ct = null;
494
494
  }
495
495
  }
496
- function ir() {
496
+ function cs() {
497
497
  try {
498
- Hn();
498
+ Xn();
499
499
  } catch (t) {
500
- wt(t, St);
500
+ wt(t, Ct);
501
501
  }
502
502
  }
503
- let ae = null;
504
- function ii(t) {
503
+ let fe = null;
504
+ function ui(t) {
505
505
  var e = t.length;
506
506
  if (e !== 0) {
507
507
  for (var i = 0; i < e; ) {
508
508
  var n = t[i++];
509
- if ((n.f & (_e | ye)) === 0 && ot(n) && (ae = /* @__PURE__ */ new Set(), Ue(n), n.deps === null && n.first === null && n.nodes === null && n.teardown === null && n.ac === null && en(n), ae?.size > 0)) {
509
+ if ((n.f & (Ee | Ie)) === 0 && ut(n) && (fe = /* @__PURE__ */ new Set(), We(n), n.deps === null && n.first === null && n.nodes === null && n.teardown === null && n.ac === null && cn(n), fe?.size > 0)) {
510
510
  we.clear();
511
- for (const r of ae) {
512
- if ((r.f & (_e | ye)) !== 0) continue;
513
- const s = [r];
514
- let o = r.parent;
511
+ for (const s of fe) {
512
+ if ((s.f & (Ee | Ie)) !== 0) continue;
513
+ const r = [s];
514
+ let o = s.parent;
515
515
  for (; o !== null; )
516
- ae.has(o) && (ae.delete(o), s.push(o)), o = o.parent;
517
- for (let l = s.length - 1; l >= 0; l--) {
518
- const a = s[l];
519
- (a.f & (_e | ye)) === 0 && Ue(a);
516
+ fe.has(o) && (fe.delete(o), r.push(o)), o = o.parent;
517
+ for (let l = r.length - 1; l >= 0; l--) {
518
+ const a = r[l];
519
+ (a.f & (Ee | Ie)) === 0 && We(a);
520
520
  }
521
521
  }
522
- ae.clear();
522
+ fe.clear();
523
523
  }
524
524
  }
525
- ae = null;
525
+ fe = null;
526
526
  }
527
527
  }
528
- function Ni(t, e, i, n) {
528
+ function ji(t, e, i, n) {
529
529
  if (!i.has(t) && (i.add(t), t.reactions !== null))
530
- for (const r of t.reactions) {
531
- const s = r.f;
532
- (s & C) !== 0 ? Ni(
530
+ for (const s of t.reactions) {
531
+ const r = s.f;
532
+ (r & H) !== 0 ? ji(
533
533
  /** @type {Derived} */
534
- r,
534
+ s,
535
535
  e,
536
536
  i,
537
537
  n
538
- ) : (s & (wi | ge)) !== 0 && (s & L) === 0 && Mi(r, e, n) && (I(r, L), ne(
538
+ ) : (r & (Li | be)) !== 0 && (r & F) === 0 && qi(s, e, n) && (R(s, F), oe(
539
539
  /** @type {Effect} */
540
- r
540
+ s
541
541
  ));
542
542
  }
543
543
  }
544
- function Mi(t, e, i) {
544
+ function qi(t, e, i) {
545
545
  const n = i.get(t);
546
546
  if (n !== void 0) return n;
547
547
  if (t.deps !== null)
548
- for (const r of t.deps) {
549
- if (Ge.call(e, r))
548
+ for (const s of t.deps) {
549
+ if (Xe.call(e, s))
550
550
  return !0;
551
- if ((r.f & C) !== 0 && Mi(
551
+ if ((s.f & H) !== 0 && qi(
552
552
  /** @type {Derived} */
553
- r,
553
+ s,
554
554
  e,
555
555
  i
556
556
  ))
557
557
  return i.set(
558
558
  /** @type {Derived} */
559
- r,
559
+ s,
560
560
  !0
561
561
  ), !0;
562
562
  }
563
563
  return i.set(t, !1), !1;
564
564
  }
565
- function ne(t) {
566
- for (var e = St = t; e.parent !== null; ) {
565
+ function oe(t) {
566
+ for (var e = Ct = t; e.parent !== null; ) {
567
567
  e = e.parent;
568
568
  var i = e.f;
569
- if (Lt && e === S && (i & ge) !== 0 && (i & _i) === 0)
569
+ if (Ft && e === E && (i & be) !== 0 && (i & Ci) === 0)
570
570
  return;
571
- if ((i & (Ae | me)) !== 0) {
572
- if ((i & R) === 0) return;
573
- e.f ^= R;
571
+ if ((i & (Ce | _e)) !== 0) {
572
+ if ((i & V) === 0) return;
573
+ e.f ^= V;
574
574
  }
575
575
  }
576
- D.push(e);
576
+ G.push(e);
577
577
  }
578
- function Fi(t, e) {
579
- if (!((t.f & me) !== 0 && (t.f & R) !== 0)) {
580
- (t.f & L) !== 0 ? e.d.push(t) : (t.f & Z) !== 0 && e.m.push(t), I(t, R);
578
+ function Ki(t, e) {
579
+ if (!((t.f & _e) !== 0 && (t.f & V) !== 0)) {
580
+ (t.f & F) !== 0 ? e.d.push(t) : (t.f & te) !== 0 && e.m.push(t), R(t, V);
581
581
  for (var i = t.first; i !== null; )
582
- Fi(i, e), i = i.next;
582
+ Ki(i, e), i = i.next;
583
583
  }
584
584
  }
585
- function nr(t) {
586
- let e = 0, i = At(0), n;
585
+ function us(t) {
586
+ let e = 0, i = Lt(0), n;
587
587
  return () => {
588
- Ut() && (g(i), Yt(() => (e === 0 && (n = Kt(() => t(() => Xe(i)))), e += 1, () => {
589
- Le(() => {
590
- e -= 1, e === 0 && (n?.(), n = void 0, Xe(i));
588
+ ei() && (m(i), ti(() => (e === 0 && (n = ni(() => t(() => it(i)))), e += 1, () => {
589
+ Me(() => {
590
+ e -= 1, e === 0 && (n?.(), n = void 0, it(i));
591
591
  });
592
592
  })));
593
593
  };
594
594
  }
595
- var rr = yt | We;
596
- function sr(t, e, i) {
597
- new or(t, e, i);
595
+ var fs = It | Je;
596
+ function ds(t, e, i) {
597
+ new hs(t, e, i);
598
598
  }
599
- var H, st, ue, Re, ee, te, j, ie, fe, Oe, be, He, qe, ze, de, Tt, O, Di, Pi, Mt, dt, Ft;
600
- class or {
599
+ var Y, ct, he, Ne, ne, se, K, re, pe, Ve, Ae, Ye, Ue, xe, ge, $t, M, zi, Yi, Bt, mt, Gt;
600
+ class hs {
601
601
  /**
602
602
  * @param {TemplateNode} node
603
603
  * @param {BoundaryProps} props
604
604
  * @param {((anchor: Node) => void)} children
605
605
  */
606
606
  constructor(e, i, n) {
607
- w(this, O);
607
+ A(this, M);
608
608
  /** @type {Boundary | null} */
609
609
  f(this, "parent");
610
610
  f(this, "is_pending", !1);
611
611
  /** @type {TemplateNode} */
612
- w(this, H);
612
+ A(this, Y);
613
613
  /** @type {TemplateNode | null} */
614
- w(this, st, Q ? M : null);
614
+ A(this, ct, J ? B : null);
615
615
  /** @type {BoundaryProps} */
616
- w(this, ue);
616
+ A(this, he);
617
617
  /** @type {((anchor: Node) => void)} */
618
- w(this, Re);
618
+ A(this, Ne);
619
619
  /** @type {Effect} */
620
- w(this, ee);
620
+ A(this, ne);
621
621
  /** @type {Effect | null} */
622
- w(this, te, null);
622
+ A(this, se, null);
623
623
  /** @type {Effect | null} */
624
- w(this, j, null);
624
+ A(this, K, null);
625
625
  /** @type {Effect | null} */
626
- w(this, ie, null);
626
+ A(this, re, null);
627
627
  /** @type {DocumentFragment | null} */
628
- w(this, fe, null);
629
- w(this, Oe, 0);
630
- w(this, be, 0);
631
- w(this, He, !1);
628
+ A(this, pe, null);
629
+ A(this, Ve, 0);
630
+ A(this, Ae, 0);
631
+ A(this, Ye, !1);
632
632
  /** @type {Set<Effect>} */
633
- w(this, qe, /* @__PURE__ */ new Set());
633
+ A(this, Ue, /* @__PURE__ */ new Set());
634
634
  /** @type {Set<Effect>} */
635
- w(this, ze, /* @__PURE__ */ new Set());
635
+ A(this, xe, /* @__PURE__ */ new Set());
636
636
  /**
637
637
  * A source containing the number of pending async deriveds/expressions.
638
638
  * Only created if `$effect.pending()` is used inside the boundary,
@@ -640,34 +640,34 @@ class or {
640
640
  * calls followed by no-op flushes
641
641
  * @type {Source<number> | null}
642
642
  */
643
- w(this, de, null);
644
- w(this, Tt, nr(() => (v(this, de, At(c(this, Oe))), () => {
645
- v(this, de, null);
643
+ A(this, ge, null);
644
+ A(this, $t, us(() => (_(this, ge, Lt(c(this, Ve))), () => {
645
+ _(this, ge, null);
646
646
  })));
647
- v(this, H, e), v(this, ue, i), v(this, Re, (r) => {
648
- var s = (
647
+ _(this, Y, e), _(this, he, i), _(this, Ne, (s) => {
648
+ var r = (
649
649
  /** @type {Effect} */
650
- S
650
+ E
651
651
  );
652
- s.b = this, s.f |= Rt, n(r);
652
+ r.b = this, r.f |= Vt, n(s);
653
653
  }), this.parent = /** @type {Effect} */
654
- S.b, v(this, ee, br(() => {
655
- if (Q) {
656
- const r = (
654
+ E.b, _(this, ne, ws(() => {
655
+ if (J) {
656
+ const s = (
657
657
  /** @type {Comment} */
658
- c(this, st)
658
+ c(this, ct)
659
659
  );
660
- Si(), r.data === mi ? V(this, O, Pi).call(this) : V(this, O, Di).call(this);
660
+ Oi(), s.data === Ei ? D(this, M, Yi).call(this) : D(this, M, zi).call(this);
661
661
  } else
662
- V(this, O, Mt).call(this);
663
- }, rr)), Q && v(this, H, M);
662
+ D(this, M, Bt).call(this);
663
+ }, fs)), J && _(this, Y, B);
664
664
  }
665
665
  /**
666
666
  * Defer an effect inside a pending boundary until the boundary resolves
667
667
  * @param {Effect} effect
668
668
  */
669
669
  defer_effect(e) {
670
- Oi(e, c(this, qe), c(this, ze));
670
+ Pi(e, c(this, Ue), c(this, xe));
671
671
  }
672
672
  /**
673
673
  * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
@@ -677,7 +677,7 @@ class or {
677
677
  return !this.is_pending && (!this.parent || this.parent.is_rendered());
678
678
  }
679
679
  has_pending_snippet() {
680
- return !!c(this, ue).pending;
680
+ return !!c(this, he).pending;
681
681
  }
682
682
  /**
683
683
  * Update the source that powers `$effect.pending()` inside this boundary,
@@ -686,54 +686,54 @@ class or {
686
686
  * @param {1 | -1} d
687
687
  */
688
688
  update_pending_count(e) {
689
- V(this, O, Ft).call(this, e), v(this, Oe, c(this, Oe) + e), !(!c(this, de) || c(this, He)) && (v(this, He, !0), Le(() => {
690
- v(this, He, !1), c(this, de) && qi(c(this, de), c(this, Oe));
689
+ D(this, M, Gt).call(this, e), _(this, Ve, c(this, Ve) + e), !(!c(this, ge) || c(this, Ye)) && (_(this, Ye, !0), Me(() => {
690
+ _(this, Ye, !1), c(this, ge) && Qi(c(this, ge), c(this, Ve));
691
691
  }));
692
692
  }
693
693
  get_effect_pending() {
694
- return c(this, Tt).call(this), g(
694
+ return c(this, $t).call(this), m(
695
695
  /** @type {Source<number>} */
696
- c(this, de)
696
+ c(this, ge)
697
697
  );
698
698
  }
699
699
  /** @param {unknown} error */
700
700
  error(e) {
701
- var i = c(this, ue).onerror;
702
- let n = c(this, ue).failed;
701
+ var i = c(this, he).onerror;
702
+ let n = c(this, he).failed;
703
703
  if (!i && !n)
704
704
  throw e;
705
- c(this, te) && (X(c(this, te)), v(this, te, null)), c(this, j) && (X(c(this, j)), v(this, j, null)), c(this, ie) && (X(c(this, ie)), v(this, ie, null)), Q && (tt(
705
+ c(this, se) && (ee(c(this, se)), _(this, se, null)), c(this, K) && (ee(c(this, K)), _(this, K, null)), c(this, re) && (ee(c(this, re)), _(this, re, null)), J && (rt(
706
706
  /** @type {TemplateNode} */
707
- c(this, st)
708
- ), Kn(), tt(Qn()));
709
- var r = !1, s = !1;
707
+ c(this, ct)
708
+ ), is(), rt(ns()));
709
+ var s = !1, r = !1;
710
710
  const o = () => {
711
- if (r) {
712
- Wn();
711
+ if (s) {
712
+ ts();
713
713
  return;
714
714
  }
715
- r = !0, s && Yn(), c(this, ie) !== null && ht(c(this, ie), () => {
716
- v(this, ie, null);
717
- }), V(this, O, dt).call(this, () => {
718
- pe.ensure(), V(this, O, Mt).call(this);
715
+ s = !0, r && es(), c(this, re) !== null && vt(c(this, re), () => {
716
+ _(this, re, null);
717
+ }), D(this, M, mt).call(this, () => {
718
+ ve.ensure(), D(this, M, Bt).call(this);
719
719
  });
720
720
  };
721
- Le(() => {
721
+ Me(() => {
722
722
  try {
723
- s = !0, i?.(e, o), s = !1;
723
+ r = !0, i?.(e, o), r = !1;
724
724
  } catch (l) {
725
- wt(l, c(this, ee) && c(this, ee).parent);
725
+ wt(l, c(this, ne) && c(this, ne).parent);
726
726
  }
727
- n && v(this, ie, V(this, O, dt).call(this, () => {
728
- pe.ensure();
727
+ n && _(this, re, D(this, M, mt).call(this, () => {
728
+ ve.ensure();
729
729
  try {
730
- return Fe(() => {
730
+ return Be(() => {
731
731
  var l = (
732
732
  /** @type {Effect} */
733
- S
733
+ E
734
734
  );
735
- l.b = this, l.f |= Rt, n(
736
- c(this, H),
735
+ l.b = this, l.f |= Vt, n(
736
+ c(this, Y),
737
737
  () => e,
738
738
  () => o
739
739
  );
@@ -742,43 +742,43 @@ class or {
742
742
  return wt(
743
743
  l,
744
744
  /** @type {Effect} */
745
- c(this, ee).parent
745
+ c(this, ne).parent
746
746
  ), null;
747
747
  }
748
748
  }));
749
749
  });
750
750
  }
751
751
  }
752
- H = new WeakMap(), st = new WeakMap(), ue = new WeakMap(), Re = new WeakMap(), ee = new WeakMap(), te = new WeakMap(), j = new WeakMap(), ie = new WeakMap(), fe = new WeakMap(), Oe = new WeakMap(), be = new WeakMap(), He = new WeakMap(), qe = new WeakMap(), ze = new WeakMap(), de = new WeakMap(), Tt = new WeakMap(), O = new WeakSet(), Di = function() {
752
+ Y = new WeakMap(), ct = new WeakMap(), he = new WeakMap(), Ne = new WeakMap(), ne = new WeakMap(), se = new WeakMap(), K = new WeakMap(), re = new WeakMap(), pe = new WeakMap(), Ve = new WeakMap(), Ae = new WeakMap(), Ye = new WeakMap(), Ue = new WeakMap(), xe = new WeakMap(), ge = new WeakMap(), $t = new WeakMap(), M = new WeakSet(), zi = function() {
753
753
  try {
754
- v(this, te, Fe(() => c(this, Re).call(this, c(this, H))));
754
+ _(this, se, Be(() => c(this, Ne).call(this, c(this, Y))));
755
755
  } catch (e) {
756
756
  this.error(e);
757
757
  }
758
- }, Pi = function() {
759
- const e = c(this, ue).pending;
760
- e && (this.is_pending = !0, v(this, j, Fe(() => e(c(this, H)))), Le(() => {
761
- var i = v(this, fe, document.createDocumentFragment()), n = Wi();
762
- i.append(n), v(this, te, V(this, O, dt).call(this, () => (pe.ensure(), Fe(() => c(this, Re).call(this, n))))), c(this, be) === 0 && (c(this, H).before(i), v(this, fe, null), ht(
758
+ }, Yi = function() {
759
+ const e = c(this, he).pending;
760
+ e && (this.is_pending = !0, _(this, K, Be(() => e(c(this, Y)))), Me(() => {
761
+ var i = _(this, pe, document.createDocumentFragment()), n = nn();
762
+ i.append(n), _(this, se, D(this, M, mt).call(this, () => (ve.ensure(), Be(() => c(this, Ne).call(this, n))))), c(this, Ae) === 0 && (c(this, Y).before(i), _(this, pe, null), vt(
763
763
  /** @type {Effect} */
764
- c(this, j),
764
+ c(this, K),
765
765
  () => {
766
- v(this, j, null);
766
+ _(this, K, null);
767
767
  }
768
768
  ), this.is_pending = !1);
769
769
  }));
770
- }, Mt = function() {
770
+ }, Bt = function() {
771
771
  try {
772
- if (this.is_pending = this.has_pending_snippet(), v(this, be, 0), v(this, Oe, 0), v(this, te, Fe(() => {
773
- c(this, Re).call(this, c(this, H));
774
- })), c(this, be) > 0) {
775
- var e = v(this, fe, document.createDocumentFragment());
776
- wr(c(this, te), e);
772
+ if (this.is_pending = this.has_pending_snippet(), _(this, Ae, 0), _(this, Ve, 0), _(this, se, Be(() => {
773
+ c(this, Ne).call(this, c(this, Y));
774
+ })), c(this, Ae) > 0) {
775
+ var e = _(this, pe, document.createDocumentFragment());
776
+ Cs(c(this, se), e);
777
777
  const i = (
778
778
  /** @type {(anchor: Node) => void} */
779
- c(this, ue).pending
779
+ c(this, he).pending
780
780
  );
781
- v(this, j, Fe(() => i(c(this, H))));
781
+ _(this, K, Be(() => i(c(this, Y))));
782
782
  } else
783
783
  this.is_pending = !1;
784
784
  } catch (i) {
@@ -788,82 +788,82 @@ H = new WeakMap(), st = new WeakMap(), ue = new WeakMap(), Re = new WeakMap(), e
788
788
  * @template T
789
789
  * @param {() => T} fn
790
790
  */
791
- dt = function(e) {
792
- var i = S, n = b, r = U;
793
- Se(c(this, ee)), re(c(this, ee)), _t(c(this, ee).ctx);
791
+ mt = function(e) {
792
+ var i = E, n = y, s = W;
793
+ $e(c(this, ne)), le(c(this, ne)), Et(c(this, ne).ctx);
794
794
  try {
795
795
  return e();
796
- } catch (s) {
797
- return ki(s), null;
796
+ } catch (r) {
797
+ return Fi(r), null;
798
798
  } finally {
799
- Se(i), re(n), _t(r);
799
+ $e(i), le(n), Et(s);
800
800
  }
801
801
  }, /**
802
802
  * Updates the pending count associated with the currently visible pending snippet,
803
803
  * if any, such that we can replace the snippet with content once work is done
804
804
  * @param {1 | -1} d
805
805
  */
806
- Ft = function(e) {
806
+ Gt = function(e) {
807
807
  var i;
808
808
  if (!this.has_pending_snippet()) {
809
- this.parent && V(i = this.parent, O, Ft).call(i, e);
809
+ this.parent && D(i = this.parent, M, Gt).call(i, e);
810
810
  return;
811
811
  }
812
- if (v(this, be, c(this, be) + e), c(this, be) === 0) {
812
+ if (_(this, Ae, c(this, Ae) + e), c(this, Ae) === 0) {
813
813
  this.is_pending = !1;
814
- for (const n of c(this, qe))
815
- I(n, L), ne(n);
816
- for (const n of c(this, ze))
817
- I(n, Z), ne(n);
818
- c(this, qe).clear(), c(this, ze).clear(), c(this, j) && ht(c(this, j), () => {
819
- v(this, j, null);
820
- }), c(this, fe) && (c(this, H).before(c(this, fe)), v(this, fe, null));
814
+ for (const n of c(this, Ue))
815
+ R(n, F), oe(n);
816
+ for (const n of c(this, xe))
817
+ R(n, te), oe(n);
818
+ c(this, Ue).clear(), c(this, xe).clear(), c(this, K) && vt(c(this, K), () => {
819
+ _(this, K, null);
820
+ }), c(this, pe) && (c(this, Y).before(c(this, pe)), _(this, pe, null));
821
821
  }
822
822
  };
823
823
  // @__NO_SIDE_EFFECTS__
824
- function xi(t) {
825
- var e = C | L, i = b !== null && (b.f & C) !== 0 ? (
824
+ function Ui(t) {
825
+ var e = H | F, i = y !== null && (y.f & H) !== 0 ? (
826
826
  /** @type {Derived} */
827
- b
827
+ y
828
828
  ) : null;
829
- return S !== null && (S.f |= We), {
830
- ctx: U,
829
+ return E !== null && (E.f |= Je), {
830
+ ctx: W,
831
831
  deps: null,
832
832
  effects: null,
833
- equals: Ai,
833
+ equals: ki,
834
834
  f: e,
835
835
  fn: t,
836
836
  reactions: null,
837
837
  rv: 0,
838
838
  v: (
839
839
  /** @type {V} */
840
- k
840
+ N
841
841
  ),
842
842
  wv: 0,
843
- parent: i ?? S,
843
+ parent: i ?? E,
844
844
  ac: null
845
845
  };
846
846
  }
847
847
  // @__NO_SIDE_EFFECTS__
848
- function ni(t) {
849
- const e = /* @__PURE__ */ xi(t);
850
- return nn(e), e;
848
+ function fi(t) {
849
+ const e = /* @__PURE__ */ Ui(t);
850
+ return fn(e), e;
851
851
  }
852
- function lr(t) {
852
+ function ps(t) {
853
853
  var e = t.effects;
854
854
  if (e !== null) {
855
855
  t.effects = null;
856
856
  for (var i = 0; i < e.length; i += 1)
857
- X(
857
+ ee(
858
858
  /** @type {Effect} */
859
859
  e[i]
860
860
  );
861
861
  }
862
862
  }
863
- function ar(t) {
863
+ function gs(t) {
864
864
  for (var e = t.parent; e !== null; ) {
865
- if ((e.f & C) === 0)
866
- return (e.f & _e) === 0 ? (
865
+ if ((e.f & H) === 0)
866
+ return (e.f & Ee) === 0 ? (
867
867
  /** @type {Effect} */
868
868
  e
869
869
  ) : null;
@@ -871,126 +871,126 @@ function ar(t) {
871
871
  }
872
872
  return null;
873
873
  }
874
- function Gt(t) {
875
- var e, i = S;
876
- Se(ar(t));
874
+ function Zt(t) {
875
+ var e, i = E;
876
+ $e(gs(t));
877
877
  try {
878
- t.f &= ~Ne, lr(t), e = ln(t);
878
+ t.f &= ~De, ps(t), e = gn(t);
879
879
  } finally {
880
- Se(i);
880
+ $e(i);
881
881
  }
882
882
  return e;
883
883
  }
884
- function ji(t) {
885
- var e = Gt(t);
886
- if (!t.equals(e) && (t.wv = sn(), (!$?.is_fork || t.deps === null) && (t.v = e, t.deps === null))) {
887
- I(t, R);
884
+ function xi(t) {
885
+ var e = Zt(t);
886
+ if (!t.equals(e) && (t.wv = hn(), (!k?.is_fork || t.deps === null) && (t.v = e, t.deps === null))) {
887
+ R(t, V);
888
888
  return;
889
889
  }
890
- Te || (K !== null ? (Ut() || $?.is_fork) && K.set(t, e) : zt(t));
890
+ Se || (Q !== null ? (ei() || k?.is_fork) && Q.set(t, e) : Jt(t));
891
891
  }
892
- function cr(t) {
892
+ function ms(t) {
893
893
  if (t.effects !== null)
894
894
  for (const e of t.effects)
895
- (e.teardown || e.ac) && (e.teardown?.(), e.ac?.abort(Ht), e.teardown = Vn, e.ac = null, it(e, 0), Wt(e));
895
+ (e.teardown || e.ac) && (e.teardown?.(), e.ac?.abort(Wt), e.teardown = Bn, e.ac = null, ot(e, 0), ii(e));
896
896
  }
897
- function Bi(t) {
897
+ function Xi(t) {
898
898
  if (t.effects !== null)
899
899
  for (const e of t.effects)
900
- e.teardown && Ue(e);
900
+ e.teardown && We(e);
901
901
  }
902
- let Dt = /* @__PURE__ */ new Set();
902
+ let jt = /* @__PURE__ */ new Set();
903
903
  const we = /* @__PURE__ */ new Map();
904
- let Hi = !1;
905
- function At(t, e) {
904
+ let Wi = !1;
905
+ function Lt(t, e) {
906
906
  var i = {
907
907
  f: 0,
908
908
  // TODO ideally we could skip this altogether, but it causes type errors
909
909
  v: t,
910
910
  reactions: null,
911
- equals: Ai,
911
+ equals: ki,
912
912
  rv: 0,
913
913
  wv: 0
914
914
  };
915
915
  return i;
916
916
  }
917
917
  // @__NO_SIDE_EFFECTS__
918
- function N(t, e) {
919
- const i = At(t);
920
- return nn(i), i;
918
+ function P(t, e) {
919
+ const i = Lt(t);
920
+ return fn(i), i;
921
921
  }
922
922
  // @__NO_SIDE_EFFECTS__
923
- function ur(t, e = !1, i = !0) {
924
- const n = At(t);
925
- return e || (n.equals = Xn), n;
923
+ function vs(t, e = !1, i = !0) {
924
+ const n = Lt(t);
925
+ return e || (n.equals = rs), n;
926
926
  }
927
- function A(t, e, i = !1) {
928
- b !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
927
+ function $(t, e, i = !1) {
928
+ y !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
929
929
  // to ensure we error if state is set inside an inspect effect
930
- (!J || (b.f & ti) !== 0) && $i() && (b.f & (C | ge | wi | ti)) !== 0 && (G === null || !Ge.call(G, t)) && Un();
931
- let n = i ? Qe(e) : e;
932
- return qi(t, n);
930
+ (!Z || (y.f & ci) !== 0) && Vi() && (y.f & (H | be | Li | ci)) !== 0 && (X === null || !Xe.call(X, t)) && Zn();
931
+ let n = i ? et(e) : e;
932
+ return Qi(t, n);
933
933
  }
934
- function qi(t, e) {
934
+ function Qi(t, e) {
935
935
  if (!t.equals(e)) {
936
936
  var i = t.v;
937
- Te ? we.set(t, e) : we.set(t, i), t.v = e;
938
- var n = pe.ensure();
939
- if (n.capture(t, i), (t.f & C) !== 0) {
940
- const r = (
937
+ Se ? we.set(t, e) : we.set(t, i), t.v = e;
938
+ var n = ve.ensure();
939
+ if (n.capture(t, i), (t.f & H) !== 0) {
940
+ const s = (
941
941
  /** @type {Derived} */
942
942
  t
943
943
  );
944
- (t.f & L) !== 0 && Gt(r), zt(r);
944
+ (t.f & F) !== 0 && Zt(s), Jt(s);
945
945
  }
946
- t.wv = sn(), zi(t, L), S !== null && (S.f & R) !== 0 && (S.f & (me | Ae)) === 0 && (B === null ? Tr([t]) : B.push(t)), !n.is_fork && Dt.size > 0 && !Hi && fr();
946
+ t.wv = hn(), Ji(t, F), E !== null && (E.f & V) !== 0 && (E.f & (_e | Ce)) === 0 && (z === null ? Ls([t]) : z.push(t)), !n.is_fork && jt.size > 0 && !Wi && bs();
947
947
  }
948
948
  return e;
949
949
  }
950
- function fr() {
951
- Hi = !1;
952
- for (const t of Dt)
953
- (t.f & R) !== 0 && I(t, Z), ot(t) && Ue(t);
954
- Dt.clear();
950
+ function bs() {
951
+ Wi = !1;
952
+ for (const t of jt)
953
+ (t.f & V) !== 0 && R(t, te), ut(t) && We(t);
954
+ jt.clear();
955
955
  }
956
- function Xe(t) {
957
- A(t, t.v + 1);
956
+ function it(t) {
957
+ $(t, t.v + 1);
958
958
  }
959
- function zi(t, e) {
959
+ function Ji(t, e) {
960
960
  var i = t.reactions;
961
961
  if (i !== null)
962
- for (var n = i.length, r = 0; r < n; r++) {
963
- var s = i[r], o = s.f, l = (o & L) === 0;
964
- if (l && I(s, e), (o & C) !== 0) {
962
+ for (var n = i.length, s = 0; s < n; s++) {
963
+ var r = i[s], o = r.f, l = (o & F) === 0;
964
+ if (l && R(r, e), (o & H) !== 0) {
965
965
  var a = (
966
966
  /** @type {Derived} */
967
- s
967
+ r
968
968
  );
969
- K?.delete(a), (o & Ne) === 0 && (o & z && (s.f |= Ne), zi(a, Z));
970
- } else l && ((o & ge) !== 0 && ae !== null && ae.add(
969
+ Q?.delete(a), (o & De) === 0 && (o & x && (r.f |= De), Ji(a, te));
970
+ } else l && ((o & be) !== 0 && fe !== null && fe.add(
971
971
  /** @type {Effect} */
972
- s
973
- ), ne(
972
+ r
973
+ ), oe(
974
974
  /** @type {Effect} */
975
- s
975
+ r
976
976
  ));
977
977
  }
978
978
  }
979
- function Qe(t) {
980
- if (typeof t != "object" || t === null || ft in t)
979
+ function et(t) {
980
+ if (typeof t != "object" || t === null || gt in t)
981
981
  return t;
982
- const e = Ln(t);
983
- if (e !== Rn && e !== On)
982
+ const e = Pn(t);
983
+ if (e !== Fn && e !== Dn)
984
984
  return t;
985
- var i = /* @__PURE__ */ new Map(), n = $n(t), r = /* @__PURE__ */ N(0), s = Ve, o = (l) => {
986
- if (Ve === s)
985
+ var i = /* @__PURE__ */ new Map(), n = Nn(t), s = /* @__PURE__ */ P(0), r = Fe, o = (l) => {
986
+ if (Fe === r)
987
987
  return l();
988
- var a = b, u = Ve;
989
- re(null), oi(s);
988
+ var a = y, u = Fe;
989
+ le(null), pi(r);
990
990
  var d = l();
991
- return re(a), oi(u), d;
991
+ return le(a), pi(u), d;
992
992
  };
993
- return n && i.set("length", /* @__PURE__ */ N(
993
+ return n && i.set("length", /* @__PURE__ */ P(
994
994
  /** @type {any[]} */
995
995
  t.length
996
996
  )), new Proxy(
@@ -998,34 +998,34 @@ function Qe(t) {
998
998
  t,
999
999
  {
1000
1000
  defineProperty(l, a, u) {
1001
- (!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && zn();
1001
+ (!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && Qn();
1002
1002
  var d = i.get(a);
1003
1003
  return d === void 0 ? o(() => {
1004
- var m = /* @__PURE__ */ N(u.value);
1005
- return i.set(a, m), m;
1006
- }) : A(d, u.value, !0), !0;
1004
+ var v = /* @__PURE__ */ P(u.value);
1005
+ return i.set(a, v), v;
1006
+ }) : $(d, u.value, !0), !0;
1007
1007
  },
1008
1008
  deleteProperty(l, a) {
1009
1009
  var u = i.get(a);
1010
1010
  if (u === void 0) {
1011
1011
  if (a in l) {
1012
- const d = o(() => /* @__PURE__ */ N(k));
1013
- i.set(a, d), Xe(r);
1012
+ const d = o(() => /* @__PURE__ */ P(N));
1013
+ i.set(a, d), it(s);
1014
1014
  }
1015
1015
  } else
1016
- A(u, k), Xe(r);
1016
+ $(u, N), it(s);
1017
1017
  return !0;
1018
1018
  },
1019
1019
  get(l, a, u) {
1020
- if (a === ft)
1020
+ if (a === gt)
1021
1021
  return t;
1022
- var d = i.get(a), m = a in l;
1023
- if (d === void 0 && (!m || De(l, a)?.writable) && (d = o(() => {
1024
- var y = Qe(m ? l[a] : k), h = /* @__PURE__ */ N(y);
1022
+ var d = i.get(a), v = a in l;
1023
+ if (d === void 0 && (!v || Ge(l, a)?.writable) && (d = o(() => {
1024
+ var g = et(v ? l[a] : N), h = /* @__PURE__ */ P(g);
1025
1025
  return h;
1026
1026
  }), i.set(a, d)), d !== void 0) {
1027
- var p = g(d);
1028
- return p === k ? void 0 : p;
1027
+ var p = m(d);
1028
+ return p === N ? void 0 : p;
1029
1029
  }
1030
1030
  return Reflect.get(l, a, u);
1031
1031
  },
@@ -1033,10 +1033,10 @@ function Qe(t) {
1033
1033
  var u = Reflect.getOwnPropertyDescriptor(l, a);
1034
1034
  if (u && "value" in u) {
1035
1035
  var d = i.get(a);
1036
- d && (u.value = g(d));
1036
+ d && (u.value = m(d));
1037
1037
  } else if (u === void 0) {
1038
- var m = i.get(a), p = m?.v;
1039
- if (m !== void 0 && p !== k)
1038
+ var v = i.get(a), p = v?.v;
1039
+ if (v !== void 0 && p !== N)
1040
1040
  return {
1041
1041
  enumerable: !0,
1042
1042
  configurable: !0,
@@ -1047,122 +1047,122 @@ function Qe(t) {
1047
1047
  return u;
1048
1048
  },
1049
1049
  has(l, a) {
1050
- if (a === ft)
1050
+ if (a === gt)
1051
1051
  return !0;
1052
- var u = i.get(a), d = u !== void 0 && u.v !== k || Reflect.has(l, a);
1053
- if (u !== void 0 || S !== null && (!d || De(l, a)?.writable)) {
1052
+ var u = i.get(a), d = u !== void 0 && u.v !== N || Reflect.has(l, a);
1053
+ if (u !== void 0 || E !== null && (!d || Ge(l, a)?.writable)) {
1054
1054
  u === void 0 && (u = o(() => {
1055
- var p = d ? Qe(l[a]) : k, y = /* @__PURE__ */ N(p);
1056
- return y;
1055
+ var p = d ? et(l[a]) : N, g = /* @__PURE__ */ P(p);
1056
+ return g;
1057
1057
  }), i.set(a, u));
1058
- var m = g(u);
1059
- if (m === k)
1058
+ var v = m(u);
1059
+ if (v === N)
1060
1060
  return !1;
1061
1061
  }
1062
1062
  return d;
1063
1063
  },
1064
1064
  set(l, a, u, d) {
1065
- var m = i.get(a), p = a in l;
1065
+ var v = i.get(a), p = a in l;
1066
1066
  if (n && a === "length")
1067
- for (var y = u; y < /** @type {Source<number>} */
1068
- m.v; y += 1) {
1069
- var h = i.get(y + "");
1070
- h !== void 0 ? A(h, k) : y in l && (h = o(() => /* @__PURE__ */ N(k)), i.set(y + "", h));
1067
+ for (var g = u; g < /** @type {Source<number>} */
1068
+ v.v; g += 1) {
1069
+ var h = i.get(g + "");
1070
+ h !== void 0 ? $(h, N) : g in l && (h = o(() => /* @__PURE__ */ P(N)), i.set(g + "", h));
1071
1071
  }
1072
- if (m === void 0)
1073
- (!p || De(l, a)?.writable) && (m = o(() => /* @__PURE__ */ N(void 0)), A(m, Qe(u)), i.set(a, m));
1072
+ if (v === void 0)
1073
+ (!p || Ge(l, a)?.writable) && (v = o(() => /* @__PURE__ */ P(void 0)), $(v, et(u)), i.set(a, v));
1074
1074
  else {
1075
- p = m.v !== k;
1076
- var E = o(() => Qe(u));
1077
- A(m, E);
1075
+ p = v.v !== N;
1076
+ var T = o(() => et(u));
1077
+ $(v, T);
1078
1078
  }
1079
- var _ = Reflect.getOwnPropertyDescriptor(l, a);
1080
- if (_?.set && _.set.call(d, u), !p) {
1079
+ var b = Reflect.getOwnPropertyDescriptor(l, a);
1080
+ if (b?.set && b.set.call(d, u), !p) {
1081
1081
  if (n && typeof a == "string") {
1082
- var F = (
1082
+ var S = (
1083
1083
  /** @type {Source<number>} */
1084
1084
  i.get("length")
1085
- ), W = Number(a);
1086
- Number.isInteger(W) && W >= F.v && A(F, W + 1);
1085
+ ), L = Number(a);
1086
+ Number.isInteger(L) && L >= S.v && $(S, L + 1);
1087
1087
  }
1088
- Xe(r);
1088
+ it(s);
1089
1089
  }
1090
1090
  return !0;
1091
1091
  },
1092
1092
  ownKeys(l) {
1093
- g(r);
1094
- var a = Reflect.ownKeys(l).filter((m) => {
1095
- var p = i.get(m);
1096
- return p === void 0 || p.v !== k;
1093
+ m(s);
1094
+ var a = Reflect.ownKeys(l).filter((v) => {
1095
+ var p = i.get(v);
1096
+ return p === void 0 || p.v !== N;
1097
1097
  });
1098
1098
  for (var [u, d] of i)
1099
- d.v !== k && !(u in l) && a.push(u);
1099
+ d.v !== N && !(u in l) && a.push(u);
1100
1100
  return a;
1101
1101
  },
1102
1102
  setPrototypeOf() {
1103
- Gn();
1103
+ Jn();
1104
1104
  }
1105
1105
  }
1106
1106
  );
1107
1107
  }
1108
- var ri, Gi, Ui, Yi;
1109
- function Pt() {
1110
- if (ri === void 0) {
1111
- ri = window, Gi = /Firefox/.test(navigator.userAgent);
1108
+ var di, Zi, en, tn;
1109
+ function qt() {
1110
+ if (di === void 0) {
1111
+ di = window, Zi = /Firefox/.test(navigator.userAgent);
1112
1112
  var t = Element.prototype, e = Node.prototype, i = Text.prototype;
1113
- Ui = De(e, "firstChild").get, Yi = De(e, "nextSibling").get, ei(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), ei(i) && (i.__t = void 0);
1113
+ en = Ge(e, "firstChild").get, tn = Ge(e, "nextSibling").get, ai(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), ai(i) && (i.__t = void 0);
1114
1114
  }
1115
1115
  }
1116
- function Wi(t = "") {
1116
+ function nn(t = "") {
1117
1117
  return document.createTextNode(t);
1118
1118
  }
1119
1119
  // @__NO_SIDE_EFFECTS__
1120
- function Ki(t) {
1120
+ function sn(t) {
1121
1121
  return (
1122
1122
  /** @type {TemplateNode | null} */
1123
- Ui.call(t)
1123
+ en.call(t)
1124
1124
  );
1125
1125
  }
1126
1126
  // @__NO_SIDE_EFFECTS__
1127
- function Ke(t) {
1127
+ function Ze(t) {
1128
1128
  return (
1129
1129
  /** @type {TemplateNode | null} */
1130
- Yi.call(t)
1130
+ tn.call(t)
1131
1131
  );
1132
1132
  }
1133
- function dr(t) {
1133
+ function _s(t) {
1134
1134
  t.textContent = "";
1135
1135
  }
1136
- function Qi(t, e, i) {
1136
+ function rn(t, e, i) {
1137
1137
  return (
1138
1138
  /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
1139
- document.createElementNS(En, t, void 0)
1139
+ document.createElementNS(Hn, t, void 0)
1140
1140
  );
1141
1141
  }
1142
- function Ji(t) {
1143
- var e = b, i = S;
1144
- re(null), Se(null);
1142
+ function on(t) {
1143
+ var e = y, i = E;
1144
+ le(null), $e(null);
1145
1145
  try {
1146
1146
  return t();
1147
1147
  } finally {
1148
- re(e), Se(i);
1148
+ le(e), $e(i);
1149
1149
  }
1150
1150
  }
1151
- function hr(t) {
1152
- S === null && (b === null && Bn(), jn()), Te && xn();
1151
+ function ys(t) {
1152
+ E === null && (y === null && xn(), Un()), Se && Yn();
1153
1153
  }
1154
- function pr(t, e) {
1154
+ function Ts(t, e) {
1155
1155
  var i = e.last;
1156
1156
  i === null ? e.last = e.first = t : (i.next = t, t.prev = i, e.last = t);
1157
1157
  }
1158
- function Me(t, e, i) {
1159
- var n = S;
1160
- n !== null && (n.f & ye) !== 0 && (t |= ye);
1161
- var r = {
1162
- ctx: U,
1158
+ function Pe(t, e, i) {
1159
+ var n = E;
1160
+ n !== null && (n.f & Ie) !== 0 && (t |= Ie);
1161
+ var s = {
1162
+ ctx: W,
1163
1163
  deps: null,
1164
1164
  nodes: null,
1165
- f: t | L | z,
1165
+ f: t | F | x,
1166
1166
  first: null,
1167
1167
  fn: e,
1168
1168
  last: null,
@@ -1176,498 +1176,498 @@ function Me(t, e, i) {
1176
1176
  };
1177
1177
  if (i)
1178
1178
  try {
1179
- Ue(r);
1179
+ We(s);
1180
1180
  } catch (l) {
1181
- throw X(r), l;
1181
+ throw ee(s), l;
1182
1182
  }
1183
- else e !== null && ne(r);
1184
- var s = r;
1185
- if (i && s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
1186
- (s.f & We) === 0 && (s = s.first, (t & ge) !== 0 && (t & yt) !== 0 && s !== null && (s.f |= yt)), s !== null && (s.parent = n, n !== null && pr(s, n), b !== null && (b.f & C) !== 0 && (t & Ae) === 0)) {
1183
+ else e !== null && oe(s);
1184
+ var r = s;
1185
+ if (i && r.deps === null && r.teardown === null && r.nodes === null && r.first === r.last && // either `null`, or a singular child
1186
+ (r.f & Je) === 0 && (r = r.first, (t & be) !== 0 && (t & It) !== 0 && r !== null && (r.f |= It)), r !== null && (r.parent = n, n !== null && Ts(r, n), y !== null && (y.f & H) !== 0 && (t & Ce) === 0)) {
1187
1187
  var o = (
1188
1188
  /** @type {Derived} */
1189
- b
1189
+ y
1190
1190
  );
1191
- (o.effects ?? (o.effects = [])).push(s);
1191
+ (o.effects ?? (o.effects = [])).push(r);
1192
1192
  }
1193
- return r;
1193
+ return s;
1194
1194
  }
1195
- function Ut() {
1196
- return b !== null && !J;
1195
+ function ei() {
1196
+ return y !== null && !Z;
1197
1197
  }
1198
- function Ie(t) {
1199
- hr();
1198
+ function Le(t) {
1199
+ ys();
1200
1200
  var e = (
1201
1201
  /** @type {Effect} */
1202
- S.f
1203
- ), i = !b && (e & me) !== 0 && (e & Ye) === 0;
1202
+ E.f
1203
+ ), i = !y && (e & _e) !== 0 && (e & Qe) === 0;
1204
1204
  if (i) {
1205
1205
  var n = (
1206
1206
  /** @type {ComponentContext} */
1207
- U
1207
+ W
1208
1208
  );
1209
1209
  (n.e ?? (n.e = [])).push(t);
1210
1210
  } else
1211
- return Xi(t);
1211
+ return ln(t);
1212
1212
  }
1213
- function Xi(t) {
1214
- return Me(Ze | Fn, t, !1);
1213
+ function ln(t) {
1214
+ return Pe(nt | qn, t, !1);
1215
1215
  }
1216
- function gr(t) {
1217
- pe.ensure();
1218
- const e = Me(Ae | We, t, !0);
1216
+ function As(t) {
1217
+ ve.ensure();
1218
+ const e = Pe(Ce | Je, t, !0);
1219
1219
  return () => {
1220
- X(e);
1220
+ ee(e);
1221
1221
  };
1222
1222
  }
1223
- function mr(t) {
1224
- pe.ensure();
1225
- const e = Me(Ae | We, t, !0);
1223
+ function Is(t) {
1224
+ ve.ensure();
1225
+ const e = Pe(Ce | Je, t, !0);
1226
1226
  return (i = {}) => new Promise((n) => {
1227
- i.outro ? ht(e, () => {
1228
- X(e), n(void 0);
1229
- }) : (X(e), n(void 0));
1227
+ i.outro ? vt(e, () => {
1228
+ ee(e), n(void 0);
1229
+ }) : (ee(e), n(void 0));
1230
1230
  });
1231
1231
  }
1232
- function vr(t) {
1233
- return Me(Ze, t, !1);
1232
+ function Es(t) {
1233
+ return Pe(nt, t, !1);
1234
1234
  }
1235
- function Yt(t, e = 0) {
1236
- return Me(bi | e, t, !0);
1235
+ function ti(t, e = 0) {
1236
+ return Pe(Si | e, t, !0);
1237
1237
  }
1238
- function br(t, e = 0) {
1239
- var i = Me(ge | e, t, !0);
1238
+ function ws(t, e = 0) {
1239
+ var i = Pe(be | e, t, !0);
1240
1240
  return i;
1241
1241
  }
1242
- function Fe(t) {
1243
- return Me(me | We, t, !0);
1242
+ function Be(t) {
1243
+ return Pe(_e | Je, t, !0);
1244
1244
  }
1245
- function Zi(t) {
1245
+ function an(t) {
1246
1246
  var e = t.teardown;
1247
1247
  if (e !== null) {
1248
- const i = Te, n = b;
1249
- si(!0), re(null);
1248
+ const i = Se, n = y;
1249
+ hi(!0), le(null);
1250
1250
  try {
1251
1251
  e.call(null);
1252
1252
  } finally {
1253
- si(i), re(n);
1253
+ hi(i), le(n);
1254
1254
  }
1255
1255
  }
1256
1256
  }
1257
- function Wt(t, e = !1) {
1257
+ function ii(t, e = !1) {
1258
1258
  var i = t.first;
1259
1259
  for (t.first = t.last = null; i !== null; ) {
1260
- const r = i.ac;
1261
- r !== null && Ji(() => {
1262
- r.abort(Ht);
1260
+ const s = i.ac;
1261
+ s !== null && on(() => {
1262
+ s.abort(Wt);
1263
1263
  });
1264
1264
  var n = i.next;
1265
- (i.f & Ae) !== 0 ? i.parent = null : X(i, e), i = n;
1265
+ (i.f & Ce) !== 0 ? i.parent = null : ee(i, e), i = n;
1266
1266
  }
1267
1267
  }
1268
- function yr(t) {
1268
+ function Ss(t) {
1269
1269
  for (var e = t.first; e !== null; ) {
1270
1270
  var i = e.next;
1271
- (e.f & me) === 0 && X(e), e = i;
1271
+ (e.f & _e) === 0 && ee(e), e = i;
1272
1272
  }
1273
1273
  }
1274
- function X(t, e = !0) {
1274
+ function ee(t, e = !0) {
1275
1275
  var i = !1;
1276
- (e || (t.f & _i) !== 0) && t.nodes !== null && t.nodes.end !== null && (_r(
1276
+ (e || (t.f & Ci) !== 0) && t.nodes !== null && t.nodes.end !== null && ($s(
1277
1277
  t.nodes.start,
1278
1278
  /** @type {TemplateNode} */
1279
1279
  t.nodes.end
1280
- ), i = !0), Wt(t, e && !i), it(t, 0), I(t, _e);
1280
+ ), i = !0), ii(t, e && !i), ot(t, 0), R(t, Ee);
1281
1281
  var n = t.nodes && t.nodes.t;
1282
1282
  if (n !== null)
1283
- for (const s of n)
1284
- s.stop();
1285
- Zi(t);
1286
- var r = t.parent;
1287
- r !== null && r.first !== null && en(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = null;
1283
+ for (const r of n)
1284
+ r.stop();
1285
+ an(t);
1286
+ var s = t.parent;
1287
+ s !== null && s.first !== null && cn(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = null;
1288
1288
  }
1289
- function _r(t, e) {
1289
+ function $s(t, e) {
1290
1290
  for (; t !== null; ) {
1291
- var i = t === e ? null : /* @__PURE__ */ Ke(t);
1291
+ var i = t === e ? null : /* @__PURE__ */ Ze(t);
1292
1292
  t.remove(), t = i;
1293
1293
  }
1294
1294
  }
1295
- function en(t) {
1295
+ function cn(t) {
1296
1296
  var e = t.parent, i = t.prev, n = t.next;
1297
1297
  i !== null && (i.next = n), n !== null && (n.prev = i), e !== null && (e.first === t && (e.first = n), e.last === t && (e.last = i));
1298
1298
  }
1299
- function ht(t, e, i = !0) {
1299
+ function vt(t, e, i = !0) {
1300
1300
  var n = [];
1301
- tn(t, n, !0);
1302
- var r = () => {
1303
- i && X(t), e && e();
1304
- }, s = n.length;
1305
- if (s > 0) {
1306
- var o = () => --s || r();
1301
+ un(t, n, !0);
1302
+ var s = () => {
1303
+ i && ee(t), e && e();
1304
+ }, r = n.length;
1305
+ if (r > 0) {
1306
+ var o = () => --r || s();
1307
1307
  for (var l of n)
1308
1308
  l.out(o);
1309
1309
  } else
1310
- r();
1310
+ s();
1311
1311
  }
1312
- function tn(t, e, i) {
1313
- if ((t.f & ye) === 0) {
1314
- t.f ^= ye;
1312
+ function un(t, e, i) {
1313
+ if ((t.f & Ie) === 0) {
1314
+ t.f ^= Ie;
1315
1315
  var n = t.nodes && t.nodes.t;
1316
1316
  if (n !== null)
1317
1317
  for (const l of n)
1318
1318
  (l.is_global || i) && e.push(l);
1319
- for (var r = t.first; r !== null; ) {
1320
- var s = r.next, o = (r.f & yt) !== 0 || // If this is a branch effect without a block effect parent,
1319
+ for (var s = t.first; s !== null; ) {
1320
+ var r = s.next, o = (s.f & It) !== 0 || // If this is a branch effect without a block effect parent,
1321
1321
  // it means the parent block effect was pruned. In that case,
1322
1322
  // transparency information was transferred to the branch effect.
1323
- (r.f & me) !== 0 && (t.f & ge) !== 0;
1324
- tn(r, e, o ? i : !1), r = s;
1323
+ (s.f & _e) !== 0 && (t.f & be) !== 0;
1324
+ un(s, e, o ? i : !1), s = r;
1325
1325
  }
1326
1326
  }
1327
1327
  }
1328
- function wr(t, e) {
1328
+ function Cs(t, e) {
1329
1329
  if (t.nodes)
1330
1330
  for (var i = t.nodes.start, n = t.nodes.end; i !== null; ) {
1331
- var r = i === n ? null : /* @__PURE__ */ Ke(i);
1332
- e.append(i), i = r;
1331
+ var s = i === n ? null : /* @__PURE__ */ Ze(i);
1332
+ e.append(i), i = s;
1333
1333
  }
1334
1334
  }
1335
- let pt = !1, Te = !1;
1336
- function si(t) {
1337
- Te = t;
1335
+ let bt = !1, Se = !1;
1336
+ function hi(t) {
1337
+ Se = t;
1338
1338
  }
1339
- let b = null, J = !1;
1340
- function re(t) {
1341
- b = t;
1339
+ let y = null, Z = !1;
1340
+ function le(t) {
1341
+ y = t;
1342
1342
  }
1343
- let S = null;
1344
- function Se(t) {
1345
- S = t;
1343
+ let E = null;
1344
+ function $e(t) {
1345
+ E = t;
1346
1346
  }
1347
- let G = null;
1348
- function nn(t) {
1349
- b !== null && (G === null ? G = [t] : G.push(t));
1347
+ let X = null;
1348
+ function fn(t) {
1349
+ y !== null && (X === null ? X = [t] : X.push(t));
1350
1350
  }
1351
- let P = null, x = 0, B = null;
1352
- function Tr(t) {
1353
- B = t;
1351
+ let j = null, q = 0, z = null;
1352
+ function Ls(t) {
1353
+ z = t;
1354
1354
  }
1355
- let rn = 1, $e = 0, Ve = $e;
1356
- function oi(t) {
1357
- Ve = t;
1355
+ let dn = 1, Oe = 0, Fe = Oe;
1356
+ function pi(t) {
1357
+ Fe = t;
1358
1358
  }
1359
- function sn() {
1360
- return ++rn;
1359
+ function hn() {
1360
+ return ++dn;
1361
1361
  }
1362
- function ot(t) {
1362
+ function ut(t) {
1363
1363
  var e = t.f;
1364
- if ((e & L) !== 0)
1364
+ if ((e & F) !== 0)
1365
1365
  return !0;
1366
- if (e & C && (t.f &= ~Ne), (e & Z) !== 0) {
1366
+ if (e & H && (t.f &= ~De), (e & te) !== 0) {
1367
1367
  for (var i = (
1368
1368
  /** @type {Value[]} */
1369
1369
  t.deps
1370
- ), n = i.length, r = 0; r < n; r++) {
1371
- var s = i[r];
1372
- if (ot(
1370
+ ), n = i.length, s = 0; s < n; s++) {
1371
+ var r = i[s];
1372
+ if (ut(
1373
1373
  /** @type {Derived} */
1374
- s
1375
- ) && ji(
1374
+ r
1375
+ ) && xi(
1376
1376
  /** @type {Derived} */
1377
- s
1378
- ), s.wv > t.wv)
1377
+ r
1378
+ ), r.wv > t.wv)
1379
1379
  return !0;
1380
1380
  }
1381
- (e & z) !== 0 && // During time traveling we don't want to reset the status so that
1381
+ (e & x) !== 0 && // During time traveling we don't want to reset the status so that
1382
1382
  // traversal of the graph in the other batches still happens
1383
- K === null && I(t, R);
1383
+ Q === null && R(t, V);
1384
1384
  }
1385
1385
  return !1;
1386
1386
  }
1387
- function on(t, e, i = !0) {
1387
+ function pn(t, e, i = !0) {
1388
1388
  var n = t.reactions;
1389
- if (n !== null && !(G !== null && Ge.call(G, t)))
1390
- for (var r = 0; r < n.length; r++) {
1391
- var s = n[r];
1392
- (s.f & C) !== 0 ? on(
1389
+ if (n !== null && !(X !== null && Xe.call(X, t)))
1390
+ for (var s = 0; s < n.length; s++) {
1391
+ var r = n[s];
1392
+ (r.f & H) !== 0 ? pn(
1393
1393
  /** @type {Derived} */
1394
- s,
1394
+ r,
1395
1395
  e,
1396
1396
  !1
1397
- ) : e === s && (i ? I(s, L) : (s.f & R) !== 0 && I(s, Z), ne(
1397
+ ) : e === r && (i ? R(r, F) : (r.f & V) !== 0 && R(r, te), oe(
1398
1398
  /** @type {Effect} */
1399
- s
1399
+ r
1400
1400
  ));
1401
1401
  }
1402
1402
  }
1403
- function ln(t) {
1404
- var E;
1405
- var e = P, i = x, n = B, r = b, s = G, o = U, l = J, a = Ve, u = t.f;
1406
- P = /** @type {null | Value[]} */
1407
- null, x = 0, B = null, b = (u & (me | Ae)) === 0 ? t : null, G = null, _t(t.ctx), J = !1, Ve = ++$e, t.ac !== null && (Ji(() => {
1408
- t.ac.abort(Ht);
1403
+ function gn(t) {
1404
+ var T;
1405
+ var e = j, i = q, n = z, s = y, r = X, o = W, l = Z, a = Fe, u = t.f;
1406
+ j = /** @type {null | Value[]} */
1407
+ null, q = 0, z = null, y = (u & (_e | Ce)) === 0 ? t : null, X = null, Et(t.ctx), Z = !1, Fe = ++Oe, t.ac !== null && (on(() => {
1408
+ t.ac.abort(Wt);
1409
1409
  }), t.ac = null);
1410
1410
  try {
1411
- t.f |= Ot;
1411
+ t.f |= Mt;
1412
1412
  var d = (
1413
1413
  /** @type {Function} */
1414
1414
  t.fn
1415
- ), m = d();
1416
- t.f |= Ye;
1417
- var p = t.deps, y = $?.is_fork;
1418
- if (P !== null) {
1415
+ ), v = d();
1416
+ t.f |= Qe;
1417
+ var p = t.deps, g = k?.is_fork;
1418
+ if (j !== null) {
1419
1419
  var h;
1420
- if (y || it(t, x), p !== null && x > 0)
1421
- for (p.length = x + P.length, h = 0; h < P.length; h++)
1422
- p[x + h] = P[h];
1420
+ if (g || ot(t, q), p !== null && q > 0)
1421
+ for (p.length = q + j.length, h = 0; h < j.length; h++)
1422
+ p[q + h] = j[h];
1423
1423
  else
1424
- t.deps = p = P;
1425
- if (Ut() && (t.f & z) !== 0)
1426
- for (h = x; h < p.length; h++)
1427
- ((E = p[h]).reactions ?? (E.reactions = [])).push(t);
1428
- } else !y && p !== null && x < p.length && (it(t, x), p.length = x);
1429
- if ($i() && B !== null && !J && p !== null && (t.f & (C | Z | L)) === 0)
1424
+ t.deps = p = j;
1425
+ if (ei() && (t.f & x) !== 0)
1426
+ for (h = q; h < p.length; h++)
1427
+ ((T = p[h]).reactions ?? (T.reactions = [])).push(t);
1428
+ } else !g && p !== null && q < p.length && (ot(t, q), p.length = q);
1429
+ if (Vi() && z !== null && !Z && p !== null && (t.f & (H | te | F)) === 0)
1430
1430
  for (h = 0; h < /** @type {Source[]} */
1431
- B.length; h++)
1432
- on(
1433
- B[h],
1431
+ z.length; h++)
1432
+ pn(
1433
+ z[h],
1434
1434
  /** @type {Effect} */
1435
1435
  t
1436
1436
  );
1437
- if (r !== null && r !== t) {
1438
- if ($e++, r.deps !== null)
1439
- for (let _ = 0; _ < i; _ += 1)
1440
- r.deps[_].rv = $e;
1437
+ if (s !== null && s !== t) {
1438
+ if (Oe++, s.deps !== null)
1439
+ for (let b = 0; b < i; b += 1)
1440
+ s.deps[b].rv = Oe;
1441
1441
  if (e !== null)
1442
- for (const _ of e)
1443
- _.rv = $e;
1444
- B !== null && (n === null ? n = B : n.push(.../** @type {Source[]} */
1445
- B));
1442
+ for (const b of e)
1443
+ b.rv = Oe;
1444
+ z !== null && (n === null ? n = z : n.push(.../** @type {Source[]} */
1445
+ z));
1446
1446
  }
1447
- return (t.f & et) !== 0 && (t.f ^= et), m;
1448
- } catch (_) {
1449
- return ki(_);
1447
+ return (t.f & st) !== 0 && (t.f ^= st), v;
1448
+ } catch (b) {
1449
+ return Fi(b);
1450
1450
  } finally {
1451
- t.f ^= Ot, P = e, x = i, B = n, b = r, G = s, _t(o), J = l, Ve = a;
1451
+ t.f ^= Mt, j = e, q = i, z = n, y = s, X = r, Et(o), Z = l, Fe = a;
1452
1452
  }
1453
1453
  }
1454
- function Sr(t, e) {
1454
+ function Rs(t, e) {
1455
1455
  let i = e.reactions;
1456
1456
  if (i !== null) {
1457
- var n = Cn.call(i, t);
1457
+ var n = Vn.call(i, t);
1458
1458
  if (n !== -1) {
1459
- var r = i.length - 1;
1460
- r === 0 ? i = e.reactions = null : (i[n] = i[r], i.pop());
1459
+ var s = i.length - 1;
1460
+ s === 0 ? i = e.reactions = null : (i[n] = i[s], i.pop());
1461
1461
  }
1462
1462
  }
1463
- if (i === null && (e.f & C) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1463
+ if (i === null && (e.f & H) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1464
1464
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1465
1465
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1466
- (P === null || !Ge.call(P, e))) {
1467
- var s = (
1466
+ (j === null || !Xe.call(j, e))) {
1467
+ var r = (
1468
1468
  /** @type {Derived} */
1469
1469
  e
1470
1470
  );
1471
- (s.f & z) !== 0 && (s.f ^= z, s.f &= ~Ne), zt(s), cr(s), it(s, 0);
1471
+ (r.f & x) !== 0 && (r.f ^= x, r.f &= ~De), Jt(r), ms(r), ot(r, 0);
1472
1472
  }
1473
1473
  }
1474
- function it(t, e) {
1474
+ function ot(t, e) {
1475
1475
  var i = t.deps;
1476
1476
  if (i !== null)
1477
1477
  for (var n = e; n < i.length; n++)
1478
- Sr(t, i[n]);
1478
+ Rs(t, i[n]);
1479
1479
  }
1480
- function Ue(t) {
1480
+ function We(t) {
1481
1481
  var e = t.f;
1482
- if ((e & _e) === 0) {
1483
- I(t, R);
1484
- var i = S, n = pt;
1485
- S = t, pt = !0;
1482
+ if ((e & Ee) === 0) {
1483
+ R(t, V);
1484
+ var i = E, n = bt;
1485
+ E = t, bt = !0;
1486
1486
  try {
1487
- (e & (ge | yi)) !== 0 ? yr(t) : Wt(t), Zi(t);
1488
- var r = ln(t);
1489
- t.teardown = typeof r == "function" ? r : null, t.wv = rn;
1490
- var s;
1491
- kt && Zn && (t.f & L) !== 0 && t.deps;
1487
+ (e & (be | $i)) !== 0 ? Ss(t) : ii(t), an(t);
1488
+ var s = gn(t);
1489
+ t.teardown = typeof s == "function" ? s : null, t.wv = dn;
1490
+ var r;
1491
+ Nt && os && (t.f & F) !== 0 && t.deps;
1492
1492
  } finally {
1493
- pt = n, S = i;
1493
+ bt = n, E = i;
1494
1494
  }
1495
1495
  }
1496
1496
  }
1497
- function g(t) {
1498
- var e = t.f, i = (e & C) !== 0;
1499
- if (b !== null && !J) {
1500
- var n = S !== null && (S.f & _e) !== 0;
1501
- if (!n && (G === null || !Ge.call(G, t))) {
1502
- var r = b.deps;
1503
- if ((b.f & Ot) !== 0)
1504
- t.rv < $e && (t.rv = $e, P === null && r !== null && r[x] === t ? x++ : P === null ? P = [t] : P.push(t));
1497
+ function m(t) {
1498
+ var e = t.f, i = (e & H) !== 0;
1499
+ if (y !== null && !Z) {
1500
+ var n = E !== null && (E.f & Ee) !== 0;
1501
+ if (!n && (X === null || !Xe.call(X, t))) {
1502
+ var s = y.deps;
1503
+ if ((y.f & Mt) !== 0)
1504
+ t.rv < Oe && (t.rv = Oe, j === null && s !== null && s[q] === t ? q++ : j === null ? j = [t] : j.push(t));
1505
1505
  else {
1506
- (b.deps ?? (b.deps = [])).push(t);
1507
- var s = t.reactions;
1508
- s === null ? t.reactions = [b] : Ge.call(s, b) || s.push(b);
1506
+ (y.deps ?? (y.deps = [])).push(t);
1507
+ var r = t.reactions;
1508
+ r === null ? t.reactions = [y] : Xe.call(r, y) || r.push(y);
1509
1509
  }
1510
1510
  }
1511
1511
  }
1512
- if (Te && we.has(t))
1512
+ if (Se && we.has(t))
1513
1513
  return we.get(t);
1514
1514
  if (i) {
1515
1515
  var o = (
1516
1516
  /** @type {Derived} */
1517
1517
  t
1518
1518
  );
1519
- if (Te) {
1519
+ if (Se) {
1520
1520
  var l = o.v;
1521
- return ((o.f & R) === 0 && o.reactions !== null || cn(o)) && (l = Gt(o)), we.set(o, l), l;
1521
+ return ((o.f & V) === 0 && o.reactions !== null || vn(o)) && (l = Zt(o)), we.set(o, l), l;
1522
1522
  }
1523
- var a = (o.f & z) === 0 && !J && b !== null && (pt || (b.f & z) !== 0), u = (o.f & Ye) === 0;
1524
- ot(o) && (a && (o.f |= z), ji(o)), a && !u && (Bi(o), an(o));
1523
+ var a = (o.f & x) === 0 && !Z && y !== null && (bt || (y.f & x) !== 0), u = (o.f & Qe) === 0;
1524
+ ut(o) && (a && (o.f |= x), xi(o)), a && !u && (Xi(o), mn(o));
1525
1525
  }
1526
- if (K?.has(t))
1527
- return K.get(t);
1528
- if ((t.f & et) !== 0)
1526
+ if (Q?.has(t))
1527
+ return Q.get(t);
1528
+ if ((t.f & st) !== 0)
1529
1529
  throw t.v;
1530
1530
  return t.v;
1531
1531
  }
1532
- function an(t) {
1533
- if (t.f |= z, t.deps !== null)
1532
+ function mn(t) {
1533
+ if (t.f |= x, t.deps !== null)
1534
1534
  for (const e of t.deps)
1535
- (e.reactions ?? (e.reactions = [])).push(t), (e.f & C) !== 0 && (e.f & z) === 0 && (Bi(
1535
+ (e.reactions ?? (e.reactions = [])).push(t), (e.f & H) !== 0 && (e.f & x) === 0 && (Xi(
1536
1536
  /** @type {Derived} */
1537
1537
  e
1538
- ), an(
1538
+ ), mn(
1539
1539
  /** @type {Derived} */
1540
1540
  e
1541
1541
  ));
1542
1542
  }
1543
- function cn(t) {
1544
- if (t.v === k) return !0;
1543
+ function vn(t) {
1544
+ if (t.v === N) return !0;
1545
1545
  if (t.deps === null) return !1;
1546
1546
  for (const e of t.deps)
1547
- if (we.has(e) || (e.f & C) !== 0 && cn(
1547
+ if (we.has(e) || (e.f & H) !== 0 && vn(
1548
1548
  /** @type {Derived} */
1549
1549
  e
1550
1550
  ))
1551
1551
  return !0;
1552
1552
  return !1;
1553
1553
  }
1554
- function Kt(t) {
1555
- var e = J;
1554
+ function ni(t) {
1555
+ var e = Z;
1556
1556
  try {
1557
- return J = !0, t();
1557
+ return Z = !0, t();
1558
1558
  } finally {
1559
- J = e;
1559
+ Z = e;
1560
1560
  }
1561
1561
  }
1562
- const ct = /* @__PURE__ */ Symbol("events"), Ar = /* @__PURE__ */ new Set(), li = /* @__PURE__ */ new Set();
1563
- let ai = null;
1564
- function ci(t) {
1562
+ const ht = /* @__PURE__ */ Symbol("events"), Os = /* @__PURE__ */ new Set(), gi = /* @__PURE__ */ new Set();
1563
+ let mi = null;
1564
+ function vi(t) {
1565
1565
  var e = this, i = (
1566
1566
  /** @type {Node} */
1567
1567
  e.ownerDocument
1568
- ), n = t.type, r = t.composedPath?.() || [], s = (
1568
+ ), n = t.type, s = t.composedPath?.() || [], r = (
1569
1569
  /** @type {null | Element} */
1570
- r[0] || t.target
1570
+ s[0] || t.target
1571
1571
  );
1572
- ai = t;
1573
- var o = 0, l = ai === t && t[ct];
1572
+ mi = t;
1573
+ var o = 0, l = mi === t && t[ht];
1574
1574
  if (l) {
1575
- var a = r.indexOf(l);
1575
+ var a = s.indexOf(l);
1576
1576
  if (a !== -1 && (e === document || e === /** @type {any} */
1577
1577
  window)) {
1578
- t[ct] = e;
1578
+ t[ht] = e;
1579
1579
  return;
1580
1580
  }
1581
- var u = r.indexOf(e);
1581
+ var u = s.indexOf(e);
1582
1582
  if (u === -1)
1583
1583
  return;
1584
1584
  a <= u && (o = a);
1585
1585
  }
1586
- if (s = /** @type {Element} */
1587
- r[o] || t.target, s !== e) {
1588
- bt(t, "currentTarget", {
1586
+ if (r = /** @type {Element} */
1587
+ s[o] || t.target, r !== e) {
1588
+ At(t, "currentTarget", {
1589
1589
  configurable: !0,
1590
1590
  get() {
1591
- return s || i;
1591
+ return r || i;
1592
1592
  }
1593
1593
  });
1594
- var d = b, m = S;
1595
- re(null), Se(null);
1594
+ var d = y, v = E;
1595
+ le(null), $e(null);
1596
1596
  try {
1597
- for (var p, y = []; s !== null; ) {
1598
- var h = s.assignedSlot || s.parentNode || /** @type {any} */
1599
- s.host || null;
1597
+ for (var p, g = []; r !== null; ) {
1598
+ var h = r.assignedSlot || r.parentNode || /** @type {any} */
1599
+ r.host || null;
1600
1600
  try {
1601
- var E = s[ct]?.[n];
1602
- E != null && (!/** @type {any} */
1603
- s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1601
+ var T = r[ht]?.[n];
1602
+ T != null && (!/** @type {any} */
1603
+ r.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1604
1604
  // -> the target could not have been disabled because it emits the event in the first place
1605
- t.target === s) && E.call(s, t);
1606
- } catch (_) {
1607
- p ? y.push(_) : p = _;
1605
+ t.target === r) && T.call(r, t);
1606
+ } catch (b) {
1607
+ p ? g.push(b) : p = b;
1608
1608
  }
1609
1609
  if (t.cancelBubble || h === e || h === null)
1610
1610
  break;
1611
- s = h;
1611
+ r = h;
1612
1612
  }
1613
1613
  if (p) {
1614
- for (let _ of y)
1614
+ for (let b of g)
1615
1615
  queueMicrotask(() => {
1616
- throw _;
1616
+ throw b;
1617
1617
  });
1618
1618
  throw p;
1619
1619
  }
1620
1620
  } finally {
1621
- t[ct] = e, delete t.currentTarget, re(d), Se(m);
1621
+ t[ht] = e, delete t.currentTarget, le(d), $e(v);
1622
1622
  }
1623
1623
  }
1624
1624
  }
1625
- const Ir = (
1625
+ const ks = (
1626
1626
  // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
1627
1627
  globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
1628
1628
  /** @param {string} html */
1629
1629
  createHTML: (t) => t
1630
1630
  })
1631
1631
  );
1632
- function Er(t) {
1632
+ function Hs(t) {
1633
1633
  return (
1634
1634
  /** @type {string} */
1635
- Ir?.createHTML(t) ?? t
1635
+ ks?.createHTML(t) ?? t
1636
1636
  );
1637
1637
  }
1638
- function $r(t, e = !1) {
1639
- var i = Qi("template");
1640
- return t = t.replaceAll("<!>", "<!---->"), i.innerHTML = e ? Er(t) : t, i.content;
1638
+ function Ns(t, e = !1) {
1639
+ var i = rn("template");
1640
+ return t = t.replaceAll("<!>", "<!---->"), i.innerHTML = e ? Hs(t) : t, i.content;
1641
1641
  }
1642
- function xt(t, e) {
1642
+ function Kt(t, e) {
1643
1643
  var i = (
1644
1644
  /** @type {Effect} */
1645
- S
1645
+ E
1646
1646
  );
1647
1647
  i.nodes === null && (i.nodes = { start: t, end: e, a: null, t: null });
1648
1648
  }
1649
1649
  // @__NO_SIDE_EFFECTS__
1650
- function Cr(t, e) {
1651
- var i = (e & In) !== 0, n, r = !t.startsWith("<!>");
1650
+ function Vs(t, e) {
1651
+ var i = (e & kn) !== 0, n, s = !t.startsWith("<!>");
1652
1652
  return () => {
1653
- if (Q)
1654
- return xt(M, null), M;
1655
- n === void 0 && (n = $r(r ? t : "<!>" + t, !0), n = /** @type {TemplateNode} */
1656
- /* @__PURE__ */ Ki(n));
1657
- var s = (
1653
+ if (J)
1654
+ return Kt(B, null), B;
1655
+ n === void 0 && (n = Ns(s ? t : "<!>" + t, !0), n = /** @type {TemplateNode} */
1656
+ /* @__PURE__ */ sn(n));
1657
+ var r = (
1658
1658
  /** @type {TemplateNode} */
1659
- i || Gi ? document.importNode(n, !0) : n.cloneNode(!0)
1659
+ i || Zi ? document.importNode(n, !0) : n.cloneNode(!0)
1660
1660
  );
1661
- return xt(s, s), s;
1661
+ return Kt(r, r), r;
1662
1662
  };
1663
1663
  }
1664
- function un(t, e) {
1665
- if (Q) {
1664
+ function bn(t, e) {
1665
+ if (J) {
1666
1666
  var i = (
1667
1667
  /** @type {Effect & { nodes: EffectNodes }} */
1668
- S
1668
+ E
1669
1669
  );
1670
- ((i.f & Ye) === 0 || i.nodes.end === null) && (i.nodes.end = M), Si();
1670
+ ((i.f & Qe) === 0 || i.nodes.end === null) && (i.nodes.end = B), Oi();
1671
1671
  return;
1672
1672
  }
1673
1673
  t !== null && t.before(
@@ -1675,44 +1675,44 @@ function un(t, e) {
1675
1675
  e
1676
1676
  );
1677
1677
  }
1678
- const kr = ["touchstart", "touchmove"];
1679
- function Rr(t) {
1680
- return kr.includes(t);
1678
+ const Ms = ["touchstart", "touchmove"];
1679
+ function Fs(t) {
1680
+ return Ms.includes(t);
1681
1681
  }
1682
- function fn(t, e) {
1683
- return dn(t, e);
1682
+ function _n(t, e) {
1683
+ return yn(t, e);
1684
1684
  }
1685
- function Or(t, e) {
1686
- Pt(), e.intro = e.intro ?? !1;
1687
- const i = e.target, n = Q, r = M;
1685
+ function Ds(t, e) {
1686
+ qt(), e.intro = e.intro ?? !1;
1687
+ const i = e.target, n = J, s = B;
1688
1688
  try {
1689
- for (var s = /* @__PURE__ */ Ki(i); s && (s.nodeType !== qt || /** @type {Comment} */
1690
- s.data !== gi); )
1691
- s = /* @__PURE__ */ Ke(s);
1692
- if (!s)
1693
- throw mt;
1694
- lt(!0), tt(
1689
+ for (var r = /* @__PURE__ */ sn(i); r && (r.nodeType !== Qt || /** @type {Comment} */
1690
+ r.data !== Ii); )
1691
+ r = /* @__PURE__ */ Ze(r);
1692
+ if (!r)
1693
+ throw yt;
1694
+ ft(!0), rt(
1695
1695
  /** @type {Comment} */
1696
- s
1696
+ r
1697
1697
  );
1698
- const o = dn(t, { ...e, anchor: s });
1699
- return lt(!1), /** @type {Exports} */
1698
+ const o = yn(t, { ...e, anchor: r });
1699
+ return ft(!1), /** @type {Exports} */
1700
1700
  o;
1701
1701
  } catch (o) {
1702
1702
  if (o instanceof Error && o.message.split(`
1703
1703
  `).some((l) => l.startsWith("https://svelte.dev/e/")))
1704
1704
  throw o;
1705
- return o !== mt && console.warn("Failed to hydrate: ", o), e.recover === !1 && qn(), Pt(), dr(i), lt(!1), fn(t, e);
1705
+ return o !== yt && console.warn("Failed to hydrate: ", o), e.recover === !1 && Wn(), qt(), _s(i), ft(!1), _n(t, e);
1706
1706
  } finally {
1707
- lt(n), tt(r);
1707
+ ft(n), rt(s);
1708
1708
  }
1709
1709
  }
1710
- const ut = /* @__PURE__ */ new Map();
1711
- function dn(t, { target: e, anchor: i, props: n = {}, events: r, context: s, intro: o = !0 }) {
1712
- Pt();
1713
- var l = void 0, a = mr(() => {
1714
- var u = i ?? e.appendChild(Wi());
1715
- sr(
1710
+ const pt = /* @__PURE__ */ new Map();
1711
+ function yn(t, { target: e, anchor: i, props: n = {}, events: s, context: r, intro: o = !0 }) {
1712
+ qt();
1713
+ var l = void 0, a = Is(() => {
1714
+ var u = i ?? e.appendChild(nn());
1715
+ ds(
1716
1716
  /** @type {TemplateNode} */
1717
1717
  u,
1718
1718
  {
@@ -1720,90 +1720,90 @@ function dn(t, { target: e, anchor: i, props: n = {}, events: r, context: s, int
1720
1720
  }
1721
1721
  },
1722
1722
  (p) => {
1723
- Ii({});
1724
- var y = (
1723
+ Hi({});
1724
+ var g = (
1725
1725
  /** @type {ComponentContext} */
1726
- U
1726
+ W
1727
1727
  );
1728
- if (s && (y.c = s), r && (n.$$events = r), Q && xt(
1728
+ if (r && (g.c = r), s && (n.$$events = s), J && Kt(
1729
1729
  /** @type {TemplateNode} */
1730
1730
  p,
1731
1731
  null
1732
- ), l = t(p, n) || {}, Q && (S.nodes.end = M, M === null || M.nodeType !== qt || /** @type {Comment} */
1733
- M.data !== vi))
1734
- throw Ti(), mt;
1735
- Ei();
1732
+ ), l = t(p, n) || {}, J && (E.nodes.end = B, B === null || B.nodeType !== Qt || /** @type {Comment} */
1733
+ B.data !== wi))
1734
+ throw Ri(), yt;
1735
+ Ni();
1736
1736
  }
1737
1737
  );
1738
- var d = /* @__PURE__ */ new Set(), m = (p) => {
1739
- for (var y = 0; y < p.length; y++) {
1740
- var h = p[y];
1738
+ var d = /* @__PURE__ */ new Set(), v = (p) => {
1739
+ for (var g = 0; g < p.length; g++) {
1740
+ var h = p[g];
1741
1741
  if (!d.has(h)) {
1742
1742
  d.add(h);
1743
- var E = Rr(h);
1744
- for (const W of [e, document]) {
1745
- var _ = ut.get(W);
1746
- _ === void 0 && (_ = /* @__PURE__ */ new Map(), ut.set(W, _));
1747
- var F = _.get(h);
1748
- F === void 0 ? (W.addEventListener(h, ci, { passive: E }), _.set(h, 1)) : _.set(h, F + 1);
1743
+ var T = Fs(h);
1744
+ for (const L of [e, document]) {
1745
+ var b = pt.get(L);
1746
+ b === void 0 && (b = /* @__PURE__ */ new Map(), pt.set(L, b));
1747
+ var S = b.get(h);
1748
+ S === void 0 ? (L.addEventListener(h, vi, { passive: T }), b.set(h, 1)) : b.set(h, S + 1);
1749
1749
  }
1750
1750
  }
1751
1751
  }
1752
1752
  };
1753
- return m(kn(Ar)), li.add(m), () => {
1753
+ return v(Mn(Os)), gi.add(v), () => {
1754
1754
  for (var p of d)
1755
- for (const E of [e, document]) {
1756
- var y = (
1755
+ for (const T of [e, document]) {
1756
+ var g = (
1757
1757
  /** @type {Map<string, number>} */
1758
- ut.get(E)
1758
+ pt.get(T)
1759
1759
  ), h = (
1760
1760
  /** @type {number} */
1761
- y.get(p)
1761
+ g.get(p)
1762
1762
  );
1763
- --h == 0 ? (E.removeEventListener(p, ci), y.delete(p), y.size === 0 && ut.delete(E)) : y.set(p, h);
1763
+ --h == 0 ? (T.removeEventListener(p, vi), g.delete(p), g.size === 0 && pt.delete(T)) : g.set(p, h);
1764
1764
  }
1765
- li.delete(m), u !== i && u.parentNode?.removeChild(u);
1765
+ gi.delete(v), u !== i && u.parentNode?.removeChild(u);
1766
1766
  };
1767
1767
  });
1768
- return jt.set(l, a), l;
1768
+ return zt.set(l, a), l;
1769
1769
  }
1770
- let jt = /* @__PURE__ */ new WeakMap();
1771
- function Lr(t, e) {
1772
- const i = jt.get(t);
1773
- return i ? (jt.delete(t), i(e)) : Promise.resolve();
1770
+ let zt = /* @__PURE__ */ new WeakMap();
1771
+ function Ps(t, e) {
1772
+ const i = zt.get(t);
1773
+ return i ? (zt.delete(t), i(e)) : Promise.resolve();
1774
1774
  }
1775
- function Vr(t) {
1776
- U === null && Pn(), Ie(() => {
1777
- const e = Kt(t);
1775
+ function Bs(t) {
1776
+ W === null && zn(), Le(() => {
1777
+ const e = ni(t);
1778
1778
  if (typeof e == "function") return (
1779
1779
  /** @type {() => void} */
1780
1780
  e
1781
1781
  );
1782
1782
  });
1783
1783
  }
1784
- function ui(t, e) {
1785
- return t === e || t?.[ft] === e;
1784
+ function bi(t, e) {
1785
+ return t === e || t?.[gt] === e;
1786
1786
  }
1787
- function Nr(t = {}, e, i, n) {
1788
- return vr(() => {
1789
- var r, s;
1790
- return Yt(() => {
1791
- r = s, s = [], Kt(() => {
1792
- t !== i(...s) && (e(t, ...s), r && ui(i(...r), t) && e(null, ...r));
1787
+ function Gs(t = {}, e, i, n) {
1788
+ return Es(() => {
1789
+ var s, r;
1790
+ return ti(() => {
1791
+ s = r, r = [], ni(() => {
1792
+ t !== i(...r) && (e(t, ...r), s && bi(i(...s), t) && e(null, ...s));
1793
1793
  });
1794
1794
  }), () => {
1795
- Le(() => {
1796
- s && ui(i(...s), t) && e(null, ...s);
1795
+ Me(() => {
1796
+ r && bi(i(...r), t) && e(null, ...r);
1797
1797
  });
1798
1798
  };
1799
1799
  }), t;
1800
1800
  }
1801
- function ve(t, e, i, n) {
1802
- var r = (
1801
+ function ye(t, e, i, n) {
1802
+ var s = (
1803
1803
  /** @type {V} */
1804
1804
  n
1805
- ), s = !0, o = () => (s && (s = !1, r = /** @type {V} */
1806
- n), r), l;
1805
+ ), r = !0, o = () => (r && (r = !1, s = /** @type {V} */
1806
+ n), s), l;
1807
1807
  l = /** @type {V} */
1808
1808
  t[e], l === void 0 && n !== void 0 && (l = o());
1809
1809
  var a;
@@ -1812,28 +1812,28 @@ function ve(t, e, i, n) {
1812
1812
  /** @type {V} */
1813
1813
  t[e]
1814
1814
  );
1815
- return p === void 0 ? o() : (s = !0, p);
1815
+ return p === void 0 ? o() : (r = !0, p);
1816
1816
  };
1817
- var u = !1, d = /* @__PURE__ */ xi(() => (u = !1, a())), m = (
1817
+ var u = !1, d = /* @__PURE__ */ Ui(() => (u = !1, a())), v = (
1818
1818
  /** @type {Effect} */
1819
- S
1819
+ E
1820
1820
  );
1821
1821
  return (
1822
1822
  /** @type {() => V} */
1823
- (function(p, y) {
1823
+ (function(p, g) {
1824
1824
  if (arguments.length > 0) {
1825
- const h = y ? g(d) : p;
1826
- return A(d, h), u = !0, r !== void 0 && (r = h), p;
1825
+ const h = g ? m(d) : p;
1826
+ return $(d, h), u = !0, s !== void 0 && (s = h), p;
1827
1827
  }
1828
- return Te && u || (m.f & _e) !== 0 ? d.v : g(d);
1828
+ return Se && u || (v.f & Ee) !== 0 ? d.v : m(d);
1829
1829
  })
1830
1830
  );
1831
1831
  }
1832
- function Mr(t) {
1833
- return new Fr(t);
1832
+ function js(t) {
1833
+ return new qs(t);
1834
1834
  }
1835
- var he, q;
1836
- class Fr {
1835
+ var me, U;
1836
+ class qs {
1837
1837
  /**
1838
1838
  * @param {ComponentConstructorOptions & {
1839
1839
  * component: any;
@@ -1841,56 +1841,56 @@ class Fr {
1841
1841
  */
1842
1842
  constructor(e) {
1843
1843
  /** @type {any} */
1844
- w(this, he);
1844
+ A(this, me);
1845
1845
  /** @type {Record<string, any>} */
1846
- w(this, q);
1847
- var i = /* @__PURE__ */ new Map(), n = (s, o) => {
1848
- var l = /* @__PURE__ */ ur(o, !1, !1);
1849
- return i.set(s, l), l;
1846
+ A(this, U);
1847
+ var i = /* @__PURE__ */ new Map(), n = (r, o) => {
1848
+ var l = /* @__PURE__ */ vs(o, !1, !1);
1849
+ return i.set(r, l), l;
1850
1850
  };
1851
- const r = new Proxy(
1851
+ const s = new Proxy(
1852
1852
  { ...e.props || {}, $$events: {} },
1853
1853
  {
1854
- get(s, o) {
1855
- return g(i.get(o) ?? n(o, Reflect.get(s, o)));
1854
+ get(r, o) {
1855
+ return m(i.get(o) ?? n(o, Reflect.get(r, o)));
1856
1856
  },
1857
- has(s, o) {
1858
- return o === Dn ? !0 : (g(i.get(o) ?? n(o, Reflect.get(s, o))), Reflect.has(s, o));
1857
+ has(r, o) {
1858
+ return o === Kn ? !0 : (m(i.get(o) ?? n(o, Reflect.get(r, o))), Reflect.has(r, o));
1859
1859
  },
1860
- set(s, o, l) {
1861
- return A(i.get(o) ?? n(o, l), l), Reflect.set(s, o, l);
1860
+ set(r, o, l) {
1861
+ return $(i.get(o) ?? n(o, l), l), Reflect.set(r, o, l);
1862
1862
  }
1863
1863
  }
1864
1864
  );
1865
- v(this, q, (e.hydrate ? Or : fn)(e.component, {
1865
+ _(this, U, (e.hydrate ? Ds : _n)(e.component, {
1866
1866
  target: e.target,
1867
1867
  anchor: e.anchor,
1868
- props: r,
1868
+ props: s,
1869
1869
  context: e.context,
1870
1870
  intro: e.intro ?? !1,
1871
1871
  recover: e.recover
1872
- })), (!e?.props?.$$host || e.sync === !1) && le(), v(this, he, r.$$events);
1873
- for (const s of Object.keys(c(this, q)))
1874
- s === "$set" || s === "$destroy" || s === "$on" || bt(this, s, {
1872
+ })), (!e?.props?.$$host || e.sync === !1) && ue(), _(this, me, s.$$events);
1873
+ for (const r of Object.keys(c(this, U)))
1874
+ r === "$set" || r === "$destroy" || r === "$on" || At(this, r, {
1875
1875
  get() {
1876
- return c(this, q)[s];
1876
+ return c(this, U)[r];
1877
1877
  },
1878
1878
  /** @param {any} value */
1879
1879
  set(o) {
1880
- c(this, q)[s] = o;
1880
+ c(this, U)[r] = o;
1881
1881
  },
1882
1882
  enumerable: !0
1883
1883
  });
1884
- c(this, q).$set = /** @param {Record<string, any>} next */
1885
- (s) => {
1886
- Object.assign(r, s);
1887
- }, c(this, q).$destroy = () => {
1888
- Lr(c(this, q));
1884
+ c(this, U).$set = /** @param {Record<string, any>} next */
1885
+ (r) => {
1886
+ Object.assign(s, r);
1887
+ }, c(this, U).$destroy = () => {
1888
+ Ps(c(this, U));
1889
1889
  };
1890
1890
  }
1891
1891
  /** @param {Record<string, any>} props */
1892
1892
  $set(e) {
1893
- c(this, q).$set(e);
1893
+ c(this, U).$set(e);
1894
1894
  }
1895
1895
  /**
1896
1896
  * @param {string} event
@@ -1898,22 +1898,22 @@ class Fr {
1898
1898
  * @returns {any}
1899
1899
  */
1900
1900
  $on(e, i) {
1901
- c(this, he)[e] = c(this, he)[e] || [];
1902
- const n = (...r) => i.call(this, ...r);
1903
- return c(this, he)[e].push(n), () => {
1904
- c(this, he)[e] = c(this, he)[e].filter(
1901
+ c(this, me)[e] = c(this, me)[e] || [];
1902
+ const n = (...s) => i.call(this, ...s);
1903
+ return c(this, me)[e].push(n), () => {
1904
+ c(this, me)[e] = c(this, me)[e].filter(
1905
1905
  /** @param {any} fn */
1906
- (r) => r !== n
1906
+ (s) => s !== n
1907
1907
  );
1908
1908
  };
1909
1909
  }
1910
1910
  $destroy() {
1911
- c(this, q).$destroy();
1911
+ c(this, U).$destroy();
1912
1912
  }
1913
1913
  }
1914
- he = new WeakMap(), q = new WeakMap();
1915
- let hn;
1916
- typeof HTMLElement == "function" && (hn = class extends HTMLElement {
1914
+ me = new WeakMap(), U = new WeakMap();
1915
+ let Tn;
1916
+ typeof HTMLElement == "function" && (Tn = class extends HTMLElement {
1917
1917
  /**
1918
1918
  * @param {*} $$componentCtor
1919
1919
  * @param {*} $$slots
@@ -1952,8 +1952,8 @@ typeof HTMLElement == "function" && (hn = class extends HTMLElement {
1952
1952
  */
1953
1953
  addEventListener(e, i, n) {
1954
1954
  if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(i), this.$$c) {
1955
- const r = this.$$c.$on(e, i);
1956
- this.$$l_u.set(i, r);
1955
+ const s = this.$$c.$on(e, i);
1956
+ this.$$l_u.set(i, s);
1957
1957
  }
1958
1958
  super.addEventListener(e, i, n);
1959
1959
  }
@@ -1964,30 +1964,30 @@ typeof HTMLElement == "function" && (hn = class extends HTMLElement {
1964
1964
  */
1965
1965
  removeEventListener(e, i, n) {
1966
1966
  if (super.removeEventListener(e, i, n), this.$$c) {
1967
- const r = this.$$l_u.get(i);
1968
- r && (r(), this.$$l_u.delete(i));
1967
+ const s = this.$$l_u.get(i);
1968
+ s && (s(), this.$$l_u.delete(i));
1969
1969
  }
1970
1970
  }
1971
1971
  async connectedCallback() {
1972
1972
  if (this.$$cn = !0, !this.$$c) {
1973
- let e = function(r) {
1974
- return (s) => {
1975
- const o = Qi("slot");
1976
- r !== "default" && (o.name = r), un(s, o);
1973
+ let e = function(s) {
1974
+ return (r) => {
1975
+ const o = rn("slot");
1976
+ s !== "default" && (o.name = s), bn(r, o);
1977
1977
  };
1978
1978
  };
1979
1979
  if (await Promise.resolve(), !this.$$cn || this.$$c)
1980
1980
  return;
1981
- const i = {}, n = Dr(this);
1982
- for (const r of this.$$s)
1983
- r in n && (r === "default" && !this.$$d.children ? (this.$$d.children = e(r), i.default = !0) : i[r] = e(r));
1984
- for (const r of this.attributes) {
1985
- const s = this.$$g_p(r.name);
1986
- s in this.$$d || (this.$$d[s] = gt(s, r.value, this.$$p_d, "toProp"));
1981
+ const i = {}, n = Ks(this);
1982
+ for (const s of this.$$s)
1983
+ s in n && (s === "default" && !this.$$d.children ? (this.$$d.children = e(s), i.default = !0) : i[s] = e(s));
1984
+ for (const s of this.attributes) {
1985
+ const r = this.$$g_p(s.name);
1986
+ r in this.$$d || (this.$$d[r] = _t(r, s.value, this.$$p_d, "toProp"));
1987
1987
  }
1988
- for (const r in this.$$p_d)
1989
- !(r in this.$$d) && this[r] !== void 0 && (this.$$d[r] = this[r], delete this[r]);
1990
- this.$$c = Mr({
1988
+ for (const s in this.$$p_d)
1989
+ !(s in this.$$d) && this[s] !== void 0 && (this.$$d[s] = this[s], delete this[s]);
1990
+ this.$$c = js({
1991
1991
  component: this.$$ctor,
1992
1992
  target: this.$$shadowRoot || this,
1993
1993
  props: {
@@ -1995,27 +1995,27 @@ typeof HTMLElement == "function" && (hn = class extends HTMLElement {
1995
1995
  $$slots: i,
1996
1996
  $$host: this
1997
1997
  }
1998
- }), this.$$me = gr(() => {
1999
- Yt(() => {
1998
+ }), this.$$me = As(() => {
1999
+ ti(() => {
2000
2000
  this.$$r = !0;
2001
- for (const r of vt(this.$$c)) {
2002
- if (!this.$$p_d[r]?.reflect) continue;
2003
- this.$$d[r] = this.$$c[r];
2004
- const s = gt(
2005
- r,
2006
- this.$$d[r],
2001
+ for (const s of Tt(this.$$c)) {
2002
+ if (!this.$$p_d[s]?.reflect) continue;
2003
+ this.$$d[s] = this.$$c[s];
2004
+ const r = _t(
2005
+ s,
2006
+ this.$$d[s],
2007
2007
  this.$$p_d,
2008
2008
  "toAttribute"
2009
2009
  );
2010
- s == null ? this.removeAttribute(this.$$p_d[r].attribute || r) : this.setAttribute(this.$$p_d[r].attribute || r, s);
2010
+ r == null ? this.removeAttribute(this.$$p_d[s].attribute || s) : this.setAttribute(this.$$p_d[s].attribute || s, r);
2011
2011
  }
2012
2012
  this.$$r = !1;
2013
2013
  });
2014
2014
  });
2015
- for (const r in this.$$l)
2016
- for (const s of this.$$l[r]) {
2017
- const o = this.$$c.$on(r, s);
2018
- this.$$l_u.set(s, o);
2015
+ for (const s in this.$$l)
2016
+ for (const r of this.$$l[s]) {
2017
+ const o = this.$$c.$on(s, r);
2018
+ this.$$l_u.set(r, o);
2019
2019
  }
2020
2020
  this.$$l = {};
2021
2021
  }
@@ -2028,7 +2028,7 @@ typeof HTMLElement == "function" && (hn = class extends HTMLElement {
2028
2028
  * @param {string} newValue
2029
2029
  */
2030
2030
  attributeChangedCallback(e, i, n) {
2031
- this.$$r || (e = this.$$g_p(e), this.$$d[e] = gt(e, n, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
2031
+ this.$$r || (e = this.$$g_p(e), this.$$d[e] = _t(e, n, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
2032
2032
  }
2033
2033
  disconnectedCallback() {
2034
2034
  this.$$cn = !1, Promise.resolve().then(() => {
@@ -2039,17 +2039,17 @@ typeof HTMLElement == "function" && (hn = class extends HTMLElement {
2039
2039
  * @param {string} attribute_name
2040
2040
  */
2041
2041
  $$g_p(e) {
2042
- return vt(this.$$p_d).find(
2042
+ return Tt(this.$$p_d).find(
2043
2043
  (i) => this.$$p_d[i].attribute === e || !this.$$p_d[i].attribute && i.toLowerCase() === e
2044
2044
  ) || e;
2045
2045
  }
2046
2046
  });
2047
- function gt(t, e, i, n) {
2048
- const r = i[t]?.type;
2049
- if (e = r === "Boolean" && typeof e != "boolean" ? e != null : e, !n || !i[t])
2047
+ function _t(t, e, i, n) {
2048
+ const s = i[t]?.type;
2049
+ if (e = s === "Boolean" && typeof e != "boolean" ? e != null : e, !n || !i[t])
2050
2050
  return e;
2051
2051
  if (n === "toAttribute")
2052
- switch (r) {
2052
+ switch (s) {
2053
2053
  case "Object":
2054
2054
  case "Array":
2055
2055
  return e == null ? null : JSON.stringify(e);
@@ -2061,7 +2061,7 @@ function gt(t, e, i, n) {
2061
2061
  return e;
2062
2062
  }
2063
2063
  else
2064
- switch (r) {
2064
+ switch (s) {
2065
2065
  case "Object":
2066
2066
  case "Array":
2067
2067
  return e && JSON.parse(e);
@@ -2074,7 +2074,7 @@ function gt(t, e, i, n) {
2074
2074
  return e;
2075
2075
  }
2076
2076
  }
2077
- function Dr(t) {
2077
+ function Ks(t) {
2078
2078
  const e = {};
2079
2079
  return t.childNodes.forEach((i) => {
2080
2080
  e[
@@ -2083,33 +2083,33 @@ function Dr(t) {
2083
2083
  ] = !0;
2084
2084
  }), e;
2085
2085
  }
2086
- function Pr(t, e, i, n, r, s) {
2087
- let o = class extends hn {
2086
+ function zs(t, e, i, n, s, r) {
2087
+ let o = class extends Tn {
2088
2088
  constructor() {
2089
- super(t, i, r), this.$$p_d = e;
2089
+ super(t, i, s), this.$$p_d = e;
2090
2090
  }
2091
2091
  static get observedAttributes() {
2092
- return vt(e).map(
2092
+ return Tt(e).map(
2093
2093
  (l) => (e[l].attribute || l).toLowerCase()
2094
2094
  );
2095
2095
  }
2096
2096
  };
2097
- return vt(e).forEach((l) => {
2098
- bt(o.prototype, l, {
2097
+ return Tt(e).forEach((l) => {
2098
+ At(o.prototype, l, {
2099
2099
  get() {
2100
2100
  return this.$$c && l in this.$$c ? this.$$c[l] : this.$$d[l];
2101
2101
  },
2102
2102
  set(a) {
2103
- a = gt(l, a, e), this.$$d[l] = a;
2103
+ a = _t(l, a, e), this.$$d[l] = a;
2104
2104
  var u = this.$$c;
2105
2105
  if (u) {
2106
- var d = De(u, l)?.get;
2106
+ var d = Ge(u, l)?.get;
2107
2107
  d ? u[l] = a : u.$set({ [l]: a });
2108
2108
  }
2109
2109
  }
2110
2110
  });
2111
2111
  }), n.forEach((l) => {
2112
- bt(o.prototype, l, {
2112
+ At(o.prototype, l, {
2113
2113
  get() {
2114
2114
  return this.$$c?.[l];
2115
2115
  }
@@ -2117,17 +2117,17 @@ function Pr(t, e, i, n, r, s) {
2117
2117
  }), t.element = /** @type {any} */
2118
2118
  o, o;
2119
2119
  }
2120
- class xr extends Event {
2121
- constructor(i, n, r, s) {
2120
+ class Ys extends Event {
2121
+ constructor(i, n, s, r) {
2122
2122
  super("context-request", { bubbles: !0, composed: !0 });
2123
2123
  f(this, "context");
2124
2124
  f(this, "contextTarget");
2125
2125
  f(this, "callback");
2126
2126
  f(this, "subscribe");
2127
- this.context = i, this.contextTarget = n, this.callback = r, this.subscribe = s ?? !1;
2127
+ this.context = i, this.contextTarget = n, this.callback = s, this.subscribe = r ?? !1;
2128
2128
  }
2129
2129
  }
2130
- class jr {
2130
+ class Us {
2131
2131
  constructor(e, i) {
2132
2132
  f(this, "host");
2133
2133
  f(this, "context");
@@ -2151,57 +2151,65 @@ class jr {
2151
2151
  return this.currentValue;
2152
2152
  }
2153
2153
  requestValue() {
2154
- this.host.dispatchEvent(new xr(this.context, this.host, this.handleValue, this.subscribe));
2154
+ this.host.dispatchEvent(new Ys(this.context, this.host, this.handleValue, this.subscribe));
2155
2155
  }
2156
2156
  }
2157
- const pn = (t) => t, Br = pn(/* @__PURE__ */ Symbol.for("pie.assessmentToolkit.runtimeContext")), Hr = pn(/* @__PURE__ */ Symbol.for("pie.assessmentToolkit.shellContext"));
2158
- function gn(t, e, i) {
2157
+ const An = (t) => t, xs = An(/* @__PURE__ */ Symbol.for("pie.assessmentToolkit.runtimeContext")), Xs = An(/* @__PURE__ */ Symbol.for("pie.assessmentToolkit.shellContext"));
2158
+ function In(t, e, i) {
2159
2159
  let n = !1;
2160
- const r = new jr(t, {
2160
+ const s = new Us(t, {
2161
2161
  context: e,
2162
2162
  subscribe: !0,
2163
2163
  onValue: (u) => {
2164
2164
  n = !0, i(u);
2165
2165
  }
2166
2166
  });
2167
- r.connect();
2168
- const s = (u) => {
2169
- u.context === e && r.requestValue();
2167
+ s.connect();
2168
+ const r = (u) => {
2169
+ u.context === e && s.requestValue();
2170
2170
  };
2171
- t.addEventListener("context-provider", s);
2171
+ t.addEventListener("context-provider", r);
2172
2172
  let o = 0;
2173
2173
  const l = 200, a = globalThis.setInterval(() => {
2174
2174
  if (n || o >= l) {
2175
2175
  globalThis.clearInterval(a);
2176
2176
  return;
2177
2177
  }
2178
- o += 1, r.requestValue();
2178
+ o += 1, s.requestValue();
2179
2179
  }, 50);
2180
2180
  return () => {
2181
- globalThis.clearInterval(a), t.removeEventListener("context-provider", s), r.disconnect();
2181
+ globalThis.clearInterval(a), t.removeEventListener("context-provider", r), s.disconnect();
2182
2182
  };
2183
2183
  }
2184
- function qr(t, e) {
2185
- return gn(t, Br, e);
2184
+ function Ws(t, e) {
2185
+ return In(t, xs, e);
2186
2186
  }
2187
- function zr(t, e) {
2188
- return gn(t, Hr, e);
2187
+ function Qs(t, e) {
2188
+ return In(t, Xs, e);
2189
2189
  }
2190
- function Gr(t, e) {
2191
- return qr(t, e);
2190
+ function Js(t, e) {
2191
+ return Ws(t, e);
2192
2192
  }
2193
- function Ur(t, e) {
2194
- return zr(t, e);
2193
+ function Zs(t, e) {
2194
+ return Qs(t, e);
2195
2195
  }
2196
- var fi;
2196
+ var _i;
2197
2197
  (function(t) {
2198
2198
  t.TTS_WORD = "tts-word", t.TTS_SENTENCE = "tts-sentence", t.ANNOTATION = "annotation";
2199
- })(fi || (fi = {}));
2200
- var di;
2199
+ })(_i || (_i = {}));
2200
+ var yi;
2201
2201
  (function(t) {
2202
2202
  t.YELLOW = "yellow", t.GREEN = "green", t.BLUE = "blue", t.PINK = "pink", t.ORANGE = "orange", t.UNDERLINE = "underline";
2203
- })(di || (di = {}));
2204
- class Yr {
2203
+ })(yi || (yi = {}));
2204
+ const er = {
2205
+ tts: "textToSpeech",
2206
+ colorScheme: "theme"
2207
+ };
2208
+ function tr(t) {
2209
+ const e = t.trim();
2210
+ return e ? er[e] || e : "";
2211
+ }
2212
+ class ir {
2205
2213
  constructor() {
2206
2214
  f(this, "tools", /* @__PURE__ */ new Map());
2207
2215
  f(this, "pnpIndex", /* @__PURE__ */ new Map());
@@ -2215,7 +2223,7 @@ class Yr {
2215
2223
  * Normalize a single tool alias to canonical toolId.
2216
2224
  */
2217
2225
  normalizeToolId(e) {
2218
- return e === "tts" ? "textToSpeech" : e;
2226
+ return tr(e);
2219
2227
  }
2220
2228
  /**
2221
2229
  * Normalize a list of tool aliases to canonical toolIds.
@@ -2318,6 +2326,24 @@ class Yr {
2318
2326
  getToolsByLevel(e) {
2319
2327
  return this.getAllTools().filter((i) => i.supportedLevels.includes(e));
2320
2328
  }
2329
+ /**
2330
+ * Resolve tool activation with backward-compatible defaults.
2331
+ */
2332
+ getToolActivation(e) {
2333
+ return this.get(e)?.activation || "toolbar-toggle";
2334
+ }
2335
+ /**
2336
+ * Resolve singleton scope for a tool when present.
2337
+ */
2338
+ getToolSingletonScope(e) {
2339
+ return this.get(e)?.singletonScope || null;
2340
+ }
2341
+ /**
2342
+ * Filter tool IDs by activation type.
2343
+ */
2344
+ filterToolIdsByActivation(e, i) {
2345
+ return e.filter((n) => this.getToolActivation(n) === i);
2346
+ }
2321
2347
  /**
2322
2348
  * Filter tools by visibility in a given context
2323
2349
  *
@@ -2330,17 +2356,17 @@ class Yr {
2330
2356
  */
2331
2357
  filterVisibleInContext(e, i) {
2332
2358
  const n = [];
2333
- for (const r of e) {
2334
- const s = this.get(r);
2335
- if (!s) {
2336
- console.warn(`Tool '${r}' is allowed but not registered`);
2359
+ for (const s of e) {
2360
+ const r = this.get(s);
2361
+ if (!r) {
2362
+ console.warn(`Tool '${s}' is allowed but not registered`);
2337
2363
  continue;
2338
2364
  }
2339
- if (s.supportedLevels.includes(i.level))
2365
+ if (r.supportedLevels.includes(i.level))
2340
2366
  try {
2341
- s.isVisibleInContext(i) && n.push(s);
2367
+ r.isVisibleInContext(i) && n.push(r);
2342
2368
  } catch (o) {
2343
- console.error(`Error evaluating visibility for tool '${r}':`, o);
2369
+ console.error(`Error evaluating visibility for tool '${s}':`, o);
2344
2370
  }
2345
2371
  }
2346
2372
  return n;
@@ -2357,7 +2383,9 @@ class Yr {
2357
2383
  name: e.name,
2358
2384
  description: e.description,
2359
2385
  pnpSupportIds: e.pnpSupportIds || [],
2360
- supportedLevels: e.supportedLevels
2386
+ supportedLevels: e.supportedLevels,
2387
+ activation: e.activation || "toolbar-toggle",
2388
+ singletonScope: e.singletonScope || null
2361
2389
  }));
2362
2390
  }
2363
2391
  /**
@@ -2370,10 +2398,10 @@ class Yr {
2370
2398
  generatePNPSupportsFromTools(e) {
2371
2399
  const i = /* @__PURE__ */ new Set();
2372
2400
  for (const n of e) {
2373
- const r = this.get(n);
2374
- if (r?.pnpSupportIds)
2375
- for (const s of r.pnpSupportIds)
2376
- i.add(s);
2401
+ const s = this.get(n);
2402
+ if (s?.pnpSupportIds)
2403
+ for (const r of s.pnpSupportIds)
2404
+ i.add(r);
2377
2405
  }
2378
2406
  return Array.from(i);
2379
2407
  }
@@ -2412,12 +2440,12 @@ class Yr {
2412
2440
  const n = this.moduleLoaders.get(e);
2413
2441
  if (!n)
2414
2442
  return;
2415
- const r = (async () => {
2443
+ const s = (async () => {
2416
2444
  await n(), this.loadedToolModules.add(e);
2417
2445
  })();
2418
- this.moduleLoadPromises.set(e, r);
2446
+ this.moduleLoadPromises.set(e, s);
2419
2447
  try {
2420
- await r;
2448
+ await s;
2421
2449
  } finally {
2422
2450
  this.moduleLoadPromises.delete(e);
2423
2451
  }
@@ -2438,39 +2466,39 @@ class Yr {
2438
2466
  * Render a tool for toolbar use with component overrides attached.
2439
2467
  */
2440
2468
  renderForToolbar(e, i, n) {
2441
- const r = this.get(e);
2442
- if (!r)
2469
+ const s = this.get(e);
2470
+ if (!s)
2443
2471
  throw new Error(`Tool '${e}' is not registered`);
2444
- const s = {
2472
+ const r = {
2445
2473
  ...n,
2446
2474
  componentOverrides: {
2447
2475
  ...this.componentOverrides || {},
2448
2476
  ...n.componentOverrides || {}
2449
2477
  }
2450
2478
  };
2451
- return r.renderToolbar(i, s);
2479
+ return s.renderToolbar(i, r);
2452
2480
  }
2453
2481
  }
2454
- function mn(t) {
2482
+ function En(t) {
2455
2483
  return t.level === "item";
2456
2484
  }
2457
- function Wr(t) {
2485
+ function nr(t) {
2458
2486
  return t.level === "passage";
2459
2487
  }
2460
- function Kr(t) {
2488
+ function sr(t) {
2461
2489
  return t.level === "rubric";
2462
2490
  }
2463
- function vn(t) {
2491
+ function wn(t) {
2464
2492
  return t.level === "element";
2465
2493
  }
2466
- function Qt(t) {
2467
- if (vn(t)) {
2494
+ function si(t) {
2495
+ if (wn(t)) {
2468
2496
  const e = t.item.config;
2469
2497
  if (!e)
2470
2498
  return "";
2471
- const i = [], n = (a) => a.replace(/<[^>]*>/g, " ").trim(), r = e.elements?.[t.elementId];
2472
- r && typeof r == "string" && i.push(n(r));
2473
- const s = e.models, l = (Array.isArray(s) ? s : s && typeof s == "object" ? Object.values(s) : []).find((a) => a && typeof a == "object" && a.id === t.elementId);
2499
+ const i = [], n = (a) => a.replace(/<[^>]*>/g, " ").trim(), s = e.elements?.[t.elementId];
2500
+ s && typeof s == "string" && i.push(n(s));
2501
+ const r = e.models, l = (Array.isArray(r) ? r : r && typeof r == "object" ? Object.values(r) : []).find((a) => a && typeof a == "object" && a.id === t.elementId);
2474
2502
  if (l) {
2475
2503
  for (const a of Object.values(l))
2476
2504
  if (typeof a == "string" && i.push(n(a)), Array.isArray(a)) {
@@ -2482,41 +2510,60 @@ function Qt(t) {
2482
2510
  }
2483
2511
  return i.filter(Boolean).join(" ").trim();
2484
2512
  }
2485
- if (mn(t)) {
2513
+ if (En(t)) {
2486
2514
  const e = t.item;
2487
2515
  if (!e?.config)
2488
2516
  return "";
2489
- const i = e.config, n = [], r = (a) => a.replace(/<[^>]*>/g, " ").trim();
2490
- typeof i.markup == "string" && n.push(r(i.markup));
2491
- const s = i.elements;
2492
- if (s && typeof s == "object")
2493
- for (const a of Object.values(s))
2494
- typeof a == "string" && n.push(r(a));
2517
+ const i = e.config, n = [], s = (a) => a.replace(/<[^>]*>/g, " ").trim();
2518
+ typeof i.markup == "string" && n.push(s(i.markup));
2519
+ const r = i.elements;
2520
+ if (r && typeof r == "object")
2521
+ for (const a of Object.values(r))
2522
+ typeof a == "string" && n.push(s(a));
2495
2523
  const o = i.models, l = Array.isArray(o) ? o : o && typeof o == "object" ? Object.values(o) : [];
2496
2524
  for (const a of l)
2497
2525
  if (!(!a || typeof a != "object")) {
2498
2526
  for (const u of Object.values(a))
2499
- if (typeof u == "string" && n.push(r(u)), Array.isArray(u)) {
2527
+ if (typeof u == "string" && n.push(s(u)), Array.isArray(u)) {
2500
2528
  for (const d of u)
2501
2529
  if (d && typeof d == "object")
2502
- for (const m of Object.values(d))
2503
- typeof m == "string" && n.push(r(m));
2530
+ for (const v of Object.values(d))
2531
+ typeof v == "string" && n.push(s(v));
2504
2532
  }
2505
2533
  }
2506
2534
  return n.filter(Boolean).join(" ").trim();
2507
2535
  }
2508
- if (Wr(t)) {
2536
+ if (nr(t)) {
2509
2537
  const e = t.passage;
2510
- return e?.config ? (e.config.markup || "").replace(/<[^>]*>/g, " ").trim() : "";
2538
+ if (!e?.config)
2539
+ return "";
2540
+ const i = e.config, n = [], s = (a) => a.replace(/<[^>]*>/g, " ").trim();
2541
+ typeof i.markup == "string" && n.push(s(i.markup)), typeof i.content == "string" && n.push(s(i.content)), typeof i.prompt == "string" && n.push(s(i.prompt));
2542
+ const r = i.elements;
2543
+ if (r && typeof r == "object")
2544
+ for (const a of Object.values(r))
2545
+ typeof a == "string" && n.push(s(a));
2546
+ const o = i.models, l = Array.isArray(o) ? o : o && typeof o == "object" ? Object.values(o) : [];
2547
+ for (const a of l)
2548
+ if (!(!a || typeof a != "object")) {
2549
+ for (const u of Object.values(a))
2550
+ if (typeof u == "string" && n.push(s(u)), Array.isArray(u)) {
2551
+ for (const d of u)
2552
+ if (d && typeof d == "object")
2553
+ for (const v of Object.values(d))
2554
+ typeof v == "string" && n.push(s(v));
2555
+ }
2556
+ }
2557
+ return n.filter(Boolean).join(" ").trim();
2511
2558
  }
2512
- if (Kr(t)) {
2559
+ if (sr(t)) {
2513
2560
  const e = t.rubricBlock;
2514
2561
  return e.passage?.config ? (e.passage.config.markup || "").replace(/<[^>]*>/g, " ").trim() : (e.content || "").replace(/<[^>]*>/g, " ").trim();
2515
2562
  }
2516
2563
  return "";
2517
2564
  }
2518
- function It(t) {
2519
- const e = Qt(t);
2565
+ function Rt(t) {
2566
+ const e = si(t);
2520
2567
  return [
2521
2568
  /<math[>\s]/i,
2522
2569
  // MathML
@@ -2532,7 +2579,7 @@ function It(t) {
2532
2579
  // Simple arithmetic
2533
2580
  ].some((n) => n.test(e));
2534
2581
  }
2535
- function Qr(t) {
2582
+ function rr(t) {
2536
2583
  const e = [
2537
2584
  "pie-multiple-choice",
2538
2585
  "pie-inline-choice",
@@ -2541,32 +2588,32 @@ function Qr(t) {
2541
2588
  "inline-choice",
2542
2589
  "select-text"
2543
2590
  ];
2544
- if (vn(t)) {
2591
+ if (wn(t)) {
2545
2592
  const i = t.item.config;
2546
2593
  if (!i?.models)
2547
2594
  return !1;
2548
- const r = (Array.isArray(i.models) ? i.models : Object.values(i.models)).find((o) => o && typeof o == "object" && o.id === t.elementId);
2549
- if (!r)
2595
+ const s = (Array.isArray(i.models) ? i.models : Object.values(i.models)).find((o) => o && typeof o == "object" && o.id === t.elementId);
2596
+ if (!s)
2550
2597
  return !1;
2551
- const s = r.element || "";
2552
- return e.includes(s);
2598
+ const r = s.element || "";
2599
+ return e.includes(r);
2553
2600
  }
2554
- if (mn(t)) {
2601
+ if (En(t)) {
2555
2602
  const i = t.item.config?.models;
2556
- return (Array.isArray(i) ? i : i && typeof i == "object" ? Object.values(i) : []).some((r) => {
2557
- if (!r || typeof r != "object")
2603
+ return (Array.isArray(i) ? i : i && typeof i == "object" ? Object.values(i) : []).some((s) => {
2604
+ if (!s || typeof s != "object")
2558
2605
  return !1;
2559
- const s = r.element || "";
2560
- return e.includes(s) ? !0 : Array.isArray(r.choices) && r.choices.length > 0;
2606
+ const r = s.element || "";
2607
+ return e.includes(r) ? !0 : Array.isArray(s.choices) && s.choices.length > 0;
2561
2608
  });
2562
2609
  }
2563
2610
  return !1;
2564
2611
  }
2565
- function Et(t) {
2566
- return Qt(t).trim().length >= 10;
2612
+ function Ot(t) {
2613
+ return si(t).trim().length >= 10;
2567
2614
  }
2568
- function Jr(t) {
2569
- const e = Qt(t);
2615
+ function or(t) {
2616
+ const e = si(t);
2570
2617
  return [
2571
2618
  /chemistry|chemical|element|atom|molecule|compound/i,
2572
2619
  /periodic\s+table/i,
@@ -2578,25 +2625,25 @@ function Jr(t) {
2578
2625
  /physics|force|energy|velocity|acceleration/i
2579
2626
  ].some((n) => n.test(e));
2580
2627
  }
2581
- const Xr = [
2628
+ const lr = [
2582
2629
  "assessment",
2583
2630
  "section",
2584
2631
  "item",
2585
2632
  "passage",
2586
2633
  "rubric"
2587
- ], Zr = new Set(Xr);
2588
- function es(t) {
2589
- return Zr.has(t);
2634
+ ], ar = new Set(lr);
2635
+ function cr(t) {
2636
+ return ar.has(t);
2590
2637
  }
2591
- function Y(t, e, i, n = "overlay") {
2592
- const r = t.trim(), s = i.trim();
2593
- if (!r || !s)
2638
+ function ie(t, e, i) {
2639
+ const n = t.trim(), s = i.trim();
2640
+ if (!n || !s)
2594
2641
  throw new Error("Tool instance ids require non-empty tool and scope ids");
2595
- if (!es(e))
2642
+ if (!cr(e))
2596
2643
  throw new Error(`Unknown tool scope level '${e}'. Register custom levels with registerToolScopeLevel().`);
2597
- return n === "inline" ? `${r}:${e}:${s}:inline` : `${r}:${e}:${s}`;
2644
+ return `${n}:${e}:${s}`;
2598
2645
  }
2599
- const ts = /* @__PURE__ */ new Set([
2646
+ const ur = /* @__PURE__ */ new Set([
2600
2647
  "annotation-xml",
2601
2648
  "color-profile",
2602
2649
  "font-face",
@@ -2605,7 +2652,7 @@ const ts = /* @__PURE__ */ new Set([
2605
2652
  "font-face-format",
2606
2653
  "font-face-name",
2607
2654
  "missing-glyph"
2608
- ]), is = /^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/, ns = (t, e = "custom element tag") => {
2655
+ ]), fr = /^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/, dr = (t, e = "custom element tag") => {
2609
2656
  if (!t || typeof t != "string")
2610
2657
  throw new Error(`Invalid ${e}: expected a non-empty string`);
2611
2658
  const i = t.trim();
@@ -2615,12 +2662,12 @@ const ts = /* @__PURE__ */ new Set([
2615
2662
  throw new Error(`Invalid ${e} "${i}": custom element names must be lowercase`);
2616
2663
  if (!i.includes("-"))
2617
2664
  throw new Error(`Invalid ${e} "${i}": custom element names must include a hyphen`);
2618
- if (ts.has(i))
2665
+ if (ur.has(i))
2619
2666
  throw new Error(`Invalid ${e} "${i}": this name is reserved by the HTML spec`);
2620
- if (!is.test(i))
2667
+ if (!fr.test(i))
2621
2668
  throw new Error(`Invalid ${e} "${i}": allowed characters are lowercase letters, numbers, ".", "_" and "-"`);
2622
2669
  return i;
2623
- }, bn = {
2670
+ }, Sn = {
2624
2671
  calculator: "pie-tool-calculator",
2625
2672
  textToSpeech: "pie-tool-text-to-speech",
2626
2673
  ruler: "pie-tool-ruler",
@@ -2628,17 +2675,18 @@ const ts = /* @__PURE__ */ new Set([
2628
2675
  answerEliminator: "pie-tool-answer-eliminator",
2629
2676
  highlighter: "pie-tool-annotation-toolbar",
2630
2677
  lineReader: "pie-tool-line-reader",
2631
- colorScheme: "pie-tool-color-scheme",
2678
+ theme: "pie-tool-theme",
2679
+ colorScheme: "pie-tool-theme",
2632
2680
  annotationToolbar: "pie-tool-annotation-toolbar",
2633
2681
  graph: "pie-tool-graph",
2634
2682
  periodicTable: "pie-tool-periodic-table"
2635
- }, rs = (t, e) => {
2636
- const i = e?.toolTagMap?.[t] ?? bn[t] ?? t;
2637
- return ns(i, `tool component tag for "${t}"`);
2638
- }, ss = (t) => document.createElement(t), oe = (t, e, i, n) => {
2639
- const r = rs(t, n), o = n?.toolComponentFactories?.[t] ?? n?.toolComponentFactory;
2640
- return o ? o({ toolId: t, tagName: r, context: e, toolbarContext: i }) : ss(r);
2641
- }, os = {
2683
+ }, hr = (t, e) => {
2684
+ const i = e?.toolTagMap?.[t] ?? Sn[t] ?? t;
2685
+ return dr(i, `tool component tag for "${t}"`);
2686
+ }, pr = (t) => document.createElement(t), ce = (t, e, i, n) => {
2687
+ const s = hr(t, n), o = n?.toolComponentFactories?.[t] ?? n?.toolComponentFactory;
2688
+ return o ? o({ toolId: t, tagName: s, context: e, toolbarContext: i }) : pr(s);
2689
+ }, gr = {
2642
2690
  toolId: "calculator",
2643
2691
  name: "Calculator",
2644
2692
  description: "Multi-type calculator (basic, scientific, graphing)",
@@ -2664,20 +2712,28 @@ const ts = /* @__PURE__ */ new Set([
2664
2712
  * (MathML, LaTeX, arithmetic markers).
2665
2713
  */
2666
2714
  isVisibleInContext(t) {
2667
- return It(t);
2715
+ return Rt(t);
2668
2716
  },
2669
2717
  renderToolbar(t, e) {
2670
- const i = Y(this.toolId, "item", e.itemId), n = e.componentOverrides, r = oe(this.toolId, t, e, n);
2671
- r.setAttribute("tool-id", i);
2672
- const s = document.createElement("pie-tool-calculator-inline");
2673
- return s.setAttribute("tool-id", Y(this.toolId, "item", e.itemId, "inline")), s.setAttribute("target-tool-id", i), s.setAttribute("calculator-type", "scientific"), s.setAttribute("available-types", "basic,scientific,graphing"), s.setAttribute("size", e.ui?.size || "md"), {
2718
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = e.componentOverrides, s = ce(this.toolId, t, e, n);
2719
+ s.setAttribute("tool-id", i);
2720
+ const r = {
2721
+ toolId: this.toolId,
2722
+ label: this.name,
2723
+ icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
2724
+ disabled: !1,
2725
+ ariaLabel: "Open scientific calculator",
2726
+ tooltip: "Calculator",
2727
+ onClick: () => e.toggleTool(this.toolId),
2728
+ active: e.isToolVisible(i)
2729
+ };
2730
+ return {
2674
2731
  toolId: this.toolId,
2675
- inlineElement: s,
2676
- overlayElement: r,
2677
- button: null,
2732
+ elements: [{ element: s, mount: "after-buttons" }],
2733
+ button: r,
2678
2734
  sync: () => {
2679
2735
  const o = e.isToolVisible(i);
2680
- r.visible = o;
2736
+ r.active = o, r.ariaLabel = o ? "Close scientific calculator" : "Open scientific calculator", r.tooltip = o ? "Close calculator" : "Calculator", s.visible = o;
2681
2737
  },
2682
2738
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
2683
2739
  o(e.isToolVisible(i));
@@ -2685,7 +2741,7 @@ const ts = /* @__PURE__ */ new Set([
2685
2741
  }
2686
2742
  };
2687
2743
  }
2688
- }, ls = {
2744
+ }, mr = {
2689
2745
  toolId: "textToSpeech",
2690
2746
  name: "Text to Speech",
2691
2747
  description: "Read content aloud",
@@ -2711,23 +2767,115 @@ const ts = /* @__PURE__ */ new Set([
2711
2767
  * - Context contains readable text (at least 10 characters)
2712
2768
  */
2713
2769
  isVisibleInContext(t) {
2714
- return Et(t);
2770
+ return Ot(t);
2715
2771
  },
2716
2772
  renderToolbar(t, e) {
2717
- const i = Y(this.toolId, "item", e.itemId, "inline"), n = document.createElement("pie-tool-tts-inline");
2718
- n.setAttribute("tool-id", i), n.setAttribute("catalog-id", e.catalogId || e.itemId), n.setAttribute("language", e.language), n.setAttribute("size", e.ui?.size || "md");
2719
- let r = !1;
2773
+ let i = null;
2774
+ const n = e.ttsService, s = ie(this.toolId, e.scope.level, e.scope.scopeId), r = () => e.isToolVisible(s), o = {
2775
+ toolId: this.toolId,
2776
+ label: "Read aloud",
2777
+ icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
2778
+ ariaLabel: "Read aloud",
2779
+ tooltip: "Read aloud",
2780
+ onClick: () => {
2781
+ p();
2782
+ },
2783
+ disabled: !1,
2784
+ active: !1
2785
+ }, l = () => {
2786
+ const g = r() ? "Stop reading" : "Read aloud";
2787
+ o.label = g, o.ariaLabel = g, o.tooltip = g, o.active = r(), o.disabled = !e.ttsService;
2788
+ }, a = (g) => {
2789
+ (g === "idle" || g === "error") && r() && (e.toggleTool(this.toolId), l());
2790
+ }, u = async () => {
2791
+ e.ensureTTSReady && (i || (i = (async () => {
2792
+ await e.ensureTTSReady?.(), e.toolkitCoordinator?.highlightCoordinator && n?.setHighlightCoordinator?.(e.toolkitCoordinator.highlightCoordinator);
2793
+ })()), await i);
2794
+ }, d = () => {
2795
+ n?.stop?.(), r() && e.toggleTool(this.toolId), l();
2796
+ }, v = () => {
2797
+ const g = e.getScopeElement?.();
2798
+ if (g)
2799
+ return g;
2800
+ const h = (S) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(S) : S.replace(/"/g, '\\"'), T = [
2801
+ e.catalogId,
2802
+ e.scope.itemId,
2803
+ e.scope.canonicalItemId
2804
+ ].filter((S) => typeof S == "string" && S.length > 0), b = [];
2805
+ for (const S of T) {
2806
+ const L = h(S);
2807
+ e.scope.level === "passage" && b.push(`pie-passage-shell[item-id="${L}"] [data-region="content"]`), b.push(`pie-item-shell[item-id="${L}"] [data-region="content"]`);
2808
+ }
2809
+ b.push("[data-region='content']");
2810
+ for (const S of b) {
2811
+ const L = document.querySelector(S);
2812
+ if (L instanceof HTMLElement)
2813
+ return L;
2814
+ }
2815
+ return null;
2816
+ }, p = async () => {
2817
+ if (!n?.speak || !e.ttsService)
2818
+ return;
2819
+ if (r()) {
2820
+ d();
2821
+ return;
2822
+ }
2823
+ const g = v();
2824
+ if (!g)
2825
+ return;
2826
+ const h = g.textContent || "";
2827
+ if (h.trim())
2828
+ try {
2829
+ r() || e.toggleTool(this.toolId), l(), await u(), n.setRootElement?.(g), n.speak(h, {
2830
+ // For passage-level TTS, use rendered DOM text as the source of truth.
2831
+ // Catalog/SSML content can diverge from rendered text and break
2832
+ // word-boundary-to-DOM mapping for progressive yellow highlighting.
2833
+ catalogId: e.scope.level === "passage" ? void 0 : e.catalogId || e.itemId,
2834
+ language: e.language,
2835
+ contentElement: g
2836
+ }).catch((T) => {
2837
+ console.error("[ttsToolRegistration] Failed to start reading:", T), l();
2838
+ }), l();
2839
+ } catch (T) {
2840
+ l(), console.error("[ttsToolRegistration] Failed to start reading:", T);
2841
+ }
2842
+ };
2720
2843
  return {
2721
2844
  toolId: this.toolId,
2722
- inlineElement: n,
2845
+ button: o,
2723
2846
  sync: () => {
2724
- n.setAttribute("catalog-id", e.catalogId || e.itemId), n.setAttribute("language", e.language), n.setAttribute("size", e.ui?.size || "md"), e.ttsService && (n.ttsService = e.ttsService), !r && e.ensureTTSReady && (r = !0, e.ensureTTSReady().catch((s) => {
2725
- console.error("[ttsToolRegistration] Failed to initialize TTS service:", s);
2726
- }));
2847
+ l(), e.ensureTTSReady && u().catch((g) => {
2848
+ console.error("[ttsToolRegistration] Failed to initialize TTS service:", g);
2849
+ });
2850
+ },
2851
+ subscribeActive: (g) => {
2852
+ const h = [];
2853
+ if (e.subscribeVisibility) {
2854
+ const T = e.subscribeVisibility(() => {
2855
+ const b = r();
2856
+ l(), g(b);
2857
+ });
2858
+ h.push(T);
2859
+ }
2860
+ if (e.ttsService) {
2861
+ const T = `tts-toolbar:${s}`, b = (S) => {
2862
+ a(String(S || ""));
2863
+ const L = r();
2864
+ l(), g(L);
2865
+ };
2866
+ e.ttsService.onStateChange(T, b), h.push(() => {
2867
+ e.ttsService?.offStateChange(T, b);
2868
+ });
2869
+ }
2870
+ return h.length === 0 ? () => {
2871
+ } : () => {
2872
+ for (const T of h)
2873
+ T();
2874
+ };
2727
2875
  }
2728
2876
  };
2729
2877
  }
2730
- }, as = {
2878
+ }, vr = {
2731
2879
  toolId: "ruler",
2732
2880
  name: "Ruler",
2733
2881
  description: "On-screen ruler for measurements",
@@ -2746,10 +2894,10 @@ const ts = /* @__PURE__ */ new Set([
2746
2894
  * Pass 2: Ruler is relevant when math content is present
2747
2895
  */
2748
2896
  isVisibleInContext(t) {
2749
- return It(t);
2897
+ return Rt(t);
2750
2898
  },
2751
2899
  renderToolbar(t, e) {
2752
- const i = Y(this.toolId, "item", e.itemId), n = {
2900
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
2753
2901
  toolId: this.toolId,
2754
2902
  label: this.name,
2755
2903
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
@@ -2758,14 +2906,14 @@ const ts = /* @__PURE__ */ new Set([
2758
2906
  tooltip: "Ruler",
2759
2907
  onClick: () => e.toggleTool(this.toolId),
2760
2908
  active: e.isToolVisible(i)
2761
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
2762
- return s.setAttribute("tool-id", i), {
2909
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
2910
+ return r.setAttribute("tool-id", i), {
2763
2911
  toolId: this.toolId,
2764
2912
  button: n,
2765
- overlayElement: s,
2913
+ elements: [{ element: r, mount: "after-buttons" }],
2766
2914
  sync: () => {
2767
2915
  const o = e.isToolVisible(i);
2768
- n.active = o, s.visible = o, e.toolkitCoordinator && (s.toolkitCoordinator = e.toolkitCoordinator);
2916
+ n.active = o, r.visible = o, e.toolkitCoordinator && (r.toolkitCoordinator = e.toolkitCoordinator);
2769
2917
  },
2770
2918
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
2771
2919
  o(e.isToolVisible(i));
@@ -2773,7 +2921,7 @@ const ts = /* @__PURE__ */ new Set([
2773
2921
  }
2774
2922
  };
2775
2923
  }
2776
- }, cs = {
2924
+ }, br = {
2777
2925
  toolId: "protractor",
2778
2926
  name: "Protractor",
2779
2927
  description: "On-screen protractor for angle measurements",
@@ -2792,10 +2940,10 @@ const ts = /* @__PURE__ */ new Set([
2792
2940
  * Pass 2: Protractor is relevant when math content is present
2793
2941
  */
2794
2942
  isVisibleInContext(t) {
2795
- return It(t);
2943
+ return Rt(t);
2796
2944
  },
2797
2945
  renderToolbar(t, e) {
2798
- const i = Y(this.toolId, "item", e.itemId), n = {
2946
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
2799
2947
  toolId: this.toolId,
2800
2948
  label: this.name,
2801
2949
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
@@ -2804,14 +2952,14 @@ const ts = /* @__PURE__ */ new Set([
2804
2952
  tooltip: "Protractor",
2805
2953
  onClick: () => e.toggleTool(this.toolId),
2806
2954
  active: e.isToolVisible(i)
2807
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
2808
- return s.setAttribute("tool-id", i), {
2955
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
2956
+ return r.setAttribute("tool-id", i), {
2809
2957
  toolId: this.toolId,
2810
2958
  button: n,
2811
- overlayElement: s,
2959
+ elements: [{ element: r, mount: "after-buttons" }],
2812
2960
  sync: () => {
2813
2961
  const o = e.isToolVisible(i);
2814
- n.active = o, s.visible = o, e.toolkitCoordinator && (s.toolkitCoordinator = e.toolkitCoordinator);
2962
+ n.active = o, r.visible = o, e.toolkitCoordinator && (r.toolkitCoordinator = e.toolkitCoordinator);
2815
2963
  },
2816
2964
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
2817
2965
  o(e.isToolVisible(i));
@@ -2819,7 +2967,7 @@ const ts = /* @__PURE__ */ new Set([
2819
2967
  }
2820
2968
  };
2821
2969
  }
2822
- }, us = {
2970
+ }, _r = {
2823
2971
  toolId: "answerEliminator",
2824
2972
  name: "Answer Eliminator",
2825
2973
  description: "Strike through answer choices",
@@ -2842,12 +2990,12 @@ const ts = /* @__PURE__ */ new Set([
2842
2990
  * Pass 2: Answer eliminator is relevant only for choice-based questions
2843
2991
  */
2844
2992
  isVisibleInContext(t) {
2845
- return Qr(t);
2993
+ return rr(t);
2846
2994
  },
2847
2995
  renderToolbar(t, e) {
2848
- const i = Y(this.toolId, "item", e.itemId), n = e.componentOverrides ?? {}, r = oe(this.toolId, t, e, n);
2849
- r.setAttribute("tool-id", i), r.setAttribute("strategy", "strikethrough"), r.setAttribute("button-alignment", "inline");
2850
- const s = {
2996
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = e.componentOverrides ?? {}, s = ce(this.toolId, t, e, n);
2997
+ s.setAttribute("tool-id", i), s.setAttribute("strategy", "strikethrough"), s.setAttribute("button-alignment", "inline");
2998
+ const r = {
2851
2999
  toolId: this.toolId,
2852
3000
  label: this.name,
2853
3001
  icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M19,3H16.3H7.7H5A2,2 0 0,0 3,5V7.7V16.4V19A2,2 0 0,0 5,21H7.7H16.4H19A2,2 0 0,0 21,19V16.3V7.7V5A2,2 0 0,0 19,3M15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4L13.4,12L17,15.6L15.6,17Z"/></svg>',
@@ -2859,13 +3007,13 @@ const ts = /* @__PURE__ */ new Set([
2859
3007
  };
2860
3008
  return {
2861
3009
  toolId: this.toolId,
2862
- button: s,
2863
- overlayElement: r,
3010
+ button: r,
3011
+ elements: [{ element: s, mount: "after-buttons" }],
2864
3012
  sync: () => {
2865
3013
  const o = e.isToolVisible(i);
2866
- s.active = o, r.visible = o, e.toolCoordinator && (r.coordinator = e.toolCoordinator), r.scopeElement = e.getScopeElement?.() || null, e.elementToolStateStore && (r.elementToolStateStore = e.elementToolStateStore);
3014
+ r.active = o, s.visible = o, e.toolCoordinator && (s.coordinator = e.toolCoordinator), s.scopeElement = e.getScopeElement?.() || null, e.elementToolStateStore && (s.elementToolStateStore = e.elementToolStateStore);
2867
3015
  const l = e.getGlobalElementId?.();
2868
- l && (r.globalElementId = l);
3016
+ l && (s.globalElementId = l);
2869
3017
  },
2870
3018
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
2871
3019
  o(e.isToolVisible(i));
@@ -2873,11 +3021,12 @@ const ts = /* @__PURE__ */ new Set([
2873
3021
  }
2874
3022
  };
2875
3023
  }
2876
- }, fs = {
3024
+ }, yr = {
2877
3025
  toolId: "highlighter",
2878
3026
  name: "Highlighter",
2879
3027
  description: "Highlight text",
2880
3028
  icon: "highlighter",
3029
+ activation: "toolbar-toggle",
2881
3030
  // Highlighter appears at passage, rubric, item, and element levels
2882
3031
  supportedLevels: ["passage", "rubric", "item", "element"],
2883
3032
  // PNP support IDs
@@ -2886,10 +3035,10 @@ const ts = /* @__PURE__ */ new Set([
2886
3035
  * Pass 2: Highlighter is relevant when readable text is available
2887
3036
  */
2888
3037
  isVisibleInContext(t) {
2889
- return Et(t);
3038
+ return Ot(t);
2890
3039
  },
2891
3040
  renderToolbar(t, e) {
2892
- const i = Y(this.toolId, "item", e.itemId), n = {
3041
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
2893
3042
  toolId: this.toolId,
2894
3043
  label: this.name,
2895
3044
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
@@ -2898,14 +3047,14 @@ const ts = /* @__PURE__ */ new Set([
2898
3047
  tooltip: "Highlight",
2899
3048
  onClick: () => e.toggleTool(this.toolId),
2900
3049
  active: e.isToolVisible(i)
2901
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
2902
- return s.setAttribute("tool-id", i), {
3050
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
3051
+ return r.setAttribute("tool-id", i), {
2903
3052
  toolId: this.toolId,
2904
3053
  button: n,
2905
- overlayElement: s,
3054
+ elements: [{ element: r, mount: "after-buttons" }],
2906
3055
  sync: () => {
2907
3056
  const o = e.isToolVisible(i);
2908
- n.active = o, s.enabled = o, s.visible = o, e.ttsService && (s.ttsService = e.ttsService);
3057
+ n.active = o, r.enabled = o, r.visible = o, e.ttsService && (r.ttsService = e.ttsService);
2909
3058
  },
2910
3059
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
2911
3060
  o(e.isToolVisible(i));
@@ -2913,7 +3062,7 @@ const ts = /* @__PURE__ */ new Set([
2913
3062
  }
2914
3063
  };
2915
3064
  }
2916
- }, ds = {
3065
+ }, Tr = {
2917
3066
  toolId: "lineReader",
2918
3067
  name: "Line Reader",
2919
3068
  description: "Reading guide overlay",
@@ -2938,10 +3087,10 @@ const ts = /* @__PURE__ */ new Set([
2938
3087
  * Pass 2: Line reader is relevant when readable text is present
2939
3088
  */
2940
3089
  isVisibleInContext(t) {
2941
- return Et(t);
3090
+ return Ot(t);
2942
3091
  },
2943
3092
  renderToolbar(t, e) {
2944
- const i = Y(this.toolId, "item", e.itemId), n = {
3093
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
2945
3094
  toolId: this.toolId,
2946
3095
  label: this.name,
2947
3096
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
@@ -2950,14 +3099,14 @@ const ts = /* @__PURE__ */ new Set([
2950
3099
  tooltip: "Line Reader",
2951
3100
  onClick: () => e.toggleTool(this.toolId),
2952
3101
  active: e.isToolVisible(i)
2953
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
2954
- return s.setAttribute("tool-id", i), {
3102
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
3103
+ return r.setAttribute("tool-id", i), {
2955
3104
  toolId: this.toolId,
2956
3105
  button: n,
2957
- overlayElement: s,
3106
+ elements: [{ element: r, mount: "after-buttons" }],
2958
3107
  sync: () => {
2959
3108
  const o = e.isToolVisible(i);
2960
- n.active = o, s.visible = o, e.toolkitCoordinator && (s.toolkitCoordinator = e.toolkitCoordinator);
3109
+ n.active = o, r.visible = o, e.toolkitCoordinator && (r.toolkitCoordinator = e.toolkitCoordinator);
2961
3110
  },
2962
3111
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
2963
3112
  o(e.isToolVisible(i));
@@ -2965,10 +3114,10 @@ const ts = /* @__PURE__ */ new Set([
2965
3114
  }
2966
3115
  };
2967
3116
  }
2968
- }, hs = {
2969
- toolId: "colorScheme",
2970
- name: "Color Scheme",
2971
- description: "Accessible color themes and contrast",
3117
+ }, Ar = {
3118
+ toolId: "theme",
3119
+ name: "Theme",
3120
+ description: "Accessible themes and contrast",
2972
3121
  icon: "swatch",
2973
3122
  // Color scheme is assessment-wide
2974
3123
  supportedLevels: ["assessment", "section"],
@@ -2982,7 +3131,9 @@ const ts = /* @__PURE__ */ new Set([
2982
3131
  "invertColors",
2983
3132
  // QTI 3.0 standard (visual.invertColors)
2984
3133
  "colorScheme",
2985
- // Common variant
3134
+ // Legacy alias
3135
+ "theme",
3136
+ // Canonical id
2986
3137
  "highContrast",
2987
3138
  // Common variant
2988
3139
  "customColors"
@@ -2995,23 +3146,23 @@ const ts = /* @__PURE__ */ new Set([
2995
3146
  return !0;
2996
3147
  },
2997
3148
  renderToolbar(t, e) {
2998
- const i = Y(this.toolId, "item", e.itemId), n = {
3149
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
2999
3150
  toolId: this.toolId,
3000
3151
  label: this.name,
3001
3152
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
3002
3153
  disabled: !1,
3003
- ariaLabel: "Color scheme - Change colors and contrast",
3004
- tooltip: "Color Scheme",
3154
+ ariaLabel: "Theme - Change colors and contrast",
3155
+ tooltip: "Theme",
3005
3156
  onClick: () => e.toggleTool(this.toolId),
3006
3157
  active: e.isToolVisible(i)
3007
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
3008
- return s.setAttribute("tool-id", i), {
3158
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
3159
+ return r.setAttribute("tool-id", i), {
3009
3160
  toolId: this.toolId,
3010
3161
  button: n,
3011
- overlayElement: s,
3162
+ elements: [{ element: r, mount: "after-buttons" }],
3012
3163
  sync: () => {
3013
3164
  const o = e.isToolVisible(i);
3014
- n.active = o, s.visible = o, e.toolkitCoordinator && (s.toolkitCoordinator = e.toolkitCoordinator);
3165
+ n.active = o, r.visible = o, e.toolkitCoordinator && (r.toolkitCoordinator = e.toolkitCoordinator);
3015
3166
  },
3016
3167
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
3017
3168
  o(e.isToolVisible(i));
@@ -3019,11 +3170,13 @@ const ts = /* @__PURE__ */ new Set([
3019
3170
  }
3020
3171
  };
3021
3172
  }
3022
- }, ps = {
3173
+ }, Ir = Ar, Er = {
3023
3174
  toolId: "annotationToolbar",
3024
3175
  name: "Highlighter",
3025
3176
  description: "Highlight and annotate text",
3026
3177
  icon: "highlighter",
3178
+ activation: "selection-gateway",
3179
+ singletonScope: "section",
3027
3180
  // Annotation appears where there's text content
3028
3181
  supportedLevels: ["passage", "rubric", "item", "element"],
3029
3182
  // PNP support IDs
@@ -3044,10 +3197,10 @@ const ts = /* @__PURE__ */ new Set([
3044
3197
  * Pass 2: Annotation is relevant when readable text is present
3045
3198
  */
3046
3199
  isVisibleInContext(t) {
3047
- return Et(t);
3200
+ return Ot(t);
3048
3201
  },
3049
3202
  renderToolbar(t, e) {
3050
- const i = Y(this.toolId, "item", e.itemId), n = {
3203
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
3051
3204
  toolId: this.toolId,
3052
3205
  label: this.name,
3053
3206
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
@@ -3056,14 +3209,14 @@ const ts = /* @__PURE__ */ new Set([
3056
3209
  tooltip: "Highlight",
3057
3210
  onClick: () => e.toggleTool(this.toolId),
3058
3211
  active: e.isToolVisible(i)
3059
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
3060
- return s.setAttribute("tool-id", i), {
3212
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
3213
+ return r.setAttribute("tool-id", i), {
3061
3214
  toolId: this.toolId,
3062
3215
  button: n,
3063
- overlayElement: s,
3216
+ elements: [{ element: r, mount: "after-buttons" }],
3064
3217
  sync: () => {
3065
3218
  const o = e.isToolVisible(i);
3066
- n.active = o, s.visible = o, e.toolkitCoordinator && (s.toolkitCoordinator = e.toolkitCoordinator);
3219
+ n.active = o, r.visible = o, e.toolkitCoordinator && (r.toolkitCoordinator = e.toolkitCoordinator);
3067
3220
  },
3068
3221
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
3069
3222
  o(e.isToolVisible(i));
@@ -3071,7 +3224,7 @@ const ts = /* @__PURE__ */ new Set([
3071
3224
  }
3072
3225
  };
3073
3226
  }
3074
- }, gs = {
3227
+ }, wr = {
3075
3228
  toolId: "graph",
3076
3229
  name: "Graph",
3077
3230
  description: "Graphing calculator and coordinate plane",
@@ -3094,10 +3247,10 @@ const ts = /* @__PURE__ */ new Set([
3094
3247
  * Pass 2: Graph is relevant when math content is present
3095
3248
  */
3096
3249
  isVisibleInContext(t) {
3097
- return It(t);
3250
+ return Rt(t);
3098
3251
  },
3099
3252
  renderToolbar(t, e) {
3100
- const i = Y(this.toolId, "item", e.itemId), n = {
3253
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
3101
3254
  toolId: this.toolId,
3102
3255
  label: this.name,
3103
3256
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
@@ -3106,14 +3259,14 @@ const ts = /* @__PURE__ */ new Set([
3106
3259
  tooltip: "Graph",
3107
3260
  onClick: () => e.toggleTool(this.toolId),
3108
3261
  active: e.isToolVisible(i)
3109
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
3110
- return s.setAttribute("tool-id", i), {
3262
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
3263
+ return r.setAttribute("tool-id", i), {
3111
3264
  toolId: this.toolId,
3112
3265
  button: n,
3113
- overlayElement: s,
3266
+ elements: [{ element: r, mount: "after-buttons" }],
3114
3267
  sync: () => {
3115
3268
  const o = e.isToolVisible(i);
3116
- n.active = o, s.visible = o, e.toolkitCoordinator && (s.toolkitCoordinator = e.toolkitCoordinator);
3269
+ n.active = o, r.visible = o, e.toolkitCoordinator && (r.toolkitCoordinator = e.toolkitCoordinator);
3117
3270
  },
3118
3271
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
3119
3272
  o(e.isToolVisible(i));
@@ -3121,7 +3274,7 @@ const ts = /* @__PURE__ */ new Set([
3121
3274
  }
3122
3275
  };
3123
3276
  }
3124
- }, ms = {
3277
+ }, Sr = {
3125
3278
  toolId: "periodicTable",
3126
3279
  name: "Periodic Table",
3127
3280
  description: "Chemistry periodic table reference",
@@ -3142,10 +3295,10 @@ const ts = /* @__PURE__ */ new Set([
3142
3295
  * Pass 2: Periodic table is relevant when science content is present
3143
3296
  */
3144
3297
  isVisibleInContext(t) {
3145
- return Jr(t);
3298
+ return or(t);
3146
3299
  },
3147
3300
  renderToolbar(t, e) {
3148
- const i = Y(this.toolId, "item", e.itemId), n = {
3301
+ const i = ie(this.toolId, e.scope.level, e.scope.scopeId), n = {
3149
3302
  toolId: this.toolId,
3150
3303
  label: this.name,
3151
3304
  icon: typeof this.icon == "function" ? this.icon(t) : this.icon,
@@ -3154,14 +3307,14 @@ const ts = /* @__PURE__ */ new Set([
3154
3307
  tooltip: "Periodic Table",
3155
3308
  onClick: () => e.toggleTool(this.toolId),
3156
3309
  active: e.isToolVisible(i)
3157
- }, r = e.componentOverrides ?? {}, s = oe(this.toolId, t, e, r);
3158
- return s.setAttribute("tool-id", i), {
3310
+ }, s = e.componentOverrides ?? {}, r = ce(this.toolId, t, e, s);
3311
+ return r.setAttribute("tool-id", i), {
3159
3312
  toolId: this.toolId,
3160
3313
  button: n,
3161
- overlayElement: s,
3314
+ elements: [{ element: r, mount: "after-buttons" }],
3162
3315
  sync: () => {
3163
3316
  const o = e.isToolVisible(i);
3164
- n.active = o, s.visible = o, e.toolkitCoordinator && (s.toolkitCoordinator = e.toolkitCoordinator);
3317
+ n.active = o, r.visible = o, e.toolkitCoordinator && (r.toolkitCoordinator = e.toolkitCoordinator);
3165
3318
  },
3166
3319
  subscribeActive: (o) => e.subscribeVisibility ? e.subscribeVisibility(() => {
3167
3320
  o(e.isToolVisible(i));
@@ -3170,26 +3323,26 @@ const ts = /* @__PURE__ */ new Set([
3170
3323
  };
3171
3324
  }
3172
3325
  };
3173
- function vs(t = {}) {
3174
- const e = new Yr(), i = {
3326
+ function $r(t = {}) {
3327
+ const e = new ir(), i = {
3175
3328
  toolTagMap: {
3176
- ...bn,
3329
+ ...Sn,
3177
3330
  ...t.toolTagMap || {}
3178
3331
  },
3179
3332
  toolComponentFactory: t.toolComponentFactory,
3180
3333
  toolComponentFactories: t.toolComponentFactories
3181
- }, n = (r) => t.overrides?.[r.toolId] || r;
3182
- return e.register(n(os)), e.register(n(ls)), e.register(n(as)), e.register(n(cs)), e.register(n(us)), e.register(n(fs)), e.register(n(ds)), e.register(n(hs)), e.register(n(ps)), e.register(n(gs)), e.register(n(ms)), t.toolModuleLoaders && Object.keys(t.toolModuleLoaders).length > 0 && e.setToolModuleLoaders(t.toolModuleLoaders), e.setComponentOverrides(i), e;
3334
+ }, n = (s) => t.overrides?.[s.toolId] || s;
3335
+ return e.register(n(gr)), e.register(n(mr)), e.register(n(vr)), e.register(n(br)), e.register(n(_r)), e.register(n(yr)), e.register(n(Tr)), e.register(n(Ir)), e.register(n(Er)), e.register(n(wr)), e.register(n(Sr)), t.toolModuleLoaders && Object.keys(t.toolModuleLoaders).length > 0 && e.setToolModuleLoaders(t.toolModuleLoaders), e.setComponentOverrides(i), e;
3183
3336
  }
3184
- function bs() {
3185
- const t = vs(), e = /* @__PURE__ */ new Set();
3337
+ function Cr() {
3338
+ const t = $r(), e = /* @__PURE__ */ new Set();
3186
3339
  for (const i of t.getAllTools())
3187
3340
  for (const n of i.pnpSupportIds || [])
3188
3341
  e.add(n);
3189
3342
  return [...e].sort();
3190
3343
  }
3191
- bs();
3192
- const ys = {
3344
+ Cr();
3345
+ const Lr = {
3193
3346
  /**
3194
3347
  * Visual accessibility features
3195
3348
  * For students with low vision, color blindness, or visual processing needs
@@ -3360,16 +3513,16 @@ const ys = {
3360
3513
  tutorialAvailable: "tutorialAvailable"
3361
3514
  }
3362
3515
  };
3363
- Object.values(ys).flatMap((t) => Object.values(t));
3364
- var Bt;
3516
+ Object.values(Lr).flatMap((t) => Object.values(t));
3517
+ var Yt;
3365
3518
  (function(t) {
3366
3519
  t[t.BASE = 0] = "BASE", t[t.TOOL = 1e3] = "TOOL", t[t.MODAL = 2e3] = "MODAL", t[t.CONTROL = 3e3] = "CONTROL", t[t.HIGHLIGHT = 4e3] = "HIGHLIGHT";
3367
- })(Bt || (Bt = {}));
3368
- var hi;
3520
+ })(Yt || (Yt = {}));
3521
+ var Ti;
3369
3522
  (function(t) {
3370
3523
  t.IDLE = "idle", t.LOADING = "loading", t.PLAYING = "playing", t.PAUSED = "paused", t.ERROR = "error";
3371
- })(hi || (hi = {}));
3372
- class yn {
3524
+ })(Ti || (Ti = {}));
3525
+ const O = class O {
3373
3526
  constructor() {
3374
3527
  f(this, "elementType", "multiple-choice");
3375
3528
  f(this, "priority", 100);
@@ -3378,14 +3531,16 @@ class yn {
3378
3531
  return e.tagName.toLowerCase() === "multiple-choice" || e.classList.contains("multiple-choice");
3379
3532
  }
3380
3533
  findChoices(e) {
3381
- return Array.from(
3382
- e.querySelectorAll(
3383
- ".corespring-checkbox, .corespring-radio-button"
3384
- )
3534
+ e.setAttribute(O.ROOT_HOOK_ATTR, "true");
3535
+ const i = Array.from(
3536
+ e.querySelectorAll(O.CHOICE_SELECTOR)
3385
3537
  );
3538
+ for (const n of i)
3539
+ this.annotateChoice(n);
3540
+ return this.annotateFeedbackTicks(e), i;
3386
3541
  }
3387
3542
  createChoiceRange(e) {
3388
- const i = e.querySelector(".label") || e.querySelector("label") || e.querySelector('[class*="label"]') || e.querySelector("span");
3543
+ const i = this.resolveLabelElement(e);
3389
3544
  if (!i)
3390
3545
  return null;
3391
3546
  const n = document.createRange();
@@ -3398,34 +3553,59 @@ class yn {
3398
3553
  return i?.getAttribute("value") || i?.id || this.generateFallbackId(e);
3399
3554
  }
3400
3555
  getChoiceLabel(e) {
3401
- return e.querySelector(".label")?.textContent?.trim() || "Unlabeled choice";
3556
+ return this.resolveLabelElement(e)?.textContent?.trim() || "Unlabeled choice";
3402
3557
  }
3403
3558
  canEliminate(e) {
3404
3559
  const i = e.querySelector(
3405
3560
  'input[type="checkbox"], input[type="radio"]'
3406
3561
  );
3407
- return !(!i || i.getAttribute("aria-checked") === "true" || i.disabled || e.closest(".multiple-choice")?.querySelector(".feedback-tick"));
3562
+ return !(!i || i.getAttribute("aria-checked") === "true" || i.disabled || (e.closest(`[${O.ROOT_HOOK_ATTR}="true"]`) || e.closest("multiple-choice"))?.querySelector(
3563
+ `[${O.FEEDBACK_HOOK_ATTR}="true"]`
3564
+ ));
3408
3565
  }
3409
3566
  getButtonContainer(e) {
3410
3567
  return e;
3411
3568
  }
3412
3569
  generateFallbackId(e) {
3413
- const n = e.closest(".multiple-choice")?.querySelectorAll(".choice-input") || [];
3570
+ const n = (e.closest(`[${O.ROOT_HOOK_ATTR}="true"]`) || e.closest("multiple-choice"))?.querySelectorAll(
3571
+ `[${O.CHOICE_HOOK_ATTR}="true"]`
3572
+ ) || [];
3414
3573
  return `choice-${Array.from(n).indexOf(e)}`;
3415
3574
  }
3416
- }
3417
- class _s {
3575
+ annotateChoice(e) {
3576
+ e.setAttribute(O.CHOICE_HOOK_ATTR, "true");
3577
+ const i = this.resolveLabelElement(e);
3578
+ i && i.setAttribute(O.LABEL_HOOK_ATTR, "true");
3579
+ }
3580
+ resolveLabelElement(e) {
3581
+ return e.querySelector(
3582
+ `[${O.LABEL_HOOK_ATTR}="true"]`
3583
+ ) || e.querySelector("label") || e.querySelector("span");
3584
+ }
3585
+ annotateFeedbackTicks(e) {
3586
+ for (const i of e.querySelectorAll(
3587
+ ".feedback-tick"
3588
+ ))
3589
+ i.setAttribute(
3590
+ O.FEEDBACK_HOOK_ATTR,
3591
+ "true"
3592
+ );
3593
+ }
3594
+ };
3595
+ f(O, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice"), f(O, "LABEL_HOOK_ATTR", "data-pie-answer-eliminator-label"), f(O, "ROOT_HOOK_ATTR", "data-pie-answer-eliminator-root"), f(O, "FEEDBACK_HOOK_ATTR", "data-pie-answer-eliminator-feedback-tick"), f(O, "CHOICE_SELECTOR", `[${O.CHOICE_HOOK_ATTR}="true"], .corespring-checkbox, .corespring-radio-button`);
3596
+ let St = O;
3597
+ class Rr {
3418
3598
  constructor() {
3419
3599
  f(this, "elementType", "ebsr");
3420
3600
  f(this, "priority", 95);
3421
- f(this, "mcAdapter", new yn());
3601
+ f(this, "mcAdapter", new St());
3422
3602
  }
3423
3603
  canHandle(e) {
3424
3604
  return e.tagName.toLowerCase() === "ebsr" || e.querySelector("ebsr-multiple-choice") !== null;
3425
3605
  }
3426
3606
  findChoices(e) {
3427
- const i = e.querySelector('ebsr-multiple-choice[id="a"]'), n = e.querySelector('ebsr-multiple-choice[id="b"]'), r = [];
3428
- return i && r.push(...this.mcAdapter.findChoices(i)), n && r.push(...this.mcAdapter.findChoices(n)), r;
3607
+ const i = e.querySelector('ebsr-multiple-choice[id="a"]'), n = e.querySelector('ebsr-multiple-choice[id="b"]'), s = [];
3608
+ return i && s.push(...this.mcAdapter.findChoices(i)), n && s.push(...this.mcAdapter.findChoices(n)), s;
3429
3609
  }
3430
3610
  // Delegate all other methods to MultipleChoiceAdapter
3431
3611
  createChoiceRange(e) {
@@ -3445,7 +3625,7 @@ class _s {
3445
3625
  return this.mcAdapter.getButtonContainer(e);
3446
3626
  }
3447
3627
  }
3448
- class ws {
3628
+ class Or {
3449
3629
  constructor() {
3450
3630
  f(this, "elementType", "inline-dropdown");
3451
3631
  f(this, "priority", 90);
@@ -3473,13 +3653,13 @@ class ws {
3473
3653
  return e;
3474
3654
  }
3475
3655
  }
3476
- class Ts {
3656
+ class kr {
3477
3657
  constructor() {
3478
3658
  f(this, "adapters");
3479
3659
  this.adapters = [
3480
- new yn(),
3481
- new _s(),
3482
- new ws()
3660
+ new St(),
3661
+ new Rr(),
3662
+ new Or()
3483
3663
  ].sort((e, i) => i.priority - e.priority);
3484
3664
  }
3485
3665
  /**
@@ -3493,10 +3673,10 @@ class Ts {
3493
3673
  */
3494
3674
  findAllChoicesWithAdapters(e) {
3495
3675
  const i = [], n = /* @__PURE__ */ new Set();
3496
- for (const r of this.adapters) {
3497
- const s = r.findChoices(e);
3498
- for (const o of s)
3499
- n.has(o) || (n.add(o), i.push({ choice: o, adapter: r }));
3676
+ for (const s of this.adapters) {
3677
+ const r = s.findChoices(e);
3678
+ for (const o of r)
3679
+ n.has(o) || (n.add(o), i.push({ choice: o, adapter: s }));
3500
3680
  }
3501
3681
  return i;
3502
3682
  }
@@ -3507,7 +3687,7 @@ class Ts {
3507
3687
  this.adapters.push(e), this.adapters.sort((i, n) => n.priority - i.priority);
3508
3688
  }
3509
3689
  }
3510
- class Ss {
3690
+ const C = class C {
3511
3691
  constructor() {
3512
3692
  f(this, "name", "mask");
3513
3693
  f(this, "highlights", /* @__PURE__ */ new Map());
@@ -3515,10 +3695,9 @@ class Ss {
3515
3695
  f(this, "fallbackContainers", /* @__PURE__ */ new Map());
3516
3696
  }
3517
3697
  initialize() {
3518
- this.injectCSS();
3519
3698
  }
3520
3699
  destroy() {
3521
- this.clearAll(), this.removeCSS();
3700
+ this.clearAll();
3522
3701
  }
3523
3702
  apply(e, i) {
3524
3703
  if (!this.isSupported()) {
@@ -3527,14 +3706,17 @@ class Ss {
3527
3706
  }
3528
3707
  this.injectHighlightCSS(e);
3529
3708
  const n = new Highlight(i);
3530
- CSS.highlights.set(`answer-masked-${e}`, n), this.highlights.set(e, n), this.ranges.set(e, i), this.addAriaAttributes(i);
3709
+ CSS.highlights.set(
3710
+ `${C.HIGHLIGHT_NAME_PREFIX}${e}`,
3711
+ n
3712
+ ), this.highlights.set(e, n), this.ranges.set(e, i), this.addAriaAttributes(i);
3531
3713
  }
3532
3714
  remove(e) {
3533
3715
  if (!this.isSupported()) {
3534
3716
  this.removeFallback(e);
3535
3717
  return;
3536
3718
  }
3537
- CSS.highlights.delete(`answer-masked-${e}`), this.removeHighlightCSS(e);
3719
+ CSS.highlights.delete(`${C.HIGHLIGHT_NAME_PREFIX}${e}`), this.removeHighlightCSS(e);
3538
3720
  const i = this.ranges.get(e);
3539
3721
  i && this.removeAriaAttributes(i), this.highlights.delete(e), this.ranges.delete(e), this.fallbackContainers.delete(e);
3540
3722
  }
@@ -3552,47 +3734,32 @@ class Ss {
3552
3734
  isSupported() {
3553
3735
  return typeof CSS < "u" && "highlights" in CSS;
3554
3736
  }
3555
- injectCSS() {
3556
- const e = "answer-eliminator-mask-styles";
3557
- if (document.getElementById(e)) return;
3558
- const i = document.createElement("style");
3559
- i.id = e, i.textContent = `
3560
- /* Fallback */
3561
- .answer-masked-fallback {
3562
- opacity: 0.2;
3563
- filter: blur(2px);
3564
- }
3565
- `, document.head.appendChild(i);
3566
- }
3567
3737
  injectHighlightCSS(e) {
3568
- const i = `answer-eliminator-mask-highlight-${e}`;
3738
+ const i = `${C.HIGHLIGHT_STYLE_PREFIX}${e}`;
3569
3739
  if (document.getElementById(i)) return;
3570
3740
  const n = document.createElement("style");
3571
3741
  n.id = i, n.textContent = `
3572
- ::highlight(answer-masked-${e}) {
3742
+ ::highlight(pie-answer-masked-${e}) {
3573
3743
  opacity: 0.2;
3574
3744
  filter: blur(2px);
3575
3745
  }
3576
3746
  `, document.head.appendChild(n);
3577
3747
  }
3578
3748
  removeHighlightCSS(e) {
3579
- document.getElementById(`answer-eliminator-mask-highlight-${e}`)?.remove();
3580
- }
3581
- removeCSS() {
3582
- document.getElementById("answer-eliminator-mask-styles")?.remove();
3749
+ document.getElementById(`${C.HIGHLIGHT_STYLE_PREFIX}${e}`)?.remove();
3583
3750
  }
3584
3751
  addAriaAttributes(e) {
3585
3752
  const i = this.findChoiceContainer(e);
3586
- i && (i.setAttribute("data-eliminated", "true"), i.setAttribute("aria-hidden", "true"));
3753
+ i && (i.setAttribute(C.ELIMINATED_ATTR, "true"), i.setAttribute("aria-hidden", "true"));
3587
3754
  }
3588
3755
  removeAriaAttributes(e) {
3589
3756
  const i = this.findChoiceContainer(e);
3590
- i && (i.removeAttribute("data-eliminated"), i.removeAttribute("aria-hidden"));
3757
+ i && (i.removeAttribute(C.ELIMINATED_ATTR), i.removeAttribute("aria-hidden"));
3591
3758
  }
3592
3759
  findChoiceContainer(e) {
3593
3760
  let i = e.startContainer;
3594
3761
  for (i.nodeType === Node.TEXT_NODE && (i = i.parentElement); i && i !== document.body; ) {
3595
- if (i.classList?.contains("choice-input"))
3762
+ if (i.getAttribute(C.CHOICE_HOOK_ATTR) === "true")
3596
3763
  return i;
3597
3764
  i = i.parentElement;
3598
3765
  }
@@ -3600,17 +3767,19 @@ class Ss {
3600
3767
  }
3601
3768
  applyFallback(e, i) {
3602
3769
  const n = this.findChoiceContainer(i);
3603
- n && (n.classList.add("answer-masked-fallback"), n.setAttribute("data-eliminated", "true"), n.setAttribute("data-eliminated-id", e), this.fallbackContainers.set(e, n), this.addAriaAttributes(i));
3770
+ n && (n.classList.add(C.FALLBACK_CLASS), n.setAttribute(C.ELIMINATED_ATTR, "true"), n.setAttribute(C.ELIMINATED_ID_ATTR, e), this.fallbackContainers.set(e, n), this.addAriaAttributes(i));
3604
3771
  }
3605
3772
  removeFallback(e) {
3606
3773
  const i = this.fallbackContainers.get(e);
3607
3774
  if (!i) return;
3608
- i.classList.remove("answer-masked-fallback"), i.removeAttribute("data-eliminated"), i.removeAttribute("data-eliminated-id");
3775
+ i.classList.remove(C.FALLBACK_CLASS), i.removeAttribute(C.ELIMINATED_ATTR), i.removeAttribute(C.ELIMINATED_ID_ATTR);
3609
3776
  const n = document.createRange();
3610
3777
  n.selectNodeContents(i), this.removeAriaAttributes(n), this.fallbackContainers.delete(e);
3611
3778
  }
3612
- }
3613
- class As {
3779
+ };
3780
+ f(C, "HIGHLIGHT_STYLE_PREFIX", "pie-answer-eliminator-mask-highlight-"), f(C, "HIGHLIGHT_NAME_PREFIX", "pie-answer-masked-"), f(C, "FALLBACK_CLASS", "pie-answer-masked-fallback"), f(C, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice"), f(C, "ELIMINATED_ATTR", "data-pie-answer-eliminated"), f(C, "ELIMINATED_ID_ATTR", "data-pie-answer-eliminated-id");
3781
+ let Ut = C;
3782
+ const w = class w {
3614
3783
  constructor() {
3615
3784
  f(this, "name", "strikethrough");
3616
3785
  f(this, "highlights", /* @__PURE__ */ new Map());
@@ -3618,14 +3787,10 @@ class As {
3618
3787
  f(this, "fallbackContainers", /* @__PURE__ */ new Map());
3619
3788
  }
3620
3789
  initialize() {
3621
- if (!this.isSupported()) {
3622
- console.warn("CSS Custom Highlight API not supported, using fallback");
3623
- return;
3624
- }
3625
- this.injectCSS();
3790
+ this.isSupported() || console.warn("CSS Custom Highlight API not supported, using fallback");
3626
3791
  }
3627
3792
  destroy() {
3628
- this.clearAll(), this.removeCSS();
3793
+ this.clearAll();
3629
3794
  }
3630
3795
  apply(e, i) {
3631
3796
  if (!this.isSupported()) {
@@ -3634,14 +3799,19 @@ class As {
3634
3799
  }
3635
3800
  this.injectHighlightCSS(e);
3636
3801
  const n = new Highlight(i);
3637
- CSS.highlights.set(`answer-eliminated-${e}`, n), this.highlights.set(e, n), this.ranges.set(e, i), this.addAriaAttributes(i);
3802
+ CSS.highlights.set(
3803
+ `${w.HIGHLIGHT_NAME_PREFIX}${e}`,
3804
+ n
3805
+ ), this.highlights.set(e, n), this.ranges.set(e, i), this.addAriaAttributes(i);
3638
3806
  }
3639
3807
  remove(e) {
3640
3808
  if (!this.isSupported()) {
3641
3809
  this.removeFallback(e);
3642
3810
  return;
3643
3811
  }
3644
- CSS.highlights.delete(`answer-eliminated-${e}`), this.removeHighlightCSS(e);
3812
+ CSS.highlights.delete(
3813
+ `${w.HIGHLIGHT_NAME_PREFIX}${e}`
3814
+ ), this.removeHighlightCSS(e);
3645
3815
  const i = this.ranges.get(e);
3646
3816
  i && this.removeAriaAttributes(i), this.highlights.delete(e), this.ranges.delete(e), this.fallbackContainers.delete(e);
3647
3817
  }
@@ -3659,35 +3829,12 @@ class As {
3659
3829
  isSupported() {
3660
3830
  return typeof CSS < "u" && "highlights" in CSS;
3661
3831
  }
3662
- injectCSS() {
3663
- const e = "answer-eliminator-strikethrough-styles";
3664
- if (document.getElementById(e)) return;
3665
- const i = document.createElement("style");
3666
- i.id = e, i.textContent = `
3667
- /* Fallback for browsers without CSS Highlight API */
3668
- .answer-eliminated-fallback {
3669
- text-decoration: line-through;
3670
- text-decoration-thickness: 2px;
3671
- text-decoration-color: var(--pie-incorrect, #ff9800);
3672
- opacity: 0.6;
3673
- }
3674
-
3675
- /* Screen reader only text */
3676
- .sr-announcement {
3677
- position: absolute;
3678
- left: -10000px;
3679
- width: 1px;
3680
- height: 1px;
3681
- overflow: hidden;
3682
- }
3683
- `, document.head.appendChild(i);
3684
- }
3685
3832
  injectHighlightCSS(e) {
3686
- const i = `answer-eliminator-highlight-${e}`;
3833
+ const i = `${w.HIGHLIGHT_STYLE_PREFIX}${e}`;
3687
3834
  if (document.getElementById(i)) return;
3688
3835
  const n = document.createElement("style");
3689
3836
  n.id = i, n.textContent = `
3690
- ::highlight(answer-eliminated-${e}) {
3837
+ ::highlight(pie-answer-eliminated-${e}) {
3691
3838
  text-decoration: line-through;
3692
3839
  text-decoration-thickness: 2px;
3693
3840
  text-decoration-color: var(--pie-incorrect, #ff9800);
@@ -3696,32 +3843,31 @@ class As {
3696
3843
  `, document.head.appendChild(n);
3697
3844
  }
3698
3845
  removeHighlightCSS(e) {
3699
- document.getElementById(`answer-eliminator-highlight-${e}`)?.remove();
3700
- }
3701
- removeCSS() {
3702
3846
  document.getElementById(
3703
- "answer-eliminator-strikethrough-styles"
3847
+ `${w.HIGHLIGHT_STYLE_PREFIX}${e}`
3704
3848
  )?.remove();
3705
3849
  }
3706
3850
  addAriaAttributes(e) {
3707
3851
  const i = this.findChoiceContainer(e);
3708
3852
  if (!i) return;
3709
- i.setAttribute("data-eliminated", "true"), i.setAttribute("aria-disabled", "true");
3710
- const n = i.querySelector(".label");
3711
- if (n && !n.querySelector(".sr-announcement")) {
3712
- const r = document.createElement("span");
3713
- r.className = "sr-announcement", r.textContent = " (eliminated)", n.appendChild(r);
3853
+ i.setAttribute(w.ELIMINATED_ATTR, "true"), i.setAttribute("aria-disabled", "true");
3854
+ const n = this.resolveLabelElement(i);
3855
+ if (n && !n.querySelector(`.${w.SR_CLASS}`)) {
3856
+ const s = document.createElement("span");
3857
+ s.className = w.SR_CLASS, s.textContent = " (eliminated)", n.appendChild(s);
3714
3858
  }
3715
3859
  }
3716
3860
  removeAriaAttributes(e) {
3717
3861
  const i = this.findChoiceContainer(e);
3718
3862
  if (!i) return;
3719
- i.removeAttribute("data-eliminated"), i.removeAttribute("aria-disabled"), i.querySelector(".sr-announcement")?.remove();
3863
+ i.removeAttribute(w.ELIMINATED_ATTR), i.removeAttribute("aria-disabled"), i.querySelector(
3864
+ `.${w.SR_CLASS}`
3865
+ )?.remove();
3720
3866
  }
3721
3867
  findChoiceContainer(e) {
3722
3868
  let i = e.startContainer;
3723
3869
  for (i.nodeType === Node.TEXT_NODE && (i = i.parentElement); i && i !== document.body; ) {
3724
- if (i.classList?.contains("choice-input") || i.classList?.contains("corespring-checkbox") || i.classList?.contains("corespring-radio-button"))
3870
+ if (i.getAttribute(w.CHOICE_HOOK_ATTR) === "true")
3725
3871
  return i;
3726
3872
  i = i.parentElement;
3727
3873
  }
@@ -3730,17 +3876,24 @@ class As {
3730
3876
  // Fallback for browsers without CSS Highlight API
3731
3877
  applyFallback(e, i) {
3732
3878
  const n = this.findChoiceContainer(i);
3733
- n && (n.classList.add("answer-eliminated-fallback"), n.setAttribute("data-eliminated", "true"), n.setAttribute("data-eliminated-id", e), this.fallbackContainers.set(e, n), this.addAriaAttributes(i));
3879
+ n && (n.classList.add(w.FALLBACK_CLASS), n.setAttribute(w.ELIMINATED_ATTR, "true"), n.setAttribute(w.ELIMINATED_ID_ATTR, e), this.fallbackContainers.set(e, n), this.addAriaAttributes(i));
3734
3880
  }
3735
3881
  removeFallback(e) {
3736
3882
  const i = this.fallbackContainers.get(e);
3737
3883
  if (!i) return;
3738
- i.classList.remove("answer-eliminated-fallback"), i.removeAttribute("data-eliminated"), i.removeAttribute("data-eliminated-id");
3884
+ i.classList.remove(w.FALLBACK_CLASS), i.removeAttribute(w.ELIMINATED_ATTR), i.removeAttribute(w.ELIMINATED_ID_ATTR);
3739
3885
  const n = document.createRange();
3740
3886
  n.selectNodeContents(i), this.removeAriaAttributes(n), this.fallbackContainers.delete(e);
3741
3887
  }
3742
- }
3743
- class Is {
3888
+ resolveLabelElement(e) {
3889
+ return e.querySelector(
3890
+ `[${w.LABEL_HOOK_ATTR}="true"]`
3891
+ ) || e.querySelector("label");
3892
+ }
3893
+ };
3894
+ f(w, "HIGHLIGHT_STYLE_PREFIX", "pie-answer-eliminator-highlight-"), f(w, "HIGHLIGHT_NAME_PREFIX", "pie-answer-eliminated-"), f(w, "FALLBACK_CLASS", "pie-answer-eliminator-eliminated-fallback"), f(w, "SR_CLASS", "pie-answer-eliminator-sr-announcement"), f(w, "CHOICE_HOOK_ATTR", "data-pie-answer-eliminator-choice"), f(w, "LABEL_HOOK_ATTR", "data-pie-answer-eliminator-label"), f(w, "ELIMINATED_ATTR", "data-pie-answer-eliminated"), f(w, "ELIMINATED_ID_ATTR", "data-pie-answer-eliminated-id");
3895
+ let xt = w;
3896
+ const Te = class Te {
3744
3897
  constructor(e = "strikethrough", i = "right") {
3745
3898
  f(this, "registry");
3746
3899
  f(this, "strategy");
@@ -3757,10 +3910,10 @@ class Is {
3757
3910
  // Whether to restore eliminations from state storage
3758
3911
  // Store integration (replaces session/localStorage)
3759
3912
  f(this, "storeIntegration", null);
3760
- this.registry = new Ts(), this.strategy = this.createStrategy(e), this.strategy.initialize(), this.buttonAlignment = i;
3913
+ this.registry = new kr(), this.strategy = this.createStrategy(e), this.strategy.initialize(), this.buttonAlignment = i;
3761
3914
  }
3762
3915
  createStrategy(e) {
3763
- return e === "mask" ? new Ss() : new As();
3916
+ return e === "mask" ? new Ut() : new xt();
3764
3917
  }
3765
3918
  /**
3766
3919
  * Initialize eliminator for a question
@@ -3768,8 +3921,8 @@ class Is {
3768
3921
  initializeForQuestion(e) {
3769
3922
  this.cleanupButtons();
3770
3923
  const i = this.registry.findAllChoicesWithAdapters(e);
3771
- for (const { choice: n, adapter: r } of i)
3772
- this.initializeChoice(n, r);
3924
+ for (const { choice: n, adapter: s } of i)
3925
+ this.initializeChoice(n, s);
3773
3926
  this.shouldRestoreState && this.restoreState();
3774
3927
  }
3775
3928
  /**
@@ -3778,40 +3931,20 @@ class Is {
3778
3931
  initializeChoice(e, i) {
3779
3932
  const n = i.getChoiceId(e);
3780
3933
  this.choiceElements.set(n, e), this.choiceAdapters.set(n, i);
3781
- const r = this.createToggleButton(e, i);
3782
- if (!r) return;
3783
- this.choiceButtons.set(n, r);
3784
- const s = i.getButtonContainer(e);
3785
- s && (s.style.position = "relative", s.appendChild(r));
3934
+ const s = this.createToggleButton(e, i);
3935
+ if (!s) return;
3936
+ this.choiceButtons.set(n, s);
3937
+ const r = i.getButtonContainer(e);
3938
+ r && (r.style.position = "relative", r.appendChild(s));
3786
3939
  }
3787
3940
  /**
3788
3941
  * Create elimination toggle button
3789
3942
  */
3790
3943
  createToggleButton(e, i) {
3791
- const n = i.getChoiceId(e), r = i.getChoiceLabel(e), s = document.createElement("button");
3792
- return s.type = "button", s.className = "answer-eliminator-toggle", s.setAttribute("aria-label", `Toggle elimination for ${r}`), s.setAttribute("data-choice-id", n), s.textContent = "⊗", this.applyButtonAlignment(s), Object.assign(s.style, {
3793
- width: "28px",
3794
- height: "28px",
3795
- padding: "0",
3796
- border: "1px solid #ccc",
3797
- borderRadius: "4px",
3798
- background: "white",
3799
- cursor: "pointer",
3800
- fontSize: "18px",
3801
- lineHeight: "1",
3802
- display: "flex",
3803
- alignItems: "center",
3804
- justifyContent: "center",
3805
- color: "#666",
3806
- transition: "all 0.2s ease",
3807
- zIndex: "10"
3808
- }), s.addEventListener("mouseenter", () => {
3809
- s.style.background = "#f0f0f0", s.style.borderColor = "#999", s.style.color = "#333";
3810
- }), s.addEventListener("mouseleave", () => {
3811
- this.strategy.isEliminated(n) || (s.style.background = "white", s.style.borderColor = "#ccc", s.style.color = "#666");
3812
- }), s.addEventListener("click", (o) => {
3944
+ const n = i.getChoiceId(e), s = i.getChoiceLabel(e), r = document.createElement("button");
3945
+ return r.type = "button", r.className = Te.TOGGLE_CLASS, r.setAttribute("aria-label", `Toggle elimination for ${s}`), r.setAttribute("data-choice-id", n), r.textContent = "⊗", this.applyButtonAlignment(r), r.addEventListener("click", (o) => {
3813
3946
  o.preventDefault(), o.stopPropagation(), this.toggleElimination(e, i);
3814
- }), s;
3947
+ }), r;
3815
3948
  }
3816
3949
  /**
3817
3950
  * Toggle elimination for a choice
@@ -3835,14 +3968,14 @@ class Is {
3835
3968
  * Eliminate a choice
3836
3969
  */
3837
3970
  eliminateChoice(e, i) {
3838
- const n = i.getChoiceId(e), r = i.createChoiceRange(e);
3839
- if (!r) {
3971
+ const n = i.getChoiceId(e), s = i.createChoiceRange(e);
3972
+ if (!s) {
3840
3973
  console.error("Failed to create range for choice");
3841
3974
  return;
3842
3975
  }
3843
- this.strategy.apply(n, r), this.eliminatedChoices.add(n);
3844
- const s = this.choiceButtons.get(n);
3845
- s && (s.classList.add("active"), s.setAttribute("aria-pressed", "true"), s.style.background = "#ff9800", s.style.borderColor = "#ff9800", s.style.color = "white"), this.saveState();
3976
+ this.strategy.apply(n, s), this.eliminatedChoices.add(n);
3977
+ const r = this.choiceButtons.get(n);
3978
+ r && (r.classList.add(Te.TOGGLE_ACTIVE_CLASS), r.setAttribute("aria-pressed", "true")), this.saveState();
3846
3979
  }
3847
3980
  /**
3848
3981
  * Restore a choice
@@ -3850,7 +3983,7 @@ class Is {
3850
3983
  restoreChoice(e) {
3851
3984
  this.strategy.remove(e), this.eliminatedChoices.delete(e);
3852
3985
  const i = this.choiceButtons.get(e);
3853
- i && (i.classList.remove("active"), i.setAttribute("aria-pressed", "false"), i.style.background = "white", i.style.borderColor = "#ccc", i.style.color = "#666"), this.saveState();
3986
+ i && (i.classList.remove(Te.TOGGLE_ACTIVE_CLASS), i.setAttribute("aria-pressed", "false")), this.saveState();
3854
3987
  }
3855
3988
  /**
3856
3989
  * Reset all eliminations for current element
@@ -3904,15 +4037,15 @@ class Is {
3904
4037
  const i = e.eliminatedChoices;
3905
4038
  if (!i || i.length === 0) return;
3906
4039
  for (const n of i) {
3907
- const r = this.choiceElements.get(n);
3908
- if (!r) continue;
3909
- const s = this.choiceAdapters.get(n);
4040
+ const s = this.choiceElements.get(n);
3910
4041
  if (!s) continue;
3911
- const o = s.createChoiceRange(r);
4042
+ const r = this.choiceAdapters.get(n);
4043
+ if (!r) continue;
4044
+ const o = r.createChoiceRange(s);
3912
4045
  if (o) {
3913
4046
  this.strategy.apply(n, o), this.eliminatedChoices.add(n);
3914
4047
  const l = this.choiceButtons.get(n);
3915
- l && (l.classList.add("active"), l.setAttribute("aria-pressed", "true"), l.style.background = "#ff9800", l.style.borderColor = "#ff9800", l.style.color = "white");
4048
+ l && (l.classList.add(Te.TOGGLE_ACTIVE_CLASS), l.setAttribute("aria-pressed", "true"));
3916
4049
  }
3917
4050
  }
3918
4051
  } catch (i) {
@@ -3985,145 +4118,147 @@ class Is {
3985
4118
  destroy() {
3986
4119
  this.cleanupButtons(), this.strategy.destroy();
3987
4120
  }
3988
- }
3989
- var Es = /* @__PURE__ */ Cr('<div style="display: none;" aria-hidden="true"></div>');
3990
- function $s(t, e) {
3991
- Ii(e, !0);
3992
- let i = ve(e, "visible", 7, !1), n = ve(e, "toolId", 7, "answerEliminator"), r = ve(e, "strategy", 7, "strikethrough"), s = ve(
4121
+ };
4122
+ f(Te, "TOGGLE_CLASS", "pie-answer-eliminator-toggle"), f(Te, "TOGGLE_ACTIVE_CLASS", "pie-answer-eliminator-toggle--active");
4123
+ let Xt = Te;
4124
+ var Hr = /* @__PURE__ */ Vs('<div style="display: none;" aria-hidden="true"></div>');
4125
+ function Nr(t, e) {
4126
+ Hi(e, !0);
4127
+ let i = ye(e, "visible", 7, !1), n = ye(e, "toolId", 7, "answerEliminator"), s = ye(e, "strategy", 7, "strikethrough"), r = ye(
3993
4128
  e,
3994
4129
  "alwaysOn",
3995
4130
  7,
3996
4131
  !1
3997
4132
  // Set true for profile-based accommodation
3998
- ), o = ve(
4133
+ ), o = ye(
3999
4134
  e,
4000
4135
  "buttonAlignment",
4001
4136
  7,
4002
4137
  "right"
4003
4138
  // Button placement: left, right, or inline with checkbox
4004
- ), l = ve(
4139
+ ), l = ye(
4005
4140
  e,
4006
4141
  "scopeElement",
4007
4142
  7,
4008
4143
  null
4009
4144
  // Container element to limit DOM queries (for multi-item pages)
4010
- ), a = ve(
4145
+ ), a = ye(
4011
4146
  e,
4012
4147
  "elementToolStateStore",
4013
4148
  7,
4014
4149
  null
4015
4150
  // ElementToolStateStore instance
4016
- ), u = ve(
4151
+ ), u = ye(
4017
4152
  e,
4018
4153
  "globalElementId",
4019
4154
  7,
4020
4155
  ""
4021
4156
  // Composite key: "assessmentId:sectionId:itemId:elementId"
4022
- ), d = /* @__PURE__ */ N(null), m = /* @__PURE__ */ N(null), p = /* @__PURE__ */ N(null);
4023
- const y = /* @__PURE__ */ ni(() => g(m)?.toolCoordinator);
4024
- let h = /* @__PURE__ */ N(null), E = /* @__PURE__ */ N(null), _ = /* @__PURE__ */ N(null), F = /* @__PURE__ */ N(null), W = /* @__PURE__ */ ni(() => s() || i());
4025
- Ie(() => {
4026
- if (g(d))
4027
- return Gr(g(d), (T) => {
4028
- A(m, T, !0);
4157
+ ), d = /* @__PURE__ */ P(null), v = /* @__PURE__ */ P(null), p = /* @__PURE__ */ P(null);
4158
+ const g = /* @__PURE__ */ fi(() => m(v)?.toolCoordinator);
4159
+ let h = /* @__PURE__ */ P(null), T = /* @__PURE__ */ P(null), b = /* @__PURE__ */ P(null), S = /* @__PURE__ */ P(null), L = /* @__PURE__ */ fi(() => r() || i());
4160
+ Le(() => {
4161
+ if (m(d))
4162
+ return Js(m(d), (I) => {
4163
+ $(v, I, !0);
4029
4164
  });
4030
- }), Ie(() => {
4031
- if (g(d))
4032
- return Ur(g(d), (T) => {
4033
- A(p, T, !0);
4165
+ }), Le(() => {
4166
+ if (m(d))
4167
+ return Zs(m(d), (I) => {
4168
+ $(p, I, !0);
4034
4169
  });
4035
4170
  });
4036
- function _n() {
4037
- return l() || g(p)?.scopeElement || null;
4171
+ function $n() {
4172
+ return l() || m(p)?.scopeElement || null;
4038
4173
  }
4039
- function $t() {
4040
- if (!g(W) || !g(h)) return;
4041
- const T = _n();
4042
- if (!T) {
4174
+ function kt() {
4175
+ if (!m(L) || !m(h)) return;
4176
+ const I = $n();
4177
+ if (!I) {
4043
4178
  console.warn("[AnswerEliminator] Missing shell scope context for question root");
4044
4179
  return;
4045
4180
  }
4046
- g(h).initializeForQuestion(T);
4181
+ m(h).initializeForQuestion(I);
4047
4182
  }
4048
- function wn() {
4183
+ function Cn() {
4049
4184
  requestAnimationFrame(() => {
4050
4185
  requestAnimationFrame(() => {
4051
- $t();
4186
+ kt();
4052
4187
  });
4053
4188
  });
4054
4189
  }
4055
- Ie(() => {
4056
- !g(y) || !n() || (g(F) && g(_) && (g(F) !== g(y) || g(_) !== n()) && (g(F).unregisterTool(g(_)), A(F, null), A(_, null)), g(_) || (g(y).registerTool(n(), "Answer Eliminator", void 0, Bt.MODAL), A(F, g(y), !0), A(_, n())));
4057
- }), Ie(() => {
4058
- g(h) && a() && u() && g(h).setStoreIntegration(a(), u());
4059
- }), Vr(() => (A(h, new Is(r(), o()), !0), g(h) && a() && u() && g(h).setStoreIntegration(a(), u()), g(W) ? $t() : g(h).cleanup(), () => {
4060
- g(h)?.destroy(), A(h, null), g(F) && g(_) && (g(F).unregisterTool(g(_)), A(F, null), A(_, null));
4061
- })), Ie(() => {
4062
- const T = g(p)?.contextVersion ?? null;
4063
- if (T !== null) {
4064
- if (g(E) === null) {
4065
- A(E, T, !0);
4190
+ Le(() => {
4191
+ !m(g) || !n() || (m(S) && m(b) && (m(S) !== m(g) || m(b) !== n()) && (m(S).unregisterTool(m(b)), $(S, null), $(b, null)), m(b) || (m(g).registerTool(n(), "Answer Eliminator", void 0, Yt.MODAL), $(S, m(g), !0), $(b, n())));
4192
+ }), Le(() => {
4193
+ m(h) && a() && u() && m(h).setStoreIntegration(a(), u());
4194
+ }), Bs(() => ($(h, new Xt(s(), o()), !0), m(h) && a() && u() && m(h).setStoreIntegration(a(), u()), m(L) ? kt() : m(h).cleanup(), () => {
4195
+ m(h)?.destroy(), $(h, null), m(S) && m(b) && (m(S).unregisterTool(m(b)), $(S, null), $(b, null));
4196
+ })), Le(() => {
4197
+ const I = m(p)?.contextVersion ?? null;
4198
+ if (I !== null) {
4199
+ if (m(T) === null) {
4200
+ $(T, I, !0);
4066
4201
  return;
4067
4202
  }
4068
- T !== g(E) && (A(E, T, !0), wn());
4203
+ I !== m(T) && ($(T, I, !0), Cn());
4069
4204
  }
4070
- }), Ie(() => {
4071
- g(h) && (g(W) ? (g(h).enableStateRestoration(), $t()) : g(h).cleanup());
4205
+ }), Le(() => {
4206
+ m(h) && (m(L) ? (m(h).enableStateRestoration(), kt()) : m(h).cleanup());
4072
4207
  });
4073
- var Tn = {
4208
+ var Ln = {
4074
4209
  get visible() {
4075
4210
  return i();
4076
4211
  },
4077
- set visible(T = !1) {
4078
- i(T), le();
4212
+ set visible(I = !1) {
4213
+ i(I), ue();
4079
4214
  },
4080
4215
  get toolId() {
4081
4216
  return n();
4082
4217
  },
4083
- set toolId(T = "answerEliminator") {
4084
- n(T), le();
4218
+ set toolId(I = "answerEliminator") {
4219
+ n(I), ue();
4085
4220
  },
4086
4221
  get strategy() {
4087
- return r();
4222
+ return s();
4088
4223
  },
4089
- set strategy(T = "strikethrough") {
4090
- r(T), le();
4224
+ set strategy(I = "strikethrough") {
4225
+ s(I), ue();
4091
4226
  },
4092
4227
  get alwaysOn() {
4093
- return s();
4228
+ return r();
4094
4229
  },
4095
- set alwaysOn(T = !1) {
4096
- s(T), le();
4230
+ set alwaysOn(I = !1) {
4231
+ r(I), ue();
4097
4232
  },
4098
4233
  get buttonAlignment() {
4099
4234
  return o();
4100
4235
  },
4101
- set buttonAlignment(T = "right") {
4102
- o(T), le();
4236
+ set buttonAlignment(I = "right") {
4237
+ o(I), ue();
4103
4238
  },
4104
4239
  get scopeElement() {
4105
4240
  return l();
4106
4241
  },
4107
- set scopeElement(T = null) {
4108
- l(T), le();
4242
+ set scopeElement(I = null) {
4243
+ l(I), ue();
4109
4244
  },
4110
4245
  get elementToolStateStore() {
4111
4246
  return a();
4112
4247
  },
4113
- set elementToolStateStore(T = null) {
4114
- a(T), le();
4248
+ set elementToolStateStore(I = null) {
4249
+ a(I), ue();
4115
4250
  },
4116
4251
  get globalElementId() {
4117
4252
  return u();
4118
4253
  },
4119
- set globalElementId(T = "") {
4120
- u(T), le();
4254
+ set globalElementId(I = "") {
4255
+ u(I), ue();
4121
4256
  }
4122
- }, Xt = Es();
4123
- return Nr(Xt, (T) => A(d, T), () => g(d)), un(t, Xt), Ei(Tn);
4257
+ }, oi = Hr();
4258
+ return Gs(oi, (I) => $(d, I), () => m(d)), bn(t, oi), Ni(Ln);
4124
4259
  }
4125
- customElements.define("pie-tool-answer-eliminator", Pr(
4126
- $s,
4260
+ customElements.define("pie-tool-answer-eliminator", zs(
4261
+ Nr,
4127
4262
  {
4128
4263
  visible: { attribute: "visible", type: "Boolean" },
4129
4264
  toolId: { attribute: "tool-id", type: "String" },
@@ -4139,5 +4274,5 @@ customElements.define("pie-tool-answer-eliminator", Pr(
4139
4274
  { mode: "open" }
4140
4275
  ));
4141
4276
  export {
4142
- $s as default
4277
+ Nr as default
4143
4278
  };