@florasync/leaflet-geokit 0.9.1 → 0.11.0

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.
@@ -456,16 +456,16 @@ function vt(i, t = {}) {
456
456
  for (const a of i.features) {
457
457
  if (!a || a.type !== "Feature") continue;
458
458
  const n = (r = a.properties) != null ? r : {}, s = H(a), l = (u, d) => {
459
- const h = n && typeof n == "object" ? { ...n } : {}, p = s !== void 0 ? `${s}::${d}` : void 0;
460
- p !== void 0 && (h.id = p);
461
- const g = Array.isArray(n[U]) ? n[U] : [], f = {
459
+ const h = n && typeof n == "object" ? { ...n } : {}, f = s !== void 0 ? `${s}::${d}` : void 0;
460
+ f !== void 0 && (h.id = f);
461
+ const y = Array.isArray(n[U]) ? n[U] : [], g = {
462
462
  type: a.geometry.type,
463
463
  hasPropertyId: Object.prototype.hasOwnProperty.call(n, "id"),
464
464
  nullProperties: a.properties === null
465
465
  };
466
- return a.id !== void 0 ? f.id = a.id : s !== void 0 && (f.id = s), f.hasPropertyId && (f.propertyId = n.id), t.preserveMetadata && (h[U] = [...g, f]), {
466
+ return a.id !== void 0 ? g.id = a.id : s !== void 0 && (g.id = s), g.hasPropertyId && (g.propertyId = n.id), t.preserveMetadata && (h[U] = [...y, g]), {
467
467
  type: "Feature",
468
- id: p,
468
+ id: f,
469
469
  properties: h,
470
470
  geometry: u
471
471
  };
@@ -518,8 +518,8 @@ function yo(i, t = {}) {
518
518
  if (!a(d)) continue;
519
519
  const h = qe(d);
520
520
  if (!h) continue;
521
- const p = n.get(h.baseId);
522
- p ? p.push(h) : n.set(h.baseId, [h]);
521
+ const f = n.get(h.baseId);
522
+ f ? f.push(h) : n.set(h.baseId, [h]);
523
523
  }
524
524
  if (n.size === 0) return i;
525
525
  const s = /* @__PURE__ */ new Set(), l = [];
@@ -1213,12 +1213,12 @@ class Ir extends HTMLElement {
1213
1213
  ), this.entries.forEach(({ element: l, config: c }) => {
1214
1214
  const u = _r(c, o.width), d = getComputedStyle(l), h = Mr(
1215
1215
  d.getPropertyValue("--geokit-toolbar-zone").trim() || u.position
1216
- ), p = this.querySelector(
1216
+ ), f = this.querySelector(
1217
1217
  `[data-geokit-zone="${h}"]`
1218
1218
  );
1219
- if (l.parentElement !== p) {
1220
- const y = l.getRootNode() instanceof ShadowRoot ? l.getRootNode().activeElement : document.activeElement;
1221
- p.appendChild(l), y instanceof HTMLElement && l.contains(y) && y.focus({ preventScroll: !0 });
1219
+ if (l.parentElement !== f) {
1220
+ const m = l.getRootNode() instanceof ShadowRoot ? l.getRootNode().activeElement : document.activeElement;
1221
+ f.appendChild(l), m instanceof HTMLElement && l.contains(m) && m.focus({ preventScroll: !0 });
1222
1222
  }
1223
1223
  l.dataset.geokitToolbarPosition = h, l.style.setProperty(
1224
1224
  "--_geokit-direction",
@@ -1230,18 +1230,18 @@ class Ir extends HTMLElement {
1230
1230
  "--_geokit-wrap",
1231
1231
  u.overflow === "scroll" ? "nowrap" : "wrap"
1232
1232
  );
1233
- const [g, f] = u.offset;
1233
+ const [y, g] = u.offset;
1234
1234
  l.style.setProperty(
1235
1235
  "--_geokit-layout-x",
1236
- `${Number.isFinite(g) ? Math.max(0, g) : 10}px`
1236
+ `${Number.isFinite(y) ? Math.max(0, y) : 10}px`
1237
1237
  ), l.style.setProperty(
1238
1238
  "--_geokit-layout-y",
1239
- `${Number.isFinite(f) ? Math.max(0, f) : 10}px`
1239
+ `${Number.isFinite(g) ? Math.max(0, g) : 10}px`
1240
1240
  );
1241
- const m = getComputedStyle(l).flexDirection.startsWith("row");
1241
+ const p = getComputedStyle(l).flexDirection.startsWith("row");
1242
1242
  l.setAttribute(
1243
1243
  "aria-orientation",
1244
- m ? "horizontal" : "vertical"
1244
+ p ? "horizontal" : "vertical"
1245
1245
  );
1246
1246
  });
1247
1247
  const n = me.filter(
@@ -1522,14 +1522,14 @@ function qr(i, t, e) {
1522
1522
  u === "horizontal" ? "row" : "column"
1523
1523
  ), typeof l.gap == "number" && Number.isFinite(l.gap) && l.gap >= 0 && c.style.setProperty("--_geokit-gap", `${l.gap}px`), jr(c, l.position, l.offset);
1524
1524
  const d = Fe(l.className);
1525
- d.length > 0 && c.classList.add(...d), l.tools.forEach((p, g) => {
1526
- const f = Vr(p, l, g, t == null ? void 0 : t[p]);
1527
- ko(f, p, {
1525
+ d.length > 0 && c.classList.add(...d), l.tools.forEach((f, y) => {
1526
+ const g = Vr(f, l, y, t == null ? void 0 : t[f]);
1527
+ ko(g, f, {
1528
1528
  source: "toolbar",
1529
1529
  activate: !0,
1530
1530
  groupId: l.id,
1531
1531
  onTrigger: e.onTrigger
1532
- }), c.appendChild(f);
1532
+ }), c.appendChild(g);
1533
1533
  }), Tr(l) ? (c.setAttribute(
1534
1534
  "part",
1535
1535
  `toolbar-group toolbar-group-${l.id.replace(/[^a-zA-Z0-9_-]/g, "-")}`
@@ -1549,30 +1549,30 @@ function Jr(i, t) {
1549
1549
  });
1550
1550
  }
1551
1551
  function Vr(i, t, e, o) {
1552
- var u, d, h, p, g, f, m, y, b;
1552
+ var u, d, h, f, y, g, p, m, v;
1553
1553
  const r = document.createElement("button");
1554
1554
  r.type = "button", r.dataset.geokitTool = (d = (u = Ae[i]) == null ? void 0 : u.dataTool) != null ? d : i, r.dataset.geokitToolbarGroup = t.id, r.dataset.geokitToolbarPosition = (h = t.position) != null ? h : "topright", r.dataset.geokitToolInstance = Wr(
1555
1555
  t.id,
1556
1556
  i,
1557
1557
  e
1558
1558
  ), r.className = "leaflet-geokit-toolbar-button", r.disabled = (o == null ? void 0 : o.disabled) === !0, r.setAttribute("aria-disabled", String(r.disabled));
1559
- const a = (p = o == null ? void 0 : o.title) != null ? p : xo(i);
1560
- r.title = a, r.setAttribute("aria-label", (g = o == null ? void 0 : o.ariaLabel) != null ? g : a), o != null && o.popover && (r.setAttribute("aria-haspopup", "dialog"), r.setAttribute("aria-expanded", "false"));
1559
+ const a = (f = o == null ? void 0 : o.title) != null ? f : xo(i);
1560
+ r.title = a, r.setAttribute("aria-label", (y = o == null ? void 0 : o.ariaLabel) != null ? y : a), o != null && o.popover && (r.setAttribute("aria-haspopup", "dialog"), r.setAttribute("aria-expanded", "false"));
1561
1561
  const n = Fe(o == null ? void 0 : o.className);
1562
1562
  if (n.length > 0 && r.classList.add(...n), o && (r.__geokitToolButtonConfig = o, Fr(o) && Ie(r, o, { tool: i, groupId: t.id })), !r.querySelector(`.${rt}`)) {
1563
- const v = {
1563
+ const b = {
1564
1564
  iconHtml: Xr(i),
1565
- iconSize: (f = o == null ? void 0 : o.iconSize) != null ? f : [20, 20]
1565
+ iconSize: (g = o == null ? void 0 : o.iconSize) != null ? g : [20, 20]
1566
1566
  };
1567
- Ie(r, v, { tool: i, groupId: t.id });
1567
+ Ie(r, b, { tool: i, groupId: t.id });
1568
1568
  }
1569
1569
  const s = `${t.id}-${i}-${e}`, l = r.querySelector(`.${rt}`), c = document.createElement("slot");
1570
1570
  c.name = `${s}-icon`, c.append(...Array.from(l.childNodes)), l.appendChild(c);
1571
- for (const v of ["badge", "tooltip"]) {
1571
+ for (const b of ["badge", "tooltip"]) {
1572
1572
  const A = document.createElement("span");
1573
- A.className = `leaflet-geokit-tool-${v}`, A.setAttribute("part", v), A.setAttribute("aria-hidden", "true");
1573
+ A.className = `leaflet-geokit-tool-${b}`, A.setAttribute("part", b), A.setAttribute("aria-hidden", "true");
1574
1574
  const k = document.createElement("slot");
1575
- k.name = `${s}-${v}`, k.textContent = v === "badge" ? (m = o == null ? void 0 : o.badge) != null ? m : "" : (b = (y = o == null ? void 0 : o.tooltip) != null ? y : o == null ? void 0 : o.ariaLabel) != null ? b : a, A.appendChild(k), r.appendChild(A);
1575
+ k.name = `${s}-${b}`, k.textContent = b === "badge" ? (p = o == null ? void 0 : o.badge) != null ? p : "" : (v = (m = o == null ? void 0 : o.tooltip) != null ? m : o == null ? void 0 : o.ariaLabel) != null ? v : a, A.appendChild(k), r.appendChild(A);
1576
1576
  }
1577
1577
  return r;
1578
1578
  }
@@ -1581,7 +1581,7 @@ function jr(i, t = "topright", e) {
1581
1581
  i.dataset.geokitToolbarPosition = t, i.style.setProperty("--_geokit-offset-x", `${o}px`), i.style.setProperty("--_geokit-offset-y", `${r}px`);
1582
1582
  }
1583
1583
  function Zr(i, t, e, o) {
1584
- var s, l, c, u, d, h, p, g, f;
1584
+ var s, l, c, u, d, h, f, y, g;
1585
1585
  if (!e.popover) return;
1586
1586
  ye(o.container);
1587
1587
  const r = document.createElement("div");
@@ -1589,16 +1589,16 @@ function Zr(i, t, e, o) {
1589
1589
  "aria-label",
1590
1590
  (u = (c = e.popover.ariaLabel) != null ? c : e.popover.title) != null ? u : xo(t)
1591
1591
  ), e.popover.title) {
1592
- const m = document.createElement("strong");
1593
- m.textContent = e.popover.title, r.appendChild(m);
1592
+ const p = document.createElement("strong");
1593
+ p.textContent = e.popover.title, r.appendChild(p);
1594
1594
  }
1595
1595
  if (e.popover.body) {
1596
- const m = document.createElement("div");
1597
- m.textContent = e.popover.body, r.appendChild(m);
1596
+ const p = document.createElement("div");
1597
+ p.textContent = e.popover.body, r.appendChild(p);
1598
1598
  }
1599
1599
  if (e.popover.html) {
1600
- const m = document.createElement("div");
1601
- m.innerHTML = e.popover.html, r.appendChild(m);
1600
+ const p = document.createElement("div");
1601
+ p.innerHTML = e.popover.html, r.appendChild(p);
1602
1602
  }
1603
1603
  const a = (h = (d = e.popover).render) == null ? void 0 : h.call(d, {
1604
1604
  tool: t,
@@ -1609,17 +1609,17 @@ function Zr(i, t, e, o) {
1609
1609
  if (a instanceof HTMLElement || n)
1610
1610
  r.appendChild(a);
1611
1611
  else if (typeof a == "string" && a.trim()) {
1612
- const m = document.createElement("div");
1613
- m.innerHTML = a, r.appendChild(m);
1612
+ const p = document.createElement("div");
1613
+ p.innerHTML = a, r.appendChild(p);
1614
1614
  }
1615
1615
  o.container.appendChild(r), Kr(o.container, i, r), i.setAttribute("aria-expanded", "true"), nt.set(r, {
1616
1616
  tool: t,
1617
1617
  groupId: o.groupId,
1618
1618
  button: i,
1619
1619
  config: e
1620
- }), Yr(o.container, i, r), r.tabIndex = -1, ((p = r.querySelector(
1620
+ }), Yr(o.container, i, r), r.tabIndex = -1, ((f = r.querySelector(
1621
1621
  "button:not(:disabled), [href], input, select, textarea, [tabindex='0']"
1622
- )) != null ? p : r).focus(), (f = (g = e.popover).onOpen) == null || f.call(g, {
1622
+ )) != null ? f : r).focus(), (g = (y = e.popover).onOpen) == null || g.call(y, {
1623
1623
  tool: t,
1624
1624
  groupId: o.groupId,
1625
1625
  button: i,
@@ -1806,49 +1806,49 @@ function Eo(i, t, e) {
1806
1806
  n = !1;
1807
1807
  };
1808
1808
  i.on("unload", s);
1809
- const l = (f, m) => ({
1810
- target: m,
1811
- originalEvent: f,
1812
- latlng: i.mouseEventToLatLng(f)
1813
- }), c = (f) => {
1814
- f.preventDefault(), f.stopPropagation();
1809
+ const l = (g, p) => ({
1810
+ target: p,
1811
+ originalEvent: g,
1812
+ latlng: i.mouseEventToLatLng(g)
1813
+ }), c = (g) => {
1814
+ g.preventDefault(), g.stopPropagation();
1815
1815
  }, u = () => {
1816
- var m;
1817
- const f = a;
1818
- a = null, f !== null && ((m = o.hasPointerCapture) != null && m.call(o, f)) && o.releasePointerCapture(f), n && i.dragging.enable(), n = !1;
1819
- }, d = (f) => {
1820
- if (a !== null || !f.isPrimary || f.button !== 0) return;
1821
- let m;
1822
- const y = f.composedPath(), b = i.mouseEventToLayerPoint(f), v = /* @__PURE__ */ new Set();
1816
+ var p;
1817
+ const g = a;
1818
+ a = null, g !== null && ((p = o.hasPointerCapture) != null && p.call(o, g)) && o.releasePointerCapture(g), n && i.dragging.enable(), n = !1;
1819
+ }, d = (g) => {
1820
+ if (a !== null || !g.isPrimary || g.button !== 0) return;
1821
+ let p;
1822
+ const m = g.composedPath(), v = i.mouseEventToLayerPoint(g), b = /* @__PURE__ */ new Set();
1823
1823
  if (t.eachLayer((A) => {
1824
- var L;
1825
- const k = (L = A.getElement) == null ? void 0 : L.call(A);
1826
- k && y.includes(k) && (m = A);
1824
+ var E;
1825
+ const k = (E = A.getElement) == null ? void 0 : E.call(A);
1826
+ k && m.includes(k) && (p = A);
1827
1827
  const x = A._renderer;
1828
- if (!k && x && !v.has(x) && y.includes(x._container)) {
1829
- v.add(x);
1830
- for (let E = x._drawFirst; E; E = E.next) {
1831
- const C = E.layer;
1832
- t.hasLayer(C) && C.options.interactive && C._containsPoint(b) && (m = C);
1828
+ if (!k && x && !b.has(x) && m.includes(x._container)) {
1829
+ b.add(x);
1830
+ for (let L = x._drawFirst; L; L = L.next) {
1831
+ const C = L.layer;
1832
+ t.hasLayer(C) && C.options.interactive && C._containsPoint(v) && (p = C);
1833
1833
  }
1834
1834
  }
1835
- }), !!m && (c(f), !e.pending())) {
1836
- a = f.pointerId, n = i.dragging.enabled(), i.dragging.disable(), e.start(l(f, m));
1835
+ }), !!p && (c(g), !e.pending())) {
1836
+ a = g.pointerId, n = i.dragging.enabled(), i.dragging.disable(), e.start(l(g, p));
1837
1837
  try {
1838
1838
  o.setPointerCapture(a);
1839
1839
  } catch {
1840
1840
  u(), e.cancel();
1841
1841
  }
1842
1842
  }
1843
- }, h = (f) => {
1844
- f.pointerId === a && (c(f), e.move(l(f)));
1845
- }, p = (f) => {
1846
- f.pointerId === a && (c(f), e.move(l(f)), u(), e.end(l(f)));
1847
- }, g = (f) => {
1848
- f.pointerId === a && (c(f), u(), e.cancel());
1843
+ }, h = (g) => {
1844
+ g.pointerId === a && (c(g), e.move(l(g)));
1845
+ }, f = (g) => {
1846
+ g.pointerId === a && (c(g), e.move(l(g)), u(), e.end(l(g)));
1847
+ }, y = (g) => {
1848
+ g.pointerId === a && (c(g), u(), e.cancel());
1849
1849
  };
1850
- return o.addEventListener("pointerdown", d, !0), o.addEventListener("pointermove", h, !0), o.addEventListener("pointerup", p, !0), o.addEventListener("pointercancel", g, !0), o.addEventListener("lostpointercapture", g, !0), () => {
1851
- u(), e.cancel(), i.off("unload", s), o.style.touchAction = r, o.removeEventListener("pointerdown", d, !0), o.removeEventListener("pointermove", h, !0), o.removeEventListener("pointerup", p, !0), o.removeEventListener("pointercancel", g, !0), o.removeEventListener("lostpointercapture", g, !0);
1850
+ return o.addEventListener("pointerdown", d, !0), o.addEventListener("pointermove", h, !0), o.addEventListener("pointerup", f, !0), o.addEventListener("pointercancel", y, !0), o.addEventListener("lostpointercapture", y, !0), () => {
1851
+ u(), e.cancel(), i.off("unload", s), o.style.touchAction = r, o.removeEventListener("pointerdown", d, !0), o.removeEventListener("pointermove", h, !0), o.removeEventListener("pointerup", f, !0), o.removeEventListener("pointercancel", y, !0), o.removeEventListener("lostpointercapture", y, !0);
1852
1852
  };
1853
1853
  }
1854
1854
  const ze = class ze extends P.Draw.Feature {
@@ -2177,8 +2177,8 @@ function St(i) {
2177
2177
  return i * 180 / Math.PI;
2178
2178
  }
2179
2179
  function ii(i, t, e) {
2180
- const o = t / ri, r = je(e), a = je(i.lat), n = je(i.lng), s = Math.sin(a), l = Math.cos(a), c = Math.sin(o), u = Math.cos(o), d = s * u + l * c * Math.cos(r), h = Math.asin(d), p = Math.sin(r) * c * l, g = u - s * d, f = n + Math.atan2(p, g);
2181
- return { lat: St(h), lng: St(f) };
2180
+ const o = t / ri, r = je(e), a = je(i.lat), n = je(i.lng), s = Math.sin(a), l = Math.cos(a), c = Math.sin(o), u = Math.cos(o), d = s * u + l * c * Math.cos(r), h = Math.asin(d), f = Math.sin(r) * c * l, y = u - s * d, g = n + Math.atan2(f, y);
2181
+ return { lat: St(h), lng: St(g) };
2182
2182
  }
2183
2183
  function ai(i) {
2184
2184
  let t = 0;
@@ -2312,6 +2312,7 @@ function ue(i, t) {
2312
2312
  }
2313
2313
  class ui {
2314
2314
  constructor(t, e, o, r = "metric", a) {
2315
+ w(this, "onChange");
2315
2316
  w(this, "map");
2316
2317
  w(this, "layers", []);
2317
2318
  w(this, "controlsGroup");
@@ -2328,28 +2329,28 @@ class ui {
2328
2329
  this.onChange = a, this.map = t, this.onSave = o, this.measurementSystem = r, this.controlsGroup = P.layerGroup().addTo(t), this.baseCircleOptions = { ...e.options }, Object.assign(this.baseCircleOptions, this.style), delete this.baseCircleOptions.editing, delete this.baseCircleOptions.original, this.addLayer(e), this.installEditEventBridges(), this.renderControls();
2329
2330
  }
2330
2331
  installEditEventBridges() {
2331
- var u, d, h, p, g, f, m, y;
2332
- const t = P, e = (d = (u = t == null ? void 0 : t.Draw) == null ? void 0 : u.Event) == null ? void 0 : d.EDITMOVE, o = (p = (h = t == null ? void 0 : t.Draw) == null ? void 0 : h.Event) == null ? void 0 : p.EDITRESIZE, r = (f = (g = t == null ? void 0 : t.Draw) == null ? void 0 : g.Event) == null ? void 0 : f.EDITSTART, a = (y = (m = t == null ? void 0 : t.Draw) == null ? void 0 : m.Event) == null ? void 0 : y.EDITSTOP;
2332
+ var u, d, h, f, y, g, p, m;
2333
+ const t = P, e = (d = (u = t == null ? void 0 : t.Draw) == null ? void 0 : u.Event) == null ? void 0 : d.EDITMOVE, o = (f = (h = t == null ? void 0 : t.Draw) == null ? void 0 : h.Event) == null ? void 0 : f.EDITRESIZE, r = (g = (y = t == null ? void 0 : t.Draw) == null ? void 0 : y.Event) == null ? void 0 : g.EDITSTART, a = (m = (p = t == null ? void 0 : t.Draw) == null ? void 0 : p.Event) == null ? void 0 : m.EDITSTOP;
2333
2334
  if (!e || !o) return;
2334
- const n = (b) => {
2335
- const v = b == null ? void 0 : b.layer;
2336
- v && this.layers.includes(v) && this.syncCenters(v);
2337
- }, s = (b) => {
2338
- const v = b == null ? void 0 : b.layer;
2339
- v && this.layers.includes(v) && (this.updateLabels(v), this.requestRenderControls());
2340
- }, l = (b) => {
2335
+ const n = (v) => {
2336
+ const b = v == null ? void 0 : v.layer;
2337
+ b && this.layers.includes(b) && this.syncCenters(b);
2338
+ }, s = (v) => {
2339
+ const b = v == null ? void 0 : v.layer;
2340
+ b && this.layers.includes(b) && (this.updateLabels(b), this.requestRenderControls());
2341
+ }, l = (v) => {
2341
2342
  var x;
2342
- const v = b == null ? void 0 : b.layer;
2343
- if (!v || !this.layers.includes(v)) return;
2344
- const A = v;
2345
- ((x = A.getTooltip) == null ? void 0 : x.call(A)) && this.updateLabels(A);
2343
+ const b = v == null ? void 0 : v.layer;
2344
+ if (!b || !this.layers.includes(b)) return;
2345
+ const A = b;
2346
+ (x = A.getTooltip) != null && x.call(A) && this.updateLabels(A);
2346
2347
  }, c = () => {
2347
- this.layers.forEach((b) => {
2348
+ this.layers.forEach((v) => {
2348
2349
  var A;
2349
- const v = (A = b.getTooltip) == null ? void 0 : A.call(b);
2350
- v && (b.setTooltipContent(
2351
- ue(b.getRadius(), this.measurementSystem)
2352
- ), v.options.offset = [10, 0], v.options.direction = "right", b.closeTooltip(), b.openTooltip());
2350
+ const b = (A = v.getTooltip) == null ? void 0 : A.call(v);
2351
+ b && (v.setTooltipContent(
2352
+ ue(v.getRadius(), this.measurementSystem)
2353
+ ), b.options.offset = [10, 0], b.options.direction = "right", v.closeTooltip(), v.openTooltip());
2353
2354
  });
2354
2355
  };
2355
2356
  this.map.on(e, n), this.map.on(o, s), r && (this.map.on(r, l), this.detachMapListeners.push(() => this.map.off(r, l))), a && (this.map.on(a, c), this.detachMapListeners.push(() => this.map.off(a, c))), this.detachMapListeners.push(() => this.map.off(e, n)), this.detachMapListeners.push(() => this.map.off(o, s));
@@ -2594,71 +2595,71 @@ function Co(i, t, e, o) {
2594
2595
  }
2595
2596
  function yi(i, t, e, o) {
2596
2597
  const r = ne(i), a = ne(e), n = ne(o - t), s = Math.atan((1 - W) * Math.tan(r)), l = Math.atan((1 - W) * Math.tan(a)), c = Math.sin(s), u = Math.cos(s), d = Math.sin(l), h = Math.cos(l);
2597
- let p = n, g = Number.POSITIVE_INFINITY, f = 0;
2598
- const m = 200;
2599
- let y = 0, b = 0, v = 0, A = 0, k = 0;
2600
- for (; Math.abs(p - g) > 1e-12 && f < m; ) {
2601
- const _ = Math.sin(p), I = Math.cos(p);
2602
- if (y = Math.sqrt(
2598
+ let f = n, y = Number.POSITIVE_INFINITY, g = 0;
2599
+ const p = 200;
2600
+ let m = 0, v = 0, b = 0, A = 0, k = 0;
2601
+ for (; Math.abs(f - y) > 1e-12 && g < p; ) {
2602
+ const _ = Math.sin(f), I = Math.cos(f);
2603
+ if (m = Math.sqrt(
2603
2604
  (h * _) ** 2 + (u * d - c * h * I) ** 2
2604
- ), y === 0)
2605
+ ), m === 0)
2605
2606
  return {
2606
2607
  distanceMeters: 0,
2607
2608
  bearingRad: 0,
2608
- iterations: f,
2609
+ iterations: g,
2609
2610
  converged: !0
2610
2611
  };
2611
- b = c * d + u * h * I, v = Math.atan2(y, b);
2612
- const S = u * h * _ / y;
2613
- A = 1 - S ** 2, k = A === 0 ? 0 : b - 2 * c * d / A;
2612
+ v = c * d + u * h * I, b = Math.atan2(m, v);
2613
+ const S = u * h * _ / m;
2614
+ A = 1 - S ** 2, k = A === 0 ? 0 : v - 2 * c * d / A;
2614
2615
  const F = W / 16 * A * (4 + W * (4 - 3 * A));
2615
- g = p, p = n + (1 - F) * W * S * (v + F * y * (k + F * b * (-1 + 2 * k ** 2))), f += 1;
2616
+ y = f, f = n + (1 - F) * W * S * (b + F * m * (k + F * v * (-1 + 2 * k ** 2))), g += 1;
2616
2617
  }
2617
- if (f >= m)
2618
+ if (g >= p)
2618
2619
  return {
2619
2620
  distanceMeters: Number.NaN,
2620
2621
  bearingRad: 0,
2621
- iterations: f,
2622
+ iterations: g,
2622
2623
  converged: !1
2623
2624
  };
2624
- const x = (Lo ** 2 - ae ** 2) / ae ** 2 * A, L = 1 + x / 16384 * (4096 + x * (-768 + x * (320 - 175 * x))), E = x / 1024 * (256 + x * (-128 + x * (74 - 47 * x))), C = E * y * (k + E / 4 * (b * (-1 + 2 * k ** 2) - E / 6 * k * (-3 + 4 * y ** 2) * (-3 + 4 * k ** 2))), T = ae * L * (v - C), M = Math.atan2(
2625
- h * Math.sin(p),
2626
- u * d - c * h * Math.cos(p)
2625
+ const x = (Lo ** 2 - ae ** 2) / ae ** 2 * A, E = 1 + x / 16384 * (4096 + x * (-768 + x * (320 - 175 * x))), L = x / 1024 * (256 + x * (-128 + x * (74 - 47 * x))), C = L * m * (k + L / 4 * (v * (-1 + 2 * k ** 2) - L / 6 * k * (-3 + 4 * m ** 2) * (-3 + 4 * k ** 2))), T = ae * E * (b - C), M = Math.atan2(
2626
+ h * Math.sin(f),
2627
+ u * d - c * h * Math.cos(f)
2627
2628
  );
2628
2629
  return {
2629
2630
  distanceMeters: T,
2630
2631
  bearingRad: M,
2631
- iterations: f,
2632
+ iterations: g,
2632
2633
  converged: !0
2633
2634
  };
2634
2635
  }
2635
2636
  function bi(i, t, e, o) {
2636
- const r = ne(i), a = ne(e), n = ne(o - t), s = Math.atan((1 - W) * Math.tan(r)), l = Math.atan((1 - W) * Math.tan(a)), c = Math.sin(s), u = Math.cos(s), d = Math.sin(l), h = Math.cos(l), p = Math.sqrt(
2637
+ const r = ne(i), a = ne(e), n = ne(o - t), s = Math.atan((1 - W) * Math.tan(r)), l = Math.atan((1 - W) * Math.tan(a)), c = Math.sin(s), u = Math.cos(s), d = Math.sin(l), h = Math.cos(l), f = Math.sqrt(
2637
2638
  (h * Math.sin(n)) ** 2 + (u * d - c * h * Math.cos(n)) ** 2
2638
- ), g = c * d + u * h * Math.cos(n), f = Math.atan2(p, g);
2639
- if (f === 0)
2639
+ ), y = c * d + u * h * Math.cos(n), g = Math.atan2(f, y);
2640
+ if (g === 0)
2640
2641
  return { distanceMeters: 0, bearingRad: 0 };
2641
- const y = 1 - (u * h * Math.sin(n) / Math.sin(f)) ** 2, b = y === 0 ? 0 : g - 2 * c * d / y, v = (Lo ** 2 - ae ** 2) / ae ** 2 * y, A = 1 + v / 16384 * (4096 + v * (-768 + v * (320 - 175 * v))), k = v / 1024 * (256 + v * (-128 + v * (74 - 47 * v))), x = k * p * (b + k / 4 * (g * (-1 + 2 * b ** 2) - k / 6 * b * (-3 + 4 * p ** 2) * (-3 + 4 * b ** 2))), L = ae * A * (f - x), E = Math.atan2(
2642
+ const m = 1 - (u * h * Math.sin(n) / Math.sin(g)) ** 2, v = m === 0 ? 0 : y - 2 * c * d / m, b = (Lo ** 2 - ae ** 2) / ae ** 2 * m, A = 1 + b / 16384 * (4096 + b * (-768 + b * (320 - 175 * b))), k = b / 1024 * (256 + b * (-128 + b * (74 - 47 * b))), x = k * f * (v + k / 4 * (y * (-1 + 2 * v ** 2) - k / 6 * v * (-3 + 4 * f ** 2) * (-3 + 4 * v ** 2))), E = ae * A * (g - x), L = Math.atan2(
2642
2643
  h * Math.sin(n),
2643
2644
  u * d - c * h * Math.cos(n)
2644
2645
  );
2645
- return { distanceMeters: L, bearingRad: E };
2646
+ return { distanceMeters: E, bearingRad: L };
2646
2647
  }
2647
2648
  const Q = (i) => i !== null && typeof i == "object" && !Array.isArray(i), Ot = (i) => JSON.parse(JSON.stringify(i));
2648
2649
  function ft(i) {
2649
2650
  const t = [];
2650
2651
  let e = 0;
2651
- const o = /* @__PURE__ */ new Set(), r = (f, m, y, b = "error") => {
2652
- t.push({ code: f, path: m, message: y, severity: b });
2653
- }, a = (f, m) => {
2654
- "crs" in f && r(
2652
+ const o = /* @__PURE__ */ new Set(), r = (p, m, v, b = "error") => {
2653
+ t.push({ code: p, path: m, message: v, severity: b });
2654
+ }, a = (p, m) => {
2655
+ "crs" in p && r(
2655
2656
  "crs-mismatch",
2656
2657
  `${m}.crs`,
2657
2658
  "RFC 7946 uses WGS84 longitude/latitude; legacy CRS is not reprojected.",
2658
2659
  "warning"
2659
2660
  );
2660
- }, n = (f, m) => {
2661
- if (Array.isArray(f) && f.length === 0 && r("empty-geometry", m, "Point has no coordinates."), !Array.isArray(f) || f.length < 2 || !f.every((y) => typeof y == "number" && Number.isFinite(y))) {
2661
+ }, n = (p, m) => {
2662
+ if (Array.isArray(p) && p.length === 0 && r("empty-geometry", m, "Point has no coordinates."), !Array.isArray(p) || p.length < 2 || !p.every((v) => typeof v == "number" && Number.isFinite(v))) {
2662
2663
  r(
2663
2664
  "invalid-position",
2664
2665
  m,
@@ -2666,14 +2667,14 @@ function ft(i) {
2666
2667
  );
2667
2668
  return;
2668
2669
  }
2669
- (Math.abs(f[0]) > 180 || Math.abs(f[1]) > 90) && r(
2670
+ (Math.abs(p[0]) > 180 || Math.abs(p[1]) > 90) && r(
2670
2671
  "crs-mismatch",
2671
2672
  m,
2672
2673
  "Position outside WGS84 longitude/latitude range.",
2673
2674
  "warning"
2674
2675
  );
2675
- }, s = (f, m, y) => {
2676
- if (!Array.isArray(f) || f.length === 0) {
2676
+ }, s = (p, m, v) => {
2677
+ if (!Array.isArray(p) || p.length === 0) {
2677
2678
  r(
2678
2679
  "empty-geometry",
2679
2680
  m,
@@ -2681,142 +2682,146 @@ function ft(i) {
2681
2682
  );
2682
2683
  return;
2683
2684
  }
2684
- f.forEach((b, v) => y(b, `${m}[${v}]`));
2685
- }, l = (f, m) => {
2686
- s(f, m, n), Array.isArray(f) && f.length < 2 && r(
2685
+ p.forEach((b, A) => v(b, `${m}[${A}]`));
2686
+ }, l = (p, m) => {
2687
+ s(p, m, n), Array.isArray(p) && p.length < 2 && r(
2687
2688
  "invalid-line",
2688
2689
  m,
2689
2690
  "LineString requires at least two positions."
2690
2691
  );
2691
- }, c = (f, m) => {
2692
- s(f, m, n);
2693
- const y = Array.isArray(f) ? f[0] : void 0, b = Array.isArray(f) ? f[f.length - 1] : void 0, v = Array.isArray(y) && Array.isArray(b) && y.length === b.length && y.every((A, k) => A === b[k]);
2694
- Array.isArray(f) && (f.length < 4 || !v) && r(
2692
+ }, c = (p, m) => {
2693
+ s(p, m, n);
2694
+ const v = Array.isArray(p) ? p[0] : void 0, b = Array.isArray(p) ? p[p.length - 1] : void 0, A = Array.isArray(v) && Array.isArray(b) && v.length === b.length && v.every((k, x) => k === b[x]);
2695
+ Array.isArray(p) && (p.length < 4 || !A) && r(
2695
2696
  "invalid-ring",
2696
2697
  m,
2697
2698
  "Linear rings require four positions and exact closure."
2698
2699
  );
2699
- }, u = (f, m) => s(f, m, c), d = (f, m, y) => {
2700
- if (y > 64) {
2700
+ }, u = (p, m) => s(p, m, c), d = (p, m, v) => {
2701
+ if (v > 64) {
2701
2702
  r("nesting-limit", m, "Geometry nesting exceeds 64.");
2702
2703
  return;
2703
2704
  }
2704
- if (!Q(f)) {
2705
+ if (!Q(p)) {
2705
2706
  r("empty-geometry", m, "Missing or null geometry.");
2706
2707
  return;
2707
2708
  }
2708
- a(f, m);
2709
+ a(p, m);
2709
2710
  const b = `${m}.coordinates`;
2710
- switch (f.type) {
2711
+ switch (p.type) {
2711
2712
  case "Point":
2712
- n(f.coordinates, b);
2713
+ n(p.coordinates, b);
2713
2714
  break;
2714
2715
  case "LineString":
2715
- l(f.coordinates, b);
2716
+ l(p.coordinates, b);
2716
2717
  break;
2717
2718
  case "Polygon":
2718
- u(f.coordinates, b);
2719
+ u(p.coordinates, b);
2719
2720
  break;
2720
2721
  case "MultiPoint":
2721
- s(f.coordinates, b, n);
2722
+ s(p.coordinates, b, n);
2722
2723
  break;
2723
2724
  case "MultiLineString":
2724
- s(f.coordinates, b, l);
2725
+ s(p.coordinates, b, l);
2725
2726
  break;
2726
2727
  case "MultiPolygon":
2727
- s(f.coordinates, b, u);
2728
+ s(p.coordinates, b, u);
2728
2729
  break;
2729
2730
  case "GeometryCollection":
2730
2731
  s(
2731
- f.geometries,
2732
+ p.geometries,
2732
2733
  `${m}.geometries`,
2733
- (v, A) => d(v, A, y + 1)
2734
+ (A, k) => d(A, k, v + 1)
2734
2735
  );
2735
2736
  break;
2736
2737
  default:
2737
2738
  r(
2738
2739
  "unsupported-geometry",
2739
2740
  m,
2740
- `Unsupported geometry: ${typeof f.type == "string" ? f.type : "missing or non-string type"}.`
2741
+ `Unsupported geometry: ${typeof p.type == "string" ? p.type : "missing or non-string type"}.`
2741
2742
  );
2742
2743
  }
2743
- typeof f.type == "string" && (f.type.startsWith("Multi") || f.type === "GeometryCollection") && r(
2744
+ typeof p.type == "string" && (p.type.startsWith("Multi") || p.type === "GeometryCollection") && r(
2744
2745
  "multi-expansion",
2745
2746
  m,
2746
2747
  "Editing adapters expand this geometry into single-geometry features.",
2747
2748
  "info"
2748
2749
  );
2749
- }, h = (f, m) => {
2750
- var v;
2751
- if (e++, !Q(f) || f.type !== "Feature") {
2750
+ }, h = (p, m) => {
2751
+ var A;
2752
+ if (e++, !Q(p) || p.type !== "Feature") {
2752
2753
  r("invalid-feature", m, "Expected a Feature.");
2753
2754
  return;
2754
2755
  }
2755
- if (a(f, m), f.properties === null || Q(f.properties) || r(
2756
+ if (a(p, m), p.properties === null || Q(p.properties) || r(
2756
2757
  "invalid-properties",
2757
2758
  `${m}.properties`,
2758
2759
  "Expected an object or null."
2759
- ), Q(f.properties)) {
2760
- const A = f.properties.id;
2761
- f.id === void 0 && A !== void 0 && !(typeof A == "string" && A.length > 0) && !(typeof A == "number" && Number.isFinite(A)) && r(
2760
+ ), Q(p.properties)) {
2761
+ const k = p.properties.id;
2762
+ p.id === void 0 && k !== void 0 && !(typeof k == "string" && k.length > 0) && !(typeof k == "number" && Number.isFinite(k)) && r(
2762
2763
  "invalid-id",
2763
2764
  `${m}.properties.id`,
2764
2765
  "Fallback ID must be a non-empty string or finite number."
2765
2766
  );
2766
- const k = f.properties["geokit:source"];
2767
- k !== void 0 && (!Array.isArray(k) || k.length === 0 || k.length > 64 || !k.every(
2768
- (x) => Q(x) && typeof x.type == "string" && [
2767
+ const x = p.properties["geokit:source"];
2768
+ x !== void 0 && (!Array.isArray(x) || x.length === 0 || x.length > 64 || !x.every(
2769
+ (E) => Q(E) && typeof E.type == "string" && [
2769
2770
  "MultiPoint",
2770
2771
  "MultiLineString",
2771
2772
  "MultiPolygon",
2772
2773
  "GeometryCollection"
2773
- ].includes(x.type) && (typeof x.id == "string" || typeof x.id == "number") && typeof x.hasPropertyId == "boolean" && typeof x.nullProperties == "boolean"
2774
+ ].includes(E.type) && (typeof E.id == "string" || typeof E.id == "number") && typeof E.hasPropertyId == "boolean" && typeof E.nullProperties == "boolean"
2774
2775
  )) && r(
2775
2776
  "invalid-provenance",
2776
2777
  `${m}.properties.geokit:source`,
2777
2778
  "Reserved expansion provenance is malformed."
2778
2779
  );
2779
2780
  }
2780
- f.id !== void 0 && !(typeof f.id == "string" && f.id.length > 0) && !(typeof f.id == "number" && Number.isFinite(f.id)) && r(
2781
+ p.id !== void 0 && !(typeof p.id == "string" && p.id.length > 0) && !(typeof p.id == "number" && Number.isFinite(p.id)) && r(
2781
2782
  "invalid-id",
2782
2783
  `${m}.id`,
2783
2784
  "Feature ID must be a non-empty string or finite number."
2784
2785
  );
2785
- const y = (v = f.id) != null ? v : Q(f.properties) ? f.properties.id : void 0, b = typeof y == "string" || typeof y == "number" ? String(y) : void 0;
2786
- b !== void 0 && (o.has(b) && r("duplicate-id", `${m}.id`, `Duplicate feature ID: ${b}.`), o.add(b)), d(f.geometry, `${m}.geometry`, 0);
2787
- }, p = /* @__PURE__ */ new Set(), g = (f, m, y) => {
2788
- if (y > 128) {
2789
- r("nesting-limit", m, "JSON nesting exceeds 128.");
2786
+ const v = (A = p.id) != null ? A : Q(p.properties) ? p.properties.id : void 0, b = typeof v == "string" || typeof v == "number" ? String(v) : void 0;
2787
+ b !== void 0 && (o.has(b) && r("duplicate-id", `${m}.id`, `Duplicate feature ID: ${b}.`), o.add(b)), d(p.geometry, `${m}.geometry`, 0);
2788
+ }, f = /* @__PURE__ */ new Set();
2789
+ let y = !1;
2790
+ const g = (p, m, v) => {
2791
+ if (v > 128) {
2792
+ y = !0, r("nesting-limit", m, "JSON nesting exceeds 128.");
2790
2793
  return;
2791
2794
  }
2792
- if (!(f === null || typeof f == "string" || typeof f == "boolean") && !(typeof f == "number" && Number.isFinite(f))) {
2793
- if (typeof f != "object" || f === null || p.has(f)) {
2794
- r("invalid-json", m, "Expected finite, acyclic JSON values.");
2795
+ if (!(p === null || typeof p == "string" || typeof p == "boolean") && !(typeof p == "number" && Number.isFinite(p))) {
2796
+ if (typeof p != "object" || p === null || f.has(p)) {
2797
+ typeof p == "object" && p !== null && f.has(p) && (y = !0), r("invalid-json", m, "Expected finite, acyclic JSON values.");
2795
2798
  return;
2796
2799
  }
2797
- if (!Array.isArray(f) && Object.getPrototypeOf(f) !== Object.prototype && Object.getPrototypeOf(f) !== null) {
2800
+ if (!Array.isArray(p) && Object.getPrototypeOf(p) !== Object.prototype && Object.getPrototypeOf(p) !== null) {
2798
2801
  r("invalid-json", m, "Expected a plain JSON object.");
2799
2802
  return;
2800
2803
  }
2801
- if (p.add(f), Array.isArray(f))
2802
- for (let b = 0; b < f.length; b++)
2803
- g(f[b], `${m}[${b}]`, y + 1);
2804
+ if (f.add(p), Array.isArray(p))
2805
+ for (let b = 0; b < p.length; b++)
2806
+ g(p[b], `${m}[${b}]`, v + 1);
2804
2807
  else
2805
- Object.entries(f).forEach(
2806
- ([b, v]) => g(v, `${m}.${b}`, y + 1)
2808
+ Object.entries(p).forEach(
2809
+ ([b, A]) => g(A, `${m}.${b}`, v + 1)
2807
2810
  );
2808
- p.delete(f);
2811
+ f.delete(p);
2809
2812
  }
2810
2813
  };
2811
- return g(i, "$", 0), Q(i) ? i.type === "FeatureCollection" ? (a(i, "$"), Array.isArray(i.features) ? i.features.forEach((f, m) => h(f, `$.features[${m}]`)) : r("invalid-collection", "$.features", "Expected a features array.")) : i.type === "Feature" ? h(i, "$") : (e = 1, d(i, "$", 0)) : r("invalid-input", "$", "Expected a GeoJSON object."), {
2812
- valid: !t.some((f) => f.severity === "error"),
2814
+ return g(i, "$", 0), y ? { valid: !1, featureCount: e, diagnostics: t } : (Q(i) ? i.type === "FeatureCollection" ? (a(i, "$"), Array.isArray(i.features) ? i.features.forEach((p, m) => h(p, `$.features[${m}]`)) : r("invalid-collection", "$.features", "Expected a features array.")) : i.type === "Feature" ? h(i, "$") : (e = 1, d(i, "$", 0)) : r("invalid-input", "$", "Expected a GeoJSON object."), {
2815
+ valid: !t.some((p) => p.severity === "error"),
2813
2816
  featureCount: e,
2814
2817
  diagnostics: t
2815
- };
2818
+ });
2816
2819
  }
2817
2820
  class Bt extends Error {
2818
- constructor(t) {
2819
- super("GeoJSON validation failed"), this.summary = t, this.name = "GeoJSONValidationError";
2821
+ constructor(e) {
2822
+ super("GeoJSON validation failed");
2823
+ w(this, "summary");
2824
+ this.summary = e, this.name = "GeoJSONValidationError";
2820
2825
  }
2821
2826
  }
2822
2827
  function Rt(i, t = {}) {
@@ -3219,67 +3224,67 @@ function Ri(i, t, e, o, r = {}, a) {
3219
3224
  if (!Number.isFinite(s) || s <= 0) return null;
3220
3225
  const l = e(i);
3221
3226
  let c = null;
3222
- const u = (p, g, f = {}, m) => {
3223
- const y = Ti(l, p);
3224
- if (y > s) return;
3225
- const b = n.indexOf(g), v = c ? n.indexOf(c.mode) : Number.MAX_SAFE_INTEGER;
3226
- c && (y > c.distancePx + 1e-3 || y >= c.distancePx - 1e-3 && b > v) || (c = {
3227
- latlng: m != null ? m : o(p),
3228
- point: p,
3229
- distancePx: y,
3230
- mode: g,
3231
- ...f
3227
+ const u = (f, y, g = {}, p) => {
3228
+ const m = Ti(l, f);
3229
+ if (m > s) return;
3230
+ const v = n.indexOf(y), b = c ? n.indexOf(c.mode) : Number.MAX_SAFE_INTEGER;
3231
+ c && (m > c.distancePx + 1e-3 || m >= c.distancePx - 1e-3 && v > b) || (c = {
3232
+ latlng: p != null ? p : o(f),
3233
+ point: f,
3234
+ distancePx: m,
3235
+ mode: y,
3236
+ ...g
3232
3237
  });
3233
3238
  };
3234
- for (const p of t) {
3235
- if (!p.visible || p.layerKind === "measurement" || p.featureId === a)
3239
+ for (const f of t) {
3240
+ if (!f.visible || f.layerKind === "measurement" || f.featureId === a)
3236
3241
  continue;
3237
- const g = p.layerKind === "guide" ? n.includes("guide") ? ["guide"] : [] : n.filter(
3238
- (f) => f === "vertex" || f === "edge"
3242
+ const y = f.layerKind === "guide" ? n.includes("guide") ? ["guide"] : [] : n.filter(
3243
+ (g) => g === "vertex" || g === "edge"
3239
3244
  );
3240
- for (const f of g)
3241
- f === "vertex" ? So(p.feature.geometry, (m) => {
3242
- const y = Ye(m);
3243
- y && u(
3244
- e({ lng: y[0], lat: y[1] }),
3245
- f,
3245
+ for (const g of y)
3246
+ g === "vertex" ? So(f.feature.geometry, (p) => {
3247
+ const m = Ye(p);
3248
+ m && u(
3249
+ e({ lng: m[0], lat: m[1] }),
3250
+ g,
3246
3251
  {
3247
- targetFeatureId: p.featureId,
3248
- targetLayerId: p.layerId
3252
+ targetFeatureId: f.featureId,
3253
+ targetLayerId: f.layerId
3249
3254
  },
3250
- { lng: y[0], lat: y[1] }
3255
+ { lng: m[0], lat: m[1] }
3251
3256
  );
3252
- }) : Io(p.feature.geometry, (m) => {
3253
- for (let y = 1; y < m.length; y++) {
3254
- const b = Ye(m[y - 1]), v = Ye(m[y]);
3255
- if (!b || !v) continue;
3256
- const A = e({ lng: b[0], lat: b[1] }), k = e({ lng: v[0], lat: v[1] }), x = _i(l, A, k), L = (k.x - A.x) ** 2 + (k.y - A.y) ** 2, E = L === 0 ? 0 : Math.max(
3257
+ }) : Io(f.feature.geometry, (p) => {
3258
+ for (let m = 1; m < p.length; m++) {
3259
+ const v = Ye(p[m - 1]), b = Ye(p[m]);
3260
+ if (!v || !b) continue;
3261
+ const A = e({ lng: v[0], lat: v[1] }), k = e({ lng: b[0], lat: b[1] }), x = _i(l, A, k), E = (k.x - A.x) ** 2 + (k.y - A.y) ** 2, L = E === 0 ? 0 : Math.max(
3257
3262
  0,
3258
3263
  Math.min(
3259
3264
  1,
3260
- ((x.x - A.x) * (k.x - A.x) + (x.y - A.y) * (k.y - A.y)) / L
3265
+ ((x.x - A.x) * (k.x - A.x) + (x.y - A.y) * (k.y - A.y)) / E
3261
3266
  )
3262
3267
  );
3263
3268
  u(
3264
3269
  x,
3265
- f,
3270
+ g,
3266
3271
  {
3267
- targetFeatureId: p.featureId,
3268
- targetLayerId: p.layerId
3272
+ targetFeatureId: f.featureId,
3273
+ targetLayerId: f.layerId
3269
3274
  },
3270
3275
  {
3271
- lng: b[0] + (v[0] - b[0]) * E,
3272
- lat: b[1] + (v[1] - b[1]) * E
3276
+ lng: v[0] + (b[0] - v[0]) * L,
3277
+ lat: v[1] + (b[1] - v[1]) * L
3273
3278
  }
3274
3279
  );
3275
3280
  }
3276
3281
  });
3277
3282
  }
3278
3283
  if (n.includes("grid") && Number.isFinite(r.gridSizeMeters) && ((h = r.gridSizeMeters) != null ? h : 0) > 0) {
3279
- const p = Bi(i, r);
3280
- if (p) {
3281
- const g = e(p);
3282
- u(g, "grid", {}, p);
3284
+ const f = Bi(i, r);
3285
+ if (f) {
3286
+ const y = e(f);
3287
+ u(y, "grid", {}, f);
3283
3288
  }
3284
3289
  }
3285
3290
  return c;
@@ -3342,30 +3347,30 @@ function Ut(i) {
3342
3347
  return !isNaN(i) && i !== null && !Array.isArray(i);
3343
3348
  }
3344
3349
  function Po(i, t) {
3345
- var e, o, r, a, n, s, l, c, u, d, h = 0, p = i.type === "FeatureCollection", g = i.type === "Feature", f = p ? i.features.length : 1;
3346
- for (e = 0; e < f; e++) {
3347
- for (s = p ? (
3350
+ var e, o, r, a, n, s, l, c, u, d, h = 0, f = i.type === "FeatureCollection", y = i.type === "Feature", g = f ? i.features.length : 1;
3351
+ for (e = 0; e < g; e++) {
3352
+ for (s = f ? (
3348
3353
  // @ts-expect-error: Known type conflict
3349
3354
  i.features[e].geometry
3350
- ) : g ? (
3355
+ ) : y ? (
3351
3356
  // @ts-expect-error: Known type conflict
3352
3357
  i.geometry
3353
- ) : i, c = p ? (
3358
+ ) : i, c = f ? (
3354
3359
  // @ts-expect-error: Known type conflict
3355
3360
  i.features[e].properties
3356
- ) : g ? (
3361
+ ) : y ? (
3357
3362
  // @ts-expect-error: Known type conflict
3358
3363
  i.properties
3359
- ) : {}, u = p ? (
3364
+ ) : {}, u = f ? (
3360
3365
  // @ts-expect-error: Known type conflict
3361
3366
  i.features[e].bbox
3362
- ) : g ? (
3367
+ ) : y ? (
3363
3368
  // @ts-expect-error: Known type conflict
3364
3369
  i.bbox
3365
- ) : void 0, d = p ? (
3370
+ ) : void 0, d = f ? (
3366
3371
  // @ts-expect-error: Known type conflict
3367
3372
  i.features[e].id
3368
- ) : g ? (
3373
+ ) : y ? (
3369
3374
  // @ts-expect-error: Known type conflict
3370
3375
  i.id
3371
3376
  ) : void 0, l = s ? s.type === "GeometryCollection" : !1, n = l ? s.geometries.length : 1, r = 0; r < n; r++) {
@@ -3569,15 +3574,15 @@ const J = 11102230246251565e-32, R = 134217729, Hi = (3 + 8 * J) * J;
3569
3574
  function We(i, t, e, o, r) {
3570
3575
  let a, n, s, l, c = t[0], u = o[0], d = 0, h = 0;
3571
3576
  u > c == u > -c ? (a = c, c = t[++d]) : (a = u, u = o[++h]);
3572
- let p = 0;
3577
+ let f = 0;
3573
3578
  if (d < i && h < e)
3574
- for (u > c == u > -c ? (n = c + a, s = a - (n - c), c = t[++d]) : (n = u + a, s = a - (n - u), u = o[++h]), a = n, s !== 0 && (r[p++] = s); d < i && h < e; )
3575
- u > c == u > -c ? (n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d]) : (n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h]), a = n, s !== 0 && (r[p++] = s);
3579
+ for (u > c == u > -c ? (n = c + a, s = a - (n - c), c = t[++d]) : (n = u + a, s = a - (n - u), u = o[++h]), a = n, s !== 0 && (r[f++] = s); d < i && h < e; )
3580
+ u > c == u > -c ? (n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d]) : (n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h]), a = n, s !== 0 && (r[f++] = s);
3576
3581
  for (; d < i; )
3577
- n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d], a = n, s !== 0 && (r[p++] = s);
3582
+ n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d], a = n, s !== 0 && (r[f++] = s);
3578
3583
  for (; h < e; )
3579
- n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h], a = n, s !== 0 && (r[p++] = s);
3580
- return (a !== 0 || p === 0) && (r[p++] = a), p;
3584
+ n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h], a = n, s !== 0 && (r[f++] = s);
3585
+ return (a !== 0 || f === 0) && (r[f++] = a), f;
3581
3586
  }
3582
3587
  function qi(i, t) {
3583
3588
  let e = t[0];
@@ -3589,16 +3594,16 @@ function ke(i) {
3589
3594
  }
3590
3595
  const Ji = (3 + 16 * J) * J, Vi = (2 + 12 * J) * J, ji = (9 + 64 * J) * J * J, oe = ke(4), Jt = ke(8), Vt = ke(12), jt = ke(16), z = ke(4);
3591
3596
  function Zi(i, t, e, o, r, a, n) {
3592
- let s, l, c, u, d, h, p, g, f, m, y, b, v, A, k, x, L, E;
3597
+ let s, l, c, u, d, h, f, y, g, p, m, v, b, A, k, x, E, L;
3593
3598
  const C = i - r, T = e - r, M = t - a, _ = o - a;
3594
- A = C * _, h = R * C, p = h - (h - C), g = C - p, h = R * _, f = h - (h - _), m = _ - f, k = g * m - (A - p * f - g * f - p * m), x = M * T, h = R * M, p = h - (h - M), g = M - p, h = R * T, f = h - (h - T), m = T - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, oe[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, oe[1] = v - (y + d) + (d - x), E = b + y, d = E - b, oe[2] = b - (E - d) + (y - d), oe[3] = E;
3599
+ A = C * _, h = R * C, f = h - (h - C), y = C - f, h = R * _, g = h - (h - _), p = _ - g, k = y * p - (A - f * g - y * g - f * p), x = M * T, h = R * M, f = h - (h - M), y = M - f, h = R * T, g = h - (h - T), p = T - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, oe[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, oe[1] = b - (m + d) + (d - x), L = v + m, d = L - v, oe[2] = v - (L - d) + (m - d), oe[3] = L;
3595
3600
  let I = qi(4, oe), S = Vi * n;
3596
3601
  if (I >= S || -I >= S || (d = i - C, s = i - (C + d) + (d - r), d = e - T, c = e - (T + d) + (d - r), d = t - M, l = t - (M + d) + (d - a), d = o - _, u = o - (_ + d) + (d - a), s === 0 && l === 0 && c === 0 && u === 0) || (S = ji * n + Hi * Math.abs(I), I += C * u + _ * s - (M * c + T * l), I >= S || -I >= S)) return I;
3597
- A = s * _, h = R * s, p = h - (h - s), g = s - p, h = R * _, f = h - (h - _), m = _ - f, k = g * m - (A - p * f - g * f - p * m), x = l * T, h = R * l, p = h - (h - l), g = l - p, h = R * T, f = h - (h - T), m = T - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, z[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, z[1] = v - (y + d) + (d - x), E = b + y, d = E - b, z[2] = b - (E - d) + (y - d), z[3] = E;
3602
+ A = s * _, h = R * s, f = h - (h - s), y = s - f, h = R * _, g = h - (h - _), p = _ - g, k = y * p - (A - f * g - y * g - f * p), x = l * T, h = R * l, f = h - (h - l), y = l - f, h = R * T, g = h - (h - T), p = T - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, z[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, z[1] = b - (m + d) + (d - x), L = v + m, d = L - v, z[2] = v - (L - d) + (m - d), z[3] = L;
3598
3603
  const F = We(4, oe, 4, z, Jt);
3599
- A = C * u, h = R * C, p = h - (h - C), g = C - p, h = R * u, f = h - (h - u), m = u - f, k = g * m - (A - p * f - g * f - p * m), x = M * c, h = R * M, p = h - (h - M), g = M - p, h = R * c, f = h - (h - c), m = c - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, z[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, z[1] = v - (y + d) + (d - x), E = b + y, d = E - b, z[2] = b - (E - d) + (y - d), z[3] = E;
3604
+ A = C * u, h = R * C, f = h - (h - C), y = C - f, h = R * u, g = h - (h - u), p = u - g, k = y * p - (A - f * g - y * g - f * p), x = M * c, h = R * M, f = h - (h - M), y = M - f, h = R * c, g = h - (h - c), p = c - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, z[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, z[1] = b - (m + d) + (d - x), L = v + m, d = L - v, z[2] = v - (L - d) + (m - d), z[3] = L;
3600
3605
  const te = We(F, Jt, 4, z, Vt);
3601
- A = s * u, h = R * s, p = h - (h - s), g = s - p, h = R * u, f = h - (h - u), m = u - f, k = g * m - (A - p * f - g * f - p * m), x = l * c, h = R * l, p = h - (h - l), g = l - p, h = R * c, f = h - (h - c), m = c - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, z[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, z[1] = v - (y + d) + (d - x), E = b + y, d = E - b, z[2] = b - (E - d) + (y - d), z[3] = E;
3606
+ A = s * u, h = R * s, f = h - (h - s), y = s - f, h = R * u, g = h - (h - u), p = u - g, k = y * p - (A - f * g - y * g - f * p), x = l * c, h = R * l, f = h - (h - l), y = l - f, h = R * c, g = h - (h - c), p = c - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, z[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, z[1] = b - (m + d) + (d - x), L = v + m, d = L - v, z[2] = v - (L - d) + (m - d), z[3] = L;
3602
3607
  const Ge = We(te, Vt, 4, z, jt);
3603
3608
  return jt[Ge - 1];
3604
3609
  }
@@ -3607,14 +3612,14 @@ function Ki(i, t, e, o, r, a) {
3607
3612
  return Math.abs(l) >= Ji * c ? l : -Zi(i, t, e, o, r, a, c);
3608
3613
  }
3609
3614
  function Yi(i, t) {
3610
- var e, o, r = 0, a, n, s, l, c, u, d, h = i[0], p = i[1], g = t.length;
3611
- for (e = 0; e < g; e++) {
3615
+ var e, o, r = 0, a, n, s, l, c, u, d, h = i[0], f = i[1], y = t.length;
3616
+ for (e = 0; e < y; e++) {
3612
3617
  o = 0;
3613
- var f = t[e], m = f.length - 1;
3614
- if (u = f[0], u[0] !== f[m][0] && u[1] !== f[m][1])
3618
+ var g = t[e], p = g.length - 1;
3619
+ if (u = g[0], u[0] !== g[p][0] && u[1] !== g[p][1])
3615
3620
  throw new Error("First and last coordinates in a ring must be the same");
3616
- for (n = u[0] - h, s = u[1] - p, o; o < m; o++) {
3617
- if (d = f[o + 1], l = d[0] - h, c = d[1] - p, s === 0 && c === 0) {
3621
+ for (n = u[0] - h, s = u[1] - f, o; o < p; o++) {
3622
+ if (d = g[o + 1], l = d[0] - h, c = d[1] - f, s === 0 && c === 0) {
3618
3623
  if (l <= 0 && n >= 0 || n <= 0 && l >= 0)
3619
3624
  return 0;
3620
3625
  } else if (c >= 0 && s <= 0 || c <= 0 && s >= 0) {
@@ -3690,15 +3695,15 @@ const V = 11102230246251565e-32, D = 134217729, Xi = (3 + 8 * V) * V;
3690
3695
  function Xe(i, t, e, o, r) {
3691
3696
  let a, n, s, l, c = t[0], u = o[0], d = 0, h = 0;
3692
3697
  u > c == u > -c ? (a = c, c = t[++d]) : (a = u, u = o[++h]);
3693
- let p = 0;
3698
+ let f = 0;
3694
3699
  if (d < i && h < e)
3695
- for (u > c == u > -c ? (n = c + a, s = a - (n - c), c = t[++d]) : (n = u + a, s = a - (n - u), u = o[++h]), a = n, s !== 0 && (r[p++] = s); d < i && h < e; )
3696
- u > c == u > -c ? (n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d]) : (n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h]), a = n, s !== 0 && (r[p++] = s);
3700
+ for (u > c == u > -c ? (n = c + a, s = a - (n - c), c = t[++d]) : (n = u + a, s = a - (n - u), u = o[++h]), a = n, s !== 0 && (r[f++] = s); d < i && h < e; )
3701
+ u > c == u > -c ? (n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d]) : (n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h]), a = n, s !== 0 && (r[f++] = s);
3697
3702
  for (; d < i; )
3698
- n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d], a = n, s !== 0 && (r[p++] = s);
3703
+ n = a + c, l = n - a, s = a - (n - l) + (c - l), c = t[++d], a = n, s !== 0 && (r[f++] = s);
3699
3704
  for (; h < e; )
3700
- n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h], a = n, s !== 0 && (r[p++] = s);
3701
- return (a !== 0 || p === 0) && (r[p++] = a), p;
3705
+ n = a + u, l = n - a, s = a - (n - l) + (u - l), u = o[++h], a = n, s !== 0 && (r[f++] = s);
3706
+ return (a !== 0 || f === 0) && (r[f++] = a), f;
3702
3707
  }
3703
3708
  function $i(i, t) {
3704
3709
  let e = t[0];
@@ -3710,16 +3715,16 @@ function xe(i) {
3710
3715
  }
3711
3716
  const ea = (3 + 16 * V) * V, ta = (2 + 12 * V) * V, oa = (9 + 64 * V) * V * V, re = xe(4), Zt = xe(8), Kt = xe(12), Yt = xe(16), N = xe(4);
3712
3717
  function ra(i, t, e, o, r, a, n) {
3713
- let s, l, c, u, d, h, p, g, f, m, y, b, v, A, k, x, L, E;
3718
+ let s, l, c, u, d, h, f, y, g, p, m, v, b, A, k, x, E, L;
3714
3719
  const C = i - r, T = e - r, M = t - a, _ = o - a;
3715
- A = C * _, h = D * C, p = h - (h - C), g = C - p, h = D * _, f = h - (h - _), m = _ - f, k = g * m - (A - p * f - g * f - p * m), x = M * T, h = D * M, p = h - (h - M), g = M - p, h = D * T, f = h - (h - T), m = T - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, re[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, re[1] = v - (y + d) + (d - x), E = b + y, d = E - b, re[2] = b - (E - d) + (y - d), re[3] = E;
3720
+ A = C * _, h = D * C, f = h - (h - C), y = C - f, h = D * _, g = h - (h - _), p = _ - g, k = y * p - (A - f * g - y * g - f * p), x = M * T, h = D * M, f = h - (h - M), y = M - f, h = D * T, g = h - (h - T), p = T - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, re[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, re[1] = b - (m + d) + (d - x), L = v + m, d = L - v, re[2] = v - (L - d) + (m - d), re[3] = L;
3716
3721
  let I = $i(4, re), S = ta * n;
3717
3722
  if (I >= S || -I >= S || (d = i - C, s = i - (C + d) + (d - r), d = e - T, c = e - (T + d) + (d - r), d = t - M, l = t - (M + d) + (d - a), d = o - _, u = o - (_ + d) + (d - a), s === 0 && l === 0 && c === 0 && u === 0) || (S = oa * n + Xi * Math.abs(I), I += C * u + _ * s - (M * c + T * l), I >= S || -I >= S)) return I;
3718
- A = s * _, h = D * s, p = h - (h - s), g = s - p, h = D * _, f = h - (h - _), m = _ - f, k = g * m - (A - p * f - g * f - p * m), x = l * T, h = D * l, p = h - (h - l), g = l - p, h = D * T, f = h - (h - T), m = T - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, N[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, N[1] = v - (y + d) + (d - x), E = b + y, d = E - b, N[2] = b - (E - d) + (y - d), N[3] = E;
3723
+ A = s * _, h = D * s, f = h - (h - s), y = s - f, h = D * _, g = h - (h - _), p = _ - g, k = y * p - (A - f * g - y * g - f * p), x = l * T, h = D * l, f = h - (h - l), y = l - f, h = D * T, g = h - (h - T), p = T - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, N[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, N[1] = b - (m + d) + (d - x), L = v + m, d = L - v, N[2] = v - (L - d) + (m - d), N[3] = L;
3719
3724
  const F = Xe(4, re, 4, N, Zt);
3720
- A = C * u, h = D * C, p = h - (h - C), g = C - p, h = D * u, f = h - (h - u), m = u - f, k = g * m - (A - p * f - g * f - p * m), x = M * c, h = D * M, p = h - (h - M), g = M - p, h = D * c, f = h - (h - c), m = c - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, N[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, N[1] = v - (y + d) + (d - x), E = b + y, d = E - b, N[2] = b - (E - d) + (y - d), N[3] = E;
3725
+ A = C * u, h = D * C, f = h - (h - C), y = C - f, h = D * u, g = h - (h - u), p = u - g, k = y * p - (A - f * g - y * g - f * p), x = M * c, h = D * M, f = h - (h - M), y = M - f, h = D * c, g = h - (h - c), p = c - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, N[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, N[1] = b - (m + d) + (d - x), L = v + m, d = L - v, N[2] = v - (L - d) + (m - d), N[3] = L;
3721
3726
  const te = Xe(F, Zt, 4, N, Kt);
3722
- A = s * u, h = D * s, p = h - (h - s), g = s - p, h = D * u, f = h - (h - u), m = u - f, k = g * m - (A - p * f - g * f - p * m), x = l * c, h = D * l, p = h - (h - l), g = l - p, h = D * c, f = h - (h - c), m = c - f, L = g * m - (x - p * f - g * f - p * m), y = k - L, d = k - y, N[0] = k - (y + d) + (d - L), b = A + y, d = b - A, v = A - (b - d) + (y - d), y = v - x, d = v - y, N[1] = v - (y + d) + (d - x), E = b + y, d = E - b, N[2] = b - (E - d) + (y - d), N[3] = E;
3727
+ A = s * u, h = D * s, f = h - (h - s), y = s - f, h = D * u, g = h - (h - u), p = u - g, k = y * p - (A - f * g - y * g - f * p), x = l * c, h = D * l, f = h - (h - l), y = l - f, h = D * c, g = h - (h - c), p = c - g, E = y * p - (x - f * g - y * g - f * p), m = k - E, d = k - m, N[0] = k - (m + d) + (d - E), v = A + m, d = v - A, b = A - (v - d) + (m - d), m = b - x, d = b - m, N[1] = b - (m + d) + (d - x), L = v + m, d = L - v, N[2] = v - (L - d) + (m - d), N[3] = L;
3723
3728
  const Ge = Xe(te, Kt, 4, N, Yt);
3724
3729
  return Yt[Ge - 1];
3725
3730
  }
@@ -3820,13 +3825,13 @@ function ca(i, t) {
3820
3825
  if (i.leftSweepEvent.isSamePoint(t.rightSweepEvent))
3821
3826
  return t.rightSweepEvent.asNewXY();
3822
3827
  }
3823
- const h = (c - s) * (r - e) - (l - n) * (a - o), p = (l - n) * (o - s) - (c - s) * (e - n), g = (r - e) * (o - s) - (a - o) * (e - n);
3828
+ const h = (c - s) * (r - e) - (l - n) * (a - o), f = (l - n) * (o - s) - (c - s) * (e - n), y = (r - e) * (o - s) - (a - o) * (e - n);
3824
3829
  if (h === 0)
3825
3830
  return !1;
3826
- const f = p / h, m = g / h;
3827
- if (f >= 0 && f <= 1 && m >= 0 && m <= 1) {
3828
- const y = e + f * (r - e), b = o + f * (a - o);
3829
- return [y, b];
3831
+ const g = f / h, p = y / h;
3832
+ if (g >= 0 && g <= 1 && p >= 0 && p <= 1) {
3833
+ const m = e + g * (r - e), v = o + g * (a - o);
3834
+ return [m, v];
3830
3835
  }
3831
3836
  return !1;
3832
3837
  }
@@ -4112,22 +4117,22 @@ function bt(i, t, e = {}) {
4112
4117
  return !1;
4113
4118
  }
4114
4119
  function wa(i, t, e, o, r) {
4115
- const a = e[0], n = e[1], s = i[0], l = i[1], c = t[0], u = t[1], d = e[0] - s, h = e[1] - l, p = c - s, g = u - l, f = d * g - h * p;
4120
+ const a = e[0], n = e[1], s = i[0], l = i[1], c = t[0], u = t[1], d = e[0] - s, h = e[1] - l, f = c - s, y = u - l, g = d * y - h * f;
4116
4121
  if (r !== null) {
4117
- if (Math.abs(f) > r)
4122
+ if (Math.abs(g) > r)
4118
4123
  return !1;
4119
- } else if (f !== 0)
4124
+ } else if (g !== 0)
4120
4125
  return !1;
4121
- if (Math.abs(p) === Math.abs(g) && Math.abs(p) === 0)
4126
+ if (Math.abs(f) === Math.abs(y) && Math.abs(f) === 0)
4122
4127
  return o ? !1 : e[0] === i[0] && e[1] === i[1];
4123
4128
  if (o) {
4124
4129
  if (o === "start")
4125
- return Math.abs(p) >= Math.abs(g) ? p > 0 ? s < a && a <= c : c <= a && a < s : g > 0 ? l < n && n <= u : u <= n && n < l;
4130
+ return Math.abs(f) >= Math.abs(y) ? f > 0 ? s < a && a <= c : c <= a && a < s : y > 0 ? l < n && n <= u : u <= n && n < l;
4126
4131
  if (o === "end")
4127
- return Math.abs(p) >= Math.abs(g) ? p > 0 ? s <= a && a < c : c < a && a <= s : g > 0 ? l <= n && n < u : u < n && n <= l;
4132
+ return Math.abs(f) >= Math.abs(y) ? f > 0 ? s <= a && a < c : c < a && a <= s : y > 0 ? l <= n && n < u : u < n && n <= l;
4128
4133
  if (o === "both")
4129
- return Math.abs(p) >= Math.abs(g) ? p > 0 ? s < a && a < c : c < a && a < s : g > 0 ? l < n && n < u : u < n && n < l;
4130
- } else return Math.abs(p) >= Math.abs(g) ? p > 0 ? s <= a && a <= c : c <= a && a <= s : g > 0 ? l <= n && n <= u : u <= n && n <= l;
4134
+ return Math.abs(f) >= Math.abs(y) ? f > 0 ? s < a && a < c : c < a && a < s : y > 0 ? l < n && n < u : u < n && n < l;
4135
+ } else return Math.abs(f) >= Math.abs(y) ? f > 0 ? s <= a && a <= c : c <= a && a <= s : y > 0 ? l <= n && n <= u : u <= n && n <= l;
4131
4136
  return !1;
4132
4137
  }
4133
4138
  function to(i, t = {}) {
@@ -4388,13 +4393,13 @@ function Ca(i) {
4388
4393
  }
4389
4394
  function Ma(i, t, e, o, r, a, n, s) {
4390
4395
  let l, c, u, d, h;
4391
- const p = {
4396
+ const f = {
4392
4397
  x: null,
4393
4398
  y: null,
4394
4399
  onLine1: !1,
4395
4400
  onLine2: !1
4396
4401
  };
4397
- return l = (s - a) * (e - i) - (n - r) * (o - t), l === 0 ? p.x !== null && p.y !== null ? p : !1 : (c = t - a, u = i - r, d = (n - r) * c - (s - a) * u, h = (e - i) * c - (o - t) * u, c = d / l, u = h / l, p.x = i + c * (e - i), p.y = t + c * (o - t), c >= 0 && c <= 1 && (p.onLine1 = !0), u >= 0 && u <= 1 && (p.onLine2 = !0), p.onLine1 && p.onLine2 ? [p.x, p.y] : !1);
4402
+ return l = (s - a) * (e - i) - (n - r) * (o - t), l === 0 ? f.x !== null && f.y !== null ? f : !1 : (c = t - a, u = i - r, d = (n - r) * c - (s - a) * u, h = (e - i) * c - (o - t) * u, c = d / l, u = h / l, f.x = i + c * (e - i), f.y = t + c * (o - t), c >= 0 && c <= 1 && (f.onLine1 = !0), u >= 0 && u <= 1 && (f.onLine2 = !0), f.onLine1 && f.onLine2 ? [f.x, f.y] : !1);
4398
4403
  }
4399
4404
  const Ta = 3.280839895013123, _a = 10.763910416709722, lo = 1609.344, co = 4046.8564224, uo = 1e4, At = (i) => ({
4400
4405
  ok: !0,
@@ -4943,7 +4948,7 @@ class Ga {
4943
4948
  return this.executeToolCommand(o, e, t, !1, t);
4944
4949
  }
4945
4950
  executeToolCommand(t, e, o, r, a) {
4946
- var c, u, d, h, p, g, f, m, y, b, v, A, k;
4951
+ var c, u, d, h, f, y, g, p, m, v, b, A, k;
4947
4952
  const n = this.beginToolCommand(
4948
4953
  t,
4949
4954
  e,
@@ -4953,8 +4958,8 @@ class Ga {
4953
4958
  );
4954
4959
  delete this.toolErrors[t];
4955
4960
  const s = (u = (c = this.toolButtonConfig) == null ? void 0 : c[t]) == null ? void 0 : u.requirements, l = this.getToolCapabilities().tools[t];
4956
- if (e !== "deactivate" && (((d = l == null ? void 0 : l.reason) == null ? void 0 : d.code) === "missing_attribute" || ((h = l == null ? void 0 : l.reason) == null ? void 0 : h.code) === "no_editable_layers" || this.options.readOnly && ((p = Oe[t]) != null && p.mutates) || s != null && s.selection && this.getToolCapabilities().selectedFeatureIds.length === 0 || s != null && s.provider && this.toolProvider.state !== "enabled")) {
4957
- const x = `Tool "${t}" is not available: ${(f = (g = l == null ? void 0 : l.reason) == null ? void 0 : g.message) != null ? f : "Tool requirements are not met"}`;
4961
+ if (e !== "deactivate" && (((d = l == null ? void 0 : l.reason) == null ? void 0 : d.code) === "missing_attribute" || ((h = l == null ? void 0 : l.reason) == null ? void 0 : h.code) === "no_editable_layers" || this.options.readOnly && ((f = Oe[t]) != null && f.mutates) || s != null && s.selection && this.getToolCapabilities().selectedFeatureIds.length === 0 || s != null && s.provider && this.toolProvider.state !== "enabled")) {
4962
+ const x = `Tool "${t}" is not available: ${(g = (y = l == null ? void 0 : l.reason) == null ? void 0 : y.message) != null ? g : "Tool requirements are not met"}`;
4958
4963
  return this.failToolCommand(n, x), this.emitToolTrigger({
4959
4964
  tool: t,
4960
4965
  source: n.source,
@@ -4966,8 +4971,8 @@ class Ga {
4966
4971
  }
4967
4972
  try {
4968
4973
  if (e === "deactivate" || t === "select") {
4969
- const L = (m = this.activeToolCommand) == null ? void 0 : m.tool;
4970
- return this.cancelActiveTool("Deactivated by select command"), this.disablePhysicalTool(L), this.toggleMeasurementModal(!1), this.emitToolLifecycle("leaflet-geokit:tool-completed", n, {
4974
+ const E = (p = this.activeToolCommand) == null ? void 0 : p.tool;
4975
+ return this.cancelActiveTool("Deactivated by select command"), this.disablePhysicalTool(E), this.toggleMeasurementModal(!1), this.emitToolLifecycle("leaflet-geokit:tool-completed", n, {
4971
4976
  activeTool: null
4972
4977
  }), this.emitToolTrigger({
4973
4978
  tool: "select",
@@ -4978,16 +4983,16 @@ class Ga {
4978
4983
  }), !0;
4979
4984
  }
4980
4985
  if (t === "save") {
4981
- const L = this.store.toFeatureCollection(), E = L.features.map((C) => H(C)).filter((C) => !!C);
4982
- return (b = (y = this.options.callbacks) == null ? void 0 : y.onSaved) == null || b.call(y, {
4983
- geoJSON: L,
4984
- featureCount: L.features.length
4986
+ const E = this.store.toFeatureCollection(), L = E.features.map((C) => H(C)).filter((C) => !!C);
4987
+ return (v = (m = this.options.callbacks) == null ? void 0 : m.onSaved) == null || v.call(m, {
4988
+ geoJSON: E,
4989
+ featureCount: E.features.length
4985
4990
  }), this.emitToolEvent("tool:save", {
4986
- geoJSON: L,
4987
- featureCount: L.features.length
4991
+ geoJSON: E,
4992
+ featureCount: E.features.length
4988
4993
  }), this.emitToolLifecycle("leaflet-geokit:tool-completed", n, {
4989
- featureIds: E,
4990
- geometry: L
4994
+ featureIds: L,
4995
+ geometry: E
4991
4996
  }), this.emitToolTrigger({
4992
4997
  tool: t,
4993
4998
  source: n.source,
@@ -5000,13 +5005,13 @@ class Ga {
5000
5005
  if (t === "measurementSettings")
5001
5006
  this.toggleMeasurementModal(!0);
5002
5007
  else {
5003
- (v = this.closeLayerStylePanel) == null || v.call(this);
5004
- const L = { layers: this.getLayers() };
5005
- (k = (A = this.options.callbacks) == null ? void 0 : A.onLayerStyleRequested) != null && k.call(A, L) || (this.closeLayerStylePanel = Er(
5008
+ (b = this.closeLayerStylePanel) == null || b.call(this);
5009
+ const E = { layers: this.getLayers() };
5010
+ (k = (A = this.options.callbacks) == null ? void 0 : A.onLayerStyleRequested) != null && k.call(A, E) || (this.closeLayerStylePanel = Er(
5006
5011
  this.container,
5007
- L.layers,
5008
- (E, C) => {
5009
- this.setLayerStyle(E, C);
5012
+ E.layers,
5013
+ (L, C) => {
5014
+ this.setLayerStyle(L, C);
5010
5015
  }
5011
5016
  ));
5012
5017
  }
@@ -5020,25 +5025,25 @@ class Ga {
5020
5025
  }
5021
5026
  if (t === "ruler") {
5022
5027
  if (!this.canTriggerRulerTool()) {
5023
- const E = "Ruler control is not available";
5024
- return this.failToolCommand(n, E), this.emitToolTrigger({
5028
+ const L = "Ruler control is not available";
5029
+ return this.failToolCommand(n, L), this.emitToolTrigger({
5025
5030
  tool: t,
5026
5031
  source: n.source,
5027
5032
  groupId: n.groupId,
5028
5033
  commandId: n.commandId,
5029
5034
  handled: !1,
5030
- error: E
5035
+ error: L
5031
5036
  }), !1;
5032
5037
  }
5033
5038
  if (this.preparePersistentTool(n), !this.triggerRulerTool()) {
5034
- const E = "Ruler control is not available";
5035
- return this.failToolCommand(n, E), this.emitToolTrigger({
5039
+ const L = "Ruler control is not available";
5040
+ return this.failToolCommand(n, L), this.emitToolTrigger({
5036
5041
  tool: t,
5037
5042
  source: n.source,
5038
5043
  groupId: n.groupId,
5039
5044
  commandId: n.commandId,
5040
5045
  handled: !1,
5041
- error: E
5046
+ error: L
5042
5047
  }), !1;
5043
5048
  }
5044
5049
  return this.startPersistentTool(n), this.emitToolTrigger({
@@ -5051,25 +5056,25 @@ class Ga {
5051
5056
  }
5052
5057
  const x = this.findLeafletDrawHandler(t);
5053
5058
  if (!x || typeof x.enable != "function") {
5054
- const L = `Tool "${t}" is not available on this map`;
5055
- return this.failToolCommand(n, L), this.emitToolTrigger({
5059
+ const E = `Tool "${t}" is not available on this map`;
5060
+ return this.failToolCommand(n, E), this.emitToolTrigger({
5056
5061
  tool: t,
5057
5062
  source: n.source,
5058
5063
  groupId: n.groupId,
5059
5064
  commandId: n.commandId,
5060
5065
  handled: !1,
5061
- error: L
5066
+ error: E
5062
5067
  }), !1;
5063
5068
  }
5064
5069
  if (this.preparePersistentTool(n), this.pendingToolCommand = n, x.enable(), this.pendingToolCommand = null, typeof x.enabled == "function" && x.enabled() === !1) {
5065
- const L = `Tool "${t}" could not be started`;
5066
- return this.failToolCommand(n, L), this.emitToolTrigger({
5070
+ const E = `Tool "${t}" could not be started`;
5071
+ return this.failToolCommand(n, E), this.emitToolTrigger({
5067
5072
  tool: t,
5068
5073
  source: n.source,
5069
5074
  groupId: n.groupId,
5070
5075
  commandId: n.commandId,
5071
5076
  handled: !1,
5072
- error: L
5077
+ error: E
5073
5078
  }), !1;
5074
5079
  }
5075
5080
  return this.startPersistentTool(n), this.emitToolTrigger({
@@ -5081,14 +5086,14 @@ class Ga {
5081
5086
  }), !0;
5082
5087
  } catch (x) {
5083
5088
  this.pendingToolCommand = null;
5084
- const L = e === "deactivate" ? "Failed to deactivate active map tools" : "Failed to activate tool " + t, E = x instanceof Error ? x.message : L;
5085
- return this.toolErrors[t] = E, this._error(L, x), this.failToolCommand(n, E), this.emitToolTrigger({
5089
+ const E = e === "deactivate" ? "Failed to deactivate active map tools" : "Failed to activate tool " + t, L = x instanceof Error ? x.message : E;
5090
+ return this.toolErrors[t] = L, this._error(E, x), this.failToolCommand(n, L), this.emitToolTrigger({
5086
5091
  tool: t,
5087
5092
  source: n.source,
5088
5093
  groupId: n.groupId,
5089
5094
  commandId: n.commandId,
5090
5095
  handled: !1,
5091
- error: E
5096
+ error: L
5092
5097
  }), !1;
5093
5098
  }
5094
5099
  }
@@ -5132,46 +5137,46 @@ class Ga {
5132
5137
  zoom: u,
5133
5138
  minZoom: d,
5134
5139
  maxZoom: h,
5135
- tileUrl: p,
5136
- tileAttribution: g,
5137
- preferCanvas: f = !0,
5140
+ tileUrl: f,
5141
+ tileAttribution: y,
5142
+ preferCanvas: g = !0,
5138
5143
  // Default to Canvas rendering for better performance
5139
- useExternalLeaflet: m
5140
- } = this.options.map, y = [l, c], b = this.L;
5141
- m && Ze(b, {
5142
- onError: (L) => this.logger.warn("external-leaflet-missing-draw", { message: L })
5143
- }), this.map = b.map(this.container, {
5144
+ useExternalLeaflet: p
5145
+ } = this.options.map, m = [l, c], v = this.L;
5146
+ p && Ze(v, {
5147
+ onError: (E) => this.logger.warn("external-leaflet-missing-draw", { message: E })
5148
+ }), this.map = v.map(this.container, {
5144
5149
  zoomControl: !0,
5145
5150
  minZoom: d,
5146
- preferCanvas: f
5147
- }).setView(y, u), this.setTileLayer(
5151
+ preferCanvas: g
5152
+ }).setView(m, u), this.setTileLayer(
5148
5153
  {
5149
- urlTemplate: p,
5150
- attribution: g != null ? g : "",
5154
+ urlTemplate: f,
5155
+ attribution: y != null ? y : "",
5151
5156
  maxZoom: h
5152
5157
  },
5153
5158
  {
5154
- onTileError: (L) => {
5155
- var E, C;
5156
- (C = (E = this.options.callbacks) == null ? void 0 : E.onTileError) == null || C.call(E, L);
5159
+ onTileError: (E) => {
5160
+ var L, C;
5161
+ (C = (L = this.options.callbacks) == null ? void 0 : L.onTileError) == null || C.call(L, E);
5157
5162
  }
5158
5163
  }
5159
- ), this.drawnItems = b.featureGroup().addTo(this.map), this.drawnItems.on(
5164
+ ), this.drawnItems = v.featureGroup().addTo(this.map), this.drawnItems.on(
5160
5165
  "layeradd layerremove",
5161
5166
  () => this.notifyToolCapabilities()
5162
5167
  );
5163
- const v = this.buildDrawOptions(
5168
+ const b = this.buildDrawOptions(
5164
5169
  this.options.controls,
5165
5170
  !!this.options.readOnly
5166
- ), A = b.Control.Draw;
5167
- this.drawControl = new A(v), this.map.addControl(this.drawControl), this.applyLayerCakeToolbarIcon(), this.applyMoveToolbarIcon(), this.restoreVisibleLayersFromStore(), this.options.controls.ruler && (this.logger.debug("init:ruler", {
5168
- available: typeof b.control.ruler == "function"
5169
- }), typeof b.control.ruler == "function" ? (this.addRulerControl(), this.installMeasurementSettingsControl()) : this.logger.warn("init:ruler:missing", {
5171
+ ), A = v.Control.Draw;
5172
+ this.drawControl = new A(b), this.map.addControl(this.drawControl), this.applyLayerCakeToolbarIcon(), this.applyMoveToolbarIcon(), this.restoreVisibleLayersFromStore(), this.options.controls.ruler && (this.logger.debug("init:ruler", {
5173
+ available: typeof v.control.ruler == "function"
5174
+ }), typeof v.control.ruler == "function" ? (this.addRulerControl(), this.installMeasurementSettingsControl()) : this.logger.warn("init:ruler:missing", {
5170
5175
  msg: "L.control.ruler is not defined"
5171
5176
  })), this.applyToolButtonCustomizations(), this.patchLeafletDrawBugs(), this.installPolygonFinishPatch(), this.installVertexEditSurfaceMenu(), this.map.invalidateSize(), setTimeout(() => {
5172
- var L;
5177
+ var E;
5173
5178
  try {
5174
- (L = this.map) == null || L.invalidateSize();
5179
+ (E = this.map) == null || E.invalidateSize();
5175
5180
  } catch {
5176
5181
  }
5177
5182
  }, 0), this.bindDrawEvents(), this.installInteractionIntegrations();
@@ -5236,8 +5241,8 @@ class Ga {
5236
5241
  continue;
5237
5242
  }
5238
5243
  for (const h of d.featureIds) {
5239
- const p = this.featureLayers.get(h);
5240
- p && (d.visible ? this.drawnItems.addLayer(p) : this.drawnItems.removeLayer(p), (r = p.setStyle) == null || r.call(p, d.style), (n = p.setOpacity) == null || n.call(p, (a = d.style.opacity) != null ? a : 1), d.visible && ((s = p.bringToFront) == null || s.call(p)), (l = p.setZIndexOffset) == null || l.call(p, d.order * 100));
5244
+ const f = this.featureLayers.get(h);
5245
+ f && (d.visible ? this.drawnItems.addLayer(f) : this.drawnItems.removeLayer(f), (r = f.setStyle) == null || r.call(f, d.style), (n = f.setOpacity) == null || n.call(f, (a = d.style.opacity) != null ? a : 1), d.visible && ((s = f.bringToFront) == null || s.call(f)), (l = f.setZIndexOffset) == null || l.call(f, d.order * 100));
5241
5246
  }
5242
5247
  }
5243
5248
  (u = (c = this.options.callbacks) == null ? void 0 : c.onLayerEvent) == null || u.call(c, "leaflet-geokit:layers-changed", {
@@ -5730,7 +5735,7 @@ class Ga {
5730
5735
  });
5731
5736
  }
5732
5737
  findLeafletDrawHandler(t) {
5733
- var n, s, l, c, u, d, h, p, g, f;
5738
+ var n, s, l, c, u, d, h, f, y, g;
5734
5739
  const e = {
5735
5740
  polygon: "polygon",
5736
5741
  polyline: "polyline",
@@ -5746,7 +5751,7 @@ class Ga {
5746
5751
  if (r)
5747
5752
  return (u = (c = (l = (s = (n = this.drawControl) == null ? void 0 : n._toolbars) == null ? void 0 : s.draw) == null ? void 0 : l._modes) == null ? void 0 : c[r]) == null ? void 0 : u.handler;
5748
5753
  const a = o[t];
5749
- return a ? (f = (g = (p = (h = (d = this.drawControl) == null ? void 0 : d._toolbars) == null ? void 0 : h.edit) == null ? void 0 : p._modes) == null ? void 0 : g[a]) == null ? void 0 : f.handler : null;
5754
+ return a ? (g = (y = (f = (h = (d = this.drawControl) == null ? void 0 : d._toolbars) == null ? void 0 : h.edit) == null ? void 0 : f._modes) == null ? void 0 : y[a]) == null ? void 0 : g.handler : null;
5750
5755
  }
5751
5756
  disableActiveToolHandlers() {
5752
5757
  var e;
@@ -5833,8 +5838,8 @@ class Ga {
5833
5838
  c.lng,
5834
5839
  u.lat,
5835
5840
  u.lng
5836
- ), p = d / 1e3, g = typeof ((l = (s = this.options) == null ? void 0 : s.lengthUnit) == null ? void 0 : l.factor) == "number" ? this.options.lengthUnit.factor : 1, f = ht(p * g);
5837
- this._result = this._result || {}, this._result.Distance = f, this._result.Bearing = h, this._result.meters = d;
5841
+ ), f = d / 1e3, y = typeof ((l = (s = this.options) == null ? void 0 : s.lengthUnit) == null ? void 0 : l.factor) == "number" ? this.options.lengthUnit.factor : 1, g = ht(f * y);
5842
+ this._result = this._result || {}, this._result.Distance = g, this._result.Bearing = h, this._result.meters = d;
5838
5843
  } catch (c) {
5839
5844
  r == null || r.warn("ruler:precision-patch", c);
5840
5845
  }
@@ -5967,16 +5972,16 @@ class Ga {
5967
5972
  const t = this.map, e = (l = (s = this.drawControl) == null ? void 0 : s._toolbars) == null ? void 0 : l.draw;
5968
5973
  if (!e || !!!((u = (c = e._modes) == null ? void 0 : c.polygon) != null && u.handler)) return;
5969
5974
  const r = 10, a = (d) => {
5970
- var h, p, g, f, m, y, b, v;
5975
+ var h, f, y, g, p, m, v, b;
5971
5976
  try {
5972
- const A = (p = (h = e._modes) == null ? void 0 : h.polygon) == null ? void 0 : p.handler;
5977
+ const A = (f = (h = e._modes) == null ? void 0 : h.polygon) == null ? void 0 : f.handler;
5973
5978
  if (!A || !A._enabled) return;
5974
5979
  const k = A._markers;
5975
5980
  if (!Array.isArray(k) || k.length < 3) return;
5976
- const x = (f = (g = k[0]) == null ? void 0 : g.getLatLng) == null ? void 0 : f.call(g);
5981
+ const x = (g = (y = k[0]) == null ? void 0 : y.getLatLng) == null ? void 0 : g.call(y);
5977
5982
  if (!x) return;
5978
- const L = t.latLngToContainerPoint(x), E = t.latLngToContainerPoint(d.latlng);
5979
- Math.hypot(L.x - E.x, L.y - E.y) <= r && typeof A._finishShape == "function" && ((y = (m = d.originalEvent) == null ? void 0 : m.preventDefault) == null || y.call(m), (v = (b = d.originalEvent) == null ? void 0 : b.stopPropagation) == null || v.call(b), A._finishShape());
5983
+ const E = t.latLngToContainerPoint(x), L = t.latLngToContainerPoint(d.latlng);
5984
+ Math.hypot(E.x - L.x, E.y - L.y) <= r && typeof A._finishShape == "function" && ((m = (p = d.originalEvent) == null ? void 0 : p.preventDefault) == null || m.call(p), (b = (v = d.originalEvent) == null ? void 0 : v.stopPropagation) == null || b.call(v), A._finishShape());
5980
5985
  } catch (A) {
5981
5986
  this._error("polygon-finish-patch", A);
5982
5987
  }
@@ -6004,16 +6009,16 @@ class Ga {
6004
6009
  nm: 2
6005
6010
  }, c = (e = (t = s.formattedNumber) == null ? void 0 : t.bind(s)) != null ? e : ((u, d) => Number(u).toFixed(d));
6006
6011
  s.readableArea = (u, d, h) => {
6007
- var f;
6008
- const p = (f = n.Util) != null && f.extend ? n.Util.extend({}, l, h || {}) : { ...l, ...h || {} };
6009
- let g;
6012
+ var g;
6013
+ const f = (g = n.Util) != null && g.extend ? n.Util.extend({}, l, h || {}) : { ...l, ...h || {} };
6014
+ let y;
6010
6015
  if (d) {
6011
- let m = ["ha", "m"];
6012
- const y = typeof d;
6013
- y === "string" ? m = [d] : y !== "boolean" && (m = Array.isArray(d) ? d : m), u >= 1e6 && m.indexOf("km") !== -1 ? g = `${c(1e-6 * u, p.km)} km²` : u >= 1e4 && m.indexOf("ha") !== -1 ? g = `${c(1e-4 * u, p.ha)} ha` : g = `${c(u, p.m)} m²`;
6016
+ let p = ["ha", "m"];
6017
+ const m = typeof d;
6018
+ m === "string" ? p = [d] : m !== "boolean" && (p = Array.isArray(d) ? d : p), u >= 1e6 && p.indexOf("km") !== -1 ? y = `${c(1e-6 * u, f.km)} km²` : u >= 1e4 && p.indexOf("ha") !== -1 ? y = `${c(1e-4 * u, f.ha)} ha` : y = `${c(u, f.m)} m²`;
6014
6019
  } else
6015
- u = u / 0.836127, u >= 3097600 ? g = `${c(u / 3097600, p.mi)} mi²` : u >= 4840 ? g = `${c(u / 4840, p.ac)} acres` : g = `${c(u, p.yd)} yd²`;
6016
- return g;
6020
+ u = u / 0.836127, u >= 3097600 ? y = `${c(u / 3097600, f.mi)} mi²` : u >= 4840 ? y = `${c(u / 4840, f.ac)} acres` : y = `${c(u, f.yd)} yd²`;
6021
+ return y;
6017
6022
  };
6018
6023
  } catch (n) {
6019
6024
  this.logger.warn("leaflet-draw-patch:readableArea", n);
@@ -6022,14 +6027,14 @@ class Ga {
6022
6027
  const n = this.L, s = (o = n.Edit) == null ? void 0 : o.Circle, l = (r = n.Draw) == null ? void 0 : r.Event, c = n.GeometryUtil;
6023
6028
  if (!((a = s == null ? void 0 : s.prototype) != null && a._resize) || !l || !c) return;
6024
6029
  s.prototype._resize = function(d) {
6025
- var g, f, m;
6026
- const h = this._moveMarker.getLatLng(), p = c.isVersion07x() ? h.distanceTo(d) : this._map.distance(h, d);
6027
- this._shape.setRadius(p);
6030
+ var y, g, p;
6031
+ const h = this._moveMarker.getLatLng(), f = c.isVersion07x() ? h.distanceTo(d) : this._map.distance(h, d);
6032
+ this._shape.setRadius(f);
6028
6033
  try {
6029
- (g = this._map) != null && g.editTooltip && ((m = (f = this._map) == null ? void 0 : f._editTooltip) != null && m.updateContent) && this._map._editTooltip.updateContent({
6034
+ (y = this._map) != null && y.editTooltip && ((p = (g = this._map) == null ? void 0 : g._editTooltip) != null && p.updateContent) && this._map._editTooltip.updateContent({
6030
6035
  text: n.drawLocal.edit.handlers.edit.tooltip.subtext + "<br />" + n.drawLocal.edit.handlers.edit.tooltip.text,
6031
6036
  subtext: n.drawLocal.draw.handlers.circle.radius + ": " + c.readableDistance(
6032
- p,
6037
+ f,
6033
6038
  !0,
6034
6039
  this.options.feet,
6035
6040
  this.options.nautic
@@ -6138,43 +6143,43 @@ class Ga {
6138
6143
  const o = (r = t == null ? void 0 : t._poly) != null ? r : t == null ? void 0 : t._shape;
6139
6144
  if (!o) return null;
6140
6145
  if ((a = t == null ? void 0 : t._poly) != null && a.getLatLngs) {
6141
- const h = t._poly.getLatLngs(), p = Array.isArray(h == null ? void 0 : h[0]) ? h[0] : h, g = (Array.isArray(p) ? p : []).map((m) => [
6142
- m.lng,
6143
- m.lat
6144
- ]), f = e != null ? e : t._currentLatLng;
6145
- if (f && g.length && (((n = g.at(-1)) == null ? void 0 : n[0]) !== f.lng || ((s = g.at(-1)) == null ? void 0 : s[1]) !== f.lat) && g.push([f.lng, f.lat]), t.type === "polygon" || o instanceof this.L.Polygon) {
6146
- if (g.length < 3) return null;
6147
- const m = g[0][0] === ((l = g.at(-1)) == null ? void 0 : l[0]) && g[0][1] === ((c = g.at(-1)) == null ? void 0 : c[1]) ? g : [...g, g[0]];
6146
+ const h = t._poly.getLatLngs(), f = Array.isArray(h == null ? void 0 : h[0]) ? h[0] : h, y = (Array.isArray(f) ? f : []).map((p) => [
6147
+ p.lng,
6148
+ p.lat
6149
+ ]), g = e != null ? e : t._currentLatLng;
6150
+ if (g && y.length && (((n = y.at(-1)) == null ? void 0 : n[0]) !== g.lng || ((s = y.at(-1)) == null ? void 0 : s[1]) !== g.lat) && y.push([g.lng, g.lat]), t.type === "polygon" || o instanceof this.L.Polygon) {
6151
+ if (y.length < 3) return null;
6152
+ const p = y[0][0] === ((l = y.at(-1)) == null ? void 0 : l[0]) && y[0][1] === ((c = y.at(-1)) == null ? void 0 : c[1]) ? y : [...y, y[0]];
6148
6153
  return {
6149
6154
  type: "Feature",
6150
6155
  properties: {},
6151
- geometry: { type: "Polygon", coordinates: [m] }
6156
+ geometry: { type: "Polygon", coordinates: [p] }
6152
6157
  };
6153
6158
  }
6154
- return g.length < 2 ? null : {
6159
+ return y.length < 2 ? null : {
6155
6160
  type: "Feature",
6156
6161
  properties: {},
6157
- geometry: { type: "LineString", coordinates: g }
6162
+ geometry: { type: "LineString", coordinates: y }
6158
6163
  };
6159
6164
  }
6160
6165
  if ((u = t == null ? void 0 : t._shape) != null && u.getLatLng && ((d = t == null ? void 0 : t._shape) != null && d.getRadius)) {
6161
- const h = t._shape.getLatLng(), p = t._shape.getRadius(), g = 110574, f = g * Math.max(0.1, Math.cos(h.lat * Math.PI / 180)), m = Array.from({ length: 65 }, (y, b) => {
6162
- const v = b / 64 * Math.PI * 2;
6166
+ const h = t._shape.getLatLng(), f = t._shape.getRadius(), y = 110574, g = y * Math.max(0.1, Math.cos(h.lat * Math.PI / 180)), p = Array.from({ length: 65 }, (m, v) => {
6167
+ const b = v / 64 * Math.PI * 2;
6163
6168
  return [
6164
- h.lng + Math.cos(v) * p / f,
6165
- h.lat + Math.sin(v) * p / g
6169
+ h.lng + Math.cos(b) * f / g,
6170
+ h.lat + Math.sin(b) * f / y
6166
6171
  ];
6167
6172
  });
6168
6173
  return {
6169
6174
  type: "Feature",
6170
6175
  properties: {},
6171
- geometry: { type: "Polygon", coordinates: [m] }
6176
+ geometry: { type: "Polygon", coordinates: [p] }
6172
6177
  };
6173
6178
  }
6174
6179
  return typeof o.toGeoJSON == "function" ? o.toGeoJSON() : null;
6175
6180
  }
6176
6181
  renderMeasurement(t, e) {
6177
- var c, u, d, h, p;
6182
+ var c, u, d, h, f;
6178
6183
  if (!((c = this.measurementOverlayOptions) != null && c.enabled) || !t) return;
6179
6184
  const o = Na(t);
6180
6185
  if (!o.ok) {
@@ -6207,10 +6212,10 @@ class Ga {
6207
6212
  whiteSpace: "pre-line"
6208
6213
  }), this.container.appendChild(s), this.measurementOverlayElement = s), s.textContent = a.join(`
6209
6214
  `);
6210
- const l = (p = e != null ? e : this.lastMeasurementLatLng) != null ? p : (h = this.map) == null ? void 0 : h.getCenter();
6215
+ const l = (f = e != null ? e : this.lastMeasurementLatLng) != null ? f : (h = this.map) == null ? void 0 : h.getCenter();
6211
6216
  if (l && this.map) {
6212
- const g = this.map.latLngToContainerPoint(l);
6213
- s.style.left = `${g.x + 12}px`, s.style.top = `${g.y + 12}px`;
6217
+ const y = this.map.latLngToContainerPoint(l);
6218
+ s.style.left = `${y.x + 12}px`, s.style.top = `${y.y + 12}px`;
6214
6219
  }
6215
6220
  this.lastMeasurementFeature = t, this.lastMeasurementLatLng = e ? this.L.latLng(e) : this.lastMeasurementLatLng;
6216
6221
  }
@@ -6232,20 +6237,20 @@ class Ga {
6232
6237
  const r = e._onMarkerDrag, a = e._onTouchMove;
6233
6238
  r && ((s = t.off) == null || s.call(t, "drag", r, e));
6234
6239
  const n = (c) => {
6235
- var h, p, g, f, m, y;
6236
- const u = (h = e._poly) == null ? void 0 : h._fid, d = this.findSnapResult((p = t.getLatLng) == null ? void 0 : p.call(t), u);
6240
+ var h, f, y, g, p, m;
6241
+ const u = (h = e._poly) == null ? void 0 : h._fid, d = this.findSnapResult((f = t.getLatLng) == null ? void 0 : f.call(t), u);
6237
6242
  this.showSnapFeedback(d), d && t.setLatLng(d.latlng), r == null || r.call(e, { ...c, target: t }), this.renderMeasurement(
6238
- (m = (f = (g = e._poly) == null ? void 0 : g.toGeoJSON) == null ? void 0 : f.call(g)) != null ? m : null,
6239
- (y = t.getLatLng) == null ? void 0 : y.call(t)
6243
+ (p = (g = (y = e._poly) == null ? void 0 : y.toGeoJSON) == null ? void 0 : g.call(y)) != null ? p : null,
6244
+ (m = t.getLatLng) == null ? void 0 : m.call(t)
6240
6245
  );
6241
6246
  };
6242
6247
  if (t.on("drag", n, e), a) {
6243
6248
  (l = t.off) == null || l.call(t, "touchmove", a, e);
6244
6249
  const c = (u) => {
6245
- var p, g, f, m, y, b, v, A;
6246
- const d = (g = this.eventLatLng(u)) != null ? g : (p = t.getLatLng) == null ? void 0 : p.call(t), h = this.findSnapResult(d, (f = e._poly) == null ? void 0 : f._fid);
6247
- this.showSnapFeedback(h), h ? (t.setLatLng(h.latlng), r == null || r.call(e, { ...u, target: t })) : (d && ((m = t.setLatLng) == null || m.call(t, d)), a ? a.call(e, { ...u, target: t }) : r == null || r.call(e, { ...u, target: t })), this.renderMeasurement(
6248
- (v = (b = (y = e._poly) == null ? void 0 : y.toGeoJSON) == null ? void 0 : b.call(y)) != null ? v : null,
6250
+ var f, y, g, p, m, v, b, A;
6251
+ const d = (y = this.eventLatLng(u)) != null ? y : (f = t.getLatLng) == null ? void 0 : f.call(t), h = this.findSnapResult(d, (g = e._poly) == null ? void 0 : g._fid);
6252
+ this.showSnapFeedback(h), h ? (t.setLatLng(h.latlng), r == null || r.call(e, { ...u, target: t })) : (d && ((p = t.setLatLng) == null || p.call(t, d)), a ? a.call(e, { ...u, target: t }) : r == null || r.call(e, { ...u, target: t })), this.renderMeasurement(
6253
+ (b = (v = (m = e._poly) == null ? void 0 : m.toGeoJSON) == null ? void 0 : v.call(m)) != null ? b : null,
6249
6254
  (A = t.getLatLng) == null ? void 0 : A.call(t)
6250
6255
  );
6251
6256
  };
@@ -6275,20 +6280,20 @@ class Ga {
6275
6280
  });
6276
6281
  }
6277
6282
  installInteractionIntegrations() {
6278
- var h, p, g, f, m, y, b;
6283
+ var h, f, y, g, p, m, v;
6279
6284
  if ((h = this.interactionCleanup) == null || h.call(this), this.interactionCleanup = null, this.hideLiveOverlays(), !this.map || !this.drawControl) return;
6280
- const t = [], e = [], o = !!(((p = this.snappingOptions) == null ? void 0 : p.enabled) !== !1 && this.snappingOptions);
6285
+ const t = [], e = [], o = !!(((f = this.snappingOptions) == null ? void 0 : f.enabled) !== !1 && this.snappingOptions);
6281
6286
  let r = !0;
6282
- const a = !!((g = this.measurementOverlayOptions) != null && g.enabled), n = () => {
6283
- var v;
6284
- for (; e.length; ) (v = e.pop()) == null || v();
6287
+ const a = !!((y = this.measurementOverlayOptions) != null && y.enabled), n = () => {
6288
+ var b;
6289
+ for (; e.length; ) (b = e.pop()) == null || b();
6285
6290
  this.showSnapFeedback(null);
6286
6291
  };
6287
6292
  if (o) {
6288
- const v = Object.values(
6289
- (b = (y = (m = (f = this.drawControl) == null ? void 0 : f._toolbars) == null ? void 0 : m.draw) == null ? void 0 : y._modes) != null ? b : {}
6293
+ const b = Object.values(
6294
+ (v = (m = (p = (g = this.drawControl) == null ? void 0 : g._toolbars) == null ? void 0 : p.draw) == null ? void 0 : m._modes) != null ? v : {}
6290
6295
  );
6291
- for (const A of v) {
6296
+ for (const A of b) {
6292
6297
  const k = A == null ? void 0 : A.handler;
6293
6298
  if (k)
6294
6299
  for (const x of [
@@ -6297,13 +6302,13 @@ class Ga {
6297
6302
  "_onMouseUp",
6298
6303
  "_onTouch"
6299
6304
  ]) {
6300
- const L = k[x];
6301
- if (typeof L != "function") continue;
6302
- const E = (C) => {
6305
+ const E = k[x];
6306
+ if (typeof E != "function") continue;
6307
+ const L = (C) => {
6303
6308
  var S, F, te;
6304
6309
  const T = this.eventLatLng(C), M = this.findSnapResult(T);
6305
6310
  this.showSnapFeedback(M);
6306
- const _ = M ? { ...C, latlng: M.latlng } : C, I = L.call(k, _);
6311
+ const _ = M ? { ...C, latlng: M.latlng } : C, I = E.call(k, _);
6307
6312
  return M && (k._currentLatLng = M.latlng, (S = k._mouseMarker) == null || S.setLatLng(M.latlng), typeof k._updateGuide == "function" && k._updateGuide(
6308
6313
  this.map.latLngToLayerPoint(M.latlng)
6309
6314
  ), (F = k._updateTooltip) == null || F.call(k, M.latlng)), this.renderMeasurement(
@@ -6311,48 +6316,48 @@ class Ga {
6311
6316
  (te = M == null ? void 0 : M.latlng) != null ? te : T
6312
6317
  ), I;
6313
6318
  };
6314
- k[x] = E, t.push(() => {
6315
- k[x] === E && (k[x] = L);
6319
+ k[x] = L, t.push(() => {
6320
+ k[x] === L && (k[x] = E);
6316
6321
  });
6317
6322
  }
6318
6323
  }
6319
6324
  }
6320
- const s = (v) => {
6321
- var L, E, C, T, M, _;
6325
+ const s = (b) => {
6326
+ var E, L, C, T, M, _;
6322
6327
  const A = Object.values(
6323
- (T = (C = (E = (L = this.drawControl) == null ? void 0 : L._toolbars) == null ? void 0 : E.draw) == null ? void 0 : C._modes) != null ? T : {}
6328
+ (T = (C = (L = (E = this.drawControl) == null ? void 0 : E._toolbars) == null ? void 0 : L.draw) == null ? void 0 : C._modes) != null ? T : {}
6324
6329
  ).map((I) => I == null ? void 0 : I.handler).find((I) => I == null ? void 0 : I._enabled);
6325
6330
  if (!A) return;
6326
- const k = this.eventLatLng(v), x = o ? this.findSnapResult(k) : null;
6331
+ const k = this.eventLatLng(b), x = o ? this.findSnapResult(k) : null;
6327
6332
  o && this.showSnapFeedback(x), this.renderMeasurement(
6328
6333
  this.geometryFeatureForHandler(A, (M = x == null ? void 0 : x.latlng) != null ? M : k),
6329
6334
  (_ = x == null ? void 0 : x.latlng) != null ? _ : k
6330
6335
  );
6331
6336
  };
6332
6337
  this.map.on("mousemove touchmove", s), t.push(() => {
6333
- var v;
6334
- return (v = this.map) == null ? void 0 : v.off("mousemove touchmove", s);
6338
+ var b;
6339
+ return (b = this.map) == null ? void 0 : b.off("mousemove touchmove", s);
6335
6340
  });
6336
6341
  const l = () => {
6337
- var v, A, k, x;
6342
+ var b, A, k, x;
6338
6343
  if (a)
6339
- for (const L of (k = (A = (v = this.drawnItems) == null ? void 0 : v.getLayers) == null ? void 0 : A.call(v)) != null ? k : []) {
6340
- const E = L, C = () => {
6344
+ for (const E of (k = (A = (b = this.drawnItems) == null ? void 0 : b.getLayers) == null ? void 0 : A.call(b)) != null ? k : []) {
6345
+ const L = E, C = () => {
6341
6346
  var T, M, _;
6342
6347
  return this.renderMeasurement(
6343
- (M = (T = E.toGeoJSON) == null ? void 0 : T.call(E)) != null ? M : null,
6344
- (_ = E.getLatLng) == null ? void 0 : _.call(E)
6348
+ (M = (T = L.toGeoJSON) == null ? void 0 : T.call(L)) != null ? M : null,
6349
+ (_ = L.getLatLng) == null ? void 0 : _.call(L)
6345
6350
  );
6346
6351
  };
6347
- (x = E.on) == null || x.call(E, "editdrag drag", C), e.push(() => {
6352
+ (x = L.on) == null || x.call(L, "editdrag drag", C), e.push(() => {
6348
6353
  var T;
6349
- return (T = E.off) == null ? void 0 : T.call(E, "editdrag drag", C);
6354
+ return (T = L.off) == null ? void 0 : T.call(L, "editdrag drag", C);
6350
6355
  });
6351
6356
  }
6352
6357
  o && queueMicrotask(() => {
6353
- var L, E, C, T, M;
6358
+ var E, L, C, T, M;
6354
6359
  if (r)
6355
- for (const _ of (C = (E = (L = this.drawnItems) == null ? void 0 : L.getLayers) == null ? void 0 : E.call(L)) != null ? C : []) {
6360
+ for (const _ of (C = (L = (E = this.drawnItems) == null ? void 0 : E.getLayers) == null ? void 0 : L.call(E)) != null ? C : []) {
6356
6361
  const I = _.editing;
6357
6362
  for (const S of (T = I == null ? void 0 : I._verticesHandlers) != null ? T : []) {
6358
6363
  this.installEditHandlerSnap(S, e);
@@ -6361,12 +6366,12 @@ class Ga {
6361
6366
  }
6362
6367
  }
6363
6368
  });
6364
- }, c = (v) => {
6365
- var k, x, L, E, C, T, M, _, I, S;
6366
- const A = (C = (x = (k = v == null ? void 0 : v.poly) == null ? void 0 : k.toGeoJSON) == null ? void 0 : x.call(k)) != null ? C : (E = (L = v == null ? void 0 : v.layer) == null ? void 0 : L.toGeoJSON) == null ? void 0 : E.call(L);
6369
+ }, c = (b) => {
6370
+ var k, x, E, L, C, T, M, _, I, S;
6371
+ const A = (C = (x = (k = b == null ? void 0 : b.poly) == null ? void 0 : k.toGeoJSON) == null ? void 0 : x.call(k)) != null ? C : (L = (E = b == null ? void 0 : b.layer) == null ? void 0 : E.toGeoJSON) == null ? void 0 : L.call(E);
6367
6372
  this.renderMeasurement(
6368
6373
  A,
6369
- (S = (M = (T = v == null ? void 0 : v.marker) == null ? void 0 : T.getLatLng) == null ? void 0 : M.call(T)) != null ? S : (I = (_ = v == null ? void 0 : v.poly) == null ? void 0 : _.getCenter) == null ? void 0 : I.call(_)
6374
+ (S = (M = (T = b == null ? void 0 : b.marker) == null ? void 0 : T.getLatLng) == null ? void 0 : M.call(T)) != null ? S : (I = (_ = b == null ? void 0 : b.poly) == null ? void 0 : _.getCenter) == null ? void 0 : I.call(_)
6370
6375
  );
6371
6376
  }, u = () => {
6372
6377
  n(), this.hideLiveOverlays();
@@ -6374,11 +6379,11 @@ class Ga {
6374
6379
  this.hideLiveOverlays();
6375
6380
  };
6376
6381
  this.map.on("draw:editstart", l), this.map.on("draw:editvertex", c), this.map.on("draw:editstop", u), this.map.on("draw:drawstop", d), t.push(() => {
6377
- var v, A, k, x;
6378
- r = !1, n(), (v = this.map) == null || v.off("draw:editstart", l), (A = this.map) == null || A.off("draw:editvertex", c), (k = this.map) == null || k.off("draw:editstop", u), (x = this.map) == null || x.off("draw:drawstop", d);
6382
+ var b, A, k, x;
6383
+ r = !1, n(), (b = this.map) == null || b.off("draw:editstart", l), (A = this.map) == null || A.off("draw:editvertex", c), (k = this.map) == null || k.off("draw:editstop", u), (x = this.map) == null || x.off("draw:drawstop", d);
6379
6384
  }), this.interactionCleanup = () => {
6380
- var v;
6381
- for (; t.length; ) (v = t.pop()) == null || v();
6385
+ var b;
6386
+ for (; t.length; ) (b = t.pop()) == null || b();
6382
6387
  n(), this.hideLiveOverlays();
6383
6388
  };
6384
6389
  }
@@ -6445,53 +6450,53 @@ class Ga {
6445
6450
  this.cakeSessionCommand = this.activeToolCommand, this.activeCakeSession = new ui(
6446
6451
  this.map,
6447
6452
  l,
6448
- (f) => {
6453
+ (g) => {
6449
6454
  var x;
6450
6455
  if (!this.drawnItems) return;
6451
- const m = this.activeCakeSession.snapshot();
6452
- f.features.forEach((L, E) => {
6453
- L.properties = {
6454
- ...L.properties,
6455
- name: `${m.name} ${E === 0 ? "core" : `ring ${E}`}`
6456
+ const p = this.activeCakeSession.snapshot();
6457
+ g.features.forEach((E, L) => {
6458
+ E.properties = {
6459
+ ...E.properties,
6460
+ name: `${p.name} ${L === 0 ? "core" : `ring ${L}`}`
6456
6461
  };
6457
6462
  });
6458
- const y = this.store.add(f), b = this.layerRegistry.add(y, {
6459
- name: m.name,
6463
+ const m = this.store.add(g), v = this.layerRegistry.add(m, {
6464
+ name: p.name,
6460
6465
  kind: "drawn",
6461
- style: m.style
6462
- }), v = this.L.geoJSON(f);
6466
+ style: p.style
6467
+ }), b = this.L.geoJSON(g);
6463
6468
  let A = 0;
6464
- v.eachLayer((L) => {
6469
+ b.eachLayer((E) => {
6465
6470
  var C, T, M;
6466
- const E = (C = y[A]) != null ? C : y[y.length - 1];
6467
- L._fid = E, this.featureLayers.set(E, L), this.drawnItems.addLayer(L), this.installVertexContextMenu(L), (M = (T = this.options.callbacks) == null ? void 0 : T.onCreated) == null || M.call(T, {
6468
- id: E,
6471
+ const L = (C = m[A]) != null ? C : m[m.length - 1];
6472
+ E._fid = L, this.featureLayers.set(L, E), this.drawnItems.addLayer(E), this.installVertexContextMenu(E), (M = (T = this.options.callbacks) == null ? void 0 : T.onCreated) == null || M.call(T, {
6473
+ id: L,
6469
6474
  layerType: "polygon",
6470
- geoJSON: L.toGeoJSON()
6475
+ geoJSON: E.toGeoJSON()
6471
6476
  }), A++;
6472
6477
  }), this.applyLayerRegistry();
6473
6478
  const k = ((x = this.activeToolCommand) == null ? void 0 : x.tool) === "layerCake" ? this.activeToolCommand : null;
6474
6479
  this.emitCakeEvent("tool:layer-cake:saved", {
6475
- layerId: b,
6476
- featureCollection: f,
6480
+ layerId: v,
6481
+ featureCollection: g,
6477
6482
  source: k == null ? void 0 : k.source,
6478
6483
  groupId: k == null ? void 0 : k.groupId,
6479
6484
  commandId: k == null ? void 0 : k.commandId
6480
6485
  }), this.activeCakeSession = null, this.cakeSessionCommand = null, k && (this.completeActiveTool(
6481
- { featureIds: y, geometry: f },
6486
+ { featureIds: m, geometry: g },
6482
6487
  !0
6483
6488
  ), this.clearActiveTool(k));
6484
6489
  },
6485
6490
  this.measurementSystem,
6486
6491
  () => this.emitCakeEvent("tool:layer-cake:session-changed")
6487
6492
  );
6488
- const g = ((r = this.activeToolCommand) == null ? void 0 : r.tool) === "layerCake" ? this.activeToolCommand : null;
6493
+ const y = ((r = this.activeToolCommand) == null ? void 0 : r.tool) === "layerCake" ? this.activeToolCommand : null;
6489
6494
  this.emitCakeEvent("tool:layer-cake:session-started", {
6490
6495
  center: l.getLatLng(),
6491
6496
  radius: l.getRadius(),
6492
- source: g == null ? void 0 : g.source,
6493
- groupId: g == null ? void 0 : g.groupId,
6494
- commandId: g == null ? void 0 : g.commandId
6497
+ source: y == null ? void 0 : y.source,
6498
+ groupId: y == null ? void 0 : y.groupId,
6499
+ commandId: y == null ? void 0 : y.commandId
6495
6500
  });
6496
6501
  return;
6497
6502
  }
@@ -6504,8 +6509,8 @@ class Ga {
6504
6509
  name: `${c} layer`,
6505
6510
  kind: "drawn"
6506
6511
  }), this.applyLayerRegistry(), (n = (a = this.options.callbacks) == null ? void 0 : a.onCreated) == null || n.call(a, { id: h, layerType: c, geoJSON: u });
6507
- const p = Ua[c];
6508
- p && this.emitToolEvent(p, {
6512
+ const f = Ua[c];
6513
+ f && this.emitToolEvent(f, {
6509
6514
  id: h,
6510
6515
  geoJSON: u
6511
6516
  }), ((s = this.activeToolCommand) == null ? void 0 : s.tool) === c && this.completeActiveTool({ featureIds: [h], geometry: u }, !0);
@@ -6728,13 +6733,13 @@ class Ga {
6728
6733
  }
6729
6734
  findNearestVertex(t, e, o) {
6730
6735
  if (!this.map) return null;
6731
- const r = (h) => this.map.latLngToContainerPoint(h), a = (h, p) => Math.hypot(h.x - p.x, h.y - p.y), n = r(e);
6736
+ const r = (h) => this.map.latLngToContainerPoint(h), a = (h, f) => Math.hypot(h.x - f.x, h.y - f.y), n = r(e);
6732
6737
  let s = 1 / 0, l = -1, c = -1;
6733
6738
  const u = t.getLatLngs();
6734
- return (Array.isArray(u[0]) ? u : [u]).forEach((h, p) => {
6735
- h.forEach((g, f) => {
6736
- const m = r(g), y = a(m, n);
6737
- y < s && (s = y, l = p, c = f);
6739
+ return (Array.isArray(u[0]) ? u : [u]).forEach((h, f) => {
6740
+ h.forEach((y, g) => {
6741
+ const p = r(y), m = a(p, n);
6742
+ m < s && (s = m, l = f, c = g);
6738
6743
  });
6739
6744
  }), l === -1 || s > o ? null : { pathIndex: l, vertexIndex: c };
6740
6745
  }
@@ -6749,15 +6754,15 @@ class Ga {
6749
6754
  if (u.splice(o, 1), c.length === 1)
6750
6755
  t.setLatLngs(u);
6751
6756
  else {
6752
- const g = c.map((f, m) => m === e ? u : f);
6753
- t.setLatLngs(g);
6757
+ const y = c.map((g, p) => p === e ? u : g);
6758
+ t.setLatLngs(y);
6754
6759
  }
6755
6760
  (r = t.redraw) == null || r.call(t);
6756
- const p = t._fid;
6757
- if (p) {
6758
- const g = t.toGeoJSON();
6759
- this.store.update(p, g), (n = (a = this.options.callbacks) == null ? void 0 : a.onEdited) == null || n.call(a, {
6760
- ids: [p],
6761
+ const f = t._fid;
6762
+ if (f) {
6763
+ const y = t.toGeoJSON();
6764
+ this.store.update(f, y), (n = (a = this.options.callbacks) == null ? void 0 : a.onEdited) == null || n.call(a, {
6765
+ ids: [f],
6761
6766
  geoJSON: this.store.toFeatureCollection()
6762
6767
  });
6763
6768
  }
@@ -6776,10 +6781,10 @@ class Ga {
6776
6781
  if (!a) return;
6777
6782
  const n = a._modes || {};
6778
6783
  let s = null;
6779
- for (const p in n) {
6780
- const g = n[p];
6781
- if (((o = g == null ? void 0 : g.handler) == null ? void 0 : o.type) === "move") {
6782
- s = g.handler;
6784
+ for (const f in n) {
6785
+ const y = n[f];
6786
+ if (((o = y == null ? void 0 : y.handler) == null ? void 0 : o.type) === "move") {
6787
+ s = y.handler;
6783
6788
  break;
6784
6789
  }
6785
6790
  }
@@ -6788,18 +6793,18 @@ class Ga {
6788
6793
  l.dataset.geokitMoveConfirmation = "", this.L.DomEvent.disableClickPropagation(l), this.L.DomEvent.disableScrollPropagation(l), l.style.position = "absolute";
6789
6794
  const c = this.container.getBoundingClientRect();
6790
6795
  let u = 60;
6791
- this.container.querySelectorAll("[data-geokit-managed-toolbar]").forEach((p) => {
6792
- var f;
6793
- const g = p.getBoundingClientRect();
6794
- g.width && g.height && ((f = p.dataset.geokitToolbarPosition) != null && f.startsWith("bottom")) && (u = Math.max(u, c.bottom - g.top + 8));
6796
+ this.container.querySelectorAll("[data-geokit-managed-toolbar]").forEach((f) => {
6797
+ var g;
6798
+ const y = f.getBoundingClientRect();
6799
+ y.width && y.height && ((g = f.dataset.geokitToolbarPosition) != null && g.startsWith("bottom")) && (u = Math.max(u, c.bottom - y.top + 8));
6795
6800
  }), l.style.bottom = `${u}px`, l.style.maxWidth = "calc(100% - 32px)", l.style.boxSizing = "border-box", l.style.left = "50%", l.style.transform = "translateX(-50%)", l.style.display = "flex", l.style.gap = "8px", l.style.background = "#fff", l.style.border = "2px solid #3388ff", l.style.borderRadius = "8px", l.style.padding = "12px 16px", l.style.boxShadow = "0 4px 12px rgba(0,0,0,0.2)", l.style.zIndex = "10000", l.style.fontSize = "14px", l.style.fontFamily = "system-ui, sans-serif";
6796
6801
  const d = document.createElement("button");
6797
- d.textContent = "✓ Save", d.style.minHeight = "44px", d.style.minWidth = "44px", d.style.whiteSpace = "nowrap", d.style.padding = "8px 16px", d.style.border = "none", d.style.background = "#28a745", d.style.color = "#fff", d.style.borderRadius = "4px", d.style.cursor = "pointer", d.style.fontWeight = "600", d.style.fontSize = "14px", d.addEventListener("click", (p) => {
6798
- p.stopPropagation(), p.preventDefault(), s != null && s.confirmMove && s.confirmMove();
6802
+ d.textContent = "✓ Save", d.style.minHeight = "44px", d.style.minWidth = "44px", d.style.whiteSpace = "nowrap", d.style.padding = "8px 16px", d.style.border = "none", d.style.background = "#28a745", d.style.color = "#fff", d.style.borderRadius = "4px", d.style.cursor = "pointer", d.style.fontWeight = "600", d.style.fontSize = "14px", d.addEventListener("click", (f) => {
6803
+ f.stopPropagation(), f.preventDefault(), s != null && s.confirmMove && s.confirmMove();
6799
6804
  });
6800
6805
  const h = document.createElement("button");
6801
- h.textContent = "✕ Cancel", h.style.minHeight = "44px", h.style.minWidth = "44px", h.style.whiteSpace = "nowrap", h.style.padding = "8px 16px", h.style.border = "1px solid #ccc", h.style.background = "#fff", h.style.color = "#333", h.style.borderRadius = "4px", h.style.cursor = "pointer", h.style.fontWeight = "600", h.style.fontSize = "14px", h.addEventListener("click", (p) => {
6802
- p.stopPropagation(), p.preventDefault(), this.emitToolEvent("tool:move:cancelled", {
6806
+ h.textContent = "✕ Cancel", h.style.minHeight = "44px", h.style.minWidth = "44px", h.style.whiteSpace = "nowrap", h.style.padding = "8px 16px", h.style.border = "1px solid #ccc", h.style.background = "#fff", h.style.color = "#333", h.style.borderRadius = "4px", h.style.cursor = "pointer", h.style.fontWeight = "600", h.style.fontSize = "14px", h.addEventListener("click", (f) => {
6807
+ f.stopPropagation(), f.preventDefault(), this.emitToolEvent("tool:move:cancelled", {
6803
6808
  layerId: t == null ? void 0 : t._fid
6804
6809
  }), s != null && s.cancelMove && s.cancelMove(), this.hideMoveConfirmationUI();
6805
6810
  }), l.appendChild(d), l.appendChild(h), this.container.appendChild(l), this.moveConfirmationUI = l, this.logger.debug("showMoveConfirmationUI", {
@@ -7163,7 +7168,7 @@ class jo extends HTMLElement {
7163
7168
  callbacks: {
7164
7169
  onToolCapabilitiesChanged: () => this._emitToolCapabilities(),
7165
7170
  onReady: (a) => {
7166
- this.dispatchEvent(new CustomEvent(O.Ready, { detail: a })), this._syncStatusFromController({
7171
+ this._setStatus({ state: "ready", ready: !0, busy: !1 }), this.dispatchEvent(new CustomEvent(O.Ready, { detail: a })), this._syncStatusFromController({
7167
7172
  state: "ready",
7168
7173
  ready: !0,
7169
7174
  busy: !1,
@@ -7457,25 +7462,25 @@ class jo extends HTMLElement {
7457
7462
  attribution: this._tileAttribution
7458
7463
  }, d = Ei(u);
7459
7464
  if (!d.valid) {
7460
- const g = (o = d.error) != null && o.toLowerCase().includes("api key") ? "missing_api_key" : "tile_load_failed";
7465
+ const y = (o = d.error) != null && o.toLowerCase().includes("api key") ? "missing_api_key" : "tile_load_failed";
7461
7466
  this._handleTileProviderError(
7462
- g,
7467
+ y,
7463
7468
  (r = d.error) != null ? r : "Invalid tile provider configuration",
7464
7469
  c
7465
7470
  );
7466
7471
  return;
7467
7472
  }
7468
- const h = pt(u), p = this._activeTileProvider;
7473
+ const h = pt(u), f = this._activeTileProvider;
7469
7474
  e.setTileLayer(h, {
7470
- onTileError: (g) => {
7475
+ onTileError: (y) => {
7471
7476
  if (this._tileProvider !== c) return;
7472
- const f = this._describeTileLayerError(g, c), m = c === "here" ? this._resolveHereTileLayerErrorCode(f) : "tile_load_failed";
7473
- this._handleTileProviderError(m, f, c);
7477
+ const g = this._describeTileLayerError(y, c), p = c === "here" ? this._resolveHereTileLayerErrorCode(g) : "tile_load_failed";
7478
+ this._handleTileProviderError(p, g, c);
7474
7479
  }
7475
7480
  }), this._activeTileProvider = c, this._emitTileProviderChanged(
7476
7481
  c,
7477
7482
  this._tileStyle,
7478
- p
7483
+ f
7479
7484
  );
7480
7485
  return;
7481
7486
  }
@@ -8542,4 +8547,4 @@ export {
8542
8547
  Rt as normalizeGeoJSON,
8543
8548
  ft as validateGeoJSON
8544
8549
  };
8545
- //# sourceMappingURL=index-DCKj0r6a.js.map
8550
+ //# sourceMappingURL=index-D9ScFTVe.js.map