@reddb-io/ui 0.3.0 → 0.3.1

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.
Files changed (96) hide show
  1. package/build/_app/immutable/assets/0.DgbuWrJy.css +1 -0
  2. package/build/_app/immutable/assets/AnalyticsView.BLAJezw4.css +1 -0
  3. package/build/_app/immutable/assets/{Workspace.CvP5De7i.css → Workspace.DM2E1WiF.css} +1 -1
  4. package/build/_app/immutable/chunks/85-Fh5Zp.js +404 -0
  5. package/build/_app/immutable/chunks/{C9rXzYLu.js → 8zg2gJwV.js} +1 -1
  6. package/build/_app/immutable/chunks/B5euRbKa.js +1 -0
  7. package/build/_app/immutable/chunks/BRIMmWzq.js +1 -0
  8. package/build/_app/immutable/chunks/BgOTHNR5.js +1 -0
  9. package/build/_app/immutable/chunks/Bq4DTWK2.js +2 -0
  10. package/build/_app/immutable/chunks/Btd6PFkC.js +1 -0
  11. package/build/_app/immutable/chunks/CGFL56WJ.js +1 -0
  12. package/build/_app/immutable/chunks/CJFJ501n.js +18 -0
  13. package/build/_app/immutable/chunks/CLBx21Hz.js +2 -0
  14. package/build/_app/immutable/chunks/CnD4hwxC.js +1106 -0
  15. package/build/_app/immutable/chunks/DCJ0QyYH.js +1 -0
  16. package/build/_app/immutable/chunks/DQCYUNtS.js +1 -0
  17. package/build/_app/immutable/chunks/DRlh90Cv.js +1 -0
  18. package/build/_app/immutable/chunks/{C278awGv.js → DV9PDoM3.js} +1 -1
  19. package/build/_app/immutable/entry/app.BDog2y0J.js +2 -0
  20. package/build/_app/immutable/entry/start.D1J45dq5.js +1 -0
  21. package/build/_app/immutable/nodes/0.BTrC4th2.js +1 -0
  22. package/build/_app/immutable/nodes/1.Ds1Tbjsm.js +1 -0
  23. package/build/_app/immutable/nodes/10.D_FCLs0Z.js +96 -0
  24. package/build/_app/immutable/nodes/12.DPE6v6Zf.js +3 -0
  25. package/build/_app/immutable/nodes/14.CAG5_cGP.js +1 -0
  26. package/build/_app/immutable/nodes/15.CcJlZGxa.js +60 -0
  27. package/build/_app/immutable/nodes/8.CAG5_cGP.js +1 -0
  28. package/build/_app/version.json +1 -1
  29. package/build/index.html +18 -15
  30. package/dist/embed/AnalyticsView-D8z1Nsed.js +23337 -0
  31. package/dist/embed/AnalyticsView-D8z1Nsed.js.map +1 -0
  32. package/dist/embed/RedUiEmbedRoot-CtqTd_FG.js +31302 -0
  33. package/dist/embed/RedUiEmbedRoot-CtqTd_FG.js.map +1 -0
  34. package/dist/embed/index-0hA141D2.js +85 -0
  35. package/dist/embed/index-0hA141D2.js.map +1 -0
  36. package/dist/embed/index-client-BeiP-va5.js +3303 -0
  37. package/dist/embed/index-client-BeiP-va5.js.map +1 -0
  38. package/dist/embed/index-w1Qo_uW0.js +677 -0
  39. package/dist/embed/index-w1Qo_uW0.js.map +1 -0
  40. package/dist/embed/index.js +1 -1
  41. package/dist/embed/{sigma.esm-D5yoExsH.js → sigma.esm-qqKBpvin.js} +2 -2
  42. package/dist/embed/{sigma.esm-D5yoExsH.js.map → sigma.esm-qqKBpvin.js.map} +1 -1
  43. package/package.json +5 -3
  44. package/src/app.css +86 -20
  45. package/src/lib/AnalyticsView.svelte +209 -0
  46. package/src/lib/AskView.svelte +255 -0
  47. package/src/lib/ClusterView.svelte +415 -95
  48. package/src/lib/CommandPalette.svelte +2 -0
  49. package/src/lib/GlobalProgressBar.svelte +9 -0
  50. package/src/lib/MetricChart.svelte +85 -0
  51. package/src/lib/QueryEditor.svelte +48 -7
  52. package/src/lib/ResultsPane.svelte +76 -8
  53. package/src/lib/SchemaTree.svelte +25 -1
  54. package/src/lib/SecurityView.svelte +176 -65
  55. package/src/lib/SettingsView.svelte +1111 -254
  56. package/src/lib/Topbar.svelte +29 -1
  57. package/src/lib/Workspace.svelte +18 -3
  58. package/src/lib/activity.svelte.ts +44 -35
  59. package/src/lib/collection-preview.ts +14 -0
  60. package/src/lib/connections.svelte.ts +73 -4
  61. package/src/lib/index.ts +3 -0
  62. package/src/lib/permission-gate.ts +120 -0
  63. package/src/lib/policies.ts +136 -0
  64. package/src/lib/query-tabs.svelte.ts +132 -53
  65. package/src/lib/reddb/analytics.ts +208 -0
  66. package/src/lib/reddb/ask.ts +123 -0
  67. package/src/lib/reddb/client.ts +159 -58
  68. package/src/lib/reddb/cluster-status.ts +306 -0
  69. package/src/lib/reddb/index.ts +3 -0
  70. package/src/lib/reddb/local-url-provider.ts +32 -1
  71. package/src/lib/reddb/redwire-ws-spike.ts +590 -0
  72. package/src/lib/router.svelte.ts +12 -0
  73. package/src/lib/settings-authoring-client.ts +336 -0
  74. package/src/lib/settings-sections.ts +292 -196
  75. package/build/_app/immutable/assets/0.DQDLkSdR.css +0 -1
  76. package/build/_app/immutable/chunks/65XjEwaF.js +0 -367
  77. package/build/_app/immutable/chunks/BGcIe2ep.js +0 -2
  78. package/build/_app/immutable/chunks/BjFADNkA.js +0 -992
  79. package/build/_app/immutable/chunks/BrvvOVaJ.js +0 -1
  80. package/build/_app/immutable/chunks/D9CTkMjK.js +0 -1
  81. package/build/_app/immutable/chunks/oiO4RLqp.js +0 -1
  82. package/build/_app/immutable/chunks/pDJnDxXM.js +0 -1
  83. package/build/_app/immutable/entry/app.DdaMXHAv.js +0 -2
  84. package/build/_app/immutable/entry/start.-MLBtQXB.js +0 -1
  85. package/build/_app/immutable/nodes/0.Ysoz3Y3h.js +0 -1
  86. package/build/_app/immutable/nodes/1.C2jbGTOJ.js +0 -1
  87. package/build/_app/immutable/nodes/12.DQG5zpEx.js +0 -60
  88. package/build/_app/immutable/nodes/8.CrHI4F9p.js +0 -134
  89. package/dist/embed/RedUiEmbedRoot-BwFUA5X-.js +0 -28624
  90. package/dist/embed/RedUiEmbedRoot-BwFUA5X-.js.map +0 -1
  91. package/dist/embed/index-DGhgtnaK.js +0 -577
  92. package/dist/embed/index-DGhgtnaK.js.map +0 -1
  93. package/dist/embed/index-client-ItCEU64C.js +0 -3087
  94. package/dist/embed/index-client-ItCEU64C.js.map +0 -1
  95. /package/build/_app/immutable/assets/{12.Dblyk0Kr.css → 15.Dblyk0Kr.css} +0 -0
  96. /package/build/_app/immutable/nodes/{10.CAG5_cGP.js → 13.CAG5_cGP.js} +0 -0
@@ -0,0 +1,3303 @@
1
+ var us = Object.defineProperty;
2
+ var Un = (e) => {
3
+ throw TypeError(e);
4
+ };
5
+ var cs = (e, t, n) => t in e ? us(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var F = (e, t, n) => cs(e, typeof t != "symbol" ? t + "" : t, n), cn = (e, t, n) => t.has(e) || Un("Cannot " + n);
7
+ var f = (e, t, n) => (cn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), y = (e, t, n) => t.has(e) ? Un("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), g = (e, t, n, r) => (cn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), m = (e, t, n) => (cn(e, t, "access private method"), n);
8
+ var sr = Array.isArray, ds = Array.prototype.indexOf, Ue = Array.prototype.includes, hs = Array.from, ir = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, _s = Object.getOwnPropertyDescriptors, vs = Object.prototype, ps = Array.prototype, fr = Object.getPrototypeOf, $n = Object.isExtensible;
9
+ function Wi(e) {
10
+ return typeof e == "function";
11
+ }
12
+ const pe = () => {
13
+ };
14
+ function Ki(e) {
15
+ return typeof (e == null ? void 0 : e.then) == "function";
16
+ }
17
+ function Xi(e) {
18
+ return e();
19
+ }
20
+ function ar(e) {
21
+ for (var t = 0; t < e.length; t++)
22
+ e[t]();
23
+ }
24
+ function lr() {
25
+ var e, t, n = new Promise((r, s) => {
26
+ e = r, t = s;
27
+ });
28
+ return { promise: n, resolve: e, reject: t };
29
+ }
30
+ function Ji(e, t, n = !1) {
31
+ return e === void 0 ? n ? (
32
+ /** @type {() => V} */
33
+ t()
34
+ ) : (
35
+ /** @type {V} */
36
+ t
37
+ ) : e;
38
+ }
39
+ function Zi(e, t) {
40
+ if (Array.isArray(e))
41
+ return e;
42
+ if (t === void 0 || !(Symbol.iterator in e))
43
+ return Array.from(e);
44
+ const n = [];
45
+ for (const r of e)
46
+ if (n.push(r), n.length === t) break;
47
+ return n;
48
+ }
49
+ function Qi(e, t) {
50
+ var n = {};
51
+ for (var r in e)
52
+ t.includes(r) || (n[r] = e[r]);
53
+ for (var s of Object.getOwnPropertySymbols(e))
54
+ Object.propertyIsEnumerable.call(e, s) && !t.includes(s) && (n[s] = e[s]);
55
+ return n;
56
+ }
57
+ const D = 2, ut = 4, Dt = 8, Mn = 1 << 24, fe = 16, ye = 32, Se = 64, vn = 128, X = 512, R = 1024, I = 2048, le = 4096, J = 8192, ge = 16384, De = 32768, zn = 1 << 25, ct = 65536, St = 1 << 17, gs = 1 << 18, Xe = 1 << 19, or = 1 << 20, ef = 1 << 25, We = 65536, Kt = 1 << 21, rt = 1 << 22, Me = 1 << 23, $e = Symbol("$state"), tf = Symbol("legacy props"), nf = Symbol(""), ys = Symbol("attributes"), bs = Symbol("class"), ws = Symbol("style"), pt = Symbol("text"), qt = Symbol("form reset"), rn = new class extends Error {
58
+ constructor() {
59
+ super(...arguments);
60
+ F(this, "name", "StaleReactionError");
61
+ F(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
62
+ }
63
+ }();
64
+ var nr;
65
+ const sf = (
66
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
67
+ !!((nr = globalThis.document) != null && nr.contentType) && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
68
+ ), ff = 1, Pt = 3, sn = 8;
69
+ function ur(e) {
70
+ throw new Error("https://svelte.dev/e/experimental_async_required");
71
+ }
72
+ function af() {
73
+ throw new Error("https://svelte.dev/e/invalid_default_snippet");
74
+ }
75
+ function _t(e) {
76
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
77
+ }
78
+ function ms() {
79
+ throw new Error("https://svelte.dev/e/missing_context");
80
+ }
81
+ function Es() {
82
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
83
+ }
84
+ function lf(e, t, n) {
85
+ throw new Error("https://svelte.dev/e/each_key_duplicate");
86
+ }
87
+ function Ts(e) {
88
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
89
+ }
90
+ function Ss() {
91
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
92
+ }
93
+ function As(e) {
94
+ throw new Error("https://svelte.dev/e/effect_orphan");
95
+ }
96
+ function ks() {
97
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
98
+ }
99
+ function xs() {
100
+ throw new Error("https://svelte.dev/e/fork_discarded");
101
+ }
102
+ function Ns() {
103
+ throw new Error("https://svelte.dev/e/fork_timing");
104
+ }
105
+ function Os() {
106
+ throw new Error("https://svelte.dev/e/get_abort_signal_outside_reaction");
107
+ }
108
+ function Rs() {
109
+ throw new Error("https://svelte.dev/e/hydration_failed");
110
+ }
111
+ function cr(e) {
112
+ throw new Error("https://svelte.dev/e/lifecycle_legacy_only");
113
+ }
114
+ function of(e) {
115
+ throw new Error("https://svelte.dev/e/props_invalid_value");
116
+ }
117
+ function Ms() {
118
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
119
+ }
120
+ function Cs() {
121
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
122
+ }
123
+ function Is() {
124
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
125
+ }
126
+ function Ds() {
127
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
128
+ }
129
+ const uf = 1, cf = 2, df = 4, hf = 8, _f = 16, vf = 1, pf = 2, gf = 4, yf = 8, bf = 16, wf = 1, mf = 2, Ef = 4, dr = 1, Ps = 2, hr = "[", _r = "[!", Gn = "[?", vr = "]", dt = {}, M = Symbol("uninitialized"), Ls = "http://www.w3.org/1999/xhtml", Tf = "http://www.w3.org/2000/svg", Sf = "http://www.w3.org/1998/Math/MathML", Af = "@attach";
130
+ function Fs() {
131
+ console.warn("https://svelte.dev/e/derived_inert");
132
+ }
133
+ function js(e) {
134
+ console.warn("https://svelte.dev/e/hydratable_missing_but_expected");
135
+ }
136
+ function fn(e) {
137
+ console.warn("https://svelte.dev/e/hydration_mismatch");
138
+ }
139
+ function kf() {
140
+ console.warn("https://svelte.dev/e/select_multiple_invalid_value");
141
+ }
142
+ function Hs() {
143
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
144
+ }
145
+ let N = !1;
146
+ function Ht(e) {
147
+ N = e;
148
+ }
149
+ let E;
150
+ function oe(e) {
151
+ if (e === null)
152
+ throw fn(), dt;
153
+ return E = e;
154
+ }
155
+ function Cn() {
156
+ return oe(/* @__PURE__ */ Ae(E));
157
+ }
158
+ function xf(e) {
159
+ if (N) {
160
+ if (/* @__PURE__ */ Ae(E) !== null)
161
+ throw fn(), dt;
162
+ E = e;
163
+ }
164
+ }
165
+ function Vs(e = 1) {
166
+ if (N) {
167
+ for (var t = e, n = E; t--; )
168
+ n = /** @type {TemplateNode} */
169
+ /* @__PURE__ */ Ae(n);
170
+ E = n;
171
+ }
172
+ }
173
+ function Bs(e = !0) {
174
+ for (var t = 0, n = E; ; ) {
175
+ if (n.nodeType === sn) {
176
+ var r = (
177
+ /** @type {Comment} */
178
+ n.data
179
+ );
180
+ if (r === vr) {
181
+ if (t === 0) return n;
182
+ t -= 1;
183
+ } else (r === hr || r === _r || // "[1", "[2", etc. for if blocks
184
+ r[0] === "[" && !isNaN(Number(r.slice(1)))) && (t += 1);
185
+ }
186
+ var s = (
187
+ /** @type {TemplateNode} */
188
+ /* @__PURE__ */ Ae(n)
189
+ );
190
+ e && n.remove(), n = s;
191
+ }
192
+ }
193
+ function Nf(e) {
194
+ if (!e || e.nodeType !== sn)
195
+ throw fn(), dt;
196
+ return (
197
+ /** @type {Comment} */
198
+ e.data
199
+ );
200
+ }
201
+ function pr(e) {
202
+ return e === this.v;
203
+ }
204
+ function gr(e, t) {
205
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
206
+ }
207
+ function yr(e) {
208
+ return !gr(e, this.v);
209
+ }
210
+ let Lt = !1;
211
+ function Of() {
212
+ Lt = !0;
213
+ }
214
+ let T = null;
215
+ function ht(e) {
216
+ T = e;
217
+ }
218
+ function Ys() {
219
+ const e = {};
220
+ return [
221
+ () => (mr(e) || ms(), br(e)),
222
+ (t) => wr(e, t)
223
+ ];
224
+ }
225
+ function br(e) {
226
+ return (
227
+ /** @type {T} */
228
+ an().get(e)
229
+ );
230
+ }
231
+ function wr(e, t) {
232
+ return an().set(e, t), t;
233
+ }
234
+ function mr(e) {
235
+ return an().has(e);
236
+ }
237
+ function qs() {
238
+ return an();
239
+ }
240
+ function Us(e, t = !1, n) {
241
+ T = {
242
+ p: T,
243
+ i: !1,
244
+ c: null,
245
+ e: null,
246
+ s: e,
247
+ x: null,
248
+ r: (
249
+ /** @type {Effect} */
250
+ w
251
+ ),
252
+ l: Lt && !t ? { s: null, u: null, $: [] } : null
253
+ };
254
+ }
255
+ function $s(e) {
256
+ var t = (
257
+ /** @type {ComponentContext} */
258
+ T
259
+ ), n = t.e;
260
+ if (n !== null) {
261
+ t.e = null;
262
+ for (var r of n)
263
+ zr(r);
264
+ }
265
+ return e !== void 0 && (t.x = e), t.i = !0, T = t.p, e ?? /** @type {T} */
266
+ {};
267
+ }
268
+ function Ft() {
269
+ return !Lt || T !== null && T.l === null;
270
+ }
271
+ function an(e) {
272
+ return T === null && _t(), T.c ?? (T.c = new Map(zs(T) || void 0));
273
+ }
274
+ function zs(e) {
275
+ let t = e.p;
276
+ for (; t !== null; ) {
277
+ const n = t.c;
278
+ if (n !== null)
279
+ return n;
280
+ t = t.p;
281
+ }
282
+ return null;
283
+ }
284
+ let Pe = [];
285
+ function Er() {
286
+ var e = Pe;
287
+ Pe = [], ar(e);
288
+ }
289
+ function Ce(e) {
290
+ if (Pe.length === 0 && !mt) {
291
+ var t = Pe;
292
+ queueMicrotask(() => {
293
+ t === Pe && Er();
294
+ });
295
+ }
296
+ Pe.push(e);
297
+ }
298
+ function Gs() {
299
+ for (; Pe.length > 0; )
300
+ Er();
301
+ }
302
+ function Tr(e) {
303
+ var t = w;
304
+ if (t === null)
305
+ return b.f |= Me, e;
306
+ if ((t.f & De) === 0 && (t.f & ut) === 0)
307
+ throw e;
308
+ Re(e, t);
309
+ }
310
+ function Re(e, t) {
311
+ for (; t !== null; ) {
312
+ if ((t.f & vn) !== 0) {
313
+ if ((t.f & De) === 0)
314
+ throw e;
315
+ try {
316
+ t.b.error(e);
317
+ return;
318
+ } catch (n) {
319
+ e = n;
320
+ }
321
+ }
322
+ t = t.parent;
323
+ }
324
+ throw e;
325
+ }
326
+ const Ws = -7169;
327
+ function x(e, t) {
328
+ e.f = e.f & Ws | t;
329
+ }
330
+ function In(e) {
331
+ (e.f & X) !== 0 || e.deps === null ? x(e, R) : x(e, le);
332
+ }
333
+ function Sr(e) {
334
+ if (e !== null)
335
+ for (const t of e)
336
+ (t.f & D) === 0 || (t.f & We) === 0 || (t.f ^= We, Sr(
337
+ /** @type {Derived} */
338
+ t.deps
339
+ ));
340
+ }
341
+ function Ar(e, t, n) {
342
+ (e.f & I) !== 0 ? t.add(e) : (e.f & le) !== 0 && n.add(e), Sr(e.deps), x(e, R);
343
+ }
344
+ function Dn(e, t, n) {
345
+ if (e == null)
346
+ return t(void 0), n && n(void 0), pe;
347
+ const r = Je(
348
+ () => e.subscribe(
349
+ t,
350
+ // @ts-expect-error
351
+ n
352
+ )
353
+ );
354
+ return r.unsubscribe ? () => r.unsubscribe() : r;
355
+ }
356
+ const Qe = [];
357
+ function Ks(e, t) {
358
+ return {
359
+ subscribe: Xs(e, t).subscribe
360
+ };
361
+ }
362
+ function Xs(e, t = pe) {
363
+ let n = null;
364
+ const r = /* @__PURE__ */ new Set();
365
+ function s(o) {
366
+ if (gr(e, o) && (e = o, n)) {
367
+ const l = !Qe.length;
368
+ for (const u of r)
369
+ u[1](), Qe.push(u, e);
370
+ if (l) {
371
+ for (let u = 0; u < Qe.length; u += 2)
372
+ Qe[u][0](Qe[u + 1]);
373
+ Qe.length = 0;
374
+ }
375
+ }
376
+ }
377
+ function i(o) {
378
+ s(o(
379
+ /** @type {T} */
380
+ e
381
+ ));
382
+ }
383
+ function a(o, l = pe) {
384
+ const u = [o, l];
385
+ return r.add(u), r.size === 1 && (n = t(s, i) || pe), o(
386
+ /** @type {T} */
387
+ e
388
+ ), () => {
389
+ r.delete(u), r.size === 0 && n && (n(), n = null);
390
+ };
391
+ }
392
+ return { set: s, update: i, subscribe: a };
393
+ }
394
+ function Rf(e, t, n) {
395
+ const r = !Array.isArray(e), s = r ? [e] : e;
396
+ if (!s.every(Boolean))
397
+ throw new Error("derived() expects stores as input, got a falsy value");
398
+ const i = t.length < 2;
399
+ return Ks(n, (a, o) => {
400
+ let l = !1;
401
+ const u = [];
402
+ let _ = 0, d = pe;
403
+ const c = () => {
404
+ if (_)
405
+ return;
406
+ d();
407
+ const h = t(r ? u[0] : u, a, o);
408
+ i ? a(h) : d = typeof h == "function" ? h : pe;
409
+ }, v = s.map(
410
+ (h, A) => Dn(
411
+ h,
412
+ (O) => {
413
+ u[A] = O, _ &= ~(1 << A), l && c();
414
+ },
415
+ () => {
416
+ _ |= 1 << A;
417
+ }
418
+ )
419
+ );
420
+ return l = !0, c(), function() {
421
+ ar(v), d(), l = !1;
422
+ };
423
+ });
424
+ }
425
+ function Js(e) {
426
+ let t;
427
+ return Dn(e, (n) => t = n)(), t;
428
+ }
429
+ let pn = !1, Vt = !1, gn = Symbol("unmounted");
430
+ function Mf(e, t, n) {
431
+ const r = n[t] ?? (n[t] = {
432
+ store: null,
433
+ source: /* @__PURE__ */ _i(void 0),
434
+ unsubscribe: pe
435
+ });
436
+ if (r.store !== e && !(gn in n))
437
+ if (r.unsubscribe(), r.store = e ?? null, e == null)
438
+ r.source.v = void 0, r.unsubscribe = pe;
439
+ else {
440
+ var s = !0;
441
+ r.unsubscribe = Dn(e, (i) => {
442
+ s ? r.source.v = i : _e(r.source, i);
443
+ }), s = !1;
444
+ }
445
+ return e && gn in n ? Js(e) : ve(r.source);
446
+ }
447
+ function Cf(e, t, n) {
448
+ let r = n[t];
449
+ return r && r.store !== e && (r.unsubscribe(), r.unsubscribe = pe), e;
450
+ }
451
+ function If(e, t) {
452
+ return Zs(e, t), t;
453
+ }
454
+ function Df() {
455
+ const e = {};
456
+ function t() {
457
+ un(() => {
458
+ for (var n in e)
459
+ e[n].unsubscribe();
460
+ ir(e, gn, {
461
+ enumerable: !1,
462
+ value: !0
463
+ });
464
+ });
465
+ }
466
+ return [e, t];
467
+ }
468
+ function Zs(e, t) {
469
+ pn = !0;
470
+ try {
471
+ e.set(t);
472
+ } finally {
473
+ pn = !1;
474
+ }
475
+ }
476
+ function Pf(e) {
477
+ var t = Vt;
478
+ try {
479
+ return Vt = !1, [e(), Vt];
480
+ } finally {
481
+ Vt = t;
482
+ }
483
+ }
484
+ let dn = null, et = null, p = null, wt = null, C = null, yn = null, mt = !1, hn = !1, nt = null, Ut = null;
485
+ var Wn = 0;
486
+ let Qs = 1;
487
+ var st, xe, je, it, ft, He, at, me, xt, Y, Nt, Ne, ce, de, lt, Ve, S, bn, gt, wn, kr, xr, $t, ei, mn, tt;
488
+ const en = class en {
489
+ constructor() {
490
+ y(this, S);
491
+ F(this, "id", Qs++);
492
+ /** True as soon as `#process` was called */
493
+ y(this, st, !1);
494
+ F(this, "linked", !0);
495
+ /** @type {Batch | null} */
496
+ y(this, xe, null);
497
+ /** @type {Batch | null} */
498
+ y(this, je, null);
499
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
500
+ F(this, "async_deriveds", /* @__PURE__ */ new Map());
501
+ /**
502
+ * The current values of any signals that are updated in this batch.
503
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
504
+ * They keys of this map are identical to `this.#previous`
505
+ * @type {Map<Value, [any, boolean]>}
506
+ */
507
+ F(this, "current", /* @__PURE__ */ new Map());
508
+ /**
509
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
510
+ * They keys of this map are identical to `this.#current`
511
+ * @type {Map<Value, any>}
512
+ */
513
+ F(this, "previous", /* @__PURE__ */ new Map());
514
+ /**
515
+ * Async effects which this batch doesn't take into account anymore when calculating blockers,
516
+ * as it has a value for it already.
517
+ * @type {Set<Effect>}
518
+ */
519
+ F(this, "unblocked", /* @__PURE__ */ new Set());
520
+ /**
521
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
522
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
523
+ * @type {Set<(batch: Batch) => void>}
524
+ */
525
+ y(this, it, /* @__PURE__ */ new Set());
526
+ /**
527
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
528
+ * @type {Set<(batch: Batch) => void>}
529
+ */
530
+ y(this, ft, /* @__PURE__ */ new Set());
531
+ /**
532
+ * Callbacks that should run only when a fork is committed.
533
+ * @type {Set<(batch: Batch) => void>}
534
+ */
535
+ y(this, He, /* @__PURE__ */ new Set());
536
+ /**
537
+ * The number of async effects that are currently in flight
538
+ */
539
+ y(this, at, 0);
540
+ /**
541
+ * Async effects that are currently in flight, _not_ inside a pending boundary
542
+ * @type {Map<Effect, number>}
543
+ */
544
+ y(this, me, /* @__PURE__ */ new Map());
545
+ /**
546
+ * A deferred that resolves when the batch is committed, used with `settled()`
547
+ * TODO replace with Promise.withResolvers once supported widely enough
548
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
549
+ */
550
+ y(this, xt, null);
551
+ /**
552
+ * The root effects that need to be flushed
553
+ * @type {Effect[]}
554
+ */
555
+ y(this, Y, []);
556
+ /**
557
+ * Effects created while this batch was active.
558
+ * @type {Effect[]}
559
+ */
560
+ y(this, Nt, []);
561
+ /**
562
+ * Deferred effects (which run after async work has completed) that are DIRTY
563
+ * @type {Set<Effect>}
564
+ */
565
+ y(this, Ne, /* @__PURE__ */ new Set());
566
+ /**
567
+ * Deferred effects that are MAYBE_DIRTY
568
+ * @type {Set<Effect>}
569
+ */
570
+ y(this, ce, /* @__PURE__ */ new Set());
571
+ /**
572
+ * A map of branches that still exist, but will be destroyed when this batch
573
+ * is committed — we skip over these during `process`.
574
+ * The value contains child effects that were dirty/maybe_dirty before being reset,
575
+ * so they can be rescheduled if the branch survives.
576
+ * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
577
+ */
578
+ y(this, de, /* @__PURE__ */ new Map());
579
+ /**
580
+ * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
581
+ * @type {Set<Effect>}
582
+ */
583
+ y(this, lt, /* @__PURE__ */ new Set());
584
+ F(this, "is_fork", !1);
585
+ y(this, Ve, !1);
586
+ }
587
+ /**
588
+ * Add an effect to the #skipped_branches map and reset its children
589
+ * @param {Effect} effect
590
+ */
591
+ skip_effect(t) {
592
+ f(this, de).has(t) || f(this, de).set(t, { d: [], m: [] }), f(this, lt).delete(t);
593
+ }
594
+ /**
595
+ * Remove an effect from the #skipped_branches map and reschedule
596
+ * any tracked dirty/maybe_dirty child effects
597
+ * @param {Effect} effect
598
+ * @param {(e: Effect) => void} callback
599
+ */
600
+ unskip_effect(t, n = (r) => this.schedule(r)) {
601
+ var r = f(this, de).get(t);
602
+ if (r) {
603
+ f(this, de).delete(t);
604
+ for (var s of r.d)
605
+ x(s, I), n(s);
606
+ for (s of r.m)
607
+ x(s, le), n(s);
608
+ }
609
+ f(this, lt).add(t);
610
+ }
611
+ /**
612
+ * Associate a change to a given source with the current
613
+ * batch, noting its previous and current values
614
+ * @param {Value} source
615
+ * @param {any} value
616
+ * @param {boolean} [is_derived]
617
+ */
618
+ capture(t, n, r = !1) {
619
+ t.v !== M && !this.previous.has(t) && this.previous.set(t, t.v), (t.f & Me) === 0 && (this.current.set(t, [n, r]), C == null || C.set(t, n)), this.is_fork || (t.v = n);
620
+ }
621
+ activate() {
622
+ p = this;
623
+ }
624
+ deactivate() {
625
+ p = null, C = null;
626
+ }
627
+ flush() {
628
+ try {
629
+ hn = !0, p = this, m(this, S, gt).call(this);
630
+ } finally {
631
+ Wn = 0, yn = null, nt = null, Ut = null, hn = !1, p = null, C = null, ze.clear();
632
+ }
633
+ }
634
+ discard() {
635
+ for (const t of f(this, ft)) t(this);
636
+ f(this, ft).clear(), f(this, He).clear(), m(this, S, tt).call(this);
637
+ }
638
+ /**
639
+ * @param {Effect} effect
640
+ */
641
+ register_created_effect(t) {
642
+ f(this, Nt).push(t);
643
+ }
644
+ /**
645
+ * @param {boolean} blocking
646
+ * @param {Effect} effect
647
+ */
648
+ increment(t, n) {
649
+ if (g(this, at, f(this, at) + 1), t) {
650
+ let r = f(this, me).get(n) ?? 0;
651
+ f(this, me).set(n, r + 1);
652
+ }
653
+ }
654
+ /**
655
+ * @param {boolean} blocking
656
+ * @param {Effect} effect
657
+ */
658
+ decrement(t, n) {
659
+ if (g(this, at, f(this, at) - 1), t) {
660
+ let r = f(this, me).get(n) ?? 0;
661
+ r === 1 ? f(this, me).delete(n) : f(this, me).set(n, r - 1);
662
+ }
663
+ f(this, Ve) || (g(this, Ve, !0), Ce(() => {
664
+ g(this, Ve, !1), this.linked && this.flush();
665
+ }));
666
+ }
667
+ /**
668
+ * @param {Set<Effect>} dirty_effects
669
+ * @param {Set<Effect>} maybe_dirty_effects
670
+ */
671
+ transfer_effects(t, n) {
672
+ for (const r of t)
673
+ f(this, Ne).add(r);
674
+ for (const r of n)
675
+ f(this, ce).add(r);
676
+ t.clear(), n.clear();
677
+ }
678
+ /** @param {(batch: Batch) => void} fn */
679
+ oncommit(t) {
680
+ f(this, it).add(t);
681
+ }
682
+ /** @param {(batch: Batch) => void} fn */
683
+ ondiscard(t) {
684
+ f(this, ft).add(t);
685
+ }
686
+ /** @param {(batch: Batch) => void} fn */
687
+ on_fork_commit(t) {
688
+ f(this, He).add(t);
689
+ }
690
+ run_fork_commit_callbacks() {
691
+ for (const t of f(this, He)) t(this);
692
+ f(this, He).clear();
693
+ }
694
+ settled() {
695
+ return (f(this, xt) ?? g(this, xt, lr())).promise;
696
+ }
697
+ static ensure() {
698
+ var t;
699
+ if (p === null) {
700
+ const n = p = new en();
701
+ m(t = n, S, mn).call(t), !hn && !mt && Ce(() => {
702
+ f(n, st) || n.flush();
703
+ });
704
+ }
705
+ return p;
706
+ }
707
+ apply() {
708
+ {
709
+ C = null;
710
+ return;
711
+ }
712
+ }
713
+ /**
714
+ *
715
+ * @param {Effect} effect
716
+ */
717
+ schedule(t) {
718
+ var s;
719
+ if (yn = t, (s = t.b) != null && s.is_pending && (t.f & (ut | Dt | Mn)) !== 0 && (t.f & De) === 0) {
720
+ t.b.defer_effect(t);
721
+ return;
722
+ }
723
+ for (var n = t; n.parent !== null; ) {
724
+ n = n.parent;
725
+ var r = n.f;
726
+ if (nt !== null && n === w && (b === null || (b.f & D) === 0) && !pn)
727
+ return;
728
+ if ((r & (Se | ye)) !== 0) {
729
+ if ((r & R) === 0)
730
+ return;
731
+ n.f ^= R;
732
+ }
733
+ }
734
+ f(this, Y).push(n);
735
+ }
736
+ };
737
+ st = new WeakMap(), xe = new WeakMap(), je = new WeakMap(), it = new WeakMap(), ft = new WeakMap(), He = new WeakMap(), at = new WeakMap(), me = new WeakMap(), xt = new WeakMap(), Y = new WeakMap(), Nt = new WeakMap(), Ne = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), lt = new WeakMap(), Ve = new WeakMap(), S = new WeakSet(), bn = function() {
738
+ if (this.is_fork) return !0;
739
+ for (const r of f(this, me).keys()) {
740
+ for (var t = r, n = !1; t.parent !== null; ) {
741
+ if (f(this, de).has(t)) {
742
+ n = !0;
743
+ break;
744
+ }
745
+ t = t.parent;
746
+ }
747
+ if (!n)
748
+ return !0;
749
+ }
750
+ return !1;
751
+ }, gt = function() {
752
+ var l, u, _, d;
753
+ if (g(this, st, !0), Wn++ > 1e3 && (m(this, S, tt).call(this), ti()), !m(this, S, bn).call(this)) {
754
+ for (const c of f(this, Ne))
755
+ f(this, ce).delete(c), x(c, I), this.schedule(c);
756
+ for (const c of f(this, ce))
757
+ x(c, le), this.schedule(c);
758
+ }
759
+ const t = f(this, Y);
760
+ g(this, Y, []), this.apply();
761
+ var n = nt = [], r = [], s = Ut = [];
762
+ for (const c of t)
763
+ try {
764
+ m(this, S, wn).call(this, c, n, r);
765
+ } catch (v) {
766
+ throw Mr(c), v;
767
+ }
768
+ if (p = null, s.length > 0) {
769
+ var i = en.ensure();
770
+ for (const c of s)
771
+ i.schedule(c);
772
+ }
773
+ if (nt = null, Ut = null, m(this, S, bn).call(this)) {
774
+ m(this, S, $t).call(this, r), m(this, S, $t).call(this, n);
775
+ for (const [c, v] of f(this, de))
776
+ Rr(c, v);
777
+ s.length > 0 && /** @type {unknown} */
778
+ m(l = p, S, gt).call(l);
779
+ return;
780
+ }
781
+ const a = m(this, S, kr).call(this);
782
+ if (a) {
783
+ m(u = a, S, xr).call(u, this);
784
+ return;
785
+ }
786
+ f(this, Ne).clear(), f(this, ce).clear();
787
+ for (const c of f(this, it)) c(this);
788
+ f(this, it).clear(), wt = this, Kn(r), Kn(n), wt = null, (_ = f(this, xt)) == null || _.resolve();
789
+ var o = (
790
+ /** @type {Batch | null} */
791
+ /** @type {unknown} */
792
+ p
793
+ );
794
+ if (this.linked && f(this, at) === 0 && m(this, S, tt).call(this), f(this, Y).length > 0) {
795
+ o === null && (o = this, m(this, S, mn).call(this));
796
+ const c = o;
797
+ f(c, Y).push(...f(this, Y).filter((v) => !f(c, Y).includes(v)));
798
+ }
799
+ o !== null && m(d = o, S, gt).call(d);
800
+ }, /**
801
+ * Traverse the effect tree, executing effects or stashing
802
+ * them for later execution as appropriate
803
+ * @param {Effect} root
804
+ * @param {Effect[]} effects
805
+ * @param {Effect[]} render_effects
806
+ */
807
+ wn = function(t, n, r) {
808
+ t.f ^= R;
809
+ for (var s = t.first; s !== null; ) {
810
+ var i = s.f, a = (i & (ye | Se)) !== 0, o = a && (i & R) !== 0, l = o || (i & J) !== 0 || f(this, de).has(s);
811
+ if (!l && s.fn !== null) {
812
+ a ? s.f ^= R : (i & ut) !== 0 ? n.push(s) : vt(s) && ((i & fe) !== 0 && f(this, ce).add(s), Ke(s));
813
+ var u = s.first;
814
+ if (u !== null) {
815
+ s = u;
816
+ continue;
817
+ }
818
+ }
819
+ for (; s !== null; ) {
820
+ var _ = s.next;
821
+ if (_ !== null) {
822
+ s = _;
823
+ break;
824
+ }
825
+ s = s.parent;
826
+ }
827
+ }
828
+ }, kr = function() {
829
+ for (var t = f(this, xe); t !== null; ) {
830
+ if (!t.is_fork) {
831
+ for (const [n, [, r]] of this.current)
832
+ if (t.current.has(n) && !r)
833
+ return t;
834
+ }
835
+ t = f(t, xe);
836
+ }
837
+ return null;
838
+ }, /**
839
+ * @param {Batch} batch
840
+ */
841
+ xr = function(t) {
842
+ var r;
843
+ for (const [s, i] of t.current)
844
+ !this.previous.has(s) && t.previous.has(s) && this.previous.set(s, t.previous.get(s)), this.current.set(s, i);
845
+ for (const [s, i] of t.async_deriveds) {
846
+ const a = this.async_deriveds.get(s);
847
+ a && i.promise.then(a.resolve);
848
+ }
849
+ const n = (s) => {
850
+ var i = s.reactions;
851
+ if (i !== null)
852
+ for (const l of i) {
853
+ var a = l.f;
854
+ if ((a & D) !== 0)
855
+ n(
856
+ /** @type {Derived} */
857
+ l
858
+ );
859
+ else {
860
+ var o = (
861
+ /** @type {Effect} */
862
+ l
863
+ );
864
+ a & (rt | fe) && !this.async_deriveds.has(o) && (f(this, ce).delete(o), x(o, I), this.schedule(o));
865
+ }
866
+ }
867
+ };
868
+ for (const s of this.current.keys())
869
+ n(s);
870
+ this.oncommit(() => t.discard()), m(r = t, S, tt).call(r), p = this, m(this, S, gt).call(this);
871
+ }, /**
872
+ * @param {Effect[]} effects
873
+ */
874
+ $t = function(t) {
875
+ for (var n = 0; n < t.length; n += 1)
876
+ Ar(t[n], f(this, Ne), f(this, ce));
877
+ }, ei = function() {
878
+ var _;
879
+ m(this, S, tt).call(this);
880
+ for (let d = dn; d !== null; d = f(d, je)) {
881
+ var t = d.id < this.id, n = [];
882
+ for (const [c, [v, h]] of this.current) {
883
+ if (d.current.has(c)) {
884
+ var r = (
885
+ /** @type {[any, boolean]} */
886
+ d.current.get(c)[0]
887
+ );
888
+ if (t && v !== r)
889
+ d.current.set(c, [v, h]);
890
+ else
891
+ continue;
892
+ }
893
+ n.push(c);
894
+ }
895
+ if (t)
896
+ for (const [c, v] of this.async_deriveds) {
897
+ const h = d.async_deriveds.get(c);
898
+ h && v.promise.then(h.resolve);
899
+ }
900
+ if (f(d, st)) {
901
+ var s = [...d.current.keys()].filter((c) => !this.current.has(c));
902
+ if (s.length === 0)
903
+ t && d.discard();
904
+ else if (n.length > 0) {
905
+ if (t)
906
+ for (const c of f(this, lt))
907
+ d.unskip_effect(c, (v) => {
908
+ var h;
909
+ (v.f & (fe | rt)) !== 0 ? d.schedule(v) : m(h = d, S, $t).call(h, [v]);
910
+ });
911
+ d.activate();
912
+ var i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
913
+ for (var o of n)
914
+ Nr(o, s, i, a);
915
+ a = /* @__PURE__ */ new Map();
916
+ var l = [...d.current.keys()].filter(
917
+ (c) => this.current.has(c) ? (
918
+ /** @type {[any, boolean]} */
919
+ this.current.get(c)[0] !== c.v
920
+ ) : !0
921
+ );
922
+ if (l.length > 0)
923
+ for (const c of f(this, Nt))
924
+ (c.f & (ge | J | St)) === 0 && Pn(c, l, a) && ((c.f & (rt | fe)) !== 0 ? (x(c, I), d.schedule(c)) : f(d, Ne).add(c));
925
+ if (f(d, Y).length > 0 && !f(d, Ve)) {
926
+ d.apply();
927
+ for (var u of f(d, Y))
928
+ m(_ = d, S, wn).call(_, u, [], []);
929
+ g(d, Y, []);
930
+ }
931
+ d.deactivate();
932
+ }
933
+ }
934
+ }
935
+ }, mn = function() {
936
+ et === null ? dn = et = this : (g(et, je, this), g(this, xe, et)), et = this;
937
+ }, tt = function() {
938
+ var t = f(this, xe), n = f(this, je);
939
+ t === null ? dn = n : g(t, je, n), n === null ? et = t : g(n, xe, t), this.linked = !1;
940
+ };
941
+ let be = en;
942
+ function Xt(e) {
943
+ var t = mt;
944
+ mt = !0;
945
+ try {
946
+ var n;
947
+ for (e && (p !== null && !p.is_fork && p.flush(), n = e()); ; ) {
948
+ if (Gs(), p === null)
949
+ return (
950
+ /** @type {T} */
951
+ n
952
+ );
953
+ p.flush();
954
+ }
955
+ } finally {
956
+ mt = t;
957
+ }
958
+ }
959
+ function ti() {
960
+ try {
961
+ ks();
962
+ } catch (e) {
963
+ Re(e, yn);
964
+ }
965
+ }
966
+ let se = null;
967
+ function Kn(e) {
968
+ var t = e.length;
969
+ if (t !== 0) {
970
+ for (var n = 0; n < t; ) {
971
+ var r = e[n++];
972
+ if ((r.f & (ge | J)) === 0 && vt(r) && (se = /* @__PURE__ */ new Set(), Ke(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Kr(r), (se == null ? void 0 : se.size) > 0)) {
973
+ ze.clear();
974
+ for (const s of se) {
975
+ if ((s.f & (ge | J)) !== 0) continue;
976
+ const i = [s];
977
+ let a = s.parent;
978
+ for (; a !== null; )
979
+ se.has(a) && (se.delete(a), i.push(a)), a = a.parent;
980
+ for (let o = i.length - 1; o >= 0; o--) {
981
+ const l = i[o];
982
+ (l.f & (ge | J)) === 0 && Ke(l);
983
+ }
984
+ }
985
+ se.clear();
986
+ }
987
+ }
988
+ se = null;
989
+ }
990
+ }
991
+ function Nr(e, t, n, r) {
992
+ if (!n.has(e) && (n.add(e), e.reactions !== null))
993
+ for (const s of e.reactions) {
994
+ const i = s.f;
995
+ (i & D) !== 0 ? Nr(
996
+ /** @type {Derived} */
997
+ s,
998
+ t,
999
+ n,
1000
+ r
1001
+ ) : (i & (rt | fe)) !== 0 && (i & I) === 0 && Pn(s, t, r) && (x(s, I), Ln(
1002
+ /** @type {Effect} */
1003
+ s
1004
+ ));
1005
+ }
1006
+ }
1007
+ function Or(e, t) {
1008
+ if (e.reactions !== null)
1009
+ for (const n of e.reactions) {
1010
+ const r = n.f;
1011
+ (r & D) !== 0 ? Or(
1012
+ /** @type {Derived} */
1013
+ n,
1014
+ t
1015
+ ) : (r & St) !== 0 && (x(n, I), t.add(
1016
+ /** @type {Effect} */
1017
+ n
1018
+ ));
1019
+ }
1020
+ }
1021
+ function Pn(e, t, n) {
1022
+ const r = n.get(e);
1023
+ if (r !== void 0) return r;
1024
+ if (e.deps !== null)
1025
+ for (const s of e.deps) {
1026
+ if (Ue.call(t, s))
1027
+ return !0;
1028
+ if ((s.f & D) !== 0 && Pn(
1029
+ /** @type {Derived} */
1030
+ s,
1031
+ t,
1032
+ n
1033
+ ))
1034
+ return n.set(
1035
+ /** @type {Derived} */
1036
+ s,
1037
+ !0
1038
+ ), !0;
1039
+ }
1040
+ return n.set(e, !1), !1;
1041
+ }
1042
+ function Ln(e) {
1043
+ p.schedule(e);
1044
+ }
1045
+ function Rr(e, t) {
1046
+ if (!((e.f & ye) !== 0 && (e.f & R) !== 0)) {
1047
+ (e.f & I) !== 0 ? t.d.push(e) : (e.f & le) !== 0 && t.m.push(e), x(e, R);
1048
+ for (var n = e.first; n !== null; )
1049
+ Rr(n, t), n = n.next;
1050
+ }
1051
+ }
1052
+ function Mr(e) {
1053
+ x(e, R);
1054
+ for (var t = e.first; t !== null; )
1055
+ Mr(t), t = t.next;
1056
+ }
1057
+ function ni(e) {
1058
+ ur(), p !== null && Ns();
1059
+ var t = be.ensure();
1060
+ t.is_fork = !0, C = /* @__PURE__ */ new Map();
1061
+ var n = !1, r = t.settled();
1062
+ return Xt(e), {
1063
+ commit: async () => {
1064
+ if (n) {
1065
+ await r;
1066
+ return;
1067
+ }
1068
+ t.linked || xs(), n = !0, t.is_fork = !1;
1069
+ for (var [s, [i]] of t.current)
1070
+ s.v = i, s.wv = Qt();
1071
+ t.activate(), t.run_fork_commit_callbacks(), t.deactivate(), Xt(() => {
1072
+ var a = /* @__PURE__ */ new Set();
1073
+ for (var o of t.current.keys())
1074
+ Or(o, a);
1075
+ hi(a), Hr();
1076
+ }), t.flush(), await r;
1077
+ },
1078
+ discard: () => {
1079
+ for (var s of t.current.keys())
1080
+ s.wv = Qt();
1081
+ !n && t.linked && t.discard();
1082
+ }
1083
+ };
1084
+ }
1085
+ function ri(e) {
1086
+ let t = 0, n = jt(0), r;
1087
+ return () => {
1088
+ Hn() && (ve(n), Vn(() => (t === 0 && (r = Je(() => e(() => Et(n)))), t += 1, () => {
1089
+ Ce(() => {
1090
+ t -= 1, t === 0 && (r == null || r(), r = void 0, Et(n));
1091
+ });
1092
+ })));
1093
+ };
1094
+ }
1095
+ var si = ct | Xe;
1096
+ function ii(e, t, n, r) {
1097
+ new fi(e, t, n, r);
1098
+ }
1099
+ var q, Ot, W, Be, j, K, L, U, Ee, Ye, Oe, ot, Rt, Mt, Te, tn, k, Cr, Ir, Dr, En, zt, Gt, Tn, Sn;
1100
+ class fi {
1101
+ /**
1102
+ * @param {TemplateNode} node
1103
+ * @param {BoundaryProps} props
1104
+ * @param {((anchor: Node) => void)} children
1105
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
1106
+ */
1107
+ constructor(t, n, r, s) {
1108
+ y(this, k);
1109
+ /** @type {Boundary | null} */
1110
+ F(this, "parent");
1111
+ F(this, "is_pending", !1);
1112
+ /**
1113
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1114
+ * Inherited from parent boundary, or defaults to identity.
1115
+ * @type {(error: unknown) => unknown}
1116
+ */
1117
+ F(this, "transform_error");
1118
+ /** @type {TemplateNode} */
1119
+ y(this, q);
1120
+ /** @type {TemplateNode | null} */
1121
+ y(this, Ot, N ? E : null);
1122
+ /** @type {BoundaryProps} */
1123
+ y(this, W);
1124
+ /** @type {((anchor: Node) => void)} */
1125
+ y(this, Be);
1126
+ /** @type {Effect} */
1127
+ y(this, j);
1128
+ /** @type {Effect | null} */
1129
+ y(this, K, null);
1130
+ /** @type {Effect | null} */
1131
+ y(this, L, null);
1132
+ /** @type {Effect | null} */
1133
+ y(this, U, null);
1134
+ /** @type {DocumentFragment | null} */
1135
+ y(this, Ee, null);
1136
+ y(this, Ye, 0);
1137
+ y(this, Oe, 0);
1138
+ y(this, ot, !1);
1139
+ /** @type {Set<Effect>} */
1140
+ y(this, Rt, /* @__PURE__ */ new Set());
1141
+ /** @type {Set<Effect>} */
1142
+ y(this, Mt, /* @__PURE__ */ new Set());
1143
+ /**
1144
+ * A source containing the number of pending async deriveds/expressions.
1145
+ * Only created if `$effect.pending()` is used inside the boundary,
1146
+ * otherwise updating the source results in needless `Batch.ensure()`
1147
+ * calls followed by no-op flushes
1148
+ * @type {Source<number> | null}
1149
+ */
1150
+ y(this, Te, null);
1151
+ y(this, tn, ri(() => (g(this, Te, jt(f(this, Ye))), () => {
1152
+ g(this, Te, null);
1153
+ })));
1154
+ var i;
1155
+ g(this, q, t), g(this, W, n), g(this, Be, (a) => {
1156
+ var o = (
1157
+ /** @type {Effect} */
1158
+ w
1159
+ );
1160
+ o.b = this, o.f |= vn, r(a);
1161
+ }), this.parent = /** @type {Effect} */
1162
+ w.b, this.transform_error = s ?? ((i = this.parent) == null ? void 0 : i.transform_error) ?? ((a) => a), g(this, j, Gr(() => {
1163
+ if (N) {
1164
+ const a = (
1165
+ /** @type {Comment} */
1166
+ f(this, Ot)
1167
+ );
1168
+ Cn();
1169
+ const o = a.data === _r;
1170
+ if (a.data.startsWith(Gn)) {
1171
+ const u = JSON.parse(a.data.slice(Gn.length));
1172
+ m(this, k, Ir).call(this, u);
1173
+ } else o ? m(this, k, Dr).call(this) : m(this, k, Cr).call(this);
1174
+ } else
1175
+ m(this, k, En).call(this);
1176
+ }, si)), N && g(this, q, E);
1177
+ }
1178
+ /**
1179
+ * Defer an effect inside a pending boundary until the boundary resolves
1180
+ * @param {Effect} effect
1181
+ */
1182
+ defer_effect(t) {
1183
+ Ar(t, f(this, Rt), f(this, Mt));
1184
+ }
1185
+ /**
1186
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1187
+ * @returns {boolean}
1188
+ */
1189
+ is_rendered() {
1190
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
1191
+ }
1192
+ has_pending_snippet() {
1193
+ return !!f(this, W).pending;
1194
+ }
1195
+ /**
1196
+ * Update the source that powers `$effect.pending()` inside this boundary,
1197
+ * and controls when the current `pending` snippet (if any) is removed.
1198
+ * Do not call from inside the class
1199
+ * @param {1 | -1} d
1200
+ * @param {Batch} batch
1201
+ */
1202
+ update_pending_count(t, n) {
1203
+ m(this, k, Tn).call(this, t, n), g(this, Ye, f(this, Ye) + t), !(!f(this, Te) || f(this, ot)) && (g(this, ot, !0), Ce(() => {
1204
+ g(this, ot, !1), f(this, Te) && Zt(f(this, Te), f(this, Ye));
1205
+ }));
1206
+ }
1207
+ get_effect_pending() {
1208
+ return f(this, tn).call(this), ve(
1209
+ /** @type {Source<number>} */
1210
+ f(this, Te)
1211
+ );
1212
+ }
1213
+ /** @param {unknown} error */
1214
+ error(t) {
1215
+ if (!f(this, W).onerror && !f(this, W).failed)
1216
+ throw t;
1217
+ p != null && p.is_fork ? (f(this, K) && p.skip_effect(f(this, K)), f(this, L) && p.skip_effect(f(this, L)), f(this, U) && p.skip_effect(f(this, U)), p.on_fork_commit(() => {
1218
+ m(this, k, Sn).call(this, t);
1219
+ })) : m(this, k, Sn).call(this, t);
1220
+ }
1221
+ }
1222
+ q = new WeakMap(), Ot = new WeakMap(), W = new WeakMap(), Be = new WeakMap(), j = new WeakMap(), K = new WeakMap(), L = new WeakMap(), U = new WeakMap(), Ee = new WeakMap(), Ye = new WeakMap(), Oe = new WeakMap(), ot = new WeakMap(), Rt = new WeakMap(), Mt = new WeakMap(), Te = new WeakMap(), tn = new WeakMap(), k = new WeakSet(), Cr = function() {
1223
+ try {
1224
+ g(this, K, we(() => f(this, Be).call(this, f(this, q))));
1225
+ } catch (t) {
1226
+ this.error(t);
1227
+ }
1228
+ }, /**
1229
+ * @param {unknown} error The deserialized error from the server's hydration comment
1230
+ */
1231
+ Ir = function(t) {
1232
+ const n = f(this, W).failed;
1233
+ n && g(this, U, we(() => {
1234
+ n(
1235
+ f(this, q),
1236
+ () => t,
1237
+ () => () => {
1238
+ }
1239
+ );
1240
+ }));
1241
+ }, Dr = function() {
1242
+ const t = f(this, W).pending;
1243
+ t && (this.is_pending = !0, g(this, L, we(() => t(f(this, q)))), Ce(() => {
1244
+ var n = g(this, Ee, document.createDocumentFragment()), r = ue();
1245
+ n.append(r), g(this, K, m(this, k, Gt).call(this, () => we(() => f(this, Be).call(this, r)))), f(this, Oe) === 0 && (f(this, q).before(n), g(this, Ee, null), Tt(
1246
+ /** @type {Effect} */
1247
+ f(this, L),
1248
+ () => {
1249
+ g(this, L, null);
1250
+ }
1251
+ ), m(this, k, zt).call(
1252
+ this,
1253
+ /** @type {Batch} */
1254
+ p
1255
+ ));
1256
+ }));
1257
+ }, En = function() {
1258
+ try {
1259
+ if (this.is_pending = this.has_pending_snippet(), g(this, Oe, 0), g(this, Ye, 0), g(this, K, we(() => {
1260
+ f(this, Be).call(this, f(this, q));
1261
+ })), f(this, Oe) > 0) {
1262
+ var t = g(this, Ee, document.createDocumentFragment());
1263
+ Zr(f(this, K), t);
1264
+ const n = (
1265
+ /** @type {(anchor: Node) => void} */
1266
+ f(this, W).pending
1267
+ );
1268
+ g(this, L, we(() => n(f(this, q))));
1269
+ } else
1270
+ m(this, k, zt).call(
1271
+ this,
1272
+ /** @type {Batch} */
1273
+ p
1274
+ );
1275
+ } catch (n) {
1276
+ this.error(n);
1277
+ }
1278
+ }, /**
1279
+ * @param {Batch} batch
1280
+ */
1281
+ zt = function(t) {
1282
+ this.is_pending = !1, t.transfer_effects(f(this, Rt), f(this, Mt));
1283
+ }, /**
1284
+ * @template T
1285
+ * @param {() => T} fn
1286
+ */
1287
+ Gt = function(t) {
1288
+ var n = w, r = b, s = T;
1289
+ te(f(this, j)), ee(f(this, j)), ht(f(this, j).ctx);
1290
+ try {
1291
+ return be.ensure(), t();
1292
+ } catch (i) {
1293
+ return Tr(i), null;
1294
+ } finally {
1295
+ te(n), ee(r), ht(s);
1296
+ }
1297
+ }, /**
1298
+ * Updates the pending count associated with the currently visible pending snippet,
1299
+ * if any, such that we can replace the snippet with content once work is done
1300
+ * @param {1 | -1} d
1301
+ * @param {Batch} batch
1302
+ */
1303
+ Tn = function(t, n) {
1304
+ var r;
1305
+ if (!this.has_pending_snippet()) {
1306
+ this.parent && m(r = this.parent, k, Tn).call(r, t, n);
1307
+ return;
1308
+ }
1309
+ g(this, Oe, f(this, Oe) + t), f(this, Oe) === 0 && (m(this, k, zt).call(this, n), f(this, L) && Tt(f(this, L), () => {
1310
+ g(this, L, null);
1311
+ }), f(this, Ee) && (f(this, q).before(f(this, Ee)), g(this, Ee, null)));
1312
+ }, /**
1313
+ * @param {unknown} error
1314
+ */
1315
+ Sn = function(t) {
1316
+ f(this, K) && (V(f(this, K)), g(this, K, null)), f(this, L) && (V(f(this, L)), g(this, L, null)), f(this, U) && (V(f(this, U)), g(this, U, null)), N && (oe(
1317
+ /** @type {TemplateNode} */
1318
+ f(this, Ot)
1319
+ ), Vs(), oe(Bs()));
1320
+ var n = f(this, W).onerror;
1321
+ let r = f(this, W).failed;
1322
+ var s = !1, i = !1;
1323
+ const a = () => {
1324
+ if (s) {
1325
+ Hs();
1326
+ return;
1327
+ }
1328
+ s = !0, i && Ds(), f(this, U) !== null && Tt(f(this, U), () => {
1329
+ g(this, U, null);
1330
+ }), m(this, k, Gt).call(this, () => {
1331
+ m(this, k, En).call(this);
1332
+ });
1333
+ }, o = (l) => {
1334
+ try {
1335
+ i = !0, n == null || n(l, a), i = !1;
1336
+ } catch (u) {
1337
+ Re(u, f(this, j) && f(this, j).parent);
1338
+ }
1339
+ r && g(this, U, m(this, k, Gt).call(this, () => {
1340
+ try {
1341
+ return we(() => {
1342
+ var u = (
1343
+ /** @type {Effect} */
1344
+ w
1345
+ );
1346
+ u.b = this, u.f |= vn, r(
1347
+ f(this, q),
1348
+ () => l,
1349
+ () => a
1350
+ );
1351
+ });
1352
+ } catch (u) {
1353
+ return Re(
1354
+ u,
1355
+ /** @type {Effect} */
1356
+ f(this, j).parent
1357
+ ), null;
1358
+ }
1359
+ }));
1360
+ };
1361
+ Ce(() => {
1362
+ var l;
1363
+ try {
1364
+ l = this.transform_error(t);
1365
+ } catch (u) {
1366
+ Re(u, f(this, j) && f(this, j).parent);
1367
+ return;
1368
+ }
1369
+ l !== null && typeof l == "object" && typeof /** @type {any} */
1370
+ l.then == "function" ? l.then(
1371
+ o,
1372
+ /** @param {unknown} e */
1373
+ (u) => Re(u, f(this, j) && f(this, j).parent)
1374
+ ) : o(l);
1375
+ });
1376
+ };
1377
+ function ai(e, t, n, r) {
1378
+ const s = Ft() ? Fn : ui;
1379
+ var i = e.filter((c) => !c.settled);
1380
+ if (n.length === 0 && i.length === 0) {
1381
+ r(t.map(s));
1382
+ return;
1383
+ }
1384
+ var a = (
1385
+ /** @type {Effect} */
1386
+ w
1387
+ ), o = li(), l = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((c) => c.promise)) : null;
1388
+ function u(c) {
1389
+ if ((a.f & ge) === 0) {
1390
+ o();
1391
+ try {
1392
+ r(c);
1393
+ } catch (v) {
1394
+ Re(v, a);
1395
+ }
1396
+ Jt();
1397
+ }
1398
+ }
1399
+ var _ = Pr();
1400
+ if (n.length === 0) {
1401
+ l.then(() => u(t.map(s))).finally(_);
1402
+ return;
1403
+ }
1404
+ function d() {
1405
+ Promise.all(n.map((c) => /* @__PURE__ */ oi(c))).then((c) => u([...t.map(s), ...c])).catch((c) => Re(c, a)).finally(_);
1406
+ }
1407
+ l ? l.then(() => {
1408
+ o(), d(), Jt();
1409
+ }) : d();
1410
+ }
1411
+ function li() {
1412
+ var e = (
1413
+ /** @type {Effect} */
1414
+ w
1415
+ ), t = b, n = T, r = (
1416
+ /** @type {Batch} */
1417
+ p
1418
+ );
1419
+ return function(i = !0) {
1420
+ te(e), ee(t), ht(n), i && (e.f & ge) === 0 && (r == null || r.activate(), r == null || r.apply());
1421
+ };
1422
+ }
1423
+ function Jt(e = !0) {
1424
+ te(null), ee(null), ht(null), e && (p == null || p.deactivate());
1425
+ }
1426
+ function Pr() {
1427
+ var e = (
1428
+ /** @type {Effect} */
1429
+ w
1430
+ ), t = (
1431
+ /** @type {Boundary} */
1432
+ e.b
1433
+ ), n = (
1434
+ /** @type {Batch} */
1435
+ p
1436
+ ), r = t.is_rendered();
1437
+ return t.update_pending_count(1, n), n.increment(r, e), () => {
1438
+ t.update_pending_count(-1, n), n.decrement(r, e);
1439
+ };
1440
+ }
1441
+ // @__NO_SIDE_EFFECTS__
1442
+ function Fn(e) {
1443
+ var t = D | I;
1444
+ return w !== null && (w.f |= Xe), {
1445
+ ctx: T,
1446
+ deps: null,
1447
+ effects: null,
1448
+ equals: pr,
1449
+ f: t,
1450
+ fn: e,
1451
+ reactions: null,
1452
+ rv: 0,
1453
+ v: (
1454
+ /** @type {V} */
1455
+ M
1456
+ ),
1457
+ wv: 0,
1458
+ parent: w,
1459
+ ac: null
1460
+ };
1461
+ }
1462
+ const Bt = Symbol("obsolete");
1463
+ // @__NO_SIDE_EFFECTS__
1464
+ function oi(e, t, n) {
1465
+ let r = (
1466
+ /** @type {Effect | null} */
1467
+ w
1468
+ );
1469
+ r === null && Es();
1470
+ var s = (
1471
+ /** @type {Promise<V>} */
1472
+ /** @type {unknown} */
1473
+ void 0
1474
+ ), i = jt(
1475
+ /** @type {V} */
1476
+ M
1477
+ ), a = !b, o = /* @__PURE__ */ new Set();
1478
+ return mi(() => {
1479
+ var v;
1480
+ var l = (
1481
+ /** @type {Effect} */
1482
+ w
1483
+ ), u = lr();
1484
+ s = u.promise;
1485
+ try {
1486
+ Promise.resolve(e()).then(u.resolve, (h) => {
1487
+ h !== rn && u.reject(h);
1488
+ }).finally(Jt);
1489
+ } catch (h) {
1490
+ u.reject(h), Jt();
1491
+ }
1492
+ var _ = (
1493
+ /** @type {Batch} */
1494
+ p
1495
+ );
1496
+ if (a) {
1497
+ if ((l.f & De) !== 0)
1498
+ var d = Pr();
1499
+ if (
1500
+ /** @type {Boundary} */
1501
+ r.b.is_rendered()
1502
+ )
1503
+ (v = _.async_deriveds.get(l)) == null || v.reject(Bt);
1504
+ else
1505
+ for (const h of o.values())
1506
+ h.reject(Bt);
1507
+ o.add(u), _.async_deriveds.set(l, u);
1508
+ }
1509
+ const c = (h, A = void 0) => {
1510
+ d == null || d(), o.delete(u), A !== Bt && (_.activate(), A ? (i.f |= Me, Zt(i, A)) : ((i.f & Me) !== 0 && (i.f ^= Me), Zt(i, h)), _.deactivate());
1511
+ };
1512
+ u.promise.then(c, (h) => c(null, h || "unknown"));
1513
+ }), un(() => {
1514
+ for (const l of o)
1515
+ l.reject(Bt);
1516
+ }), new Promise((l) => {
1517
+ function u(_) {
1518
+ function d() {
1519
+ _ === s ? l(i) : u(s);
1520
+ }
1521
+ _.then(d, d);
1522
+ }
1523
+ u(s);
1524
+ });
1525
+ }
1526
+ // @__NO_SIDE_EFFECTS__
1527
+ function Lf(e) {
1528
+ const t = /* @__PURE__ */ Fn(e);
1529
+ return Qr(t), t;
1530
+ }
1531
+ // @__NO_SIDE_EFFECTS__
1532
+ function ui(e) {
1533
+ const t = /* @__PURE__ */ Fn(e);
1534
+ return t.equals = yr, t;
1535
+ }
1536
+ function ci(e) {
1537
+ var t = e.effects;
1538
+ if (t !== null) {
1539
+ e.effects = null;
1540
+ for (var n = 0; n < t.length; n += 1)
1541
+ V(
1542
+ /** @type {Effect} */
1543
+ t[n]
1544
+ );
1545
+ }
1546
+ }
1547
+ function jn(e) {
1548
+ var t, n = w, r = e.parent;
1549
+ if (!Ie && r !== null && e.v !== M && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead
1550
+ (r.f & (ge | J)) !== 0)
1551
+ return Fs(), e.v;
1552
+ te(r);
1553
+ try {
1554
+ e.f &= ~We, ci(e), t = ns(e);
1555
+ } finally {
1556
+ te(n);
1557
+ }
1558
+ return t;
1559
+ }
1560
+ function Lr(e) {
1561
+ var t = jn(e);
1562
+ if (!e.equals(t) && (e.wv = Qt(), (!(p != null && p.is_fork) || e.deps === null) && (p !== null ? (p.capture(e, t, !0), wt == null || wt.capture(e, t, !0)) : e.v = t, e.deps === null))) {
1563
+ x(e, R);
1564
+ return;
1565
+ }
1566
+ Ie || (C !== null ? (Hn() || p != null && p.is_fork) && C.set(e, t) : In(e));
1567
+ }
1568
+ function di(e) {
1569
+ var t, n;
1570
+ if (e.effects !== null)
1571
+ for (const r of e.effects)
1572
+ (r.teardown || r.ac) && ((t = r.teardown) == null || t.call(r), (n = r.ac) == null || n.abort(rn), r.fn !== null && (r.teardown = pe), r.ac = null, kt(r, 0), Bn(r));
1573
+ }
1574
+ function Fr(e) {
1575
+ if (e.effects !== null)
1576
+ for (const t of e.effects)
1577
+ t.teardown && t.fn !== null && Ke(t);
1578
+ }
1579
+ let At = /* @__PURE__ */ new Set();
1580
+ const ze = /* @__PURE__ */ new Map();
1581
+ function hi(e) {
1582
+ At = e;
1583
+ }
1584
+ let jr = !1;
1585
+ function jt(e, t) {
1586
+ var n = {
1587
+ f: 0,
1588
+ // TODO ideally we could skip this altogether, but it causes type errors
1589
+ v: e,
1590
+ reactions: null,
1591
+ equals: pr,
1592
+ rv: 0,
1593
+ wv: 0
1594
+ };
1595
+ return n;
1596
+ }
1597
+ // @__NO_SIDE_EFFECTS__
1598
+ function ke(e, t) {
1599
+ const n = jt(e);
1600
+ return Qr(n), n;
1601
+ }
1602
+ // @__NO_SIDE_EFFECTS__
1603
+ function _i(e, t = !1, n = !0) {
1604
+ var s;
1605
+ const r = jt(e);
1606
+ return t || (r.equals = yr), Lt && n && T !== null && T.l !== null && ((s = T.l).s ?? (s.s = [])).push(r), r;
1607
+ }
1608
+ function Ff(e, t) {
1609
+ return _e(
1610
+ e,
1611
+ Je(() => ve(e))
1612
+ ), t;
1613
+ }
1614
+ function _e(e, t, n = !1) {
1615
+ b !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
1616
+ // to ensure we error if state is set inside an inspect effect
1617
+ (!ae || (b.f & St) !== 0) && Ft() && (b.f & (D | fe | rt | St)) !== 0 && (Z === null || !Ue.call(Z, e)) && Is();
1618
+ let r = n ? yt(t) : t;
1619
+ return Zt(e, r, Ut);
1620
+ }
1621
+ function Zt(e, t, n = null) {
1622
+ if (!e.equals(t)) {
1623
+ ze.set(e, Ie ? t : e.v);
1624
+ var r = be.ensure();
1625
+ if (r.capture(e, t), (e.f & D) !== 0) {
1626
+ const s = (
1627
+ /** @type {Derived} */
1628
+ e
1629
+ );
1630
+ (e.f & I) !== 0 && jn(s), C === null && In(s);
1631
+ }
1632
+ e.wv = Qt(), Vr(e, I, n), Ft() && w !== null && (w.f & R) !== 0 && (w.f & (ye | Se)) === 0 && (G === null ? Ai([e]) : G.push(e)), !r.is_fork && At.size > 0 && !jr && Hr();
1633
+ }
1634
+ return t;
1635
+ }
1636
+ function Hr() {
1637
+ jr = !1;
1638
+ for (const e of At) {
1639
+ (e.f & R) !== 0 && x(e, le);
1640
+ let t;
1641
+ try {
1642
+ t = vt(e);
1643
+ } catch {
1644
+ t = !0;
1645
+ }
1646
+ t && Ke(e);
1647
+ }
1648
+ At.clear();
1649
+ }
1650
+ function jf(e, t = 1) {
1651
+ var n = ve(e), r = t === 1 ? n++ : n--;
1652
+ return _e(e, n), r;
1653
+ }
1654
+ function Et(e) {
1655
+ _e(e, e.v + 1);
1656
+ }
1657
+ function Vr(e, t, n) {
1658
+ var r = e.reactions;
1659
+ if (r !== null)
1660
+ for (var s = Ft(), i = r.length, a = 0; a < i; a++) {
1661
+ var o = r[a], l = o.f;
1662
+ if (!(!s && o === w)) {
1663
+ var u = (l & I) === 0;
1664
+ if (u && x(o, t), (l & St) !== 0)
1665
+ At.add(
1666
+ /** @type {Effect} */
1667
+ o
1668
+ );
1669
+ else if ((l & D) !== 0) {
1670
+ var _ = (
1671
+ /** @type {Derived} */
1672
+ o
1673
+ );
1674
+ C == null || C.delete(_), (l & We) === 0 && (l & X && (w === null || (w.f & Kt) === 0) && (o.f |= We), Vr(_, le, n));
1675
+ } else if (u) {
1676
+ var d = (
1677
+ /** @type {Effect} */
1678
+ o
1679
+ );
1680
+ (l & fe) !== 0 && se !== null && se.add(d), n !== null ? n.push(d) : Ln(d);
1681
+ }
1682
+ }
1683
+ }
1684
+ }
1685
+ function yt(e) {
1686
+ if (typeof e != "object" || e === null || $e in e)
1687
+ return e;
1688
+ const t = fr(e);
1689
+ if (t !== vs && t !== ps)
1690
+ return e;
1691
+ var n = /* @__PURE__ */ new Map(), r = sr(e), s = /* @__PURE__ */ ke(0), i = Ge, a = (o) => {
1692
+ if (Ge === i)
1693
+ return o();
1694
+ var l = b, u = Ge;
1695
+ ee(null), er(i);
1696
+ var _ = o();
1697
+ return ee(l), er(u), _;
1698
+ };
1699
+ return r && n.set("length", /* @__PURE__ */ ke(
1700
+ /** @type {any[]} */
1701
+ e.length
1702
+ )), new Proxy(
1703
+ /** @type {any} */
1704
+ e,
1705
+ {
1706
+ defineProperty(o, l, u) {
1707
+ (!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && Ms();
1708
+ var _ = n.get(l);
1709
+ return _ === void 0 ? a(() => {
1710
+ var d = /* @__PURE__ */ ke(u.value);
1711
+ return n.set(l, d), d;
1712
+ }) : _e(_, u.value, !0), !0;
1713
+ },
1714
+ deleteProperty(o, l) {
1715
+ var u = n.get(l);
1716
+ if (u === void 0) {
1717
+ if (l in o) {
1718
+ const _ = a(() => /* @__PURE__ */ ke(M));
1719
+ n.set(l, _), Et(s);
1720
+ }
1721
+ } else
1722
+ _e(u, M), Et(s);
1723
+ return !0;
1724
+ },
1725
+ get(o, l, u) {
1726
+ var v;
1727
+ if (l === $e)
1728
+ return e;
1729
+ var _ = n.get(l), d = l in o;
1730
+ if (_ === void 0 && (!d || (v = bt(o, l)) != null && v.writable) && (_ = a(() => {
1731
+ var h = yt(d ? o[l] : M), A = /* @__PURE__ */ ke(h);
1732
+ return A;
1733
+ }), n.set(l, _)), _ !== void 0) {
1734
+ var c = ve(_);
1735
+ return c === M ? void 0 : c;
1736
+ }
1737
+ return Reflect.get(o, l, u);
1738
+ },
1739
+ getOwnPropertyDescriptor(o, l) {
1740
+ var u = Reflect.getOwnPropertyDescriptor(o, l);
1741
+ if (u && "value" in u) {
1742
+ var _ = n.get(l);
1743
+ _ && (u.value = ve(_));
1744
+ } else if (u === void 0) {
1745
+ var d = n.get(l), c = d == null ? void 0 : d.v;
1746
+ if (d !== void 0 && c !== M)
1747
+ return {
1748
+ enumerable: !0,
1749
+ configurable: !0,
1750
+ value: c,
1751
+ writable: !0
1752
+ };
1753
+ }
1754
+ return u;
1755
+ },
1756
+ has(o, l) {
1757
+ var c;
1758
+ if (l === $e)
1759
+ return !0;
1760
+ var u = n.get(l), _ = u !== void 0 && u.v !== M || Reflect.has(o, l);
1761
+ if (u !== void 0 || w !== null && (!_ || (c = bt(o, l)) != null && c.writable)) {
1762
+ u === void 0 && (u = a(() => {
1763
+ var v = _ ? yt(o[l]) : M, h = /* @__PURE__ */ ke(v);
1764
+ return h;
1765
+ }), n.set(l, u));
1766
+ var d = ve(u);
1767
+ if (d === M)
1768
+ return !1;
1769
+ }
1770
+ return _;
1771
+ },
1772
+ set(o, l, u, _) {
1773
+ var Ze;
1774
+ var d = n.get(l), c = l in o;
1775
+ if (r && l === "length")
1776
+ for (var v = u; v < /** @type {Source<number>} */
1777
+ d.v; v += 1) {
1778
+ var h = n.get(v + "");
1779
+ h !== void 0 ? _e(h, M) : v in o && (h = a(() => /* @__PURE__ */ ke(M)), n.set(v + "", h));
1780
+ }
1781
+ if (d === void 0)
1782
+ (!c || (Ze = bt(o, l)) != null && Ze.writable) && (d = a(() => /* @__PURE__ */ ke(void 0)), _e(d, yt(u)), n.set(l, d));
1783
+ else {
1784
+ c = d.v !== M;
1785
+ var A = a(() => yt(u));
1786
+ _e(d, A);
1787
+ }
1788
+ var O = Reflect.getOwnPropertyDescriptor(o, l);
1789
+ if (O != null && O.set && O.set.call(_, u), !c) {
1790
+ if (r && typeof l == "string") {
1791
+ var P = (
1792
+ /** @type {Source<number>} */
1793
+ n.get("length")
1794
+ ), re = Number(l);
1795
+ Number.isInteger(re) && re >= P.v && _e(P, re + 1);
1796
+ }
1797
+ Et(s);
1798
+ }
1799
+ return !0;
1800
+ },
1801
+ ownKeys(o) {
1802
+ ve(s);
1803
+ var l = Reflect.ownKeys(o).filter((d) => {
1804
+ var c = n.get(d);
1805
+ return c === void 0 || c.v !== M;
1806
+ });
1807
+ for (var [u, _] of n)
1808
+ _.v !== M && !(u in o) && l.push(u);
1809
+ return l;
1810
+ },
1811
+ setPrototypeOf() {
1812
+ Cs();
1813
+ }
1814
+ }
1815
+ );
1816
+ }
1817
+ function Xn(e) {
1818
+ try {
1819
+ if (e !== null && typeof e == "object" && $e in e)
1820
+ return e[$e];
1821
+ } catch {
1822
+ }
1823
+ return e;
1824
+ }
1825
+ function Hf(e, t) {
1826
+ return Object.is(Xn(e), Xn(t));
1827
+ }
1828
+ var Jn, Br, Yr, qr;
1829
+ function An() {
1830
+ if (Jn === void 0) {
1831
+ Jn = window, Br = /Firefox/.test(navigator.userAgent);
1832
+ var e = Element.prototype, t = Node.prototype, n = Text.prototype;
1833
+ Yr = bt(t, "firstChild").get, qr = bt(t, "nextSibling").get, $n(e) && (e[bs] = void 0, e[ys] = null, e[ws] = void 0, e.__e = void 0), $n(n) && (n[pt] = void 0);
1834
+ }
1835
+ }
1836
+ function ue(e = "") {
1837
+ return document.createTextNode(e);
1838
+ }
1839
+ // @__NO_SIDE_EFFECTS__
1840
+ function z(e) {
1841
+ return (
1842
+ /** @type {TemplateNode | null} */
1843
+ Yr.call(e)
1844
+ );
1845
+ }
1846
+ // @__NO_SIDE_EFFECTS__
1847
+ function Ae(e) {
1848
+ return (
1849
+ /** @type {TemplateNode | null} */
1850
+ qr.call(e)
1851
+ );
1852
+ }
1853
+ function Vf(e, t) {
1854
+ if (!N)
1855
+ return /* @__PURE__ */ z(e);
1856
+ var n = /* @__PURE__ */ z(E);
1857
+ if (n === null)
1858
+ n = E.appendChild(ue());
1859
+ else if (t && n.nodeType !== Pt) {
1860
+ var r = ue();
1861
+ return n == null || n.before(r), oe(r), r;
1862
+ }
1863
+ return t && ln(
1864
+ /** @type {Text} */
1865
+ n
1866
+ ), oe(n), n;
1867
+ }
1868
+ function Bf(e, t = !1) {
1869
+ if (!N) {
1870
+ var n = /* @__PURE__ */ z(e);
1871
+ return n instanceof Comment && n.data === "" ? /* @__PURE__ */ Ae(n) : n;
1872
+ }
1873
+ if (t) {
1874
+ if ((E == null ? void 0 : E.nodeType) !== Pt) {
1875
+ var r = ue();
1876
+ return E == null || E.before(r), oe(r), r;
1877
+ }
1878
+ ln(
1879
+ /** @type {Text} */
1880
+ E
1881
+ );
1882
+ }
1883
+ return E;
1884
+ }
1885
+ function Yf(e, t = 1, n = !1) {
1886
+ let r = N ? E : e;
1887
+ for (var s; t--; )
1888
+ s = r, r = /** @type {TemplateNode} */
1889
+ /* @__PURE__ */ Ae(r);
1890
+ if (!N)
1891
+ return r;
1892
+ if (n) {
1893
+ if ((r == null ? void 0 : r.nodeType) !== Pt) {
1894
+ var i = ue();
1895
+ return r === null ? s == null || s.after(i) : r.before(i), oe(i), i;
1896
+ }
1897
+ ln(
1898
+ /** @type {Text} */
1899
+ r
1900
+ );
1901
+ }
1902
+ return oe(r), r;
1903
+ }
1904
+ function Ur(e) {
1905
+ e.textContent = "";
1906
+ }
1907
+ function vi() {
1908
+ return !1;
1909
+ }
1910
+ function pi(e, t, n) {
1911
+ return (
1912
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
1913
+ document.createElementNS(t ?? Ls, e, void 0)
1914
+ );
1915
+ }
1916
+ function ln(e) {
1917
+ if (
1918
+ /** @type {string} */
1919
+ e.nodeValue.length < 65536
1920
+ )
1921
+ return;
1922
+ let t = e.nextSibling;
1923
+ for (; t !== null && t.nodeType === Pt; )
1924
+ t.remove(), e.nodeValue += /** @type {string} */
1925
+ t.nodeValue, t = e.nextSibling;
1926
+ }
1927
+ function qf(e, t) {
1928
+ if (t) {
1929
+ const n = document.body;
1930
+ e.autofocus = !0, Ce(() => {
1931
+ document.activeElement === n && e.focus();
1932
+ });
1933
+ }
1934
+ }
1935
+ function Uf(e) {
1936
+ N && /* @__PURE__ */ z(e) !== null && Ur(e);
1937
+ }
1938
+ let Zn = !1;
1939
+ function gi() {
1940
+ Zn || (Zn = !0, document.addEventListener(
1941
+ "reset",
1942
+ (e) => {
1943
+ Promise.resolve().then(() => {
1944
+ var t;
1945
+ if (!e.defaultPrevented)
1946
+ for (
1947
+ const n of
1948
+ /**@type {HTMLFormElement} */
1949
+ e.target.elements
1950
+ )
1951
+ (t = n[qt]) == null || t.call(n);
1952
+ });
1953
+ },
1954
+ // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
1955
+ { capture: !0 }
1956
+ ));
1957
+ }
1958
+ function on(e) {
1959
+ var t = b, n = w;
1960
+ ee(null), te(null);
1961
+ try {
1962
+ return e();
1963
+ } finally {
1964
+ ee(t), te(n);
1965
+ }
1966
+ }
1967
+ function $f(e, t, n, r = n) {
1968
+ e.addEventListener(t, () => on(n));
1969
+ const s = (
1970
+ /** @type {any} */
1971
+ e[qt]
1972
+ );
1973
+ s ? e[qt] = () => {
1974
+ s(), r(!0);
1975
+ } : e[qt] = () => r(!0), gi();
1976
+ }
1977
+ function $r(e) {
1978
+ w === null && (b === null && As(), Ss()), Ie && Ts();
1979
+ }
1980
+ function yi(e, t) {
1981
+ var n = t.last;
1982
+ n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
1983
+ }
1984
+ function ne(e, t) {
1985
+ var n = w;
1986
+ n !== null && (n.f & J) !== 0 && (e |= J);
1987
+ var r = {
1988
+ ctx: T,
1989
+ deps: null,
1990
+ nodes: null,
1991
+ f: e | I | X,
1992
+ first: null,
1993
+ fn: t,
1994
+ last: null,
1995
+ next: null,
1996
+ parent: n,
1997
+ b: n && n.b,
1998
+ prev: null,
1999
+ teardown: null,
2000
+ wv: 0,
2001
+ ac: null
2002
+ };
2003
+ p == null || p.register_created_effect(r);
2004
+ var s = r;
2005
+ if ((e & ut) !== 0)
2006
+ nt !== null ? nt.push(r) : be.ensure().schedule(r);
2007
+ else if (t !== null) {
2008
+ try {
2009
+ Ke(r);
2010
+ } catch (a) {
2011
+ throw V(r), a;
2012
+ }
2013
+ s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
2014
+ (s.f & Xe) === 0 && (s = s.first, (e & fe) !== 0 && (e & ct) !== 0 && s !== null && (s.f |= ct));
2015
+ }
2016
+ if (s !== null && (s.parent = n, n !== null && yi(s, n), b !== null && (b.f & D) !== 0 && (e & Se) === 0)) {
2017
+ var i = (
2018
+ /** @type {Derived} */
2019
+ b
2020
+ );
2021
+ (i.effects ?? (i.effects = [])).push(s);
2022
+ }
2023
+ return r;
2024
+ }
2025
+ function Hn() {
2026
+ return b !== null && !ae;
2027
+ }
2028
+ function un(e) {
2029
+ const t = ne(Dt, null);
2030
+ return x(t, R), t.teardown = e, t;
2031
+ }
2032
+ function bi(e) {
2033
+ $r();
2034
+ var t = (
2035
+ /** @type {Effect} */
2036
+ w.f
2037
+ ), n = !b && (t & ye) !== 0 && (t & De) === 0;
2038
+ if (n) {
2039
+ var r = (
2040
+ /** @type {ComponentContext} */
2041
+ T
2042
+ );
2043
+ (r.e ?? (r.e = [])).push(e);
2044
+ } else
2045
+ return zr(e);
2046
+ }
2047
+ function zr(e) {
2048
+ return ne(ut | or, e);
2049
+ }
2050
+ function zf(e) {
2051
+ return $r(), ne(Dt | or, e);
2052
+ }
2053
+ function Gf(e) {
2054
+ be.ensure();
2055
+ const t = ne(Se | Xe, e);
2056
+ return () => {
2057
+ V(t);
2058
+ };
2059
+ }
2060
+ function wi(e) {
2061
+ be.ensure();
2062
+ const t = ne(Se | Xe, e);
2063
+ return (n = {}) => new Promise((r) => {
2064
+ n.outro ? Tt(t, () => {
2065
+ V(t), r(void 0);
2066
+ }) : (V(t), r(void 0));
2067
+ });
2068
+ }
2069
+ function Wf(e) {
2070
+ return ne(ut, e);
2071
+ }
2072
+ function Kf(e, t) {
2073
+ var n = (
2074
+ /** @type {ComponentContextLegacy} */
2075
+ T
2076
+ ), r = { effect: null, ran: !1, deps: e };
2077
+ n.l.$.push(r), r.effect = Vn(() => {
2078
+ if (e(), !r.ran) {
2079
+ r.ran = !0;
2080
+ var s = (
2081
+ /** @type {Effect} */
2082
+ w
2083
+ );
2084
+ try {
2085
+ te(s.parent), Je(t);
2086
+ } finally {
2087
+ te(s);
2088
+ }
2089
+ }
2090
+ });
2091
+ }
2092
+ function Xf() {
2093
+ var e = (
2094
+ /** @type {ComponentContextLegacy} */
2095
+ T
2096
+ );
2097
+ Vn(() => {
2098
+ for (var t of e.l.$) {
2099
+ t.deps();
2100
+ var n = t.effect;
2101
+ (n.f & R) !== 0 && n.deps !== null && x(n, le), vt(n) && Ke(n), t.ran = !1;
2102
+ }
2103
+ });
2104
+ }
2105
+ function mi(e) {
2106
+ return ne(rt | Xe, e);
2107
+ }
2108
+ function Vn(e, t = 0) {
2109
+ return ne(Dt | t, e);
2110
+ }
2111
+ function Jf(e, t = [], n = [], r = []) {
2112
+ ai(r, t, n, (s) => {
2113
+ ne(Dt, () => e(...s.map(ve)));
2114
+ });
2115
+ }
2116
+ function Gr(e, t = 0) {
2117
+ var n = ne(fe | t, e);
2118
+ return n;
2119
+ }
2120
+ function Zf(e, t = 0) {
2121
+ var n = ne(Mn | t, e);
2122
+ return n;
2123
+ }
2124
+ function we(e) {
2125
+ return ne(ye | Xe, e);
2126
+ }
2127
+ function Wr(e) {
2128
+ var t = e.teardown;
2129
+ if (t !== null) {
2130
+ const n = Ie, r = b;
2131
+ Qn(!0), ee(null);
2132
+ try {
2133
+ t.call(null);
2134
+ } finally {
2135
+ Qn(n), ee(r);
2136
+ }
2137
+ }
2138
+ }
2139
+ function Bn(e, t = !1) {
2140
+ var n = e.first;
2141
+ for (e.first = e.last = null; n !== null; ) {
2142
+ const s = n.ac;
2143
+ s !== null && on(() => {
2144
+ s.abort(rn);
2145
+ });
2146
+ var r = n.next;
2147
+ (n.f & Se) !== 0 ? n.parent = null : V(n, t), n = r;
2148
+ }
2149
+ }
2150
+ function Ei(e) {
2151
+ for (var t = e.first; t !== null; ) {
2152
+ var n = t.next;
2153
+ (t.f & ye) === 0 && V(t), t = n;
2154
+ }
2155
+ }
2156
+ function V(e, t = !0) {
2157
+ var n = !1;
2158
+ (t || (e.f & gs) !== 0) && e.nodes !== null && e.nodes.end !== null && (Ti(
2159
+ e.nodes.start,
2160
+ /** @type {TemplateNode} */
2161
+ e.nodes.end
2162
+ ), n = !0), x(e, zn), Bn(e, t && !n), kt(e, 0);
2163
+ var r = e.nodes && e.nodes.t;
2164
+ if (r !== null)
2165
+ for (const i of r)
2166
+ i.stop();
2167
+ Wr(e), e.f ^= zn, e.f |= ge;
2168
+ var s = e.parent;
2169
+ s !== null && s.first !== null && Kr(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = e.b = null;
2170
+ }
2171
+ function Ti(e, t) {
2172
+ for (; e !== null; ) {
2173
+ var n = e === t ? null : /* @__PURE__ */ Ae(e);
2174
+ e.remove(), e = n;
2175
+ }
2176
+ }
2177
+ function Kr(e) {
2178
+ var t = e.parent, n = e.prev, r = e.next;
2179
+ n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
2180
+ }
2181
+ function Tt(e, t, n = !0) {
2182
+ var r = [];
2183
+ Xr(e, r, !0);
2184
+ var s = () => {
2185
+ n && V(e), t && t();
2186
+ }, i = r.length;
2187
+ if (i > 0) {
2188
+ var a = () => --i || s();
2189
+ for (var o of r)
2190
+ o.out(a);
2191
+ } else
2192
+ s();
2193
+ }
2194
+ function Xr(e, t, n) {
2195
+ if ((e.f & J) === 0) {
2196
+ e.f ^= J;
2197
+ var r = e.nodes && e.nodes.t;
2198
+ if (r !== null)
2199
+ for (const o of r)
2200
+ (o.is_global || n) && t.push(o);
2201
+ for (var s = e.first; s !== null; ) {
2202
+ var i = s.next;
2203
+ if ((s.f & Se) === 0) {
2204
+ var a = (s.f & ct) !== 0 || // If this is a branch effect without a block effect parent,
2205
+ // it means the parent block effect was pruned. In that case,
2206
+ // transparency information was transferred to the branch effect.
2207
+ (s.f & ye) !== 0 && (e.f & fe) !== 0;
2208
+ Xr(s, t, a ? n : !1);
2209
+ }
2210
+ s = i;
2211
+ }
2212
+ }
2213
+ }
2214
+ function Si(e) {
2215
+ Jr(e, !0);
2216
+ }
2217
+ function Jr(e, t) {
2218
+ if ((e.f & J) !== 0) {
2219
+ e.f ^= J, (e.f & R) === 0 && (x(e, I), be.ensure().schedule(e));
2220
+ for (var n = e.first; n !== null; ) {
2221
+ var r = n.next, s = (n.f & ct) !== 0 || (n.f & ye) !== 0;
2222
+ Jr(n, s ? t : !1), n = r;
2223
+ }
2224
+ var i = e.nodes && e.nodes.t;
2225
+ if (i !== null)
2226
+ for (const a of i)
2227
+ (a.is_global || t) && a.in();
2228
+ }
2229
+ }
2230
+ function Zr(e, t) {
2231
+ if (e.nodes)
2232
+ for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
2233
+ var s = n === r ? null : /* @__PURE__ */ Ae(n);
2234
+ t.append(n), n = s;
2235
+ }
2236
+ }
2237
+ let Wt = !1, Ie = !1;
2238
+ function Qn(e) {
2239
+ Ie = e;
2240
+ }
2241
+ let b = null, ae = !1;
2242
+ function ee(e) {
2243
+ b = e;
2244
+ }
2245
+ let w = null;
2246
+ function te(e) {
2247
+ w = e;
2248
+ }
2249
+ let Z = null;
2250
+ function Qr(e) {
2251
+ b !== null && (Z === null ? Z = [e] : Z.push(e));
2252
+ }
2253
+ let H = null, B = 0, G = null;
2254
+ function Ai(e) {
2255
+ G = e;
2256
+ }
2257
+ let es = 1, Le = 0, Ge = Le;
2258
+ function er(e) {
2259
+ Ge = e;
2260
+ }
2261
+ function Qt() {
2262
+ return ++es;
2263
+ }
2264
+ function vt(e) {
2265
+ var t = e.f;
2266
+ if ((t & I) !== 0)
2267
+ return !0;
2268
+ if (t & D && (e.f &= ~We), (t & le) !== 0) {
2269
+ for (var n = (
2270
+ /** @type {Value[]} */
2271
+ e.deps
2272
+ ), r = n.length, s = 0; s < r; s++) {
2273
+ var i = n[s];
2274
+ if (vt(
2275
+ /** @type {Derived} */
2276
+ i
2277
+ ) && Lr(
2278
+ /** @type {Derived} */
2279
+ i
2280
+ ), i.wv > e.wv)
2281
+ return !0;
2282
+ }
2283
+ (t & X) !== 0 && // During time traveling we don't want to reset the status so that
2284
+ // traversal of the graph in the other batches still happens
2285
+ C === null && x(e, R);
2286
+ }
2287
+ return !1;
2288
+ }
2289
+ function ts(e, t, n = !0) {
2290
+ var r = e.reactions;
2291
+ if (r !== null && !(Z !== null && Ue.call(Z, e)))
2292
+ for (var s = 0; s < r.length; s++) {
2293
+ var i = r[s];
2294
+ (i.f & D) !== 0 ? ts(
2295
+ /** @type {Derived} */
2296
+ i,
2297
+ t,
2298
+ !1
2299
+ ) : t === i && (n ? x(i, I) : (i.f & R) !== 0 && x(i, le), Ln(
2300
+ /** @type {Effect} */
2301
+ i
2302
+ ));
2303
+ }
2304
+ }
2305
+ function ns(e) {
2306
+ var A;
2307
+ var t = H, n = B, r = G, s = b, i = Z, a = T, o = ae, l = Ge, u = e.f;
2308
+ H = /** @type {null | Value[]} */
2309
+ null, B = 0, G = null, b = (u & (ye | Se)) === 0 ? e : null, Z = null, ht(e.ctx), ae = !1, Ge = ++Le, e.ac !== null && (on(() => {
2310
+ e.ac.abort(rn);
2311
+ }), e.ac = null);
2312
+ try {
2313
+ e.f |= Kt;
2314
+ var _ = (
2315
+ /** @type {Function} */
2316
+ e.fn
2317
+ ), d = _();
2318
+ e.f |= De;
2319
+ var c = e.deps, v = p == null ? void 0 : p.is_fork;
2320
+ if (H !== null) {
2321
+ var h;
2322
+ if (v || kt(e, B), c !== null && B > 0)
2323
+ for (c.length = B + H.length, h = 0; h < H.length; h++)
2324
+ c[B + h] = H[h];
2325
+ else
2326
+ e.deps = c = H;
2327
+ if (Hn() && (e.f & X) !== 0)
2328
+ for (h = B; h < c.length; h++)
2329
+ ((A = c[h]).reactions ?? (A.reactions = [])).push(e);
2330
+ } else !v && c !== null && B < c.length && (kt(e, B), c.length = B);
2331
+ if (Ft() && G !== null && !ae && c !== null && (e.f & (D | le | I)) === 0)
2332
+ for (h = 0; h < /** @type {Source[]} */
2333
+ G.length; h++)
2334
+ ts(
2335
+ G[h],
2336
+ /** @type {Effect} */
2337
+ e
2338
+ );
2339
+ if (s !== null && s !== e) {
2340
+ if (Le++, s.deps !== null)
2341
+ for (let O = 0; O < n; O += 1)
2342
+ s.deps[O].rv = Le;
2343
+ if (t !== null)
2344
+ for (const O of t)
2345
+ O.rv = Le;
2346
+ G !== null && (r === null ? r = G : r.push(.../** @type {Source[]} */
2347
+ G));
2348
+ }
2349
+ return (e.f & Me) !== 0 && (e.f ^= Me), d;
2350
+ } catch (O) {
2351
+ return Tr(O);
2352
+ } finally {
2353
+ e.f ^= Kt, H = t, B = n, G = r, b = s, Z = i, ht(a), ae = o, Ge = l;
2354
+ }
2355
+ }
2356
+ function ki(e, t) {
2357
+ let n = t.reactions;
2358
+ if (n !== null) {
2359
+ var r = ds.call(n, e);
2360
+ if (r !== -1) {
2361
+ var s = n.length - 1;
2362
+ s === 0 ? n = t.reactions = null : (n[r] = n[s], n.pop());
2363
+ }
2364
+ }
2365
+ if (n === null && (t.f & D) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
2366
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
2367
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
2368
+ (H === null || !Ue.call(H, t))) {
2369
+ var i = (
2370
+ /** @type {Derived} */
2371
+ t
2372
+ );
2373
+ (i.f & X) !== 0 && (i.f ^= X, i.f &= ~We), i.v !== M && In(i), di(i), kt(i, 0);
2374
+ }
2375
+ }
2376
+ function kt(e, t) {
2377
+ var n = e.deps;
2378
+ if (n !== null)
2379
+ for (var r = t; r < n.length; r++)
2380
+ ki(e, n[r]);
2381
+ }
2382
+ function Ke(e) {
2383
+ var t = e.f;
2384
+ if ((t & ge) === 0) {
2385
+ x(e, R);
2386
+ var n = w, r = Wt;
2387
+ w = e, Wt = !0;
2388
+ try {
2389
+ (t & (fe | Mn)) !== 0 ? Ei(e) : Bn(e), Wr(e);
2390
+ var s = ns(e);
2391
+ e.teardown = typeof s == "function" ? s : null, e.wv = es;
2392
+ var i;
2393
+ } finally {
2394
+ Wt = r, w = n;
2395
+ }
2396
+ }
2397
+ }
2398
+ async function xi() {
2399
+ await Promise.resolve(), Xt();
2400
+ }
2401
+ function Ni() {
2402
+ return be.ensure().settled();
2403
+ }
2404
+ function ve(e) {
2405
+ var t = e.f, n = (t & D) !== 0;
2406
+ if (b !== null && !ae) {
2407
+ var r = w !== null && (w.f & ge) !== 0;
2408
+ if (!r && (Z === null || !Ue.call(Z, e))) {
2409
+ var s = b.deps;
2410
+ if ((b.f & Kt) !== 0)
2411
+ e.rv < Le && (e.rv = Le, H === null && s !== null && s[B] === e ? B++ : H === null ? H = [e] : H.push(e));
2412
+ else {
2413
+ b.deps ?? (b.deps = []), Ue.call(b.deps, e) || b.deps.push(e);
2414
+ var i = e.reactions;
2415
+ i === null ? e.reactions = [b] : Ue.call(i, b) || i.push(b);
2416
+ }
2417
+ }
2418
+ }
2419
+ if (Ie && ze.has(e))
2420
+ return ze.get(e);
2421
+ if (n) {
2422
+ var a = (
2423
+ /** @type {Derived} */
2424
+ e
2425
+ );
2426
+ if (Ie) {
2427
+ var o = a.v;
2428
+ return ((a.f & R) === 0 && a.reactions !== null || ss(a)) && (o = jn(a)), ze.set(a, o), o;
2429
+ }
2430
+ var l = (a.f & X) === 0 && !ae && b !== null && (Wt || (b.f & X) !== 0), u = (a.f & De) === 0;
2431
+ vt(a) && (l && (a.f |= X), Lr(a)), l && !u && (Fr(a), rs(a));
2432
+ }
2433
+ if (C != null && C.has(e))
2434
+ return C.get(e);
2435
+ if ((e.f & Me) !== 0)
2436
+ throw e.v;
2437
+ return e.v;
2438
+ }
2439
+ function rs(e) {
2440
+ if (e.f |= X, e.deps !== null)
2441
+ for (const t of e.deps)
2442
+ (t.reactions ?? (t.reactions = [])).push(e), (t.f & D) !== 0 && (t.f & X) === 0 && (Fr(
2443
+ /** @type {Derived} */
2444
+ t
2445
+ ), rs(
2446
+ /** @type {Derived} */
2447
+ t
2448
+ ));
2449
+ }
2450
+ function ss(e) {
2451
+ if (e.v === M) return !0;
2452
+ if (e.deps === null) return !1;
2453
+ for (const t of e.deps)
2454
+ if (ze.has(t) || (t.f & D) !== 0 && ss(
2455
+ /** @type {Derived} */
2456
+ t
2457
+ ))
2458
+ return !0;
2459
+ return !1;
2460
+ }
2461
+ function Je(e) {
2462
+ var t = ae;
2463
+ try {
2464
+ return ae = !0, e();
2465
+ } finally {
2466
+ ae = t;
2467
+ }
2468
+ }
2469
+ function Qf(e) {
2470
+ if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
2471
+ if ($e in e)
2472
+ kn(e);
2473
+ else if (!Array.isArray(e))
2474
+ for (let t in e) {
2475
+ const n = e[t];
2476
+ typeof n == "object" && n && $e in n && kn(n);
2477
+ }
2478
+ }
2479
+ }
2480
+ function kn(e, t = /* @__PURE__ */ new Set()) {
2481
+ if (typeof e == "object" && e !== null && // We don't want to traverse DOM elements
2482
+ !(e instanceof EventTarget) && !t.has(e)) {
2483
+ t.add(e), e instanceof Date && e.getTime();
2484
+ for (let r in e)
2485
+ try {
2486
+ kn(e[r], t);
2487
+ } catch {
2488
+ }
2489
+ const n = fr(e);
2490
+ if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
2491
+ const r = _s(n);
2492
+ for (let s in r) {
2493
+ const i = r[s].get;
2494
+ if (i)
2495
+ try {
2496
+ i.call(e);
2497
+ } catch {
2498
+ }
2499
+ }
2500
+ }
2501
+ }
2502
+ }
2503
+ function ea(e) {
2504
+ return e.endsWith("capture") && e !== "gotpointercapture" && e !== "lostpointercapture";
2505
+ }
2506
+ const Oi = [
2507
+ "beforeinput",
2508
+ "click",
2509
+ "change",
2510
+ "dblclick",
2511
+ "contextmenu",
2512
+ "focusin",
2513
+ "focusout",
2514
+ "input",
2515
+ "keydown",
2516
+ "keyup",
2517
+ "mousedown",
2518
+ "mousemove",
2519
+ "mouseout",
2520
+ "mouseover",
2521
+ "mouseup",
2522
+ "pointerdown",
2523
+ "pointermove",
2524
+ "pointerout",
2525
+ "pointerover",
2526
+ "pointerup",
2527
+ "touchend",
2528
+ "touchmove",
2529
+ "touchstart"
2530
+ ];
2531
+ function ta(e) {
2532
+ return Oi.includes(e);
2533
+ }
2534
+ const Ri = {
2535
+ // no `class: 'className'` because we handle that separately
2536
+ formnovalidate: "formNoValidate",
2537
+ ismap: "isMap",
2538
+ nomodule: "noModule",
2539
+ playsinline: "playsInline",
2540
+ readonly: "readOnly",
2541
+ defaultvalue: "defaultValue",
2542
+ defaultchecked: "defaultChecked",
2543
+ srcobject: "srcObject",
2544
+ novalidate: "noValidate",
2545
+ allowfullscreen: "allowFullscreen",
2546
+ disablepictureinpicture: "disablePictureInPicture",
2547
+ disableremoteplayback: "disableRemotePlayback"
2548
+ };
2549
+ function na(e) {
2550
+ return e = e.toLowerCase(), Ri[e] ?? e;
2551
+ }
2552
+ const Mi = ["touchstart", "touchmove"];
2553
+ function Ci(e) {
2554
+ return Mi.includes(e);
2555
+ }
2556
+ const Ii = (
2557
+ /** @type {const} */
2558
+ ["textarea", "script", "style", "title"]
2559
+ );
2560
+ function ra(e) {
2561
+ return Ii.includes(
2562
+ /** @type {typeof RAW_TEXT_ELEMENTS[number]} */
2563
+ e
2564
+ );
2565
+ }
2566
+ const Fe = Symbol("events"), is = /* @__PURE__ */ new Set(), xn = /* @__PURE__ */ new Set();
2567
+ function fs(e, t, n, r = {}) {
2568
+ function s(i) {
2569
+ if (r.capture || Nn.call(t, i), !i.cancelBubble)
2570
+ return on(() => n == null ? void 0 : n.call(this, i));
2571
+ }
2572
+ return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Ce(() => {
2573
+ t.addEventListener(e, s, r);
2574
+ }) : t.addEventListener(e, s, r), s;
2575
+ }
2576
+ function sa(e, t, n, r = {}) {
2577
+ var s = fs(t, e, n, r);
2578
+ return () => {
2579
+ e.removeEventListener(t, s, r);
2580
+ };
2581
+ }
2582
+ function ia(e, t, n, r, s) {
2583
+ var i = { capture: r, passive: s }, a = fs(e, t, n, i);
2584
+ (t === document.body || // @ts-ignore
2585
+ t === window || // @ts-ignore
2586
+ t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
2587
+ t instanceof HTMLMediaElement) && un(() => {
2588
+ t.removeEventListener(e, a, i);
2589
+ });
2590
+ }
2591
+ function fa(e, t, n) {
2592
+ (t[Fe] ?? (t[Fe] = {}))[e] = n;
2593
+ }
2594
+ function aa(e) {
2595
+ for (var t = 0; t < e.length; t++)
2596
+ is.add(e[t]);
2597
+ for (var n of xn)
2598
+ n(e);
2599
+ }
2600
+ let tr = null;
2601
+ function Nn(e) {
2602
+ var O, P;
2603
+ var t = this, n = (
2604
+ /** @type {Node} */
2605
+ t.ownerDocument
2606
+ ), r = e.type, s = ((O = e.composedPath) == null ? void 0 : O.call(e)) || [], i = (
2607
+ /** @type {null | Element} */
2608
+ s[0] || e.target
2609
+ );
2610
+ tr = e;
2611
+ var a = 0, o = tr === e && e[Fe];
2612
+ if (o) {
2613
+ var l = s.indexOf(o);
2614
+ if (l !== -1 && (t === document || t === /** @type {any} */
2615
+ window)) {
2616
+ e[Fe] = t;
2617
+ return;
2618
+ }
2619
+ var u = s.indexOf(t);
2620
+ if (u === -1)
2621
+ return;
2622
+ l <= u && (a = l);
2623
+ }
2624
+ if (i = /** @type {Element} */
2625
+ s[a] || e.target, i !== t) {
2626
+ ir(e, "currentTarget", {
2627
+ configurable: !0,
2628
+ get() {
2629
+ return i || n;
2630
+ }
2631
+ });
2632
+ var _ = b, d = w;
2633
+ ee(null), te(null);
2634
+ try {
2635
+ for (var c, v = []; i !== null; ) {
2636
+ var h = i.assignedSlot || i.parentNode || /** @type {any} */
2637
+ i.host || null;
2638
+ try {
2639
+ var A = (P = i[Fe]) == null ? void 0 : P[r];
2640
+ A != null && (!/** @type {any} */
2641
+ i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
2642
+ // -> the target could not have been disabled because it emits the event in the first place
2643
+ e.target === i) && A.call(i, e);
2644
+ } catch (re) {
2645
+ c ? v.push(re) : c = re;
2646
+ }
2647
+ if (e.cancelBubble || h === t || h === null)
2648
+ break;
2649
+ i = h;
2650
+ }
2651
+ if (c) {
2652
+ for (let re of v)
2653
+ queueMicrotask(() => {
2654
+ throw re;
2655
+ });
2656
+ throw c;
2657
+ }
2658
+ } finally {
2659
+ e[Fe] = t, delete e.currentTarget, ee(_), te(d);
2660
+ }
2661
+ }
2662
+ }
2663
+ var rr;
2664
+ const _n = (
2665
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
2666
+ ((rr = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : rr.trustedTypes) && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
2667
+ /** @param {string} html */
2668
+ createHTML: (e) => e
2669
+ })
2670
+ );
2671
+ function Di(e) {
2672
+ return (
2673
+ /** @type {string} */
2674
+ (_n == null ? void 0 : _n.createHTML(e)) ?? e
2675
+ );
2676
+ }
2677
+ function Yn(e) {
2678
+ var t = pi("template");
2679
+ return t.innerHTML = Di(e.replaceAll("<!>", "<!---->")), t.content;
2680
+ }
2681
+ function Q(e, t) {
2682
+ var n = (
2683
+ /** @type {Effect} */
2684
+ w
2685
+ );
2686
+ n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
2687
+ }
2688
+ // @__NO_SIDE_EFFECTS__
2689
+ function la(e, t) {
2690
+ var n = (t & dr) !== 0, r = (t & Ps) !== 0, s, i = !e.startsWith("<!>");
2691
+ return () => {
2692
+ if (N)
2693
+ return Q(E, null), E;
2694
+ s === void 0 && (s = Yn(i ? e : "<!>" + e), n || (s = /** @type {TemplateNode} */
2695
+ /* @__PURE__ */ z(s)));
2696
+ var a = (
2697
+ /** @type {TemplateNode} */
2698
+ r || Br ? document.importNode(s, !0) : s.cloneNode(!0)
2699
+ );
2700
+ if (n) {
2701
+ var o = (
2702
+ /** @type {TemplateNode} */
2703
+ /* @__PURE__ */ z(a)
2704
+ ), l = (
2705
+ /** @type {TemplateNode} */
2706
+ a.lastChild
2707
+ );
2708
+ Q(o, l);
2709
+ } else
2710
+ Q(a, a);
2711
+ return a;
2712
+ };
2713
+ }
2714
+ // @__NO_SIDE_EFFECTS__
2715
+ function Pi(e, t, n = "svg") {
2716
+ var r = !e.startsWith("<!>"), s = (t & dr) !== 0, i = `<${n}>${r ? e : "<!>" + e}</${n}>`, a;
2717
+ return () => {
2718
+ if (N)
2719
+ return Q(E, null), E;
2720
+ if (!a) {
2721
+ var o = (
2722
+ /** @type {DocumentFragment} */
2723
+ Yn(i)
2724
+ ), l = (
2725
+ /** @type {Element} */
2726
+ /* @__PURE__ */ z(o)
2727
+ );
2728
+ if (s)
2729
+ for (a = document.createDocumentFragment(); /* @__PURE__ */ z(l); )
2730
+ a.appendChild(
2731
+ /** @type {TemplateNode} */
2732
+ /* @__PURE__ */ z(l)
2733
+ );
2734
+ else
2735
+ a = /** @type {Element} */
2736
+ /* @__PURE__ */ z(l);
2737
+ }
2738
+ var u = (
2739
+ /** @type {TemplateNode} */
2740
+ a.cloneNode(!0)
2741
+ );
2742
+ if (s) {
2743
+ var _ = (
2744
+ /** @type {TemplateNode} */
2745
+ /* @__PURE__ */ z(u)
2746
+ ), d = (
2747
+ /** @type {TemplateNode} */
2748
+ u.lastChild
2749
+ );
2750
+ Q(_, d);
2751
+ } else
2752
+ Q(u, u);
2753
+ return u;
2754
+ };
2755
+ }
2756
+ // @__NO_SIDE_EFFECTS__
2757
+ function oa(e, t) {
2758
+ return /* @__PURE__ */ Pi(e, t, "svg");
2759
+ }
2760
+ function ua(e = "") {
2761
+ if (!N) {
2762
+ var t = ue(e + "");
2763
+ return Q(t, t), t;
2764
+ }
2765
+ var n = E;
2766
+ return n.nodeType !== Pt ? (n.before(n = ue()), oe(n)) : ln(
2767
+ /** @type {Text} */
2768
+ n
2769
+ ), Q(n, n), n;
2770
+ }
2771
+ function ca() {
2772
+ if (N)
2773
+ return Q(E, null), E;
2774
+ var e = document.createDocumentFragment(), t = document.createComment(""), n = ue();
2775
+ return e.append(t, n), Q(t, n), e;
2776
+ }
2777
+ function da(e, t) {
2778
+ if (N) {
2779
+ var n = (
2780
+ /** @type {Effect & { nodes: EffectNodes }} */
2781
+ w
2782
+ );
2783
+ ((n.f & De) === 0 || n.nodes.end === null) && (n.nodes.end = E), Cn();
2784
+ return;
2785
+ }
2786
+ e !== null && e.before(
2787
+ /** @type {Node} */
2788
+ t
2789
+ );
2790
+ }
2791
+ let On = !0;
2792
+ function ha(e) {
2793
+ On = e;
2794
+ }
2795
+ function _a(e, t) {
2796
+ var n = t == null ? "" : typeof t == "object" ? `${t}` : t;
2797
+ n !== /** @type {any} */
2798
+ (e[pt] ?? (e[pt] = e.nodeValue)) && (e[pt] = n, e.nodeValue = `${n}`);
2799
+ }
2800
+ function as(e, t) {
2801
+ return ls(e, t);
2802
+ }
2803
+ function Li(e, t) {
2804
+ An(), t.intro = t.intro ?? !1;
2805
+ const n = t.target, r = N, s = E;
2806
+ try {
2807
+ for (var i = /* @__PURE__ */ z(n); i && (i.nodeType !== sn || /** @type {Comment} */
2808
+ i.data !== hr); )
2809
+ i = /* @__PURE__ */ Ae(i);
2810
+ if (!i)
2811
+ throw dt;
2812
+ Ht(!0), oe(
2813
+ /** @type {Comment} */
2814
+ i
2815
+ );
2816
+ const a = ls(e, { ...t, anchor: i });
2817
+ return Ht(!1), /** @type {Exports} */
2818
+ a;
2819
+ } catch (a) {
2820
+ if (a instanceof Error && a.message.split(`
2821
+ `).some((o) => o.startsWith("https://svelte.dev/e/")))
2822
+ throw a;
2823
+ return a !== dt && console.warn("Failed to hydrate: ", a), t.recover === !1 && Rs(), An(), Ur(n), Ht(!1), as(e, t);
2824
+ } finally {
2825
+ Ht(r), oe(s);
2826
+ }
2827
+ }
2828
+ const Yt = /* @__PURE__ */ new Map();
2829
+ function ls(e, { target: t, anchor: n, props: r = {}, events: s, context: i, intro: a = !0, transformError: o }) {
2830
+ An();
2831
+ var l = void 0, u = wi(() => {
2832
+ var _ = n ?? t.appendChild(ue());
2833
+ ii(
2834
+ /** @type {TemplateNode} */
2835
+ _,
2836
+ {
2837
+ pending: () => {
2838
+ }
2839
+ },
2840
+ (v) => {
2841
+ Us({});
2842
+ var h = (
2843
+ /** @type {ComponentContext} */
2844
+ T
2845
+ );
2846
+ if (i && (h.c = i), s && (r.$$events = s), N && Q(
2847
+ /** @type {TemplateNode} */
2848
+ v,
2849
+ null
2850
+ ), On = a, l = e(v, r) || {}, On = !0, N && (w.nodes.end = E, E === null || E.nodeType !== sn || /** @type {Comment} */
2851
+ E.data !== vr))
2852
+ throw fn(), dt;
2853
+ $s();
2854
+ },
2855
+ o
2856
+ );
2857
+ var d = /* @__PURE__ */ new Set(), c = (v) => {
2858
+ for (var h = 0; h < v.length; h++) {
2859
+ var A = v[h];
2860
+ if (!d.has(A)) {
2861
+ d.add(A);
2862
+ var O = Ci(A);
2863
+ for (const Ze of [t, document]) {
2864
+ var P = Yt.get(Ze);
2865
+ P === void 0 && (P = /* @__PURE__ */ new Map(), Yt.set(Ze, P));
2866
+ var re = P.get(A);
2867
+ re === void 0 ? (Ze.addEventListener(A, Nn, { passive: O }), P.set(A, 1)) : P.set(A, re + 1);
2868
+ }
2869
+ }
2870
+ }
2871
+ };
2872
+ return c(hs(is)), xn.add(c), () => {
2873
+ var O;
2874
+ for (var v of d)
2875
+ for (const P of [t, document]) {
2876
+ var h = (
2877
+ /** @type {Map<string, number>} */
2878
+ Yt.get(P)
2879
+ ), A = (
2880
+ /** @type {number} */
2881
+ h.get(v)
2882
+ );
2883
+ --A == 0 ? (P.removeEventListener(v, Nn), h.delete(v), h.size === 0 && Yt.delete(P)) : h.set(v, A);
2884
+ }
2885
+ xn.delete(c), _ !== n && ((O = _.parentNode) == null || O.removeChild(_));
2886
+ };
2887
+ });
2888
+ return Rn.set(l, u), l;
2889
+ }
2890
+ let Rn = /* @__PURE__ */ new WeakMap();
2891
+ function Fi(e, t) {
2892
+ const n = Rn.get(e);
2893
+ return n ? (Rn.delete(e), n(t)) : Promise.resolve();
2894
+ }
2895
+ var ie, he, $, qe, Ct, It, nn;
2896
+ class ji {
2897
+ /**
2898
+ * @param {TemplateNode} anchor
2899
+ * @param {boolean} transition
2900
+ */
2901
+ constructor(t, n = !0) {
2902
+ /** @type {TemplateNode} */
2903
+ F(this, "anchor");
2904
+ /** @type {Map<Batch, Key>} */
2905
+ y(this, ie, /* @__PURE__ */ new Map());
2906
+ /**
2907
+ * Map of keys to effects that are currently rendered in the DOM.
2908
+ * These effects are visible and actively part of the document tree.
2909
+ * Example:
2910
+ * ```
2911
+ * {#if condition}
2912
+ * foo
2913
+ * {:else}
2914
+ * bar
2915
+ * {/if}
2916
+ * ```
2917
+ * Can result in the entries `true->Effect` and `false->Effect`
2918
+ * @type {Map<Key, Effect>}
2919
+ */
2920
+ y(this, he, /* @__PURE__ */ new Map());
2921
+ /**
2922
+ * Similar to #onscreen with respect to the keys, but contains branches that are not yet
2923
+ * in the DOM, because their insertion is deferred.
2924
+ * @type {Map<Key, Branch>}
2925
+ */
2926
+ y(this, $, /* @__PURE__ */ new Map());
2927
+ /**
2928
+ * Keys of effects that are currently outroing
2929
+ * @type {Set<Key>}
2930
+ */
2931
+ y(this, qe, /* @__PURE__ */ new Set());
2932
+ /**
2933
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
2934
+ * This is necessary for `<svelte:element>`
2935
+ */
2936
+ y(this, Ct, !0);
2937
+ /**
2938
+ * @param {Batch} batch
2939
+ */
2940
+ y(this, It, (t) => {
2941
+ if (f(this, ie).has(t)) {
2942
+ var n = (
2943
+ /** @type {Key} */
2944
+ f(this, ie).get(t)
2945
+ ), r = f(this, he).get(n);
2946
+ if (r)
2947
+ Si(r), f(this, qe).delete(n);
2948
+ else {
2949
+ var s = f(this, $).get(n);
2950
+ s && (f(this, he).set(n, s.effect), f(this, $).delete(n), s.fragment.lastChild.remove(), this.anchor.before(s.fragment), r = s.effect);
2951
+ }
2952
+ for (const [i, a] of f(this, ie)) {
2953
+ if (f(this, ie).delete(i), i === t)
2954
+ break;
2955
+ const o = f(this, $).get(a);
2956
+ o && (V(o.effect), f(this, $).delete(a));
2957
+ }
2958
+ for (const [i, a] of f(this, he)) {
2959
+ if (i === n || f(this, qe).has(i)) continue;
2960
+ const o = () => {
2961
+ if (Array.from(f(this, ie).values()).includes(i)) {
2962
+ var u = document.createDocumentFragment();
2963
+ Zr(a, u), u.append(ue()), f(this, $).set(i, { effect: a, fragment: u });
2964
+ } else
2965
+ V(a);
2966
+ f(this, qe).delete(i), f(this, he).delete(i);
2967
+ };
2968
+ f(this, Ct) || !r ? (f(this, qe).add(i), Tt(a, o, !1)) : o();
2969
+ }
2970
+ }
2971
+ });
2972
+ /**
2973
+ * @param {Batch} batch
2974
+ */
2975
+ y(this, nn, (t) => {
2976
+ f(this, ie).delete(t);
2977
+ const n = Array.from(f(this, ie).values());
2978
+ for (const [r, s] of f(this, $))
2979
+ n.includes(r) || (V(s.effect), f(this, $).delete(r));
2980
+ });
2981
+ this.anchor = t, g(this, Ct, n);
2982
+ }
2983
+ /**
2984
+ *
2985
+ * @param {any} key
2986
+ * @param {null | ((target: TemplateNode) => void)} fn
2987
+ */
2988
+ ensure(t, n) {
2989
+ var r = (
2990
+ /** @type {Batch} */
2991
+ p
2992
+ ), s = vi();
2993
+ if (n && !f(this, he).has(t) && !f(this, $).has(t))
2994
+ if (s) {
2995
+ var i = document.createDocumentFragment(), a = ue();
2996
+ i.append(a), f(this, $).set(t, {
2997
+ effect: we(() => n(a)),
2998
+ fragment: i
2999
+ });
3000
+ } else
3001
+ f(this, he).set(
3002
+ t,
3003
+ we(() => n(this.anchor))
3004
+ );
3005
+ if (f(this, ie).set(r, t), s) {
3006
+ for (const [o, l] of f(this, he))
3007
+ o === t ? r.unskip_effect(l) : r.skip_effect(l);
3008
+ for (const [o, l] of f(this, $))
3009
+ o === t ? r.unskip_effect(l.effect) : r.skip_effect(l.effect);
3010
+ r.oncommit(f(this, It)), r.ondiscard(f(this, nn));
3011
+ } else
3012
+ N && (this.anchor = E), f(this, It).call(this, r);
3013
+ }
3014
+ }
3015
+ ie = new WeakMap(), he = new WeakMap(), $ = new WeakMap(), qe = new WeakMap(), Ct = new WeakMap(), It = new WeakMap(), nn = new WeakMap();
3016
+ function va(e, t, ...n) {
3017
+ var r = new ji(e);
3018
+ Gr(() => {
3019
+ const s = t() ?? null;
3020
+ r.ensure(s, s && ((i) => s(i, ...n)));
3021
+ }, ct);
3022
+ }
3023
+ function Hi(e) {
3024
+ return (t, ...n) => {
3025
+ var l;
3026
+ var r = e(...n), s;
3027
+ if (N)
3028
+ s = /** @type {Element} */
3029
+ E, Cn();
3030
+ else {
3031
+ var i = r.render().trim(), a = Yn(i);
3032
+ s = /** @type {Element} */
3033
+ /* @__PURE__ */ z(a), t.before(s);
3034
+ }
3035
+ const o = (l = r.setup) == null ? void 0 : l.call(r, s);
3036
+ Q(s, s), typeof o == "function" && un(o);
3037
+ };
3038
+ }
3039
+ function Vi(e, t) {
3040
+ var n;
3041
+ if (ur(), N) {
3042
+ const r = (n = window.__svelte) == null ? void 0 : n.h;
3043
+ if (r != null && r.has(e))
3044
+ return (
3045
+ /** @type {T} */
3046
+ r.get(e)
3047
+ );
3048
+ js();
3049
+ }
3050
+ return t();
3051
+ }
3052
+ function Bi() {
3053
+ return b === null && Os(), (b.ac ?? (b.ac = new AbortController())).signal;
3054
+ }
3055
+ function os(e) {
3056
+ T === null && _t(), Lt && T.l !== null ? qn(T).m.push(e) : bi(() => {
3057
+ const t = Je(e);
3058
+ if (typeof t == "function") return (
3059
+ /** @type {() => void} */
3060
+ t
3061
+ );
3062
+ });
3063
+ }
3064
+ function Yi(e) {
3065
+ T === null && _t(), os(() => () => Je(e));
3066
+ }
3067
+ function qi(e, t, { bubbles: n = !1, cancelable: r = !1 } = {}) {
3068
+ return new CustomEvent(e, { detail: t, bubbles: n, cancelable: r });
3069
+ }
3070
+ function Ui() {
3071
+ const e = T;
3072
+ return e === null && _t(), (t, n, r) => {
3073
+ var i;
3074
+ const s = (
3075
+ /** @type {Record<string, Function | Function[]>} */
3076
+ (i = e.s.$$events) == null ? void 0 : i[
3077
+ /** @type {string} */
3078
+ t
3079
+ ]
3080
+ );
3081
+ if (s) {
3082
+ const a = sr(s) ? s.slice() : [s], o = qi(
3083
+ /** @type {string} */
3084
+ t,
3085
+ n,
3086
+ r
3087
+ );
3088
+ for (const l of a)
3089
+ l.call(e.x, o);
3090
+ return !o.defaultPrevented;
3091
+ }
3092
+ return !0;
3093
+ };
3094
+ }
3095
+ function $i(e) {
3096
+ T === null && _t(), T.l === null && cr(), qn(T).b.push(e);
3097
+ }
3098
+ function zi(e) {
3099
+ T === null && _t(), T.l === null && cr(), qn(T).a.push(e);
3100
+ }
3101
+ function qn(e) {
3102
+ var t = (
3103
+ /** @type {ComponentContextLegacy} */
3104
+ e.l
3105
+ );
3106
+ return t.u ?? (t.u = { a: [], b: [], m: [] });
3107
+ }
3108
+ const pa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3109
+ __proto__: null,
3110
+ afterUpdate: zi,
3111
+ beforeUpdate: $i,
3112
+ createContext: Ys,
3113
+ createEventDispatcher: Ui,
3114
+ createRawSnippet: Hi,
3115
+ flushSync: Xt,
3116
+ fork: ni,
3117
+ getAbortSignal: Bi,
3118
+ getAllContexts: qs,
3119
+ getContext: br,
3120
+ hasContext: mr,
3121
+ hydratable: Vi,
3122
+ hydrate: Li,
3123
+ mount: as,
3124
+ onDestroy: Yi,
3125
+ onMount: os,
3126
+ setContext: wr,
3127
+ settled: Ni,
3128
+ tick: xi,
3129
+ unmount: Fi,
3130
+ untrack: Je
3131
+ }, Symbol.toStringTag, { value: "Module" }));
3132
+ export {
3133
+ Jn as $,
3134
+ Af as A,
3135
+ fe as B,
3136
+ bs as C,
3137
+ ge as D,
3138
+ cf as E,
3139
+ qt as F,
3140
+ mf as G,
3141
+ vr as H,
3142
+ J as I,
3143
+ w as J,
3144
+ gi as K,
3145
+ tf as L,
3146
+ da as M,
3147
+ Ls as N,
3148
+ hs as O,
3149
+ yf as P,
3150
+ Q,
3151
+ De as R,
3152
+ $e as S,
3153
+ Ef as T,
3154
+ M as U,
3155
+ qf as V,
3156
+ Gr as W,
3157
+ we as X,
3158
+ ta as Y,
3159
+ li as Z,
3160
+ Pf as _,
3161
+ ys as a,
3162
+ vs as a$,
3163
+ Vf as a0,
3164
+ Ur as a1,
3165
+ ca as a2,
3166
+ T as a3,
3167
+ ri as a4,
3168
+ pi as a5,
3169
+ fs as a6,
3170
+ ue as a7,
3171
+ p as a8,
3172
+ Qf as a9,
3173
+ Cn as aA,
3174
+ E as aB,
3175
+ N as aC,
3176
+ fn as aD,
3177
+ pa as aE,
3178
+ Zt as aF,
3179
+ af as aG,
3180
+ Hf as aH,
3181
+ sr as aI,
3182
+ ea as aJ,
3183
+ Ie as aK,
3184
+ mt as aL,
3185
+ Wi as aM,
3186
+ Ki as aN,
3187
+ ra as aO,
3188
+ Ft as aP,
3189
+ Lt as aQ,
3190
+ Kf as aR,
3191
+ Xf as aS,
3192
+ $f as aT,
3193
+ Zf as aU,
3194
+ Zr as aV,
3195
+ _i as aW,
3196
+ Ff as aX,
3197
+ Vs as aY,
3198
+ pe as aZ,
3199
+ na as a_,
3200
+ aa,
3201
+ fa as ab,
3202
+ Fn as ac,
3203
+ Rf as ad,
3204
+ ui as ae,
3205
+ V as af,
3206
+ lf as ag,
3207
+ Wf as ah,
3208
+ Gf as ai,
3209
+ Of as aj,
3210
+ ia as ak,
3211
+ Qi as al,
3212
+ Ji as am,
3213
+ Bf as an,
3214
+ ai as ao,
3215
+ Xt as ap,
3216
+ la as aq,
3217
+ oa as ar,
3218
+ ve as as,
3219
+ br as at,
3220
+ bt as au,
3221
+ _s as av,
3222
+ z as aw,
3223
+ Ae as ax,
3224
+ fr as ay,
3225
+ mr as az,
3226
+ ye as b,
3227
+ sa as b0,
3228
+ Yi as b1,
3229
+ os as b2,
3230
+ Tt as b3,
3231
+ $s as b4,
3232
+ of as b5,
3233
+ yt as b6,
3234
+ Us as b7,
3235
+ Ce as b8,
3236
+ Nf as b9,
3237
+ If as bA,
3238
+ Cf as bB,
3239
+ un as bC,
3240
+ Jf as bD,
3241
+ ua as bE,
3242
+ xi as bF,
3243
+ Zi as bG,
3244
+ Jt as bH,
3245
+ Je as bI,
3246
+ jf as bJ,
3247
+ Lf as bK,
3248
+ bi as bL,
3249
+ zf as bM,
3250
+ on as bN,
3251
+ Xs as bO,
3252
+ Ks as ba,
3253
+ Ti as bb,
3254
+ Uf as bc,
3255
+ Vn as bd,
3256
+ xf as be,
3257
+ Si as bf,
3258
+ Xi as bg,
3259
+ ar as bh,
3260
+ gr as bi,
3261
+ kf as bj,
3262
+ _e as bk,
3263
+ wr as bl,
3264
+ te as bm,
3265
+ oe as bn,
3266
+ Ht as bo,
3267
+ ha as bp,
3268
+ _a as bq,
3269
+ Df as br,
3270
+ vi as bs,
3271
+ On as bt,
3272
+ Yf as bu,
3273
+ Bs as bv,
3274
+ va as bw,
3275
+ jt as bx,
3276
+ ke as by,
3277
+ Mf as bz,
3278
+ be as c,
3279
+ ji as d,
3280
+ sn as e,
3281
+ zn as f,
3282
+ hf as g,
3283
+ df as h,
3284
+ _f as i,
3285
+ uf as j,
3286
+ ef as k,
3287
+ ct as l,
3288
+ ff as m,
3289
+ dt as n,
3290
+ hr as o,
3291
+ _r as p,
3292
+ sf as q,
3293
+ nf as r,
3294
+ Sf as s,
3295
+ Tf as t,
3296
+ vf as u,
3297
+ bf as v,
3298
+ pf as w,
3299
+ gf as x,
3300
+ ws as y,
3301
+ wf as z
3302
+ };
3303
+ //# sourceMappingURL=index-client-BeiP-va5.js.map