@arenarium/maps 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +66 -67
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,5 +1,6 @@
1
1
  class qt {
2
2
  invoked = !1;
3
+ running = !1;
3
4
  interval;
4
5
  timeout;
5
6
  callback;
@@ -11,10 +12,10 @@ class qt {
11
12
  this.invoked = !1, await this.callback() || !this.invoked ? this.stop() : this.timeout = window.setTimeout(this.process.bind(this), this.interval);
12
13
  }
13
14
  run() {
14
- this.invoked = !0, this.timeout || this.process();
15
+ this.invoked = !0, this.running || (this.running = !0, this.timeout = window.setTimeout(this.process.bind(this), 0));
15
16
  }
16
17
  stop() {
17
- this.invoked = !1, this.timeout && window.clearTimeout(this.timeout), this.timeout = void 0;
18
+ this.invoked = !1, this.running = !1, this.timeout && window.clearTimeout(this.timeout), this.timeout = void 0;
18
19
  }
19
20
  }
20
21
  class xi {
@@ -214,7 +215,7 @@ class ut {
214
215
  return this.blockL.intersects(e) || this.blockR.intersects(e);
215
216
  }
216
217
  }
217
- const Di = 75, zi = 150, Ln = 25e-5, Oi = 1e6, Li = 2e6, Fn = 3e6, pr = 10, $n = 16, Fi = 8, Vn = 2, je = 0.5, $i = "0px 2px 2px rgba(0, 0, 0, 0.5)", jn = 8, Vi = 8, ji = "drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.5))", Un = "white", Ui = "darkgreen", Wn = 1024;
218
+ const Di = 75, zi = 150, Ln = 25e-5, Oi = 1e6, Li = 2e6, Fn = 3e6, pr = 10, $n = 16, Fi = 8, Vn = 2, Ue = 0.5, $i = "0px 2px 2px rgba(0, 0, 0, 0.5)", Un = 8, Vi = 8, Ui = "drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.5))", jn = "white", ji = "darkgreen", Wn = 1024;
218
219
  class Wi {
219
220
  // State
220
221
  markers;
@@ -324,19 +325,19 @@ function ln(t) {
324
325
  function wr() {
325
326
  return !0;
326
327
  }
327
- let Ue = [];
328
+ let je = [];
328
329
  function fs() {
329
- var t = Ue;
330
- Ue = [], Ki(t);
330
+ var t = je;
331
+ je = [], Ki(t);
331
332
  }
332
333
  function Re(t) {
333
- if (Ue.length === 0) {
334
- var e = Ue;
334
+ if (je.length === 0) {
335
+ var e = je;
335
336
  queueMicrotask(() => {
336
- e === Ue && fs();
337
+ e === je && fs();
337
338
  });
338
339
  }
339
- Ue.push(t);
340
+ je.push(t);
340
341
  }
341
342
  function kr(t) {
342
343
  var e = y;
@@ -861,7 +862,7 @@ class ws {
861
862
  this.#o(this.#r);
862
863
  }), this.#l > 0) {
863
864
  var e = this.#a = document.createDocumentFragment();
864
- js(this.#s, e);
865
+ Us(this.#s, e);
865
866
  const n = (
866
867
  /** @type {(anchor: Node) => void} */
867
868
  this.#i.pending
@@ -1163,7 +1164,7 @@ function fn(t) {
1163
1164
  var e, n = y;
1164
1165
  he(xs(t));
1165
1166
  try {
1166
- t.f &= ~Le, Es(t), e = Ur(t);
1167
+ t.f &= ~Le, Es(t), e = jr(t);
1167
1168
  } finally {
1168
1169
  he(n);
1169
1170
  }
@@ -1203,9 +1204,9 @@ function Dt(t, e) {
1203
1204
  return n;
1204
1205
  }
1205
1206
  // @__NO_SIDE_EFFECTS__
1206
- function j(t, e) {
1207
+ function U(t, e) {
1207
1208
  const n = Dt(t);
1208
- return Us(n), n;
1209
+ return js(n), n;
1209
1210
  }
1210
1211
  function W(t, e, n = !1) {
1211
1212
  k !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
@@ -1265,7 +1266,7 @@ function rt(t) {
1265
1266
  const e = Ji(t);
1266
1267
  if (e !== Zi && e !== Xi)
1267
1268
  return t;
1268
- var n = /* @__PURE__ */ new Map(), r = Bi(t), i = /* @__PURE__ */ j(0), s = De, a = (u) => {
1269
+ var n = /* @__PURE__ */ new Map(), r = Bi(t), i = /* @__PURE__ */ U(0), s = De, a = (u) => {
1269
1270
  if (De === s)
1270
1271
  return u();
1271
1272
  var o = k, l = De;
@@ -1273,7 +1274,7 @@ function rt(t) {
1273
1274
  var c = u();
1274
1275
  return ne(o), Jn(l), c;
1275
1276
  };
1276
- return r && n.set("length", /* @__PURE__ */ j(
1277
+ return r && n.set("length", /* @__PURE__ */ U(
1277
1278
  /** @type {any[]} */
1278
1279
  t.length
1279
1280
  )), new Proxy(
@@ -1284,7 +1285,7 @@ function rt(t) {
1284
1285
  (!("value" in l) || l.configurable === !1 || l.enumerable === !1 || l.writable === !1) && ns();
1285
1286
  var c = n.get(o);
1286
1287
  return c === void 0 ? a(() => {
1287
- var f = /* @__PURE__ */ j(l.value);
1288
+ var f = /* @__PURE__ */ U(l.value);
1288
1289
  return n.set(o, f), f;
1289
1290
  }) : W(c, l.value, !0), !0;
1290
1291
  },
@@ -1292,7 +1293,7 @@ function rt(t) {
1292
1293
  var l = n.get(o);
1293
1294
  if (l === void 0) {
1294
1295
  if (o in u) {
1295
- const c = a(() => /* @__PURE__ */ j(R));
1296
+ const c = a(() => /* @__PURE__ */ U(R));
1296
1297
  n.set(o, c), lt(i);
1297
1298
  }
1298
1299
  } else
@@ -1304,7 +1305,7 @@ function rt(t) {
1304
1305
  return t;
1305
1306
  var c = n.get(o), f = o in u;
1306
1307
  if (c === void 0 && (!f || ot(u, o)?.writable) && (c = a(() => {
1307
- var m = rt(f ? u[o] : R), p = /* @__PURE__ */ j(m);
1308
+ var m = rt(f ? u[o] : R), p = /* @__PURE__ */ U(m);
1308
1309
  return p;
1309
1310
  }), n.set(o, c)), c !== void 0) {
1310
1311
  var h = E(c);
@@ -1335,7 +1336,7 @@ function rt(t) {
1335
1336
  var l = n.get(o), c = l !== void 0 && l.v !== R || Reflect.has(u, o);
1336
1337
  if (l !== void 0 || y !== null && (!c || ot(u, o)?.writable)) {
1337
1338
  l === void 0 && (l = a(() => {
1338
- var h = c ? rt(u[o]) : R, m = /* @__PURE__ */ j(h);
1339
+ var h = c ? rt(u[o]) : R, m = /* @__PURE__ */ U(h);
1339
1340
  return m;
1340
1341
  }), n.set(o, l));
1341
1342
  var f = E(l);
@@ -1350,10 +1351,10 @@ function rt(t) {
1350
1351
  for (var m = l; m < /** @type {Source<number>} */
1351
1352
  f.v; m += 1) {
1352
1353
  var p = n.get(m + "");
1353
- p !== void 0 ? W(p, R) : m in u && (p = a(() => /* @__PURE__ */ j(R)), n.set(m + "", p));
1354
+ p !== void 0 ? W(p, R) : m in u && (p = a(() => /* @__PURE__ */ U(R)), n.set(m + "", p));
1354
1355
  }
1355
1356
  if (f === void 0)
1356
- (!h || ot(u, o)?.writable) && (f = a(() => /* @__PURE__ */ j(void 0)), W(f, rt(l)), n.set(o, f));
1357
+ (!h || ot(u, o)?.writable) && (f = a(() => /* @__PURE__ */ U(void 0)), W(f, rt(l)), n.set(o, f));
1357
1358
  else {
1358
1359
  h = f.v !== R;
1359
1360
  var v = a(() => rt(l));
@@ -1608,7 +1609,7 @@ function Fr(t, e, n) {
1608
1609
  }
1609
1610
  }
1610
1611
  }
1611
- function js(t, e) {
1612
+ function Us(t, e) {
1612
1613
  if (t.nodes)
1613
1614
  for (var n = t.nodes.start, r = t.nodes.end; n !== null; ) {
1614
1615
  var i = n === r ? null : /* @__PURE__ */ zt(n);
@@ -1628,10 +1629,10 @@ function he(t) {
1628
1629
  y = t;
1629
1630
  }
1630
1631
  let te = null;
1631
- function Us(t) {
1632
+ function js(t) {
1632
1633
  k !== null && (te === null ? te = [t] : te.push(t));
1633
1634
  }
1634
- let U = null, Z = 0, G = null;
1635
+ let j = null, Z = 0, G = null;
1635
1636
  function Ws(t) {
1636
1637
  G = t;
1637
1638
  }
@@ -1667,12 +1668,12 @@ function dt(t) {
1667
1668
  }
1668
1669
  return !1;
1669
1670
  }
1670
- function jr(t, e, n = !0) {
1671
+ function Ur(t, e, n = !0) {
1671
1672
  var r = t.reactions;
1672
1673
  if (r !== null && !(te !== null && Ze.call(te, t)))
1673
1674
  for (var i = 0; i < r.length; i++) {
1674
1675
  var s = r[i];
1675
- (s.f & z) !== 0 ? jr(
1676
+ (s.f & z) !== 0 ? Ur(
1676
1677
  /** @type {Derived} */
1677
1678
  s,
1678
1679
  e,
@@ -1683,9 +1684,9 @@ function jr(t, e, n = !0) {
1683
1684
  ));
1684
1685
  }
1685
1686
  }
1686
- function Ur(t) {
1687
- var e = U, n = Z, r = G, i = k, s = te, a = le, u = ae, o = De, l = t.f;
1688
- U = /** @type {null | Value[]} */
1687
+ function jr(t) {
1688
+ var e = j, n = Z, r = G, i = k, s = te, a = le, u = ae, o = De, l = t.f;
1689
+ j = /** @type {null | Value[]} */
1689
1690
  null, Z = 0, G = null, k = (l & (Te | Fe)) === 0 ? t : null, te = null, Je(t.ctx), ae = !1, De = ++Ce, t.ac !== null && (Rr(() => {
1690
1691
  t.ac.abort(Ne);
1691
1692
  }), t.ac = null);
@@ -1697,13 +1698,13 @@ function Ur(t) {
1697
1698
  ), f = c();
1698
1699
  t.f |= Xe;
1699
1700
  var h = t.deps, m = x?.is_fork;
1700
- if (U !== null) {
1701
+ if (j !== null) {
1701
1702
  var p;
1702
1703
  if (m || ct(t, Z), h !== null && Z > 0)
1703
- for (h.length = Z + U.length, p = 0; p < U.length; p++)
1704
- h[Z + p] = U[p];
1704
+ for (h.length = Z + j.length, p = 0; p < j.length; p++)
1705
+ h[Z + p] = j[p];
1705
1706
  else
1706
- t.deps = h = U;
1707
+ t.deps = h = j;
1707
1708
  if (hn() && (t.f & ee) !== 0)
1708
1709
  for (p = Z; p < h.length; p++)
1709
1710
  (h[p].reactions ??= []).push(t);
@@ -1711,7 +1712,7 @@ function Ur(t) {
1711
1712
  if (wr() && G !== null && !ae && h !== null && (t.f & (z | oe | F)) === 0)
1712
1713
  for (p = 0; p < /** @type {Source[]} */
1713
1714
  G.length; p++)
1714
- jr(
1715
+ Ur(
1715
1716
  G[p],
1716
1717
  /** @type {Effect} */
1717
1718
  t
@@ -1730,7 +1731,7 @@ function Ur(t) {
1730
1731
  } catch (v) {
1731
1732
  return kr(v);
1732
1733
  } finally {
1733
- t.f ^= en, U = e, Z = n, G = r, k = i, te = s, Je(a), ae = u, De = o;
1734
+ t.f ^= en, j = e, Z = n, G = r, k = i, te = s, Je(a), ae = u, De = o;
1734
1735
  }
1735
1736
  }
1736
1737
  function Bs(t, e) {
@@ -1745,7 +1746,7 @@ function Bs(t, e) {
1745
1746
  if (n === null && (e.f & z) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1746
1747
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1747
1748
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1748
- (U === null || !Ze.call(U, e))) {
1749
+ (j === null || !Ze.call(j, e))) {
1749
1750
  var s = (
1750
1751
  /** @type {Derived} */
1751
1752
  e
@@ -1767,7 +1768,7 @@ function Ke(t) {
1767
1768
  y = t, Tt = !0;
1768
1769
  try {
1769
1770
  (e & (we | mr)) !== 0 ? $s(t) : pn(t), Or(t);
1770
- var i = Ur(t);
1771
+ var i = jr(t);
1771
1772
  t.teardown = typeof i == "function" ? i : null, t.wv = $r;
1772
1773
  var s;
1773
1774
  Kt && cs && (t.f & F) !== 0 && t.deps;
@@ -1783,7 +1784,7 @@ function E(t) {
1783
1784
  if (!r && (te === null || !Ze.call(te, t))) {
1784
1785
  var i = k.deps;
1785
1786
  if ((k.f & en) !== 0)
1786
- t.rv < Ce && (t.rv = Ce, U === null && i !== null && i[Z] === t ? Z++ : U === null ? U = [t] : U.push(t));
1787
+ t.rv < Ce && (t.rv = Ce, j === null && i !== null && i[Z] === t ? Z++ : j === null ? j = [t] : j.push(t));
1787
1788
  else {
1788
1789
  (k.deps ??= []).push(t);
1789
1790
  var s = t.reactions;
@@ -2185,26 +2186,26 @@ function ia(t, e) {
2185
2186
  function o() {
2186
2187
  return u;
2187
2188
  }
2188
- let l, c = s.width, f = s.height, h = s.padding, m = i?.background ?? Ui, p = i?.radius ?? Fi, v = i?.shadow ?? $i, b = /* @__PURE__ */ j(!1), C = !1;
2189
+ let l, c = s.width, f = s.height, h = s.padding, m = i?.background ?? ji, p = i?.radius ?? Fi, v = i?.shadow ?? $i, b = /* @__PURE__ */ U(!1), C = !1;
2189
2190
  function $(_) {
2190
2191
  _ == !0 && (l && r && r.parentElement != l && l.appendChild(r), C == !1 && a && r && (C = !0, setTimeout(async () => await a(n, r), 0))), _ != E(b) && (W(b, _, !0), _ == !1 && Y.end());
2191
2192
  }
2192
2193
  function re() {
2193
2194
  return E(b);
2194
2195
  }
2195
- let ye = /* @__PURE__ */ j(!0);
2196
+ let ye = /* @__PURE__ */ U(!0);
2196
2197
  function be(_) {
2197
- _ != E(ye) && (W(ye, _, !0), _ && (ie = je, Y.set(je)));
2198
+ _ != E(ye) && (W(ye, _, !0), _ && (ie = Ue, Y.set(Ue)));
2198
2199
  }
2199
- let pe = /* @__PURE__ */ j(!0);
2200
+ let pe = /* @__PURE__ */ U(!0);
2200
2201
  function Ie(_) {
2201
2202
  _ != E(pe) && (W(pe, _, !0), Y.target(E(pe) ? 0 : ie));
2202
2203
  }
2203
2204
  function J() {
2204
2205
  return E(b) ? Y.expired() : !0;
2205
2206
  }
2206
- let ie = je, Y = new Gr({
2207
- value: je,
2207
+ let ie = Ue, Y = new Gr({
2208
+ value: Ue,
2208
2209
  min: 0,
2209
2210
  max: 1,
2210
2211
  timespan: Di,
@@ -2243,8 +2244,8 @@ function ia(t, e) {
2243
2244
  "border-radius": `${p}px`,
2244
2245
  "background-color": `rgb(from ${m} r g b / 1)`,
2245
2246
  "box-shadow": v,
2246
- scale: je,
2247
- filter: `brightness(${de(je)})`
2247
+ scale: Ue,
2248
+ filter: `brightness(${de(Ue)})`
2248
2249
  })
2249
2250
  ]
2250
2251
  ), qr(t, $e), ln(Lt);
@@ -2337,14 +2338,14 @@ function Kr(t, e) {
2337
2338
  function o() {
2338
2339
  return u;
2339
2340
  }
2340
- let l = s.width + 2 * s.padding, c = s.height + 2 * s.padding, f = s.padding, h, m = i?.filter ?? ji, p, v = s.padding * 2, b = Math.max(2, (i?.radius ?? jn) / v), C = i?.background ?? Un, $, re = s.width, ye = s.height, be = i?.radius ?? jn, pe = Math.min(1, 2 * be / Math.min(ye, re)), Ie = i?.background ?? Un, J, ie = s.width, Y = s.height, Ot = i?.radius, vt = !1, de = /* @__PURE__ */ j(!1);
2341
+ let l = s.width + 2 * s.padding, c = s.height + 2 * s.padding, f = s.padding, h, m = i?.filter ?? Ui, p, v = s.padding * 2, b = Math.max(2, (i?.radius ?? Un) / v), C = i?.background ?? jn, $, re = s.width, ye = s.height, be = i?.radius ?? Un, pe = Math.min(1, 2 * be / Math.min(ye, re)), Ie = i?.background ?? jn, J, ie = s.width, Y = s.height, Ot = i?.radius, vt = !1, de = /* @__PURE__ */ U(!1);
2341
2342
  function Lt(g) {
2342
2343
  g != E(de) && (W(de, g, !0), g == !0 && (r && r.parentElement != J && J.appendChild(r), vt == !1 && a && r && (vt = !0, setTimeout(async () => await a(n, r), 0))), g == !1 && (gt.end(), $t.end(), Vt.end()));
2343
2344
  }
2344
2345
  function $e() {
2345
2346
  return E(de);
2346
2347
  }
2347
- let Ve = /* @__PURE__ */ j(!0);
2348
+ let Ve = /* @__PURE__ */ U(!0);
2348
2349
  function _(g) {
2349
2350
  g != E(Ve) && (W(Ve, g, !0), gt.target(E(Ve) ? 0 : 1));
2350
2351
  }
@@ -2365,7 +2366,7 @@ function Kr(t, e) {
2365
2366
  function mi(g) {
2366
2367
  h.style.opacity = `${g}`, p.style.scale = `${g}`, $.style.scale = `${g}`, J.style.scale = `${g}`;
2367
2368
  }
2368
- let wt = NaN, Ft = /* @__PURE__ */ j(!1), kn = -l / 2, $t = new rr({
2369
+ let wt = NaN, Ft = /* @__PURE__ */ U(!1), kn = -l / 2, $t = new rr({
2369
2370
  value: -l / 2,
2370
2371
  min: -l,
2371
2372
  max: 0,
@@ -2405,21 +2406,21 @@ function Kr(t, e) {
2405
2406
  yn = g, bn();
2406
2407
  }
2407
2408
  function bn() {
2408
- const g = kn, kt = yn, me = g + l / 2, Ut = kt + c / 2, Wt = c < l ? me * c / l : me, Bt = c > l ? Ut * l / c : Ut, yi = Math.atan2(Bt, Wt) / Math.PI * 180 - 45, Ht = Math.sqrt(Wt * Wt + Bt * Bt), nt = Math.min(l, c) / 2, bi = nt * Math.SQRT2, In = (Ht - nt) / (bi - nt), An = 15, Nn = An + In * (22.5 - An), _i = Ht < nt ? Ht / nt : 1, Mi = g + f, Ei = kt + f, Cn = f * 2 * pe * In, Rn = Mi - Cn * (me / l), Dn = Ei - Cn * (Ut / c);
2409
+ const g = kn, kt = yn, me = g + l / 2, jt = kt + c / 2, Wt = c < l ? me * c / l : me, Bt = c > l ? jt * l / c : jt, yi = Math.atan2(Bt, Wt) / Math.PI * 180 - 45, Ht = Math.sqrt(Wt * Wt + Bt * Bt), nt = Math.min(l, c) / 2, bi = nt * Math.SQRT2, In = (Ht - nt) / (bi - nt), An = 15, Nn = An + In * (22.5 - An), _i = Ht < nt ? Ht / nt : 1, Mi = g + f, Ei = kt + f, Cn = f * 2 * pe * In, Rn = Mi - Cn * (me / l), Dn = Ei - Cn * (jt / c);
2409
2410
  p.style.transform = `scale(${_i}) rotate(${yi}deg) skew(${Nn}deg, ${Nn}deg)`, $.style.transform = `translate(${Math.round(Rn)}px, ${Math.round(Dn)}px)`, J.style.transform = `translate(${Math.round(Rn)}px, ${Math.round(Dn)}px)`;
2410
2411
  }
2411
2412
  var ki = { invoke: o }, _n = aa(), tt = As(_n);
2412
2413
  let Mn;
2413
- var jt = Is(tt);
2414
+ var Ut = Is(tt);
2414
2415
  let En;
2415
- st(jt, (g) => p = g, () => p);
2416
- var xn = Zn(jt, 2);
2416
+ st(Ut, (g) => p = g, () => p);
2417
+ var xn = Zn(Ut, 2);
2417
2418
  let Sn;
2418
2419
  st(xn, (g) => $ = g, () => $), st(tt, (g) => h = g, () => h);
2419
2420
  var Pn = Zn(tt, 2);
2420
2421
  let Tn;
2421
2422
  return st(Pn, (g) => J = g, () => J), zr(() => {
2422
- Xr(tt, 1, Zr(["element anchor", E(de) && "displayed"]), "svelte-1no6o2a"), Mn = it(tt, "", Mn, { filter: m }), En = it(jt, "", En, {
2423
+ Xr(tt, 1, Zr(["element anchor", E(de) && "displayed"]), "svelte-1no6o2a"), Mn = it(tt, "", Mn, { filter: m }), En = it(Ut, "", En, {
2423
2424
  width: `${v}px`,
2424
2425
  height: `${v}px`,
2425
2426
  "border-radius": `${b}px`,
@@ -2652,7 +2653,7 @@ class da {
2652
2653
  }
2653
2654
  //#endregion
2654
2655
  }
2655
- const Qr = '(function(){"use strict";var h=[0,30,60,90,120,150,180,210,240,270,300,330],l=",";function i(e,t){return parseFloat(e[t]+e[t+1]+"."+e[t+2])}function f(e,t){return h[parseInt(e[t],16)]}function m(e){if(!e||e.length===0)return[];let t=[],o=e.split(l);for(let n=0;n<o.length;n++){let s=o[n],r=i(s,0),a=[];for(let c=3;c<s.length;c+=4){let v=i(s,c),T=f(s,c+3);a.push({zoom:v,angle:T})}t.push({zoom:r,directions:a})}return t}var d=e=>new Promise(t=>setTimeout(t,e));async function u(e,t){let o=0,n=Math.max(1,t?.retry?.times??1);for(;o<n;)try{return{data:await e(),error:null}}catch(s){if(o++,o==n){if(s instanceof Error)return(!t?.exceptions||t.exceptions.some(r=>s instanceof r)==!1)&&t?.catch?.(s),{data:null,error:s};throw t?.catch?.(s),s}else t?.retry?.delay&&await d(t.retry.delay)}throw Error("Unreachable code")}async function w(e,t,o,n,s){let r=await u(async()=>await fetch(e,{...o,method:"POST",body:t?JSON.stringify(t):void 0,headers:{...o?.headers,"Content-Type":"application/json"}}),{retry:{times:n,delay:s}});if(r.error)throw r.error;let a=r.data;if(!a.ok)throw Error(await a.text());return await a.json()}const p="https://maps.api.arenarium.dev/states",y=3,E=500,S={async fetch(e){const o={headers:{"Cache-Control":self?.location.host.startsWith("localhost")||self?.location.host.startsWith("127.0.0.1")?"no-cache":""}},n=await w(p,e,o,y,E),s=m(n.states),r=n.jwt;return{states:s,jwt:r}}};class k{methods;constructor(t){this.methods=t}listen(){self.onmessage=this.onmessage.bind(this)}async onmessage(t){const{id:o,method:n,args:s}=t.data;try{const r=this.methods[n];if(typeof r!="function")throw new Error(`Unknown method: ${n}`);const a=await r(...s),c={id:o,result:a};self.postMessage(c)}catch(r){const a=r instanceof Error?r.message:String(r),c={id:o,error:a};self.postMessage(c)}}}new k(S).listen()})();\n', ir = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Qr], { type: "text/javascript;charset=utf-8" });
2656
+ const Qr = '(function(){"use strict";var h=[0,30,60,90,120,150,180,210,240,270,300,330],l=",";function i(e,t){return parseFloat(e[t]+e[t+1]+"."+e[t+2])}function f(e,t){return h[parseInt(e[t],16)]}function m(e){if(!e||e.length===0)return[];let t=[],n=e.split(l);for(let o=0;o<n.length;o++){let s=n[o],r=i(s,0),a=[];for(let c=3;c<s.length;c+=4){let v=i(s,c),T=f(s,c+3);a.push({zoom:v,angle:T})}t.push({zoom:r,directions:a})}return t}var d=e=>new Promise(t=>setTimeout(t,e));async function u(e,t){let n=0,o=Math.max(1,t?.retry?.times??1);for(;n<o;)try{return{data:await e(),error:null}}catch(s){if(n++,n==o){if(s instanceof Error)return(!t?.exceptions||t.exceptions.some(r=>s instanceof r)==!1)&&t?.catch?.(s),{data:null,error:s};throw t?.catch?.(s),s}else t?.retry?.delay&&await d(t.retry.delay)}throw Error("Unreachable code")}async function w(e,t,n,o,s){let r=await u(async()=>await fetch(e,{...n,method:"POST",body:t?JSON.stringify(t):void 0}),{retry:{times:o,delay:s}});if(r.error)throw r.error;let a=r.data;if(!a.ok)throw Error(await a.text());return await a.json()}const y="https://maps.api.arenarium.dev/states",p=3,E=500,S={async fetch(e){const n={headers:{"Cache-Control":self?.location.host.startsWith("localhost")||self?.location.host.startsWith("127.0.0.1")?"no-cache":""}},o=await w(y,e,n,p,E),s=m(o.states),r=o.jwt;return{states:s,jwt:r}}};class k{methods;constructor(t){this.methods=t}listen(){self.onmessage=this.onmessage.bind(this)}async onmessage(t){const{id:n,method:o,args:s}=t.data;try{const r=this.methods[o];if(typeof r!="function")throw new Error(`Unknown method: ${o}`);const a=await r(...s),c={id:n,result:a};self.postMessage(c)}catch(r){const a=r instanceof Error?r.message:String(r),c={id:n,error:a};self.postMessage(c)}}}new k(S).listen()})();\n', ir = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Qr], { type: "text/javascript;charset=utf-8" });
2656
2657
  function ma(t) {
2657
2658
  let e;
2658
2659
  try {
@@ -2687,14 +2688,14 @@ async function ei(t, e) {
2687
2688
  throw Error("Unreachable code");
2688
2689
  }
2689
2690
  async function ga(t, e, n, r, i) {
2690
- let s = await ei(async () => await fetch(t, { ...n, method: "POST", body: e ? JSON.stringify(e) : void 0, headers: { ...n?.headers, "Content-Type": "application/json" } }), { retry: { times: r, delay: i } });
2691
+ let s = await ei(async () => await fetch(t, { ...n, method: "POST", body: e ? JSON.stringify(e) : void 0 }), { retry: { times: r, delay: i } });
2691
2692
  if (s.error) throw s.error;
2692
2693
  let a = s.data;
2693
2694
  if (!a.ok) throw Error(await a.text());
2694
2695
  return await a.json();
2695
2696
  }
2696
2697
  async function wa(t, e, n, r, i) {
2697
- let s = await ei(async () => await fetch(t, { ...n, method: "PUT", body: e ? JSON.stringify(e) : void 0, headers: { ...n?.headers, "Content-Type": "application/json" } }), { retry: { times: r, delay: i } });
2698
+ let s = await ei(async () => await fetch(t, { ...n, method: "PUT", body: e ? JSON.stringify(e) : void 0 }), { retry: { times: r, delay: i } });
2698
2699
  if (s.error) throw s.error;
2699
2700
  let a = s.data;
2700
2701
  if (!a.ok) throw Error(await a.text());
@@ -3326,8 +3327,8 @@ function w(...t) {
3326
3327
  }
3327
3328
  };
3328
3329
  }
3329
- var ui = /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-90), /* @__PURE__ */ ht(90)), ci = /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-180), /* @__PURE__ */ ht(180)), Ct = /* @__PURE__ */ H({ lat: ui, lng: ci }), fi = /* @__PURE__ */ H({ sw: Ct, ne: Ct }), za = /* @__PURE__ */ H({ bounds: fi, center: Ct, zoom: /* @__PURE__ */ P() }), Ye = /* @__PURE__ */ li((t) => t instanceof HTMLElement, "Must be an HTMLElement"), Oa = /* @__PURE__ */ H({ mapSize: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(1)), zoomMin: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), zoomMax: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), zoomScale: /* @__PURE__ */ wn([/* @__PURE__ */ ze(1), /* @__PURE__ */ ze(2), /* @__PURE__ */ ze(10)]) }), La = /* @__PURE__ */ H({ inserted: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ oi())), insert: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), remove: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), update: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([/* @__PURE__ */ P()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())) }), or = /* @__PURE__ */ wn([/* @__PURE__ */ ze("idle"), /* @__PURE__ */ ze("move"), /* @__PURE__ */ ze("click")]), Fa = /* @__PURE__ */ H({ getParameters: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(Oa)), getContainer: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(Ye)), getZoom: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ P())), getBounds: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(fi)), getCenter: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(Ct)), getViewport: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(za)), panBy: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([/* @__PURE__ */ P(), /* @__PURE__ */ P()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), createMarker: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([Ye, ui, ci, /* @__PURE__ */ P()])), /* @__PURE__ */ V(La)), subscribe: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([or, /* @__PURE__ */ I()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), unsubscribe: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([or, /* @__PURE__ */ I()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())) }), Jt = /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([/* @__PURE__ */ ge(), Ye]))), Gt = /* @__PURE__ */ w(/* @__PURE__ */ H({ width: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), height: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), padding: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)) }), /* @__PURE__ */ ri((t) => Math.min(t.width, t.height) / t.padding >= 4, "Minimum of width or height must be greater than or equal to 4 * padding")), $a = /* @__PURE__ */ H({ background: /* @__PURE__ */ T(/* @__PURE__ */ ge()), radius: /* @__PURE__ */ T(/* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0))), shadow: /* @__PURE__ */ T(/* @__PURE__ */ ge()) }), lr = /* @__PURE__ */ H({ background: /* @__PURE__ */ T(/* @__PURE__ */ ge()), radius: /* @__PURE__ */ T(/* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0))), filter: /* @__PURE__ */ T(/* @__PURE__ */ ge()) }), Va = /* @__PURE__ */ H({ id: /* @__PURE__ */ w(/* @__PURE__ */ ge(), /* @__PURE__ */ gn(1)), rank: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), lat: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-90), /* @__PURE__ */ ht(90)), lng: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-180), /* @__PURE__ */ ht(180)), tooltip: /* @__PURE__ */ H({ element: Ye, style: /* @__PURE__ */ T(lr), dimensions: /* @__PURE__ */ T(Gt), initialize: /* @__PURE__ */ T(Jt) }), pin: /* @__PURE__ */ T(/* @__PURE__ */ H({ element: /* @__PURE__ */ T(Ye), style: /* @__PURE__ */ T($a), dimensions: /* @__PURE__ */ T(Gt), initialize: /* @__PURE__ */ T(Jt) })), popup: /* @__PURE__ */ T(/* @__PURE__ */ H({ element: Ye, style: /* @__PURE__ */ T(lr), dimensions: /* @__PURE__ */ T(Gt), initialize: /* @__PURE__ */ T(Jt) })) }), ja = /* @__PURE__ */ w(/* @__PURE__ */ ge(), /* @__PURE__ */ ii(32)), Ua = /* @__PURE__ */ w(/* @__PURE__ */ ge(), /* @__PURE__ */ gn(1));
3330
- const Wa = "1.3.3";
3330
+ var ui = /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-90), /* @__PURE__ */ ht(90)), ci = /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-180), /* @__PURE__ */ ht(180)), Ct = /* @__PURE__ */ H({ lat: ui, lng: ci }), fi = /* @__PURE__ */ H({ sw: Ct, ne: Ct }), za = /* @__PURE__ */ H({ bounds: fi, center: Ct, zoom: /* @__PURE__ */ P() }), Ye = /* @__PURE__ */ li((t) => t instanceof HTMLElement, "Must be an HTMLElement"), Oa = /* @__PURE__ */ H({ mapSize: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(1)), zoomMin: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), zoomMax: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), zoomScale: /* @__PURE__ */ wn([/* @__PURE__ */ ze(1), /* @__PURE__ */ ze(2), /* @__PURE__ */ ze(10)]) }), La = /* @__PURE__ */ H({ inserted: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ oi())), insert: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), remove: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), update: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([/* @__PURE__ */ P()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())) }), or = /* @__PURE__ */ wn([/* @__PURE__ */ ze("idle"), /* @__PURE__ */ ze("move"), /* @__PURE__ */ ze("click")]), Fa = /* @__PURE__ */ H({ getParameters: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(Oa)), getContainer: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(Ye)), getZoom: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(/* @__PURE__ */ P())), getBounds: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(fi)), getCenter: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(Ct)), getViewport: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([])), /* @__PURE__ */ V(za)), panBy: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([/* @__PURE__ */ P(), /* @__PURE__ */ P()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), createMarker: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([Ye, ui, ci, /* @__PURE__ */ P()])), /* @__PURE__ */ V(La)), subscribe: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([or, /* @__PURE__ */ I()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())), unsubscribe: /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([or, /* @__PURE__ */ I()])), /* @__PURE__ */ V(/* @__PURE__ */ Oe())) }), Jt = /* @__PURE__ */ w(/* @__PURE__ */ I(), /* @__PURE__ */ O(/* @__PURE__ */ L([/* @__PURE__ */ ge(), Ye]))), Gt = /* @__PURE__ */ w(/* @__PURE__ */ H({ width: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), height: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), padding: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)) }), /* @__PURE__ */ ri((t) => Math.min(t.width, t.height) / t.padding >= 4, "Minimum of width or height must be greater than or equal to 4 * padding")), $a = /* @__PURE__ */ H({ background: /* @__PURE__ */ T(/* @__PURE__ */ ge()), radius: /* @__PURE__ */ T(/* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0))), shadow: /* @__PURE__ */ T(/* @__PURE__ */ ge()) }), lr = /* @__PURE__ */ H({ background: /* @__PURE__ */ T(/* @__PURE__ */ ge()), radius: /* @__PURE__ */ T(/* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0))), filter: /* @__PURE__ */ T(/* @__PURE__ */ ge()) }), Va = /* @__PURE__ */ H({ id: /* @__PURE__ */ w(/* @__PURE__ */ ge(), /* @__PURE__ */ gn(1)), rank: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(0)), lat: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-90), /* @__PURE__ */ ht(90)), lng: /* @__PURE__ */ w(/* @__PURE__ */ P(), /* @__PURE__ */ q(-180), /* @__PURE__ */ ht(180)), tooltip: /* @__PURE__ */ H({ element: Ye, style: /* @__PURE__ */ T(lr), dimensions: /* @__PURE__ */ T(Gt), initialize: /* @__PURE__ */ T(Jt) }), pin: /* @__PURE__ */ T(/* @__PURE__ */ H({ element: /* @__PURE__ */ T(Ye), style: /* @__PURE__ */ T($a), dimensions: /* @__PURE__ */ T(Gt), initialize: /* @__PURE__ */ T(Jt) })), popup: /* @__PURE__ */ T(/* @__PURE__ */ H({ element: Ye, style: /* @__PURE__ */ T(lr), dimensions: /* @__PURE__ */ T(Gt), initialize: /* @__PURE__ */ T(Jt) })) }), Ua = /* @__PURE__ */ w(/* @__PURE__ */ ge(), /* @__PURE__ */ ii(32)), ja = /* @__PURE__ */ w(/* @__PURE__ */ ge(), /* @__PURE__ */ gn(1));
3331
+ const Wa = "1.3.4";
3331
3332
  class Ba {
3332
3333
  apiKey;
3333
3334
  apiJwt;
@@ -3370,7 +3371,7 @@ class Ba {
3370
3371
  return i.jwt && (this.apiJwt = i.jwt), i.states;
3371
3372
  }
3372
3373
  }
3373
- const ur = "1.3.3", Ha = "https://maps.api.arenarium.dev/auth", qa = "https://maps.api.arenarium.dev/log", cr = 500;
3374
+ const ur = "1.3.4", Ha = "https://maps.api.arenarium.dev/auth", qa = "https://maps.api.arenarium.dev/log", cr = 500;
3374
3375
  class hi {
3375
3376
  apiKey;
3376
3377
  mapProvider;
@@ -3385,7 +3386,7 @@ class hi {
3385
3386
  markerStatesProcessDelay = cr;
3386
3387
  markerStatesProcessTimeout = void 0;
3387
3388
  constructor(e, n, r, i) {
3388
- xt(ja, e), xt(Ua, n), xt(Fa, r), this.apiKey = e, this.mapProvider = r, this.mapStateProvider = new Ti(
3389
+ xt(Ua, e), xt(ja, n), xt(Fa, r), this.apiKey = e, this.mapProvider = r, this.mapStateProvider = new Ti(
3389
3390
  this.mapProvider,
3390
3391
  this.detached.bind(this),
3391
3392
  this.error.bind(this),
@@ -3463,7 +3464,7 @@ class hi {
3463
3464
  try {
3464
3465
  if (this.detached()) return !0;
3465
3466
  const e = this.mapProvider.getParameters(), n = this.mapProvider.getViewport(), r = await this.markerVisibilityManager.getMarkersDelta(e, n);
3466
- return this.markerStatesManager.resetStates(r.remove), this.markerElementsManager.removeElements(r.remove), this.markerElementsManager.insertElements(r.insert, this.onMapMarkerClick.bind(this)), this.markerElementsProcessor.run(), this.mapStateProvider.idle() && this.onMapIdle(), !1;
3467
+ return this.markerStatesManager.resetStates(r.remove), this.markerElementsManager.removeElements(r.remove), this.markerElementsManager.insertElements(r.insert, this.onMapMarkerClick.bind(this)), this.markerElementsProcessor.run(), this.mapStateProvider.idle() && this.markerStateProcessor.run(), !1;
3467
3468
  } catch (e) {
3468
3469
  return this.clear(), this.error("Process markers visibility error", e), !0;
3469
3470
  }
@@ -3511,9 +3512,7 @@ class hi {
3511
3512
  return { width: $n, height: $n, padding: Vn };
3512
3513
  }, u = (o, l) => {
3513
3514
  if (l) return l;
3514
- const c = s(o), f = c.width, h = c.height;
3515
- console.log(f, h);
3516
- const m = Math.min(Math.round(Math.min(f, h) / 4), Vi);
3515
+ const c = s(o), f = c.width, h = c.height, m = Math.min(Math.round(Math.min(f, h) / 4), Vi);
3517
3516
  return { width: f, height: h, padding: m };
3518
3517
  };
3519
3518
  for (const o of r) {
@@ -3547,7 +3546,7 @@ class hi {
3547
3546
  xt(/* @__PURE__ */ ai(Va), e);
3548
3547
  try {
3549
3548
  const n = this.mapProvider.getParameters(), r = this.getMarkers(e);
3550
- await this.markerVisibilityManager.updateMarkers(n, r), this.mapStateProvider.start(), this.markerVisibilityProcessor.run(), this.markerStateProcessor.run(), this.markerElementsProcessor.run();
3549
+ await this.markerVisibilityManager.updateMarkers(n, r), this.mapStateProvider.start(), this.markerVisibilityProcessor.run();
3551
3550
  } catch (n) {
3552
3551
  throw this.clear(), this.error("Failed to update markers", n), n;
3553
3552
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arenarium/maps",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "license": "MIT",
5
5
  "author": "arenarium",
6
6
  "description": "Visualize complex map markers clearly. A JavaScript library for effective display of map markers, compatible with MapLibre, Mapbox, and Google Maps.",