@reevit/svelte 0.3.3 → 0.3.6

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.
package/dist/index.mjs CHANGED
@@ -1,77 +1,77 @@
1
- import { createEventDispatcher as en, onMount as gr, onDestroy as Er } from "svelte";
2
- import { createInitialState as Sr, ReevitAPIClient as Pr, generateReference as kr, detectCountryFromCurrency as Ir, reevitReducer as Rr, formatAmount as yn, cn as ge, validatePhone as zt, detectNetwork as Cr, createThemeVariables as Mr } from "@reevit/core";
3
- import { ReevitAPIClient as Ui, cn as Bi, createInitialState as zi, createReevitClient as Ki, detectCountryFromCurrency as qi, detectNetwork as Vi, formatAmount as Hi, formatPhone as Yi, reevitReducer as Gi, validatePhone as Wi } from "@reevit/core";
4
- const Tr = "5";
5
- typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Tr);
6
- let ot = !1, xr = !1;
1
+ import { createEventDispatcher as en, onMount as wr, onDestroy as Er } from "svelte";
2
+ import { createInitialState as Pr, ReevitAPIClient as Sr, generateReference as Ir, detectCountryFromCurrency as kr, reevitReducer as Cr, formatAmount as yn, cn as we, validatePhone as Ht, detectNetwork as Rr, createThemeVariables as xr } from "@reevit/core";
3
+ import { ReevitAPIClient as za, cn as Ha, createInitialState as qa, createReevitClient as Ka, detectCountryFromCurrency as Va, detectNetwork as Ya, formatAmount as Ba, formatPhone as Wa, reevitReducer as Ga, validatePhone as Za } from "@reevit/core";
4
+ const Mr = "5";
5
+ typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Mr);
6
+ let ot = !1, Tr = !1;
7
7
  function Ar() {
8
8
  ot = !0;
9
9
  }
10
10
  Ar();
11
- const Nr = 1, Or = 2, Dr = 16, Fr = 1, Lr = 2, jr = 4, Ur = 8, Br = 16, zr = 1, Kr = 2, V = /* @__PURE__ */ Symbol(), Ht = !1;
12
- var Tn = Array.isArray, qr = Array.prototype.indexOf, tn = Array.from, xn = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, Vr = Object.getOwnPropertyDescriptors, Hr = Object.prototype, Yr = Array.prototype, An = Object.getPrototypeOf;
13
- const Yt = () => {
11
+ const Or = 1, Nr = 2, Dr = 16, Fr = 1, Lr = 2, Ur = 4, jr = 8, zr = 16, Hr = 1, qr = 2, Y = /* @__PURE__ */ Symbol(), Yt = !1;
12
+ var Mn = Array.isArray, Kr = Array.prototype.indexOf, tn = Array.from, Tn = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, Vr = Object.getOwnPropertyDescriptors, Yr = Object.prototype, Br = Array.prototype, An = Object.getPrototypeOf;
13
+ const Bt = () => {
14
14
  };
15
- function Gr(e) {
15
+ function Wr(e) {
16
16
  return e();
17
17
  }
18
- function Gt(e) {
18
+ function Wt(e) {
19
19
  for (var t = 0; t < e.length; t++)
20
20
  e[t]();
21
21
  }
22
- function Nn() {
23
- var e, t, n = new Promise((r, s) => {
24
- e = r, t = s;
22
+ function On() {
23
+ var e, t, n = new Promise((r, a) => {
24
+ e = r, t = a;
25
25
  });
26
26
  return { promise: n, resolve: e, reject: t };
27
27
  }
28
- const q = 2, On = 4, Ct = 8, Wr = 1 << 24, me = 16, ye = 32, He = 64, nn = 128, ne = 512, z = 1024, Z = 2048, re = 4096, X = 8192, _e = 16384, rn = 32768, tt = 65536, bn = 1 << 17, Dn = 1 << 18, Mt = 1 << 19, Fn = 1 << 20, Ee = 1 << 25, Ne = 32768, Wt = 1 << 21, an = 1 << 22, Se = 1 << 23, qe = /* @__PURE__ */ Symbol("$state"), Zr = /* @__PURE__ */ Symbol("legacy props"), Be = new class extends Error {
28
+ const V = 2, Nn = 4, Ct = 8, Gr = 1 << 24, me = 16, ye = 32, Ye = 64, nn = 128, ne = 512, q = 1024, Z = 2048, re = 4096, Q = 8192, pe = 16384, rn = 32768, tt = 65536, bn = 1 << 17, Dn = 1 << 18, Rt = 1 << 19, Fn = 1 << 20, Ee = 1 << 25, Oe = 32768, Gt = 1 << 21, an = 1 << 22, Pe = 1 << 23, Ke = /* @__PURE__ */ Symbol("$state"), Zr = /* @__PURE__ */ Symbol("legacy props"), ze = new class extends Error {
29
29
  name = "StaleReactionError";
30
30
  message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
31
31
  }();
32
32
  function Jr() {
33
33
  throw new Error("https://svelte.dev/e/async_derived_orphan");
34
34
  }
35
- function Xr(e) {
35
+ function Qr(e) {
36
36
  throw new Error("https://svelte.dev/e/effect_in_teardown");
37
37
  }
38
- function Qr() {
38
+ function Xr() {
39
39
  throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
40
40
  }
41
41
  function $r(e) {
42
42
  throw new Error("https://svelte.dev/e/effect_orphan");
43
43
  }
44
- function ea() {
44
+ function ei() {
45
45
  throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
46
46
  }
47
- function ta(e) {
47
+ function ti(e) {
48
48
  throw new Error("https://svelte.dev/e/props_invalid_value");
49
49
  }
50
- function na() {
50
+ function ni() {
51
51
  throw new Error("https://svelte.dev/e/state_descriptors_fixed");
52
52
  }
53
- function ra() {
53
+ function ri() {
54
54
  throw new Error("https://svelte.dev/e/state_prototype_fixed");
55
55
  }
56
- function aa() {
56
+ function ii() {
57
57
  throw new Error("https://svelte.dev/e/state_unsafe_mutation");
58
58
  }
59
59
  function Ln(e) {
60
60
  return e === this.v;
61
61
  }
62
- function ia(e, t) {
62
+ function ai(e, t) {
63
63
  return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
64
64
  }
65
- function jn(e) {
66
- return !ia(e, this.v);
65
+ function Un(e) {
66
+ return !ai(e, this.v);
67
67
  }
68
- let U = null;
69
- function yt(e) {
70
- U = e;
68
+ let H = null;
69
+ function mt(e) {
70
+ H = e;
71
71
  }
72
72
  function sn(e, t = !1, n) {
73
- U = {
74
- p: U,
73
+ H = {
74
+ p: H,
75
75
  i: !1,
76
76
  c: null,
77
77
  e: null,
@@ -83,49 +83,49 @@ function sn(e, t = !1, n) {
83
83
  function on(e) {
84
84
  var t = (
85
85
  /** @type {ComponentContext} */
86
- U
86
+ H
87
87
  ), n = t.e;
88
88
  if (n !== null) {
89
89
  t.e = null;
90
90
  for (var r of n)
91
91
  Jn(r);
92
92
  }
93
- return t.i = !0, U = t.p, /** @type {T} */
93
+ return t.i = !0, H = t.p, /** @type {T} */
94
94
  {};
95
95
  }
96
96
  function lt() {
97
- return !ot || U !== null && U.l === null;
97
+ return !ot || H !== null && H.l === null;
98
98
  }
99
- let Ce = [];
100
- function Un() {
101
- var e = Ce;
102
- Ce = [], Gt(e);
99
+ let Re = [];
100
+ function jn() {
101
+ var e = Re;
102
+ Re = [], Wt(e);
103
103
  }
104
- function Bn(e) {
105
- if (Ce.length === 0 && !et) {
106
- var t = Ce;
104
+ function zn(e) {
105
+ if (Re.length === 0 && !et) {
106
+ var t = Re;
107
107
  queueMicrotask(() => {
108
- t === Ce && Un();
108
+ t === Re && jn();
109
109
  });
110
110
  }
111
- Ce.push(e);
111
+ Re.push(e);
112
112
  }
113
- function sa() {
114
- for (; Ce.length > 0; )
115
- Un();
113
+ function si() {
114
+ for (; Re.length > 0; )
115
+ jn();
116
116
  }
117
- function oa(e) {
118
- var t = M;
117
+ function oi(e) {
118
+ var t = x;
119
119
  if (t === null)
120
- return S.f |= Se, e;
120
+ return S.f |= Pe, e;
121
121
  if ((t.f & rn) === 0) {
122
122
  if ((t.f & nn) === 0)
123
123
  throw e;
124
124
  t.b.error(e);
125
125
  } else
126
- bt(e, t);
126
+ yt(e, t);
127
127
  }
128
- function bt(e, t) {
128
+ function yt(e, t) {
129
129
  for (; t !== null; ) {
130
130
  if ((t.f & nn) !== 0)
131
131
  try {
@@ -138,8 +138,8 @@ function bt(e, t) {
138
138
  }
139
139
  throw e;
140
140
  }
141
- const vt = /* @__PURE__ */ new Set();
142
- let R = null, mt = null, te = null, ee = [], Tt = null, Zt = !1, et = !1;
141
+ const dt = /* @__PURE__ */ new Set();
142
+ let C = null, _t = null, te = null, ee = [], xt = null, Zt = !1, et = !1;
143
143
  class nt {
144
144
  committed = !1;
145
145
  /**
@@ -178,12 +178,12 @@ class nt {
178
178
  * TODO replace with Promise.withResolvers once supported widely enough
179
179
  * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
180
180
  */
181
- #i = null;
181
+ #a = null;
182
182
  /**
183
183
  * Deferred effects (which run after async work has completed) that are DIRTY
184
184
  * @type {Set<Effect>}
185
185
  */
186
- #a = /* @__PURE__ */ new Set();
186
+ #i = /* @__PURE__ */ new Set();
187
187
  /**
188
188
  * Deferred effects that are MAYBE_DIRTY
189
189
  * @type {Set<Effect>}
@@ -204,7 +204,7 @@ class nt {
204
204
  * @param {Effect[]} root_effects
205
205
  */
206
206
  process(t) {
207
- ee = [], mt = null, this.apply();
207
+ ee = [], _t = null, this.apply();
208
208
  var n = {
209
209
  parent: null,
210
210
  effect: null,
@@ -213,7 +213,7 @@ class nt {
213
213
  };
214
214
  for (const r of t)
215
215
  this.#l(r, n);
216
- this.is_fork || this.#f(), this.is_deferred() ? (this.#o(n.effects), this.#o(n.render_effects)) : (mt = this, R = null, wn(n.render_effects), wn(n.effects), mt = null, this.#i?.resolve()), te = null;
216
+ this.is_fork || this.#c(), this.is_deferred() ? (this.#o(n.effects), this.#o(n.render_effects)) : (_t = this, C = null, gn(n.render_effects), gn(n.effects), _t = null, this.#a?.resolve()), te = null;
217
217
  }
218
218
  /**
219
219
  * Traverse the effect tree, executing effects or stashing
@@ -222,16 +222,16 @@ class nt {
222
222
  * @param {EffectTarget} target
223
223
  */
224
224
  #l(t, n) {
225
- t.f ^= z;
225
+ t.f ^= q;
226
226
  for (var r = t.first; r !== null; ) {
227
- var s = r.f, a = (s & (ye | He)) !== 0, l = a && (s & z) !== 0, i = l || (s & X) !== 0 || this.skipped_effects.has(r);
227
+ var a = r.f, i = (a & (ye | Ye)) !== 0, l = i && (a & q) !== 0, s = l || (a & Q) !== 0 || this.skipped_effects.has(r);
228
228
  if ((r.f & nn) !== 0 && r.b?.is_pending() && (n = {
229
229
  parent: n,
230
230
  effect: r,
231
231
  effects: [],
232
232
  render_effects: []
233
- }), !i && r.fn !== null) {
234
- a ? r.f ^= z : (s & On) !== 0 ? n.effects.push(r) : Ye(r) && ((r.f & me) !== 0 && this.#a.add(r), Ve(r));
233
+ }), !s && r.fn !== null) {
234
+ i ? r.f ^= q : (a & Nn) !== 0 ? n.effects.push(r) : Be(r) && ((r.f & me) !== 0 && this.#i.add(r), Ve(r));
235
235
  var u = r.first;
236
236
  if (u !== null) {
237
237
  r = u;
@@ -249,7 +249,7 @@ class nt {
249
249
  */
250
250
  #o(t) {
251
251
  for (const n of t)
252
- (n.f & Z) !== 0 ? this.#a.add(n) : (n.f & re) !== 0 && this.#s.add(n), this.#u(n.deps), K(n, z);
252
+ (n.f & Z) !== 0 ? this.#i.add(n) : (n.f & re) !== 0 && this.#s.add(n), this.#u(n.deps), K(n, q);
253
253
  }
254
254
  /**
255
255
  * @param {Value[] | null} deps
@@ -257,7 +257,7 @@ class nt {
257
257
  #u(t) {
258
258
  if (t !== null)
259
259
  for (const n of t)
260
- (n.f & q) === 0 || (n.f & Ne) === 0 || (n.f ^= Ne, this.#u(
260
+ (n.f & V) === 0 || (n.f & Oe) === 0 || (n.f ^= Oe, this.#u(
261
261
  /** @type {Derived} */
262
262
  n.deps
263
263
  ));
@@ -269,17 +269,17 @@ class nt {
269
269
  * @param {any} value
270
270
  */
271
271
  capture(t, n) {
272
- this.previous.has(t) || this.previous.set(t, n), (t.f & Se) === 0 && (this.current.set(t, t.v), te?.set(t, t.v));
272
+ this.previous.has(t) || this.previous.set(t, n), (t.f & Pe) === 0 && (this.current.set(t, t.v), te?.set(t, t.v));
273
273
  }
274
274
  activate() {
275
- R = this, this.apply();
275
+ C = this, this.apply();
276
276
  }
277
277
  deactivate() {
278
- R === this && (R = null, te = null);
278
+ C === this && (C = null, te = null);
279
279
  }
280
280
  flush() {
281
281
  if (this.activate(), ee.length > 0) {
282
- if (zn(), R !== null && R !== this)
282
+ if (Hn(), C !== null && C !== this)
283
283
  return;
284
284
  } else this.#e === 0 && this.process([]);
285
285
  this.deactivate();
@@ -288,15 +288,15 @@ class nt {
288
288
  for (const t of this.#n) t(this);
289
289
  this.#n.clear();
290
290
  }
291
- #f() {
291
+ #c() {
292
292
  if (this.#r === 0) {
293
293
  for (const t of this.#t) t();
294
294
  this.#t.clear();
295
295
  }
296
- this.#e === 0 && this.#c();
296
+ this.#e === 0 && this.#f();
297
297
  }
298
- #c() {
299
- if (vt.size > 1) {
298
+ #f() {
299
+ if (dt.size > 1) {
300
300
  this.previous.clear();
301
301
  var t = te, n = !0, r = {
302
302
  parent: null,
@@ -304,41 +304,41 @@ class nt {
304
304
  effects: [],
305
305
  render_effects: []
306
306
  };
307
- for (const a of vt) {
308
- if (a === this) {
307
+ for (const i of dt) {
308
+ if (i === this) {
309
309
  n = !1;
310
310
  continue;
311
311
  }
312
312
  const l = [];
313
313
  for (const [u, o] of this.current) {
314
- if (a.current.has(u))
315
- if (n && o !== a.current.get(u))
316
- a.current.set(u, o);
314
+ if (i.current.has(u))
315
+ if (n && o !== i.current.get(u))
316
+ i.current.set(u, o);
317
317
  else
318
318
  continue;
319
319
  l.push(u);
320
320
  }
321
321
  if (l.length === 0)
322
322
  continue;
323
- const i = [...a.current.keys()].filter((u) => !this.current.has(u));
324
- if (i.length > 0) {
325
- var s = ee;
323
+ const s = [...i.current.keys()].filter((u) => !this.current.has(u));
324
+ if (s.length > 0) {
325
+ var a = ee;
326
326
  ee = [];
327
327
  const u = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
328
- for (const d of l)
329
- Kn(d, i, u, o);
328
+ for (const c of l)
329
+ qn(c, s, u, o);
330
330
  if (ee.length > 0) {
331
- R = a, a.apply();
332
- for (const d of ee)
333
- a.#l(d, r);
334
- a.deactivate();
331
+ C = i, i.apply();
332
+ for (const c of ee)
333
+ i.#l(c, r);
334
+ i.deactivate();
335
335
  }
336
- ee = s;
336
+ ee = a;
337
337
  }
338
338
  }
339
- R = null, te = t;
339
+ C = null, te = t;
340
340
  }
341
- this.committed = !0, vt.delete(this);
341
+ this.committed = !0, dt.delete(this);
342
342
  }
343
343
  /**
344
344
  *
@@ -355,10 +355,10 @@ class nt {
355
355
  this.#e -= 1, t && (this.#r -= 1), this.revive();
356
356
  }
357
357
  revive() {
358
- for (const t of this.#a)
359
- this.#s.delete(t), K(t, Z), Oe(t);
358
+ for (const t of this.#i)
359
+ this.#s.delete(t), K(t, Z), Ne(t);
360
360
  for (const t of this.#s)
361
- K(t, re), Oe(t);
361
+ K(t, re), Ne(t);
362
362
  this.flush();
363
363
  }
364
364
  /** @param {() => void} fn */
@@ -370,80 +370,80 @@ class nt {
370
370
  this.#n.add(t);
371
371
  }
372
372
  settled() {
373
- return (this.#i ??= Nn()).promise;
373
+ return (this.#a ??= On()).promise;
374
374
  }
375
375
  static ensure() {
376
- if (R === null) {
377
- const t = R = new nt();
378
- vt.add(R), et || nt.enqueue(() => {
379
- R === t && t.flush();
376
+ if (C === null) {
377
+ const t = C = new nt();
378
+ dt.add(C), et || nt.enqueue(() => {
379
+ C === t && t.flush();
380
380
  });
381
381
  }
382
- return R;
382
+ return C;
383
383
  }
384
384
  /** @param {() => void} task */
385
385
  static enqueue(t) {
386
- Bn(t);
386
+ zn(t);
387
387
  }
388
388
  apply() {
389
389
  }
390
390
  }
391
- function la(e) {
391
+ function li(e) {
392
392
  var t = et;
393
393
  et = !0;
394
394
  try {
395
395
  for (var n; ; ) {
396
- if (sa(), ee.length === 0 && (R?.flush(), ee.length === 0))
397
- return Tt = null, /** @type {T} */
396
+ if (si(), ee.length === 0 && (C?.flush(), ee.length === 0))
397
+ return xt = null, /** @type {T} */
398
398
  n;
399
- zn();
399
+ Hn();
400
400
  }
401
401
  } finally {
402
402
  et = t;
403
403
  }
404
404
  }
405
- function zn() {
406
- var e = xe;
405
+ function Hn() {
406
+ var e = Te;
407
407
  Zt = !0;
408
408
  var t = null;
409
409
  try {
410
410
  var n = 0;
411
- for (St(!0); ee.length > 0; ) {
411
+ for (Et(!0); ee.length > 0; ) {
412
412
  var r = nt.ensure();
413
413
  if (n++ > 1e3) {
414
- var s, a;
415
- ua();
414
+ var a, i;
415
+ ui();
416
416
  }
417
- r.process(ee), Pe.clear();
417
+ r.process(ee), Se.clear();
418
418
  }
419
419
  } finally {
420
- Zt = !1, St(e), Tt = null;
420
+ Zt = !1, Et(e), xt = null;
421
421
  }
422
422
  }
423
- function ua() {
423
+ function ui() {
424
424
  try {
425
- ea();
425
+ ei();
426
426
  } catch (e) {
427
- bt(e, Tt);
427
+ yt(e, xt);
428
428
  }
429
429
  }
430
430
  let ve = null;
431
- function wn(e) {
431
+ function gn(e) {
432
432
  var t = e.length;
433
433
  if (t !== 0) {
434
434
  for (var n = 0; n < t; ) {
435
435
  var r = e[n++];
436
- if ((r.f & (_e | X)) === 0 && Ye(r) && (ve = /* @__PURE__ */ new Set(), Ve(r), r.deps === null && r.first === null && r.nodes === null && (r.teardown === null && r.ac === null ? er(r) : r.fn = null), ve?.size > 0)) {
437
- Pe.clear();
438
- for (const s of ve) {
439
- if ((s.f & (_e | X)) !== 0) continue;
440
- const a = [s];
441
- let l = s.parent;
436
+ if ((r.f & (pe | Q)) === 0 && Be(r) && (ve = /* @__PURE__ */ new Set(), Ve(r), r.deps === null && r.first === null && r.nodes === null && (r.teardown === null && r.ac === null ? er(r) : r.fn = null), ve?.size > 0)) {
437
+ Se.clear();
438
+ for (const a of ve) {
439
+ if ((a.f & (pe | Q)) !== 0) continue;
440
+ const i = [a];
441
+ let l = a.parent;
442
442
  for (; l !== null; )
443
- ve.has(l) && (ve.delete(l), a.push(l)), l = l.parent;
444
- for (let i = a.length - 1; i >= 0; i--) {
445
- const u = a[i];
446
- (u.f & (_e | X)) === 0 && Ve(u);
443
+ ve.has(l) && (ve.delete(l), i.push(l)), l = l.parent;
444
+ for (let s = i.length - 1; s >= 0; s--) {
445
+ const u = i[s];
446
+ (u.f & (pe | Q)) === 0 && Ve(u);
447
447
  }
448
448
  }
449
449
  ve.clear();
@@ -452,105 +452,105 @@ function wn(e) {
452
452
  ve = null;
453
453
  }
454
454
  }
455
- function Kn(e, t, n, r) {
455
+ function qn(e, t, n, r) {
456
456
  if (!n.has(e) && (n.add(e), e.reactions !== null))
457
- for (const s of e.reactions) {
458
- const a = s.f;
459
- (a & q) !== 0 ? Kn(
457
+ for (const a of e.reactions) {
458
+ const i = a.f;
459
+ (i & V) !== 0 ? qn(
460
460
  /** @type {Derived} */
461
- s,
461
+ a,
462
462
  t,
463
463
  n,
464
464
  r
465
- ) : (a & (an | me)) !== 0 && (a & Z) === 0 && qn(s, t, r) && (K(s, Z), Oe(
465
+ ) : (i & (an | me)) !== 0 && (i & Z) === 0 && Kn(a, t, r) && (K(a, Z), Ne(
466
466
  /** @type {Effect} */
467
- s
467
+ a
468
468
  ));
469
469
  }
470
470
  }
471
- function qn(e, t, n) {
471
+ function Kn(e, t, n) {
472
472
  const r = n.get(e);
473
473
  if (r !== void 0) return r;
474
474
  if (e.deps !== null)
475
- for (const s of e.deps) {
476
- if (t.includes(s))
475
+ for (const a of e.deps) {
476
+ if (t.includes(a))
477
477
  return !0;
478
- if ((s.f & q) !== 0 && qn(
478
+ if ((a.f & V) !== 0 && Kn(
479
479
  /** @type {Derived} */
480
- s,
480
+ a,
481
481
  t,
482
482
  n
483
483
  ))
484
484
  return n.set(
485
485
  /** @type {Derived} */
486
- s,
486
+ a,
487
487
  !0
488
488
  ), !0;
489
489
  }
490
490
  return n.set(e, !1), !1;
491
491
  }
492
- function Oe(e) {
493
- for (var t = Tt = e; t.parent !== null; ) {
492
+ function Ne(e) {
493
+ for (var t = xt = e; t.parent !== null; ) {
494
494
  t = t.parent;
495
495
  var n = t.f;
496
- if (Zt && t === M && (n & me) !== 0 && (n & Dn) === 0)
496
+ if (Zt && t === x && (n & me) !== 0 && (n & Dn) === 0)
497
497
  return;
498
- if ((n & (He | ye)) !== 0) {
499
- if ((n & z) === 0) return;
500
- t.f ^= z;
498
+ if ((n & (Ye | ye)) !== 0) {
499
+ if ((n & q) === 0) return;
500
+ t.f ^= q;
501
501
  }
502
502
  }
503
503
  ee.push(t);
504
504
  }
505
- function fa(e, t, n, r) {
506
- const s = lt() ? xt : At;
505
+ function ci(e, t, n, r) {
506
+ const a = lt() ? Mt : Tt;
507
507
  if (n.length === 0 && e.length === 0) {
508
- r(t.map(s));
508
+ r(t.map(a));
509
509
  return;
510
510
  }
511
- var a = R, l = (
511
+ var i = C, l = (
512
512
  /** @type {Effect} */
513
- M
514
- ), i = ca();
513
+ x
514
+ ), s = fi();
515
515
  function u() {
516
- Promise.all(n.map((o) => /* @__PURE__ */ da(o))).then((o) => {
517
- i();
516
+ Promise.all(n.map((o) => /* @__PURE__ */ di(o))).then((o) => {
517
+ s();
518
518
  try {
519
- r([...t.map(s), ...o]);
520
- } catch (d) {
521
- (l.f & _e) === 0 && bt(d, l);
519
+ r([...t.map(a), ...o]);
520
+ } catch (c) {
521
+ (l.f & pe) === 0 && yt(c, l);
522
522
  }
523
- a?.deactivate(), wt();
523
+ i?.deactivate(), bt();
524
524
  }).catch((o) => {
525
- bt(o, l);
525
+ yt(o, l);
526
526
  });
527
527
  }
528
528
  e.length > 0 ? Promise.all(e).then(() => {
529
- i();
529
+ s();
530
530
  try {
531
531
  return u();
532
532
  } finally {
533
- a?.deactivate(), wt();
533
+ i?.deactivate(), bt();
534
534
  }
535
535
  }) : u();
536
536
  }
537
- function ca() {
538
- var e = M, t = S, n = U, r = R;
539
- return function(a = !0) {
540
- Ie(e), ue(t), yt(n), a && r?.activate();
537
+ function fi() {
538
+ var e = x, t = S, n = H, r = C;
539
+ return function(i = !0) {
540
+ ke(e), ue(t), mt(n), i && r?.activate();
541
541
  };
542
542
  }
543
- function wt() {
544
- Ie(null), ue(null), yt(null);
543
+ function bt() {
544
+ ke(null), ue(null), mt(null);
545
545
  }
546
546
  // @__NO_SIDE_EFFECTS__
547
- function xt(e) {
548
- var t = q | Z, n = S !== null && (S.f & q) !== 0 ? (
547
+ function Mt(e) {
548
+ var t = V | Z, n = S !== null && (S.f & V) !== 0 ? (
549
549
  /** @type {Derived} */
550
550
  S
551
551
  ) : null;
552
- return M !== null && (M.f |= Mt), {
553
- ctx: U,
552
+ return x !== null && (x.f |= Rt), {
553
+ ctx: H,
554
554
  deps: null,
555
555
  effects: null,
556
556
  equals: Ln,
@@ -560,95 +560,95 @@ function xt(e) {
560
560
  rv: 0,
561
561
  v: (
562
562
  /** @type {V} */
563
- V
563
+ Y
564
564
  ),
565
565
  wv: 0,
566
- parent: n ?? M,
566
+ parent: n ?? x,
567
567
  ac: null
568
568
  };
569
569
  }
570
570
  // @__NO_SIDE_EFFECTS__
571
- function da(e, t) {
571
+ function di(e, t) {
572
572
  let n = (
573
573
  /** @type {Effect | null} */
574
- M
574
+ x
575
575
  );
576
576
  n === null && Jr();
577
577
  var r = (
578
578
  /** @type {Boundary} */
579
579
  n.b
580
- ), s = (
580
+ ), a = (
581
581
  /** @type {Promise<V>} */
582
582
  /** @type {unknown} */
583
583
  void 0
584
- ), a = rt(
584
+ ), i = rt(
585
585
  /** @type {V} */
586
- V
587
- ), l = !S, i = /* @__PURE__ */ new Map();
588
- return Sa(() => {
589
- var u = Nn();
590
- s = u.promise;
586
+ Y
587
+ ), l = !S, s = /* @__PURE__ */ new Map();
588
+ return Pi(() => {
589
+ var u = On();
590
+ a = u.promise;
591
591
  try {
592
592
  Promise.resolve(e()).then(u.resolve, u.reject).then(() => {
593
- o === R && o.committed && o.deactivate(), wt();
593
+ o === C && o.committed && o.deactivate(), bt();
594
594
  });
595
- } catch (_) {
596
- u.reject(_), wt();
595
+ } catch (p) {
596
+ u.reject(p), bt();
597
597
  }
598
598
  var o = (
599
599
  /** @type {Batch} */
600
- R
600
+ C
601
601
  );
602
602
  if (l) {
603
- var d = !r.is_pending();
604
- r.update_pending_count(1), o.increment(d), i.get(o)?.reject(Be), i.delete(o), i.set(o, u);
603
+ var c = !r.is_pending();
604
+ r.update_pending_count(1), o.increment(c), s.get(o)?.reject(ze), s.delete(o), s.set(o, u);
605
605
  }
606
- const v = (_, p = void 0) => {
607
- if (o.activate(), p)
608
- p !== Be && (a.f |= Se, at(a, p));
606
+ const d = (p, h = void 0) => {
607
+ if (o.activate(), h)
608
+ h !== ze && (i.f |= Pe, it(i, h));
609
609
  else {
610
- (a.f & Se) !== 0 && (a.f ^= Se), at(a, _);
611
- for (const [c, b] of i) {
612
- if (i.delete(c), c === o) break;
613
- b.reject(Be);
610
+ (i.f & Pe) !== 0 && (i.f ^= Pe), it(i, p);
611
+ for (const [v, w] of s) {
612
+ if (s.delete(v), v === o) break;
613
+ w.reject(ze);
614
614
  }
615
615
  }
616
- l && (r.update_pending_count(-1), o.decrement(d));
616
+ l && (r.update_pending_count(-1), o.decrement(c));
617
617
  };
618
- u.promise.then(v, (_) => v(null, _ || "unknown"));
618
+ u.promise.then(d, (p) => d(null, p || "unknown"));
619
619
  }), un(() => {
620
- for (const u of i.values())
621
- u.reject(Be);
620
+ for (const u of s.values())
621
+ u.reject(ze);
622
622
  }), new Promise((u) => {
623
- function o(d) {
624
- function v() {
625
- d === s ? u(a) : o(s);
623
+ function o(c) {
624
+ function d() {
625
+ c === a ? u(i) : o(a);
626
626
  }
627
- d.then(v, v);
627
+ c.then(d, d);
628
628
  }
629
- o(s);
629
+ o(a);
630
630
  });
631
631
  }
632
632
  // @__NO_SIDE_EFFECTS__
633
- function At(e) {
634
- const t = /* @__PURE__ */ xt(e);
635
- return t.equals = jn, t;
633
+ function Tt(e) {
634
+ const t = /* @__PURE__ */ Mt(e);
635
+ return t.equals = Un, t;
636
636
  }
637
637
  function Vn(e) {
638
638
  var t = e.effects;
639
639
  if (t !== null) {
640
640
  e.effects = null;
641
641
  for (var n = 0; n < t.length; n += 1)
642
- pe(
642
+ he(
643
643
  /** @type {Effect} */
644
644
  t[n]
645
645
  );
646
646
  }
647
647
  }
648
- function va(e) {
648
+ function vi(e) {
649
649
  for (var t = e.parent; t !== null; ) {
650
- if ((t.f & q) === 0)
651
- return (t.f & _e) === 0 ? (
650
+ if ((t.f & V) === 0)
651
+ return (t.f & pe) === 0 ? (
652
652
  /** @type {Effect} */
653
653
  t
654
654
  ) : null;
@@ -657,28 +657,28 @@ function va(e) {
657
657
  return null;
658
658
  }
659
659
  function ln(e) {
660
- var t, n = M;
661
- Ie(va(e));
660
+ var t, n = x;
661
+ ke(vi(e));
662
662
  try {
663
- e.f &= ~Ne, Vn(e), t = sr(e);
663
+ e.f &= ~Oe, Vn(e), t = sr(e);
664
664
  } finally {
665
- Ie(n);
665
+ ke(n);
666
666
  }
667
667
  return t;
668
668
  }
669
- function Hn(e) {
669
+ function Yn(e) {
670
670
  var t = ln(e);
671
- if (e.equals(t) || (R?.is_fork || (e.v = t), e.wv = ar()), !De)
671
+ if (e.equals(t) || (C?.is_fork || (e.v = t), e.wv = ir()), !De)
672
672
  if (te !== null)
673
- (Et() || R?.is_fork) && te.set(e, t);
673
+ (wt() || C?.is_fork) && te.set(e, t);
674
674
  else {
675
- var n = (e.f & ne) === 0 ? re : z;
675
+ var n = (e.f & ne) === 0 ? re : q;
676
676
  K(e, n);
677
677
  }
678
678
  }
679
679
  let Jt = /* @__PURE__ */ new Set();
680
- const Pe = /* @__PURE__ */ new Map();
681
- let Yn = !1;
680
+ const Se = /* @__PURE__ */ new Map();
681
+ let Bn = !1;
682
682
  function rt(e, t) {
683
683
  var n = {
684
684
  f: 0,
@@ -694,84 +694,84 @@ function rt(e, t) {
694
694
  // @__NO_SIDE_EFFECTS__
695
695
  function be(e, t) {
696
696
  const n = rt(e);
697
- return Ra(n), n;
697
+ return Ci(n), n;
698
698
  }
699
699
  // @__NO_SIDE_EFFECTS__
700
- function ke(e, t = !1, n = !0) {
700
+ function Ie(e, t = !1, n = !0) {
701
701
  const r = rt(e);
702
- return t || (r.equals = jn), ot && n && U !== null && U.l !== null && (U.l.s ??= []).push(r), r;
702
+ return t || (r.equals = Un), ot && n && H !== null && H.l !== null && (H.l.s ??= []).push(r), r;
703
703
  }
704
- function j(e, t, n = !1) {
704
+ function z(e, t, n = !1) {
705
705
  S !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
706
706
  // to ensure we error if state is set inside an inspect effect
707
- (!le || (S.f & bn) !== 0) && lt() && (S.f & (q | me | an | bn)) !== 0 && !he?.includes(e) && aa();
708
- let r = n ? ze(t) : t;
709
- return at(e, r);
707
+ (!le || (S.f & bn) !== 0) && lt() && (S.f & (V | me | an | bn)) !== 0 && !_e?.includes(e) && ii();
708
+ let r = n ? He(t) : t;
709
+ return it(e, r);
710
710
  }
711
- function at(e, t) {
711
+ function it(e, t) {
712
712
  if (!e.equals(t)) {
713
713
  var n = e.v;
714
- De ? Pe.set(e, t) : Pe.set(e, n), e.v = t;
714
+ De ? Se.set(e, t) : Se.set(e, n), e.v = t;
715
715
  var r = nt.ensure();
716
- r.capture(e, n), (e.f & q) !== 0 && ((e.f & Z) !== 0 && ln(
716
+ r.capture(e, n), (e.f & V) !== 0 && ((e.f & Z) !== 0 && ln(
717
717
  /** @type {Derived} */
718
718
  e
719
- ), K(e, (e.f & ne) !== 0 ? z : re)), e.wv = ar(), Gn(e, Z), lt() && M !== null && (M.f & z) !== 0 && (M.f & (ye | He)) === 0 && (Q === null ? Ca([e]) : Q.push(e)), !r.is_fork && Jt.size > 0 && !Yn && _a();
719
+ ), K(e, (e.f & ne) !== 0 ? q : re)), e.wv = ir(), Wn(e, Z), lt() && x !== null && (x.f & q) !== 0 && (x.f & (ye | Ye)) === 0 && (X === null ? Ri([e]) : X.push(e)), !r.is_fork && Jt.size > 0 && !Bn && pi();
720
720
  }
721
721
  return t;
722
722
  }
723
- function _a() {
724
- Yn = !1;
725
- var e = xe;
726
- St(!0);
723
+ function pi() {
724
+ Bn = !1;
725
+ var e = Te;
726
+ Et(!0);
727
727
  const t = Array.from(Jt);
728
728
  try {
729
729
  for (const n of t)
730
- (n.f & z) !== 0 && K(n, re), Ye(n) && Ve(n);
730
+ (n.f & q) !== 0 && K(n, re), Be(n) && Ve(n);
731
731
  } finally {
732
- St(e);
732
+ Et(e);
733
733
  }
734
734
  Jt.clear();
735
735
  }
736
- function Kt(e) {
737
- j(e, e.v + 1);
736
+ function qt(e) {
737
+ z(e, e.v + 1);
738
738
  }
739
- function Gn(e, t) {
739
+ function Wn(e, t) {
740
740
  var n = e.reactions;
741
741
  if (n !== null)
742
- for (var r = lt(), s = n.length, a = 0; a < s; a++) {
743
- var l = n[a], i = l.f;
744
- if (!(!r && l === M)) {
745
- var u = (i & Z) === 0;
746
- if (u && K(l, t), (i & q) !== 0) {
742
+ for (var r = lt(), a = n.length, i = 0; i < a; i++) {
743
+ var l = n[i], s = l.f;
744
+ if (!(!r && l === x)) {
745
+ var u = (s & Z) === 0;
746
+ if (u && K(l, t), (s & V) !== 0) {
747
747
  var o = (
748
748
  /** @type {Derived} */
749
749
  l
750
750
  );
751
- te?.delete(o), (i & Ne) === 0 && (i & ne && (l.f |= Ne), Gn(o, re));
752
- } else u && ((i & me) !== 0 && ve !== null && ve.add(
751
+ te?.delete(o), (s & Oe) === 0 && (s & ne && (l.f |= Oe), Wn(o, re));
752
+ } else u && ((s & me) !== 0 && ve !== null && ve.add(
753
753
  /** @type {Effect} */
754
754
  l
755
- ), Oe(
755
+ ), Ne(
756
756
  /** @type {Effect} */
757
757
  l
758
758
  ));
759
759
  }
760
760
  }
761
761
  }
762
- function ze(e) {
763
- if (typeof e != "object" || e === null || qe in e)
762
+ function He(e) {
763
+ if (typeof e != "object" || e === null || Ke in e)
764
764
  return e;
765
765
  const t = An(e);
766
- if (t !== Hr && t !== Yr)
766
+ if (t !== Yr && t !== Br)
767
767
  return e;
768
- var n = /* @__PURE__ */ new Map(), r = Tn(e), s = /* @__PURE__ */ be(0), a = Ae, l = (i) => {
769
- if (Ae === a)
770
- return i();
768
+ var n = /* @__PURE__ */ new Map(), r = Mn(e), a = /* @__PURE__ */ be(0), i = Ae, l = (s) => {
769
+ if (Ae === i)
770
+ return s();
771
771
  var u = S, o = Ae;
772
- ue(null), Pn(a);
773
- var d = i();
774
- return ue(u), Pn(o), d;
772
+ ue(null), Sn(i);
773
+ var c = s();
774
+ return ue(u), Sn(o), c;
775
775
  };
776
776
  return r && n.set("length", /* @__PURE__ */ be(
777
777
  /** @type {any[]} */
@@ -780,157 +780,157 @@ function ze(e) {
780
780
  /** @type {any} */
781
781
  e,
782
782
  {
783
- defineProperty(i, u, o) {
784
- (!("value" in o) || o.configurable === !1 || o.enumerable === !1 || o.writable === !1) && na();
785
- var d = n.get(u);
786
- return d === void 0 ? d = l(() => {
787
- var v = /* @__PURE__ */ be(o.value);
788
- return n.set(u, v), v;
789
- }) : j(d, o.value, !0), !0;
783
+ defineProperty(s, u, o) {
784
+ (!("value" in o) || o.configurable === !1 || o.enumerable === !1 || o.writable === !1) && ni();
785
+ var c = n.get(u);
786
+ return c === void 0 ? c = l(() => {
787
+ var d = /* @__PURE__ */ be(o.value);
788
+ return n.set(u, d), d;
789
+ }) : z(c, o.value, !0), !0;
790
790
  },
791
- deleteProperty(i, u) {
791
+ deleteProperty(s, u) {
792
792
  var o = n.get(u);
793
793
  if (o === void 0) {
794
- if (u in i) {
795
- const d = l(() => /* @__PURE__ */ be(V));
796
- n.set(u, d), Kt(s);
794
+ if (u in s) {
795
+ const c = l(() => /* @__PURE__ */ be(Y));
796
+ n.set(u, c), qt(a);
797
797
  }
798
798
  } else
799
- j(o, V), Kt(s);
799
+ z(o, Y), qt(a);
800
800
  return !0;
801
801
  },
802
- get(i, u, o) {
803
- if (u === qe)
802
+ get(s, u, o) {
803
+ if (u === Ke)
804
804
  return e;
805
- var d = n.get(u), v = u in i;
806
- if (d === void 0 && (!v || ht(i, u)?.writable) && (d = l(() => {
807
- var p = ze(v ? i[u] : V), c = /* @__PURE__ */ be(p);
808
- return c;
809
- }), n.set(u, d)), d !== void 0) {
810
- var _ = f(d);
811
- return _ === V ? void 0 : _;
805
+ var c = n.get(u), d = u in s;
806
+ if (c === void 0 && (!d || ht(s, u)?.writable) && (c = l(() => {
807
+ var h = He(d ? s[u] : Y), v = /* @__PURE__ */ be(h);
808
+ return v;
809
+ }), n.set(u, c)), c !== void 0) {
810
+ var p = f(c);
811
+ return p === Y ? void 0 : p;
812
812
  }
813
- return Reflect.get(i, u, o);
813
+ return Reflect.get(s, u, o);
814
814
  },
815
- getOwnPropertyDescriptor(i, u) {
816
- var o = Reflect.getOwnPropertyDescriptor(i, u);
815
+ getOwnPropertyDescriptor(s, u) {
816
+ var o = Reflect.getOwnPropertyDescriptor(s, u);
817
817
  if (o && "value" in o) {
818
- var d = n.get(u);
819
- d && (o.value = f(d));
818
+ var c = n.get(u);
819
+ c && (o.value = f(c));
820
820
  } else if (o === void 0) {
821
- var v = n.get(u), _ = v?.v;
822
- if (v !== void 0 && _ !== V)
821
+ var d = n.get(u), p = d?.v;
822
+ if (d !== void 0 && p !== Y)
823
823
  return {
824
824
  enumerable: !0,
825
825
  configurable: !0,
826
- value: _,
826
+ value: p,
827
827
  writable: !0
828
828
  };
829
829
  }
830
830
  return o;
831
831
  },
832
- has(i, u) {
833
- if (u === qe)
832
+ has(s, u) {
833
+ if (u === Ke)
834
834
  return !0;
835
- var o = n.get(u), d = o !== void 0 && o.v !== V || Reflect.has(i, u);
836
- if (o !== void 0 || M !== null && (!d || ht(i, u)?.writable)) {
835
+ var o = n.get(u), c = o !== void 0 && o.v !== Y || Reflect.has(s, u);
836
+ if (o !== void 0 || x !== null && (!c || ht(s, u)?.writable)) {
837
837
  o === void 0 && (o = l(() => {
838
- var _ = d ? ze(i[u]) : V, p = /* @__PURE__ */ be(_);
839
- return p;
838
+ var p = c ? He(s[u]) : Y, h = /* @__PURE__ */ be(p);
839
+ return h;
840
840
  }), n.set(u, o));
841
- var v = f(o);
842
- if (v === V)
841
+ var d = f(o);
842
+ if (d === Y)
843
843
  return !1;
844
844
  }
845
- return d;
845
+ return c;
846
846
  },
847
- set(i, u, o, d) {
848
- var v = n.get(u), _ = u in i;
847
+ set(s, u, o, c) {
848
+ var d = n.get(u), p = u in s;
849
849
  if (r && u === "length")
850
- for (var p = o; p < /** @type {Source<number>} */
851
- v.v; p += 1) {
852
- var c = n.get(p + "");
853
- c !== void 0 ? j(c, V) : p in i && (c = l(() => /* @__PURE__ */ be(V)), n.set(p + "", c));
850
+ for (var h = o; h < /** @type {Source<number>} */
851
+ d.v; h += 1) {
852
+ var v = n.get(h + "");
853
+ v !== void 0 ? z(v, Y) : h in s && (v = l(() => /* @__PURE__ */ be(Y)), n.set(h + "", v));
854
854
  }
855
- if (v === void 0)
856
- (!_ || ht(i, u)?.writable) && (v = l(() => /* @__PURE__ */ be(void 0)), j(v, ze(o)), n.set(u, v));
855
+ if (d === void 0)
856
+ (!p || ht(s, u)?.writable) && (d = l(() => /* @__PURE__ */ be(void 0)), z(d, He(o)), n.set(u, d));
857
857
  else {
858
- _ = v.v !== V;
859
- var b = l(() => ze(o));
860
- j(v, b);
858
+ p = d.v !== Y;
859
+ var w = l(() => He(o));
860
+ z(d, w);
861
861
  }
862
- var y = Reflect.getOwnPropertyDescriptor(i, u);
863
- if (y?.set && y.set.call(d, o), !_) {
862
+ var g = Reflect.getOwnPropertyDescriptor(s, u);
863
+ if (g?.set && g.set.call(c, o), !p) {
864
864
  if (r && typeof u == "string") {
865
- var w = (
865
+ var E = (
866
866
  /** @type {Source<number>} */
867
867
  n.get("length")
868
- ), C = Number(u);
869
- Number.isInteger(C) && C >= w.v && j(w, C + 1);
868
+ ), R = Number(u);
869
+ Number.isInteger(R) && R >= E.v && z(E, R + 1);
870
870
  }
871
- Kt(s);
871
+ qt(a);
872
872
  }
873
873
  return !0;
874
874
  },
875
- ownKeys(i) {
876
- f(s);
877
- var u = Reflect.ownKeys(i).filter((v) => {
878
- var _ = n.get(v);
879
- return _ === void 0 || _.v !== V;
875
+ ownKeys(s) {
876
+ f(a);
877
+ var u = Reflect.ownKeys(s).filter((d) => {
878
+ var p = n.get(d);
879
+ return p === void 0 || p.v !== Y;
880
880
  });
881
- for (var [o, d] of n)
882
- d.v !== V && !(o in i) && u.push(o);
881
+ for (var [o, c] of n)
882
+ c.v !== Y && !(o in s) && u.push(o);
883
883
  return u;
884
884
  },
885
885
  setPrototypeOf() {
886
- ra();
886
+ ri();
887
887
  }
888
888
  }
889
889
  );
890
890
  }
891
- var pa, ha, ma;
892
- function Te(e = "") {
891
+ var hi, _i, mi;
892
+ function Me(e = "") {
893
893
  return document.createTextNode(e);
894
894
  }
895
895
  // @__NO_SIDE_EFFECTS__
896
896
  function gt(e) {
897
897
  return (
898
898
  /** @type {TemplateNode | null} */
899
- ha.call(e)
899
+ _i.call(e)
900
900
  );
901
901
  }
902
902
  // @__NO_SIDE_EFFECTS__
903
903
  function ut(e) {
904
904
  return (
905
905
  /** @type {TemplateNode | null} */
906
- ma.call(e)
906
+ mi.call(e)
907
907
  );
908
908
  }
909
909
  function A(e, t) {
910
910
  return /* @__PURE__ */ gt(e);
911
911
  }
912
- function Qe(e, t = !1) {
912
+ function Xe(e, t = !1) {
913
913
  {
914
914
  var n = /* @__PURE__ */ gt(e);
915
915
  return n instanceof Comment && n.data === "" ? /* @__PURE__ */ ut(n) : n;
916
916
  }
917
917
  }
918
- function D(e, t = 1, n = !1) {
918
+ function L(e, t = 1, n = !1) {
919
919
  let r = e;
920
920
  for (; t--; )
921
921
  r = /** @type {TemplateNode} */
922
922
  /* @__PURE__ */ ut(r);
923
923
  return r;
924
924
  }
925
- function ya(e) {
925
+ function yi(e) {
926
926
  e.textContent = "";
927
927
  }
928
- function Wn() {
928
+ function Gn() {
929
929
  return !1;
930
930
  }
931
- let gn = !1;
932
- function ba() {
933
- gn || (gn = !0, document.addEventListener(
931
+ let wn = !1;
932
+ function bi() {
933
+ wn || (wn = !0, document.addEventListener(
934
934
  "reset",
935
935
  (e) => {
936
936
  Promise.resolve().then(() => {
@@ -947,34 +947,34 @@ function ba() {
947
947
  { capture: !0 }
948
948
  ));
949
949
  }
950
- function Nt(e) {
951
- var t = S, n = M;
952
- ue(null), Ie(null);
950
+ function At(e) {
951
+ var t = S, n = x;
952
+ ue(null), ke(null);
953
953
  try {
954
954
  return e();
955
955
  } finally {
956
- ue(t), Ie(n);
956
+ ue(t), ke(n);
957
957
  }
958
958
  }
959
- function wa(e, t, n, r = n) {
960
- e.addEventListener(t, () => Nt(n));
961
- const s = e.__on_r;
962
- s ? e.__on_r = () => {
963
- s(), r(!0);
964
- } : e.__on_r = () => r(!0), ba();
959
+ function gi(e, t, n, r = n) {
960
+ e.addEventListener(t, () => At(n));
961
+ const a = e.__on_r;
962
+ a ? e.__on_r = () => {
963
+ a(), r(!0);
964
+ } : e.__on_r = () => r(!0), bi();
965
965
  }
966
966
  function Zn(e) {
967
- M === null && (S === null && $r(), Qr()), De && Xr();
967
+ x === null && (S === null && $r(), Xr()), De && Qr();
968
968
  }
969
- function ga(e, t) {
969
+ function wi(e, t) {
970
970
  var n = t.last;
971
971
  n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
972
972
  }
973
- function Re(e, t, n) {
974
- var r = M;
975
- r !== null && (r.f & X) !== 0 && (e |= X);
976
- var s = {
977
- ctx: U,
973
+ function Ce(e, t, n) {
974
+ var r = x;
975
+ r !== null && (r.f & Q) !== 0 && (e |= Q);
976
+ var a = {
977
+ ctx: H,
978
978
  deps: null,
979
979
  nodes: null,
980
980
  f: e | Z | ne,
@@ -991,135 +991,135 @@ function Re(e, t, n) {
991
991
  };
992
992
  if (n)
993
993
  try {
994
- Ve(s), s.f |= rn;
995
- } catch (i) {
996
- throw pe(s), i;
994
+ Ve(a), a.f |= rn;
995
+ } catch (s) {
996
+ throw he(a), s;
997
997
  }
998
- else t !== null && Oe(s);
999
- var a = s;
1000
- if (n && a.deps === null && a.teardown === null && a.nodes === null && a.first === a.last && // either `null`, or a singular child
1001
- (a.f & Mt) === 0 && (a = a.first, (e & me) !== 0 && (e & tt) !== 0 && a !== null && (a.f |= tt)), a !== null && (a.parent = r, r !== null && ga(a, r), S !== null && (S.f & q) !== 0 && (e & He) === 0)) {
998
+ else t !== null && Ne(a);
999
+ var i = a;
1000
+ if (n && i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && // either `null`, or a singular child
1001
+ (i.f & Rt) === 0 && (i = i.first, (e & me) !== 0 && (e & tt) !== 0 && i !== null && (i.f |= tt)), i !== null && (i.parent = r, r !== null && wi(i, r), S !== null && (S.f & V) !== 0 && (e & Ye) === 0)) {
1002
1002
  var l = (
1003
1003
  /** @type {Derived} */
1004
1004
  S
1005
1005
  );
1006
- (l.effects ??= []).push(a);
1006
+ (l.effects ??= []).push(i);
1007
1007
  }
1008
- return s;
1008
+ return a;
1009
1009
  }
1010
- function Et() {
1010
+ function wt() {
1011
1011
  return S !== null && !le;
1012
1012
  }
1013
1013
  function un(e) {
1014
- const t = Re(Ct, null, !1);
1015
- return K(t, z), t.teardown = e, t;
1014
+ const t = Ce(Ct, null, !1);
1015
+ return K(t, q), t.teardown = e, t;
1016
1016
  }
1017
1017
  function En(e) {
1018
1018
  Zn();
1019
1019
  var t = (
1020
1020
  /** @type {Effect} */
1021
- M.f
1021
+ x.f
1022
1022
  ), n = !S && (t & ye) !== 0 && (t & rn) === 0;
1023
1023
  if (n) {
1024
1024
  var r = (
1025
1025
  /** @type {ComponentContext} */
1026
- U
1026
+ H
1027
1027
  );
1028
1028
  (r.e ??= []).push(e);
1029
1029
  } else
1030
1030
  return Jn(e);
1031
1031
  }
1032
1032
  function Jn(e) {
1033
- return Re(On | Fn, e, !1);
1033
+ return Ce(Nn | Fn, e, !1);
1034
1034
  }
1035
- function Ea(e) {
1036
- return Zn(), Re(Ct | Fn, e, !0);
1035
+ function Ei(e) {
1036
+ return Zn(), Ce(Ct | Fn, e, !0);
1037
1037
  }
1038
- function Ke(e, t) {
1038
+ function qe(e, t) {
1039
1039
  var n = (
1040
1040
  /** @type {ComponentContextLegacy} */
1041
- U
1041
+ H
1042
1042
  ), r = { effect: null, ran: !1, deps: e };
1043
- n.l.$.push(r), r.effect = cn(() => {
1044
- e(), !r.ran && (r.ran = !0, E(t));
1043
+ n.l.$.push(r), r.effect = fn(() => {
1044
+ e(), !r.ran && (r.ran = !0, P(t));
1045
1045
  });
1046
1046
  }
1047
- function fn() {
1047
+ function cn() {
1048
1048
  var e = (
1049
1049
  /** @type {ComponentContextLegacy} */
1050
- U
1050
+ H
1051
1051
  );
1052
- cn(() => {
1052
+ fn(() => {
1053
1053
  for (var t of e.l.$) {
1054
1054
  t.deps();
1055
1055
  var n = t.effect;
1056
- (n.f & z) !== 0 && K(n, re), Ye(n) && Ve(n), t.ran = !1;
1056
+ (n.f & q) !== 0 && K(n, re), Be(n) && Ve(n), t.ran = !1;
1057
1057
  }
1058
1058
  });
1059
1059
  }
1060
- function Sa(e) {
1061
- return Re(an | Mt, e, !0);
1060
+ function Pi(e) {
1061
+ return Ce(an | Rt, e, !0);
1062
1062
  }
1063
- function cn(e, t = 0) {
1064
- return Re(Ct | t, e, !0);
1063
+ function fn(e, t = 0) {
1064
+ return Ce(Ct | t, e, !0);
1065
1065
  }
1066
1066
  function oe(e, t = [], n = [], r = []) {
1067
- fa(r, t, n, (s) => {
1068
- Re(Ct, () => e(...s.map(f)), !0);
1067
+ ci(r, t, n, (a) => {
1068
+ Ce(Ct, () => e(...a.map(f)), !0);
1069
1069
  });
1070
1070
  }
1071
- function Xn(e, t = 0) {
1072
- var n = Re(me | t, e, !0);
1071
+ function Qn(e, t = 0) {
1072
+ var n = Ce(me | t, e, !0);
1073
1073
  return n;
1074
1074
  }
1075
- function it(e) {
1076
- return Re(ye | Mt, e, !0);
1075
+ function at(e) {
1076
+ return Ce(ye | Rt, e, !0);
1077
1077
  }
1078
- function Qn(e) {
1078
+ function Xn(e) {
1079
1079
  var t = e.teardown;
1080
1080
  if (t !== null) {
1081
1081
  const n = De, r = S;
1082
- Sn(!0), ue(null);
1082
+ Pn(!0), ue(null);
1083
1083
  try {
1084
1084
  t.call(null);
1085
1085
  } finally {
1086
- Sn(n), ue(r);
1086
+ Pn(n), ue(r);
1087
1087
  }
1088
1088
  }
1089
1089
  }
1090
1090
  function $n(e, t = !1) {
1091
1091
  var n = e.first;
1092
1092
  for (e.first = e.last = null; n !== null; ) {
1093
- const s = n.ac;
1094
- s !== null && Nt(() => {
1095
- s.abort(Be);
1093
+ const a = n.ac;
1094
+ a !== null && At(() => {
1095
+ a.abort(ze);
1096
1096
  });
1097
1097
  var r = n.next;
1098
- (n.f & He) !== 0 ? n.parent = null : pe(n, t), n = r;
1098
+ (n.f & Ye) !== 0 ? n.parent = null : he(n, t), n = r;
1099
1099
  }
1100
1100
  }
1101
- function Pa(e) {
1101
+ function Si(e) {
1102
1102
  for (var t = e.first; t !== null; ) {
1103
1103
  var n = t.next;
1104
- (t.f & ye) === 0 && pe(t), t = n;
1104
+ (t.f & ye) === 0 && he(t), t = n;
1105
1105
  }
1106
1106
  }
1107
- function pe(e, t = !0) {
1107
+ function he(e, t = !0) {
1108
1108
  var n = !1;
1109
- (t || (e.f & Dn) !== 0) && e.nodes !== null && e.nodes.end !== null && (ka(
1109
+ (t || (e.f & Dn) !== 0) && e.nodes !== null && e.nodes.end !== null && (Ii(
1110
1110
  e.nodes.start,
1111
1111
  /** @type {TemplateNode} */
1112
1112
  e.nodes.end
1113
- ), n = !0), $n(e, t && !n), Pt(e, 0), K(e, _e);
1113
+ ), n = !0), $n(e, t && !n), Pt(e, 0), K(e, pe);
1114
1114
  var r = e.nodes && e.nodes.t;
1115
1115
  if (r !== null)
1116
- for (const a of r)
1117
- a.stop();
1118
- Qn(e);
1119
- var s = e.parent;
1120
- s !== null && s.first !== null && er(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1116
+ for (const i of r)
1117
+ i.stop();
1118
+ Xn(e);
1119
+ var a = e.parent;
1120
+ a !== null && a.first !== null && er(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1121
1121
  }
1122
- function ka(e, t) {
1122
+ function Ii(e, t) {
1123
1123
  for (; e !== null; ) {
1124
1124
  var n = e === t ? null : /* @__PURE__ */ ut(e);
1125
1125
  e.remove(), e = n;
@@ -1132,29 +1132,29 @@ function er(e) {
1132
1132
  function dn(e, t, n = !0) {
1133
1133
  var r = [];
1134
1134
  tr(e, r, !0);
1135
- var s = () => {
1136
- n && pe(e), t && t();
1137
- }, a = r.length;
1138
- if (a > 0) {
1139
- var l = () => --a || s();
1140
- for (var i of r)
1141
- i.out(l);
1135
+ var a = () => {
1136
+ n && he(e), t && t();
1137
+ }, i = r.length;
1138
+ if (i > 0) {
1139
+ var l = () => --i || a();
1140
+ for (var s of r)
1141
+ s.out(l);
1142
1142
  } else
1143
- s();
1143
+ a();
1144
1144
  }
1145
1145
  function tr(e, t, n) {
1146
- if ((e.f & X) === 0) {
1147
- e.f ^= X;
1146
+ if ((e.f & Q) === 0) {
1147
+ e.f ^= Q;
1148
1148
  var r = e.nodes && e.nodes.t;
1149
1149
  if (r !== null)
1150
- for (const i of r)
1151
- (i.is_global || n) && t.push(i);
1152
- for (var s = e.first; s !== null; ) {
1153
- var a = s.next, l = (s.f & tt) !== 0 || // If this is a branch effect without a block effect parent,
1150
+ for (const s of r)
1151
+ (s.is_global || n) && t.push(s);
1152
+ for (var a = e.first; a !== null; ) {
1153
+ var i = a.next, l = (a.f & tt) !== 0 || // If this is a branch effect without a block effect parent,
1154
1154
  // it means the parent block effect was pruned. In that case,
1155
1155
  // transparency information was transferred to the branch effect.
1156
- (s.f & ye) !== 0 && (e.f & me) !== 0;
1157
- tr(s, t, l ? n : !1), s = a;
1156
+ (a.f & ye) !== 0 && (e.f & me) !== 0;
1157
+ tr(a, t, l ? n : !1), a = i;
1158
1158
  }
1159
1159
  }
1160
1160
  }
@@ -1162,148 +1162,148 @@ function vn(e) {
1162
1162
  nr(e, !0);
1163
1163
  }
1164
1164
  function nr(e, t) {
1165
- if ((e.f & X) !== 0) {
1166
- e.f ^= X, (e.f & z) === 0 && (K(e, Z), Oe(e));
1165
+ if ((e.f & Q) !== 0) {
1166
+ e.f ^= Q, (e.f & q) === 0 && (K(e, Z), Ne(e));
1167
1167
  for (var n = e.first; n !== null; ) {
1168
- var r = n.next, s = (n.f & tt) !== 0 || (n.f & ye) !== 0;
1169
- nr(n, s ? t : !1), n = r;
1168
+ var r = n.next, a = (n.f & tt) !== 0 || (n.f & ye) !== 0;
1169
+ nr(n, a ? t : !1), n = r;
1170
1170
  }
1171
- var a = e.nodes && e.nodes.t;
1172
- if (a !== null)
1173
- for (const l of a)
1171
+ var i = e.nodes && e.nodes.t;
1172
+ if (i !== null)
1173
+ for (const l of i)
1174
1174
  (l.is_global || t) && l.in();
1175
1175
  }
1176
1176
  }
1177
- function Ia(e, t) {
1177
+ function ki(e, t) {
1178
1178
  if (e.nodes)
1179
1179
  for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
1180
- var s = n === r ? null : /* @__PURE__ */ ut(n);
1181
- t.append(n), n = s;
1180
+ var a = n === r ? null : /* @__PURE__ */ ut(n);
1181
+ t.append(n), n = a;
1182
1182
  }
1183
1183
  }
1184
- let xe = !1;
1185
- function St(e) {
1186
- xe = e;
1184
+ let Te = !1;
1185
+ function Et(e) {
1186
+ Te = e;
1187
1187
  }
1188
1188
  let De = !1;
1189
- function Sn(e) {
1189
+ function Pn(e) {
1190
1190
  De = e;
1191
1191
  }
1192
1192
  let S = null, le = !1;
1193
1193
  function ue(e) {
1194
1194
  S = e;
1195
1195
  }
1196
- let M = null;
1197
- function Ie(e) {
1198
- M = e;
1196
+ let x = null;
1197
+ function ke(e) {
1198
+ x = e;
1199
1199
  }
1200
- let he = null;
1201
- function Ra(e) {
1202
- S !== null && (he === null ? he = [e] : he.push(e));
1200
+ let _e = null;
1201
+ function Ci(e) {
1202
+ S !== null && (_e === null ? _e = [e] : _e.push(e));
1203
1203
  }
1204
- let W = null, J = 0, Q = null;
1205
- function Ca(e) {
1206
- Q = e;
1204
+ let G = null, J = 0, X = null;
1205
+ function Ri(e) {
1206
+ X = e;
1207
1207
  }
1208
1208
  let rr = 1, st = 0, Ae = st;
1209
- function Pn(e) {
1209
+ function Sn(e) {
1210
1210
  Ae = e;
1211
1211
  }
1212
- function ar() {
1212
+ function ir() {
1213
1213
  return ++rr;
1214
1214
  }
1215
- function Ye(e) {
1215
+ function Be(e) {
1216
1216
  var t = e.f;
1217
1217
  if ((t & Z) !== 0)
1218
1218
  return !0;
1219
- if (t & q && (e.f &= ~Ne), (t & re) !== 0) {
1219
+ if (t & V && (e.f &= ~Oe), (t & re) !== 0) {
1220
1220
  var n = e.deps;
1221
1221
  if (n !== null)
1222
- for (var r = n.length, s = 0; s < r; s++) {
1223
- var a = n[s];
1224
- if (Ye(
1222
+ for (var r = n.length, a = 0; a < r; a++) {
1223
+ var i = n[a];
1224
+ if (Be(
1225
1225
  /** @type {Derived} */
1226
- a
1227
- ) && Hn(
1226
+ i
1227
+ ) && Yn(
1228
1228
  /** @type {Derived} */
1229
- a
1230
- ), a.wv > e.wv)
1229
+ i
1230
+ ), i.wv > e.wv)
1231
1231
  return !0;
1232
1232
  }
1233
1233
  (t & ne) !== 0 && // During time traveling we don't want to reset the status so that
1234
1234
  // traversal of the graph in the other batches still happens
1235
- te === null && K(e, z);
1235
+ te === null && K(e, q);
1236
1236
  }
1237
1237
  return !1;
1238
1238
  }
1239
- function ir(e, t, n = !0) {
1239
+ function ar(e, t, n = !0) {
1240
1240
  var r = e.reactions;
1241
- if (r !== null && !he?.includes(e))
1242
- for (var s = 0; s < r.length; s++) {
1243
- var a = r[s];
1244
- (a.f & q) !== 0 ? ir(
1241
+ if (r !== null && !_e?.includes(e))
1242
+ for (var a = 0; a < r.length; a++) {
1243
+ var i = r[a];
1244
+ (i.f & V) !== 0 ? ar(
1245
1245
  /** @type {Derived} */
1246
- a,
1246
+ i,
1247
1247
  t,
1248
1248
  !1
1249
- ) : t === a && (n ? K(a, Z) : (a.f & z) !== 0 && K(a, re), Oe(
1249
+ ) : t === i && (n ? K(i, Z) : (i.f & q) !== 0 && K(i, re), Ne(
1250
1250
  /** @type {Effect} */
1251
- a
1251
+ i
1252
1252
  ));
1253
1253
  }
1254
1254
  }
1255
1255
  function sr(e) {
1256
- var t = W, n = J, r = Q, s = S, a = he, l = U, i = le, u = Ae, o = e.f;
1257
- W = /** @type {null | Value[]} */
1258
- null, J = 0, Q = null, S = (o & (ye | He)) === 0 ? e : null, he = null, yt(e.ctx), le = !1, Ae = ++st, e.ac !== null && (Nt(() => {
1259
- e.ac.abort(Be);
1256
+ var t = G, n = J, r = X, a = S, i = _e, l = H, s = le, u = Ae, o = e.f;
1257
+ G = /** @type {null | Value[]} */
1258
+ null, J = 0, X = null, S = (o & (ye | Ye)) === 0 ? e : null, _e = null, mt(e.ctx), le = !1, Ae = ++st, e.ac !== null && (At(() => {
1259
+ e.ac.abort(ze);
1260
1260
  }), e.ac = null);
1261
1261
  try {
1262
- e.f |= Wt;
1263
- var d = (
1262
+ e.f |= Gt;
1263
+ var c = (
1264
1264
  /** @type {Function} */
1265
1265
  e.fn
1266
- ), v = d(), _ = e.deps;
1267
- if (W !== null) {
1268
- var p;
1269
- if (Pt(e, J), _ !== null && J > 0)
1270
- for (_.length = J + W.length, p = 0; p < W.length; p++)
1271
- _[J + p] = W[p];
1266
+ ), d = c(), p = e.deps;
1267
+ if (G !== null) {
1268
+ var h;
1269
+ if (Pt(e, J), p !== null && J > 0)
1270
+ for (p.length = J + G.length, h = 0; h < G.length; h++)
1271
+ p[J + h] = G[h];
1272
1272
  else
1273
- e.deps = _ = W;
1274
- if (Et() && (e.f & ne) !== 0)
1275
- for (p = J; p < _.length; p++)
1276
- (_[p].reactions ??= []).push(e);
1277
- } else _ !== null && J < _.length && (Pt(e, J), _.length = J);
1278
- if (lt() && Q !== null && !le && _ !== null && (e.f & (q | re | Z)) === 0)
1279
- for (p = 0; p < /** @type {Source[]} */
1280
- Q.length; p++)
1281
- ir(
1282
- Q[p],
1273
+ e.deps = p = G;
1274
+ if (wt() && (e.f & ne) !== 0)
1275
+ for (h = J; h < p.length; h++)
1276
+ (p[h].reactions ??= []).push(e);
1277
+ } else p !== null && J < p.length && (Pt(e, J), p.length = J);
1278
+ if (lt() && X !== null && !le && p !== null && (e.f & (V | re | Z)) === 0)
1279
+ for (h = 0; h < /** @type {Source[]} */
1280
+ X.length; h++)
1281
+ ar(
1282
+ X[h],
1283
1283
  /** @type {Effect} */
1284
1284
  e
1285
1285
  );
1286
- return s !== null && s !== e && (st++, Q !== null && (r === null ? r = Q : r.push(.../** @type {Source[]} */
1287
- Q))), (e.f & Se) !== 0 && (e.f ^= Se), v;
1288
- } catch (c) {
1289
- return oa(c);
1286
+ return a !== null && a !== e && (st++, X !== null && (r === null ? r = X : r.push(.../** @type {Source[]} */
1287
+ X))), (e.f & Pe) !== 0 && (e.f ^= Pe), d;
1288
+ } catch (v) {
1289
+ return oi(v);
1290
1290
  } finally {
1291
- e.f ^= Wt, W = t, J = n, Q = r, S = s, he = a, yt(l), le = i, Ae = u;
1291
+ e.f ^= Gt, G = t, J = n, X = r, S = a, _e = i, mt(l), le = s, Ae = u;
1292
1292
  }
1293
1293
  }
1294
- function Ma(e, t) {
1294
+ function xi(e, t) {
1295
1295
  let n = t.reactions;
1296
1296
  if (n !== null) {
1297
- var r = qr.call(n, e);
1297
+ var r = Kr.call(n, e);
1298
1298
  if (r !== -1) {
1299
- var s = n.length - 1;
1300
- s === 0 ? n = t.reactions = null : (n[r] = n[s], n.pop());
1299
+ var a = n.length - 1;
1300
+ a === 0 ? n = t.reactions = null : (n[r] = n[a], n.pop());
1301
1301
  }
1302
1302
  }
1303
- n === null && (t.f & q) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1303
+ n === null && (t.f & V) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1304
1304
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1305
1305
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1306
- (W === null || !W.includes(t)) && (K(t, re), (t.f & ne) !== 0 && (t.f ^= ne, t.f &= ~Ne), Vn(
1306
+ (G === null || !G.includes(t)) && (K(t, re), (t.f & ne) !== 0 && (t.f ^= ne, t.f &= ~Oe), Vn(
1307
1307
  /** @type {Derived} **/
1308
1308
  t
1309
1309
  ), Pt(
@@ -1316,58 +1316,58 @@ function Pt(e, t) {
1316
1316
  var n = e.deps;
1317
1317
  if (n !== null)
1318
1318
  for (var r = t; r < n.length; r++)
1319
- Ma(e, n[r]);
1319
+ xi(e, n[r]);
1320
1320
  }
1321
1321
  function Ve(e) {
1322
1322
  var t = e.f;
1323
- if ((t & _e) === 0) {
1324
- K(e, z);
1325
- var n = M, r = xe;
1326
- M = e, xe = !0;
1323
+ if ((t & pe) === 0) {
1324
+ K(e, q);
1325
+ var n = x, r = Te;
1326
+ x = e, Te = !0;
1327
1327
  try {
1328
- (t & (me | Wr)) !== 0 ? Pa(e) : $n(e), Qn(e);
1329
- var s = sr(e);
1330
- e.teardown = typeof s == "function" ? s : null, e.wv = rr;
1331
- var a;
1332
- Ht && xr && (e.f & Z) !== 0 && e.deps;
1328
+ (t & (me | Gr)) !== 0 ? Si(e) : $n(e), Xn(e);
1329
+ var a = sr(e);
1330
+ e.teardown = typeof a == "function" ? a : null, e.wv = rr;
1331
+ var i;
1332
+ Yt && Tr && (e.f & Z) !== 0 && e.deps;
1333
1333
  } finally {
1334
- xe = r, M = n;
1334
+ Te = r, x = n;
1335
1335
  }
1336
1336
  }
1337
1337
  }
1338
- async function Ta() {
1339
- await Promise.resolve(), la();
1338
+ async function Mi() {
1339
+ await Promise.resolve(), li();
1340
1340
  }
1341
1341
  function f(e) {
1342
- var t = e.f, n = (t & q) !== 0;
1342
+ var t = e.f, n = (t & V) !== 0;
1343
1343
  if (S !== null && !le) {
1344
- var r = M !== null && (M.f & _e) !== 0;
1345
- if (!r && !he?.includes(e)) {
1346
- var s = S.deps;
1347
- if ((S.f & Wt) !== 0)
1348
- e.rv < st && (e.rv = st, W === null && s !== null && s[J] === e ? J++ : W === null ? W = [e] : W.includes(e) || W.push(e));
1344
+ var r = x !== null && (x.f & pe) !== 0;
1345
+ if (!r && !_e?.includes(e)) {
1346
+ var a = S.deps;
1347
+ if ((S.f & Gt) !== 0)
1348
+ e.rv < st && (e.rv = st, G === null && a !== null && a[J] === e ? J++ : G === null ? G = [e] : G.includes(e) || G.push(e));
1349
1349
  else {
1350
1350
  (S.deps ??= []).push(e);
1351
- var a = e.reactions;
1352
- a === null ? e.reactions = [S] : a.includes(S) || a.push(S);
1351
+ var i = e.reactions;
1352
+ i === null ? e.reactions = [S] : i.includes(S) || i.push(S);
1353
1353
  }
1354
1354
  }
1355
1355
  }
1356
1356
  if (De) {
1357
- if (Pe.has(e))
1358
- return Pe.get(e);
1357
+ if (Se.has(e))
1358
+ return Se.get(e);
1359
1359
  if (n) {
1360
1360
  var l = (
1361
1361
  /** @type {Derived} */
1362
1362
  e
1363
- ), i = l.v;
1364
- return ((l.f & z) === 0 && l.reactions !== null || lr(l)) && (i = ln(l)), Pe.set(l, i), i;
1363
+ ), s = l.v;
1364
+ return ((l.f & q) === 0 && l.reactions !== null || lr(l)) && (s = ln(l)), Se.set(l, s), s;
1365
1365
  }
1366
- } else n && (!te?.has(e) || R?.is_fork && !Et()) && (l = /** @type {Derived} */
1367
- e, Ye(l) && Hn(l), xe && Et() && (l.f & ne) === 0 && or(l));
1366
+ } else n && (!te?.has(e) || C?.is_fork && !wt()) && (l = /** @type {Derived} */
1367
+ e, Be(l) && Yn(l), Te && wt() && (l.f & ne) === 0 && or(l));
1368
1368
  if (te?.has(e))
1369
1369
  return te.get(e);
1370
- if ((e.f & Se) !== 0)
1370
+ if ((e.f & Pe) !== 0)
1371
1371
  throw e.v;
1372
1372
  return e.v;
1373
1373
  }
@@ -1375,24 +1375,24 @@ function or(e) {
1375
1375
  if (e.deps !== null) {
1376
1376
  e.f ^= ne;
1377
1377
  for (const t of e.deps)
1378
- (t.reactions ??= []).push(e), (t.f & q) !== 0 && (t.f & ne) === 0 && or(
1378
+ (t.reactions ??= []).push(e), (t.f & V) !== 0 && (t.f & ne) === 0 && or(
1379
1379
  /** @type {Derived} */
1380
1380
  t
1381
1381
  );
1382
1382
  }
1383
1383
  }
1384
1384
  function lr(e) {
1385
- if (e.v === V) return !0;
1385
+ if (e.v === Y) return !0;
1386
1386
  if (e.deps === null) return !1;
1387
1387
  for (const t of e.deps)
1388
- if (Pe.has(t) || (t.f & q) !== 0 && lr(
1388
+ if (Se.has(t) || (t.f & V) !== 0 && lr(
1389
1389
  /** @type {Derived} */
1390
1390
  t
1391
1391
  ))
1392
1392
  return !0;
1393
1393
  return !1;
1394
1394
  }
1395
- function E(e) {
1395
+ function P(e) {
1396
1396
  var t = le;
1397
1397
  try {
1398
1398
  return le = !0, e();
@@ -1400,180 +1400,180 @@ function E(e) {
1400
1400
  le = t;
1401
1401
  }
1402
1402
  }
1403
- const xa = -7169;
1403
+ const Ti = -7169;
1404
1404
  function K(e, t) {
1405
- e.f = e.f & xa | t;
1405
+ e.f = e.f & Ti | t;
1406
1406
  }
1407
- function H(e) {
1407
+ function B(e) {
1408
1408
  if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
1409
- if (qe in e)
1410
- Xt(e);
1409
+ if (Ke in e)
1410
+ Qt(e);
1411
1411
  else if (!Array.isArray(e))
1412
1412
  for (let t in e) {
1413
1413
  const n = e[t];
1414
- typeof n == "object" && n && qe in n && Xt(n);
1414
+ typeof n == "object" && n && Ke in n && Qt(n);
1415
1415
  }
1416
1416
  }
1417
1417
  }
1418
- function Xt(e, t = /* @__PURE__ */ new Set()) {
1418
+ function Qt(e, t = /* @__PURE__ */ new Set()) {
1419
1419
  if (typeof e == "object" && e !== null && // We don't want to traverse DOM elements
1420
1420
  !(e instanceof EventTarget) && !t.has(e)) {
1421
1421
  t.add(e), e instanceof Date && e.getTime();
1422
1422
  for (let r in e)
1423
1423
  try {
1424
- Xt(e[r], t);
1424
+ Qt(e[r], t);
1425
1425
  } catch {
1426
1426
  }
1427
1427
  const n = An(e);
1428
1428
  if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
1429
1429
  const r = Vr(n);
1430
- for (let s in r) {
1431
- const a = r[s].get;
1432
- if (a)
1430
+ for (let a in r) {
1431
+ const i = r[a].get;
1432
+ if (i)
1433
1433
  try {
1434
- a.call(e);
1434
+ i.call(e);
1435
1435
  } catch {
1436
1436
  }
1437
1437
  }
1438
1438
  }
1439
1439
  }
1440
1440
  }
1441
- function Aa(e, t, n, r = {}) {
1442
- function s(a) {
1443
- if (r.capture || Na.call(t, a), !a.cancelBubble)
1444
- return Nt(() => n?.call(this, a));
1441
+ function Ai(e, t, n, r = {}) {
1442
+ function a(i) {
1443
+ if (r.capture || Oi.call(t, i), !i.cancelBubble)
1444
+ return At(() => n?.call(this, i));
1445
1445
  }
1446
- return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Bn(() => {
1447
- t.addEventListener(e, s, r);
1448
- }) : t.addEventListener(e, s, r), s;
1446
+ return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? zn(() => {
1447
+ t.addEventListener(e, a, r);
1448
+ }) : t.addEventListener(e, a, r), a;
1449
1449
  }
1450
- function se(e, t, n, r, s) {
1451
- var a = { capture: r, passive: s }, l = Aa(e, t, n, a);
1450
+ function se(e, t, n, r, a) {
1451
+ var i = { capture: r, passive: a }, l = Ai(e, t, n, i);
1452
1452
  (t === document.body || // @ts-ignore
1453
1453
  t === window || // @ts-ignore
1454
1454
  t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
1455
1455
  t instanceof HTMLMediaElement) && un(() => {
1456
- t.removeEventListener(e, l, a);
1456
+ t.removeEventListener(e, l, i);
1457
1457
  });
1458
1458
  }
1459
- let kn = null;
1460
- function Na(e) {
1459
+ let In = null;
1460
+ function Oi(e) {
1461
1461
  var t = this, n = (
1462
1462
  /** @type {Node} */
1463
1463
  t.ownerDocument
1464
- ), r = e.type, s = e.composedPath?.() || [], a = (
1464
+ ), r = e.type, a = e.composedPath?.() || [], i = (
1465
1465
  /** @type {null | Element} */
1466
- s[0] || e.target
1466
+ a[0] || e.target
1467
1467
  );
1468
- kn = e;
1469
- var l = 0, i = kn === e && e.__root;
1470
- if (i) {
1471
- var u = s.indexOf(i);
1468
+ In = e;
1469
+ var l = 0, s = In === e && e.__root;
1470
+ if (s) {
1471
+ var u = a.indexOf(s);
1472
1472
  if (u !== -1 && (t === document || t === /** @type {any} */
1473
1473
  window)) {
1474
1474
  e.__root = t;
1475
1475
  return;
1476
1476
  }
1477
- var o = s.indexOf(t);
1477
+ var o = a.indexOf(t);
1478
1478
  if (o === -1)
1479
1479
  return;
1480
1480
  u <= o && (l = u);
1481
1481
  }
1482
- if (a = /** @type {Element} */
1483
- s[l] || e.target, a !== t) {
1484
- xn(e, "currentTarget", {
1482
+ if (i = /** @type {Element} */
1483
+ a[l] || e.target, i !== t) {
1484
+ Tn(e, "currentTarget", {
1485
1485
  configurable: !0,
1486
1486
  get() {
1487
- return a || n;
1487
+ return i || n;
1488
1488
  }
1489
1489
  });
1490
- var d = S, v = M;
1491
- ue(null), Ie(null);
1490
+ var c = S, d = x;
1491
+ ue(null), ke(null);
1492
1492
  try {
1493
- for (var _, p = []; a !== null; ) {
1494
- var c = a.assignedSlot || a.parentNode || /** @type {any} */
1495
- a.host || null;
1493
+ for (var p, h = []; i !== null; ) {
1494
+ var v = i.assignedSlot || i.parentNode || /** @type {any} */
1495
+ i.host || null;
1496
1496
  try {
1497
- var b = a["__" + r];
1498
- b != null && (!/** @type {any} */
1499
- a.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1497
+ var w = i["__" + r];
1498
+ w != null && (!/** @type {any} */
1499
+ i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1500
1500
  // -> the target could not have been disabled because it emits the event in the first place
1501
- e.target === a) && b.call(a, e);
1502
- } catch (y) {
1503
- _ ? p.push(y) : _ = y;
1501
+ e.target === i) && w.call(i, e);
1502
+ } catch (g) {
1503
+ p ? h.push(g) : p = g;
1504
1504
  }
1505
- if (e.cancelBubble || c === t || c === null)
1505
+ if (e.cancelBubble || v === t || v === null)
1506
1506
  break;
1507
- a = c;
1507
+ i = v;
1508
1508
  }
1509
- if (_) {
1510
- for (let y of p)
1509
+ if (p) {
1510
+ for (let g of h)
1511
1511
  queueMicrotask(() => {
1512
- throw y;
1512
+ throw g;
1513
1513
  });
1514
- throw _;
1514
+ throw p;
1515
1515
  }
1516
1516
  } finally {
1517
- e.__root = t, delete e.currentTarget, ue(d), Ie(v);
1517
+ e.__root = t, delete e.currentTarget, ue(c), ke(d);
1518
1518
  }
1519
1519
  }
1520
1520
  }
1521
- function Oa(e) {
1521
+ function Ni(e) {
1522
1522
  var t = document.createElement("template");
1523
1523
  return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
1524
1524
  }
1525
- function kt(e, t) {
1525
+ function St(e, t) {
1526
1526
  var n = (
1527
1527
  /** @type {Effect} */
1528
- M
1528
+ x
1529
1529
  );
1530
1530
  n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
1531
1531
  }
1532
1532
  // @__NO_SIDE_EFFECTS__
1533
- function N(e, t) {
1534
- var n = (t & zr) !== 0, r = (t & Kr) !== 0, s, a = !e.startsWith("<!>");
1533
+ function O(e, t) {
1534
+ var n = (t & Hr) !== 0, r = (t & qr) !== 0, a, i = !e.startsWith("<!>");
1535
1535
  return () => {
1536
- s === void 0 && (s = Oa(a ? e : "<!>" + e), n || (s = /** @type {TemplateNode} */
1537
- /* @__PURE__ */ gt(s)));
1536
+ a === void 0 && (a = Ni(i ? e : "<!>" + e), n || (a = /** @type {TemplateNode} */
1537
+ /* @__PURE__ */ gt(a)));
1538
1538
  var l = (
1539
1539
  /** @type {TemplateNode} */
1540
- r || pa ? document.importNode(s, !0) : s.cloneNode(!0)
1540
+ r || hi ? document.importNode(a, !0) : a.cloneNode(!0)
1541
1541
  );
1542
1542
  if (n) {
1543
- var i = (
1543
+ var s = (
1544
1544
  /** @type {TemplateNode} */
1545
1545
  /* @__PURE__ */ gt(l)
1546
1546
  ), u = (
1547
1547
  /** @type {TemplateNode} */
1548
1548
  l.lastChild
1549
1549
  );
1550
- kt(i, u);
1550
+ St(s, u);
1551
1551
  } else
1552
- kt(l, l);
1552
+ St(l, l);
1553
1553
  return l;
1554
1554
  };
1555
1555
  }
1556
- function Da(e = "") {
1556
+ function Di(e = "") {
1557
1557
  {
1558
- var t = Te(e + "");
1559
- return kt(t, t), t;
1558
+ var t = Me(e + "");
1559
+ return St(t, t), t;
1560
1560
  }
1561
1561
  }
1562
- function _t() {
1563
- var e = document.createDocumentFragment(), t = document.createComment(""), n = Te();
1564
- return e.append(t, n), kt(t, n), e;
1562
+ function vt() {
1563
+ var e = document.createDocumentFragment(), t = document.createComment(""), n = Me();
1564
+ return e.append(t, n), St(t, n), e;
1565
1565
  }
1566
- function x(e, t) {
1566
+ function T(e, t) {
1567
1567
  e !== null && e.before(
1568
1568
  /** @type {Node} */
1569
1569
  t
1570
1570
  );
1571
1571
  }
1572
- function Me(e, t) {
1572
+ function xe(e, t) {
1573
1573
  var n = t == null ? "" : typeof t == "object" ? t + "" : t;
1574
1574
  n !== (e.__t ??= e.nodeValue) && (e.__t = n, e.nodeValue = n + "");
1575
1575
  }
1576
- class Fa {
1576
+ class Fi {
1577
1577
  /** @type {TemplateNode} */
1578
1578
  anchor;
1579
1579
  /** @type {Map<Batch, Key>} */
@@ -1608,18 +1608,18 @@ class Fa {
1608
1608
  * Whether to pause (i.e. outro) on change, or destroy immediately.
1609
1609
  * This is necessary for `<svelte:element>`
1610
1610
  */
1611
- #i = !0;
1611
+ #a = !0;
1612
1612
  /**
1613
1613
  * @param {TemplateNode} anchor
1614
1614
  * @param {boolean} transition
1615
1615
  */
1616
1616
  constructor(t, n = !0) {
1617
- this.anchor = t, this.#i = n;
1617
+ this.anchor = t, this.#a = n;
1618
1618
  }
1619
- #a = () => {
1619
+ #i = () => {
1620
1620
  var t = (
1621
1621
  /** @type {Batch} */
1622
- R
1622
+ C
1623
1623
  );
1624
1624
  if (this.#t.has(t)) {
1625
1625
  var n = (
@@ -1629,26 +1629,26 @@ class Fa {
1629
1629
  if (r)
1630
1630
  vn(r), this.#r.delete(n);
1631
1631
  else {
1632
- var s = this.#e.get(n);
1633
- s && (this.#n.set(n, s.effect), this.#e.delete(n), s.fragment.lastChild.remove(), this.anchor.before(s.fragment), r = s.effect);
1632
+ var a = this.#e.get(n);
1633
+ a && (this.#n.set(n, a.effect), this.#e.delete(n), a.fragment.lastChild.remove(), this.anchor.before(a.fragment), r = a.effect);
1634
1634
  }
1635
- for (const [a, l] of this.#t) {
1636
- if (this.#t.delete(a), a === t)
1635
+ for (const [i, l] of this.#t) {
1636
+ if (this.#t.delete(i), i === t)
1637
1637
  break;
1638
- const i = this.#e.get(l);
1639
- i && (pe(i.effect), this.#e.delete(l));
1638
+ const s = this.#e.get(l);
1639
+ s && (he(s.effect), this.#e.delete(l));
1640
1640
  }
1641
- for (const [a, l] of this.#n) {
1642
- if (a === n || this.#r.has(a)) continue;
1643
- const i = () => {
1644
- if (Array.from(this.#t.values()).includes(a)) {
1641
+ for (const [i, l] of this.#n) {
1642
+ if (i === n || this.#r.has(i)) continue;
1643
+ const s = () => {
1644
+ if (Array.from(this.#t.values()).includes(i)) {
1645
1645
  var o = document.createDocumentFragment();
1646
- Ia(l, o), o.append(Te()), this.#e.set(a, { effect: l, fragment: o });
1646
+ ki(l, o), o.append(Me()), this.#e.set(i, { effect: l, fragment: o });
1647
1647
  } else
1648
- pe(l);
1649
- this.#r.delete(a), this.#n.delete(a);
1648
+ he(l);
1649
+ this.#r.delete(i), this.#n.delete(i);
1650
1650
  };
1651
- this.#i || !r ? (this.#r.add(a), dn(l, i, !1)) : i();
1651
+ this.#a || !r ? (this.#r.add(i), dn(l, s, !1)) : s();
1652
1652
  }
1653
1653
  }
1654
1654
  };
@@ -1658,8 +1658,8 @@ class Fa {
1658
1658
  #s = (t) => {
1659
1659
  this.#t.delete(t);
1660
1660
  const n = Array.from(this.#t.values());
1661
- for (const [r, s] of this.#e)
1662
- n.includes(r) || (pe(s.effect), this.#e.delete(r));
1661
+ for (const [r, a] of this.#e)
1662
+ n.includes(r) || (he(a.effect), this.#e.delete(r));
1663
1663
  };
1664
1664
  /**
1665
1665
  *
@@ -1669,55 +1669,55 @@ class Fa {
1669
1669
  ensure(t, n) {
1670
1670
  var r = (
1671
1671
  /** @type {Batch} */
1672
- R
1673
- ), s = Wn();
1672
+ C
1673
+ ), a = Gn();
1674
1674
  if (n && !this.#n.has(t) && !this.#e.has(t))
1675
- if (s) {
1676
- var a = document.createDocumentFragment(), l = Te();
1677
- a.append(l), this.#e.set(t, {
1678
- effect: it(() => n(l)),
1679
- fragment: a
1675
+ if (a) {
1676
+ var i = document.createDocumentFragment(), l = Me();
1677
+ i.append(l), this.#e.set(t, {
1678
+ effect: at(() => n(l)),
1679
+ fragment: i
1680
1680
  });
1681
1681
  } else
1682
1682
  this.#n.set(
1683
1683
  t,
1684
- it(() => n(this.anchor))
1684
+ at(() => n(this.anchor))
1685
1685
  );
1686
- if (this.#t.set(r, t), s) {
1687
- for (const [i, u] of this.#n)
1688
- i === t ? r.skipped_effects.delete(u) : r.skipped_effects.add(u);
1689
- for (const [i, u] of this.#e)
1690
- i === t ? r.skipped_effects.delete(u.effect) : r.skipped_effects.add(u.effect);
1691
- r.oncommit(this.#a), r.ondiscard(this.#s);
1686
+ if (this.#t.set(r, t), a) {
1687
+ for (const [s, u] of this.#n)
1688
+ s === t ? r.skipped_effects.delete(u) : r.skipped_effects.add(u);
1689
+ for (const [s, u] of this.#e)
1690
+ s === t ? r.skipped_effects.delete(u.effect) : r.skipped_effects.add(u.effect);
1691
+ r.oncommit(this.#i), r.ondiscard(this.#s);
1692
1692
  } else
1693
- this.#a();
1693
+ this.#i();
1694
1694
  }
1695
1695
  }
1696
1696
  function $(e, t, n = !1) {
1697
- var r = new Fa(e), s = n ? tt : 0;
1698
- function a(l, i) {
1699
- r.ensure(l, i);
1697
+ var r = new Fi(e), a = n ? tt : 0;
1698
+ function i(l, s) {
1699
+ r.ensure(l, s);
1700
1700
  }
1701
- Xn(() => {
1701
+ Qn(() => {
1702
1702
  var l = !1;
1703
- t((i, u = !0) => {
1704
- l = !0, a(u, i);
1705
- }), l || a(!1, null);
1706
- }, s);
1707
- }
1708
- function La(e, t, n) {
1709
- for (var r = [], s = t.length, a, l = t.length, i = 0; i < s; i++) {
1710
- let v = t[i];
1703
+ t((s, u = !0) => {
1704
+ l = !0, i(u, s);
1705
+ }), l || i(!1, null);
1706
+ }, a);
1707
+ }
1708
+ function Li(e, t, n) {
1709
+ for (var r = [], a = t.length, i, l = t.length, s = 0; s < a; s++) {
1710
+ let d = t[s];
1711
1711
  dn(
1712
- v,
1712
+ d,
1713
1713
  () => {
1714
- if (a) {
1715
- if (a.pending.delete(v), a.done.add(v), a.pending.size === 0) {
1716
- var _ = (
1714
+ if (i) {
1715
+ if (i.pending.delete(d), i.done.add(d), i.pending.size === 0) {
1716
+ var p = (
1717
1717
  /** @type {Set<EachOutroGroup>} */
1718
1718
  e.outrogroups
1719
1719
  );
1720
- Qt(tn(a.done)), _.delete(a), _.size === 0 && (e.outrogroups = null);
1720
+ Xt(tn(i.done)), p.delete(i), p.size === 0 && (e.outrogroups = null);
1721
1721
  }
1722
1722
  } else
1723
1723
  l -= 1;
@@ -1731,142 +1731,142 @@ function La(e, t, n) {
1731
1731
  var o = (
1732
1732
  /** @type {Element} */
1733
1733
  n
1734
- ), d = (
1734
+ ), c = (
1735
1735
  /** @type {Element} */
1736
1736
  o.parentNode
1737
1737
  );
1738
- ya(d), d.append(o), e.items.clear();
1738
+ yi(c), c.append(o), e.items.clear();
1739
1739
  }
1740
- Qt(t, !u);
1740
+ Xt(t, !u);
1741
1741
  } else
1742
- a = {
1742
+ i = {
1743
1743
  pending: new Set(t),
1744
1744
  done: /* @__PURE__ */ new Set()
1745
- }, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(a);
1745
+ }, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(i);
1746
1746
  }
1747
- function Qt(e, t = !0) {
1747
+ function Xt(e, t = !0) {
1748
1748
  for (var n = 0; n < e.length; n++)
1749
- pe(e[n], t);
1749
+ he(e[n], t);
1750
1750
  }
1751
- var In;
1752
- function ur(e, t, n, r, s, a = null) {
1753
- var l = e, i = /* @__PURE__ */ new Map();
1751
+ var kn;
1752
+ function ur(e, t, n, r, a, i = null) {
1753
+ var l = e, s = /* @__PURE__ */ new Map();
1754
1754
  {
1755
1755
  var u = (
1756
1756
  /** @type {Element} */
1757
1757
  e
1758
1758
  );
1759
- l = u.appendChild(Te());
1760
- }
1761
- var o = null, d = /* @__PURE__ */ At(() => {
1762
- var y = n();
1763
- return Tn(y) ? y : y == null ? [] : tn(y);
1764
- }), v, _ = !0;
1765
- function p() {
1766
- b.fallback = o, ja(b, v, l, t, r), o !== null && (v.length === 0 ? (o.f & Ee) === 0 ? vn(o) : (o.f ^= Ee, $e(o, null, l)) : dn(o, () => {
1759
+ l = u.appendChild(Me());
1760
+ }
1761
+ var o = null, c = /* @__PURE__ */ Tt(() => {
1762
+ var g = n();
1763
+ return Mn(g) ? g : g == null ? [] : tn(g);
1764
+ }), d, p = !0;
1765
+ function h() {
1766
+ w.fallback = o, Ui(w, d, l, t, r), o !== null && (d.length === 0 ? (o.f & Ee) === 0 ? vn(o) : (o.f ^= Ee, $e(o, null, l)) : dn(o, () => {
1767
1767
  o = null;
1768
1768
  }));
1769
1769
  }
1770
- var c = Xn(() => {
1771
- v = /** @type {V[]} */
1772
- f(d);
1773
- for (var y = v.length, w = /* @__PURE__ */ new Set(), C = (
1770
+ var v = Qn(() => {
1771
+ d = /** @type {V[]} */
1772
+ f(c);
1773
+ for (var g = d.length, E = /* @__PURE__ */ new Set(), R = (
1774
1774
  /** @type {Batch} */
1775
- R
1776
- ), k = Wn(), g = 0; g < y; g += 1) {
1777
- var h = v[g], I = r(h, g), T = _ ? null : i.get(I);
1778
- T ? (T.v && at(T.v, h), T.i && at(T.i, g), k && C.skipped_effects.delete(T.e)) : (T = Ua(
1779
- i,
1780
- _ ? l : In ??= Te(),
1781
- h,
1782
- I,
1783
- g,
1775
+ C
1776
+ ), I = Gn(), y = 0; y < g; y += 1) {
1777
+ var m = d[y], k = r(m, y), M = p ? null : s.get(k);
1778
+ M ? (M.v && it(M.v, m), M.i && it(M.i, y), I && R.skipped_effects.delete(M.e)) : (M = ji(
1784
1779
  s,
1780
+ p ? l : kn ??= Me(),
1781
+ m,
1782
+ k,
1783
+ y,
1784
+ a,
1785
1785
  t,
1786
1786
  n
1787
- ), _ || (T.e.f |= Ee), i.set(I, T)), w.add(I);
1787
+ ), p || (M.e.f |= Ee), s.set(k, M)), E.add(k);
1788
1788
  }
1789
- if (y === 0 && a && !o && (_ ? o = it(() => a(l)) : (o = it(() => a(In ??= Te())), o.f |= Ee)), !_)
1790
- if (k) {
1791
- for (const [F, fe] of i)
1792
- w.has(F) || C.skipped_effects.add(fe.e);
1793
- C.oncommit(p), C.ondiscard(() => {
1789
+ if (g === 0 && i && !o && (p ? o = at(() => i(l)) : (o = at(() => i(kn ??= Me())), o.f |= Ee)), !p)
1790
+ if (I) {
1791
+ for (const [U, ce] of s)
1792
+ E.has(U) || R.skipped_effects.add(ce.e);
1793
+ R.oncommit(h), R.ondiscard(() => {
1794
1794
  });
1795
1795
  } else
1796
- p();
1797
- f(d);
1798
- }), b = { effect: c, items: i, outrogroups: null, fallback: o };
1799
- _ = !1;
1800
- }
1801
- function ja(e, t, n, r, s) {
1802
- var a = t.length, l = e.items, i = e.effect.first, u, o = null, d = [], v = [], _, p, c, b;
1803
- for (b = 0; b < a; b += 1) {
1804
- if (_ = t[b], p = s(_, b), c = /** @type {EachItem} */
1805
- l.get(p).e, e.outrogroups !== null)
1806
- for (const F of e.outrogroups)
1807
- F.pending.delete(c), F.done.delete(c);
1808
- if ((c.f & Ee) !== 0)
1809
- if (c.f ^= Ee, c === i)
1810
- $e(c, null, n);
1796
+ h();
1797
+ f(c);
1798
+ }), w = { effect: v, items: s, outrogroups: null, fallback: o };
1799
+ p = !1;
1800
+ }
1801
+ function Ui(e, t, n, r, a) {
1802
+ var i = t.length, l = e.items, s = e.effect.first, u, o = null, c = [], d = [], p, h, v, w;
1803
+ for (w = 0; w < i; w += 1) {
1804
+ if (p = t[w], h = a(p, w), v = /** @type {EachItem} */
1805
+ l.get(h).e, e.outrogroups !== null)
1806
+ for (const U of e.outrogroups)
1807
+ U.pending.delete(v), U.done.delete(v);
1808
+ if ((v.f & Ee) !== 0)
1809
+ if (v.f ^= Ee, v === s)
1810
+ $e(v, null, n);
1811
1811
  else {
1812
- var y = o ? o.next : i;
1813
- c === e.effect.last && (e.effect.last = c.prev), c.prev && (c.prev.next = c.next), c.next && (c.next.prev = c.prev), we(e, o, c), we(e, c, y), $e(c, y, n), o = c, d = [], v = [], i = o.next;
1812
+ var g = o ? o.next : s;
1813
+ v === e.effect.last && (e.effect.last = v.prev), v.prev && (v.prev.next = v.next), v.next && (v.next.prev = v.prev), ge(e, o, v), ge(e, v, g), $e(v, g, n), o = v, c = [], d = [], s = o.next;
1814
1814
  continue;
1815
1815
  }
1816
- if ((c.f & X) !== 0 && vn(c), c !== i) {
1817
- if (u !== void 0 && u.has(c)) {
1818
- if (d.length < v.length) {
1819
- var w = v[0], C;
1820
- o = w.prev;
1821
- var k = d[0], g = d[d.length - 1];
1822
- for (C = 0; C < d.length; C += 1)
1823
- $e(d[C], w, n);
1824
- for (C = 0; C < v.length; C += 1)
1825
- u.delete(v[C]);
1826
- we(e, k.prev, g.next), we(e, o, k), we(e, g, w), i = w, o = g, b -= 1, d = [], v = [];
1816
+ if ((v.f & Q) !== 0 && vn(v), v !== s) {
1817
+ if (u !== void 0 && u.has(v)) {
1818
+ if (c.length < d.length) {
1819
+ var E = d[0], R;
1820
+ o = E.prev;
1821
+ var I = c[0], y = c[c.length - 1];
1822
+ for (R = 0; R < c.length; R += 1)
1823
+ $e(c[R], E, n);
1824
+ for (R = 0; R < d.length; R += 1)
1825
+ u.delete(d[R]);
1826
+ ge(e, I.prev, y.next), ge(e, o, I), ge(e, y, E), s = E, o = y, w -= 1, c = [], d = [];
1827
1827
  } else
1828
- u.delete(c), $e(c, i, n), we(e, c.prev, c.next), we(e, c, o === null ? e.effect.first : o.next), we(e, o, c), o = c;
1828
+ u.delete(v), $e(v, s, n), ge(e, v.prev, v.next), ge(e, v, o === null ? e.effect.first : o.next), ge(e, o, v), o = v;
1829
1829
  continue;
1830
1830
  }
1831
- for (d = [], v = []; i !== null && i !== c; )
1832
- (u ??= /* @__PURE__ */ new Set()).add(i), v.push(i), i = i.next;
1833
- if (i === null)
1831
+ for (c = [], d = []; s !== null && s !== v; )
1832
+ (u ??= /* @__PURE__ */ new Set()).add(s), d.push(s), s = s.next;
1833
+ if (s === null)
1834
1834
  continue;
1835
1835
  }
1836
- (c.f & Ee) === 0 && d.push(c), o = c, i = c.next;
1836
+ (v.f & Ee) === 0 && c.push(v), o = v, s = v.next;
1837
1837
  }
1838
1838
  if (e.outrogroups !== null) {
1839
- for (const F of e.outrogroups)
1840
- F.pending.size === 0 && (Qt(tn(F.done)), e.outrogroups?.delete(F));
1839
+ for (const U of e.outrogroups)
1840
+ U.pending.size === 0 && (Xt(tn(U.done)), e.outrogroups?.delete(U));
1841
1841
  e.outrogroups.size === 0 && (e.outrogroups = null);
1842
1842
  }
1843
- if (i !== null || u !== void 0) {
1844
- var h = [];
1843
+ if (s !== null || u !== void 0) {
1844
+ var m = [];
1845
1845
  if (u !== void 0)
1846
- for (c of u)
1847
- (c.f & X) === 0 && h.push(c);
1848
- for (; i !== null; )
1849
- (i.f & X) === 0 && i !== e.fallback && h.push(i), i = i.next;
1850
- var I = h.length;
1851
- if (I > 0) {
1852
- var T = a === 0 ? n : null;
1853
- La(e, h, T);
1846
+ for (v of u)
1847
+ (v.f & Q) === 0 && m.push(v);
1848
+ for (; s !== null; )
1849
+ (s.f & Q) === 0 && s !== e.fallback && m.push(s), s = s.next;
1850
+ var k = m.length;
1851
+ if (k > 0) {
1852
+ var M = i === 0 ? n : null;
1853
+ Li(e, m, M);
1854
1854
  }
1855
1855
  }
1856
1856
  }
1857
- function Ua(e, t, n, r, s, a, l, i) {
1858
- var u = (l & Nr) !== 0 ? (l & Dr) === 0 ? /* @__PURE__ */ ke(n, !1, !1) : rt(n) : null, o = (l & Or) !== 0 ? rt(s) : null;
1857
+ function ji(e, t, n, r, a, i, l, s) {
1858
+ var u = (l & Or) !== 0 ? (l & Dr) === 0 ? /* @__PURE__ */ Ie(n, !1, !1) : rt(n) : null, o = (l & Nr) !== 0 ? rt(a) : null;
1859
1859
  return {
1860
1860
  v: u,
1861
1861
  i: o,
1862
- e: it(() => (a(t, u ?? n, o ?? s, i), () => {
1862
+ e: at(() => (i(t, u ?? n, o ?? a, s), () => {
1863
1863
  e.delete(r);
1864
1864
  }))
1865
1865
  };
1866
1866
  }
1867
1867
  function $e(e, t, n) {
1868
1868
  if (e.nodes)
1869
- for (var r = e.nodes.start, s = e.nodes.end, a = t && (t.f & Ee) === 0 ? (
1869
+ for (var r = e.nodes.start, a = e.nodes.end, i = t && (t.f & Ee) === 0 ? (
1870
1870
  /** @type {EffectNodes} */
1871
1871
  t.nodes.start
1872
1872
  ) : n; r !== null; ) {
@@ -1874,93 +1874,93 @@ function $e(e, t, n) {
1874
1874
  /** @type {TemplateNode} */
1875
1875
  /* @__PURE__ */ ut(r)
1876
1876
  );
1877
- if (a.before(r), r === s)
1877
+ if (i.before(r), r === a)
1878
1878
  return;
1879
1879
  r = l;
1880
1880
  }
1881
1881
  }
1882
- function we(e, t, n) {
1882
+ function ge(e, t, n) {
1883
1883
  t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
1884
1884
  }
1885
- function Rn(e, t, n, r, s) {
1886
- var a = t.$$slots?.[n], l = !1;
1887
- a === !0 && (a = t[n === "default" ? "children" : n], l = !0), a === void 0 ? s !== null && s(e) : a(e, l ? () => r : r);
1885
+ function Cn(e, t, n, r, a) {
1886
+ var i = t.$$slots?.[n], l = !1;
1887
+ i === !0 && (i = t[n === "default" ? "children" : n], l = !0), i === void 0 ? a !== null && a(e) : i(e, l ? () => r : r);
1888
1888
  }
1889
- function fr(e) {
1889
+ function cr(e) {
1890
1890
  var t, n, r = "";
1891
1891
  if (typeof e == "string" || typeof e == "number") r += e;
1892
1892
  else if (typeof e == "object") if (Array.isArray(e)) {
1893
- var s = e.length;
1894
- for (t = 0; t < s; t++) e[t] && (n = fr(e[t])) && (r && (r += " "), r += n);
1893
+ var a = e.length;
1894
+ for (t = 0; t < a; t++) e[t] && (n = cr(e[t])) && (r && (r += " "), r += n);
1895
1895
  } else for (n in e) e[n] && (r && (r += " "), r += n);
1896
1896
  return r;
1897
1897
  }
1898
- function Ba() {
1899
- for (var e, t, n = 0, r = "", s = arguments.length; n < s; n++) (e = arguments[n]) && (t = fr(e)) && (r && (r += " "), r += t);
1898
+ function zi() {
1899
+ for (var e, t, n = 0, r = "", a = arguments.length; n < a; n++) (e = arguments[n]) && (t = cr(e)) && (r && (r += " "), r += t);
1900
1900
  return r;
1901
1901
  }
1902
1902
  function It(e) {
1903
- return typeof e == "object" ? Ba(e) : e ?? "";
1903
+ return typeof e == "object" ? zi(e) : e ?? "";
1904
1904
  }
1905
- function za(e, t, n) {
1905
+ function Hi(e, t, n) {
1906
1906
  var r = e == null ? "" : "" + e;
1907
1907
  return r === "" ? null : r;
1908
1908
  }
1909
- function Ka(e, t) {
1909
+ function qi(e, t) {
1910
1910
  return e == null ? null : String(e);
1911
1911
  }
1912
- function Rt(e, t, n, r, s, a) {
1912
+ function kt(e, t, n, r, a, i) {
1913
1913
  var l = e.__className;
1914
1914
  if (l !== n || l === void 0) {
1915
- var i = za(n);
1916
- i == null ? e.removeAttribute("class") : e.className = i, e.__className = n;
1915
+ var s = Hi(n);
1916
+ s == null ? e.removeAttribute("class") : e.className = s, e.__className = n;
1917
1917
  }
1918
- return a;
1918
+ return i;
1919
1919
  }
1920
- function cr(e, t, n, r) {
1921
- var s = e.__style;
1922
- if (s !== t) {
1923
- var a = Ka(t);
1924
- a == null ? e.removeAttribute("style") : e.style.cssText = a, e.__style = t;
1920
+ function fr(e, t, n, r) {
1921
+ var a = e.__style;
1922
+ if (a !== t) {
1923
+ var i = qi(t);
1924
+ i == null ? e.removeAttribute("style") : e.style.cssText = i, e.__style = t;
1925
1925
  }
1926
1926
  return r;
1927
1927
  }
1928
- function qa(e, t, n = t) {
1928
+ function Ki(e, t, n = t) {
1929
1929
  var r = /* @__PURE__ */ new WeakSet();
1930
- wa(e, "input", async (s) => {
1931
- var a = s ? e.defaultValue : e.value;
1932
- if (a = qt(e) ? Vt(a) : a, n(a), R !== null && r.add(R), await Ta(), a !== (a = t())) {
1933
- var l = e.selectionStart, i = e.selectionEnd, u = e.value.length;
1934
- if (e.value = a ?? "", i !== null) {
1930
+ gi(e, "input", async (a) => {
1931
+ var i = a ? e.defaultValue : e.value;
1932
+ if (i = Kt(e) ? Vt(i) : i, n(i), C !== null && r.add(C), await Mi(), i !== (i = t())) {
1933
+ var l = e.selectionStart, s = e.selectionEnd, u = e.value.length;
1934
+ if (e.value = i ?? "", s !== null) {
1935
1935
  var o = e.value.length;
1936
- l === i && i === u && o > u ? (e.selectionStart = o, e.selectionEnd = o) : (e.selectionStart = l, e.selectionEnd = Math.min(i, o));
1936
+ l === s && s === u && o > u ? (e.selectionStart = o, e.selectionEnd = o) : (e.selectionStart = l, e.selectionEnd = Math.min(s, o));
1937
1937
  }
1938
1938
  }
1939
1939
  }), // If we are hydrating and the value has since changed,
1940
1940
  // then use the updated value from the input instead.
1941
1941
  // If defaultValue is set, then value == defaultValue
1942
1942
  // TODO Svelte 6: remove input.value check and set to empty string?
1943
- E(t) == null && e.value && (n(qt(e) ? Vt(e.value) : e.value), R !== null && r.add(R)), cn(() => {
1944
- var s = t();
1943
+ P(t) == null && e.value && (n(Kt(e) ? Vt(e.value) : e.value), C !== null && r.add(C)), fn(() => {
1944
+ var a = t();
1945
1945
  if (e === document.activeElement) {
1946
- var a = (
1946
+ var i = (
1947
1947
  /** @type {Batch} */
1948
- mt ?? R
1948
+ _t ?? C
1949
1949
  );
1950
- if (r.has(a))
1950
+ if (r.has(i))
1951
1951
  return;
1952
1952
  }
1953
- qt(e) && s === Vt(e.value) || e.type === "date" && !s && !e.value || s !== e.value && (e.value = s ?? "");
1953
+ Kt(e) && a === Vt(e.value) || e.type === "date" && !a && !e.value || a !== e.value && (e.value = a ?? "");
1954
1954
  });
1955
1955
  }
1956
- function qt(e) {
1956
+ function Kt(e) {
1957
1957
  var t = e.type;
1958
1958
  return t === "number" || t === "range";
1959
1959
  }
1960
1960
  function Vt(e) {
1961
1961
  return e === "" ? null : +e;
1962
1962
  }
1963
- function Va(e) {
1963
+ function Vi(e) {
1964
1964
  return function(...t) {
1965
1965
  var n = (
1966
1966
  /** @type {Event} */
@@ -1969,7 +1969,7 @@ function Va(e) {
1969
1969
  n.target === this && e?.apply(this, t);
1970
1970
  };
1971
1971
  }
1972
- function Ha(e) {
1972
+ function Yi(e) {
1973
1973
  return function(...t) {
1974
1974
  var n = (
1975
1975
  /** @type {Event} */
@@ -1978,48 +1978,48 @@ function Ha(e) {
1978
1978
  return n.preventDefault(), e?.apply(this, t);
1979
1979
  };
1980
1980
  }
1981
- function _n(e = !1) {
1981
+ function pn(e = !1) {
1982
1982
  const t = (
1983
1983
  /** @type {ComponentContextLegacy} */
1984
- U
1984
+ H
1985
1985
  ), n = t.l.u;
1986
1986
  if (!n) return;
1987
- let r = () => H(t.s);
1987
+ let r = () => B(t.s);
1988
1988
  if (e) {
1989
- let s = 0, a = (
1989
+ let a = 0, i = (
1990
1990
  /** @type {Record<string, any>} */
1991
1991
  {}
1992
1992
  );
1993
- const l = /* @__PURE__ */ xt(() => {
1994
- let i = !1;
1993
+ const l = /* @__PURE__ */ Mt(() => {
1994
+ let s = !1;
1995
1995
  const u = t.s;
1996
1996
  for (const o in u)
1997
- u[o] !== a[o] && (a[o] = u[o], i = !0);
1998
- return i && s++, s;
1997
+ u[o] !== i[o] && (i[o] = u[o], s = !0);
1998
+ return s && a++, a;
1999
1999
  });
2000
2000
  r = () => f(l);
2001
2001
  }
2002
- n.b.length && Ea(() => {
2003
- Cn(t, r), Gt(n.b);
2002
+ n.b.length && Ei(() => {
2003
+ Rn(t, r), Wt(n.b);
2004
2004
  }), En(() => {
2005
- const s = E(() => n.m.map(Gr));
2005
+ const a = P(() => n.m.map(Wr));
2006
2006
  return () => {
2007
- for (const a of s)
2008
- typeof a == "function" && a();
2007
+ for (const i of a)
2008
+ typeof i == "function" && i();
2009
2009
  };
2010
2010
  }), n.a.length && En(() => {
2011
- Cn(t, r), Gt(n.a);
2011
+ Rn(t, r), Wt(n.a);
2012
2012
  });
2013
2013
  }
2014
- function Cn(e, t) {
2014
+ function Rn(e, t) {
2015
2015
  if (e.l.s)
2016
2016
  for (const n of e.l.s) f(n);
2017
2017
  t();
2018
2018
  }
2019
2019
  function dr(e, t, n) {
2020
2020
  if (e == null)
2021
- return t(void 0), Yt;
2022
- const r = E(
2021
+ return t(void 0), Bt;
2022
+ const r = P(
2023
2023
  () => e.subscribe(
2024
2024
  t,
2025
2025
  // @ts-expect-error
@@ -2028,35 +2028,35 @@ function dr(e, t, n) {
2028
2028
  );
2029
2029
  return r.unsubscribe ? () => r.unsubscribe() : r;
2030
2030
  }
2031
- function Ya(e) {
2031
+ function Bi(e) {
2032
2032
  let t;
2033
2033
  return dr(e, (n) => t = n)(), t;
2034
2034
  }
2035
2035
  let pt = !1, $t = /* @__PURE__ */ Symbol();
2036
- function Ga(e, t, n) {
2036
+ function Wi(e, t, n) {
2037
2037
  const r = n[t] ??= {
2038
2038
  store: null,
2039
- source: /* @__PURE__ */ ke(void 0),
2040
- unsubscribe: Yt
2039
+ source: /* @__PURE__ */ Ie(void 0),
2040
+ unsubscribe: Bt
2041
2041
  };
2042
2042
  if (r.store !== e && !($t in n))
2043
2043
  if (r.unsubscribe(), r.store = e ?? null, e == null)
2044
- r.source.v = void 0, r.unsubscribe = Yt;
2044
+ r.source.v = void 0, r.unsubscribe = Bt;
2045
2045
  else {
2046
- var s = !0;
2047
- r.unsubscribe = dr(e, (a) => {
2048
- s ? r.source.v = a : j(r.source, a);
2049
- }), s = !1;
2046
+ var a = !0;
2047
+ r.unsubscribe = dr(e, (i) => {
2048
+ a ? r.source.v = i : z(r.source, i);
2049
+ }), a = !1;
2050
2050
  }
2051
- return e && $t in n ? Ya(e) : f(r.source);
2051
+ return e && $t in n ? Bi(e) : f(r.source);
2052
2052
  }
2053
- function Wa() {
2053
+ function Gi() {
2054
2054
  const e = {};
2055
2055
  function t() {
2056
2056
  un(() => {
2057
2057
  for (var n in e)
2058
2058
  e[n].unsubscribe();
2059
- xn(e, $t, {
2059
+ Tn(e, $t, {
2060
2060
  enumerable: !1,
2061
2061
  value: !0
2062
2062
  });
@@ -2064,7 +2064,7 @@ function Wa() {
2064
2064
  }
2065
2065
  return [e, t];
2066
2066
  }
2067
- function Za(e) {
2067
+ function Zi(e) {
2068
2068
  var t = pt;
2069
2069
  try {
2070
2070
  return pt = !1, [e(), pt];
@@ -2072,74 +2072,74 @@ function Za(e) {
2072
2072
  pt = t;
2073
2073
  }
2074
2074
  }
2075
- function L(e, t, n, r) {
2076
- var s = !ot || (n & Lr) !== 0, a = (n & Ur) !== 0, l = (n & Br) !== 0, i = (
2075
+ function j(e, t, n, r) {
2076
+ var a = !ot || (n & Lr) !== 0, i = (n & jr) !== 0, l = (n & zr) !== 0, s = (
2077
2077
  /** @type {V} */
2078
2078
  r
2079
- ), u = !0, o = () => (u && (u = !1, i = l ? E(
2079
+ ), u = !0, o = () => (u && (u = !1, s = l ? P(
2080
2080
  /** @type {() => V} */
2081
2081
  r
2082
2082
  ) : (
2083
2083
  /** @type {V} */
2084
2084
  r
2085
- )), i), d;
2086
- if (a) {
2087
- var v = qe in e || Zr in e;
2088
- d = ht(e, t)?.set ?? (v && t in e ? (k) => e[t] = k : void 0);
2085
+ )), s), c;
2086
+ if (i) {
2087
+ var d = Ke in e || Zr in e;
2088
+ c = ht(e, t)?.set ?? (d && t in e ? (I) => e[t] = I : void 0);
2089
2089
  }
2090
- var _, p = !1;
2091
- a ? [_, p] = Za(() => (
2090
+ var p, h = !1;
2091
+ i ? [p, h] = Zi(() => (
2092
2092
  /** @type {V} */
2093
2093
  e[t]
2094
- )) : _ = /** @type {V} */
2095
- e[t], _ === void 0 && r !== void 0 && (_ = o(), d && (s && ta(), d(_)));
2096
- var c;
2097
- if (s ? c = () => {
2098
- var k = (
2094
+ )) : p = /** @type {V} */
2095
+ e[t], p === void 0 && r !== void 0 && (p = o(), c && (a && ti(), c(p)));
2096
+ var v;
2097
+ if (a ? v = () => {
2098
+ var I = (
2099
2099
  /** @type {V} */
2100
2100
  e[t]
2101
2101
  );
2102
- return k === void 0 ? o() : (u = !0, k);
2103
- } : c = () => {
2104
- var k = (
2102
+ return I === void 0 ? o() : (u = !0, I);
2103
+ } : v = () => {
2104
+ var I = (
2105
2105
  /** @type {V} */
2106
2106
  e[t]
2107
2107
  );
2108
- return k !== void 0 && (i = /** @type {V} */
2109
- void 0), k === void 0 ? i : k;
2110
- }, s && (n & jr) === 0)
2111
- return c;
2112
- if (d) {
2113
- var b = e.$$legacy;
2108
+ return I !== void 0 && (s = /** @type {V} */
2109
+ void 0), I === void 0 ? s : I;
2110
+ }, a && (n & Ur) === 0)
2111
+ return v;
2112
+ if (c) {
2113
+ var w = e.$$legacy;
2114
2114
  return (
2115
2115
  /** @type {() => V} */
2116
- (function(k, g) {
2117
- return arguments.length > 0 ? ((!s || !g || b || p) && d(g ? c() : k), k) : c();
2116
+ (function(I, y) {
2117
+ return arguments.length > 0 ? ((!a || !y || w || h) && c(y ? v() : I), I) : v();
2118
2118
  })
2119
2119
  );
2120
2120
  }
2121
- var y = !1, w = ((n & Fr) !== 0 ? xt : At)(() => (y = !1, c()));
2122
- a && f(w);
2123
- var C = (
2121
+ var g = !1, E = ((n & Fr) !== 0 ? Mt : Tt)(() => (g = !1, v()));
2122
+ i && f(E);
2123
+ var R = (
2124
2124
  /** @type {Effect} */
2125
- M
2125
+ x
2126
2126
  );
2127
2127
  return (
2128
2128
  /** @type {() => V} */
2129
- (function(k, g) {
2129
+ (function(I, y) {
2130
2130
  if (arguments.length > 0) {
2131
- const h = g ? f(w) : s && a ? ze(k) : k;
2132
- return j(w, h), y = !0, i !== void 0 && (i = h), k;
2131
+ const m = y ? f(E) : a && i ? He(I) : I;
2132
+ return z(E, m), g = !0, s !== void 0 && (s = m), I;
2133
2133
  }
2134
- return De && y || (C.f & _e) !== 0 ? w.v : f(w);
2134
+ return De && g || (R.f & pe) !== 0 ? E.v : f(E);
2135
2135
  })
2136
2136
  );
2137
2137
  }
2138
- function Ja(e) {
2138
+ function Ji(e) {
2139
2139
  const t = e.toLowerCase();
2140
2140
  return t.includes("paystack") ? "paystack" : t.includes("hubtel") ? "hubtel" : t.includes("flutterwave") ? "flutterwave" : "paystack";
2141
2141
  }
2142
- function Xa(e, t) {
2142
+ function Qi(e, t) {
2143
2143
  return {
2144
2144
  id: e.id,
2145
2145
  clientSecret: e.client_secret,
@@ -2147,7 +2147,7 @@ function Xa(e, t) {
2147
2147
  amount: e.amount,
2148
2148
  currency: e.currency,
2149
2149
  status: e.status,
2150
- recommendedPsp: Ja(e.provider),
2150
+ recommendedPsp: Ji(e.provider),
2151
2151
  availableMethods: t.paymentMethods || ["card", "mobile_money"],
2152
2152
  reference: e.reference || t.reference,
2153
2153
  connectionId: e.connection_id,
@@ -2158,150 +2158,150 @@ function Xa(e, t) {
2158
2158
  metadata: t.metadata
2159
2159
  };
2160
2160
  }
2161
- function Qa(e) {
2162
- const { config: t, onSuccess: n, onError: r, onClose: s, onStateChange: a, apiBaseUrl: l } = e;
2163
- let i = Sr();
2164
- t.initialPaymentIntent && (i = {
2165
- ...i,
2161
+ function Xi(e) {
2162
+ const { config: t, onSuccess: n, onError: r, onClose: a, onStateChange: i, apiBaseUrl: l } = e;
2163
+ let s = Pr();
2164
+ t.initialPaymentIntent && (s = {
2165
+ ...s,
2166
2166
  status: "ready",
2167
2167
  paymentIntent: t.initialPaymentIntent,
2168
2168
  selectedMethod: t.initialPaymentIntent.availableMethods?.length === 1 ? t.initialPaymentIntent.availableMethods[0] : null
2169
2169
  });
2170
- const u = /* @__PURE__ */ new Set(), o = new Pr({
2170
+ const u = /* @__PURE__ */ new Set(), o = new Sr({
2171
2171
  publicKey: t.publicKey,
2172
2172
  baseUrl: l
2173
- }), d = () => {
2174
- u.forEach((m) => m(i));
2175
- }, v = (m) => {
2176
- const P = i.status;
2177
- i = Rr(i, m), d(), i.status !== P && a?.(i.status);
2178
- }, _ = (m) => (u.add(m), m(i), () => u.delete(m)), p = async (m) => {
2179
- v({ type: "INIT_START" });
2173
+ }), c = () => {
2174
+ u.forEach((_) => _(s));
2175
+ }, d = (_) => {
2176
+ const b = s.status;
2177
+ s = Cr(s, _), c(), s.status !== b && i?.(s.status);
2178
+ }, p = (_) => (u.add(_), _(s), () => u.delete(_)), h = async (_) => {
2179
+ d({ type: "INIT_START" });
2180
2180
  try {
2181
- const P = t.reference || kr(), Y = Ir(t.currency), ce = m || t.paymentMethods?.[0] || "card", { data: O, error: ie } = await o.createPaymentIntent(
2182
- { ...t, reference: P },
2183
- ce,
2184
- Y
2181
+ const b = t.reference || Ir(), D = kr(t.currency), fe = _ || t.paymentMethods?.[0] || "card", { data: F, error: ae } = await o.createPaymentIntent(
2182
+ { ...t, reference: b },
2183
+ fe,
2184
+ D
2185
2185
  );
2186
- if (ie) {
2187
- v({ type: "INIT_ERROR", payload: ie }), r?.(ie);
2186
+ if (ae) {
2187
+ d({ type: "INIT_ERROR", payload: ae }), r?.(ae);
2188
2188
  return;
2189
2189
  }
2190
- if (!O) {
2191
- const G = {
2190
+ if (!F) {
2191
+ const W = {
2192
2192
  code: "INIT_FAILED",
2193
2193
  message: "No data received from API",
2194
2194
  recoverable: !0
2195
2195
  };
2196
- v({ type: "INIT_ERROR", payload: G }), r?.(G);
2196
+ d({ type: "INIT_ERROR", payload: W }), r?.(W);
2197
2197
  return;
2198
2198
  }
2199
- const Ge = Xa(O, { ...t, reference: P });
2200
- v({ type: "INIT_SUCCESS", payload: Ge });
2201
- } catch (P) {
2202
- const Y = {
2199
+ const We = Qi(F, { ...t, reference: b });
2200
+ d({ type: "INIT_SUCCESS", payload: We });
2201
+ } catch (b) {
2202
+ const D = {
2203
2203
  code: "INIT_FAILED",
2204
- message: P instanceof Error ? P.message : "Failed to initialize checkout",
2204
+ message: b instanceof Error ? b.message : "Failed to initialize checkout",
2205
2205
  recoverable: !0,
2206
- originalError: P
2206
+ originalError: b
2207
2207
  };
2208
- v({ type: "INIT_ERROR", payload: Y }), r?.(Y);
2208
+ d({ type: "INIT_ERROR", payload: D }), r?.(D);
2209
2209
  }
2210
- }, c = (m) => {
2211
- v({ type: "SELECT_METHOD", payload: m });
2212
- }, b = async (m) => {
2213
- if (!(!i.paymentIntent || !i.selectedMethod)) {
2214
- v({ type: "PROCESS_START" });
2210
+ }, v = (_) => {
2211
+ d({ type: "SELECT_METHOD", payload: _ });
2212
+ }, w = async (_) => {
2213
+ if (!(!s.paymentIntent || !s.selectedMethod)) {
2214
+ d({ type: "PROCESS_START" });
2215
2215
  try {
2216
- let P;
2217
- if (i.paymentIntent.clientSecret) {
2218
- const { data: ce, error: O } = await o.confirmPaymentIntent(
2219
- i.paymentIntent.id,
2220
- i.paymentIntent.clientSecret
2216
+ let b;
2217
+ if (s.paymentIntent.clientSecret) {
2218
+ const { data: fe, error: F } = await o.confirmPaymentIntent(
2219
+ s.paymentIntent.id,
2220
+ s.paymentIntent.clientSecret
2221
2221
  );
2222
- if (O) {
2223
- v({ type: "PROCESS_ERROR", payload: O }), r?.(O);
2222
+ if (F) {
2223
+ d({ type: "PROCESS_ERROR", payload: F }), r?.(F);
2224
2224
  return;
2225
2225
  }
2226
- P = ce;
2226
+ b = fe;
2227
2227
  } else {
2228
- const { data: ce, error: O } = await o.confirmPayment(i.paymentIntent.id);
2229
- if (O) {
2230
- v({ type: "PROCESS_ERROR", payload: O }), r?.(O);
2228
+ const { data: fe, error: F } = await o.confirmPayment(s.paymentIntent.id);
2229
+ if (F) {
2230
+ d({ type: "PROCESS_ERROR", payload: F }), r?.(F);
2231
2231
  return;
2232
2232
  }
2233
- P = ce;
2233
+ b = fe;
2234
2234
  }
2235
- const Y = {
2236
- paymentId: i.paymentIntent.id,
2237
- reference: m.reference || i.paymentIntent.reference || i.paymentIntent.metadata?.reference || "",
2238
- amount: i.paymentIntent.amount,
2239
- currency: i.paymentIntent.currency,
2240
- paymentMethod: i.selectedMethod,
2241
- psp: i.paymentIntent.recommendedPsp,
2242
- pspReference: m.pspReference || P?.provider_ref_id || "",
2235
+ const D = {
2236
+ paymentId: s.paymentIntent.id,
2237
+ reference: _.reference || s.paymentIntent.reference || s.paymentIntent.metadata?.reference || "",
2238
+ amount: s.paymentIntent.amount,
2239
+ currency: s.paymentIntent.currency,
2240
+ paymentMethod: s.selectedMethod,
2241
+ psp: s.paymentIntent.recommendedPsp,
2242
+ pspReference: _.pspReference || b?.provider_ref_id || "",
2243
2243
  status: "success",
2244
- metadata: m
2244
+ metadata: _
2245
2245
  };
2246
- v({ type: "PROCESS_SUCCESS", payload: Y }), n?.(Y);
2247
- } catch (P) {
2248
- const Y = {
2246
+ d({ type: "PROCESS_SUCCESS", payload: D }), n?.(D);
2247
+ } catch (b) {
2248
+ const D = {
2249
2249
  code: "PAYMENT_FAILED",
2250
- message: P instanceof Error ? P.message : "Payment failed",
2250
+ message: b instanceof Error ? b.message : "Payment failed",
2251
2251
  recoverable: !0,
2252
- originalError: P
2252
+ originalError: b
2253
2253
  };
2254
- v({ type: "PROCESS_ERROR", payload: Y }), r?.(Y);
2254
+ d({ type: "PROCESS_ERROR", payload: D }), r?.(D);
2255
2255
  }
2256
2256
  }
2257
2257
  };
2258
2258
  return {
2259
2259
  // Svelte store contract
2260
- subscribe: _,
2260
+ subscribe: p,
2261
2261
  // Actions
2262
- initialize: p,
2263
- selectMethod: c,
2264
- processPayment: b,
2265
- handlePspSuccess: async (m) => {
2266
- await b(m);
2262
+ initialize: h,
2263
+ selectMethod: v,
2264
+ processPayment: w,
2265
+ handlePspSuccess: async (_) => {
2266
+ await w(_);
2267
2267
  },
2268
- handlePspError: (m) => {
2269
- v({ type: "PROCESS_ERROR", payload: m }), r?.(m);
2268
+ handlePspError: (_) => {
2269
+ d({ type: "PROCESS_ERROR", payload: _ }), r?.(_);
2270
2270
  },
2271
2271
  reset: () => {
2272
- v({ type: "RESET" });
2272
+ d({ type: "RESET" });
2273
2273
  },
2274
2274
  close: async () => {
2275
- if (i.paymentIntent && i.status !== "success")
2275
+ if (s.paymentIntent && s.status !== "success")
2276
2276
  try {
2277
- await o.cancelPaymentIntent(i.paymentIntent.id);
2277
+ await o.cancelPaymentIntent(s.paymentIntent.id);
2278
2278
  } catch {
2279
2279
  }
2280
- v({ type: "CLOSE" }), s?.();
2280
+ d({ type: "CLOSE" }), a?.();
2281
2281
  },
2282
2282
  // Getters
2283
- getStatus: () => i.status,
2284
- getPaymentIntent: () => i.paymentIntent,
2285
- getSelectedMethod: () => i.selectedMethod,
2286
- getError: () => i.error,
2287
- getResult: () => i.result,
2288
- isLoading: () => i.status === "loading" || i.status === "processing",
2289
- isReady: () => i.status === "ready" || i.status === "method_selected",
2290
- isComplete: () => i.status === "success",
2291
- canRetry: () => i.error?.recoverable ?? !1
2283
+ getStatus: () => s.status,
2284
+ getPaymentIntent: () => s.paymentIntent,
2285
+ getSelectedMethod: () => s.selectedMethod,
2286
+ getError: () => s.error,
2287
+ getResult: () => s.result,
2288
+ isLoading: () => s.status === "loading" || s.status === "processing",
2289
+ isReady: () => s.status === "ready" || s.status === "method_selected",
2290
+ isComplete: () => s.status === "success",
2291
+ canRetry: () => s.error?.recoverable ?? !1
2292
2292
  };
2293
2293
  }
2294
- var $a = /* @__PURE__ */ N('<div class="reevit-radio-inner"></div>'), ei = /* @__PURE__ */ N('<button type="button"><span class="reevit-method-icon"> </span> <div class="reevit-method-info"><span class="reevit-method-name"> </span> <span class="reevit-method-description"> </span></div> <div class="reevit-method-radio"><!></div></button>'), ti = /* @__PURE__ */ N('<div class="reevit-method-selector"><h3 class="reevit-section-title">Select Payment Method</h3> <p class="reevit-amount-display"> </p> <div class="reevit-methods-grid"></div></div>');
2295
- function ni(e, t) {
2294
+ var $i = /* @__PURE__ */ O('<div class="reevit-radio-inner"></div>'), ea = /* @__PURE__ */ O('<button type="button"><span class="reevit-method-icon"> </span> <div class="reevit-method-info"><span class="reevit-method-name"> </span> <span class="reevit-method-description"> </span></div> <div class="reevit-method-radio"><!></div></button>'), ta = /* @__PURE__ */ O('<div class="reevit-method-selector"><h3 class="reevit-section-title">Select Payment Method</h3> <p class="reevit-amount-display"> </p> <div class="reevit-methods-grid"></div></div>');
2295
+ function na(e, t) {
2296
2296
  sn(t, !1);
2297
- const n = /* @__PURE__ */ ke();
2298
- let r = L(t, "methods", 8), s = L(t, "selected", 8), a = L(t, "amount", 8), l = L(t, "currency", 8);
2299
- const i = en();
2300
- function u(p) {
2301
- i("select", p);
2302
- }
2303
- Ke(() => H(r()), () => {
2304
- j(n, [
2297
+ const n = /* @__PURE__ */ Ie();
2298
+ let r = j(t, "methods", 8), a = j(t, "selected", 8), i = j(t, "amount", 8), l = j(t, "currency", 8);
2299
+ const s = en();
2300
+ function u(h) {
2301
+ s("select", h);
2302
+ }
2303
+ qe(() => B(r()), () => {
2304
+ z(n, [
2305
2305
  {
2306
2306
  id: "card",
2307
2307
  name: "Card",
@@ -2320,133 +2320,345 @@ function ni(e, t) {
2320
2320
  description: "Transfer directly from your bank",
2321
2321
  icon: "🏦"
2322
2322
  }
2323
- ].filter((p) => r().includes(p.id)));
2324
- }), fn(), _n();
2325
- var o = ti(), d = D(A(o), 2), v = A(d), _ = D(d, 2);
2326
- ur(_, 5, () => f(n), (p) => p.id, (p, c) => {
2327
- var b = ei(), y = A(b), w = A(y), C = D(y, 2), k = A(C), g = A(k), h = D(k, 2), I = A(h), T = D(C, 2), F = A(T);
2323
+ ].filter((h) => r().includes(h.id)));
2324
+ }), cn(), pn();
2325
+ var o = ta(), c = L(A(o), 2), d = A(c), p = L(c, 2);
2326
+ ur(p, 5, () => f(n), (h) => h.id, (h, v) => {
2327
+ var w = ea(), g = A(w), E = A(g), R = L(g, 2), I = A(R), y = A(I), m = L(I, 2), k = A(m), M = L(R, 2), U = A(M);
2328
2328
  {
2329
- var fe = (ae) => {
2330
- var ct = $a();
2331
- x(ae, ct);
2329
+ var ce = (ie) => {
2330
+ var ct = $i();
2331
+ T(ie, ct);
2332
2332
  };
2333
- $(F, (ae) => {
2334
- H(s()), f(c), E(() => s() === f(c).id) && ae(fe);
2333
+ $(U, (ie) => {
2334
+ B(a()), f(v), P(() => a() === f(v).id) && ie(ce);
2335
2335
  });
2336
2336
  }
2337
2337
  oe(
2338
- (ae) => {
2339
- Rt(b, 1, ae), Me(w, (f(c), E(() => f(c).icon))), Me(g, (f(c), E(() => f(c).name))), Me(I, (f(c), E(() => f(c).description)));
2338
+ (ie) => {
2339
+ kt(w, 1, ie), xe(E, (f(v), P(() => f(v).icon))), xe(y, (f(v), P(() => f(v).name))), xe(k, (f(v), P(() => f(v).description)));
2340
2340
  },
2341
2341
  [
2342
- () => It((H(ge), H(s()), f(c), E(() => ge("reevit-method-card", s() === f(c).id && "reevit-method-card--selected"))))
2342
+ () => It((B(we), B(a()), f(v), P(() => we("reevit-method-card", a() === f(v).id && "reevit-method-card--selected"))))
2343
2343
  ]
2344
- ), se("click", b, () => u(f(c).id)), x(p, b);
2345
- }), oe((p) => Me(v, `Pay ${p ?? ""}`), [
2346
- () => (H(yn), H(a()), H(l()), E(() => yn(a(), l())))
2347
- ]), x(e, o), on();
2344
+ ), se("click", w, () => u(f(v).id)), T(h, w);
2345
+ }), oe((h) => xe(d, `Pay ${h ?? ""}`), [
2346
+ () => (B(yn), B(i()), B(l()), P(() => yn(i(), l())))
2347
+ ]), T(e, o), on();
2348
2348
  }
2349
- var ri = /* @__PURE__ */ N('<button type="button"><div class="reevit-network-dot"></div> </button>'), ai = /* @__PURE__ */ N('<p class="reevit-error-message"> </p>'), ii = /* @__PURE__ */ N('<span class="reevit-spinner"></span>'), si = /* @__PURE__ */ N("<span>Continue</span>"), oi = /* @__PURE__ */ N('<form class="reevit-momo-form"><div class="reevit-form-group"><label class="reevit-label" for="reevit-phone">Phone Number</label> <input id="reevit-phone" type="tel" placeholder="e.g. 024 123 4567" autocomplete="tel"/></div> <div class="reevit-network-selector"><label class="reevit-label" for="reevit-network-grid">Select Network</label> <div id="reevit-network-grid" class="reevit-networks-grid"></div></div> <!> <button type="submit" class="reevit-submit-btn"><!></button> <p class="reevit-secure-text">🔒 Secure mobile money payment via Reevit</p></form>');
2350
- function li(e, t) {
2349
+ var ra = /* @__PURE__ */ O('<button type="button"><div class="reevit-network-dot"></div> </button>'), ia = /* @__PURE__ */ O('<p class="reevit-error-message"> </p>'), aa = /* @__PURE__ */ O('<span class="reevit-spinner"></span>'), sa = /* @__PURE__ */ O("<span>Continue</span>"), oa = /* @__PURE__ */ O('<form class="reevit-momo-form"><div class="reevit-form-group"><label class="reevit-label" for="reevit-phone">Phone Number</label> <input id="reevit-phone" type="tel" placeholder="e.g. 024 123 4567" autocomplete="tel"/></div> <div class="reevit-network-selector"><label class="reevit-label" for="reevit-network-grid">Select Network</label> <div id="reevit-network-grid" class="reevit-networks-grid"></div></div> <!> <button type="submit" class="reevit-submit-btn"><!></button> <p class="reevit-secure-text">🔒 Secure mobile money payment via Reevit</p></form>');
2350
+ function la(e, t) {
2351
2351
  sn(t, !1);
2352
- let n = L(t, "initialPhone", 8, ""), r = L(t, "loading", 8, !1);
2353
- const s = en();
2354
- let a = /* @__PURE__ */ ke(n()), l = /* @__PURE__ */ ke(null), i = /* @__PURE__ */ ke(null);
2352
+ let n = j(t, "initialPhone", 8, ""), r = j(t, "loading", 8, !1);
2353
+ const a = en();
2354
+ let i = /* @__PURE__ */ Ie(n()), l = /* @__PURE__ */ Ie(null), s = /* @__PURE__ */ Ie(null);
2355
2355
  function u() {
2356
- if (!zt(f(a))) {
2357
- j(i, "Please enter a valid phone number");
2356
+ if (!Ht(f(i))) {
2357
+ z(s, "Please enter a valid phone number");
2358
2358
  return;
2359
2359
  }
2360
2360
  if (!f(l)) {
2361
- j(i, "Please select your mobile network");
2361
+ z(s, "Please select your mobile network");
2362
2362
  return;
2363
2363
  }
2364
- s("submit", { phone: f(a), network: f(l) });
2364
+ a("submit", { phone: f(i), network: f(l) });
2365
2365
  }
2366
2366
  const o = [
2367
2367
  { id: "mtn", name: "MTN", color: "#FFCC00" },
2368
2368
  { id: "vodafone", name: "Vodafone", color: "#E60000" },
2369
2369
  { id: "airteltigo", name: "AirtelTigo", color: "#005596" }
2370
2370
  ];
2371
- Ke(() => (f(a), f(i)), () => {
2372
- const h = Cr(f(a));
2373
- h && j(l, h), f(i) && j(i, null);
2374
- }), fn(), _n();
2375
- var d = oi(), v = A(d), _ = D(A(v), 2), p = D(v, 2), c = D(A(p), 2);
2376
- ur(c, 5, () => o, (h) => h.id, (h, I) => {
2377
- var T = ri(), F = A(T), fe = D(F);
2371
+ qe(() => (f(i), f(s)), () => {
2372
+ const m = Rr(f(i));
2373
+ m && z(l, m), f(s) && z(s, null);
2374
+ }), cn(), pn();
2375
+ var c = oa(), d = A(c), p = L(A(d), 2), h = L(d, 2), v = L(A(h), 2);
2376
+ ur(v, 5, () => o, (m) => m.id, (m, k) => {
2377
+ var M = ra(), U = A(M), ce = L(U);
2378
2378
  oe(
2379
- (ae) => {
2380
- Rt(T, 1, ae), T.disabled = r(), cr(F, `background-color: ${f(I), E(() => f(I).color) ?? ""}`), Me(fe, ` ${f(I), E(() => f(I).name) ?? ""}`);
2379
+ (ie) => {
2380
+ kt(M, 1, ie), M.disabled = r(), fr(U, `background-color: ${f(k), P(() => f(k).color) ?? ""}`), xe(ce, ` ${f(k), P(() => f(k).name) ?? ""}`);
2381
2381
  },
2382
2382
  [
2383
- () => It((H(ge), f(l), f(I), E(() => ge("reevit-network-btn", f(l) === f(I).id && "reevit-network-btn--selected"))))
2383
+ () => It((B(we), f(l), f(k), P(() => we("reevit-network-btn", f(l) === f(k).id && "reevit-network-btn--selected"))))
2384
2384
  ]
2385
- ), se("click", T, () => j(l, f(I).id)), x(h, T);
2385
+ ), se("click", M, () => z(l, f(k).id)), T(m, M);
2386
2386
  });
2387
- var b = D(p, 2);
2387
+ var w = L(h, 2);
2388
2388
  {
2389
- var y = (h) => {
2390
- var I = ai(), T = A(I);
2391
- oe(() => Me(T, f(i))), x(h, I);
2389
+ var g = (m) => {
2390
+ var k = ia(), M = A(k);
2391
+ oe(() => xe(M, f(s))), T(m, k);
2392
2392
  };
2393
- $(b, (h) => {
2394
- f(i) && h(y);
2393
+ $(w, (m) => {
2394
+ f(s) && m(g);
2395
2395
  });
2396
2396
  }
2397
- var w = D(b, 2), C = A(w);
2397
+ var E = L(w, 2), R = A(E);
2398
2398
  {
2399
- var k = (h) => {
2400
- var I = ii();
2401
- x(h, I);
2402
- }, g = (h) => {
2403
- var I = si();
2404
- x(h, I);
2399
+ var I = (m) => {
2400
+ var k = aa();
2401
+ T(m, k);
2402
+ }, y = (m) => {
2403
+ var k = sa();
2404
+ T(m, k);
2405
2405
  };
2406
- $(C, (h) => {
2407
- r() ? h(k) : h(g, !1);
2406
+ $(R, (m) => {
2407
+ r() ? m(I) : m(y, !1);
2408
2408
  });
2409
2409
  }
2410
2410
  oe(
2411
- (h) => {
2412
- Rt(_, 1, h), _.disabled = r(), w.disabled = r() || !f(a);
2411
+ (m) => {
2412
+ kt(p, 1, m), p.disabled = r(), E.disabled = r() || !f(i);
2413
2413
  },
2414
2414
  [
2415
- () => It((H(ge), f(i), H(zt), f(a), E(() => ge("reevit-input", f(i) && !zt(f(a)) && "reevit-input--error"))))
2415
+ () => It((B(we), f(s), B(Ht), f(i), P(() => we("reevit-input", f(s) && !Ht(f(i)) && "reevit-input--error"))))
2416
2416
  ]
2417
- ), qa(_, () => f(a), (h) => j(a, h)), se("submit", d, Ha(u)), x(e, d), on();
2417
+ ), Ki(p, () => f(i), (m) => z(i, m)), se("submit", c, Yi(u)), T(e, c), on();
2418
2418
  }
2419
- const Mn = /* @__PURE__ */ new Map();
2420
- function ft(e, t) {
2421
- const n = Mn.get(t);
2419
+ class ua {
2420
+ constructor(t) {
2421
+ this.baseUrl = "https://unified-pay.hubtel.com", this.messageHandler = null, this.stylesInjected = !1, t && (this.baseUrl = t);
2422
+ }
2423
+ /**
2424
+ * Redirects the user to the checkout page with the provided purchase information and configuration.
2425
+ * @param purchaseInfo - The purchase information.
2426
+ * @param config - The configuration.
2427
+ * @throws {Error} If the popup is blocked by the browser.
2428
+ */
2429
+ redirect({ purchaseInfo: t, config: n }) {
2430
+ const r = this.createCheckoutUrl(t, n), a = window.open(r);
2431
+ if (!a || a.closed || typeof a.closed > "u")
2432
+ throw new Error("Popup was blocked by the browser. Please allow popups for this site.");
2433
+ }
2434
+ /**
2435
+ * Initializes the iframe for the checkout process.
2436
+ *
2437
+ * @param purchaseInfo - The purchase information.
2438
+ * @param callBacks - The callback functions.
2439
+ * @param config - The configuration settings.
2440
+ * @param iframeStyle - The style options for the iframe (optional).
2441
+ * @throws {Error} If the container element with id "hubtel-checkout-iframe" is not found.
2442
+ */
2443
+ initIframe({ purchaseInfo: t, callBacks: n, config: r, iframeStyle: a }) {
2444
+ var i, l, s;
2445
+ this.registerEvents(n);
2446
+ const u = document.getElementById("hubtel-checkout-iframe");
2447
+ if (!u)
2448
+ throw new Error('Container element with id "hubtel-checkout-iframe" not found in the DOM.');
2449
+ u.innerHTML = "";
2450
+ const o = document.createElement("div");
2451
+ o.textContent = "Loading...", u.appendChild(o);
2452
+ const c = document.createElement("iframe");
2453
+ c.setAttribute("id", "hubtel-iframe-element"), c.src = this.createCheckoutUrl(t, r), c.style.display = "none", c.style.width = (i = a?.width) !== null && i !== void 0 ? i : "100%", c.style.height = (l = a?.height) !== null && l !== void 0 ? l : "100%", c.style.minHeight = a?.minHeight || "400px", c.style.border = (s = a?.border) !== null && s !== void 0 ? s : "none", c.onload = () => {
2454
+ var d;
2455
+ u.removeChild(o), c.style.display = "block", (d = n.onLoad) === null || d === void 0 || d.call(n);
2456
+ }, u.appendChild(c);
2457
+ }
2458
+ openModal({ purchaseInfo: t, callBacks: n, config: r }) {
2459
+ this.injectStyles(), this.createIframe(), this.handleBackButton(), this.registerEvents(n), this.renderWebpageInPopup(this.createCheckoutUrl(t, r), n.onClose, n.onLoad);
2460
+ }
2461
+ createCheckoutUrl(t, n) {
2462
+ const r = Object.assign(Object.assign({}, t), n), a = Object.keys(r).reduce((o, c) => (r[c] !== null && r[c] !== void 0 && (o[c] = r[c]), o), {}), i = Object.keys(a).map((o) => `${o}=${encodeURIComponent(a[o])}`).join("&"), l = this.encodeBase64(i), s = encodeURIComponent(l);
2463
+ return `${a?.branding === "disabled" ? `${this.baseUrl}/pay/direct` : `${this.baseUrl}/pay`}?p=${s}`;
2464
+ }
2465
+ encodeBase64(t) {
2466
+ return btoa(unescape(encodeURIComponent(t)));
2467
+ }
2468
+ handleBackButton() {
2469
+ window.addEventListener("popstate", () => {
2470
+ this.closePopUp();
2471
+ });
2472
+ }
2473
+ createIframe() {
2474
+ const t = document.createElement("div");
2475
+ t.setAttribute("id", "backdrop"), t.classList.add("backdrop");
2476
+ const n = document.createElement("span");
2477
+ n.classList.add("checkout-loader"), t.appendChild(n), document.body.appendChild(t);
2478
+ }
2479
+ registerEvents(t) {
2480
+ this.messageHandler && window.removeEventListener("message", this.messageHandler, !1);
2481
+ const n = (r) => {
2482
+ var a, i, l, s, u, o;
2483
+ if (r.origin !== this.baseUrl)
2484
+ return;
2485
+ const { data: c } = r;
2486
+ if (c.success === !0)
2487
+ (a = t.onPaymentSuccess) === null || a === void 0 || a.call(t, c);
2488
+ else if (c.success === !1)
2489
+ (i = t.onPaymentFailure) === null || i === void 0 || i.call(t, c);
2490
+ else if (c.initialized)
2491
+ (l = t.init) === null || l === void 0 || l.call(t, c), (s = t.onInit) === null || s === void 0 || s.call(t, c);
2492
+ else if (c.feesChanged)
2493
+ (u = t.onFeesChanged) === null || u === void 0 || u.call(t, c.fees);
2494
+ else if (c.resize) {
2495
+ const d = document.getElementById("hubtel-iframe-element");
2496
+ d && (d.style.height = c.height + "px"), (o = t?.onResize) === null || o === void 0 || o.call(t, c);
2497
+ }
2498
+ };
2499
+ this.messageHandler = n, window.addEventListener("message", n, !1);
2500
+ }
2501
+ /**
2502
+ * Removes the message event listener to prevent memory leaks.
2503
+ * Call this method when you're done with the checkout to clean up resources.
2504
+ */
2505
+ destroy() {
2506
+ this.messageHandler && (window.removeEventListener("message", this.messageHandler, !1), this.messageHandler = null);
2507
+ }
2508
+ renderWebpageInPopup(t, n, r) {
2509
+ const a = document.createElement("div");
2510
+ a.classList.add("checkout-modal");
2511
+ const i = document.createElement("div");
2512
+ i.setAttribute("id", "checkout-close-icon"), i.innerHTML = "&times;", i.classList.add("close-icon"), i.addEventListener("click", () => {
2513
+ this.closePopUp(), n?.();
2514
+ }), a.appendChild(i);
2515
+ const l = document.createElement("iframe");
2516
+ l.src = t, history.pushState({ modalOpen: !0 }, ""), l.classList.add("iframe"), a.appendChild(l), document.body.appendChild(a), a.style.opacity = "0", l.addEventListener("load", () => {
2517
+ a.style.opacity = "1", r?.();
2518
+ });
2519
+ }
2520
+ closePopUp() {
2521
+ const t = document.querySelector(".backdrop"), n = document.querySelector(".checkout-modal");
2522
+ t && document.body.removeChild(t), n && document.body.removeChild(n), history.replaceState(null, ""), window.removeEventListener("popstate", this.closePopUp);
2523
+ }
2524
+ injectStyles() {
2525
+ if (this.stylesInjected)
2526
+ return;
2527
+ const t = document.createElement("style");
2528
+ t.type = "text/css", t.setAttribute("data-hubtel-checkout", "true"), t.innerHTML = `
2529
+ .backdrop {
2530
+ position: fixed;
2531
+ left: 0;
2532
+ top: 0;
2533
+ width: 100%;
2534
+ height: 100%;
2535
+ background-color: rgba(0, 0, 0, 0.5);
2536
+ z-index: 999998;
2537
+ }
2538
+
2539
+ .loader {
2540
+ position: fixed;
2541
+ top: 50%;
2542
+ left: 50%;
2543
+ transform: translate(-50%, -50%);
2544
+ z-index: 999999;
2545
+ /* Your loader styles */
2546
+ }
2547
+
2548
+ .checkout-modal {
2549
+ position: fixed;
2550
+ top: 50%;
2551
+ left: 50%;
2552
+ transform: translate(-50%, -50%);
2553
+ width: 90%;
2554
+ height: 90%;
2555
+ padding-top: 20px;
2556
+ max-width: 480px;
2557
+ background-color: #fff;
2558
+ border-radius: 10px;
2559
+ z-index: 1000000;
2560
+ transition: opacity 0.5s ease, transform 0.5s ease;
2561
+ opacity: 0;
2562
+ }
2563
+
2564
+ .close-icon {
2565
+ position: absolute;
2566
+ top: 10px;
2567
+ width: 25px;
2568
+ height: 25px;
2569
+ font-size: 20px;
2570
+ right: 10px;
2571
+ cursor: pointer;
2572
+ color: #fff;
2573
+ background-color: #000;
2574
+ text-align: center;
2575
+ border-radius: 50%;
2576
+ }
2577
+
2578
+ .iframe {
2579
+ width: 100%;
2580
+ height: calc(100% - 20px);
2581
+ border: none;
2582
+ }
2583
+
2584
+ .checkout-loader {
2585
+ width: 30px;
2586
+ height: 30px;
2587
+ border: 3px solid #FFF;
2588
+ border-bottom-color: #42b883;
2589
+ border-radius: 50%;
2590
+ display: inline-block;
2591
+ box-sizing: border-box;
2592
+ position : fixed;
2593
+ top : 50%;
2594
+ left : 50%;
2595
+ transform : translate(-50%, -50%);
2596
+ z-index : 999999;
2597
+ animation: rotation 1s linear infinite;
2598
+ }
2599
+
2600
+ @keyframes rotation {
2601
+ 0% {
2602
+ transform: rotate(0deg);
2603
+ }
2604
+ 100% {
2605
+ transform: rotate(360deg);
2606
+ }
2607
+ }
2608
+
2609
+ @media screen and (max-width: 600px) {
2610
+ .checkout-modal {
2611
+ width: 100%;
2612
+ height: 100%;
2613
+ border-radius: 0;
2614
+ padding-bottom: 0px;
2615
+ padding-top: 0px;
2616
+ }
2617
+ .close-icon{
2618
+ top: 10px;
2619
+ right: 15px;
2620
+ }
2621
+
2622
+ .iframe {
2623
+
2624
+ height: 100%;
2625
+
2626
+ }
2627
+ }
2628
+ `, document.head.appendChild(t), this.stylesInjected = !0;
2629
+ }
2630
+ }
2631
+ const xn = /* @__PURE__ */ new Map();
2632
+ function Ot(e, t) {
2633
+ const n = xn.get(t);
2422
2634
  if (n) return n;
2423
- const r = new Promise((s, a) => {
2635
+ const r = new Promise((a, i) => {
2424
2636
  if (document.getElementById(t)) {
2425
- s();
2637
+ a();
2426
2638
  return;
2427
2639
  }
2428
2640
  const l = document.createElement("script");
2429
- l.id = t, l.src = e, l.async = !0, l.onload = () => s(), l.onerror = () => a(new Error(`Failed to load ${t} script`)), document.head.appendChild(l);
2641
+ l.id = t, l.src = e, l.async = !0, l.onload = () => a(), l.onerror = () => i(new Error(`Failed to load ${t} script`)), document.head.appendChild(l);
2430
2642
  });
2431
- return Mn.set(t, r), r;
2643
+ return xn.set(t, r), r;
2432
2644
  }
2433
- function ui() {
2434
- return ft("https://js.paystack.co/v1/inline.js", "paystack-script");
2645
+ function ca() {
2646
+ return Ot("https://js.paystack.co/v1/inline.js", "paystack-script");
2435
2647
  }
2436
- function fi() {
2437
- return ft("https://checkout.hubtel.com/js/hubtel-checkout.js", "hubtel-script");
2648
+ function Da() {
2649
+ return Promise.resolve();
2438
2650
  }
2439
- function ci() {
2440
- return ft("https://checkout.flutterwave.com/v3.js", "flutterwave-script");
2651
+ function fa() {
2652
+ return Ot("https://checkout.flutterwave.com/v3.js", "flutterwave-script");
2441
2653
  }
2442
- function di() {
2443
- return ft("https://js.stripe.com/v3/", "stripe-script");
2654
+ function da() {
2655
+ return Ot("https://js.stripe.com/v3/", "stripe-script");
2444
2656
  }
2445
- function vi() {
2446
- return ft("https://sdk.monnify.com/plugin/monnify.js", "monnify-script");
2657
+ function va() {
2658
+ return Ot("https://sdk.monnify.com/plugin/monnify.js", "monnify-script");
2447
2659
  }
2448
- async function _i(e) {
2449
- if (await ui(), !window.PaystackPop)
2660
+ async function pa(e) {
2661
+ if (await ca(), !window.PaystackPop)
2450
2662
  throw new Error("Paystack script not loaded");
2451
2663
  window.PaystackPop.setup({
2452
2664
  key: e.key,
@@ -2459,22 +2671,36 @@ async function _i(e) {
2459
2671
  onClose: e.onClose
2460
2672
  }).openIframe();
2461
2673
  }
2462
- async function pi(e) {
2463
- if (await fi(), !window.HubtelCheckout)
2464
- throw new Error("Hubtel script not loaded");
2465
- window.HubtelCheckout.initPay({
2466
- clientId: e.clientId,
2467
- purchaseDescription: e.purchaseDescription,
2674
+ async function ha(e) {
2675
+ const t = new ua(), n = {
2468
2676
  amount: e.amount,
2469
- callbackUrl: e.callbackUrl,
2470
- customerPhone: e.customerPhone,
2471
- customerEmail: e.customerEmail,
2472
- onSuccess: e.onSuccess,
2473
- onClose: e.onClose
2677
+ purchaseDescription: e.purchaseDescription,
2678
+ customerPhoneNumber: e.customerPhone || "",
2679
+ clientReference: `hubtel_${Date.now()}`
2680
+ }, r = {
2681
+ branding: "enabled",
2682
+ callbackUrl: e.callbackUrl || (typeof window < "u" ? window.location.href : ""),
2683
+ merchantAccount: typeof e.clientId == "string" ? parseInt(e.clientId, 10) : e.clientId,
2684
+ basicAuth: ""
2685
+ };
2686
+ t.openModal({
2687
+ purchaseInfo: n,
2688
+ config: r,
2689
+ callBacks: {
2690
+ onPaymentSuccess: (a) => {
2691
+ e.onSuccess(a), t.closePopUp();
2692
+ },
2693
+ onPaymentFailure: () => {
2694
+ e.onClose();
2695
+ },
2696
+ onClose: () => {
2697
+ e.onClose();
2698
+ }
2699
+ }
2474
2700
  });
2475
2701
  }
2476
- async function hi(e) {
2477
- if (await ci(), !window.FlutterwaveCheckout)
2702
+ async function _a(e) {
2703
+ if (await fa(), !window.FlutterwaveCheckout)
2478
2704
  throw new Error("Flutterwave script not loaded");
2479
2705
  window.FlutterwaveCheckout({
2480
2706
  public_key: e.public_key,
@@ -2488,13 +2714,13 @@ async function hi(e) {
2488
2714
  onclose: e.onclose
2489
2715
  });
2490
2716
  }
2491
- async function mi(e) {
2492
- if (await di(), !window.Stripe)
2717
+ async function ma(e) {
2718
+ if (await da(), !window.Stripe)
2493
2719
  throw new Error("Stripe.js not loaded");
2494
2720
  return window.Stripe(e);
2495
2721
  }
2496
- async function Ni(e) {
2497
- const n = await (await mi(e.publishableKey)).confirmPayment({
2722
+ async function Fa(e) {
2723
+ const n = await (await ma(e.publishableKey)).confirmPayment({
2498
2724
  elements: e.elements,
2499
2725
  clientSecret: e.clientSecret,
2500
2726
  redirect: "if_required"
@@ -2504,8 +2730,8 @@ async function Ni(e) {
2504
2730
  status: n.paymentIntent.status
2505
2731
  });
2506
2732
  }
2507
- async function Oi(e) {
2508
- if (await vi(), !window.MonnifySDK)
2733
+ async function ya(e) {
2734
+ if (await va(), !window.MonnifySDK)
2509
2735
  throw new Error("Monnify SDK not loaded");
2510
2736
  window.MonnifySDK.initialize({
2511
2737
  amount: e.amount,
@@ -2529,7 +2755,7 @@ async function Oi(e) {
2529
2755
  onClose: e.onClose
2530
2756
  });
2531
2757
  }
2532
- async function Di(e, t) {
2758
+ async function ba(e, t) {
2533
2759
  e.onInitiated();
2534
2760
  try {
2535
2761
  const n = await fetch(t, {
@@ -2543,8 +2769,8 @@ async function Di(e, t) {
2543
2769
  })
2544
2770
  });
2545
2771
  if (!n.ok) {
2546
- const a = (await n.json().catch(() => ({}))).message || "Failed to initiate M-Pesa payment";
2547
- return e.onError({ message: a }), { status: "failed", message: a };
2772
+ const i = (await n.json().catch(() => ({}))).message || "Failed to initiate M-Pesa payment";
2773
+ return e.onError({ message: i }), { status: "failed", message: i };
2548
2774
  }
2549
2775
  const r = await n.json();
2550
2776
  return {
@@ -2557,276 +2783,318 @@ async function Di(e, t) {
2557
2783
  return e.onError({ message: r }), { status: "failed", message: r };
2558
2784
  }
2559
2785
  }
2560
- var yi = /* @__PURE__ */ N('<span class="reevit-spinner"></span>'), bi = /* @__PURE__ */ N('<button type="button" class="reevit-pay-button"><!></button>'), wi = /* @__PURE__ */ N('<div class="reevit-loading-state"><div class="reevit-spinner reevit-spinner--large"></div> <p>Initializing payment...</p></div>'), gi = /* @__PURE__ */ N('<div class="reevit-error-state"><div class="reevit-error-icon">⚠️</div> <h3>Payment Failed</h3> <p> </p> <button class="reevit-retry-btn">Retry</button></div>'), Ei = /* @__PURE__ */ N('<div class="reevit-success-state"><div class="reevit-success-icon">✅</div> <h3>Payment Successful</h3> <p>Thank you for your payment.</p> <button class="reevit-done-btn">Done</button></div>'), Si = /* @__PURE__ */ N('<div class="reevit-method-form-container"><!></div>'), Pi = /* @__PURE__ */ N('<span class="reevit-spinner"></span>'), ki = /* @__PURE__ */ N("<span>Proceed to Card Payment</span>"), Ii = /* @__PURE__ */ N('<div class="reevit-card-info"><p class="reevit-info-text">You will be redirected to our secure payment partner to complete your card payment.</p> <button class="reevit-submit-btn"><!></button></div>'), Ri = /* @__PURE__ */ N("<!> <!> <!>", 1), Ci = /* @__PURE__ */ N('<div class="reevit-modal-overlay" role="button" tabindex="0"><div><button class="reevit-modal-close" aria-label="Close">&times;</button> <div class="reevit-modal-header"><img src="https://i.imgur.com/bzUR5Lm.png" alt="Reevit" class="reevit-modal__logo"/></div> <div class="reevit-modal-body"><!></div> <div class="reevit-modal-footer"><div class="reevit-trust-badges"><span>PCI DSS Compliant</span> <span>•</span> <span>SSL Secure</span></div></div></div></div>'), Mi = /* @__PURE__ */ N('<div class="reevit-sdk-container"><!> <!></div>');
2561
- function Fi(e, t) {
2786
+ var ga = /* @__PURE__ */ O('<span class="reevit-spinner"></span>'), wa = /* @__PURE__ */ O('<button type="button" class="reevit-pay-button"><!></button>'), Ea = /* @__PURE__ */ O('<div class="reevit-loading-state"><div class="reevit-spinner reevit-spinner--large"></div> <p>Initializing payment...</p></div>'), Pa = /* @__PURE__ */ O('<div class="reevit-error-state"><div class="reevit-error-icon">⚠️</div> <h3>Payment Failed</h3> <p> </p> <button class="reevit-retry-btn">Retry</button></div>'), Sa = /* @__PURE__ */ O('<div class="reevit-success-state"><div class="reevit-success-icon">✅</div> <h3>Payment Successful</h3> <p>Thank you for your payment.</p> <button class="reevit-done-btn">Done</button></div>'), Ia = /* @__PURE__ */ O('<div class="reevit-method-form-container"><!></div>'), ka = /* @__PURE__ */ O('<span class="reevit-spinner"></span>'), Ca = /* @__PURE__ */ O("<span>Proceed to Card Payment</span>"), Ra = /* @__PURE__ */ O('<div class="reevit-card-info"><p class="reevit-info-text">You will be redirected to our secure payment partner to complete your card payment.</p> <button class="reevit-submit-btn"><!></button></div>'), xa = /* @__PURE__ */ O("<!> <!> <!>", 1), Ma = /* @__PURE__ */ O('<div class="reevit-modal-overlay" role="button" tabindex="0"><div><button class="reevit-modal-close" aria-label="Close">&times;</button> <div class="reevit-modal-header"><img src="https://i.imgur.com/bzUR5Lm.png" alt="Reevit" class="reevit-modal__logo"/></div> <div class="reevit-modal-body"><!></div> <div class="reevit-modal-footer"><div class="reevit-trust-badges"><span>PCI DSS Compliant</span> <span>•</span> <span>SSL Secure</span></div></div></div></div>'), Ta = /* @__PURE__ */ O('<div class="reevit-sdk-container"><!> <!></div>');
2787
+ function La(e, t) {
2562
2788
  sn(t, !1);
2563
- const n = () => Ga(g, "$store", r), [r, s] = Wa(), a = /* @__PURE__ */ ke(), l = /* @__PURE__ */ ke(), i = en();
2564
- let u = L(t, "publicKey", 8), o = L(t, "amount", 8), d = L(t, "currency", 8), v = L(t, "email", 8, void 0), _ = L(t, "phone", 8, void 0), p = L(t, "reference", 8, void 0), c = L(t, "metadata", 8, void 0), b = L(t, "paymentMethods", 24, () => ["card", "mobile_money"]), y = L(t, "theme", 24, () => ({})), w = L(t, "isOpen", 12, !1), C = L(t, "apiBaseUrl", 8, void 0), k = L(t, "initialPaymentIntent", 8, void 0);
2565
- const g = Qa({
2789
+ const n = () => Wi(y, "$store", r), [r, a] = Gi(), i = /* @__PURE__ */ Ie(), l = /* @__PURE__ */ Ie(), s = en();
2790
+ let u = j(t, "publicKey", 8), o = j(t, "amount", 8), c = j(t, "currency", 8), d = j(t, "email", 8, void 0), p = j(t, "phone", 8, void 0), h = j(t, "reference", 8, void 0), v = j(t, "metadata", 8, void 0), w = j(t, "paymentMethods", 24, () => ["card", "mobile_money"]), g = j(t, "theme", 24, () => ({})), E = j(t, "isOpen", 12, !1), R = j(t, "apiBaseUrl", 8, void 0), I = j(t, "initialPaymentIntent", 8, void 0);
2791
+ const y = Xi({
2566
2792
  config: {
2567
2793
  publicKey: u(),
2568
2794
  amount: o(),
2569
- currency: d(),
2570
- email: v(),
2571
- phone: _(),
2572
- reference: p(),
2573
- metadata: c(),
2574
- paymentMethods: b(),
2575
- initialPaymentIntent: k()
2795
+ currency: c(),
2796
+ email: d(),
2797
+ phone: p(),
2798
+ reference: h(),
2799
+ metadata: v(),
2800
+ paymentMethods: w(),
2801
+ initialPaymentIntent: I()
2576
2802
  },
2577
- apiBaseUrl: C(),
2578
- onSuccess: (B) => i("success", B),
2579
- onError: (B) => i("error", B),
2803
+ apiBaseUrl: R(),
2804
+ onSuccess: (N) => s("success", N),
2805
+ onError: (N) => s("error", N),
2580
2806
  onClose: () => {
2581
- w(!1), i("close");
2807
+ E(!1), s("close");
2582
2808
  }
2583
2809
  });
2584
- function h() {
2585
- w(!0);
2810
+ function m() {
2811
+ E(!0);
2586
2812
  }
2587
- function I() {
2588
- w(!1), g.close();
2813
+ function k() {
2814
+ E(!1), y.close();
2589
2815
  }
2590
- async function T(B) {
2591
- if (!f(a).paymentIntent) return;
2592
- const m = f(a).paymentIntent.recommendedPsp;
2816
+ async function M(N) {
2817
+ if (!f(i).paymentIntent) return;
2818
+ const _ = f(i).paymentIntent.recommendedPsp;
2593
2819
  try {
2594
- m === "paystack" ? await _i({
2595
- key: u(),
2596
- email: v() || "",
2597
- amount: o(),
2598
- currency: d(),
2599
- ref: f(a).paymentIntent.id,
2600
- onSuccess: (P) => g.handlePspSuccess(P),
2601
- onClose: () => {
2602
- }
2603
- }) : m === "hubtel" ? await pi({
2604
- clientId: u(),
2605
- purchaseDescription: `Payment for ${o()} ${d()}`,
2606
- amount: o(),
2607
- customerPhone: B?.phone || _(),
2608
- customerEmail: v(),
2609
- onSuccess: (P) => g.handlePspSuccess(P),
2610
- onClose: () => {
2611
- }
2612
- }) : m === "flutterwave" && await hi({
2613
- public_key: u(),
2614
- tx_ref: f(a).paymentIntent.id,
2615
- amount: o(),
2616
- currency: d(),
2617
- customer: { email: v() || "", phone_number: B?.phone || _() },
2618
- callback: (P) => g.handlePspSuccess(P),
2619
- onclose: () => {
2620
- }
2820
+ if (_ === "paystack")
2821
+ await pa({
2822
+ key: u(),
2823
+ email: d() || "",
2824
+ amount: o(),
2825
+ currency: c(),
2826
+ ref: f(i).paymentIntent.id,
2827
+ onSuccess: (b) => y.handlePspSuccess(b),
2828
+ onClose: () => {
2829
+ }
2830
+ });
2831
+ else if (_ === "hubtel")
2832
+ await ha({
2833
+ clientId: u(),
2834
+ purchaseDescription: `Payment for ${o()} ${c()}`,
2835
+ amount: o(),
2836
+ customerPhone: N?.phone || p(),
2837
+ customerEmail: d(),
2838
+ onSuccess: (b) => y.handlePspSuccess(b),
2839
+ onClose: () => {
2840
+ }
2841
+ });
2842
+ else if (_ === "flutterwave")
2843
+ await _a({
2844
+ public_key: u(),
2845
+ tx_ref: f(i).paymentIntent.id,
2846
+ amount: o(),
2847
+ currency: c(),
2848
+ customer: { email: d() || "", phone_number: N?.phone || p() },
2849
+ callback: (b) => y.handlePspSuccess(b),
2850
+ onclose: () => {
2851
+ }
2852
+ });
2853
+ else if (_ === "monnify")
2854
+ await ya({
2855
+ apiKey: f(i).paymentIntent.pspPublicKey || u(),
2856
+ contractCode: v()?.contract_code || u(),
2857
+ amount: o(),
2858
+ currency: c(),
2859
+ reference: f(i).paymentIntent.reference || f(i).paymentIntent.id,
2860
+ customerName: v()?.customer_name || d() || "",
2861
+ customerEmail: d() || "",
2862
+ customerPhone: N?.phone || p(),
2863
+ metadata: v(),
2864
+ onSuccess: (b) => y.handlePspSuccess(b),
2865
+ onClose: () => {
2866
+ }
2867
+ });
2868
+ else if (_ === "mpesa") {
2869
+ const b = `${R() || "https://api.reevit.io"}/v1/payments/${f(i).paymentIntent.id}/mpesa`;
2870
+ await ba(
2871
+ {
2872
+ phoneNumber: N?.phone || p() || "",
2873
+ amount: o(),
2874
+ reference: f(i).paymentIntent.reference || f(i).paymentIntent.id,
2875
+ description: `Payment ${f(i).paymentIntent.reference || ""}`,
2876
+ onInitiated: () => {
2877
+ },
2878
+ onSuccess: (D) => y.handlePspSuccess(D),
2879
+ onError: (D) => y.handlePspError({ code: "MPESA_ERROR", message: D.message })
2880
+ },
2881
+ b
2882
+ );
2883
+ } else _ === "stripe" ? y.handlePspError({
2884
+ code: "STRIPE_NOT_IMPLEMENTED",
2885
+ message: "Stripe integration requires custom Elements setup. Please use the React SDK or implement custom Stripe Elements."
2886
+ }) : y.handlePspError({
2887
+ code: "UNSUPPORTED_PSP",
2888
+ message: `Payment provider "${_}" is not supported in this checkout.`
2621
2889
  });
2622
- } catch (P) {
2623
- g.handlePspError({
2890
+ } catch (b) {
2891
+ y.handlePspError({
2624
2892
  code: "BRIDGE_ERROR",
2625
- message: P instanceof Error ? P.message : "Failed to open payment gateway"
2893
+ message: b instanceof Error ? b.message : "Failed to open payment gateway"
2626
2894
  });
2627
2895
  }
2628
2896
  }
2629
- gr(() => {
2630
- w() && g.initialize();
2897
+ wr(() => {
2898
+ E() && y.initialize();
2631
2899
  }), Er(() => {
2632
2900
  typeof document < "u" && (document.body.style.overflow = "");
2633
- }), Ke(() => n(), () => {
2634
- j(a, n());
2635
- }), Ke(() => H(y()), () => {
2636
- j(l, Mr(y()));
2637
- }), Ke(() => (H(w()), f(a)), () => {
2638
- w() && f(a).paymentIntent && f(a).selectedMethod && f(a).selectedMethod === "card" && T(null);
2639
- }), Ke(() => (H(w()), f(a)), () => {
2640
- w() ? (document.body.style.overflow = "hidden", !f(a).paymentIntent && f(a).status === "idle" && g.initialize()) : typeof document < "u" && (document.body.style.overflow = "");
2641
- }), fn(), _n();
2642
- var F = Mi(), fe = A(F);
2643
- Rn(
2644
- fe,
2901
+ }), qe(() => n(), () => {
2902
+ z(i, n());
2903
+ }), qe(() => B(g()), () => {
2904
+ z(l, xr(g()));
2905
+ }), qe(() => (B(E()), f(i)), () => {
2906
+ E() && f(i).paymentIntent && f(i).selectedMethod && f(i).selectedMethod === "card" && M(null);
2907
+ }), qe(() => (B(E()), f(i)), () => {
2908
+ E() ? (document.body.style.overflow = "hidden", !f(i).paymentIntent && f(i).status === "idle" && y.initialize()) : typeof document < "u" && (document.body.style.overflow = "");
2909
+ }), cn(), pn();
2910
+ var U = Ta(), ce = A(U);
2911
+ Cn(
2912
+ ce,
2645
2913
  t,
2646
2914
  "default",
2647
2915
  {
2648
- handleOpen: h,
2916
+ handleOpen: m,
2649
2917
  get isLoading() {
2650
- return f(a), E(() => f(a).status === "loading");
2918
+ return f(i), P(() => f(i).status === "loading");
2651
2919
  }
2652
2920
  },
2653
- (B) => {
2654
- var m = bi(), P = A(m);
2921
+ (N) => {
2922
+ var _ = wa(), b = A(_);
2655
2923
  {
2656
- var Y = (O) => {
2657
- var ie = yi();
2658
- x(O, ie);
2659
- }, ce = (O) => {
2660
- var ie = _t(), Ge = Qe(ie);
2661
- Rn(Ge, t, "button-text", {}, (G) => {
2662
- var Fe = Da("Pay Now");
2663
- x(G, Fe);
2664
- }), x(O, ie);
2924
+ var D = (F) => {
2925
+ var ae = ga();
2926
+ T(F, ae);
2927
+ }, fe = (F) => {
2928
+ var ae = vt(), We = Xe(ae);
2929
+ Cn(We, t, "button-text", {}, (W) => {
2930
+ var Fe = Di("Pay Now");
2931
+ T(W, Fe);
2932
+ }), T(F, ae);
2665
2933
  };
2666
- $(P, (O) => {
2667
- f(a), E(() => f(a).status === "loading") ? O(Y) : O(ce, !1);
2934
+ $(b, (F) => {
2935
+ f(i), P(() => f(i).status === "loading") ? F(D) : F(fe, !1);
2668
2936
  });
2669
2937
  }
2670
- oe(() => m.disabled = (f(a), E(() => f(a).status === "loading"))), se("click", m, h), x(B, m);
2938
+ oe(() => _.disabled = (f(i), P(() => f(i).status === "loading"))), se("click", _, m), T(N, _);
2671
2939
  }
2672
2940
  );
2673
- var ae = D(fe, 2);
2941
+ var ie = L(ce, 2);
2674
2942
  {
2675
- var ct = (B) => {
2676
- var m = Ci(), P = A(m), Y = A(P), ce = D(Y, 4), O = A(ce);
2943
+ var ct = (N) => {
2944
+ var _ = Ma(), b = A(_), D = A(b), fe = L(D, 4), F = A(fe);
2677
2945
  {
2678
- var ie = (G) => {
2679
- var Fe = wi();
2680
- x(G, Fe);
2681
- }, Ge = (G) => {
2682
- var Fe = _t(), vr = Qe(Fe);
2946
+ var ae = (W) => {
2947
+ var Fe = Ea();
2948
+ T(W, Fe);
2949
+ }, We = (W) => {
2950
+ var Fe = vt(), vr = Xe(Fe);
2683
2951
  {
2684
- var _r = (Le) => {
2685
- var We = gi(), dt = D(A(We), 4), Ot = A(dt), Dt = D(dt, 2);
2686
- oe(() => Me(Ot, (f(a), E(() => f(a).error.message)))), se("click", Dt, () => g.initialize()), x(Le, We);
2687
- }, pr = (Le) => {
2688
- var We = _t(), dt = Qe(We);
2952
+ var pr = (Le) => {
2953
+ var Ge = Pa(), ft = L(A(Ge), 4), Nt = A(ft), Dt = L(ft, 2);
2954
+ oe(() => xe(Nt, (f(i), P(() => f(i).error.message)))), se("click", Dt, () => y.initialize()), T(Le, Ge);
2955
+ }, hr = (Le) => {
2956
+ var Ge = vt(), ft = Xe(Ge);
2689
2957
  {
2690
- var Ot = (je) => {
2691
- var Ze = Ei(), Ft = D(A(Ze), 6);
2692
- se("click", Ft, I), x(je, Ze);
2693
- }, Dt = (je) => {
2694
- var Ze = _t(), Ft = Qe(Ze);
2958
+ var Nt = (Ue) => {
2959
+ var Ze = Sa(), Ft = L(A(Ze), 6);
2960
+ se("click", Ft, k), T(Ue, Ze);
2961
+ }, Dt = (Ue) => {
2962
+ var Ze = vt(), Ft = Xe(Ze);
2695
2963
  {
2696
- var hr = (Lt) => {
2697
- var pn = Ri(), hn = Qe(pn);
2698
- ni(hn, {
2964
+ var _r = (Lt) => {
2965
+ var hn = xa(), _n = Xe(hn);
2966
+ na(_n, {
2699
2967
  get methods() {
2700
- return b();
2968
+ return w();
2701
2969
  },
2702
2970
  get selected() {
2703
- return f(a), E(() => f(a).selectedMethod);
2971
+ return f(i), P(() => f(i).selectedMethod);
2704
2972
  },
2705
2973
  get amount() {
2706
2974
  return o();
2707
2975
  },
2708
2976
  get currency() {
2709
- return d();
2977
+ return c();
2710
2978
  },
2711
- $$events: { select: (de) => g.selectMethod(de.detail) }
2979
+ $$events: { select: (de) => y.selectMethod(de.detail) }
2712
2980
  });
2713
- var mn = D(hn, 2);
2981
+ var mn = L(_n, 2);
2714
2982
  {
2715
2983
  var mr = (de) => {
2716
- var Je = Si(), Xe = A(Je);
2984
+ var Je = Ia(), Qe = A(Je);
2717
2985
  {
2718
- let jt = /* @__PURE__ */ At(() => (f(a), E(() => f(a).status === "processing")));
2719
- li(Xe, {
2986
+ let Ut = /* @__PURE__ */ Tt(() => (f(i), P(() => f(i).status === "processing")));
2987
+ la(Qe, {
2720
2988
  get initialPhone() {
2721
- return _();
2989
+ return p();
2722
2990
  },
2723
2991
  get loading() {
2724
- return f(jt);
2992
+ return f(Ut);
2725
2993
  },
2726
- $$events: { submit: (Ut) => T(Ut.detail) }
2994
+ $$events: { submit: (jt) => M(jt.detail) }
2727
2995
  });
2728
2996
  }
2729
- x(de, Je);
2997
+ T(de, Je);
2730
2998
  };
2731
2999
  $(mn, (de) => {
2732
- f(a), E(() => f(a).status === "method_selected" && f(a).selectedMethod === "mobile_money") && de(mr);
3000
+ f(i), P(() => f(i).status === "method_selected" && f(i).selectedMethod === "mobile_money") && de(mr);
2733
3001
  });
2734
3002
  }
2735
- var yr = D(mn, 2);
3003
+ var yr = L(mn, 2);
2736
3004
  {
2737
3005
  var br = (de) => {
2738
- var Je = Ii(), Xe = D(A(Je), 2), jt = A(Xe);
3006
+ var Je = Ra(), Qe = L(A(Je), 2), Ut = A(Qe);
2739
3007
  {
2740
- var Ut = (Ue) => {
2741
- var Bt = Pi();
2742
- x(Ue, Bt);
2743
- }, wr = (Ue) => {
2744
- var Bt = ki();
2745
- x(Ue, Bt);
3008
+ var jt = (je) => {
3009
+ var zt = ka();
3010
+ T(je, zt);
3011
+ }, gr = (je) => {
3012
+ var zt = Ca();
3013
+ T(je, zt);
2746
3014
  };
2747
- $(jt, (Ue) => {
2748
- f(a), E(() => f(a).status === "processing") ? Ue(Ut) : Ue(wr, !1);
3015
+ $(Ut, (je) => {
3016
+ f(i), P(() => f(i).status === "processing") ? je(jt) : je(gr, !1);
2749
3017
  });
2750
3018
  }
2751
- oe(() => Xe.disabled = (f(a), E(() => f(a).status === "processing"))), se("click", Xe, () => T(null)), x(de, Je);
3019
+ oe(() => Qe.disabled = (f(i), P(() => f(i).status === "processing"))), se("click", Qe, () => M(null)), T(de, Je);
2752
3020
  };
2753
3021
  $(yr, (de) => {
2754
- f(a), E(() => f(a).status === "method_selected" && f(a).selectedMethod === "card") && de(br);
3022
+ f(i), P(() => f(i).status === "method_selected" && f(i).selectedMethod === "card") && de(br);
2755
3023
  });
2756
3024
  }
2757
- x(Lt, pn);
3025
+ T(Lt, hn);
2758
3026
  };
2759
3027
  $(
2760
3028
  Ft,
2761
3029
  (Lt) => {
2762
- f(a), E(() => f(a).status === "ready" || f(a).status === "method_selected") && Lt(hr);
3030
+ f(i), P(() => f(i).status === "ready" || f(i).status === "method_selected") && Lt(_r);
2763
3031
  },
2764
3032
  !0
2765
3033
  );
2766
3034
  }
2767
- x(je, Ze);
3035
+ T(Ue, Ze);
2768
3036
  };
2769
3037
  $(
2770
- dt,
2771
- (je) => {
2772
- f(a), E(() => f(a).status === "success") ? je(Ot) : je(Dt, !1);
3038
+ ft,
3039
+ (Ue) => {
3040
+ f(i), P(() => f(i).status === "success") ? Ue(Nt) : Ue(Dt, !1);
2773
3041
  },
2774
3042
  !0
2775
3043
  );
2776
3044
  }
2777
- x(Le, We);
3045
+ T(Le, Ge);
2778
3046
  };
2779
3047
  $(
2780
3048
  vr,
2781
3049
  (Le) => {
2782
- f(a), E(() => f(a).status === "failed" && f(a).error) ? Le(_r) : Le(pr, !1);
3050
+ f(i), P(() => f(i).status === "failed" && f(i).error) ? Le(pr) : Le(hr, !1);
2783
3051
  },
2784
3052
  !0
2785
3053
  );
2786
3054
  }
2787
- x(G, Fe);
3055
+ T(W, Fe);
2788
3056
  };
2789
- $(O, (G) => {
2790
- f(a), E(() => f(a).status === "loading") ? G(ie) : G(Ge, !1);
3057
+ $(F, (W) => {
3058
+ f(i), P(() => f(i).status === "loading") ? W(ae) : W(We, !1);
2791
3059
  });
2792
3060
  }
2793
- oe((G) => Rt(P, 1, G), [
2794
- () => It((H(ge), H(y()), E(() => ge("reevit-modal-content", y().darkMode && "reevit-modal--dark"))))
2795
- ]), se("click", Y, I), se("click", m, Va(I)), se("keydown", m, (G) => G.key === "Escape" && I()), x(B, m);
3061
+ oe((W) => kt(b, 1, W), [
3062
+ () => It((B(we), B(g()), P(() => we("reevit-modal-content", g().darkMode && "reevit-modal--dark"))))
3063
+ ]), se("click", D, k), se("click", _, Vi(k)), se("keydown", _, (W) => W.key === "Escape" && k()), T(N, _);
2796
3064
  };
2797
- $(ae, (B) => {
2798
- w() && B(ct);
3065
+ $(ie, (N) => {
3066
+ E() && N(ct);
2799
3067
  });
2800
3068
  }
2801
- oe((B) => cr(F, B), [
2802
- () => (f(l), E(() => Object.entries(f(l)).map(([B, m]) => `${B}:${m}`).join(";")))
2803
- ]), x(e, F), on(), s();
3069
+ oe((N) => fr(U, N), [
3070
+ () => (f(l), P(() => Object.entries(f(l)).map(([N, _]) => `${N}:${_}`).join(";")))
3071
+ ]), T(e, U), on(), a();
2804
3072
  }
2805
3073
  export {
2806
- li as MobileMoneyForm,
2807
- ni as PaymentMethodSelector,
2808
- Ui as ReevitAPIClient,
2809
- Fi as ReevitCheckout,
2810
- Bi as cn,
2811
- Ni as confirmStripePayment,
2812
- zi as createInitialState,
2813
- Ki as createReevitClient,
2814
- Qa as createReevitStore,
2815
- mi as createStripeInstance,
2816
- qi as detectCountryFromCurrency,
2817
- Vi as detectNetwork,
2818
- Hi as formatAmount,
2819
- Yi as formatPhone,
2820
- Di as initiateMPesaSTKPush,
2821
- ci as loadFlutterwaveScript,
2822
- fi as loadHubtelScript,
2823
- vi as loadMonnifyScript,
2824
- ui as loadPaystackScript,
2825
- di as loadStripeScript,
2826
- hi as openFlutterwaveModal,
2827
- pi as openHubtelPopup,
2828
- Oi as openMonnifyModal,
2829
- _i as openPaystackPopup,
2830
- Gi as reevitReducer,
2831
- Wi as validatePhone
3074
+ la as MobileMoneyForm,
3075
+ na as PaymentMethodSelector,
3076
+ za as ReevitAPIClient,
3077
+ La as ReevitCheckout,
3078
+ Ha as cn,
3079
+ Fa as confirmStripePayment,
3080
+ qa as createInitialState,
3081
+ Ka as createReevitClient,
3082
+ Xi as createReevitStore,
3083
+ ma as createStripeInstance,
3084
+ Va as detectCountryFromCurrency,
3085
+ Ya as detectNetwork,
3086
+ Ba as formatAmount,
3087
+ Wa as formatPhone,
3088
+ ba as initiateMPesaSTKPush,
3089
+ fa as loadFlutterwaveScript,
3090
+ Da as loadHubtelScript,
3091
+ va as loadMonnifyScript,
3092
+ ca as loadPaystackScript,
3093
+ da as loadStripeScript,
3094
+ _a as openFlutterwaveModal,
3095
+ ha as openHubtelPopup,
3096
+ ya as openMonnifyModal,
3097
+ pa as openPaystackPopup,
3098
+ Ga as reevitReducer,
3099
+ Za as validatePhone
2832
3100
  };