@arenarium/maps 1.2.1 → 1.2.2

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/main.es.js CHANGED
@@ -1,28 +1,28 @@
1
- var br = Array.isArray, kn = Array.prototype.indexOf, Mn = Array.from, Mt = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, xn = Object.prototype, Pn = Array.prototype, Sn = Object.getPrototypeOf, sr = Object.isExtensible;
1
+ var Er = Array.isArray, bn = Array.prototype.indexOf, Mn = Array.from, xt = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, xn = Object.prototype, Pn = Array.prototype, Sn = Object.getPrototypeOf, sr = Object.isExtensible;
2
2
  function An(t) {
3
3
  for (var e = 0; e < t.length; e++)
4
4
  t[e]();
5
5
  }
6
- function Dn() {
6
+ function Cn() {
7
7
  var t, e, r = new Promise((n, i) => {
8
8
  t = n, e = i;
9
9
  });
10
10
  return { promise: r, resolve: t, reject: e };
11
11
  }
12
- const R = 2, It = 4, Er = 8, Le = 16, fe = 32, ge = 64, Ft = 128, q = 256, st = 512, L = 1024, re = 2048, ce = 4096, Ae = 8192, Ie = 16384, Ot = 32768, kr = 65536, or = 1 << 17, Cn = 1 << 18, Fe = 1 << 19, Tn = 1 << 20, xt = 1 << 21, Rt = 1 << 22, ve = 1 << 23, rt = Symbol("$state"), Nt = new class extends Error {
12
+ const R = 2, Ot = 4, kr = 8, Ie = 16, fe = 32, ge = 64, Ft = 128, q = 256, ot = 512, I = 1024, re = 2048, ce = 4096, Ae = 8192, De = 16384, Rt = 32768, br = 65536, or = 1 << 17, Tn = 1 << 18, Oe = 1 << 19, Ln = 1 << 20, Pt = 1 << 21, Nt = 1 << 22, ve = 1 << 23, nt = Symbol("$state"), jt = new class extends Error {
13
13
  name = "StaleReactionError";
14
14
  message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
15
15
  }();
16
- function Ln() {
16
+ function In() {
17
17
  throw new Error("https://svelte.dev/e/async_derived_orphan");
18
18
  }
19
- function In(t) {
19
+ function Dn(t) {
20
20
  throw new Error("https://svelte.dev/e/effect_in_teardown");
21
21
  }
22
- function Fn() {
22
+ function On() {
23
23
  throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
24
24
  }
25
- function On(t) {
25
+ function Fn(t) {
26
26
  throw new Error("https://svelte.dev/e/effect_orphan");
27
27
  }
28
28
  function Rn() {
@@ -48,10 +48,10 @@ function Mr(t) {
48
48
  return t === this.v;
49
49
  }
50
50
  let Y = null;
51
- function De(t) {
51
+ function Ce(t) {
52
52
  Y = t;
53
53
  }
54
- function jt(t, e = !1, r) {
54
+ function zt(t, e = !1, r) {
55
55
  Y = {
56
56
  p: Y,
57
57
  c: null,
@@ -61,7 +61,7 @@ function jt(t, e = !1, r) {
61
61
  l: null
62
62
  };
63
63
  }
64
- function zt(t) {
64
+ function Bt(t) {
65
65
  var e = (
66
66
  /** @type {ComponentContext} */
67
67
  Y
@@ -82,7 +82,7 @@ function qn() {
82
82
  var t = Me;
83
83
  Me = [], An(t);
84
84
  }
85
- function ut(t) {
85
+ function ft(t) {
86
86
  if (Me.length === 0) {
87
87
  var e = Me;
88
88
  queueMicrotask(() => {
@@ -96,14 +96,14 @@ function Pr(t) {
96
96
  var e = m;
97
97
  if (e === null)
98
98
  return v.f |= ve, t;
99
- if ((e.f & Ot) === 0) {
99
+ if ((e.f & Rt) === 0) {
100
100
  if ((e.f & Ft) === 0)
101
101
  throw !e.parent && t instanceof Error && Sr(t), t;
102
102
  e.b.error(t);
103
103
  } else
104
- Ce(t, e);
104
+ Te(t, e);
105
105
  }
106
- function Ce(t, e) {
106
+ function Te(t, e) {
107
107
  for (; e !== null; ) {
108
108
  if ((e.f & Ft) !== 0)
109
109
  try {
@@ -118,14 +118,14 @@ function Ce(t, e) {
118
118
  }
119
119
  function Sr(t) {
120
120
  const e = Hn.get(t);
121
- e && (Mt(t, "message", {
121
+ e && (xt(t, "message", {
122
122
  value: e.message
123
- }), Mt(t, "stack", {
123
+ }), xt(t, "stack", {
124
124
  value: e.stack
125
125
  }));
126
126
  }
127
- const wt = /* @__PURE__ */ new Set();
128
- let A = null, Pt = /* @__PURE__ */ new Set(), Xe = [], Bt = null, St = !1;
127
+ const Et = /* @__PURE__ */ new Set();
128
+ let A = null, St = /* @__PURE__ */ new Set(), Xe = [], Ut = null, At = !1;
129
129
  class ie {
130
130
  /**
131
131
  * The current values of any sources that are updated in this batch
@@ -194,7 +194,7 @@ class ie {
194
194
  * Deferred effects (which run after async work has completed) that are DIRTY
195
195
  * @type {Effect[]}
196
196
  */
197
- #h = [];
197
+ #p = [];
198
198
  /**
199
199
  * Deferred effects that are MAYBE_DIRTY
200
200
  * @type {Effect[]}
@@ -213,11 +213,11 @@ class ie {
213
213
  process(e) {
214
214
  Xe = [];
215
215
  for (const i of e)
216
- this.#p(i);
216
+ this.#h(i);
217
217
  if (this.#o.length === 0 && this.#a === 0) {
218
218
  this.#d();
219
219
  var r = this.#r, n = this.#s;
220
- this.#r = [], this.#s = [], this.#l = [], A = null, ar(r), ar(n), A === null ? A = this : wt.delete(this), this.#n?.resolve();
220
+ this.#r = [], this.#s = [], this.#l = [], A = null, ar(r), ar(n), A === null ? A = this : Et.delete(this), this.#n?.resolve();
221
221
  } else
222
222
  this.#u(this.#r), this.#u(this.#s), this.#u(this.#l);
223
223
  for (const i of this.#o)
@@ -231,20 +231,20 @@ class ie {
231
231
  * them for later execution as appropriate
232
232
  * @param {Effect} root
233
233
  */
234
- #p(e) {
235
- e.f ^= L;
234
+ #h(e) {
235
+ e.f ^= I;
236
236
  for (var r = e.first; r !== null; ) {
237
- var n = r.f, i = (n & (fe | ge)) !== 0, s = i && (n & L) !== 0, o = s || (n & Ae) !== 0 || this.skipped_effects.has(r);
237
+ var n = r.f, i = (n & (fe | ge)) !== 0, s = i && (n & I) !== 0, o = s || (n & Ae) !== 0 || this.skipped_effects.has(r);
238
238
  if (!o && r.fn !== null) {
239
239
  if (i)
240
- r.f ^= L;
241
- else if ((n & It) !== 0)
240
+ r.f ^= I;
241
+ else if ((n & Ot) !== 0)
242
242
  this.#s.push(r);
243
- else if ((n & L) === 0)
244
- if ((n & Rt) !== 0) {
243
+ else if ((n & I) === 0)
244
+ if ((n & Nt) !== 0) {
245
245
  var l = r.b?.is_pending() ? this.#i : this.#o;
246
246
  l.push(r);
247
- } else ct(r) && ((r.f & Le) !== 0 && this.#l.push(r), Se(r));
247
+ } else pt(r) && ((r.f & Ie) !== 0 && this.#l.push(r), Se(r));
248
248
  var a = r.first;
249
249
  if (a !== null) {
250
250
  r = a;
@@ -261,7 +261,7 @@ class ie {
261
261
  */
262
262
  #u(e) {
263
263
  for (const r of e)
264
- ((r.f & re) !== 0 ? this.#h : this.#f).push(r), H(r, L);
264
+ ((r.f & re) !== 0 ? this.#p : this.#f).push(r), H(r, I);
265
265
  e.length = 0;
266
266
  }
267
267
  /**
@@ -278,15 +278,15 @@ class ie {
278
278
  }
279
279
  deactivate() {
280
280
  A = null;
281
- for (const e of Pt)
282
- if (Pt.delete(e), e(), A !== null)
281
+ for (const e of St)
282
+ if (St.delete(e), e(), A !== null)
283
283
  break;
284
284
  }
285
285
  neuter() {
286
286
  this.#c = !0;
287
287
  }
288
288
  flush() {
289
- Xe.length > 0 ? Yn() : this.#d(), A === this && (this.#a === 0 && wt.delete(this), this.deactivate());
289
+ Xe.length > 0 ? Yn() : this.#d(), A === this && (this.#a === 0 && Et.delete(this), this.deactivate());
290
290
  }
291
291
  /**
292
292
  * Append and remove branches to/from the DOM
@@ -302,7 +302,7 @@ class ie {
302
302
  }
303
303
  decrement() {
304
304
  if (this.#a -= 1, this.#a === 0) {
305
- for (const e of this.#h)
305
+ for (const e of this.#p)
306
306
  H(e, re), We(e);
307
307
  for (const e of this.#f)
308
308
  H(e, ce), We(e);
@@ -315,12 +315,12 @@ class ie {
315
315
  this.#t.add(e);
316
316
  }
317
317
  settled() {
318
- return (this.#n ??= Dn()).promise;
318
+ return (this.#n ??= Cn()).promise;
319
319
  }
320
320
  static ensure() {
321
321
  if (A === null) {
322
322
  const e = A = new ie();
323
- wt.add(A), ie.enqueue(() => {
323
+ Et.add(A), ie.enqueue(() => {
324
324
  A === e && e.flush();
325
325
  });
326
326
  }
@@ -328,12 +328,12 @@ class ie {
328
328
  }
329
329
  /** @param {() => void} task */
330
330
  static enqueue(e) {
331
- ut(e);
331
+ ft(e);
332
332
  }
333
333
  }
334
334
  function Yn() {
335
335
  var t = Pe;
336
- St = !0;
336
+ At = !0;
337
337
  try {
338
338
  var e = 0;
339
339
  for (fr(!0); Xe.length > 0; ) {
@@ -345,14 +345,14 @@ function Yn() {
345
345
  r.process(Xe), ue.clear();
346
346
  }
347
347
  } finally {
348
- St = !1, fr(t), Bt = null;
348
+ At = !1, fr(t), Ut = null;
349
349
  }
350
350
  }
351
351
  function Vn() {
352
352
  try {
353
353
  Rn();
354
354
  } catch (t) {
355
- Ce(t, Bt);
355
+ Te(t, Ut);
356
356
  }
357
357
  }
358
358
  let de = null;
@@ -361,7 +361,7 @@ function ar(t) {
361
361
  if (e !== 0) {
362
362
  for (var r = 0; r < e; ) {
363
363
  var n = t[r++];
364
- if ((n.f & (Ie | Ae)) === 0 && ct(n) && (de = [], Se(n), n.deps === null && n.first === null && n.nodes_start === null && (n.teardown === null && n.ac === null ? Ur(n) : n.fn = null), de?.length > 0)) {
364
+ if ((n.f & (De | Ae)) === 0 && pt(n) && (de = [], Se(n), n.deps === null && n.first === null && n.nodes_start === null && (n.teardown === null && n.ac === null ? Ur(n) : n.fn = null), de?.length > 0)) {
365
365
  ue.clear();
366
366
  for (const i of de)
367
367
  Se(i);
@@ -372,29 +372,29 @@ function ar(t) {
372
372
  }
373
373
  }
374
374
  function We(t) {
375
- for (var e = Bt = t; e.parent !== null; ) {
375
+ for (var e = Ut = t; e.parent !== null; ) {
376
376
  e = e.parent;
377
377
  var r = e.f;
378
- if (St && e === m && (r & Le) !== 0)
378
+ if (At && e === m && (r & Ie) !== 0)
379
379
  return;
380
380
  if ((r & (ge | fe)) !== 0) {
381
- if ((r & L) === 0) return;
382
- e.f ^= L;
381
+ if ((r & I) === 0) return;
382
+ e.f ^= I;
383
383
  }
384
384
  }
385
385
  Xe.push(e);
386
386
  }
387
387
  function Xn(t) {
388
- let e = 0, r = ft(0), n;
388
+ let e = 0, r = ct(0), n;
389
389
  return () => {
390
- li() && (g(r), qt(() => (e === 0 && (n = Wr(() => t(() => Ze(r)))), e += 1, () => {
391
- ut(() => {
390
+ li() && (g(r), Ht(() => (e === 0 && (n = Wr(() => t(() => Ze(r)))), e += 1, () => {
391
+ ft(() => {
392
392
  e -= 1, e === 0 && (n?.(), n = void 0, Ze(r));
393
393
  });
394
394
  })));
395
395
  };
396
396
  }
397
- var Wn = kr | Fe | Ft;
397
+ var Wn = br | Oe | Ft;
398
398
  function Gn(t, e, r) {
399
399
  new Kn(t, e, r);
400
400
  }
@@ -420,9 +420,9 @@ class Kn {
420
420
  #s = null;
421
421
  /** @type {DocumentFragment | null} */
422
422
  #l = null;
423
- #h = 0;
423
+ #p = 0;
424
424
  #f = 0;
425
- #p = !1;
425
+ #h = !1;
426
426
  /**
427
427
  * A source containing the number of pending async deriveds/expressions.
428
428
  * Only created if `$effect.pending()` is used inside the boundary,
@@ -432,9 +432,9 @@ class Kn {
432
432
  */
433
433
  #u = null;
434
434
  #d = () => {
435
- this.#u && ot(this.#u, this.#h);
435
+ this.#u && at(this.#u, this.#p);
436
436
  };
437
- #g = Xn(() => (this.#u = ft(this.#h), () => {
437
+ #g = Xn(() => (this.#u = ct(this.#p), () => {
438
438
  this.#u = null;
439
439
  }));
440
440
  /**
@@ -444,11 +444,11 @@ class Kn {
444
444
  */
445
445
  constructor(e, r, n) {
446
446
  this.#t = e, this.#n = r, this.#c = n, this.parent = /** @type {Effect} */
447
- m.b, this.#e = !!this.#n.pending, this.#o = hi(() => {
447
+ m.b, this.#e = !!this.#n.pending, this.#o = pi(() => {
448
448
  m.b = this;
449
449
  {
450
450
  try {
451
- this.#i = pe(() => n(this.#t));
451
+ this.#i = he(() => n(this.#t));
452
452
  } catch (i) {
453
453
  this.error(i);
454
454
  }
@@ -458,7 +458,7 @@ class Kn {
458
458
  }
459
459
  #_() {
460
460
  try {
461
- this.#i = pe(() => this.#c(this.#t));
461
+ this.#i = he(() => this.#c(this.#t));
462
462
  } catch (e) {
463
463
  this.error(e);
464
464
  }
@@ -466,8 +466,8 @@ class Kn {
466
466
  }
467
467
  #w() {
468
468
  const e = this.#n.pending;
469
- e && (this.#r = pe(() => e(this.#t)), ie.enqueue(() => {
470
- this.#i = this.#v(() => (ie.ensure(), pe(() => this.#c(this.#t)))), this.#f > 0 ? this.#m() : (nt(
469
+ e && (this.#r = he(() => e(this.#t)), ie.enqueue(() => {
470
+ this.#i = this.#v(() => (ie.ensure(), he(() => this.#c(this.#t)))), this.#f > 0 ? this.#m() : (it(
471
471
  /** @type {Effect} */
472
472
  this.#r,
473
473
  () => {
@@ -491,13 +491,13 @@ class Kn {
491
491
  */
492
492
  #v(e) {
493
493
  var r = m, n = v, i = Y;
494
- ne(this.#o), I(this.#o), De(this.#o.ctx);
494
+ ne(this.#o), D(this.#o), Ce(this.#o.ctx);
495
495
  try {
496
496
  return e();
497
497
  } catch (s) {
498
498
  return Pr(s), null;
499
499
  } finally {
500
- ne(r), I(n), De(i);
500
+ ne(r), D(n), Ce(i);
501
501
  }
502
502
  }
503
503
  #m() {
@@ -505,7 +505,7 @@ class Kn {
505
505
  /** @type {(anchor: Node) => void} */
506
506
  this.#n.pending
507
507
  );
508
- this.#i !== null && (this.#l = document.createDocumentFragment(), Jn(this.#i, this.#l)), this.#r === null && (this.#r = pe(() => e(this.#t)));
508
+ this.#i !== null && (this.#l = document.createDocumentFragment(), Jn(this.#i, this.#l)), this.#r === null && (this.#r = he(() => e(this.#t)));
509
509
  }
510
510
  /**
511
511
  * Updates the pending count associated with the currently visible pending snippet,
@@ -517,7 +517,7 @@ class Kn {
517
517
  this.parent && this.parent.#y(e);
518
518
  return;
519
519
  }
520
- this.#f += e, this.#f === 0 && (this.#e = !1, this.#r && nt(this.#r, () => {
520
+ this.#f += e, this.#f === 0 && (this.#e = !1, this.#r && it(this.#r, () => {
521
521
  this.#r = null;
522
522
  }), this.#l && (this.#t.before(this.#l), this.#l = null));
523
523
  }
@@ -528,7 +528,7 @@ class Kn {
528
528
  * @param {1 | -1} d
529
529
  */
530
530
  update_pending_count(e) {
531
- this.#y(e), this.#h += e, Pt.add(this.#d);
531
+ this.#y(e), this.#p += e, St.add(this.#d);
532
532
  }
533
533
  get_effect_pending() {
534
534
  return this.#g(), g(
@@ -540,7 +540,7 @@ class Kn {
540
540
  error(e) {
541
541
  var r = this.#n.onerror;
542
542
  let n = this.#n.failed;
543
- if (this.#p || !r && !n)
543
+ if (this.#h || !r && !n)
544
544
  throw e;
545
545
  this.#i && (ee(this.#i), this.#i = null), this.#r && (ee(this.#r), this.#r = null), this.#s && (ee(this.#s), this.#s = null);
546
546
  var i = !1, s = !1;
@@ -549,23 +549,23 @@ class Kn {
549
549
  Zn();
550
550
  return;
551
551
  }
552
- i = !0, s && Bn(), ie.ensure(), this.#h = 0, this.#s !== null && nt(this.#s, () => {
552
+ i = !0, s && Bn(), ie.ensure(), this.#p = 0, this.#s !== null && it(this.#s, () => {
553
553
  this.#s = null;
554
- }), this.#e = this.has_pending_snippet(), this.#i = this.#v(() => (this.#p = !1, pe(() => this.#c(this.#t)))), this.#f > 0 ? this.#m() : this.#e = !1;
554
+ }), this.#e = this.has_pending_snippet(), this.#i = this.#v(() => (this.#h = !1, he(() => this.#c(this.#t)))), this.#f > 0 ? this.#m() : this.#e = !1;
555
555
  };
556
556
  var l = v;
557
557
  try {
558
- I(null), s = !0, r?.(e, o), s = !1;
558
+ D(null), s = !0, r?.(e, o), s = !1;
559
559
  } catch (a) {
560
- Ce(a, this.#o && this.#o.parent);
560
+ Te(a, this.#o && this.#o.parent);
561
561
  } finally {
562
- I(l);
562
+ D(l);
563
563
  }
564
- n && ut(() => {
564
+ n && ft(() => {
565
565
  this.#s = this.#v(() => {
566
- this.#p = !0;
566
+ this.#h = !0;
567
567
  try {
568
- return pe(() => {
568
+ return he(() => {
569
569
  n(
570
570
  this.#t,
571
571
  () => e,
@@ -573,13 +573,13 @@ class Kn {
573
573
  );
574
574
  });
575
575
  } catch (a) {
576
- return Ce(
576
+ return Te(
577
577
  a,
578
578
  /** @type {Effect} */
579
579
  this.#o.parent
580
580
  ), null;
581
581
  } finally {
582
- this.#p = !1;
582
+ this.#h = !1;
583
583
  }
584
584
  });
585
585
  });
@@ -589,7 +589,7 @@ function Jn(t, e) {
589
589
  for (var r = t.nodes_start, n = t.nodes_end; r !== null; ) {
590
590
  var i = r === n ? null : (
591
591
  /** @type {TemplateNode} */
592
- /* @__PURE__ */ Zt(r)
592
+ /* @__PURE__ */ qt(r)
593
593
  );
594
594
  e.append(r), r = i;
595
595
  }
@@ -609,21 +609,21 @@ function Qn(t, e, r) {
609
609
  try {
610
610
  r([...t.map(n), ...l]);
611
611
  } catch (a) {
612
- (s.f & Ie) === 0 && Ce(a, s);
612
+ (s.f & De) === 0 && Te(a, s);
613
613
  }
614
614
  i?.deactivate(), Ar();
615
615
  }).catch((l) => {
616
- Ce(l, s);
616
+ Te(l, s);
617
617
  });
618
618
  }
619
619
  function $n() {
620
620
  var t = m, e = v, r = Y, n = A;
621
621
  return function() {
622
- ne(t), I(e), De(r), n?.activate();
622
+ ne(t), D(e), Ce(r), n?.activate();
623
623
  };
624
624
  }
625
625
  function Ar() {
626
- ne(null), I(null), De(null);
626
+ ne(null), D(null), Ce(null);
627
627
  }
628
628
  // @__NO_SIDE_EFFECTS__
629
629
  function ei(t) {
@@ -631,7 +631,7 @@ function ei(t) {
631
631
  /** @type {Derived} */
632
632
  v
633
633
  ) : null;
634
- return m === null || r !== null && (r.f & q) !== 0 ? e |= q : m.f |= Fe, {
634
+ return m === null || r !== null && (r.f & q) !== 0 ? e |= q : m.f |= Oe, {
635
635
  ctx: Y,
636
636
  deps: null,
637
637
  effects: null,
@@ -655,7 +655,7 @@ function ti(t, e) {
655
655
  /** @type {Effect | null} */
656
656
  m
657
657
  );
658
- r === null && Ln();
658
+ r === null && In();
659
659
  var n = (
660
660
  /** @type {Boundary} */
661
661
  r.b
@@ -663,7 +663,7 @@ function ti(t, e) {
663
663
  /** @type {Promise<V>} */
664
664
  /** @type {unknown} */
665
665
  void 0
666
- ), s = ft(
666
+ ), s = ct(
667
667
  /** @type {V} */
668
668
  x
669
669
  ), o = null, l = !v;
@@ -680,26 +680,26 @@ function ti(t, e) {
680
680
  var f = (
681
681
  /** @type {Batch} */
682
682
  A
683
- ), p = n.is_pending();
684
- l && (n.update_pending_count(1), p || f.increment());
685
- const h = (c, d = void 0) => {
686
- o = null, p || f.activate(), d ? d !== Nt && (s.f |= ve, ot(s, d)) : ((s.f & ve) !== 0 && (s.f ^= ve), ot(s, c)), l && (n.update_pending_count(-1), p || f.decrement()), Ar();
683
+ ), h = n.is_pending();
684
+ l && (n.update_pending_count(1), h || f.increment());
685
+ const p = (c, d = void 0) => {
686
+ o = null, h || f.activate(), d ? d !== jt && (s.f |= ve, at(s, d)) : ((s.f & ve) !== 0 && (s.f ^= ve), at(s, c)), l && (n.update_pending_count(-1), h || f.decrement()), Ar();
687
687
  };
688
- if (i.then(h, (c) => h(null, c || "unknown")), f)
688
+ if (i.then(p, (c) => p(null, c || "unknown")), f)
689
689
  return () => {
690
690
  queueMicrotask(() => f.neuter());
691
691
  };
692
692
  }), new Promise((a) => {
693
693
  function u(f) {
694
- function p() {
694
+ function h() {
695
695
  f === i ? a(s) : u(i);
696
696
  }
697
- f.then(p, p);
697
+ f.then(h, h);
698
698
  }
699
699
  u(i);
700
700
  });
701
701
  }
702
- function Dr(t) {
702
+ function Cr(t) {
703
703
  var e = t.effects;
704
704
  if (e !== null) {
705
705
  t.effects = null;
@@ -721,25 +721,25 @@ function ri(t) {
721
721
  }
722
722
  return null;
723
723
  }
724
- function Ut(t) {
724
+ function Zt(t) {
725
725
  var e, r = m;
726
726
  ne(ri(t));
727
727
  try {
728
- Dr(t), e = Vr(t);
728
+ Cr(t), e = Vr(t);
729
729
  } finally {
730
730
  ne(r);
731
731
  }
732
732
  return e;
733
733
  }
734
- function Cr(t) {
735
- var e = Ut(t);
736
- if (t.equals(e) || (t.v = e, t.wv = Hr()), !Oe) {
737
- var r = (le || (t.f & q) !== 0) && t.deps !== null ? ce : L;
734
+ function Tr(t) {
735
+ var e = Zt(t);
736
+ if (t.equals(e) || (t.v = e, t.wv = Hr()), !Fe) {
737
+ var r = (le || (t.f & q) !== 0) && t.deps !== null ? ce : I;
738
738
  H(t, r);
739
739
  }
740
740
  }
741
741
  const ue = /* @__PURE__ */ new Map();
742
- function ft(t, e) {
742
+ function ct(t, e) {
743
743
  var r = {
744
744
  f: 0,
745
745
  // TODO ideally we could skip this altogether, but it causes type errors
@@ -752,42 +752,42 @@ function ft(t, e) {
752
752
  return r;
753
753
  }
754
754
  // @__NO_SIDE_EFFECTS__
755
- function D(t, e) {
756
- const r = ft(t);
755
+ function C(t, e) {
756
+ const r = ct(t);
757
757
  return mi(r), r;
758
758
  }
759
759
  function P(t, e, r = !1) {
760
760
  v !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
761
761
  // to ensure we error if state is set inside an inspect effect
762
- (!G || (v.f & or) !== 0) && xr() && (v.f & (R | Le | Rt | or)) !== 0 && !se?.includes(t) && zn();
762
+ (!G || (v.f & or) !== 0) && xr() && (v.f & (R | Ie | Nt | or)) !== 0 && !se?.includes(t) && zn();
763
763
  let n = r ? je(e) : e;
764
- return ot(t, n);
764
+ return at(t, n);
765
765
  }
766
- function ot(t, e) {
766
+ function at(t, e) {
767
767
  if (!t.equals(e)) {
768
768
  var r = t.v;
769
- Oe ? ue.set(t, e) : ue.set(t, r), t.v = e;
769
+ Fe ? ue.set(t, e) : ue.set(t, r), t.v = e;
770
770
  var n = ie.ensure();
771
- n.capture(t, r), (t.f & R) !== 0 && ((t.f & re) !== 0 && Ut(
771
+ n.capture(t, r), (t.f & R) !== 0 && ((t.f & re) !== 0 && Zt(
772
772
  /** @type {Derived} */
773
773
  t
774
- ), H(t, (t.f & q) === 0 ? L : ce)), t.wv = Hr(), Tr(t, re), m !== null && (m.f & L) !== 0 && (m.f & (fe | ge)) === 0 && (j === null ? yi([t]) : j.push(t));
774
+ ), H(t, (t.f & q) === 0 ? I : ce)), t.wv = Hr(), Lr(t, re), m !== null && (m.f & I) !== 0 && (m.f & (fe | ge)) === 0 && (j === null ? yi([t]) : j.push(t));
775
775
  }
776
776
  return e;
777
777
  }
778
778
  function Ze(t) {
779
779
  P(t, t.v + 1);
780
780
  }
781
- function Tr(t, e) {
781
+ function Lr(t, e) {
782
782
  var r = t.reactions;
783
783
  if (r !== null)
784
784
  for (var n = r.length, i = 0; i < n; i++) {
785
785
  var s = r[i], o = s.f, l = (o & re) === 0;
786
- l && H(s, e), (o & R) !== 0 ? Tr(
786
+ l && H(s, e), (o & R) !== 0 ? Lr(
787
787
  /** @type {Derived} */
788
788
  s,
789
789
  ce
790
- ) : l && ((o & Le) !== 0 && de !== null && de.push(
790
+ ) : l && ((o & Ie) !== 0 && de !== null && de.push(
791
791
  /** @type {Effect} */
792
792
  s
793
793
  ), We(
@@ -797,20 +797,20 @@ function Tr(t, e) {
797
797
  }
798
798
  }
799
799
  function je(t) {
800
- if (typeof t != "object" || t === null || rt in t)
800
+ if (typeof t != "object" || t === null || nt in t)
801
801
  return t;
802
802
  const e = Sn(t);
803
803
  if (e !== xn && e !== Pn)
804
804
  return t;
805
- var r = /* @__PURE__ */ new Map(), n = br(t), i = /* @__PURE__ */ D(0), s = me, o = (l) => {
805
+ var r = /* @__PURE__ */ new Map(), n = Er(t), i = /* @__PURE__ */ C(0), s = me, o = (l) => {
806
806
  if (me === s)
807
807
  return l();
808
808
  var a = v, u = me;
809
- I(null), hr(s);
809
+ D(null), pr(s);
810
810
  var f = l();
811
- return I(a), hr(u), f;
811
+ return D(a), pr(u), f;
812
812
  };
813
- return n && r.set("length", /* @__PURE__ */ D(
813
+ return n && r.set("length", /* @__PURE__ */ C(
814
814
  /** @type {any[]} */
815
815
  t.length
816
816
  )), new Proxy(
@@ -821,15 +821,15 @@ function je(t) {
821
821
  (!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && Nn();
822
822
  var f = r.get(a);
823
823
  return f === void 0 ? f = o(() => {
824
- var p = /* @__PURE__ */ D(u.value);
825
- return r.set(a, p), p;
824
+ var h = /* @__PURE__ */ C(u.value);
825
+ return r.set(a, h), h;
826
826
  }) : P(f, u.value, !0), !0;
827
827
  },
828
828
  deleteProperty(l, a) {
829
829
  var u = r.get(a);
830
830
  if (u === void 0) {
831
831
  if (a in l) {
832
- const f = o(() => /* @__PURE__ */ D(x));
832
+ const f = o(() => /* @__PURE__ */ C(x));
833
833
  r.set(a, f), Ze(i);
834
834
  }
835
835
  } else
@@ -837,15 +837,15 @@ function je(t) {
837
837
  return !0;
838
838
  },
839
839
  get(l, a, u) {
840
- if (a === rt)
840
+ if (a === nt)
841
841
  return t;
842
- var f = r.get(a), p = a in l;
843
- if (f === void 0 && (!p || Ue(l, a)?.writable) && (f = o(() => {
844
- var c = je(p ? l[a] : x), d = /* @__PURE__ */ D(c);
842
+ var f = r.get(a), h = a in l;
843
+ if (f === void 0 && (!h || Ue(l, a)?.writable) && (f = o(() => {
844
+ var c = je(h ? l[a] : x), d = /* @__PURE__ */ C(c);
845
845
  return d;
846
846
  }), r.set(a, f)), f !== void 0) {
847
- var h = g(f);
848
- return h === x ? void 0 : h;
847
+ var p = g(f);
848
+ return p === x ? void 0 : p;
849
849
  }
850
850
  return Reflect.get(l, a, u);
851
851
  },
@@ -855,55 +855,55 @@ function je(t) {
855
855
  var f = r.get(a);
856
856
  f && (u.value = g(f));
857
857
  } else if (u === void 0) {
858
- var p = r.get(a), h = p?.v;
859
- if (p !== void 0 && h !== x)
858
+ var h = r.get(a), p = h?.v;
859
+ if (h !== void 0 && p !== x)
860
860
  return {
861
861
  enumerable: !0,
862
862
  configurable: !0,
863
- value: h,
863
+ value: p,
864
864
  writable: !0
865
865
  };
866
866
  }
867
867
  return u;
868
868
  },
869
869
  has(l, a) {
870
- if (a === rt)
870
+ if (a === nt)
871
871
  return !0;
872
872
  var u = r.get(a), f = u !== void 0 && u.v !== x || Reflect.has(l, a);
873
873
  if (u !== void 0 || m !== null && (!f || Ue(l, a)?.writable)) {
874
874
  u === void 0 && (u = o(() => {
875
- var h = f ? je(l[a]) : x, c = /* @__PURE__ */ D(h);
875
+ var p = f ? je(l[a]) : x, c = /* @__PURE__ */ C(p);
876
876
  return c;
877
877
  }), r.set(a, u));
878
- var p = g(u);
879
- if (p === x)
878
+ var h = g(u);
879
+ if (h === x)
880
880
  return !1;
881
881
  }
882
882
  return f;
883
883
  },
884
884
  set(l, a, u, f) {
885
- var p = r.get(a), h = a in l;
885
+ var h = r.get(a), p = a in l;
886
886
  if (n && a === "length")
887
887
  for (var c = u; c < /** @type {Source<number>} */
888
- p.v; c += 1) {
888
+ h.v; c += 1) {
889
889
  var d = r.get(c + "");
890
- d !== void 0 ? P(d, x) : c in l && (d = o(() => /* @__PURE__ */ D(x)), r.set(c + "", d));
890
+ d !== void 0 ? P(d, x) : c in l && (d = o(() => /* @__PURE__ */ C(x)), r.set(c + "", d));
891
891
  }
892
- if (p === void 0)
893
- (!h || Ue(l, a)?.writable) && (p = o(() => /* @__PURE__ */ D(void 0)), P(p, je(u)), r.set(a, p));
892
+ if (h === void 0)
893
+ (!p || Ue(l, a)?.writable) && (h = o(() => /* @__PURE__ */ C(void 0)), P(h, je(u)), r.set(a, h));
894
894
  else {
895
- h = p.v !== x;
895
+ p = h.v !== x;
896
896
  var w = o(() => je(u));
897
- P(p, w);
897
+ P(h, w);
898
898
  }
899
- var F = Reflect.getOwnPropertyDescriptor(l, a);
900
- if (F?.set && F.set.call(f, u), !h) {
899
+ var O = Reflect.getOwnPropertyDescriptor(l, a);
900
+ if (O?.set && O.set.call(f, u), !p) {
901
901
  if (n && typeof a == "string") {
902
902
  var K = (
903
903
  /** @type {Source<number>} */
904
904
  r.get("length")
905
- ), k = Number(a);
906
- Number.isInteger(k) && k >= K.v && P(K, k + 1);
905
+ ), b = Number(a);
906
+ Number.isInteger(b) && b >= K.v && P(K, b + 1);
907
907
  }
908
908
  Ze(i);
909
909
  }
@@ -911,9 +911,9 @@ function je(t) {
911
911
  },
912
912
  ownKeys(l) {
913
913
  g(i);
914
- var a = Reflect.ownKeys(l).filter((p) => {
915
- var h = r.get(p);
916
- return h === void 0 || h.v !== x;
914
+ var a = Reflect.ownKeys(l).filter((h) => {
915
+ var p = r.get(h);
916
+ return p === void 0 || p.v !== x;
917
917
  });
918
918
  for (var [u, f] of r)
919
919
  f.v !== x && !(u in l) && a.push(u);
@@ -925,52 +925,52 @@ function je(t) {
925
925
  }
926
926
  );
927
927
  }
928
- var lr, Lr, Ir, Fr;
928
+ var lr, Ir, Dr, Or;
929
929
  function ni() {
930
930
  if (lr === void 0) {
931
- lr = window, Lr = /Firefox/.test(navigator.userAgent);
931
+ lr = window, Ir = /Firefox/.test(navigator.userAgent);
932
932
  var t = Element.prototype, e = Node.prototype, r = Text.prototype;
933
- Ir = Ue(e, "firstChild").get, Fr = Ue(e, "nextSibling").get, sr(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), sr(r) && (r.__t = void 0);
933
+ Dr = Ue(e, "firstChild").get, Or = Ue(e, "nextSibling").get, sr(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), sr(r) && (r.__t = void 0);
934
934
  }
935
935
  }
936
936
  function ii(t = "") {
937
937
  return document.createTextNode(t);
938
938
  }
939
939
  // @__NO_SIDE_EFFECTS__
940
- function Or(t) {
941
- return Ir.call(t);
940
+ function Fr(t) {
941
+ return Dr.call(t);
942
942
  }
943
943
  // @__NO_SIDE_EFFECTS__
944
- function Zt(t) {
945
- return Fr.call(t);
944
+ function qt(t) {
945
+ return Or.call(t);
946
946
  }
947
947
  function ur(t, e) {
948
- return /* @__PURE__ */ Or(t);
948
+ return /* @__PURE__ */ Fr(t);
949
949
  }
950
950
  function si(t, e = 1, r = !1) {
951
951
  let n = t;
952
952
  for (; e--; )
953
953
  n = /** @type {TemplateNode} */
954
- /* @__PURE__ */ Zt(n);
954
+ /* @__PURE__ */ qt(n);
955
955
  return n;
956
956
  }
957
957
  function Rr(t) {
958
958
  var e = v, r = m;
959
- I(null), ne(null);
959
+ D(null), ne(null);
960
960
  try {
961
961
  return t();
962
962
  } finally {
963
- I(e), ne(r);
963
+ D(e), ne(r);
964
964
  }
965
965
  }
966
966
  function oi(t) {
967
- m === null && v === null && On(), v !== null && (v.f & q) !== 0 && m === null && Fn(), Oe && In();
967
+ m === null && v === null && Fn(), v !== null && (v.f & q) !== 0 && m === null && On(), Fe && Dn();
968
968
  }
969
969
  function ai(t, e) {
970
970
  var r = e.last;
971
971
  r === null ? e.last = e.first = t : (r.next = t, t.prev = r, e.last = t);
972
972
  }
973
- function he(t, e, r, n = !0) {
973
+ function pe(t, e, r, n = !0) {
974
974
  var i = m;
975
975
  i !== null && (i.f & Ae) !== 0 && (t |= Ae);
976
976
  var s = {
@@ -993,7 +993,7 @@ function he(t, e, r, n = !0) {
993
993
  };
994
994
  if (r)
995
995
  try {
996
- Se(s), s.f |= Ot;
996
+ Se(s), s.f |= Rt;
997
997
  } catch (a) {
998
998
  throw ee(s), a;
999
999
  }
@@ -1001,7 +1001,7 @@ function he(t, e, r, n = !0) {
1001
1001
  if (n) {
1002
1002
  var o = s;
1003
1003
  if (r && o.deps === null && o.teardown === null && o.nodes_start === null && o.first === o.last && // either `null`, or a singular child
1004
- (o.f & Fe) === 0 && (o = o.first), o !== null && (o.parent = i, i !== null && ai(o, i), v !== null && (v.f & R) !== 0 && (t & ge) === 0)) {
1004
+ (o.f & Oe) === 0 && (o = o.first), o !== null && (o.parent = i, i !== null && ai(o, i), v !== null && (v.f & R) !== 0 && (t & ge) === 0)) {
1005
1005
  var l = (
1006
1006
  /** @type {Derived} */
1007
1007
  v
@@ -1019,7 +1019,7 @@ function J(t) {
1019
1019
  var e = (
1020
1020
  /** @type {Effect} */
1021
1021
  m.f
1022
- ), r = !v && (e & fe) !== 0 && (e & Ot) === 0;
1022
+ ), r = !v && (e & fe) !== 0 && (e & Rt) === 0;
1023
1023
  if (r) {
1024
1024
  var n = (
1025
1025
  /** @type {ComponentContext} */
@@ -1030,47 +1030,47 @@ function J(t) {
1030
1030
  return Nr(t);
1031
1031
  }
1032
1032
  function Nr(t) {
1033
- return he(It | Tn, t, !1);
1033
+ return pe(Ot | Ln, t, !1);
1034
1034
  }
1035
1035
  function ui(t) {
1036
1036
  ie.ensure();
1037
- const e = he(ge | Fe, t, !0);
1037
+ const e = pe(ge | Oe, t, !0);
1038
1038
  return (r = {}) => new Promise((n) => {
1039
- r.outro ? nt(e, () => {
1039
+ r.outro ? it(e, () => {
1040
1040
  ee(e), n(void 0);
1041
1041
  }) : (ee(e), n(void 0));
1042
1042
  });
1043
1043
  }
1044
1044
  function fi(t) {
1045
- return he(It, t, !1);
1045
+ return pe(Ot, t, !1);
1046
1046
  }
1047
1047
  function ci(t) {
1048
- return he(Rt | Fe, t, !0);
1048
+ return pe(Nt | Oe, t, !0);
1049
1049
  }
1050
- function qt(t, e = 0) {
1051
- return he(Er | e, t, !0);
1050
+ function Ht(t, e = 0) {
1051
+ return pe(kr | e, t, !0);
1052
1052
  }
1053
1053
  function jr(t, e = [], r = []) {
1054
1054
  Qn(e, r, (n) => {
1055
- he(Er, () => t(...n.map(g)), !0);
1055
+ pe(kr, () => t(...n.map(g)), !0);
1056
1056
  });
1057
1057
  }
1058
- function hi(t, e = 0) {
1059
- var r = he(Le | e, t, !0);
1058
+ function pi(t, e = 0) {
1059
+ var r = pe(Ie | e, t, !0);
1060
1060
  return r;
1061
1061
  }
1062
- function pe(t, e = !0) {
1063
- return he(fe | Fe, t, !0, e);
1062
+ function he(t, e = !0) {
1063
+ return pe(fe | Oe, t, !0, e);
1064
1064
  }
1065
1065
  function zr(t) {
1066
1066
  var e = t.teardown;
1067
1067
  if (e !== null) {
1068
- const r = Oe, n = v;
1069
- cr(!0), I(null);
1068
+ const r = Fe, n = v;
1069
+ cr(!0), D(null);
1070
1070
  try {
1071
1071
  e.call(null);
1072
1072
  } finally {
1073
- cr(r), I(n);
1073
+ cr(r), D(n);
1074
1074
  }
1075
1075
  }
1076
1076
  }
@@ -1079,13 +1079,13 @@ function Br(t, e = !1) {
1079
1079
  for (t.first = t.last = null; r !== null; ) {
1080
1080
  const i = r.ac;
1081
1081
  i !== null && Rr(() => {
1082
- i.abort(Nt);
1082
+ i.abort(jt);
1083
1083
  });
1084
1084
  var n = r.next;
1085
1085
  (r.f & ge) !== 0 ? r.parent = null : ee(r, e), r = n;
1086
1086
  }
1087
1087
  }
1088
- function pi(t) {
1088
+ function hi(t) {
1089
1089
  for (var e = t.first; e !== null; ) {
1090
1090
  var r = e.next;
1091
1091
  (e.f & fe) === 0 && ee(e), e = r;
@@ -1093,11 +1093,11 @@ function pi(t) {
1093
1093
  }
1094
1094
  function ee(t, e = !0) {
1095
1095
  var r = !1;
1096
- (e || (t.f & Cn) !== 0) && t.nodes_start !== null && t.nodes_end !== null && (di(
1096
+ (e || (t.f & Tn) !== 0) && t.nodes_start !== null && t.nodes_end !== null && (di(
1097
1097
  t.nodes_start,
1098
1098
  /** @type {TemplateNode} */
1099
1099
  t.nodes_end
1100
- ), r = !0), Br(t, e && !r), at(t, 0), H(t, Ie);
1100
+ ), r = !0), Br(t, e && !r), lt(t, 0), H(t, De);
1101
1101
  var n = t.transitions;
1102
1102
  if (n !== null)
1103
1103
  for (const s of n)
@@ -1110,7 +1110,7 @@ function di(t, e) {
1110
1110
  for (; t !== null; ) {
1111
1111
  var r = t === e ? null : (
1112
1112
  /** @type {TemplateNode} */
1113
- /* @__PURE__ */ Zt(t)
1113
+ /* @__PURE__ */ qt(t)
1114
1114
  );
1115
1115
  t.remove(), t = r;
1116
1116
  }
@@ -1119,7 +1119,7 @@ function Ur(t) {
1119
1119
  var e = t.parent, r = t.prev, n = t.next;
1120
1120
  r !== null && (r.next = n), n !== null && (n.prev = r), e !== null && (e.first === t && (e.first = n), e.last === t && (e.last = r));
1121
1121
  }
1122
- function nt(t, e) {
1122
+ function it(t, e) {
1123
1123
  var r = [];
1124
1124
  Zr(t, r, !0), vi(r, () => {
1125
1125
  ee(t), e && e();
@@ -1140,7 +1140,7 @@ function Zr(t, e, r) {
1140
1140
  for (const o of t.transitions)
1141
1141
  (o.is_global || r) && e.push(o);
1142
1142
  for (var n = t.first; n !== null; ) {
1143
- var i = n.next, s = (n.f & kr) !== 0 || (n.f & fe) !== 0;
1143
+ var i = n.next, s = (n.f & br) !== 0 || (n.f & fe) !== 0;
1144
1144
  Zr(n, e, s ? r : !1), n = i;
1145
1145
  }
1146
1146
  }
@@ -1149,12 +1149,12 @@ let Pe = !1;
1149
1149
  function fr(t) {
1150
1150
  Pe = t;
1151
1151
  }
1152
- let Oe = !1;
1152
+ let Fe = !1;
1153
1153
  function cr(t) {
1154
- Oe = t;
1154
+ Fe = t;
1155
1155
  }
1156
1156
  let v = null, G = !1;
1157
- function I(t) {
1157
+ function D(t) {
1158
1158
  v = t;
1159
1159
  }
1160
1160
  let m = null;
@@ -1165,46 +1165,46 @@ let se = null;
1165
1165
  function mi(t) {
1166
1166
  v !== null && (se === null ? se = [t] : se.push(t));
1167
1167
  }
1168
- let C = null, O = 0, j = null;
1168
+ let T = null, F = 0, j = null;
1169
1169
  function yi(t) {
1170
1170
  j = t;
1171
1171
  }
1172
1172
  let qr = 1, Ge = 0, me = Ge;
1173
- function hr(t) {
1173
+ function pr(t) {
1174
1174
  me = t;
1175
1175
  }
1176
1176
  let le = !1;
1177
1177
  function Hr() {
1178
1178
  return ++qr;
1179
1179
  }
1180
- function ct(t) {
1180
+ function pt(t) {
1181
1181
  var e = t.f;
1182
1182
  if ((e & re) !== 0)
1183
1183
  return !0;
1184
1184
  if ((e & ce) !== 0) {
1185
1185
  var r = t.deps, n = (e & q) !== 0;
1186
1186
  if (r !== null) {
1187
- var i, s, o = (e & st) !== 0, l = n && m !== null && !le, a = r.length;
1188
- if ((o || l) && (m === null || (m.f & Ie) === 0)) {
1187
+ var i, s, o = (e & ot) !== 0, l = n && m !== null && !le, a = r.length;
1188
+ if ((o || l) && (m === null || (m.f & De) === 0)) {
1189
1189
  var u = (
1190
1190
  /** @type {Derived} */
1191
1191
  t
1192
1192
  ), f = u.parent;
1193
1193
  for (i = 0; i < a; i++)
1194
1194
  s = r[i], (o || !s?.reactions?.includes(u)) && (s.reactions ??= []).push(u);
1195
- o && (u.f ^= st), l && f !== null && (f.f & q) === 0 && (u.f ^= q);
1195
+ o && (u.f ^= ot), l && f !== null && (f.f & q) === 0 && (u.f ^= q);
1196
1196
  }
1197
1197
  for (i = 0; i < a; i++)
1198
- if (s = r[i], ct(
1198
+ if (s = r[i], pt(
1199
1199
  /** @type {Derived} */
1200
1200
  s
1201
- ) && Cr(
1201
+ ) && Tr(
1202
1202
  /** @type {Derived} */
1203
1203
  s
1204
1204
  ), s.wv > t.wv)
1205
1205
  return !0;
1206
1206
  }
1207
- (!n || m !== null && !le) && H(t, L);
1207
+ (!n || m !== null && !le) && H(t, I);
1208
1208
  }
1209
1209
  return !1;
1210
1210
  }
@@ -1218,37 +1218,37 @@ function Yr(t, e, r = !0) {
1218
1218
  s,
1219
1219
  e,
1220
1220
  !1
1221
- ) : e === s && (r ? H(s, re) : (s.f & L) !== 0 && H(s, ce), We(
1221
+ ) : e === s && (r ? H(s, re) : (s.f & I) !== 0 && H(s, ce), We(
1222
1222
  /** @type {Effect} */
1223
1223
  s
1224
1224
  ));
1225
1225
  }
1226
1226
  }
1227
1227
  function Vr(t) {
1228
- var e = C, r = O, n = j, i = v, s = le, o = se, l = Y, a = G, u = me, f = t.f;
1229
- C = /** @type {null | Value[]} */
1230
- null, O = 0, j = null, le = (f & q) !== 0 && (G || !Pe || v === null), v = (f & (fe | ge)) === 0 ? t : null, se = null, De(t.ctx), G = !1, me = ++Ge, t.ac !== null && (Rr(() => {
1231
- t.ac.abort(Nt);
1228
+ var e = T, r = F, n = j, i = v, s = le, o = se, l = Y, a = G, u = me, f = t.f;
1229
+ T = /** @type {null | Value[]} */
1230
+ null, F = 0, j = null, le = (f & q) !== 0 && (G || !Pe || v === null), v = (f & (fe | ge)) === 0 ? t : null, se = null, Ce(t.ctx), G = !1, me = ++Ge, t.ac !== null && (Rr(() => {
1231
+ t.ac.abort(jt);
1232
1232
  }), t.ac = null);
1233
1233
  try {
1234
- t.f |= xt;
1235
- var p = (
1234
+ t.f |= Pt;
1235
+ var h = (
1236
1236
  /** @type {Function} */
1237
1237
  t.fn
1238
- ), h = p(), c = t.deps;
1239
- if (C !== null) {
1238
+ ), p = h(), c = t.deps;
1239
+ if (T !== null) {
1240
1240
  var d;
1241
- if (at(t, O), c !== null && O > 0)
1242
- for (c.length = O + C.length, d = 0; d < C.length; d++)
1243
- c[O + d] = C[d];
1241
+ if (lt(t, F), c !== null && F > 0)
1242
+ for (c.length = F + T.length, d = 0; d < T.length; d++)
1243
+ c[F + d] = T[d];
1244
1244
  else
1245
- t.deps = c = C;
1245
+ t.deps = c = T;
1246
1246
  if (!le || // Deriveds that already have reactions can cleanup, so we still add them as reactions
1247
1247
  (f & R) !== 0 && /** @type {import('#client').Derived} */
1248
1248
  t.reactions !== null)
1249
- for (d = O; d < c.length; d++)
1249
+ for (d = F; d < c.length; d++)
1250
1250
  (c[d].reactions ??= []).push(t);
1251
- } else c !== null && O < c.length && (at(t, O), c.length = O);
1251
+ } else c !== null && F < c.length && (lt(t, F), c.length = F);
1252
1252
  if (xr() && j !== null && !G && c !== null && (t.f & (R | ce | re)) === 0)
1253
1253
  for (d = 0; d < /** @type {Source[]} */
1254
1254
  j.length; d++)
@@ -1258,17 +1258,17 @@ function Vr(t) {
1258
1258
  t
1259
1259
  );
1260
1260
  return i !== null && i !== t && (Ge++, j !== null && (n === null ? n = j : n.push(.../** @type {Source[]} */
1261
- j))), (t.f & ve) !== 0 && (t.f ^= ve), h;
1261
+ j))), (t.f & ve) !== 0 && (t.f ^= ve), p;
1262
1262
  } catch (w) {
1263
1263
  return Pr(w);
1264
1264
  } finally {
1265
- t.f ^= xt, C = e, O = r, j = n, v = i, le = s, se = o, De(l), G = a, me = u;
1265
+ t.f ^= Pt, T = e, F = r, j = n, v = i, le = s, se = o, Ce(l), G = a, me = u;
1266
1266
  }
1267
1267
  }
1268
1268
  function gi(t, e) {
1269
1269
  let r = e.reactions;
1270
1270
  if (r !== null) {
1271
- var n = kn.call(r, t);
1271
+ var n = bn.call(r, t);
1272
1272
  if (n !== -1) {
1273
1273
  var i = r.length - 1;
1274
1274
  i === 0 ? r = e.reactions = null : (r[n] = r[i], r.pop());
@@ -1277,16 +1277,16 @@ function gi(t, e) {
1277
1277
  r === null && (e.f & R) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1278
1278
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1279
1279
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1280
- (C === null || !C.includes(e)) && (H(e, ce), (e.f & (q | st)) === 0 && (e.f ^= st), Dr(
1280
+ (T === null || !T.includes(e)) && (H(e, ce), (e.f & (q | ot)) === 0 && (e.f ^= ot), Cr(
1281
1281
  /** @type {Derived} **/
1282
1282
  e
1283
- ), at(
1283
+ ), lt(
1284
1284
  /** @type {Derived} **/
1285
1285
  e,
1286
1286
  0
1287
1287
  ));
1288
1288
  }
1289
- function at(t, e) {
1289
+ function lt(t, e) {
1290
1290
  var r = t.deps;
1291
1291
  if (r !== null)
1292
1292
  for (var n = e; n < r.length; n++)
@@ -1294,12 +1294,12 @@ function at(t, e) {
1294
1294
  }
1295
1295
  function Se(t) {
1296
1296
  var e = t.f;
1297
- if ((e & Ie) === 0) {
1298
- H(t, L);
1297
+ if ((e & De) === 0) {
1298
+ H(t, I);
1299
1299
  var r = m, n = Pe;
1300
1300
  m = t, Pe = !0;
1301
1301
  try {
1302
- (e & Le) !== 0 ? pi(t) : Br(t), zr(t);
1302
+ (e & Ie) !== 0 ? hi(t) : Br(t), zr(t);
1303
1303
  var i = Vr(t);
1304
1304
  t.teardown = typeof i == "function" ? i : null, t.wv = qr;
1305
1305
  var s;
@@ -1311,11 +1311,11 @@ function Se(t) {
1311
1311
  function g(t) {
1312
1312
  var e = t.f, r = (e & R) !== 0;
1313
1313
  if (v !== null && !G) {
1314
- var n = m !== null && (m.f & Ie) !== 0;
1314
+ var n = m !== null && (m.f & De) !== 0;
1315
1315
  if (!n && !se?.includes(t)) {
1316
1316
  var i = v.deps;
1317
- if ((v.f & xt) !== 0)
1318
- t.rv < Ge && (t.rv = Ge, C === null && i !== null && i[O] === t ? O++ : C === null ? C = [t] : (!le || !C.includes(t)) && C.push(t));
1317
+ if ((v.f & Pt) !== 0)
1318
+ t.rv < Ge && (t.rv = Ge, T === null && i !== null && i[F] === t ? F++ : T === null ? T = [t] : (!le || !T.includes(t)) && T.push(t));
1319
1319
  else {
1320
1320
  (v.deps ??= []).push(t);
1321
1321
  var s = t.reactions;
@@ -1331,17 +1331,17 @@ function g(t) {
1331
1331
  ), l = o.parent;
1332
1332
  l !== null && (l.f & q) === 0 && (o.f ^= q);
1333
1333
  }
1334
- if (Oe) {
1334
+ if (Fe) {
1335
1335
  if (ue.has(t))
1336
1336
  return ue.get(t);
1337
1337
  if (r) {
1338
1338
  o = /** @type {Derived} */
1339
1339
  t;
1340
1340
  var a = o.v;
1341
- return ((o.f & L) === 0 && o.reactions !== null || Xr(o)) && (a = Ut(o)), ue.set(o, a), a;
1341
+ return ((o.f & I) === 0 && o.reactions !== null || Xr(o)) && (a = Zt(o)), ue.set(o, a), a;
1342
1342
  }
1343
1343
  } else r && (o = /** @type {Derived} */
1344
- t, ct(o) && Cr(o));
1344
+ t, pt(o) && Tr(o));
1345
1345
  if ((t.f & ve) !== 0)
1346
1346
  throw t.v;
1347
1347
  return t.v;
@@ -1370,12 +1370,12 @@ function H(t, e) {
1370
1370
  t.f = t.f & _i | e;
1371
1371
  }
1372
1372
  const wi = ["touchstart", "touchmove"];
1373
- function bi(t) {
1373
+ function Ei(t) {
1374
1374
  return wi.includes(t);
1375
1375
  }
1376
- const Ei = /* @__PURE__ */ new Set(), pr = /* @__PURE__ */ new Set();
1376
+ const ki = /* @__PURE__ */ new Set(), hr = /* @__PURE__ */ new Set();
1377
1377
  let dr = null;
1378
- function et(t) {
1378
+ function tt(t) {
1379
1379
  var e = this, r = (
1380
1380
  /** @type {Node} */
1381
1381
  e.ownerDocument
@@ -1399,16 +1399,16 @@ function et(t) {
1399
1399
  }
1400
1400
  if (s = /** @type {Element} */
1401
1401
  i[o] || t.target, s !== e) {
1402
- Mt(t, "currentTarget", {
1402
+ xt(t, "currentTarget", {
1403
1403
  configurable: !0,
1404
1404
  get() {
1405
1405
  return s || r;
1406
1406
  }
1407
1407
  });
1408
- var f = v, p = m;
1409
- I(null), ne(null);
1408
+ var f = v, h = m;
1409
+ D(null), ne(null);
1410
1410
  try {
1411
- for (var h, c = []; s !== null; ) {
1411
+ for (var p, c = []; s !== null; ) {
1412
1412
  var d = s.assignedSlot || s.parentNode || /** @type {any} */
1413
1413
  s.host || null;
1414
1414
  try {
@@ -1417,31 +1417,31 @@ function et(t) {
1417
1417
  s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1418
1418
  // -> the target could not have been disabled because it emits the event in the first place
1419
1419
  t.target === s))
1420
- if (br(w)) {
1421
- var [F, ...K] = w;
1422
- F.apply(s, [t, ...K]);
1420
+ if (Er(w)) {
1421
+ var [O, ...K] = w;
1422
+ O.apply(s, [t, ...K]);
1423
1423
  } else
1424
1424
  w.call(s, t);
1425
- } catch (k) {
1426
- h ? c.push(k) : h = k;
1425
+ } catch (b) {
1426
+ p ? c.push(b) : p = b;
1427
1427
  }
1428
1428
  if (t.cancelBubble || d === e || d === null)
1429
1429
  break;
1430
1430
  s = d;
1431
1431
  }
1432
- if (h) {
1433
- for (let k of c)
1432
+ if (p) {
1433
+ for (let b of c)
1434
1434
  queueMicrotask(() => {
1435
- throw k;
1435
+ throw b;
1436
1436
  });
1437
- throw h;
1437
+ throw p;
1438
1438
  }
1439
1439
  } finally {
1440
- t.__root = e, delete t.currentTarget, I(f), ne(p);
1440
+ t.__root = e, delete t.currentTarget, D(f), ne(h);
1441
1441
  }
1442
1442
  }
1443
1443
  }
1444
- function ki(t) {
1444
+ function bi(t) {
1445
1445
  var e = document.createElement("template");
1446
1446
  return e.innerHTML = t.replaceAll("<!>", "<!---->"), e.content;
1447
1447
  }
@@ -1456,11 +1456,11 @@ function Mi(t, e) {
1456
1456
  function Gr(t, e) {
1457
1457
  var r = (e & Un) !== 0, n, i = !t.startsWith("<!>");
1458
1458
  return () => {
1459
- n === void 0 && (n = ki(i ? t : "<!>" + t), n = /** @type {Node} */
1460
- /* @__PURE__ */ Or(n));
1459
+ n === void 0 && (n = bi(i ? t : "<!>" + t), n = /** @type {Node} */
1460
+ /* @__PURE__ */ Fr(n));
1461
1461
  var s = (
1462
1462
  /** @type {TemplateNode} */
1463
- r || Lr ? document.importNode(n, !0) : n.cloneNode(!0)
1463
+ r || Ir ? document.importNode(n, !0) : n.cloneNode(!0)
1464
1464
  );
1465
1465
  return Mi(s, s), s;
1466
1466
  };
@@ -1471,55 +1471,55 @@ function Kr(t, e) {
1471
1471
  e
1472
1472
  );
1473
1473
  }
1474
- function Ht(t, e) {
1474
+ function Yt(t, e) {
1475
1475
  return xi(t, e);
1476
1476
  }
1477
- const ke = /* @__PURE__ */ new Map();
1477
+ const be = /* @__PURE__ */ new Map();
1478
1478
  function xi(t, { target: e, anchor: r, props: n = {}, events: i, context: s, intro: o = !0 }) {
1479
1479
  ni();
1480
- var l = /* @__PURE__ */ new Set(), a = (p) => {
1481
- for (var h = 0; h < p.length; h++) {
1482
- var c = p[h];
1480
+ var l = /* @__PURE__ */ new Set(), a = (h) => {
1481
+ for (var p = 0; p < h.length; p++) {
1482
+ var c = h[p];
1483
1483
  if (!l.has(c)) {
1484
1484
  l.add(c);
1485
- var d = bi(c);
1486
- e.addEventListener(c, et, { passive: d });
1487
- var w = ke.get(c);
1488
- w === void 0 ? (document.addEventListener(c, et, { passive: d }), ke.set(c, 1)) : ke.set(c, w + 1);
1485
+ var d = Ei(c);
1486
+ e.addEventListener(c, tt, { passive: d });
1487
+ var w = be.get(c);
1488
+ w === void 0 ? (document.addEventListener(c, tt, { passive: d }), be.set(c, 1)) : be.set(c, w + 1);
1489
1489
  }
1490
1490
  }
1491
1491
  };
1492
- a(Mn(Ei)), pr.add(a);
1492
+ a(Mn(ki)), hr.add(a);
1493
1493
  var u = void 0, f = ui(() => {
1494
- var p = r ?? e.appendChild(ii());
1494
+ var h = r ?? e.appendChild(ii());
1495
1495
  return Gn(
1496
1496
  /** @type {TemplateNode} */
1497
- p,
1497
+ h,
1498
1498
  {
1499
1499
  pending: () => {
1500
1500
  }
1501
1501
  },
1502
- (h) => {
1502
+ (p) => {
1503
1503
  if (s) {
1504
- jt({});
1504
+ zt({});
1505
1505
  var c = (
1506
1506
  /** @type {ComponentContext} */
1507
1507
  Y
1508
1508
  );
1509
1509
  c.c = s;
1510
1510
  }
1511
- i && (n.$$events = i), u = t(h, n) || {}, s && zt();
1511
+ i && (n.$$events = i), u = t(p, n) || {}, s && Bt();
1512
1512
  }
1513
1513
  ), () => {
1514
- for (var h of l) {
1515
- e.removeEventListener(h, et);
1514
+ for (var p of l) {
1515
+ e.removeEventListener(p, tt);
1516
1516
  var c = (
1517
1517
  /** @type {number} */
1518
- ke.get(h)
1518
+ be.get(p)
1519
1519
  );
1520
- --c === 0 ? (document.removeEventListener(h, et), ke.delete(h)) : ke.set(h, c);
1520
+ --c === 0 ? (document.removeEventListener(p, tt), be.delete(p)) : be.set(p, c);
1521
1521
  }
1522
- pr.delete(a), p !== r && p.parentNode?.removeChild(p);
1522
+ hr.delete(a), h !== r && h.parentNode?.removeChild(h);
1523
1523
  };
1524
1524
  });
1525
1525
  return Pi.set(u, f), u;
@@ -1553,7 +1553,7 @@ function vr(t, e = !1) {
1553
1553
  }
1554
1554
  return n;
1555
1555
  }
1556
- function Di(t, e) {
1556
+ function Ci(t, e) {
1557
1557
  if (e) {
1558
1558
  var r = "", n, i;
1559
1559
  return Array.isArray(e) ? (n = e[0], i = e[1]) : n = e, n && (r += vr(n)), i && (r += vr(i, !0)), r = r.trim(), r === "" ? null : r;
@@ -1568,7 +1568,7 @@ function $r(t, e, r, n, i, s) {
1568
1568
  }
1569
1569
  return s;
1570
1570
  }
1571
- function bt(t, e = {}, r, n) {
1571
+ function kt(t, e = {}, r, n) {
1572
1572
  for (var i in r) {
1573
1573
  var s = r[i];
1574
1574
  e[i] !== s && (r[i] == null ? t.style.removeProperty(i) : t.style.setProperty(i, s, n));
@@ -1577,12 +1577,12 @@ function bt(t, e = {}, r, n) {
1577
1577
  function ze(t, e, r, n) {
1578
1578
  var i = t.__style;
1579
1579
  if (i !== e) {
1580
- var s = Di(e, n);
1580
+ var s = Ci(e, n);
1581
1581
  s == null ? t.removeAttribute("style") : t.style.cssText = s, t.__style = e;
1582
- } else n && (Array.isArray(n) ? (bt(t, r?.[0], n[0]), bt(t, r?.[1], n[1], "important")) : bt(t, r, n));
1582
+ } else n && (Array.isArray(n) ? (kt(t, r?.[0], n[0]), kt(t, r?.[1], n[1], "important")) : kt(t, r, n));
1583
1583
  return n;
1584
1584
  }
1585
- const Ci = () => performance.now(), Q = {
1585
+ const Ti = () => performance.now(), Q = {
1586
1586
  // don't access requestAnimationFrame eagerly outside method
1587
1587
  // this allows basic testing of user code without JSDOM
1588
1588
  // bunder will eval and remove ternary when the user's app is built
@@ -1590,7 +1590,7 @@ const Ci = () => performance.now(), Q = {
1590
1590
  /** @param {any} _ */
1591
1591
  (t) => requestAnimationFrame(t)
1592
1592
  ),
1593
- now: () => Ci(),
1593
+ now: () => Ti(),
1594
1594
  tasks: /* @__PURE__ */ new Set()
1595
1595
  };
1596
1596
  function en() {
@@ -1599,7 +1599,7 @@ function en() {
1599
1599
  e.c(t) || (Q.tasks.delete(e), e.f());
1600
1600
  }), Q.tasks.size !== 0 && Q.tick(en);
1601
1601
  }
1602
- function Ti(t) {
1602
+ function Li(t) {
1603
1603
  let e;
1604
1604
  return Q.tasks.size === 0 && Q.tick(en), {
1605
1605
  promise: new Promise((r) => {
@@ -1611,35 +1611,35 @@ function Ti(t) {
1611
1611
  };
1612
1612
  }
1613
1613
  function mr(t, e) {
1614
- return t === e || t?.[rt] === e;
1614
+ return t === e || t?.[nt] === e;
1615
1615
  }
1616
1616
  function Be(t = {}, e, r, n) {
1617
1617
  return fi(() => {
1618
1618
  var i, s;
1619
- return qt(() => {
1619
+ return Ht(() => {
1620
1620
  i = s, s = [], Wr(() => {
1621
1621
  t !== r(...s) && (e(t, ...s), i && mr(r(...i), t) && e(null, ...i));
1622
1622
  });
1623
1623
  }), () => {
1624
- ut(() => {
1624
+ ft(() => {
1625
1625
  s && mr(r(...s), t) && e(null, ...s);
1626
1626
  });
1627
1627
  };
1628
1628
  }), t;
1629
1629
  }
1630
- const Li = "5";
1631
- typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Li);
1632
- function Ii(t) {
1630
+ const Ii = "5";
1631
+ typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Ii);
1632
+ function Di(t) {
1633
1633
  return t;
1634
1634
  }
1635
- function At(t) {
1635
+ function Ct(t) {
1636
1636
  return -0.5 * (Math.cos(Math.PI * t) - 1);
1637
1637
  }
1638
- function Fi(t) {
1638
+ function Oi(t) {
1639
1639
  const e = Math.cos(t * Math.PI * 0.5);
1640
1640
  return Math.abs(e) < 1e-14 ? 1 : 1 - e;
1641
1641
  }
1642
- function Oi(t) {
1642
+ function Fi(t) {
1643
1643
  return Math.sin(t * Math.PI / 2);
1644
1644
  }
1645
1645
  const Ri = 128, Ni = 0, ji = 1, zi = 2;
@@ -1706,7 +1706,7 @@ const ae = new Bi();
1706
1706
  function yr(t) {
1707
1707
  return Object.prototype.toString.call(t) === "[object Date]";
1708
1708
  }
1709
- function Dt(t, e) {
1709
+ function Tt(t, e) {
1710
1710
  if (t === e || t !== t) return () => t;
1711
1711
  const r = typeof t;
1712
1712
  if (r !== typeof e || Array.isArray(t) !== Array.isArray(e))
@@ -1714,7 +1714,7 @@ function Dt(t, e) {
1714
1714
  if (Array.isArray(t)) {
1715
1715
  const n = (
1716
1716
  /** @type {Array<any>} */
1717
- e.map((i, s) => Dt(
1717
+ e.map((i, s) => Tt(
1718
1718
  /** @type {Array<any>} */
1719
1719
  t[s],
1720
1720
  i
@@ -1731,7 +1731,7 @@ function Dt(t, e) {
1731
1731
  }
1732
1732
  const n = Object.keys(e), i = {};
1733
1733
  return n.forEach((s) => {
1734
- i[s] = Dt(t[s], e[s]);
1734
+ i[s] = Tt(t[s], e[s]);
1735
1735
  }), (s) => {
1736
1736
  const o = {};
1737
1737
  return n.forEach((l) => {
@@ -1749,7 +1749,7 @@ function Dt(t, e) {
1749
1749
  }
1750
1750
  return () => e;
1751
1751
  }
1752
- class Yt {
1752
+ class Vt {
1753
1753
  #e;
1754
1754
  #t;
1755
1755
  /** @type {TweenedOptions<T>} */
@@ -1761,7 +1761,7 @@ class Yt {
1761
1761
  * @param {TweenedOptions<T>} options
1762
1762
  */
1763
1763
  constructor(e, r = {}) {
1764
- this.#e = /* @__PURE__ */ D(e), this.#t = /* @__PURE__ */ D(e), this.#a = r;
1764
+ this.#e = /* @__PURE__ */ C(e), this.#t = /* @__PURE__ */ C(e), this.#a = r;
1765
1765
  }
1766
1766
  /**
1767
1767
  * Create a tween whose value is bound to the return value of `fn`. This must be called
@@ -1781,8 +1781,8 @@ class Yt {
1781
1781
  * @param {TweenedOptions<U>} [options]
1782
1782
  */
1783
1783
  static of(e, r) {
1784
- const n = new Yt(e(), r);
1785
- return qt(() => {
1784
+ const n = new Vt(e(), r);
1785
+ return Ht(() => {
1786
1786
  n.set(e());
1787
1787
  }), n;
1788
1788
  }
@@ -1799,24 +1799,24 @@ class Yt {
1799
1799
  let {
1800
1800
  delay: n = 0,
1801
1801
  duration: i = 400,
1802
- easing: s = Ii,
1803
- interpolate: o = Dt
1802
+ easing: s = Di,
1803
+ interpolate: o = Tt
1804
1804
  } = { ...this.#a, ...r };
1805
1805
  if (i === 0)
1806
1806
  return this.#n?.abort(), P(this.#e, e), Promise.resolve();
1807
1807
  const l = Q.now() + n;
1808
1808
  let a, u = !1, f = this.#n;
1809
- return this.#n = Ti((p) => {
1810
- if (p < l)
1809
+ return this.#n = Li((h) => {
1810
+ if (h < l)
1811
1811
  return !0;
1812
1812
  if (!u) {
1813
1813
  u = !0;
1814
1814
  const c = this.#e.v;
1815
1815
  a = o(c, e), typeof i == "function" && (i = i(c, e)), f?.abort();
1816
1816
  }
1817
- const h = p - l;
1818
- return h > /** @type {number} */
1819
- i ? (P(this.#e, e), !1) : (P(this.#e, a(s(h / /** @type {number} */
1817
+ const p = h - l;
1818
+ return p > /** @type {number} */
1819
+ i ? (P(this.#e, e), !1) : (P(this.#e, a(s(p / /** @type {number} */
1820
1820
  i))), !0);
1821
1821
  }), this.#n.promise;
1822
1822
  }
@@ -1830,11 +1830,11 @@ class Yt {
1830
1830
  this.set(e);
1831
1831
  }
1832
1832
  }
1833
- class it {
1833
+ class st {
1834
1834
  value;
1835
1835
  motion;
1836
1836
  constructor(e, r) {
1837
- this.value = e, this.motion = new Yt(e, r);
1837
+ this.value = e, this.motion = new Vt(e, r);
1838
1838
  }
1839
1839
  set(e, r) {
1840
1840
  this.value = e, this.motion.set(e, r);
@@ -1848,64 +1848,64 @@ class it {
1848
1848
  }
1849
1849
  var Ui = /* @__PURE__ */ Gr("<div></div>");
1850
1850
  function Zi(t, e) {
1851
- jt(e, !0);
1851
+ zt(e, !0);
1852
1852
  let r = e.style.width, n = e.style.height, i = e.style.radius, s = e.colors?.background ?? "darkgreen", o = e.colors?.border ?? "white", l = e.colors?.shadow ?? "0px 2px 2px rgba(0, 0, 0, 0.5)", a;
1853
1853
  function u() {
1854
1854
  return a;
1855
1855
  }
1856
- let f = /* @__PURE__ */ D(!1);
1857
- function p(b) {
1858
- P(f, b, !0);
1856
+ let f = /* @__PURE__ */ C(!1);
1857
+ function h(E) {
1858
+ P(f, E, !0);
1859
1859
  }
1860
- function h() {
1860
+ function p() {
1861
1861
  return g(f);
1862
1862
  }
1863
- let c = /* @__PURE__ */ D(!0), d = 0, w = 150;
1864
- function F(b) {
1865
- b != g(c) && (P(c, b, !0), d = performance.now());
1863
+ let c = /* @__PURE__ */ C(!0), d = 0, w = 150;
1864
+ function O(E) {
1865
+ E != g(c) && (P(c, E, !0), d = performance.now());
1866
1866
  }
1867
1867
  function K() {
1868
1868
  return performance.now() - d < w ? V.motion.current == 0 : V.value == 0;
1869
1869
  }
1870
- let k = 0, V = new it(0, { easing: At });
1870
+ let b = 0, V = new st(0, { easing: Ct });
1871
1871
  J(() => {
1872
1872
  g(f) == !1 && (V.snap(), ae.clear(e.priority, e.id));
1873
1873
  }), J(() => {
1874
- V.set(g(c) ? 0 : k, { duration: 75 });
1874
+ V.set(g(c) ? 0 : b, { duration: 75 });
1875
1875
  }), J(() => {
1876
- Je(V.motion.current);
1876
+ Qe(V.motion.current);
1877
1877
  });
1878
- function Je(b) {
1878
+ function Qe(E) {
1879
1879
  a && ae.equeue(e.layer, e.priority, e.id, () => {
1880
- a.style.scale = b.toString(), a.style.filter = `brightness(${0.25 + 0.75 * b})`;
1880
+ a.style.scale = E.toString(), a.style.filter = `brightness(${0.25 + 0.75 * E})`;
1881
1881
  });
1882
1882
  }
1883
- function pt(b) {
1884
- b != k && (k = b, V.set(b, { duration: 75 }));
1883
+ function dt(E) {
1884
+ E != b && (b = E, V.set(E, { duration: 75 }));
1885
1885
  }
1886
- function dt() {
1886
+ function vt() {
1887
1887
  return V.value;
1888
1888
  }
1889
- var vt = {
1889
+ var mt = {
1890
1890
  getBody: u,
1891
- setDisplayed: p,
1892
- getDisplayed: h,
1893
- setCollapsed: F,
1891
+ setDisplayed: h,
1892
+ getDisplayed: p,
1893
+ setCollapsed: O,
1894
1894
  getCollapsed: K,
1895
- setScale: pt,
1896
- getScale: dt
1895
+ setScale: dt,
1896
+ getScale: vt
1897
1897
  }, M = Ui();
1898
- let Qe;
1898
+ let $e;
1899
1899
  return Be(
1900
1900
  M,
1901
- (b) => (
1901
+ (E) => (
1902
1902
  //#endregion
1903
- a = b
1903
+ a = E
1904
1904
  ),
1905
1905
  () => a
1906
1906
  ), jr(
1907
- (b) => {
1908
- $r(M, 1, Qr(["pin", g(f) && "displayed"]), "svelte-zz3jrb"), Qe = ze(M, "", Qe, b);
1907
+ (E) => {
1908
+ $r(M, 1, Qr(["pin", g(f) && "displayed"]), "svelte-zz3jrb"), $e = ze(M, "", $e, E);
1909
1909
  },
1910
1910
  [
1911
1911
  () => ({
@@ -1917,243 +1917,75 @@ function Zi(t, e) {
1917
1917
  "box-shadow": l
1918
1918
  })
1919
1919
  ]
1920
- ), Kr(t, M), zt(vt);
1921
- }
1922
- var qe;
1923
- ((t) => {
1924
- function e(r, n, i) {
1925
- const s = r / 2, o = n / 2, l = Math.sqrt(s * s + o * o), a = Math.atan(o / s) * (180 / Math.PI), u = i * (Math.PI / 180);
1926
- return i < 180 ? i < 90 ? i < a ? {
1927
- x: 0,
1928
- y: l * Math.sin(u) - o
1929
- } : {
1930
- x: l * Math.cos(u) - s,
1931
- y: 0
1932
- } : i < 180 - a ? {
1933
- x: l * Math.cos(u) - s,
1934
- y: 0
1935
- } : {
1936
- x: -r,
1937
- y: l * Math.sin(u) - o
1938
- } : i < 270 ? i < 180 + a ? {
1939
- x: -r,
1940
- y: l * Math.sin(u) - o
1941
- } : {
1942
- x: l * Math.cos(u) - s,
1943
- y: -n
1944
- } : i < 360 - a ? {
1945
- x: l * Math.cos(u) - s,
1946
- y: -n
1947
- } : {
1948
- x: 0,
1949
- y: l * Math.sin(u) - o
1950
- };
1951
- }
1952
- t.getOffsets = e;
1953
- })(qe || (qe = {}));
1954
- var qi = /* @__PURE__ */ Gr('<div><div class="pointer svelte-11extwn"></div> <div class="bubble svelte-11extwn"><div class="body svelte-11extwn"></div></div></div>');
1955
- function tn(t, e) {
1956
- jt(e, !0);
1957
- let r = e.style.width, n = e.style.height, i = e.style.margin, s = e.style.radius, o = e.colors?.background ?? "white", l = e.colors?.shadow ?? "0px 2px 2px rgba(0, 0, 0, 0.5)", a, u, f, p;
1958
- const h = r + 2 * i, c = n + 2 * i, d = () => p;
1959
- J(() => {
1960
- f.style.width = `${i * 4}px`, f.style.height = `${i * 4}px`;
1961
- });
1962
- let w = /* @__PURE__ */ D(!0);
1963
- function F(y) {
1964
- P(w, y, !0);
1965
- }
1966
- function K() {
1967
- return g(w);
1968
- }
1969
- let k = /* @__PURE__ */ D(!0), V = 0, Je = 300;
1970
- function pt(y) {
1971
- y != g(k) && (P(k, y, !0), V = performance.now());
1972
- }
1973
- function dt() {
1974
- return performance.now() - V < Je ? M.motion.current == 0 : M.value == 0;
1975
- }
1976
- function vt() {
1977
- return performance.now() - V < Je ? M.motion.current == 1 : M.value == 1;
1978
- }
1979
- let M = new it(0);
1980
- J(() => {
1981
- g(w) == !1 && (M.snap(), ae.clear(e.priority, e.id + "_scale"));
1982
- }), J(() => {
1983
- g(k) == !0 && M.value != 0 && (ae.stacked() ? M.set(0, { duration: 0 }) : M.set(0, { duration: 150, easing: Fi })), g(k) == !1 && M.value != 1 && M.set(1, { duration: 150, easing: Oi });
1984
- }), J(() => {
1985
- Qe(M.motion.current);
1986
- });
1987
- function Qe(y) {
1988
- !a || !u || !f || ae.equeue(g(k) ? 0 : e.layer, e.priority, e.id + "_scale", () => {
1989
- a.style.opacity = `${y}`, u.style.scale = `${y}`, f.style.scale = `${y}`;
1990
- });
1991
- }
1992
- let b = NaN, mt = /* @__PURE__ */ D(!1), oe = new it(-h / 2, { easing: At }), $e = new it(-c / 2, { easing: At });
1993
- J(() => {
1994
- g(w) == !1 && (oe.snap(), oe.snap(), ae.clear(e.priority, e.id + "_angle"));
1995
- }), J(() => {
1996
- g(k) == !0 && g(mt) && (oe.update({ duration: 75 }), oe.update({ duration: 75 }));
1997
- }), J(() => {
1998
- Jt(oe.motion.current, $e.motion.current);
1999
- });
2000
- function Jt(y, _e) {
2001
- if (!a || !u || !f) return;
2002
- const X = y + h / 2, we = _e + c / 2, be = c < h ? X * c / h : X, Ee = c > h ? we * h / c : we, gn = Math.atan2(Ee, be) / Math.PI * 180 - 45, nr = 0, _n = 30, _t = Math.sqrt(be * be + Ee * Ee), Ne = Math.min(h, c) / 2, wn = Ne * Math.SQRT2, bn = (_t - Ne) / (wn - Ne), ir = nr + bn * (_n - nr), En = _t < Ne ? _t / Ne : 1;
2003
- ae.equeue(e.layer, e.priority, e.id + "_angle", () => {
2004
- u.style.transform = `translate(${Math.round(y)}px, ${Math.round(_e)}px)`, f.style.transform = `scale(${En}) rotate(${gn}deg) skew(${ir}deg, ${ir}deg)`;
2005
- });
2006
- }
2007
- function vn(y, _e) {
2008
- if (g(mt) == !1 || _e == !0) {
2009
- let X = qe.getOffsets(h, c, y);
2010
- oe.set(Math.round(X.x), { duration: 0 }), $e.set(Math.round(X.y), { duration: 0 }), Jt(oe.value, $e.value), b = y, P(mt, !0);
2011
- } else if (y != b) {
2012
- let X = Math.abs(y - b), we = X < 180 ? X : 360 - X, be = Math.log(we) * 75, Ee = qe.getOffsets(h, c, y);
2013
- oe.set(Math.round(Ee.x), { duration: be }), $e.set(Math.round(Ee.y), { duration: be }), b = y;
2014
- }
2015
- }
2016
- function mn() {
2017
- return qe.getOffsets(h, c, b);
2018
- }
2019
- var yn = {
2020
- getBody: d,
2021
- setDisplayed: F,
2022
- getDisplayed: K,
2023
- setCollapsed: pt,
2024
- getCollapsed: dt,
2025
- getExpanded: vt,
2026
- setAngle: vn,
2027
- getOffsets: mn
2028
- }, Re = qi();
2029
- let Qt;
2030
- var yt = ur(Re);
2031
- let $t;
2032
- Be(
2033
- yt,
2034
- (y) => (
2035
- //#endregion
2036
- f = y
2037
- ),
2038
- () => f
2039
- );
2040
- var gt = si(yt, 2);
2041
- let er;
2042
- var tr = ur(gt);
2043
- let rr;
2044
- return Be(tr, (y) => p = y, () => p), Be(gt, (y) => u = y, () => u), Be(Re, (y) => a = y, () => a), jr(
2045
- (y, _e, X, we) => {
2046
- $r(Re, 1, Qr(["anchor", g(w) && "displayed"]), "svelte-11extwn"), Qt = ze(Re, "", Qt, y), $t = ze(yt, "", $t, _e), er = ze(gt, "", er, X), rr = ze(tr, "", rr, we);
2047
- },
2048
- [
2049
- () => ({ filter: `drop-shadow(${l})` }),
2050
- () => ({ "background-color": o }),
2051
- () => ({ margin: `${i}px;` }),
2052
- () => ({
2053
- width: `${r}px`,
2054
- height: `${n}px`,
2055
- "border-radius": `${s}px;`,
2056
- "background-color": o
2057
- })
2058
- ]
2059
- ), Kr(t, Re), zt(yn);
1920
+ ), Kr(t, M), Bt(mt);
2060
1921
  }
2061
- var He;
2062
- ((t) => {
2063
- async function e(n, i) {
2064
- const s = await fetch(n, i);
2065
- if (!s.ok) throw new Error(s.statusText);
2066
- return s.json();
2067
- }
2068
- t.get = e;
2069
- async function r(n, i, s) {
2070
- const o = await fetch(n, {
2071
- method: "POST",
2072
- body: JSON.stringify(i),
2073
- headers: {
2074
- "Content-Type": "application/json",
2075
- ...s?.headers
2076
- },
2077
- ...s
2078
- });
2079
- if (!o.ok) throw new Error(o.statusText);
2080
- return o.json();
1922
+ class Je {
1923
+ provider;
1924
+ providerMarker;
1925
+ id;
1926
+ lat;
1927
+ lng;
1928
+ shown;
1929
+ element;
1930
+ component;
1931
+ constructor(e, r) {
1932
+ if (new.target === Je)
1933
+ throw new Error("Cannot instantiate an abstract class directly.");
1934
+ this.provider = e, this.id = r.id, this.lat = r.lat, this.lng = r.lng, this.shown = !0;
2081
1935
  }
2082
- t.post = r;
2083
- })(He || (He = {}));
2084
- var xe;
2085
- ((t) => {
2086
- function e(l, a, u) {
2087
- return {
2088
- x: n(a) * u,
2089
- y: i(l) * u
2090
- };
1936
+ create() {
1937
+ this.createElement(), this.createMarker(), this.setZIndex();
2091
1938
  }
2092
- t.project = e;
2093
- function r(l, a, u) {
2094
- return {
2095
- lat: o(a / u),
2096
- lng: s(l / u)
2097
- };
1939
+ remove() {
1940
+ this.removeMarker();
2098
1941
  }
2099
- t.unproject = r;
2100
- function n(l) {
2101
- return (180 + l) / 360;
1942
+ createElement() {
1943
+ throw new Error("Create element not implemented");
2102
1944
  }
2103
- function i(l) {
2104
- return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + l * Math.PI / 360))) / 360;
1945
+ createMarker() {
1946
+ const e = this.element;
1947
+ if (!e) throw new Error("Failed to create provider marker");
1948
+ this.providerMarker = this.provider.createMarker(e, this.lat, this.lng, this.getZindex());
2105
1949
  }
2106
- function s(l) {
2107
- return l * 360 - 180;
1950
+ updateMarker(e) {
1951
+ if (this.providerMarker == null) throw new Error("Failed to update provider marker map");
1952
+ e ? this.providerMarker.inserted() == !1 && this.providerMarker.insert() : this.providerMarker.inserted() == !0 && this.providerMarker.remove();
2108
1953
  }
2109
- function o(l) {
2110
- return 360 / Math.PI * Math.atan(Math.exp((180 - l * 360) * Math.PI / 180)) - 90;
1954
+ removeMarker() {
1955
+ this.providerMarker?.remove();
2111
1956
  }
2112
- })(xe || (xe = {}));
2113
- class rn {
2114
- swLat;
2115
- swLng;
2116
- neLat;
2117
- neLng;
2118
- /**
2119
- * @param mapBounds - The bounds of the map.
2120
- * @param mapZoom - The zoom level of the map.
2121
- * @param mapSize - The size of the map in pixels at zoom level 0.
2122
- * @param offsetX - The x offset of the map in pixels at zoom level n.
2123
- * @param offsetY - The y offset of the map in pixels at zoom level n.
2124
- */
2125
- constructor(e, r, n, i, s) {
2126
- const o = n * Math.pow(2, r), l = xe.project(e.sw.lat, e.sw.lng, o), a = xe.project(e.ne.lat, e.ne.lng, o), u = l.x - i, f = l.y + s, p = a.x + i, h = a.y - s, c = xe.unproject(u, f, o), d = xe.unproject(p, h, o);
2127
- this.swLat = c.lat, this.swLng = c.lng, this.neLat = d.lat, this.neLng = d.lng;
1957
+ setZIndex() {
1958
+ if (this.providerMarker == null) throw new Error("Failed to update provider marker z-index");
1959
+ this.providerMarker.update(this.getZindex());
2128
1960
  }
2129
- contains(e, r) {
2130
- return this.swLat <= e && e <= this.neLat ? this.swLng < this.neLng ? this.swLng <= r && r <= this.neLng : r <= this.neLng || this.swLng <= r : !1;
1961
+ getZindex() {
1962
+ throw new Error("Get z-index not implemented");
2131
1963
  }
2132
1964
  }
2133
- var Et;
1965
+ var bt;
2134
1966
  // @__NO_SIDE_EFFECTS__
2135
- function nn(t) {
1967
+ function tn(t) {
2136
1968
  return {
2137
- lang: t?.lang ?? Et?.lang,
1969
+ lang: t?.lang ?? bt?.lang,
2138
1970
  message: t?.message,
2139
- abortEarly: t?.abortEarly ?? Et?.abortEarly,
2140
- abortPipeEarly: t?.abortPipeEarly ?? Et?.abortPipeEarly
1971
+ abortEarly: t?.abortEarly ?? bt?.abortEarly,
1972
+ abortPipeEarly: t?.abortPipeEarly ?? bt?.abortPipeEarly
2141
1973
  };
2142
1974
  }
2143
- var Hi;
1975
+ var qi;
2144
1976
  // @__NO_SIDE_EFFECTS__
2145
- function Yi(t) {
2146
- return Hi?.get(t);
1977
+ function Hi(t) {
1978
+ return qi?.get(t);
2147
1979
  }
2148
- var Vi;
1980
+ var Yi;
2149
1981
  // @__NO_SIDE_EFFECTS__
2150
- function Xi(t) {
2151
- return Vi?.get(t);
1982
+ function Vi(t) {
1983
+ return Yi?.get(t);
2152
1984
  }
2153
- var Wi;
1985
+ var Xi;
2154
1986
  // @__NO_SIDE_EFFECTS__
2155
- function Gi(t, e) {
2156
- return Wi?.get(t)?.get(e);
1987
+ function Wi(t, e) {
1988
+ return Xi?.get(t)?.get(e);
2157
1989
  }
2158
1990
  // @__NO_SIDE_EFFECTS__
2159
1991
  function Ke(t) {
@@ -2174,7 +2006,7 @@ function S(t, e, r, n, i) {
2174
2006
  lang: n.lang,
2175
2007
  abortEarly: n.abortEarly,
2176
2008
  abortPipeEarly: n.abortPipeEarly
2177
- }, u = t.kind === "schema", f = i?.message ?? t.message ?? /* @__PURE__ */ Gi(t.reference, a.lang) ?? (u ? /* @__PURE__ */ Xi(a.lang) : null) ?? n.message ?? /* @__PURE__ */ Yi(a.lang);
2009
+ }, u = t.kind === "schema", f = i?.message ?? t.message ?? /* @__PURE__ */ Wi(t.reference, a.lang) ?? (u ? /* @__PURE__ */ Vi(a.lang) : null) ?? n.message ?? /* @__PURE__ */ Hi(a.lang);
2178
2010
  f !== void 0 && (a.message = typeof f == "function" ? (
2179
2011
  // @ts-expect-error
2180
2012
  f(a)
@@ -2186,7 +2018,7 @@ function N(t) {
2186
2018
  version: 1,
2187
2019
  vendor: "valibot",
2188
2020
  validate(e) {
2189
- return t["~run"]({ value: e }, /* @__PURE__ */ nn());
2021
+ return t["~run"]({ value: e }, /* @__PURE__ */ tn());
2190
2022
  }
2191
2023
  };
2192
2024
  }
@@ -2220,11 +2052,11 @@ function z(t) {
2220
2052
  };
2221
2053
  }
2222
2054
  // @__NO_SIDE_EFFECTS__
2223
- function sn() {
2055
+ function rn() {
2224
2056
  return {
2225
2057
  kind: "transformation",
2226
2058
  type: "await",
2227
- reference: sn,
2059
+ reference: rn,
2228
2060
  async: !0,
2229
2061
  async "~run"(t) {
2230
2062
  return t.value = await t.value, t;
@@ -2232,11 +2064,11 @@ function sn() {
2232
2064
  };
2233
2065
  }
2234
2066
  // @__NO_SIDE_EFFECTS__
2235
- function on(t, e) {
2067
+ function nn(t, e) {
2236
2068
  return {
2237
2069
  kind: "validation",
2238
2070
  type: "check",
2239
- reference: on,
2071
+ reference: nn,
2240
2072
  async: !1,
2241
2073
  expects: null,
2242
2074
  requirement: t,
@@ -2247,11 +2079,11 @@ function on(t, e) {
2247
2079
  };
2248
2080
  }
2249
2081
  // @__NO_SIDE_EFFECTS__
2250
- function an(t, e) {
2082
+ function sn(t, e) {
2251
2083
  return {
2252
2084
  kind: "validation",
2253
2085
  type: "length",
2254
- reference: an,
2086
+ reference: sn,
2255
2087
  async: !1,
2256
2088
  expects: `${t}`,
2257
2089
  requirement: t,
@@ -2264,11 +2096,11 @@ function an(t, e) {
2264
2096
  };
2265
2097
  }
2266
2098
  // @__NO_SIDE_EFFECTS__
2267
- function Te(t, e) {
2099
+ function Le(t, e) {
2268
2100
  return {
2269
2101
  kind: "validation",
2270
2102
  type: "max_value",
2271
- reference: Te,
2103
+ reference: Le,
2272
2104
  async: !1,
2273
2105
  expects: `<=${t instanceof Date ? t.toJSON() : /* @__PURE__ */ Ke(t)}`,
2274
2106
  requirement: t,
@@ -2281,11 +2113,11 @@ function Te(t, e) {
2281
2113
  };
2282
2114
  }
2283
2115
  // @__NO_SIDE_EFFECTS__
2284
- function Vt(t, e) {
2116
+ function Xt(t, e) {
2285
2117
  return {
2286
2118
  kind: "validation",
2287
2119
  type: "min_length",
2288
- reference: Vt,
2120
+ reference: Xt,
2289
2121
  async: !1,
2290
2122
  expects: `>=${t}`,
2291
2123
  requirement: t,
@@ -2337,11 +2169,11 @@ function W(t) {
2337
2169
  };
2338
2170
  }
2339
2171
  // @__NO_SIDE_EFFECTS__
2340
- function ln(t) {
2172
+ function on(t) {
2341
2173
  return {
2342
2174
  kind: "transformation",
2343
2175
  type: "returns",
2344
- reference: ln,
2176
+ reference: on,
2345
2177
  async: !1,
2346
2178
  schema: t,
2347
2179
  "~run"(e, r) {
@@ -2359,7 +2191,7 @@ function ln(t) {
2359
2191
  };
2360
2192
  }
2361
2193
  // @__NO_SIDE_EFFECTS__
2362
- function Ki(t, e, r) {
2194
+ function Gi(t, e, r) {
2363
2195
  return typeof t.fallback == "function" ? (
2364
2196
  // @ts-expect-error
2365
2197
  t.fallback(e, r)
@@ -2369,7 +2201,7 @@ function Ki(t, e, r) {
2369
2201
  );
2370
2202
  }
2371
2203
  // @__NO_SIDE_EFFECTS__
2372
- function un(t, e, r) {
2204
+ function an(t, e, r) {
2373
2205
  return typeof t.default == "function" ? (
2374
2206
  // @ts-expect-error
2375
2207
  t.default(e, r)
@@ -2379,11 +2211,11 @@ function un(t, e, r) {
2379
2211
  );
2380
2212
  }
2381
2213
  // @__NO_SIDE_EFFECTS__
2382
- function fn(t, e) {
2214
+ function ln(t, e) {
2383
2215
  return {
2384
2216
  kind: "schema",
2385
2217
  type: "array",
2386
- reference: fn,
2218
+ reference: ln,
2387
2219
  expects: "Array",
2388
2220
  async: !1,
2389
2221
  item: t,
@@ -2421,11 +2253,11 @@ function fn(t, e) {
2421
2253
  };
2422
2254
  }
2423
2255
  // @__NO_SIDE_EFFECTS__
2424
- function cn(t) {
2256
+ function un(t) {
2425
2257
  return {
2426
2258
  kind: "schema",
2427
2259
  type: "boolean",
2428
- reference: cn,
2260
+ reference: un,
2429
2261
  expects: "boolean",
2430
2262
  async: !1,
2431
2263
  message: t,
@@ -2438,11 +2270,11 @@ function cn(t) {
2438
2270
  };
2439
2271
  }
2440
2272
  // @__NO_SIDE_EFFECTS__
2441
- function hn(t, e) {
2273
+ function fn(t, e) {
2442
2274
  return {
2443
2275
  kind: "schema",
2444
2276
  type: "custom",
2445
- reference: hn,
2277
+ reference: fn,
2446
2278
  expects: "unknown",
2447
2279
  async: !1,
2448
2280
  check: t,
@@ -2473,11 +2305,11 @@ function B(t) {
2473
2305
  };
2474
2306
  }
2475
2307
  // @__NO_SIDE_EFFECTS__
2476
- function E(t) {
2308
+ function k(t) {
2477
2309
  return {
2478
2310
  kind: "schema",
2479
2311
  type: "number",
2480
- reference: E,
2312
+ reference: k,
2481
2313
  expects: "number",
2482
2314
  async: !1,
2483
2315
  message: t,
@@ -2490,11 +2322,11 @@ function E(t) {
2490
2322
  };
2491
2323
  }
2492
2324
  // @__NO_SIDE_EFFECTS__
2493
- function T(t, e) {
2325
+ function L(t, e) {
2494
2326
  return {
2495
2327
  kind: "schema",
2496
2328
  type: "object",
2497
- reference: T,
2329
+ reference: L,
2498
2330
  expects: "Object",
2499
2331
  async: !1,
2500
2332
  entries: t,
@@ -2513,7 +2345,7 @@ function T(t, e) {
2513
2345
  const l = s in i ? (
2514
2346
  // @ts-expect-error
2515
2347
  i[s]
2516
- ) : /* @__PURE__ */ un(o), a = o["~run"]({ value: l }, n);
2348
+ ) : /* @__PURE__ */ an(o), a = o["~run"]({ value: l }, n);
2517
2349
  if (a.issues) {
2518
2350
  const u = {
2519
2351
  type: "object",
@@ -2531,7 +2363,7 @@ function T(t, e) {
2531
2363
  }
2532
2364
  a.typed || (r.typed = !1), r.value[s] = a.value;
2533
2365
  } else if (o.fallback !== void 0)
2534
- r.value[s] = /* @__PURE__ */ Ki(o);
2366
+ r.value[s] = /* @__PURE__ */ Gi(o);
2535
2367
  else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (S(this, "key", r, n, {
2536
2368
  input: void 0,
2537
2369
  expected: `"${s}"`,
@@ -2568,16 +2400,16 @@ function U(t, e) {
2568
2400
  return /* @__PURE__ */ N(this);
2569
2401
  },
2570
2402
  "~run"(r, n) {
2571
- return r.value === void 0 && (this.default !== void 0 && (r.value = /* @__PURE__ */ un(this, r, n)), r.value === void 0) ? (r.typed = !0, r) : this.wrapped["~run"](r, n);
2403
+ return r.value === void 0 && (this.default !== void 0 && (r.value = /* @__PURE__ */ an(this, r, n)), r.value === void 0) ? (r.typed = !0, r) : this.wrapped["~run"](r, n);
2572
2404
  }
2573
2405
  };
2574
2406
  }
2575
2407
  // @__NO_SIDE_EFFECTS__
2576
- function pn(t) {
2408
+ function cn(t) {
2577
2409
  return {
2578
2410
  kind: "schema",
2579
2411
  type: "promise",
2580
- reference: pn,
2412
+ reference: cn,
2581
2413
  expects: "Promise",
2582
2414
  async: !1,
2583
2415
  message: t,
@@ -2649,11 +2481,11 @@ function Z(t, e) {
2649
2481
  };
2650
2482
  }
2651
2483
  // @__NO_SIDE_EFFECTS__
2652
- function Ye(t) {
2484
+ function qe(t) {
2653
2485
  return {
2654
2486
  kind: "schema",
2655
2487
  type: "void",
2656
- reference: Ye,
2488
+ reference: qe,
2657
2489
  expects: "void",
2658
2490
  async: !1,
2659
2491
  message: t,
@@ -2665,8 +2497,8 @@ function Ye(t) {
2665
2497
  }
2666
2498
  };
2667
2499
  }
2668
- function tt(t, e, r) {
2669
- const n = t["~run"]({ value: e }, /* @__PURE__ */ nn(r));
2500
+ function rt(t, e, r) {
2501
+ const n = t["~run"]({ value: e }, /* @__PURE__ */ tn(r));
2670
2502
  if (n.issues)
2671
2503
  throw new ht(n.issues);
2672
2504
  return n.value;
@@ -2693,7 +2525,7 @@ function _(...t) {
2693
2525
  };
2694
2526
  }
2695
2527
  // @__NO_SIDE_EFFECTS__
2696
- function Ji(...t) {
2528
+ function Ki(...t) {
2697
2529
  return {
2698
2530
  ...t[0],
2699
2531
  pipe: t,
@@ -2714,316 +2546,359 @@ function Ji(...t) {
2714
2546
  }
2715
2547
  };
2716
2548
  }
2717
- const Ct = /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(-90), /* @__PURE__ */ Te(90)), Tt = /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(-180), /* @__PURE__ */ Te(180)), Qi = /* @__PURE__ */ T({
2718
- sw: /* @__PURE__ */ T({ lat: Ct, lng: Tt }),
2719
- ne: /* @__PURE__ */ T({ lat: Ct, lng: Tt })
2720
- }), Lt = /* @__PURE__ */ hn((t) => t instanceof HTMLElement, "Must be an HTMLElement"), $i = /* @__PURE__ */ T({
2721
- mapSize: /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(1)),
2722
- zoomMin: /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(0)),
2723
- zoomMax: /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(0)),
2724
- zoomScale: /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(1), /* @__PURE__ */ Te(10))
2725
- }), es = /* @__PURE__ */ T({
2726
- inserted: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ cn())),
2727
- insert: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ Ye())),
2728
- remove: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ Ye())),
2729
- update: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ E()])), /* @__PURE__ */ W(/* @__PURE__ */ Ye()))
2730
- }), ts = /* @__PURE__ */ T({
2731
- getParameters: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W($i)),
2732
- getContainer: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Lt)),
2733
- getZoom: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ E())),
2734
- getBounds: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Qi)),
2735
- panBy: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ E(), /* @__PURE__ */ E()])), /* @__PURE__ */ W(/* @__PURE__ */ Ye())),
2549
+ const Lt = /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-90), /* @__PURE__ */ Le(90)), It = /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-180), /* @__PURE__ */ Le(180)), Ji = /* @__PURE__ */ L({
2550
+ sw: /* @__PURE__ */ L({ lat: Lt, lng: It }),
2551
+ ne: /* @__PURE__ */ L({ lat: Lt, lng: It })
2552
+ }), Dt = /* @__PURE__ */ fn((t) => t instanceof HTMLElement, "Must be an HTMLElement"), Qi = /* @__PURE__ */ L({
2553
+ mapSize: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(1)),
2554
+ zoomMin: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(0)),
2555
+ zoomMax: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(0)),
2556
+ zoomScale: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(1), /* @__PURE__ */ Le(10))
2557
+ }), $i = /* @__PURE__ */ L({
2558
+ inserted: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ un())),
2559
+ insert: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ qe())),
2560
+ remove: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ qe())),
2561
+ update: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ k()])), /* @__PURE__ */ W(/* @__PURE__ */ qe()))
2562
+ }), es = /* @__PURE__ */ L({
2563
+ getParameters: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Qi)),
2564
+ getContainer: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Dt)),
2565
+ getZoom: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ k())),
2566
+ getBounds: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Ji)),
2567
+ panBy: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ k(), /* @__PURE__ */ k()])), /* @__PURE__ */ W(/* @__PURE__ */ qe())),
2736
2568
  createMarker: /* @__PURE__ */ _(
2737
2569
  /* @__PURE__ */ B(),
2738
- /* @__PURE__ */ z(/* @__PURE__ */ Z([Lt, Ct, Tt, /* @__PURE__ */ E()])),
2739
- /* @__PURE__ */ W(es)
2570
+ /* @__PURE__ */ z(/* @__PURE__ */ Z([Dt, Lt, It, /* @__PURE__ */ k()])),
2571
+ /* @__PURE__ */ W($i)
2740
2572
  )
2741
- }), kt = /* @__PURE__ */ _(
2573
+ }), Mt = /* @__PURE__ */ _(
2742
2574
  /* @__PURE__ */ B(),
2743
2575
  /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ te()])),
2744
- /* @__PURE__ */ ln(/* @__PURE__ */ Ji(/* @__PURE__ */ pn(), /* @__PURE__ */ sn(), Lt))
2745
- ), rs = /* @__PURE__ */ T({
2576
+ /* @__PURE__ */ on(/* @__PURE__ */ Ki(/* @__PURE__ */ cn(), /* @__PURE__ */ rn(), Dt))
2577
+ ), ts = /* @__PURE__ */ L({
2746
2578
  background: /* @__PURE__ */ U(/* @__PURE__ */ te()),
2747
2579
  border: /* @__PURE__ */ U(/* @__PURE__ */ te()),
2748
2580
  shadow: /* @__PURE__ */ U(/* @__PURE__ */ te())
2749
- }), ns = /* @__PURE__ */ T({
2750
- width: /* @__PURE__ */ E(),
2751
- height: /* @__PURE__ */ E(),
2752
- radius: /* @__PURE__ */ E()
2753
- }), gr = /* @__PURE__ */ T({
2581
+ }), rs = /* @__PURE__ */ L({
2582
+ width: /* @__PURE__ */ k(),
2583
+ height: /* @__PURE__ */ k(),
2584
+ radius: /* @__PURE__ */ k()
2585
+ }), gr = /* @__PURE__ */ L({
2754
2586
  background: /* @__PURE__ */ U(/* @__PURE__ */ te()),
2755
2587
  shadow: /* @__PURE__ */ U(/* @__PURE__ */ te())
2756
2588
  }), _r = /* @__PURE__ */ _(
2757
- /* @__PURE__ */ T({
2758
- width: /* @__PURE__ */ E(),
2759
- height: /* @__PURE__ */ E(),
2760
- margin: /* @__PURE__ */ E(),
2761
- radius: /* @__PURE__ */ E()
2589
+ /* @__PURE__ */ L({
2590
+ width: /* @__PURE__ */ k(),
2591
+ height: /* @__PURE__ */ k(),
2592
+ margin: /* @__PURE__ */ k(),
2593
+ radius: /* @__PURE__ */ k()
2762
2594
  }),
2763
- /* @__PURE__ */ on(
2595
+ /* @__PURE__ */ nn(
2764
2596
  (t) => Math.min(t.width, t.height) / t.margin >= 6,
2765
- "Tooltip: minimum of width or height must be greater than or equal to 6 * margin"
2597
+ "Minimum of width or height must be greater than or equal to 6 * margin"
2766
2598
  )
2767
- ), is = /* @__PURE__ */ T({
2768
- id: /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ Vt(1)),
2769
- rank: /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(0)),
2770
- lat: /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(-90), /* @__PURE__ */ Te(90)),
2771
- lng: /* @__PURE__ */ _(/* @__PURE__ */ E(), /* @__PURE__ */ $(-180), /* @__PURE__ */ Te(180)),
2772
- tooltip: /* @__PURE__ */ T({
2773
- body: kt,
2599
+ ), ns = /* @__PURE__ */ L({
2600
+ id: /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ Xt(1)),
2601
+ rank: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(0)),
2602
+ lat: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-90), /* @__PURE__ */ Le(90)),
2603
+ lng: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-180), /* @__PURE__ */ Le(180)),
2604
+ tooltip: /* @__PURE__ */ L({
2605
+ body: Mt,
2774
2606
  style: _r,
2775
2607
  colors: /* @__PURE__ */ U(gr)
2776
2608
  }),
2777
2609
  pin: /* @__PURE__ */ U(
2778
- /* @__PURE__ */ T({
2779
- body: kt,
2780
- style: /* @__PURE__ */ U(ns),
2781
- colors: /* @__PURE__ */ U(rs)
2610
+ /* @__PURE__ */ L({
2611
+ body: Mt,
2612
+ style: /* @__PURE__ */ U(rs),
2613
+ colors: /* @__PURE__ */ U(ts)
2782
2614
  })
2783
2615
  ),
2784
2616
  popup: /* @__PURE__ */ U(
2785
- /* @__PURE__ */ T({
2786
- body: kt,
2617
+ /* @__PURE__ */ L({
2618
+ body: Mt,
2787
2619
  style: _r,
2788
2620
  colors: /* @__PURE__ */ U(gr)
2789
2621
  })
2790
2622
  )
2791
- }), ss = /* @__PURE__ */ fn(is);
2792
- var ye;
2793
- ((t) => {
2794
- t.COUNT = 12, t.DEGREES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330], t.DEGREES_DEFAULT = 270;
2795
- })(ye || (ye = {}));
2796
- const os = /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ an(32)), as = /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ Vt(1)), wr = "1.2.0", Xt = "https://maps.api.arenarium.dev", ls = `${Xt}/auth`, us = `${Xt}/states`, fs = `${Xt}/log`;
2797
- class dn {
2798
- apiKey;
2799
- apiToken;
2800
- apiDevEnvironment;
2801
- mapProvider;
2802
- markerDataArray = new Array();
2803
- markerDataMap = /* @__PURE__ */ new Map();
2804
- markerDataUpdating = !1;
2805
- markerPinProcessor;
2806
- markerTooltipProcessor;
2807
- markerPopupProcessor;
2808
- constructor(e, r, n, i) {
2809
- tt(os, e), tt(as, r), tt(ts, n), this.apiKey = e, this.apiToken = r, this.apiDevEnvironment = window?.location.host.startsWith("localhost") || window?.location.host.startsWith("127.0.0.1"), this.mapProvider = n, this.markerPinProcessor = new lt(n), this.markerTooltipProcessor = new hs(n), this.markerPopupProcessor = new ps(n), this.setConfiguration(i);
2623
+ }), is = /* @__PURE__ */ ln(ns);
2624
+ class He extends Je {
2625
+ static DEFAULT_SIZE = 16;
2626
+ style;
2627
+ colors;
2628
+ zoom;
2629
+ bodyLoading = !1;
2630
+ bodyLoaded = !1;
2631
+ bodyCallback;
2632
+ constructor(e, r, n) {
2633
+ super(e, r), this.style = r.pin?.style ?? { width: He.DEFAULT_SIZE, height: He.DEFAULT_SIZE, radius: He.DEFAULT_SIZE }, this.colors = r.pin?.colors, this.zoom = n, this.bodyCallback = r.pin?.body;
2810
2634
  }
2811
- static async create(e, r, n) {
2812
- const i = { key: e, version: wr };
2813
- let o = (await He.post(ls, i)).token;
2814
- if (!o) throw new Error("Failed to get api token");
2815
- return new dn(e, o, r, n);
2635
+ createElement() {
2636
+ this.element = document.createElement("div"), this.element.classList.add("pin"), this.component = Yt(Zi, {
2637
+ target: this.element,
2638
+ props: {
2639
+ id: this.id + "_pin",
2640
+ layer: zi,
2641
+ priority: this.zoom * this.provider.getParameters().zoomScale,
2642
+ style: this.style,
2643
+ colors: this.colors
2644
+ }
2645
+ });
2816
2646
  }
2817
- setConfiguration(e) {
2818
- ae.setLimit(e?.animation?.queue?.limit ?? 8 * navigator.hardwareConcurrency), this.markerPinProcessor.setConfiguration(e);
2647
+ update(e) {
2648
+ this.zoom = e[0], this.setZIndex();
2819
2649
  }
2820
- async updateMarkers(e) {
2821
- tt(ss, e);
2822
- try {
2823
- await this.updateMarkerData(e), this.processMarkerDataCallback();
2824
- } catch (r) {
2825
- throw console.error(r), this.removeMarkerData(), r instanceof Error && this.log("error", "Failed to update markers", r), r;
2826
- }
2650
+ updateMarker(e) {
2651
+ super.updateMarker(e), this.component?.setDisplayed(e);
2827
2652
  }
2828
- removeMarkers() {
2829
- try {
2830
- this.removeMarkerData();
2831
- } catch (e) {
2832
- throw console.error(e), e instanceof Error && this.log("error", "Failed to remove markers", e), e;
2833
- }
2653
+ updateBody() {
2654
+ if (this.bodyCallback == null || this.bodyLoaded || this.bodyLoading) return;
2655
+ const e = this.component?.getBody();
2656
+ e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
2657
+ r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load pin body");
2658
+ }).catch((r) => console.error(r)).finally(() => {
2659
+ this.bodyLoaded = !0, this.bodyLoading = !1;
2660
+ }));
2834
2661
  }
2835
- showPopup(e) {
2836
- try {
2837
- for (const r of this.markerDataArray)
2838
- r.marker.id == e ? this.markerPopupProcessor.show(r) : this.markerPopupProcessor.hide(r);
2839
- } catch (r) {
2840
- console.error(r);
2841
- for (const n of this.markerDataArray)
2842
- this.markerPopupProcessor.hide(n);
2843
- throw r instanceof Error && this.log("error", "Failed to show popup", r), r;
2844
- }
2662
+ setCollapsed(e) {
2663
+ if (this.component == null) throw new Error("Failed to set pin collapsed");
2664
+ this.component.setCollapsed(e);
2845
2665
  }
2846
- hidePopup(e) {
2847
- try {
2848
- if (e) {
2849
- const r = this.markerDataMap.get(e);
2850
- if (r == null) return;
2851
- this.markerPopupProcessor.hide(r);
2852
- } else
2853
- for (const r of this.markerDataArray)
2854
- this.markerPopupProcessor.hide(r);
2855
- } catch (r) {
2856
- console.error(r);
2857
- for (const n of this.markerDataArray)
2858
- this.markerPopupProcessor.hide(n);
2859
- throw r instanceof Error && this.log("error", "Failed to hide popup", r), r;
2860
- }
2666
+ setScale(e) {
2667
+ if (this.component == null) throw new Error("Failed to set pin scale");
2668
+ this.component.setScale(e);
2861
2669
  }
2862
- async updateMarkerData(e) {
2863
- try {
2864
- let r = this.markerDataArray.map((i) => i.marker);
2865
- for (let i = 0; i < e.length; i++) {
2866
- const s = e[i];
2867
- this.markerDataMap.get(s.id) || r.push(s);
2868
- }
2869
- const n = await this.getMarkerStates(r);
2870
- try {
2871
- this.markerDataUpdating = !0;
2872
- for (let i = 0; i < r.length; i++) {
2873
- const s = r[i], o = n[i], l = this.markerDataMap.get(s.id);
2874
- if (l)
2875
- l.update(o);
2876
- else {
2877
- const a = new cs(this.mapProvider, s, o);
2878
- a.create(), this.markerDataMap.set(s.id, a), this.markerDataArray.push(a);
2879
- }
2880
- }
2881
- this.markerDataArray.sort((i, s) => i.zoom - s.zoom), this.markerPinProcessor.updateElements(this.markerDataArray.map((i) => i.pin)), this.markerTooltipProcessor.updateElements(this.markerDataArray.map((i) => i.tooltip)), this.markerPopupProcessor.updateElements(this.markerDataArray.map((i) => i.popup).filter((i) => i != null));
2882
- } finally {
2883
- this.markerDataUpdating = !1;
2884
- }
2885
- } catch (r) {
2886
- throw console.error(r), this.markerDataArray.forEach((n) => n.remove()), this.markerDataArray.length = 0, this.markerDataMap.clear(), r instanceof Error && this.log("error", "Failed to update marker data", r), r;
2887
- } finally {
2888
- this.markerDataUpdating = !1;
2889
- }
2670
+ getScaleFromZoomDistance(e) {
2671
+ return this.zoom < e ? 1 : Math.max(0, 1 - (this.zoom - e) * 0.125);
2890
2672
  }
2891
- removeMarkerData() {
2892
- try {
2893
- this.markerDataUpdating = !0, this.markerPinProcessor.removeElements(), this.markerTooltipProcessor.removeElements(), this.markerPopupProcessor.removeElements(), this.markerDataArray.length = 0, this.markerDataMap.clear();
2894
- } catch (e) {
2895
- throw console.error(e), e instanceof Error && this.log("error", "Failed to remove marker data", e), e;
2896
- } finally {
2897
- this.markerDataUpdating = !1;
2898
- }
2673
+ getZindex() {
2674
+ const e = this.provider.getParameters();
2675
+ return Math.round((e.zoomMax - this.zoom) * e.zoomScale);
2899
2676
  }
2900
- async getMarkerStates(e) {
2901
- if (e.length == 0) return [];
2902
- if (e.length == 1) return [[0, [[0, ye.DEGREES.indexOf(ye.DEGREES_DEFAULT)]]]];
2903
- const r = e.map((s) => ({
2904
- id: s.id,
2905
- rank: s.rank,
2906
- lat: s.lat,
2907
- lng: s.lng,
2908
- width: s.tooltip.style.width,
2909
- height: s.tooltip.style.height,
2910
- margin: s.tooltip.style.margin
2911
- })), n = {
2912
- key: this.apiKey,
2913
- token: this.apiToken,
2914
- parameters: this.mapProvider.getParameters(),
2915
- input: r
2916
- }, i = await He.post(us, n, {
2917
- headers: { "Cache-Control": this.apiDevEnvironment ? "no-cache" : "" }
2918
- });
2919
- return i.token && (this.apiToken = i.token), i.states;
2677
+ isCollapsed() {
2678
+ return this.component == null ? !1 : this.component.getCollapsed();
2920
2679
  }
2921
- processMarkerDataCallback() {
2922
- if (this.mapProvider.getContainer().parentElement != null && this.markerDataArray.length != 0)
2923
- try {
2924
- this.processMarkerData(), window.setTimeout(this.processMarkerDataCallback.bind(this), 25);
2925
- } catch (e) {
2926
- console.error(e), e instanceof Error && this.log("error", "Failed to process marker data", e);
2927
- }
2680
+ isBodyLoaded() {
2681
+ return this.bodyCallback == null || this.bodyLoaded;
2928
2682
  }
2929
- processMarkerData() {
2930
- if (this.markerDataUpdating) return;
2931
- const e = this.mapProvider.getBounds(), r = this.mapProvider.getZoom();
2932
- this.markerPopupProcessor.process(), this.markerTooltipProcessor.process(e, r), this.markerPinProcessor.process(e, r);
2683
+ }
2684
+ var Ye;
2685
+ ((t) => {
2686
+ function e(r, n, i) {
2687
+ const s = r / 2, o = n / 2, l = Math.sqrt(s * s + o * o), a = Math.atan(o / s) * (180 / Math.PI), u = i * (Math.PI / 180);
2688
+ return i < 180 ? i < 90 ? i < a ? {
2689
+ x: 0,
2690
+ y: l * Math.sin(u) - o
2691
+ } : {
2692
+ x: l * Math.cos(u) - s,
2693
+ y: 0
2694
+ } : i < 180 - a ? {
2695
+ x: l * Math.cos(u) - s,
2696
+ y: 0
2697
+ } : {
2698
+ x: -r,
2699
+ y: l * Math.sin(u) - o
2700
+ } : i < 270 ? i < 180 + a ? {
2701
+ x: -r,
2702
+ y: l * Math.sin(u) - o
2703
+ } : {
2704
+ x: l * Math.cos(u) - s,
2705
+ y: -n
2706
+ } : i < 360 - a ? {
2707
+ x: l * Math.cos(u) - s,
2708
+ y: -n
2709
+ } : {
2710
+ x: 0,
2711
+ y: l * Math.sin(u) - o
2712
+ };
2933
2713
  }
2934
- async log(e, r, n) {
2935
- if (!this.apiDevEnvironment)
2936
- try {
2937
- const i = {
2938
- key: this.apiKey,
2939
- title: r,
2940
- level: e,
2941
- content: {
2942
- version: wr,
2943
- ...n
2944
- }
2945
- };
2946
- await He.post(fs, i);
2947
- } catch (i) {
2948
- console.error(i);
2949
- }
2714
+ t.getOffsets = e;
2715
+ })(Ye || (Ye = {}));
2716
+ var ss = /* @__PURE__ */ Gr('<div><div class="pointer svelte-11extwn"></div> <div class="bubble svelte-11extwn"><div class="body svelte-11extwn"></div></div></div>');
2717
+ function pn(t, e) {
2718
+ zt(e, !0);
2719
+ let r = e.style.width, n = e.style.height, i = e.style.margin, s = e.style.radius, o = e.colors?.background ?? "white", l = e.colors?.shadow ?? "0px 2px 2px rgba(0, 0, 0, 0.5)", a, u, f, h;
2720
+ const p = r + 2 * i, c = n + 2 * i, d = () => h;
2721
+ J(() => {
2722
+ f.style.width = `${i * 4}px`, f.style.height = `${i * 4}px`;
2723
+ });
2724
+ let w = /* @__PURE__ */ C(!0);
2725
+ function O(y) {
2726
+ P(w, y, !0);
2950
2727
  }
2951
- }
2952
- class cs {
2953
- marker;
2954
- zoom;
2955
- pin;
2956
- tooltip;
2957
- popup;
2958
- constructor(e, r, n) {
2959
- this.marker = r, this.zoom = n[0], this.pin = new Ve(e, r, n), this.tooltip = new Gt(e, r, n), r.popup && (this.popup = new Kt(e, r));
2728
+ function K() {
2729
+ return g(w);
2960
2730
  }
2961
- create() {
2962
- this.pin.create(), this.tooltip.create(), this.popup?.create();
2731
+ let b = /* @__PURE__ */ C(!0), V = 0, Qe = 300;
2732
+ function dt(y) {
2733
+ y != g(b) && (P(b, y, !0), V = performance.now());
2963
2734
  }
2964
- update(e) {
2965
- this.pin.update(e), this.tooltip.update(e);
2735
+ function vt() {
2736
+ return performance.now() - V < Qe ? M.motion.current == 0 : M.value == 0;
2966
2737
  }
2967
- remove() {
2968
- this.pin.remove(), this.tooltip.remove(), this.popup?.remove();
2738
+ function mt() {
2739
+ return performance.now() - V < Qe ? M.motion.current == 1 : M.value == 1;
2740
+ }
2741
+ let M = new st(0);
2742
+ J(() => {
2743
+ g(w) == !1 && (M.snap(), ae.clear(e.priority, e.id + "_scale"));
2744
+ }), J(() => {
2745
+ g(b) == !0 && M.value != 0 && (ae.stacked() ? M.set(0, { duration: 0 }) : M.set(0, { duration: 150, easing: Oi })), g(b) == !1 && M.value != 1 && M.set(1, { duration: 150, easing: Fi });
2746
+ }), J(() => {
2747
+ $e(M.motion.current);
2748
+ });
2749
+ function $e(y) {
2750
+ !a || !u || !f || ae.equeue(g(b) ? 0 : e.layer, e.priority, e.id + "_scale", () => {
2751
+ a.style.opacity = `${y}`, u.style.scale = `${y}`, f.style.scale = `${y}`;
2752
+ });
2753
+ }
2754
+ let E = NaN, yt = /* @__PURE__ */ C(!1), oe = new st(-p / 2, { easing: Ct }), et = new st(-c / 2, { easing: Ct });
2755
+ J(() => {
2756
+ g(w) == !1 && (oe.snap(), oe.snap(), ae.clear(e.priority, e.id + "_angle"));
2757
+ }), J(() => {
2758
+ g(b) == !0 && g(yt) && (oe.update({ duration: 75 }), oe.update({ duration: 75 }));
2759
+ }), J(() => {
2760
+ Jt(oe.motion.current, et.motion.current);
2761
+ });
2762
+ function Jt(y, _e) {
2763
+ if (!a || !u || !f) return;
2764
+ const X = y + p / 2, we = _e + c / 2, Ee = c < p ? X * c / p : X, ke = c > p ? we * p / c : we, gn = Math.atan2(ke, Ee) / Math.PI * 180 - 45, nr = 0, _n = 30, wt = Math.sqrt(Ee * Ee + ke * ke), Ne = Math.min(p, c) / 2, wn = Ne * Math.SQRT2, En = (wt - Ne) / (wn - Ne), ir = nr + En * (_n - nr), kn = wt < Ne ? wt / Ne : 1;
2765
+ ae.equeue(e.layer, e.priority, e.id + "_angle", () => {
2766
+ u.style.transform = `translate(${Math.round(y)}px, ${Math.round(_e)}px)`, f.style.transform = `scale(${kn}) rotate(${gn}deg) skew(${ir}deg, ${ir}deg)`;
2767
+ });
2768
+ }
2769
+ function vn(y, _e) {
2770
+ if (g(yt) == !1 || _e == !0) {
2771
+ let X = Ye.getOffsets(p, c, y);
2772
+ oe.set(Math.round(X.x), { duration: 0 }), et.set(Math.round(X.y), { duration: 0 }), Jt(oe.value, et.value), E = y, P(yt, !0);
2773
+ } else if (y != E) {
2774
+ let X = Math.abs(y - E), we = X < 180 ? X : 360 - X, Ee = Math.log(we) * 75, ke = Ye.getOffsets(p, c, y);
2775
+ oe.set(Math.round(ke.x), { duration: Ee }), et.set(Math.round(ke.y), { duration: Ee }), E = y;
2776
+ }
2777
+ }
2778
+ function mn() {
2779
+ return Ye.getOffsets(p, c, E);
2969
2780
  }
2781
+ var yn = {
2782
+ getBody: d,
2783
+ setDisplayed: O,
2784
+ getDisplayed: K,
2785
+ setCollapsed: dt,
2786
+ getCollapsed: vt,
2787
+ getExpanded: mt,
2788
+ setAngle: vn,
2789
+ getOffsets: mn
2790
+ }, Re = ss();
2791
+ let Qt;
2792
+ var gt = ur(Re);
2793
+ let $t;
2794
+ Be(
2795
+ gt,
2796
+ (y) => (
2797
+ //#endregion
2798
+ f = y
2799
+ ),
2800
+ () => f
2801
+ );
2802
+ var _t = si(gt, 2);
2803
+ let er;
2804
+ var tr = ur(_t);
2805
+ let rr;
2806
+ return Be(tr, (y) => h = y, () => h), Be(_t, (y) => u = y, () => u), Be(Re, (y) => a = y, () => a), jr(
2807
+ (y, _e, X, we) => {
2808
+ $r(Re, 1, Qr(["anchor", g(w) && "displayed"]), "svelte-11extwn"), Qt = ze(Re, "", Qt, y), $t = ze(gt, "", $t, _e), er = ze(_t, "", er, X), rr = ze(tr, "", rr, we);
2809
+ },
2810
+ [
2811
+ () => ({ filter: `drop-shadow(${l})` }),
2812
+ () => ({ "background-color": o }),
2813
+ () => ({ margin: `${i}px;` }),
2814
+ () => ({
2815
+ width: `${r}px`,
2816
+ height: `${n}px`,
2817
+ "border-radius": `${s}px;`,
2818
+ "background-color": o
2819
+ })
2820
+ ]
2821
+ ), Kr(t, Re), Bt(yn);
2970
2822
  }
2971
- class Wt {
2972
- provider;
2973
- id;
2974
- lat;
2975
- lng;
2976
- shown;
2977
- element;
2978
- component;
2979
- marker;
2823
+ class Wt extends Je {
2824
+ static Z_INDEX_OFFSET = 2e6;
2825
+ style;
2826
+ colors;
2827
+ bodyLoading = !1;
2828
+ bodyLoaded = !1;
2829
+ bodyCallback;
2980
2830
  constructor(e, r) {
2981
- this.provider = e, this.id = r.id, this.lat = r.lat, this.lng = r.lng, this.shown = !0;
2982
- }
2983
- create() {
2984
- this.createElement(), this.createMarker(), this.updateZIndex();
2831
+ if (r.popup == null) throw new Error("Failed to create popup");
2832
+ super(e, r), this.shown = !1, this.style = r.popup.style, this.colors = r.popup.colors, this.bodyCallback = r.popup.body;
2985
2833
  }
2986
2834
  createElement() {
2987
- throw new Error("Create element not implemented");
2988
- }
2989
- createMarker() {
2990
- const e = this.element;
2991
- if (!e) throw new Error("Failed to create provider marker");
2992
- this.marker = this.provider.createMarker(e, this.lat, this.lng, this.getZindex());
2835
+ this.element = document.createElement("div"), this.element.classList.add("popup"), this.component = Yt(pn, {
2836
+ target: this.element,
2837
+ props: {
2838
+ id: this.id + "_popup",
2839
+ layer: Ni,
2840
+ priority: 0,
2841
+ style: this.style,
2842
+ colors: this.colors
2843
+ }
2844
+ });
2993
2845
  }
2994
- updateZIndex() {
2995
- if (this.marker == null) throw new Error("Failed to update provider marker z-index");
2996
- this.marker.update(this.getZindex());
2846
+ updateMarker(e) {
2847
+ super.updateMarker(e), this.component?.setDisplayed(e);
2997
2848
  }
2998
- updateMap(e) {
2999
- const r = this.marker, n = this.component;
3000
- if (r == null || n == null) throw new Error("Failed to update provider marker map");
3001
- e ? r.inserted() == !1 && r.insert() : r.inserted() == !0 && r.remove();
2849
+ updateBody() {
2850
+ if (this.bodyLoaded || this.bodyLoading) return;
2851
+ const e = this.component?.getBody();
2852
+ e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
2853
+ r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load popup body");
2854
+ }).catch((r) => console.error(r)).finally(() => {
2855
+ this.bodyLoaded = !0, this.bodyLoading = !1;
2856
+ }));
3002
2857
  }
3003
2858
  getZindex() {
3004
- throw new Error("Get z-index not implemented");
2859
+ return Wt.Z_INDEX_OFFSET;
3005
2860
  }
3006
- remove() {
3007
- this.marker?.remove();
2861
+ setCollapsed(e) {
2862
+ if (this.component == null) throw new Error("Failed to set popup collapsed");
2863
+ this.component.setCollapsed(e);
2864
+ }
2865
+ setAngle(e) {
2866
+ if (this.component == null) throw new Error("Failed to set popup angle");
2867
+ this.component.setAngle(e, !0);
2868
+ }
2869
+ isExpanded() {
2870
+ return this.component == null ? !1 : this.component.getExpanded();
2871
+ }
2872
+ isCollapsed() {
2873
+ return this.component == null ? !1 : this.component.getCollapsed();
2874
+ }
2875
+ isBodyLoaded() {
2876
+ return this.bodyLoaded;
3008
2877
  }
3009
2878
  }
3010
- class Ve extends Wt {
3011
- static DEFAULT_SIZE = 16;
2879
+ var ye;
2880
+ ((t) => {
2881
+ t.COUNT = 12, t.DEGREES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330], t.DEGREES_DEFAULT = 270;
2882
+ })(ye || (ye = {}));
2883
+ class Gt extends Je {
2884
+ static Z_INDEX_OFFSET = 1e6;
3012
2885
  style;
3013
2886
  colors;
3014
2887
  zoom;
2888
+ angle;
2889
+ states;
3015
2890
  bodyLoading = !1;
3016
2891
  bodyLoaded = !1;
3017
2892
  bodyCallback;
3018
2893
  constructor(e, r, n) {
3019
- super(e, r), this.style = r.pin?.style ?? { width: Ve.DEFAULT_SIZE, height: Ve.DEFAULT_SIZE, radius: Ve.DEFAULT_SIZE }, this.colors = r.pin?.colors, this.zoom = n[0], this.bodyCallback = r.pin?.body;
2894
+ super(e, r), this.style = r.tooltip.style, this.colors = r.tooltip.colors, this.zoom = n[0], this.angle = ye.DEGREES_DEFAULT, this.states = n[1].map((i) => [i[0], ye.DEGREES[i[1]]]), this.bodyCallback = r.tooltip.body;
3020
2895
  }
3021
2896
  createElement() {
3022
- this.element = document.createElement("div"), this.element.classList.add("pin"), this.component = Ht(Zi, {
2897
+ this.element = document.createElement("div"), this.element.classList.add("tooltip"), this.component = Yt(pn, {
3023
2898
  target: this.element,
3024
2899
  props: {
3025
- id: this.id + "_pin",
3026
- layer: zi,
2900
+ id: this.id + "_tooltip",
2901
+ layer: ji,
3027
2902
  priority: this.zoom * this.provider.getParameters().zoomScale,
3028
2903
  style: this.style,
3029
2904
  colors: this.colors
@@ -3031,43 +2906,116 @@ class Ve extends Wt {
3031
2906
  });
3032
2907
  }
3033
2908
  update(e) {
3034
- this.zoom = e[0], this.updateZIndex();
2909
+ this.zoom = e[0], this.states = e[1].map((r) => [r[0], ye.DEGREES[r[1]]]), this.setZIndex();
2910
+ }
2911
+ updateMarker(e) {
2912
+ super.updateMarker(e), this.component?.setDisplayed(e);
3035
2913
  }
3036
- updateMap(e) {
3037
- super.updateMap(e), this.component?.setDisplayed(e);
2914
+ updateState(e) {
2915
+ if (this.component == null) throw new Error("Failed to update tooltip state");
2916
+ this.angle = this.getAngle(e), this.component.setAngle(this.angle);
3038
2917
  }
3039
2918
  updateBody() {
3040
- if (this.bodyCallback == null || this.bodyLoaded || this.bodyLoading) return;
2919
+ if (this.bodyLoaded || this.bodyLoading) return;
3041
2920
  const e = this.component?.getBody();
3042
2921
  e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
3043
- r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load pin body");
2922
+ r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load tooltip body");
3044
2923
  }).catch((r) => console.error(r)).finally(() => {
3045
2924
  this.bodyLoaded = !0, this.bodyLoading = !1;
3046
2925
  }));
3047
2926
  }
3048
- setCollapsed(e) {
3049
- if (this.component == null) throw new Error("Failed to set pin collapsed");
3050
- this.component.setCollapsed(e);
3051
- }
3052
- setScale(e) {
3053
- if (this.component == null) throw new Error("Failed to set pin scale");
3054
- this.component.setScale(e);
3055
- }
3056
- getScaleFromZoomDistance(e) {
3057
- return this.zoom < e ? 1 : Math.max(0, 1 - (this.zoom - e) * 0.125);
2927
+ getAngle(e) {
2928
+ const r = this.states.findLast((n) => n[0] <= e);
2929
+ if (!r) throw new Error("Angle not found");
2930
+ return r[1];
3058
2931
  }
3059
2932
  getZindex() {
3060
2933
  const e = this.provider.getParameters();
3061
- return Math.round((e.zoomMax - this.zoom) * e.zoomScale);
2934
+ return Math.round((e.zoomMax - this.zoom) * e.zoomScale) + Gt.Z_INDEX_OFFSET;
2935
+ }
2936
+ setCollapsed(e) {
2937
+ if (this.component == null) throw new Error("Failed to set tooltip collapsed");
2938
+ this.component.setCollapsed(e);
2939
+ }
2940
+ isExpanded() {
2941
+ return this.component == null ? !1 : this.component.getExpanded();
3062
2942
  }
3063
2943
  isCollapsed() {
3064
2944
  return this.component == null ? !1 : this.component.getCollapsed();
3065
2945
  }
3066
2946
  isBodyLoaded() {
3067
- return this.bodyCallback == null || this.bodyLoaded;
2947
+ return this.bodyLoaded;
2948
+ }
2949
+ }
2950
+ class os {
2951
+ marker;
2952
+ zoom;
2953
+ pin;
2954
+ tooltip;
2955
+ popup;
2956
+ constructor(e, r, n) {
2957
+ this.marker = r, this.zoom = n[0], this.pin = new He(e, r, n[0]), this.tooltip = new Gt(e, r, n), this.popup = r.popup ? new Wt(e, r) : void 0;
2958
+ }
2959
+ create() {
2960
+ this.pin.create(), this.tooltip.create(), this.popup?.create();
2961
+ }
2962
+ update(e) {
2963
+ this.pin.update(e), this.tooltip.update(e);
2964
+ }
2965
+ remove() {
2966
+ this.pin.remove(), this.tooltip.remove(), this.popup?.remove();
2967
+ }
2968
+ }
2969
+ var xe;
2970
+ ((t) => {
2971
+ function e(l, a, u) {
2972
+ return {
2973
+ x: n(a) * u,
2974
+ y: i(l) * u
2975
+ };
2976
+ }
2977
+ t.project = e;
2978
+ function r(l, a, u) {
2979
+ return {
2980
+ lat: o(a / u),
2981
+ lng: s(l / u)
2982
+ };
2983
+ }
2984
+ t.unproject = r;
2985
+ function n(l) {
2986
+ return (180 + l) / 360;
2987
+ }
2988
+ function i(l) {
2989
+ return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + l * Math.PI / 360))) / 360;
2990
+ }
2991
+ function s(l) {
2992
+ return l * 360 - 180;
2993
+ }
2994
+ function o(l) {
2995
+ return 360 / Math.PI * Math.atan(Math.exp((180 - l * 360) * Math.PI / 180)) - 90;
2996
+ }
2997
+ })(xe || (xe = {}));
2998
+ class hn {
2999
+ swLat;
3000
+ swLng;
3001
+ neLat;
3002
+ neLng;
3003
+ /**
3004
+ * @param mapBounds - The bounds of the map.
3005
+ * @param mapZoom - The zoom level of the map.
3006
+ * @param mapSize - The size of the map in pixels at zoom level 0.
3007
+ * @param offsetX - The x offset of the map in pixels at zoom level n.
3008
+ * @param offsetY - The y offset of the map in pixels at zoom level n.
3009
+ */
3010
+ constructor(e, r, n, i, s) {
3011
+ const o = n * Math.pow(2, r), l = xe.project(e.sw.lat, e.sw.lng, o), a = xe.project(e.ne.lat, e.ne.lng, o), u = l.x - i, f = l.y + s, h = a.x + i, p = a.y - s, c = xe.unproject(u, f, o), d = xe.unproject(h, p, o);
3012
+ this.swLat = c.lat, this.swLng = c.lng, this.neLat = d.lat, this.neLng = d.lng;
3013
+ }
3014
+ contains(e, r) {
3015
+ return this.swLat <= e && e <= this.neLat ? this.swLng < this.neLng ? this.swLng <= r && r <= this.neLng : r <= this.neLng || this.swLng <= r : !1;
3068
3016
  }
3069
3017
  }
3070
- class lt {
3018
+ class ut {
3071
3019
  static MAP_PINS_MAX_ZOOM = 2;
3072
3020
  static MAP_PINS_MAX_COUNT = 128;
3073
3021
  provider;
@@ -3083,89 +3031,22 @@ class lt {
3083
3031
  this.provider = e;
3084
3032
  }
3085
3033
  setConfiguration(e) {
3086
- this.pinFade = e?.pin?.fade ?? !0, this.pinMaxCount = e?.pin?.maxCount ?? Math.max(lt.MAP_PINS_MAX_COUNT, 8 * navigator.hardwareConcurrency), this.pinMaxZoomDelta = e?.pin?.maxZoom ?? lt.MAP_PINS_MAX_ZOOM;
3034
+ this.pinFade = e?.pin?.fade ?? !0, this.pinMaxCount = e?.pin?.maxCount ?? Math.max(ut.MAP_PINS_MAX_COUNT, 8 * navigator.hardwareConcurrency), this.pinMaxZoomDelta = e?.pin?.maxZoom ?? ut.MAP_PINS_MAX_ZOOM;
3087
3035
  }
3088
3036
  updateElements(e) {
3089
3037
  this.pinElements = e, this.pinMaxWidth = e.reduce((r, n) => Math.max(r, n.style.width), 0), this.pinMaxHeight = e.reduce((r, n) => Math.max(r, n.style.height), 0);
3090
3038
  }
3091
3039
  removeElements() {
3092
- this.pinElements.forEach((e) => e.remove()), this.pinElements.length = 0;
3040
+ this.pinElements.forEach((e) => e.removeMarker()), this.pinElements.length = 0;
3093
3041
  }
3094
3042
  process(e, r) {
3095
- const n = this.provider.getParameters().mapSize, i = new rn(e, r, n, this.pinMaxWidth * 2, this.pinMaxHeight * 2);
3043
+ const n = this.provider.getParameters().mapSize, i = new hn(e, r, n, this.pinMaxWidth * 2, this.pinMaxHeight * 2);
3096
3044
  let s = 0;
3097
3045
  for (const o of this.pinElements)
3098
- i.contains(o.lat, o.lng) ? o.shown && r < o.zoom && o.zoom < r + this.pinMaxZoomDelta ? (s < this.pinMaxCount && (o.setCollapsed(!1), o.setScale(this.pinFade ? o.getScaleFromZoomDistance(r) : 1), o.updateMap(!0), o.isBodyLoaded() == !1 && o.updateBody()), s++) : (o.setCollapsed(!0), o.isCollapsed() && o.updateMap(!1)) : o.updateMap(!1);
3046
+ i.contains(o.lat, o.lng) ? o.shown && r < o.zoom && o.zoom < r + this.pinMaxZoomDelta ? (s < this.pinMaxCount && (o.setCollapsed(!1), o.setScale(this.pinFade ? o.getScaleFromZoomDistance(r) : 1), o.updateMarker(!0), o.isBodyLoaded() == !1 && o.updateBody()), s++) : (o.setCollapsed(!0), o.isCollapsed() && o.updateMarker(!1)) : o.updateMarker(!1);
3099
3047
  }
3100
3048
  }
3101
- class Gt extends Wt {
3102
- static Z_INDEX_OFFSET = 1e6;
3103
- style;
3104
- colors;
3105
- zoom;
3106
- angle;
3107
- states;
3108
- bodyLoading = !1;
3109
- bodyLoaded = !1;
3110
- bodyCallback;
3111
- constructor(e, r, n) {
3112
- super(e, r), this.style = r.tooltip.style, this.colors = r.tooltip.colors, this.zoom = n[0], this.angle = ye.DEGREES_DEFAULT, this.states = n[1].map((i) => [i[0], ye.DEGREES[i[1]]]), this.bodyCallback = r.tooltip.body;
3113
- }
3114
- createElement() {
3115
- this.element = document.createElement("div"), this.element.classList.add("tooltip"), this.component = Ht(tn, {
3116
- target: this.element,
3117
- props: {
3118
- id: this.id + "_tooltip",
3119
- layer: ji,
3120
- priority: this.zoom * this.provider.getParameters().zoomScale,
3121
- style: this.style,
3122
- colors: this.colors
3123
- }
3124
- });
3125
- }
3126
- update(e) {
3127
- this.zoom = e[0], this.states = e[1].map((r) => [r[0], ye.DEGREES[r[1]]]), this.updateZIndex();
3128
- }
3129
- updateMap(e) {
3130
- super.updateMap(e), this.component?.setDisplayed(e);
3131
- }
3132
- updateState(e) {
3133
- if (this.component == null) throw new Error("Failed to update tooltip state");
3134
- this.angle = this.getAngle(e), this.component.setAngle(this.angle);
3135
- }
3136
- updateBody() {
3137
- if (this.bodyLoaded || this.bodyLoading) return;
3138
- const e = this.component?.getBody();
3139
- e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
3140
- r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load tooltip body");
3141
- }).catch((r) => console.error(r)).finally(() => {
3142
- this.bodyLoaded = !0, this.bodyLoading = !1;
3143
- }));
3144
- }
3145
- getAngle(e) {
3146
- const r = this.states.findLast((n) => n[0] <= e);
3147
- if (!r) throw new Error("Angle not found");
3148
- return r[1];
3149
- }
3150
- getZindex() {
3151
- const e = this.provider.getParameters();
3152
- return Math.round((e.zoomMax - this.zoom) * e.zoomScale) + Gt.Z_INDEX_OFFSET;
3153
- }
3154
- setCollapsed(e) {
3155
- if (this.component == null) throw new Error("Failed to set tooltip collapsed");
3156
- this.component.setCollapsed(e);
3157
- }
3158
- isExpanded() {
3159
- return this.component == null ? !1 : this.component.getExpanded();
3160
- }
3161
- isCollapsed() {
3162
- return this.component == null ? !1 : this.component.getCollapsed();
3163
- }
3164
- isBodyLoaded() {
3165
- return this.bodyLoaded;
3166
- }
3167
- }
3168
- class hs {
3049
+ class as {
3169
3050
  provider;
3170
3051
  // Data
3171
3052
  tooltipElements = new Array();
@@ -3179,71 +3060,15 @@ class hs {
3179
3060
  this.tooltipElements = e, this.tooltipMaxWidth = this.tooltipElements.reduce((r, n) => Math.max(r, n.style.width), 0), this.tooltipMaxHeight = this.tooltipElements.reduce((r, n) => Math.max(r, n.style.height), 0);
3180
3061
  }
3181
3062
  removeElements() {
3182
- this.tooltipElements.forEach((e) => e.remove()), this.tooltipElements.length = 0;
3063
+ this.tooltipElements.forEach((e) => e.removeMarker()), this.tooltipElements.length = 0;
3183
3064
  }
3184
3065
  process(e, r) {
3185
- const n = this.provider.getParameters().mapSize, i = new rn(e, r, n, this.tooltipMaxWidth * 2, this.tooltipMaxHeight * 2);
3066
+ const n = this.provider.getParameters().mapSize, i = new hn(e, r, n, this.tooltipMaxWidth * 2, this.tooltipMaxHeight * 2);
3186
3067
  for (const s of this.tooltipElements)
3187
- i.contains(s.lat, s.lng) ? s.shown && s.zoom <= r ? (s.updateState(r), s.setCollapsed(!1), s.updateMap(!0), s.isCollapsed() == !1 && s.isBodyLoaded() == !1 && s.updateBody()) : (s.setCollapsed(!0), s.isCollapsed() && s.updateMap(!1)) : s.updateMap(!1);
3188
- }
3189
- }
3190
- class Kt extends Wt {
3191
- static Z_INDEX_OFFSET = 2e6;
3192
- style;
3193
- colors;
3194
- bodyLoading = !1;
3195
- bodyLoaded = !1;
3196
- bodyCallback;
3197
- constructor(e, r) {
3198
- if (r.popup == null) throw new Error("Failed to create popup");
3199
- super(e, r), this.shown = !1, this.style = r.popup.style, this.colors = r.popup.colors, this.bodyCallback = r.popup.body;
3200
- }
3201
- createElement() {
3202
- this.element = document.createElement("div"), this.element.classList.add("popup"), this.component = Ht(tn, {
3203
- target: this.element,
3204
- props: {
3205
- id: this.id + "_popup",
3206
- layer: Ni,
3207
- priority: 0,
3208
- style: this.style,
3209
- colors: this.colors
3210
- }
3211
- });
3212
- }
3213
- updateMap(e) {
3214
- super.updateMap(e), this.component?.setDisplayed(e);
3215
- }
3216
- updateBody() {
3217
- if (this.bodyLoaded || this.bodyLoading) return;
3218
- const e = this.component?.getBody();
3219
- e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
3220
- r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load popup body");
3221
- }).catch((r) => console.error(r)).finally(() => {
3222
- this.bodyLoaded = !0, this.bodyLoading = !1;
3223
- }));
3224
- }
3225
- getZindex() {
3226
- return Kt.Z_INDEX_OFFSET;
3227
- }
3228
- setCollapsed(e) {
3229
- if (this.component == null) throw new Error("Failed to set popup collapsed");
3230
- this.component.setCollapsed(e);
3231
- }
3232
- setAngle(e) {
3233
- if (this.component == null) throw new Error("Failed to set popup angle");
3234
- this.component.setAngle(e, !0);
3235
- }
3236
- isExpanded() {
3237
- return this.component == null ? !1 : this.component.getExpanded();
3238
- }
3239
- isCollapsed() {
3240
- return this.component == null ? !1 : this.component.getCollapsed();
3241
- }
3242
- isBodyLoaded() {
3243
- return this.bodyLoaded;
3068
+ i.contains(s.lat, s.lng) ? s.shown && s.zoom <= r ? (s.updateState(r), s.setCollapsed(!1), s.updateMarker(!0), s.isCollapsed() == !1 && s.isBodyLoaded() == !1 && s.updateBody()) : (s.setCollapsed(!0), s.isCollapsed() && s.updateMarker(!1)) : s.updateMarker(!1);
3244
3069
  }
3245
3070
  }
3246
- class ps {
3071
+ class ls {
3247
3072
  provider;
3248
3073
  // Data
3249
3074
  popupElements = new Array();
@@ -3261,28 +3086,238 @@ class ps {
3261
3086
  this.popupElements = e, this.popupPositioned = new Map(e.map((r) => [r.id, !1]));
3262
3087
  }
3263
3088
  removeElements() {
3264
- this.popupElements.forEach((e) => e.remove()), this.popupElements.length = 0, this.popupPositioned.clear();
3089
+ this.popupElements.forEach((e) => e.removeMarker()), this.popupElements.length = 0, this.popupPositioned.clear();
3265
3090
  }
3266
3091
  process() {
3267
3092
  for (const e of this.popupElements)
3268
3093
  if (e.shown) {
3269
- if (e.setCollapsed(!1), e.updateMap(!0), e.isExpanded() && e.isBodyLoaded() == !1 && e.updateBody(), e.isCollapsed() == !1 && this.popupPositioned.get(e.id) == !1) {
3094
+ if (e.setCollapsed(!1), e.updateMarker(!0), e.isExpanded() && e.isBodyLoaded() == !1 && e.updateBody(), e.isCollapsed() == !1 && this.popupPositioned.get(e.id) == !1) {
3270
3095
  const r = e.component?.getBody();
3271
3096
  if (r == null) continue;
3272
3097
  const n = e.component?.getOffsets();
3273
3098
  if (n == null) continue;
3274
3099
  const i = r.getBoundingClientRect();
3275
3100
  if (i.x == 0 && i.y == 0 && i.width == 0 && i.height == 0) continue;
3276
- const s = i.x + i.width / 2, o = i.y + i.height / 2, l = s + n.x, a = o + n.y, u = l + e.style.width, f = a + e.style.height, p = this.provider.getContainer().getBoundingClientRect(), h = l - p.left, c = p.right - u, d = a - p.top, w = p.bottom - f, F = Math.min(e.style.width, e.style.height) / 4, K = h < 0 ? h - F : c < 0 ? -c + F : 0, k = d < 0 ? d - F : w < 0 ? -w + F : 0;
3277
- this.provider.panBy(K, k), this.popupPositioned.set(e.id, !0);
3101
+ const s = i.x + i.width / 2, o = i.y + i.height / 2, l = s + n.x, a = o + n.y, u = l + e.style.width, f = a + e.style.height, h = this.provider.getContainer().getBoundingClientRect(), p = l - h.left, c = h.right - u, d = a - h.top, w = h.bottom - f, O = Math.min(e.style.width, e.style.height) / 4, K = p < 0 ? p - O : c < 0 ? -c + O : 0, b = d < 0 ? d - O : w < 0 ? -w + O : 0;
3102
+ this.provider.panBy(K, b), this.popupPositioned.set(e.id, !0);
3278
3103
  }
3279
3104
  } else
3280
- e.setCollapsed(!0), e.isCollapsed() && e.updateMap(!1);
3105
+ e.setCollapsed(!0), e.isCollapsed() && e.updateMarker(!1);
3106
+ }
3107
+ }
3108
+ class us {
3109
+ markerPinProcessor;
3110
+ markerTooltipProcessor;
3111
+ markerPopupProcessor;
3112
+ constructor(e) {
3113
+ this.markerPinProcessor = new ut(e), this.markerTooltipProcessor = new as(e), this.markerPopupProcessor = new ls(e);
3114
+ }
3115
+ setConfiguration(e) {
3116
+ this.markerPinProcessor.setConfiguration(e);
3117
+ }
3118
+ updateElements(e) {
3119
+ this.markerPinProcessor.updateElements(e.map((r) => r.pin)), this.markerTooltipProcessor.updateElements(e.map((r) => r.tooltip)), this.markerPopupProcessor.updateElements(e.map((r) => r.popup).filter((r) => r != null));
3120
+ }
3121
+ removeElements() {
3122
+ this.markerPinProcessor.removeElements(), this.markerTooltipProcessor.removeElements(), this.markerPopupProcessor.removeElements();
3123
+ }
3124
+ processElements(e, r) {
3125
+ this.markerPinProcessor.process(e, r), this.markerTooltipProcessor.process(e, r), this.markerPopupProcessor.process();
3126
+ }
3127
+ showPopup(e) {
3128
+ this.markerPopupProcessor.show(e);
3129
+ }
3130
+ hidePopup(e) {
3131
+ this.markerPopupProcessor.hide(e);
3132
+ }
3133
+ }
3134
+ var Ve;
3135
+ ((t) => {
3136
+ async function e(n, i) {
3137
+ const s = await fetch(n, i);
3138
+ if (!s.ok) throw new Error(s.statusText);
3139
+ return s.json();
3140
+ }
3141
+ t.get = e;
3142
+ async function r(n, i, s) {
3143
+ const o = await fetch(n, {
3144
+ method: "POST",
3145
+ body: JSON.stringify(i),
3146
+ headers: {
3147
+ "Content-Type": "application/json",
3148
+ ...s?.headers
3149
+ },
3150
+ ...s
3151
+ });
3152
+ if (!o.ok) throw new Error(o.statusText);
3153
+ return o.json();
3154
+ }
3155
+ t.post = r;
3156
+ })(Ve || (Ve = {}));
3157
+ const fs = /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ sn(32)), cs = /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ Xt(1)), wr = "1.2.1", Kt = "https://maps.api.arenarium.dev", ps = `${Kt}/auth`, hs = `${Kt}/states`, ds = `${Kt}/log`;
3158
+ class dn {
3159
+ apiKey;
3160
+ apiToken;
3161
+ apiDevEnvironment;
3162
+ mapProvider;
3163
+ mapMarkerProcessor;
3164
+ mapMarkerElementArray = new Array();
3165
+ mapMarkerElementMap = /* @__PURE__ */ new Map();
3166
+ mapMarkerElementsUpdating = !1;
3167
+ constructor(e, r, n, i) {
3168
+ rt(fs, e), rt(cs, r), rt(es, n), this.apiKey = e, this.apiToken = r, this.apiDevEnvironment = window?.location.host.startsWith("localhost") || window?.location.host.startsWith("127.0.0.1"), this.mapProvider = n, this.mapMarkerProcessor = new us(n), this.setConfiguration(i);
3169
+ }
3170
+ static async create(e, r, n) {
3171
+ const i = { key: e, version: wr };
3172
+ let o = (await Ve.post(ps, i)).token;
3173
+ if (!o) throw new Error("Failed to get api token");
3174
+ return new dn(e, o, r, n);
3175
+ }
3176
+ setConfiguration(e) {
3177
+ ae.setLimit(e?.animation?.queue?.limit ?? 8 * navigator.hardwareConcurrency), this.mapMarkerProcessor.setConfiguration(e);
3178
+ }
3179
+ async updateMarkers(e) {
3180
+ rt(is, e);
3181
+ try {
3182
+ await this.updateMarkerElements(e), this.processMarkerElementsCallback();
3183
+ } catch (r) {
3184
+ throw this.removeMarkerElements(), this.log("error", "Failed to update markers", r), r;
3185
+ }
3186
+ }
3187
+ removeMarkers() {
3188
+ try {
3189
+ this.removeMarkerElements();
3190
+ } catch (e) {
3191
+ throw this.log("error", "Failed to remove markers", e), e;
3192
+ }
3193
+ }
3194
+ showPopup(e) {
3195
+ try {
3196
+ for (const r of this.mapMarkerElementArray)
3197
+ r.marker.id == e ? this.mapMarkerProcessor.showPopup(r) : this.mapMarkerProcessor.hidePopup(r);
3198
+ } catch (r) {
3199
+ for (const n of this.mapMarkerElementArray)
3200
+ this.mapMarkerProcessor.hidePopup(n);
3201
+ throw this.log("error", "Failed to show popup", r), r;
3202
+ }
3203
+ }
3204
+ hidePopup(e) {
3205
+ try {
3206
+ if (e) {
3207
+ const r = this.mapMarkerElementMap.get(e);
3208
+ if (r == null) return;
3209
+ this.mapMarkerProcessor.hidePopup(r);
3210
+ } else
3211
+ for (const r of this.mapMarkerElementArray)
3212
+ this.mapMarkerProcessor.hidePopup(r);
3213
+ } catch (r) {
3214
+ for (const n of this.mapMarkerElementArray)
3215
+ this.mapMarkerProcessor.hidePopup(n);
3216
+ throw this.log("error", "Failed to hide popup", r), r;
3217
+ }
3218
+ }
3219
+ async updateMarkerElements(e) {
3220
+ try {
3221
+ let r = this.mapMarkerElementArray.map((i) => i.marker);
3222
+ for (let i = 0; i < e.length; i++) {
3223
+ const s = e[i];
3224
+ this.mapMarkerElementMap.get(s.id) || r.push(s);
3225
+ }
3226
+ const n = await this.getMarkerStates(r);
3227
+ try {
3228
+ this.mapMarkerElementsUpdating = !0;
3229
+ for (let i = 0; i < r.length; i++) {
3230
+ const s = r[i], o = n[i], l = this.mapMarkerElementMap.get(s.id);
3231
+ if (l)
3232
+ l.update(o);
3233
+ else {
3234
+ const a = new os(this.mapProvider, s, o);
3235
+ a.create(), this.mapMarkerElementMap.set(s.id, a), this.mapMarkerElementArray.push(a);
3236
+ }
3237
+ }
3238
+ this.mapMarkerElementArray.sort((i, s) => i.zoom - s.zoom), this.mapMarkerProcessor.updateElements(this.mapMarkerElementArray);
3239
+ } finally {
3240
+ this.mapMarkerElementsUpdating = !1;
3241
+ }
3242
+ } catch (r) {
3243
+ throw this.mapMarkerProcessor.removeElements(), this.mapMarkerElementArray.length = 0, this.mapMarkerElementMap.clear(), r;
3244
+ } finally {
3245
+ this.mapMarkerElementsUpdating = !1;
3246
+ }
3247
+ }
3248
+ removeMarkerElements() {
3249
+ try {
3250
+ this.mapMarkerElementsUpdating = !0, this.mapMarkerProcessor.removeElements(), this.mapMarkerElementArray.length = 0, this.mapMarkerElementMap.clear();
3251
+ } finally {
3252
+ this.mapMarkerElementsUpdating = !1;
3253
+ }
3254
+ }
3255
+ async getMarkerStates(e) {
3256
+ if (e.length == 0) return [];
3257
+ if (e.length == 1) return [[0, [[0, ye.DEGREES.indexOf(ye.DEGREES_DEFAULT)]]]];
3258
+ const r = e.map((s) => ({
3259
+ id: s.id,
3260
+ rank: s.rank,
3261
+ lat: s.lat,
3262
+ lng: s.lng,
3263
+ width: s.tooltip.style.width,
3264
+ height: s.tooltip.style.height,
3265
+ margin: s.tooltip.style.margin
3266
+ })), n = {
3267
+ key: this.apiKey,
3268
+ token: this.apiToken,
3269
+ parameters: this.mapProvider.getParameters(),
3270
+ input: r
3271
+ }, i = await Ve.post(hs, n, {
3272
+ headers: { "Cache-Control": this.apiDevEnvironment ? "no-cache" : "" }
3273
+ });
3274
+ return i.token && (this.apiToken = i.token), i.states;
3275
+ }
3276
+ processMarkerElementsCallback() {
3277
+ if (this.mapProvider.getContainer().parentElement != null && this.mapMarkerElementArray.length != 0)
3278
+ try {
3279
+ this.processMarkerElements(), window.setTimeout(this.processMarkerElementsCallback.bind(this), 25);
3280
+ } catch (e) {
3281
+ this.log("error", "Failed to process marker elements", e);
3282
+ }
3283
+ }
3284
+ processMarkerElements() {
3285
+ if (this.mapMarkerElementsUpdating) return;
3286
+ const e = this.mapProvider.getBounds(), r = this.mapProvider.getZoom();
3287
+ this.mapMarkerProcessor.processElements(e, r);
3288
+ }
3289
+ async log(e, r, n) {
3290
+ switch (e) {
3291
+ case "info":
3292
+ console.info(n);
3293
+ break;
3294
+ case "warn":
3295
+ console.warn(n);
3296
+ break;
3297
+ case "error":
3298
+ console.error(n);
3299
+ break;
3300
+ }
3301
+ if (n instanceof Error && !this.apiDevEnvironment)
3302
+ try {
3303
+ const i = {
3304
+ key: this.apiKey,
3305
+ title: r,
3306
+ level: e,
3307
+ content: {
3308
+ version: wr,
3309
+ ...n
3310
+ }
3311
+ };
3312
+ await Ve.post(ds, i);
3313
+ } catch (i) {
3314
+ console.error(i);
3315
+ }
3281
3316
  }
3282
3317
  }
3283
- const ds = () => '<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />', ys = () => `<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${ds()}<span>&nbsp;@arenarium/maps</span></a>`;
3318
+ const vs = () => '<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />', gs = () => `<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${vs()}<span>&nbsp;@arenarium/maps</span></a>`;
3284
3319
  export {
3285
3320
  dn as MapManager,
3286
- ys as getAttributionHtml,
3287
- ds as getImageHtml
3321
+ gs as getAttributionHtml,
3322
+ vs as getImageHtml
3288
3323
  };