gs-maplibre-draw 0.0.69 → 0.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- const { abs: Ae, cos: ge, sin: be, acos: qt, atan2: Xe, sqrt: me, pow: he } = Math;
1
+ const { abs: Ae, cos: ge, sin: be, acos: Bt, atan2: Xe, sqrt: me, pow: he } = Math;
2
2
  function Ye(e) {
3
3
  return e < 0 ? -he(-e, 1 / 3) : he(e, 1 / 3);
4
4
  }
5
- const Pt = Math.PI, Ge = 2 * Pt, ve = Pt / 2, Nt = 1e-6, Qe = Number.MAX_SAFE_INTEGER || 9007199254740991, Ve = Number.MIN_SAFE_INTEGER || -9007199254740991, Tt = { x: 0, y: 0, z: 0 }, L = {
5
+ const Lt = Math.PI, Ge = 2 * Lt, ve = Lt / 2, qt = 1e-6, Qe = Number.MAX_SAFE_INTEGER || 9007199254740991, Ve = Number.MIN_SAFE_INTEGER || -9007199254740991, Nt = { x: 0, y: 0, z: 0 }, L = {
6
6
  // Legendre-Gauss abscissae with n=24 (x_i values, defined at i=n as the roots of the nth order Legendre polynomial Pn(x))
7
7
  Tvalues: [
8
8
  -0.06405689286260563,
@@ -82,7 +82,7 @@ const Pt = Math.PI, Ge = 2 * Pt, ve = Pt / 2, Nt = 1e-6, Qe = Number.MAX_SAFE_IN
82
82
  }
83
83
  if (o < 4) {
84
84
  let u = a * a, c = e * e, l, g, d, p = 0;
85
- o === 2 ? (s = [s[0], s[1], s[2], Tt], l = u, g = a * e * 2, d = c) : o === 3 && (l = u * a, g = u * e * 3, d = a * c * 3, p = e * c);
85
+ o === 2 ? (s = [s[0], s[1], s[2], Nt], l = u, g = a * e * 2, d = c) : o === 3 && (l = u * a, g = u * e * 3, d = a * c * 3, p = e * c);
86
86
  const z = {
87
87
  x: l * s[0].x + g * s[1].x + d * s[2].x + p * s[3].x,
88
88
  y: l * s[0].y + g * s[1].y + d * s[2].y + p * s[3].y,
@@ -143,7 +143,7 @@ const Pt = Math.PI, Ge = 2 * Pt, ve = Pt / 2, Nt = 1e-6, Qe = Number.MAX_SAFE_IN
143
143
  return r <= e && e <= n || L.approximately(e, r) || L.approximately(e, n);
144
144
  },
145
145
  approximately: function(e, r, n) {
146
- return Ae(e - r) <= (n || Nt);
146
+ return Ae(e - r) <= (n || qt);
147
147
  },
148
148
  length: function(e) {
149
149
  const n = L.Tvalues.length;
@@ -318,7 +318,7 @@ const Pt = Math.PI, Ge = 2 * Pt, ve = Pt / 2, Nt = 1e-6, Qe = Number.MAX_SAFE_IN
318
318
  const z = (3 * d - g * g) / 3, m = z / 3, b = (2 * g * g * g - 9 * g * d + 27 * p) / 27, F = b / 2, X = F * F + m * m * m;
319
319
  let f, h, y, x, _;
320
320
  if (X < 0) {
321
- const v = -z / 3, M = v * v * v, S = me(M), D = -b / (2 * S), A = D < -1 ? -1 : D > 1 ? 1 : D, Y = qt(A), R = Ye(S), q = 2 * R;
321
+ const v = -z / 3, M = v * v * v, S = me(M), D = -b / (2 * S), A = D < -1 ? -1 : D > 1 ? 1 : D, Y = Bt(A), R = Ye(S), q = 2 * R;
322
322
  return y = q * ge(Y / 3) - g / 3, x = q * ge((Y + Ge) / 3) - g / 3, _ = q * ge((Y + 2 * Ge) / 3) - g / 3, [y, x, _].filter(a);
323
323
  } else {
324
324
  if (X === 0)
@@ -462,7 +462,7 @@ class Oe {
462
462
  }), new Oe(n);
463
463
  }
464
464
  }
465
- const { abs: Ce, min: dt, max: gt, cos: Gt, sin: $t, acos: Ut, sqrt: Fe } = Math, Jt = Math.PI;
465
+ const { abs: Ce, min: dt, max: gt, cos: Tt, sin: Gt, acos: $t, sqrt: Fe } = Math, Ut = Math.PI;
466
466
  class j {
467
467
  constructor(r) {
468
468
  let n = r && r.forEach ? r : Array.from(arguments).slice(), o = !1;
@@ -755,7 +755,7 @@ class j {
755
755
  }
756
756
  const r = this.normal(0), n = this.normal(1);
757
757
  let o = r.x * n.x + r.y * n.y;
758
- return this._3d && (o += r.z * n.z), Ce(Ut(o)) < Jt / 3;
758
+ return this._3d && (o += r.z * n.z), Ce($t(o)) < Ut / 3;
759
759
  }
760
760
  reduce() {
761
761
  let r, n = 0, o = 0, a = 0.01, s, i = [], u = [], c = this.extrema().values;
@@ -924,8 +924,8 @@ class j {
924
924
  if (a >= 1) {
925
925
  if (l.interval.end = b = 1, g = l, a > 1) {
926
926
  let X = {
927
- x: l.x + l.r * Gt(l.e),
928
- y: l.y + l.r * $t(l.e)
927
+ x: l.x + l.r * Tt(l.e),
928
+ y: l.y + l.r * Gt(l.e)
929
929
  };
930
930
  l.e += L.angle({ x: l.x, y: l.y }, X, this.get(1));
931
931
  }
@@ -942,7 +942,7 @@ class j {
942
942
  return n;
943
943
  }
944
944
  }
945
- var le = 63710088e-1, bt = {
945
+ var le = 63710088e-1, Pt = {
946
946
  centimeters: le * 100,
947
947
  centimetres: le * 100,
948
948
  degrees: le / 111325,
@@ -1010,16 +1010,16 @@ function $e(e, r) {
1010
1010
  var n = Math.pow(10, r || 0);
1011
1011
  return Math.round(e * n) / n;
1012
1012
  }
1013
- function Zt(e, r) {
1013
+ function Jt(e, r) {
1014
1014
  r === void 0 && (r = "kilometers");
1015
- var n = bt[r];
1015
+ var n = Pt[r];
1016
1016
  if (!n)
1017
1017
  throw new Error(r + " units is invalid");
1018
1018
  return e * n;
1019
1019
  }
1020
- function jt(e, r) {
1020
+ function Zt(e, r) {
1021
1021
  r === void 0 && (r = "kilometers");
1022
- var n = bt[r];
1022
+ var n = Pt[r];
1023
1023
  if (!n)
1024
1024
  throw new Error(r + " units is invalid");
1025
1025
  return e / n;
@@ -1122,7 +1122,7 @@ function Be(e, r, n) {
1122
1122
  }
1123
1123
  }
1124
1124
  }
1125
- function Ht(e, r) {
1125
+ function jt(e, r) {
1126
1126
  var n, o, a, s, i, u, c, l, g, d, p = 0, z = e.type === "FeatureCollection", m = e.type === "Feature", b = z ? e.features.length : 1;
1127
1127
  for (n = 0; n < b; n++) {
1128
1128
  for (u = z ? e.features[n].geometry : m ? e.geometry : e, l = z ? e.features[n].properties : m ? e.properties : {}, g = z ? e.features[n].bbox : m ? e.bbox : void 0, d = z ? e.features[n].id : m ? e.id : void 0, c = u ? u.type === "GeometryCollection" : !1, i = c ? u.geometries.length : 1, a = 0; a < i; a++) {
@@ -1173,9 +1173,9 @@ function Ht(e, r) {
1173
1173
  p++;
1174
1174
  }
1175
1175
  }
1176
- function Qt(e, r, n) {
1176
+ function Ht(e, r, n) {
1177
1177
  var o = n;
1178
- return Ht(
1178
+ return jt(
1179
1179
  e,
1180
1180
  function(a, s, i, u, c) {
1181
1181
  s === 0 && n === void 0 ? o = a : o = r(
@@ -1209,17 +1209,17 @@ function ke(e) {
1209
1209
  return e;
1210
1210
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
1211
1211
  }
1212
- function Vt(e) {
1212
+ function Qt(e) {
1213
1213
  return e.type === "Feature" ? e.geometry : e;
1214
1214
  }
1215
- function Kt(e, r) {
1215
+ function Vt(e, r) {
1216
1216
  return e.type === "FeatureCollection" ? "FeatureCollection" : e.type === "GeometryCollection" ? "GeometryCollection" : e.type === "Feature" && e.geometry !== null ? e.geometry.type : e.type;
1217
1217
  }
1218
- var Dt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1219
- function Wt(e) {
1218
+ var bt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1219
+ function Kt(e) {
1220
1220
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1221
1221
  }
1222
- function er(e) {
1222
+ function Wt(e) {
1223
1223
  if (e.__esModule)
1224
1224
  return e;
1225
1225
  var r = e.default;
@@ -1240,11 +1240,11 @@ function er(e) {
1240
1240
  });
1241
1241
  }), n;
1242
1242
  }
1243
- var lt = { exports: {} }, kt = { exports: {} };
1243
+ var lt = { exports: {} }, Dt = { exports: {} };
1244
1244
  (function(e, r) {
1245
1245
  (function(n, o) {
1246
1246
  e.exports = o();
1247
- })(Dt, function() {
1247
+ })(bt, function() {
1248
1248
  function n(f, h, y, x, _) {
1249
1249
  (function v(M, S, D, A, Y) {
1250
1250
  for (; A > D; ) {
@@ -1471,10 +1471,10 @@ var lt = { exports: {} }, kt = { exports: {} };
1471
1471
  f[h].children.length === 0 ? h > 0 ? (y = f[h - 1].children).splice(y.indexOf(f[h]), 1) : this.clear() : u(f[h], this.toBBox);
1472
1472
  }, s;
1473
1473
  });
1474
- })(kt);
1475
- var tr = kt.exports;
1476
- class rr {
1477
- constructor(r = [], n = nr) {
1474
+ })(Dt);
1475
+ var er = Dt.exports;
1476
+ class tr {
1477
+ constructor(r = [], n = rr) {
1478
1478
  if (this.data = r, this.length = this.data.length, this.compare = n, this.length > 0)
1479
1479
  for (let o = (this.length >> 1) - 1; o >= 0; o--)
1480
1480
  this._down(o);
@@ -1513,14 +1513,14 @@ class rr {
1513
1513
  n[r] = s;
1514
1514
  }
1515
1515
  }
1516
- function nr(e, r) {
1516
+ function rr(e, r) {
1517
1517
  return e < r ? -1 : e > r ? 1 : 0;
1518
1518
  }
1519
- const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1519
+ const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1520
1520
  __proto__: null,
1521
- default: rr
1522
- }, Symbol.toStringTag, { value: "Module" })), ir = /* @__PURE__ */ er(or);
1523
- var je = { exports: {} }, sr = function(r, n, o, a) {
1521
+ default: tr
1522
+ }, Symbol.toStringTag, { value: "Module" })), or = /* @__PURE__ */ Wt(nr);
1523
+ var je = { exports: {} }, ir = function(r, n, o, a) {
1524
1524
  var s = r[0], i = r[1], u = !1;
1525
1525
  o === void 0 && (o = 0), a === void 0 && (a = n.length);
1526
1526
  for (var c = (a - o) / 2, l = 0, g = c - 1; l < c; g = l++) {
@@ -1528,7 +1528,7 @@ var je = { exports: {} }, sr = function(r, n, o, a) {
1528
1528
  b && (u = !u);
1529
1529
  }
1530
1530
  return u;
1531
- }, ar = function(r, n, o, a) {
1531
+ }, sr = function(r, n, o, a) {
1532
1532
  var s = r[0], i = r[1], u = !1;
1533
1533
  o === void 0 && (o = 0), a === void 0 && (a = n.length);
1534
1534
  for (var c = a - o, l = 0, g = c - 1; l < c; g = l++) {
@@ -1536,17 +1536,17 @@ var je = { exports: {} }, sr = function(r, n, o, a) {
1536
1536
  b && (u = !u);
1537
1537
  }
1538
1538
  return u;
1539
- }, Et = sr, At = ar;
1539
+ }, kt = ir, Et = sr;
1540
1540
  je.exports = function(r, n, o, a) {
1541
- return n.length > 0 && Array.isArray(n[0]) ? At(r, n, o, a) : Et(r, n, o, a);
1541
+ return n.length > 0 && Array.isArray(n[0]) ? Et(r, n, o, a) : kt(r, n, o, a);
1542
1542
  };
1543
- je.exports.nested = At;
1544
- je.exports.flat = Et;
1545
- var ur = je.exports, it = { exports: {} };
1543
+ je.exports.nested = Et;
1544
+ je.exports.flat = kt;
1545
+ var ar = je.exports, it = { exports: {} };
1546
1546
  (function(e, r) {
1547
1547
  (function(n, o) {
1548
1548
  o(r);
1549
- })(Dt, function(n) {
1549
+ })(bt, function(n) {
1550
1550
  const a = 33306690738754706e-32;
1551
1551
  function s(b, F, X, f, h) {
1552
1552
  let y, x, _, v, M = F[0], S = f[0], D = 0, A = 0;
@@ -1595,13 +1595,13 @@ var ur = je.exports, it = { exports: {} };
1595
1595
  }, Object.defineProperty(n, "__esModule", { value: !0 });
1596
1596
  });
1597
1597
  })(it, it.exports);
1598
- var cr = it.exports, pt = tr, Je = ir, lr = ur, fr = cr.orient2d;
1598
+ var ur = it.exports, pt = er, Je = or, cr = ar, lr = ur.orient2d;
1599
1599
  Je.default && (Je = Je.default);
1600
- lt.exports = Xt;
1601
- lt.exports.default = Xt;
1602
- function Xt(e, r, n) {
1600
+ lt.exports = At;
1601
+ lt.exports.default = At;
1602
+ function At(e, r, n) {
1603
1603
  r = Math.max(0, r === void 0 ? 2 : r), n = n || 0;
1604
- var o = xr(e), a = new pt(16);
1604
+ var o = gr(e), a = new pt(16);
1605
1605
  a.toBBox = function(f) {
1606
1606
  return {
1607
1607
  minX: f[0],
@@ -1625,7 +1625,7 @@ function Xt(e, r, n) {
1625
1625
  var p = s.shift(), z = p.p, m = p.next.p, b = We(z, m);
1626
1626
  if (!(b < d)) {
1627
1627
  var F = b / g;
1628
- c = hr(a, p.prev.p, z, m, p.next.next.p, F, l), c && Math.min(We(c, z), We(c, m)) <= F && (s.push(p), s.push(wt(c, p)), a.remove(c), l.remove(p), l.insert(Ke(p)), l.insert(Ke(p.next)));
1628
+ c = fr(a, p.prev.p, z, m, p.next.next.p, F, l), c && Math.min(We(c, z), We(c, m)) <= F && (s.push(p), s.push(wt(c, p)), a.remove(c), l.remove(p), l.insert(Ke(p)), l.insert(Ke(p.next)));
1629
1629
  }
1630
1630
  }
1631
1631
  p = u;
@@ -1635,10 +1635,10 @@ function Xt(e, r, n) {
1635
1635
  while (p !== u);
1636
1636
  return X.push(p.p), X;
1637
1637
  }
1638
- function hr(e, r, n, o, a, s, i) {
1639
- for (var u = new Je([], yr), c = e.data; c; ) {
1638
+ function fr(e, r, n, o, a, s, i) {
1639
+ for (var u = new Je([], hr), c = e.data; c; ) {
1640
1640
  for (var l = 0; l < c.children.length; l++) {
1641
- var g = c.children[l], d = c.leaf ? et(g, n, o) : dr(n, o, g);
1641
+ var g = c.children[l], d = c.leaf ? et(g, n, o) : yr(n, o, g);
1642
1642
  d > s || u.push({
1643
1643
  node: g,
1644
1644
  dist: d
@@ -1653,10 +1653,10 @@ function hr(e, r, n, o, a, s, i) {
1653
1653
  }
1654
1654
  return null;
1655
1655
  }
1656
- function yr(e, r) {
1656
+ function hr(e, r) {
1657
1657
  return e.dist - r.dist;
1658
1658
  }
1659
- function dr(e, r, n) {
1659
+ function yr(e, r, n) {
1660
1660
  if (mt(e, n) || mt(r, n))
1661
1661
  return 0;
1662
1662
  var o = Ue(e[0], e[1], r[0], r[1], n.minX, n.minY, n.maxX, n.minY);
@@ -1676,29 +1676,29 @@ function mt(e, r) {
1676
1676
  }
1677
1677
  function vt(e, r, n) {
1678
1678
  for (var o = Math.min(e[0], r[0]), a = Math.min(e[1], r[1]), s = Math.max(e[0], r[0]), i = Math.max(e[1], r[1]), u = n.search({ minX: o, minY: a, maxX: s, maxY: i }), c = 0; c < u.length; c++)
1679
- if (gr(u[c].p, u[c].next.p, e, r))
1679
+ if (dr(u[c].p, u[c].next.p, e, r))
1680
1680
  return !1;
1681
1681
  return !0;
1682
1682
  }
1683
1683
  function De(e, r, n) {
1684
- return fr(e[0], e[1], r[0], r[1], n[0], n[1]);
1684
+ return lr(e[0], e[1], r[0], r[1], n[0], n[1]);
1685
1685
  }
1686
- function gr(e, r, n, o) {
1686
+ function dr(e, r, n, o) {
1687
1687
  return e !== o && r !== n && De(e, r, n) > 0 != De(e, r, o) > 0 && De(n, o, e) > 0 != De(n, o, r) > 0;
1688
1688
  }
1689
1689
  function Ke(e) {
1690
1690
  var r = e.p, n = e.next.p;
1691
1691
  return e.minX = Math.min(r[0], n[0]), e.minY = Math.min(r[1], n[1]), e.maxX = Math.max(r[0], n[0]), e.maxY = Math.max(r[1], n[1]), e;
1692
1692
  }
1693
- function xr(e) {
1693
+ function gr(e) {
1694
1694
  for (var r = e[0], n = e[0], o = e[0], a = e[0], s = 0; s < e.length; s++) {
1695
1695
  var i = e[s];
1696
1696
  i[0] < r[0] && (r = i), i[0] > o[0] && (o = i), i[1] < n[1] && (n = i), i[1] > a[1] && (a = i);
1697
1697
  }
1698
1698
  var u = [r, n, o, a], c = u.slice();
1699
1699
  for (s = 0; s < e.length; s++)
1700
- lr(e[s], u) || c.push(e[s]);
1701
- return mr(c);
1700
+ cr(e[s], u) || c.push(e[s]);
1701
+ return pr(c);
1702
1702
  }
1703
1703
  function wt(e, r) {
1704
1704
  var n = {
@@ -1730,11 +1730,11 @@ function Ue(e, r, n, o, a, s, i, u) {
1730
1730
  var D = (1 - y) * e + y * n, A = (1 - y) * r + y * o, Y = (1 - _) * a + _ * i, R = (1 - _) * s + _ * u, q = Y - D, se = R - A;
1731
1731
  return q * q + se * se;
1732
1732
  }
1733
- function pr(e, r) {
1733
+ function xr(e, r) {
1734
1734
  return e[0] === r[0] ? e[1] - r[1] : e[0] - r[0];
1735
1735
  }
1736
- function mr(e) {
1737
- e.sort(pr);
1736
+ function pr(e) {
1737
+ e.sort(xr);
1738
1738
  for (var r = [], n = 0; n < e.length; n++) {
1739
1739
  for (; r.length >= 2 && De(r[r.length - 2], r[r.length - 1], e[n]) <= 0; )
1740
1740
  r.pop();
@@ -1747,31 +1747,31 @@ function mr(e) {
1747
1747
  }
1748
1748
  return o.pop(), r.pop(), r.concat(o);
1749
1749
  }
1750
- var vr = lt.exports;
1751
- const wr = /* @__PURE__ */ Wt(vr);
1752
- function Mr(e, r) {
1750
+ var mr = lt.exports;
1751
+ const vr = /* @__PURE__ */ Kt(mr);
1752
+ function wr(e, r) {
1753
1753
  r === void 0 && (r = {}), r.concavity = r.concavity || 1 / 0;
1754
1754
  var n = [];
1755
1755
  if (Be(e, function(a) {
1756
1756
  n.push([a[0], a[1]]);
1757
1757
  }), !n.length)
1758
1758
  return null;
1759
- var o = wr(n, r.concavity);
1759
+ var o = vr(n, r.concavity);
1760
1760
  return o.length > 3 ? Re([o]) : null;
1761
1761
  }
1762
1762
  function st(e, r, n) {
1763
1763
  n === void 0 && (n = {});
1764
1764
  var o = ke(e), a = ke(r), s = de(a[1] - o[1]), i = de(a[0] - o[0]), u = de(o[1]), c = de(a[1]), l = Math.pow(Math.sin(s / 2), 2) + Math.pow(Math.sin(i / 2), 2) * Math.cos(u) * Math.cos(c);
1765
- return Zt(2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)), n.units);
1765
+ return Jt(2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)), n.units);
1766
1766
  }
1767
1767
  function re(e) {
1768
1768
  if (!e)
1769
1769
  throw new Error("geojson is required");
1770
1770
  switch (e.type) {
1771
1771
  case "Feature":
1772
- return Yt(e);
1772
+ return Xt(e);
1773
1773
  case "FeatureCollection":
1774
- return zr(e);
1774
+ return Mr(e);
1775
1775
  case "Point":
1776
1776
  case "LineString":
1777
1777
  case "Polygon":
@@ -1784,7 +1784,7 @@ function re(e) {
1784
1784
  throw new Error("unknown GeoJSON type");
1785
1785
  }
1786
1786
  }
1787
- function Yt(e) {
1787
+ function Xt(e) {
1788
1788
  var r = { type: "Feature" };
1789
1789
  return Object.keys(e).forEach(function(n) {
1790
1790
  switch (n) {
@@ -1795,18 +1795,18 @@ function Yt(e) {
1795
1795
  default:
1796
1796
  r[n] = e[n];
1797
1797
  }
1798
- }), r.properties = Ct(e.properties), r.geometry = ft(e.geometry), r;
1798
+ }), r.properties = Yt(e.properties), r.geometry = ft(e.geometry), r;
1799
1799
  }
1800
- function Ct(e) {
1800
+ function Yt(e) {
1801
1801
  var r = {};
1802
1802
  return e && Object.keys(e).forEach(function(n) {
1803
1803
  var o = e[n];
1804
1804
  typeof o == "object" ? o === null ? r[n] = null : Array.isArray(o) ? r[n] = o.map(function(a) {
1805
1805
  return a;
1806
- }) : r[n] = Ct(o) : r[n] = o;
1806
+ }) : r[n] = Yt(o) : r[n] = o;
1807
1807
  }), r;
1808
1808
  }
1809
- function zr(e) {
1809
+ function Mr(e) {
1810
1810
  var r = { type: "FeatureCollection" };
1811
1811
  return Object.keys(e).forEach(function(n) {
1812
1812
  switch (n) {
@@ -1817,22 +1817,22 @@ function zr(e) {
1817
1817
  r[n] = e[n];
1818
1818
  }
1819
1819
  }), r.features = e.features.map(function(n) {
1820
- return Yt(n);
1820
+ return Xt(n);
1821
1821
  }), r;
1822
1822
  }
1823
1823
  function ft(e) {
1824
1824
  var r = { type: e.type };
1825
1825
  return e.bbox && (r.bbox = e.bbox), e.type === "GeometryCollection" ? (r.geometries = e.geometries.map(function(n) {
1826
1826
  return ft(n);
1827
- }), r) : (r.coordinates = Ft(e.coordinates), r);
1827
+ }), r) : (r.coordinates = Ct(e.coordinates), r);
1828
1828
  }
1829
- function Ft(e) {
1829
+ function Ct(e) {
1830
1830
  var r = e;
1831
1831
  return typeof r[0] != "object" ? r.slice() : r.map(function(n) {
1832
- return Ft(n);
1832
+ return Ct(n);
1833
1833
  });
1834
1834
  }
1835
- var _r = (
1835
+ var zr = (
1836
1836
  /** @class */
1837
1837
  function() {
1838
1838
  function e(r) {
@@ -1889,19 +1889,19 @@ var _r = (
1889
1889
  if (o >= 1)
1890
1890
  return this.points[this.length - 1];
1891
1891
  var a = Math.floor((this.points.length - 1) * o), s = (this.length - 1) * o - a;
1892
- return Sr(s, this.points[a], this.controls[a][1], this.controls[a + 1][0], this.points[a + 1]);
1892
+ return _r(s, this.points[a], this.controls[a][1], this.controls[a + 1][0], this.points[a + 1]);
1893
1893
  }, e;
1894
1894
  }()
1895
1895
  );
1896
- function Sr(e, r, n, o, a) {
1897
- var s = Lr(e), i = {
1896
+ function _r(e, r, n, o, a) {
1897
+ var s = Sr(e), i = {
1898
1898
  x: a.x * s[0] + o.x * s[1] + n.x * s[2] + r.x * s[3],
1899
1899
  y: a.y * s[0] + o.y * s[1] + n.y * s[2] + r.y * s[3],
1900
1900
  z: a.z * s[0] + o.z * s[1] + n.z * s[2] + r.z * s[3]
1901
1901
  };
1902
1902
  return i;
1903
1903
  }
1904
- function Lr(e) {
1904
+ function Sr(e) {
1905
1905
  var r = e * e, n = r * e;
1906
1906
  return [
1907
1907
  n,
@@ -1912,9 +1912,9 @@ function Lr(e) {
1912
1912
  }
1913
1913
  function at(e, r) {
1914
1914
  r === void 0 && (r = {});
1915
- for (var n = r.resolution || 1e4, o = r.sharpness || 0.85, a = [], s = Vt(e).coordinates.map(function(l) {
1915
+ for (var n = r.resolution || 1e4, o = r.sharpness || 0.85, a = [], s = Qt(e).coordinates.map(function(l) {
1916
1916
  return { x: l[0], y: l[1] };
1917
- }), i = new _r({
1917
+ }), i = new zr({
1918
1918
  duration: n,
1919
1919
  points: s,
1920
1920
  sharpness: o
@@ -1925,7 +1925,7 @@ function at(e, r) {
1925
1925
  u(c);
1926
1926
  return u(i.duration), Ze(a, r.properties);
1927
1927
  }
1928
- function Pr(e, r) {
1928
+ function Lr(e, r) {
1929
1929
  r === void 0 && (r = {});
1930
1930
  var n = Number(e[0]), o = Number(e[1]), a = Number(e[2]), s = Number(e[3]);
1931
1931
  if (e.length === 6)
@@ -1933,29 +1933,29 @@ function Pr(e, r) {
1933
1933
  var i = [n, o], u = [n, s], c = [a, s], l = [a, o];
1934
1934
  return Re([[i, l, c, u, i]], r.properties, { bbox: e, id: r.id });
1935
1935
  }
1936
- function It(e, r, n, o) {
1936
+ function Ft(e, r, n, o) {
1937
1937
  o === void 0 && (o = {});
1938
- var a = ke(e), s = de(a[0]), i = de(a[1]), u = de(n), c = jt(r, o.units), l = Math.asin(Math.sin(i) * Math.cos(c) + Math.cos(i) * Math.sin(c) * Math.cos(u)), g = s + Math.atan2(Math.sin(u) * Math.sin(c) * Math.cos(i), Math.cos(c) - Math.sin(i) * Math.sin(l)), d = nt(g), p = nt(l);
1938
+ var a = ke(e), s = de(a[0]), i = de(a[1]), u = de(n), c = Zt(r, o.units), l = Math.asin(Math.sin(i) * Math.cos(c) + Math.cos(i) * Math.sin(c) * Math.cos(u)), g = s + Math.atan2(Math.sin(u) * Math.sin(c) * Math.cos(i), Math.cos(c) - Math.sin(i) * Math.sin(l)), d = nt(g), p = nt(l);
1939
1939
  return pe([d, p], o.properties);
1940
1940
  }
1941
- function Ot(e, r, n) {
1941
+ function It(e, r, n) {
1942
1942
  n === void 0 && (n = {});
1943
1943
  for (var o = n.steps || 64, a = n.properties ? n.properties : !Array.isArray(e) && e.type === "Feature" && e.properties ? e.properties : {}, s = [], i = 0; i < o; i++)
1944
- s.push(It(e, r, i * -360 / o, n).geometry.coordinates);
1944
+ s.push(Ft(e, r, i * -360 / o, n).geometry.coordinates);
1945
1945
  return s.push(s[0]), Re([s], a);
1946
1946
  }
1947
- function Rt(e, r, n) {
1947
+ function Ot(e, r, n) {
1948
1948
  if (n === void 0 && (n = {}), n.final === !0)
1949
- return br(e, r);
1949
+ return Pr(e, r);
1950
1950
  var o = ke(e), a = ke(r), s = de(o[0]), i = de(a[0]), u = de(o[1]), c = de(a[1]), l = Math.sin(i - s) * Math.cos(c), g = Math.cos(u) * Math.sin(c) - Math.sin(u) * Math.cos(c) * Math.cos(i - s);
1951
1951
  return nt(Math.atan2(l, g));
1952
1952
  }
1953
- function br(e, r) {
1954
- var n = Rt(r, e);
1953
+ function Pr(e, r) {
1954
+ var n = Ot(r, e);
1955
1955
  return n = (n + 180) % 360, n;
1956
1956
  }
1957
- function Dr(e, r) {
1958
- var n = st(e, r), o = Rt(e, r), a = It(e, n / 2, o);
1957
+ function br(e, r) {
1958
+ var n = st(e, r), o = Ot(e, r), a = Ft(e, n / 2, o);
1959
1959
  return a;
1960
1960
  }
1961
1961
  function Mt(e, r) {
@@ -1966,7 +1966,7 @@ function Mt(e, r) {
1966
1966
  }, !0), pe([n / a, o / a], r.properties);
1967
1967
  }
1968
1968
  function ut(e, r) {
1969
- switch (r === void 0 && (r = {}), Kt(e)) {
1969
+ switch (r === void 0 && (r = {}), Vt(e)) {
1970
1970
  case "Point":
1971
1971
  return pe(ke(e), r.properties);
1972
1972
  case "Polygon":
@@ -1984,17 +1984,17 @@ function ut(e, r) {
1984
1984
  var X = u * 0.5, f = 1 / (6 * X);
1985
1985
  return pe([a[0] + f * s, a[1] + f * i], r.properties);
1986
1986
  default:
1987
- var h = Mr(e);
1987
+ var h = wr(e);
1988
1988
  return h ? ut(h, { properties: r.properties }) : Mt(e, { properties: r.properties });
1989
1989
  }
1990
1990
  }
1991
1991
  var zt = 6378137;
1992
1992
  function tt(e) {
1993
- return Qt(e, function(r, n) {
1994
- return r + kr(n);
1993
+ return Ht(e, function(r, n) {
1994
+ return r + Dr(n);
1995
1995
  }, 0);
1996
1996
  }
1997
- function kr(e) {
1997
+ function Dr(e) {
1998
1998
  var r = 0, n;
1999
1999
  switch (e.type) {
2000
2000
  case "Polygon":
@@ -2032,7 +2032,7 @@ function St(e) {
2032
2032
  function rt(e) {
2033
2033
  return e * Math.PI / 180;
2034
2034
  }
2035
- const Er = (e, r, n, o) => {
2035
+ const kr = (e, r, n, o) => {
2036
2036
  e.addLayer({
2037
2037
  id: r,
2038
2038
  type: "symbol",
@@ -2110,7 +2110,7 @@ const Er = (e, r, n, o) => {
2110
2110
  "fill-opacity": 0.8
2111
2111
  }
2112
2112
  });
2113
- }, Lt = (e) => {
2113
+ }, Er = (e) => {
2114
2114
  let r = !1, n = e, o = [], a = n.length - 1;
2115
2115
  for (let i = 0; i < a; i++) {
2116
2116
  let u = n[i], c = n[i + 1];
@@ -2235,8 +2235,8 @@ function Xr(e, r, n, o, a) {
2235
2235
  }, R = () => {
2236
2236
  I(), ee(), e.addSource(i, { type: "geojson", data: y }), _e(e, i, i, l), xe(e, i + "outline", i, { "line-color": "black", "line-width": 2, ...l });
2237
2237
  }, q = (P, O) => {
2238
- const N = pe([P.lng, P.lat]), T = O / 2 / 111320, ue = ot(Ot(N, T, { units: "degrees" }));
2239
- return Pr(ue);
2238
+ const N = pe([P.lng, P.lat]), T = O / 2 / 111320, ue = ot(It(N, T, { units: "degrees" }));
2239
+ return Lr(ue);
2240
2240
  }, se = (P, O) => {
2241
2241
  const N = q(P, O);
2242
2242
  y.geometry = N.geometry, e.getSource(i).setData(y);
@@ -2311,16 +2311,12 @@ function Xr(e, r, n, o, a) {
2311
2311
  const N = y.geometry.coordinates[0].length;
2312
2312
  y.geometry.coordinates[0].splice(N - 2, 1), O.setData(re(y));
2313
2313
  }
2314
- if (Lt(m)) {
2315
- alert("落区自相交,请重画"), u.pop(), c.pop(), e.removeLayer(i), e.removeLayer(i + "outline"), e.removeLayer(i + "point");
2316
- return;
2317
- }
2318
2314
  z || (e.setLayoutProperty(i, "visibility", "none"), e.setLayoutProperty(i + "outline", "visibility", "none")), e.setLayoutProperty(i + "point", "visibility", "none"), p && O.setData(re(k(y)));
2319
2315
  break;
2320
2316
  case "free":
2321
2317
  if (y.geometry.coordinates[0].length) {
2322
2318
  const N = y.geometry.coordinates[0].length;
2323
- if (y.geometry.coordinates[0].splice(N - 2, 1), O.setData(re(y)), Lt(m)) {
2319
+ if (y.geometry.coordinates[0].splice(N - 2, 1), O.setData(re(y)), Er(m)) {
2324
2320
  alert("落区自相交,请重画"), u.pop(), c.pop(), e.removeLayer(i), e.removeLayer(i + "outline");
2325
2321
  return;
2326
2322
  }
@@ -2331,8 +2327,8 @@ function Xr(e, r, n, o, a) {
2331
2327
  let Me = [];
2332
2328
  Te.forEach((fe) => {
2333
2329
  if (fe.length > 1) {
2334
- const Bt = new j(fe).getLUT();
2335
- Me.push(...Bt);
2330
+ const Rt = new j(fe).getLUT();
2331
+ Me.push(...Rt);
2336
2332
  } else
2337
2333
  Me.push(...fe);
2338
2334
  }), y.geometry.coordinates[0].length = 0;
@@ -2444,7 +2440,7 @@ function Yr(e, r) {
2444
2440
  geometry: { type: "Point", coordinates: w.lngLat.toArray() }
2445
2441
  }), e.getSource(o).setData(re(p)), r && r(R());
2446
2442
  }, f = (w) => {
2447
- v(), Q(), e.addSource(o, { type: "geojson", data: p }), Er(e, o, o, i), p.features.push({
2443
+ v(), Q(), e.addSource(o, { type: "geojson", data: p }), kr(e, o, o, i), p.features.push({
2448
2444
  type: "Feature",
2449
2445
  properties: i,
2450
2446
  geometry: { type: "Point", coordinates: w.lngLat.toArray() }
@@ -2507,7 +2503,7 @@ function Yr(e, r) {
2507
2503
  case "line":
2508
2504
  if (z.geometry.coordinates.length) {
2509
2505
  z.geometry.coordinates.length == 1 && z.geometry.coordinates.push(w.lngLat.toArray()), z.geometry.coordinates[z.geometry.coordinates.length - 1] = w.lngLat.toArray(), e.getSource(o).setData(z);
2510
- const Z = z.geometry.coordinates[z.geometry.coordinates.length - 2], oe = z.geometry.coordinates[z.geometry.coordinates.length - 1], ee = st(Z, oe, { units: "kilometers" }), te = Dr(pe(Z), pe(oe)), ae = p.features[p.features.length - 1];
2506
+ const Z = z.geometry.coordinates[z.geometry.coordinates.length - 2], oe = z.geometry.coordinates[z.geometry.coordinates.length - 1], ee = st(Z, oe, { units: "kilometers" }), te = br(pe(Z), pe(oe)), ae = p.features[p.features.length - 1];
2511
2507
  ae.properties.result = $e(ee, 4) + "km", ae.geometry.coordinates = te.geometry.coordinates, e.getSource(o + "text").setData(re(p));
2512
2508
  }
2513
2509
  break;
@@ -2539,7 +2535,7 @@ function Yr(e, r) {
2539
2535
  case "circle":
2540
2536
  if (p.features.length) {
2541
2537
  p.features[1].geometry.coordinates = w.lngLat.toArray();
2542
- var G = pe(p.features[0].geometry.coordinates), B = pe(p.features[1].geometry.coordinates), $ = st(G, B, { units: "miles" }), J = { steps: 500, units: "miles", properties: { foo: "bar" } }, U = Ot(G, $, J);
2538
+ var G = pe(p.features[0].geometry.coordinates), B = pe(p.features[1].geometry.coordinates), $ = st(G, B, { units: "miles" }), J = { steps: 500, units: "miles", properties: { foo: "bar" } }, U = It(G, $, J);
2543
2539
  m.geometry.coordinates = U.geometry.coordinates;
2544
2540
  const ie = tt(m) / 1e6;
2545
2541
  b.properties.result = $e(ie, 2) + "km²";
@@ -1 +1 @@
1
- (function(Me,ge){typeof exports=="object"&&typeof module<"u"?ge(exports):typeof define=="function"&&define.amd?define(["exports"],ge):(Me=typeof globalThis<"u"?globalThis:Me||self,ge(Me.index={}))})(this,function(Me){"use strict";const{abs:ge,cos:xe,sin:Pe,acos:qt,atan2:Xe,sqrt:ve,pow:fe}=Math;function Ye(e){return e<0?-fe(-e,1/3):fe(e,1/3)}const yt=Math.PI,Ne=2*yt,we=yt/2,Nt=1e-6,Qe=Number.MAX_SAFE_INTEGER||9007199254740991,Ve=Number.MIN_SAFE_INTEGER||-9007199254740991,Tt={x:0,y:0,z:0},L={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,r){const n=r(e);let o=n.x*n.x+n.y*n.y;return typeof n.z<"u"&&(o+=n.z*n.z),ve(o)},compute:function(e,r,n){if(e===0)return r[0].t=0,r[0];const o=r.length-1;if(e===1)return r[o].t=1,r[o];const a=1-e;let s=r;if(o===0)return r[0].t=e,r[0];if(o===1){const u={x:a*s[0].x+e*s[1].x,y:a*s[0].y+e*s[1].y,t:e};return n&&(u.z=a*s[0].z+e*s[1].z),u}if(o<4){let u=a*a,c=e*e,l,g,d,p=0;o===2?(s=[s[0],s[1],s[2],Tt],l=u,g=a*e*2,d=c):o===3&&(l=u*a,g=u*e*3,d=a*c*3,p=e*c);const z={x:l*s[0].x+g*s[1].x+d*s[2].x+p*s[3].x,y:l*s[0].y+g*s[1].y+d*s[2].y+p*s[3].y,t:e};return n&&(z.z=l*s[0].z+g*s[1].z+d*s[2].z+p*s[3].z),z}const i=JSON.parse(JSON.stringify(r));for(;i.length>1;){for(let u=0;u<i.length-1;u++)i[u]={x:i[u].x+(i[u+1].x-i[u].x)*e,y:i[u].y+(i[u+1].y-i[u].y)*e},typeof i[u].z<"u"&&(i[u].z=i[u].z+(i[u+1].z-i[u].z)*e);i.splice(i.length-1,1)}return i[0].t=e,i[0]},computeWithRatios:function(e,r,n,o){const a=1-e,s=n,i=r;let u=s[0],c=s[1],l=s[2],g=s[3],d;if(u*=a,c*=e,i.length===2)return d=u+c,{x:(u*i[0].x+c*i[1].x)/d,y:(u*i[0].y+c*i[1].y)/d,z:o?(u*i[0].z+c*i[1].z)/d:!1,t:e};if(u*=a,c*=2*a,l*=e*e,i.length===3)return d=u+c+l,{x:(u*i[0].x+c*i[1].x+l*i[2].x)/d,y:(u*i[0].y+c*i[1].y+l*i[2].y)/d,z:o?(u*i[0].z+c*i[1].z+l*i[2].z)/d:!1,t:e};if(u*=a,c*=1.5*a,l*=3*a,g*=e*e*e,i.length===4)return d=u+c+l+g,{x:(u*i[0].x+c*i[1].x+l*i[2].x+g*i[3].x)/d,y:(u*i[0].y+c*i[1].y+l*i[2].y+g*i[3].y)/d,z:o?(u*i[0].z+c*i[1].z+l*i[2].z+g*i[3].z)/d:!1,t:e}},derive:function(e,r){const n=[];for(let o=e,a=o.length,s=a-1;a>1;a--,s--){const i=[];for(let u=0,c;u<s;u++)c={x:s*(o[u+1].x-o[u].x),y:s*(o[u+1].y-o[u].y)},r&&(c.z=s*(o[u+1].z-o[u].z)),i.push(c);n.push(i),o=i}return n},between:function(e,r,n){return r<=e&&e<=n||L.approximately(e,r)||L.approximately(e,n)},approximately:function(e,r,n){return ge(e-r)<=(n||Nt)},length:function(e){const n=L.Tvalues.length;let o=0;for(let a=0,s;a<n;a++)s=.5*L.Tvalues[a]+.5,o+=L.Cvalues[a]*L.arcfn(s,e);return .5*o},map:function(e,r,n,o,a){const s=n-r,i=a-o,u=e-r,c=u/s;return o+i*c},lerp:function(e,r,n){const o={x:r.x+e*(n.x-r.x),y:r.y+e*(n.y-r.y)};return r.z!==void 0&&n.z!==void 0&&(o.z=r.z+e*(n.z-r.z)),o},pointToString:function(e){let r=e.x+"/"+e.y;return typeof e.z<"u"&&(r+="/"+e.z),r},pointsToString:function(e){return"["+e.map(L.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,r,n){const o=r.x-e.x,a=r.y-e.y,s=n.x-e.x,i=n.y-e.y,u=o*i-a*s,c=o*s+a*i;return Xe(u,c)},round:function(e,r){const n=""+e,o=n.indexOf(".");return parseFloat(n.substring(0,o+1+r))},dist:function(e,r){const n=e.x-r.x,o=e.y-r.y;return ve(n*n+o*o)},closest:function(e,r){let n=fe(2,63),o,a;return e.forEach(function(s,i){a=L.dist(r,s),a<n&&(n=a,o=i)}),{mdist:n,mpos:o}},abcratio:function(e,r){if(r!==2&&r!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const n=fe(e,r)+fe(1-e,r),o=n-1;return ge(o/n)},projectionratio:function(e,r){if(r!==2&&r!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const n=fe(1-e,r),o=fe(e,r)+n;return n/o},lli8:function(e,r,n,o,a,s,i,u){const c=(e*o-r*n)*(a-i)-(e-n)*(a*u-s*i),l=(e*o-r*n)*(s-u)-(r-o)*(a*u-s*i),g=(e-n)*(s-u)-(r-o)*(a-i);return g==0?!1:{x:c/g,y:l/g}},lli4:function(e,r,n,o){const a=e.x,s=e.y,i=r.x,u=r.y,c=n.x,l=n.y,g=o.x,d=o.y;return L.lli8(a,s,i,u,c,l,g,d)},lli:function(e,r){return L.lli4(e,e.c,r,r.c)},makeline:function(e,r){return new Z(e.x,e.y,(e.x+r.x)/2,(e.y+r.y)/2,r.x,r.y)},findbbox:function(e){let r=Qe,n=Qe,o=Ve,a=Ve;return e.forEach(function(s){const i=s.bbox();r>i.x.min&&(r=i.x.min),n>i.y.min&&(n=i.y.min),o<i.x.max&&(o=i.x.max),a<i.y.max&&(a=i.y.max)}),{x:{min:r,mid:(r+o)/2,max:o,size:o-r},y:{min:n,mid:(n+a)/2,max:a,size:a-n}}},shapeintersections:function(e,r,n,o,a){if(!L.bboxoverlap(r,o))return[];const s=[],i=[e.startcap,e.forward,e.back,e.endcap],u=[n.startcap,n.forward,n.back,n.endcap];return i.forEach(function(c){c.virtual||u.forEach(function(l){if(l.virtual)return;const g=c.intersects(l,a);g.length>0&&(g.c1=c,g.c2=l,g.s1=e,g.s2=n,s.push(g))})}),s},makeshape:function(e,r,n){const o=r.points.length,a=e.points.length,s=L.makeline(r.points[o-1],e.points[0]),i=L.makeline(e.points[a-1],r.points[0]),u={startcap:s,forward:e,back:r,endcap:i,bbox:L.findbbox([s,e,r,i])};return u.intersections=function(c){return L.shapeintersections(u,u.bbox,c,c.bbox,n)},u},getminmax:function(e,r,n){if(!n)return{min:0,max:0};let o=Qe,a=Ve,s,i;n.indexOf(0)===-1&&(n=[0].concat(n)),n.indexOf(1)===-1&&n.push(1);for(let u=0,c=n.length;u<c;u++)s=n[u],i=e.get(s),i[r]<o&&(o=i[r]),i[r]>a&&(a=i[r]);return{min:o,mid:(o+a)/2,max:a,size:a-o}},align:function(e,r){const n=r.p1.x,o=r.p1.y,a=-Xe(r.p2.y-o,r.p2.x-n),s=function(i){return{x:(i.x-n)*xe(a)-(i.y-o)*Pe(a),y:(i.x-n)*Pe(a)+(i.y-o)*xe(a)}};return e.map(s)},roots:function(e,r){r=r||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,o=L.align(e,r),a=function(v){return 0<=v&&v<=1};if(n===2){const v=o[0].y,M=o[1].y,_=o[2].y,D=v-2*M+_;if(D!==0){const A=-ve(M*M-v*_),Y=-v+M,R=-(A+Y)/D,q=-(-A+Y)/D;return[R,q].filter(a)}else if(M!==_&&D===0)return[(2*M-_)/(2*M-2*_)].filter(a);return[]}const s=o[0].y,i=o[1].y,u=o[2].y,c=o[3].y;let l=-s+3*i-3*u+c,g=3*s-6*i+3*u,d=-3*s+3*i,p=s;if(L.approximately(l,0)){if(L.approximately(g,0))return L.approximately(d,0)?[]:[-p/d].filter(a);const v=ve(d*d-4*g*p),M=2*g;return[(v-d)/M,(-d-v)/M].filter(a)}g/=l,d/=l,p/=l;const z=(3*d-g*g)/3,m=z/3,b=(2*g*g*g-9*g*d+27*p)/27,F=b/2,X=F*F+m*m*m;let f,h,y,x,S;if(X<0){const v=-z/3,M=v*v*v,_=ve(M),D=-b/(2*_),A=D<-1?-1:D>1?1:D,Y=qt(A),R=Ye(_),q=2*R;return y=q*xe(Y/3)-g/3,x=q*xe((Y+Ne)/3)-g/3,S=q*xe((Y+2*Ne)/3)-g/3,[y,x,S].filter(a)}else{if(X===0)return f=F<0?Ye(-F):-Ye(F),y=2*f-g/3,x=-f-g/3,[y,x].filter(a);{const v=ve(X);return f=Ye(-F+v),h=Ye(F+v),[f-h-g/3].filter(a)}}},droots:function(e){if(e.length===3){const r=e[0],n=e[1],o=e[2],a=r-2*n+o;if(a!==0){const s=-ve(n*n-r*o),i=-r+n,u=-(s+i)/a,c=-(-s+i)/a;return[u,c]}else if(n!==o&&a===0)return[(2*n-o)/(2*(n-o))];return[]}if(e.length===2){const r=e[0],n=e[1];return r!==n?[r/(r-n)]:[]}return[]},curvature:function(e,r,n,o,a){let s,i,u,c,l=0,g=0;const d=L.compute(e,r),p=L.compute(e,n),z=d.x*d.x+d.y*d.y;if(o?(s=ve(fe(d.y*p.z-p.y*d.z,2)+fe(d.z*p.x-p.z*d.x,2)+fe(d.x*p.y-p.x*d.y,2)),i=fe(z+d.z*d.z,3/2)):(s=d.x*p.y-d.y*p.x,i=fe(z,3/2)),s===0||i===0)return{k:0,r:0};if(l=s/i,g=i/s,!a){const m=L.curvature(e-.001,r,n,o,!0).k,b=L.curvature(e+.001,r,n,o,!0).k;c=(b-l+(l-m))/2,u=(ge(b-l)+ge(l-m))/2}return{k:l,r:g,dk:c,adk:u}},inflections:function(e){if(e.length<4)return[];const r=L.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=r[2].x*r[1].y,o=r[3].x*r[1].y,a=r[1].x*r[2].y,s=r[3].x*r[2].y,i=18*(-3*n+2*o+3*a-s),u=18*(3*n-o-3*a),c=18*(a-n);if(L.approximately(i,0)){if(!L.approximately(u,0)){let p=-c/u;if(0<=p&&p<=1)return[p]}return[]}const l=2*i;if(L.approximately(l,0))return[];const g=u*u-4*i*c;if(g<0)return[];const d=Math.sqrt(g);return[(d-u)/l,-(u+d)/l].filter(function(p){return 0<=p&&p<=1})},bboxoverlap:function(e,r){const n=["x","y"],o=n.length;for(let a=0,s,i,u,c;a<o;a++)if(s=n[a],i=e[s].mid,u=r[s].mid,c=(e[s].size+r[s].size)/2,ge(i-u)>=c)return!1;return!0},expandbox:function(e,r){r.x.min<e.x.min&&(e.x.min=r.x.min),r.y.min<e.y.min&&(e.y.min=r.y.min),r.z&&r.z.min<e.z.min&&(e.z.min=r.z.min),r.x.max>e.x.max&&(e.x.max=r.x.max),r.y.max>e.y.max&&(e.y.max=r.y.max),r.z&&r.z.max>e.z.max&&(e.z.max=r.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,r,n){const o=e.bbox(),a=r.bbox(),s=1e5,i=n||.5;if(o.x.size+o.y.size<i&&a.x.size+a.y.size<i)return[(s*(e._t1+e._t2)/2|0)/s+"/"+(s*(r._t1+r._t2)/2|0)/s];let u=e.split(.5),c=r.split(.5),l=[{left:u.left,right:c.left},{left:u.left,right:c.right},{left:u.right,right:c.right},{left:u.right,right:c.left}];l=l.filter(function(d){return L.bboxoverlap(d.left.bbox(),d.right.bbox())});let g=[];return l.length===0||(l.forEach(function(d){g=g.concat(L.pairiteration(d.left,d.right,i))}),g=g.filter(function(d,p){return g.indexOf(d)===p})),g},getccenter:function(e,r,n){const o=r.x-e.x,a=r.y-e.y,s=n.x-r.x,i=n.y-r.y,u=o*xe(we)-a*Pe(we),c=o*Pe(we)+a*xe(we),l=s*xe(we)-i*Pe(we),g=s*Pe(we)+i*xe(we),d=(e.x+r.x)/2,p=(e.y+r.y)/2,z=(r.x+n.x)/2,m=(r.y+n.y)/2,b=d+u,F=p+c,X=z+l,f=m+g,h=L.lli8(d,p,b,F,z,m,X,f),y=L.dist(h,e);let x=Xe(e.y-h.y,e.x-h.x),S=Xe(r.y-h.y,r.x-h.x),v=Xe(n.y-h.y,n.x-h.x),M;return x<v?((x>S||S>v)&&(x+=Ne),x>v&&(M=v,v=x,x=M)):v<S&&S<x?(M=v,v=x,x=M):v+=Ne,h.s=x,h.e=v,h.r=y,h},numberSort:function(e,r){return e-r}};class Ce{constructor(r){this.curves=[],this._3d=!1,r&&(this.curves=r,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(r){return L.pointsToString(r.points)}).join(", ")+"]"}addCurve(r){this.curves.push(r),this._3d=this._3d||r._3d}length(){return this.curves.map(function(r){return r.length()}).reduce(function(r,n){return r+n})}curve(r){return this.curves[r]}bbox(){const r=this.curves;for(var n=r[0].bbox(),o=1;o<r.length;o++)L.expandbox(n,r[o].bbox());return n}offset(r){const n=[];return this.curves.forEach(function(o){n.push(...o.offset(r))}),new Ce(n)}}const{abs:Fe,min:dt,max:gt,cos:Gt,sin:$t,acos:Ut,sqrt:Oe}=Math,Jt=Math.PI;class Z{constructor(r){let n=r&&r.forEach?r:Array.from(arguments).slice(),o=!1;if(typeof n[0]=="object"){o=n.length;const z=[];n.forEach(function(m){["x","y","z"].forEach(function(b){typeof m[b]<"u"&&z.push(m[b])})}),n=z}let a=!1;const s=n.length;if(o){if(o>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");a=!0}}else if(s!==6&&s!==8&&s!==9&&s!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const i=this._3d=!a&&(s===9||s===12)||r&&r[0]&&typeof r[0].z<"u",u=this.points=[];for(let z=0,m=i?3:2;z<s;z+=m){var c={x:n[z],y:n[z+1]};i&&(c.z=n[z+2]),u.push(c)}const l=this.order=u.length-1,g=this.dims=["x","y"];i&&g.push("z"),this.dimlen=g.length;const d=L.align(u,{p1:u[0],p2:u[l]}),p=L.dist(u[0],u[l]);this._linear=d.reduce((z,m)=>z+Fe(m.y),0)<p/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(r,n,o,a){if(typeof a>"u"&&(a=.5),a===0)return new Z(n,n,o);if(a===1)return new Z(r,n,n);const s=Z.getABC(2,r,n,o,a);return new Z(r,s.A,o)}static cubicFromPoints(r,n,o,a,s){typeof a>"u"&&(a=.5);const i=Z.getABC(3,r,n,o,a);typeof s>"u"&&(s=L.dist(n,i.C));const u=s*(1-a)/a,c=L.dist(r,o),l=(o.x-r.x)/c,g=(o.y-r.y)/c,d=s*l,p=s*g,z=u*l,m=u*g,b={x:n.x-d,y:n.y-p},F={x:n.x+z,y:n.y+m},X=i.A,f={x:X.x+(b.x-X.x)/(1-a),y:X.y+(b.y-X.y)/(1-a)},h={x:X.x+(F.x-X.x)/a,y:X.y+(F.y-X.y)/a},y={x:r.x+(f.x-r.x)/a,y:r.y+(f.y-r.y)/a},x={x:o.x+(h.x-o.x)/(1-a),y:o.y+(h.y-o.y)/(1-a)};return new Z(r,y,x,o)}static getUtils(){return L}getUtils(){return Z.getUtils()}static get PolyBezier(){return Ce}valueOf(){return this.toString()}toString(){return L.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const r=this.points,n=r[0].x,o=r[0].y,a=["M",n,o,this.order===2?"Q":"C"];for(let s=1,i=r.length;s<i;s++)a.push(r[s].x),a.push(r[s].y);return a.join(" ")}setRatios(r){if(r.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=r,this._lut=[]}verify(){const r=this.coordDigest();r!==this._print&&(this._print=r,this.update())}coordDigest(){return this.points.map(function(r,n){return""+n+r.x+r.y+(r.z?r.z:0)}).join("")}update(){this._lut=[],this.dpoints=L.derive(this.points,this._3d),this.computedirection()}computedirection(){const r=this.points,n=L.angle(r[0],r[this.order],r[1]);this.clockwise=n>0}length(){return L.length(this.derivative.bind(this))}static getABC(r=2,n,o,a,s=.5){const i=L.projectionratio(s,r),u=1-i,c={x:i*n.x+u*a.x,y:i*n.y+u*a.y},l=L.abcratio(s,r);return{A:{x:o.x+(o.x-c.x)/l,y:o.y+(o.y-c.y)/l},B:o,C:c,S:n,E:a}}getABC(r,n){n=n||this.get(r);let o=this.points[0],a=this.points[this.order];return Z.getABC(this.order,o,n,a,r)}getLUT(r){if(this.verify(),r=r||100,this._lut.length===r+1)return this._lut;this._lut=[],r++,this._lut=[];for(let n=0,o,a;n<r;n++)a=n/(r-1),o=this.compute(a),o.t=a,this._lut.push(o);return this._lut}on(r,n){n=n||5;const o=this.getLUT(),a=[];for(let s=0,i,u=0;s<o.length;s++)i=o[s],L.dist(i,r)<n&&(a.push(i),u+=s/o.length);return a.length?t/=a.length:!1}project(r){const n=this.getLUT(),o=n.length-1,a=L.closest(n,r),s=a.mpos,i=(s-1)/o,u=(s+1)/o,c=.1/o;let l=a.mdist,g=i,d=g,p;l+=1;for(let z;g<u+c;g+=c)p=this.compute(g),z=L.dist(r,p),z<l&&(l=z,d=g);return d=d<0?0:d>1?1:d,p=this.compute(d),p.t=d,p.d=l,p}get(r){return this.compute(r)}point(r){return this.points[r]}compute(r){return this.ratios?L.computeWithRatios(r,this.points,this.ratios,this._3d):L.compute(r,this.points,this._3d,this.ratios)}raise(){const r=this.points,n=[r[0]],o=r.length;for(let a=1,s,i;a<o;a++)s=r[a],i=r[a-1],n[a]={x:(o-a)/o*s.x+a/o*i.x,y:(o-a)/o*s.y+a/o*i.y};return n[o]=r[o-1],new Z(n)}derivative(r){return L.compute(r,this.dpoints[0],this._3d)}dderivative(r){return L.compute(r,this.dpoints[1],this._3d)}align(){let r=this.points;return new Z(L.align(r,{p1:r[0],p2:r[r.length-1]}))}curvature(r){return L.curvature(r,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return L.inflections(this.points)}normal(r){return this._3d?this.__normal3(r):this.__normal2(r)}__normal2(r){const n=this.derivative(r),o=Oe(n.x*n.x+n.y*n.y);return{t:r,x:-n.y/o,y:n.x/o}}__normal3(r){const n=this.derivative(r),o=this.derivative(r+.01),a=Oe(n.x*n.x+n.y*n.y+n.z*n.z),s=Oe(o.x*o.x+o.y*o.y+o.z*o.z);n.x/=a,n.y/=a,n.z/=a,o.x/=s,o.y/=s,o.z/=s;const i={x:o.y*n.z-o.z*n.y,y:o.z*n.x-o.x*n.z,z:o.x*n.y-o.y*n.x},u=Oe(i.x*i.x+i.y*i.y+i.z*i.z);i.x/=u,i.y/=u,i.z/=u;const c=[i.x*i.x,i.x*i.y-i.z,i.x*i.z+i.y,i.x*i.y+i.z,i.y*i.y,i.y*i.z-i.x,i.x*i.z-i.y,i.y*i.z+i.x,i.z*i.z];return{t:r,x:c[0]*n.x+c[1]*n.y+c[2]*n.z,y:c[3]*n.x+c[4]*n.y+c[5]*n.z,z:c[6]*n.x+c[7]*n.y+c[8]*n.z}}hull(r){let n=this.points,o=[],a=[],s=0;for(a[s++]=n[0],a[s++]=n[1],a[s++]=n[2],this.order===3&&(a[s++]=n[3]);n.length>1;){o=[];for(let i=0,u,c=n.length-1;i<c;i++)u=L.lerp(r,n[i],n[i+1]),a[s++]=u,o.push(u);n=o}return a}split(r,n){if(r===0&&n)return this.split(n).left;if(n===1)return this.split(r).right;const o=this.hull(r),a={left:this.order===2?new Z([o[0],o[3],o[5]]):new Z([o[0],o[4],o[7],o[9]]),right:this.order===2?new Z([o[5],o[4],o[2]]):new Z([o[9],o[8],o[6],o[3]]),span:o};return a.left._t1=L.map(0,0,1,this._t1,this._t2),a.left._t2=L.map(r,0,1,this._t1,this._t2),a.right._t1=L.map(r,0,1,this._t1,this._t2),a.right._t2=L.map(1,0,1,this._t1,this._t2),n?(n=L.map(n,r,1,0,1),a.right.split(n).left):a}extrema(){const r={};let n=[];return this.dims.forEach((function(o){let a=function(i){return i[o]},s=this.dpoints[0].map(a);r[o]=L.droots(s),this.order===3&&(s=this.dpoints[1].map(a),r[o]=r[o].concat(L.droots(s))),r[o]=r[o].filter(function(i){return i>=0&&i<=1}),n=n.concat(r[o].sort(L.numberSort))}).bind(this)),r.values=n.sort(L.numberSort).filter(function(o,a){return n.indexOf(o)===a}),r}bbox(){const r=this.extrema(),n={};return this.dims.forEach((function(o){n[o]=L.getminmax(this,o,r[o])}).bind(this)),n}overlaps(r){const n=this.bbox(),o=r.bbox();return L.bboxoverlap(n,o)}offset(r,n){if(typeof n<"u"){const o=this.get(r),a=this.normal(r),s={c:o,n:a,x:o.x+a.x*n,y:o.y+a.y*n};return this._3d&&(s.z=o.z+a.z*n),s}if(this._linear){const o=this.normal(0),a=this.points.map(function(s){const i={x:s.x+r*o.x,y:s.y+r*o.y};return s.z&&o.z&&(i.z=s.z+r*o.z),i});return[new Z(a)]}return this.reduce().map(function(o){return o._linear?o.offset(r)[0]:o.scale(r)})}simple(){if(this.order===3){const a=L.angle(this.points[0],this.points[3],this.points[1]),s=L.angle(this.points[0],this.points[3],this.points[2]);if(a>0&&s<0||a<0&&s>0)return!1}const r=this.normal(0),n=this.normal(1);let o=r.x*n.x+r.y*n.y;return this._3d&&(o+=r.z*n.z),Fe(Ut(o))<Jt/3}reduce(){let r,n=0,o=0,a=.01,s,i=[],u=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),n=c[0],r=1;r<c.length;r++)o=c[r],s=this.split(n,o),s._t1=n,s._t2=o,i.push(s),n=o;return i.forEach(function(l){for(n=0,o=0;o<=1;)for(o=n+a;o<=1+a;o+=a)if(s=l.split(n,o),!s.simple()){if(o-=a,Fe(n-o)<a)return[];s=l.split(n,o),s._t1=L.map(n,0,1,l._t1,l._t2),s._t2=L.map(o,0,1,l._t1,l._t2),u.push(s),n=o;break}n<1&&(s=l.split(n,1),s._t1=L.map(n,0,1,l._t1,l._t2),s._t2=l._t2,u.push(s))}),u}translate(r,n,o){o=typeof o=="number"?o:n;const a=this.order;let s=this.points.map((i,u)=>(1-u/a)*n+u/a*o);return new Z(this.points.map((i,u)=>({x:i.x+r.x*s[u],y:i.y+r.y*s[u]})))}scale(r){const n=this.order;let o=!1;if(typeof r=="function"&&(o=r),o&&n===2)return this.raise().scale(o);const a=this.clockwise,s=this.points;if(this._linear)return this.translate(this.normal(0),o?o(0):r,o?o(1):r);const i=o?o(0):r,u=o?o(1):r,c=[this.offset(0,10),this.offset(1,10)],l=[],g=L.lli4(c[0],c[0].c,c[1],c[1].c);if(!g)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(d){const p=l[d*n]=L.copy(s[d*n]);p.x+=(d?u:i)*c[d].n.x,p.y+=(d?u:i)*c[d].n.y}),o?([0,1].forEach(function(d){if(!(n===2&&d)){var p=s[d+1],z={x:p.x-g.x,y:p.y-g.y},m=o?o((d+1)/n):r;o&&!a&&(m=-m);var b=Oe(z.x*z.x+z.y*z.y);z.x/=b,z.y/=b,l[d+1]={x:p.x+m*z.x,y:p.y+m*z.y}}}),new Z(l)):([0,1].forEach(d=>{if(n===2&&d)return;const p=l[d*n],z=this.derivative(d),m={x:p.x+z.x,y:p.y+z.y};l[d+1]=L.lli4(p,m,g,s[d+1])}),new Z(l))}outline(r,n,o,a){if(n=n===void 0?r:n,this._linear){const x=this.normal(0),S=this.points[0],v=this.points[this.points.length-1];let M,_,D;o===void 0&&(o=r,a=n),M={x:S.x+x.x*r,y:S.y+x.y*r},D={x:v.x+x.x*o,y:v.y+x.y*o},_={x:(M.x+D.x)/2,y:(M.y+D.y)/2};const A=[M,_,D];M={x:S.x-x.x*n,y:S.y-x.y*n},D={x:v.x-x.x*a,y:v.y-x.y*a},_={x:(M.x+D.x)/2,y:(M.y+D.y)/2};const Y=[D,_,M],R=L.makeline(Y[2],A[0]),q=L.makeline(A[2],Y[0]),se=[R,new Z(A),q,new Z(Y)];return new Ce(se)}const s=this.reduce(),i=s.length,u=[];let c=[],l,g=0,d=this.length();const p=typeof o<"u"&&typeof a<"u";function z(x,S,v,M,_){return function(D){const A=M/v,Y=(M+_)/v,R=S-x;return L.map(D,0,1,x+A*R,x+Y*R)}}s.forEach(function(x){const S=x.length();p?(u.push(x.scale(z(r,o,d,g,S))),c.push(x.scale(z(-n,-a,d,g,S)))):(u.push(x.scale(r)),c.push(x.scale(-n))),g+=S}),c=c.map(function(x){return l=x.points,l[3]?x.points=[l[3],l[2],l[1],l[0]]:x.points=[l[2],l[1],l[0]],x}).reverse();const m=u[0].points[0],b=u[i-1].points[u[i-1].points.length-1],F=c[i-1].points[c[i-1].points.length-1],X=c[0].points[0],f=L.makeline(F,m),h=L.makeline(b,X),y=[f].concat(u).concat([h]).concat(c);return new Ce(y)}outlineshapes(r,n,o){n=n||r;const a=this.outline(r,n).curves,s=[];for(let i=1,u=a.length;i<u/2;i++){const c=L.makeshape(a[i],a[u-i],o);c.startcap.virtual=i>1,c.endcap.virtual=i<u/2-1,s.push(c)}return s}intersects(r,n){return r?r.p1&&r.p2?this.lineIntersects(r):(r instanceof Z&&(r=r.reduce()),this.curveintersects(this.reduce(),r,n)):this.selfintersects(n)}lineIntersects(r){const n=dt(r.p1.x,r.p2.x),o=dt(r.p1.y,r.p2.y),a=gt(r.p1.x,r.p2.x),s=gt(r.p1.y,r.p2.y);return L.roots(this.points,r).filter(i=>{var u=this.get(i);return L.between(u.x,n,a)&&L.between(u.y,o,s)})}selfintersects(r){const n=this.reduce(),o=n.length-2,a=[];for(let s=0,i,u,c;s<o;s++)u=n.slice(s,s+1),c=n.slice(s+2),i=this.curveintersects(u,c,r),a.push(...i);return a}curveintersects(r,n,o){const a=[];r.forEach(function(i){n.forEach(function(u){i.overlaps(u)&&a.push({left:i,right:u})})});let s=[];return a.forEach(function(i){const u=L.pairiteration(i.left,i.right,o);u.length>0&&(s=s.concat(u))}),s}arcs(r){return r=r||.5,this._iterate(r,[])}_error(r,n,o,a){const s=(a-o)/4,i=this.get(o+s),u=this.get(a-s),c=L.dist(r,n),l=L.dist(r,i),g=L.dist(r,u);return Fe(l-c)+Fe(g-c)}_iterate(r,n){let o=0,a=1,s;do{s=0,a=1;let i=this.get(o),u,c,l,g,d=!1,p=!1,z,m=a,b=1;do if(p=d,g=l,m=(o+a)/2,u=this.get(m),c=this.get(a),l=L.getccenter(i,u,c),l.interval={start:o,end:a},d=this._error(l,i,o,a)<=r,z=p&&!d,z||(b=a),d){if(a>=1){if(l.interval.end=b=1,g=l,a>1){let X={x:l.x+l.r*Gt(l.e),y:l.y+l.r*$t(l.e)};l.e+=L.angle({x:l.x,y:l.y},X,this.get(1))}break}a=a+(a-o)/2}else a=m;while(!z&&s++<100);if(s>=100)break;g=g||l,n.push(g),o=b}while(a<1);return n}}var le=63710088e-1,xt={centimeters:le*100,centimetres:le*100,degrees:le/111325,feet:le*3.28084,inches:le*39.37,kilometers:le/1e3,kilometres:le/1e3,meters:le,metres:le,miles:le/1609.344,millimeters:le*1e3,millimetres:le*1e3,nauticalmiles:le/1852,radians:1,yards:le*1.0936};function Ke(e,r,n){n===void 0&&(n={});var o={type:"Feature"};return(n.id===0||n.id)&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.properties=r||{},o.geometry=e,o}function pe(e,r,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!pt(e[0])||!pt(e[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:e};return Ke(o,r,n)}function Ie(e,r,n){n===void 0&&(n={});for(var o=0,a=e;o<a.length;o++){var s=a[o];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var i=0;i<s[s.length-1].length;i++)if(s[s.length-1][i]!==s[0][i])throw new Error("First and last Position are not equivalent.")}var u={type:"Polygon",coordinates:e};return Ke(u,r,n)}function Te(e,r,n){if(n===void 0&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:e};return Ke(o,r,n)}function Ge(e,r){if(r===void 0&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,r||0);return Math.round(e*n)/n}function jt(e,r){r===void 0&&(r="kilometers");var n=xt[r];if(!n)throw new Error(r+" units is invalid");return e*n}function Zt(e,r){r===void 0&&(r="kilometers");var n=xt[r];if(!n)throw new Error(r+" units is invalid");return e/n}function We(e){var r=e%(2*Math.PI);return r*180/Math.PI}function ye(e){var r=e%360;return r*Math.PI/180}function pt(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Re(e,r,n){if(e!==null)for(var o,a,s,i,u,c,l,g=0,d=0,p,z=e.type,m=z==="FeatureCollection",b=z==="Feature",F=m?e.features.length:1,X=0;X<F;X++){l=m?e.features[X].geometry:b?e.geometry:e,p=l?l.type==="GeometryCollection":!1,u=p?l.geometries.length:1;for(var f=0;f<u;f++){var h=0,y=0;if(i=p?l.geometries[f]:l,i!==null){c=i.coordinates;var x=i.type;switch(g=n&&(x==="Polygon"||x==="MultiPolygon")?1:0,x){case null:break;case"Point":if(r(c,d,X,h,y)===!1)return!1;d++,h++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++){if(r(c[o],d,X,h,y)===!1)return!1;d++,x==="MultiPoint"&&h++}x==="LineString"&&h++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(a=0;a<c[o].length-g;a++){if(r(c[o][a],d,X,h,y)===!1)return!1;d++}x==="MultiLineString"&&h++,x==="Polygon"&&y++}x==="Polygon"&&h++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(y=0,a=0;a<c[o].length;a++){for(s=0;s<c[o][a].length-g;s++){if(r(c[o][a][s],d,X,h,y)===!1)return!1;d++}y++}h++}break;case"GeometryCollection":for(o=0;o<i.geometries.length;o++)if(Re(i.geometries[o],r,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ht(e,r){var n,o,a,s,i,u,c,l,g,d,p=0,z=e.type==="FeatureCollection",m=e.type==="Feature",b=z?e.features.length:1;for(n=0;n<b;n++){for(u=z?e.features[n].geometry:m?e.geometry:e,l=z?e.features[n].properties:m?e.properties:{},g=z?e.features[n].bbox:m?e.bbox:void 0,d=z?e.features[n].id:m?e.id:void 0,c=u?u.type==="GeometryCollection":!1,i=c?u.geometries.length:1,a=0;a<i;a++){if(s=c?u.geometries[a]:u,s===null){if(r(null,p,l,g,d)===!1)return!1;continue}switch(s.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(s,p,l,g,d)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<s.geometries.length;o++)if(r(s.geometries[o],p,l,g,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}p++}}function Qt(e,r,n){var o=n;return Ht(e,function(a,s,i,u,c){s===0&&n===void 0?o=a:o=r(o,a,s,i,u,c)}),o}function et(e){var r=[1/0,1/0,-1/0,-1/0];return Re(e,function(n){r[0]>n[0]&&(r[0]=n[0]),r[1]>n[1]&&(r[1]=n[1]),r[2]<n[0]&&(r[2]=n[0]),r[3]<n[1]&&(r[3]=n[1])}),r}et.default=et;function be(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Vt(e){return e.type==="Feature"?e.geometry:e}function Kt(e,r){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}var mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function er(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var n=function o(){return this instanceof o?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,a.get?a:{enumerable:!0,get:function(){return e[o]}})}),n}var tt={exports:{}},vt={exports:{}};(function(e,r){(function(n,o){e.exports=o()})(mt,function(){function n(f,h,y,x,S){(function v(M,_,D,A,Y){for(;A>D;){if(A-D>600){var R=A-D+1,q=_-D+1,se=Math.log(R),H=.5*Math.exp(2*se/3),K=.5*Math.sqrt(se*H*(R-H)/R)*(q-R/2<0?-1:1),W=Math.max(D,Math.floor(_-q*H/R+K)),Q=Math.min(A,Math.floor(_+(R-q)*H/R+K));v(M,_,W,Q,Y)}var k=M[_],O=D,w=A;for(o(M,D,_),Y(M[A],k)>0&&o(M,D,A);O<w;){for(o(M,O,w),O++,w--;Y(M[O],k)<0;)O++;for(;Y(M[w],k)>0;)w--}Y(M[D],k)===0?o(M,D,w):o(M,++w,A),w<=_&&(D=w+1),_<=w&&(A=w-1)}})(f,h,y||0,x||f.length-1,S||a)}function o(f,h,y){var x=f[h];f[h]=f[y],f[y]=x}function a(f,h){return f<h?-1:f>h?1:0}var s=function(f){f===void 0&&(f=9),this._maxEntries=Math.max(4,f),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(f,h,y){if(!y)return h.indexOf(f);for(var x=0;x<h.length;x++)if(y(f,h[x]))return x;return-1}function u(f,h){c(f,0,f.children.length,h,f)}function c(f,h,y,x,S){S||(S=F(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var v=h;v<y;v++){var M=f.children[v];l(S,f.leaf?x(M):M)}return S}function l(f,h){return f.minX=Math.min(f.minX,h.minX),f.minY=Math.min(f.minY,h.minY),f.maxX=Math.max(f.maxX,h.maxX),f.maxY=Math.max(f.maxY,h.maxY),f}function g(f,h){return f.minX-h.minX}function d(f,h){return f.minY-h.minY}function p(f){return(f.maxX-f.minX)*(f.maxY-f.minY)}function z(f){return f.maxX-f.minX+(f.maxY-f.minY)}function m(f,h){return f.minX<=h.minX&&f.minY<=h.minY&&h.maxX<=f.maxX&&h.maxY<=f.maxY}function b(f,h){return h.minX<=f.maxX&&h.minY<=f.maxY&&h.maxX>=f.minX&&h.maxY>=f.minY}function F(f){return{children:f,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X(f,h,y,x,S){for(var v=[h,y];v.length;)if(!((y=v.pop())-(h=v.pop())<=x)){var M=h+Math.ceil((y-h)/x/2)*x;n(f,M,h,y,S),v.push(h,M,M,y)}}return s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(f){var h=this.data,y=[];if(!b(f,h))return y;for(var x=this.toBBox,S=[];h;){for(var v=0;v<h.children.length;v++){var M=h.children[v],_=h.leaf?x(M):M;b(f,_)&&(h.leaf?y.push(M):m(f,_)?this._all(M,y):S.push(M))}h=S.pop()}return y},s.prototype.collides=function(f){var h=this.data;if(!b(f,h))return!1;for(var y=[];h;){for(var x=0;x<h.children.length;x++){var S=h.children[x],v=h.leaf?this.toBBox(S):S;if(b(f,v)){if(h.leaf||m(f,v))return!0;y.push(S)}}h=y.pop()}return!1},s.prototype.load=function(f){if(!f||!f.length)return this;if(f.length<this._minEntries){for(var h=0;h<f.length;h++)this.insert(f[h]);return this}var y=this._build(f.slice(),0,f.length-1,0);if(this.data.children.length)if(this.data.height===y.height)this._splitRoot(this.data,y);else{if(this.data.height<y.height){var x=this.data;this.data=y,y=x}this._insert(y,this.data.height-y.height-1,!0)}else this.data=y;return this},s.prototype.insert=function(f){return f&&this._insert(f,this.data.height-1),this},s.prototype.clear=function(){return this.data=F([]),this},s.prototype.remove=function(f,h){if(!f)return this;for(var y,x,S,v=this.data,M=this.toBBox(f),_=[],D=[];v||_.length;){if(v||(v=_.pop(),x=_[_.length-1],y=D.pop(),S=!0),v.leaf){var A=i(f,v.children,h);if(A!==-1)return v.children.splice(A,1),_.push(v),this._condense(_),this}S||v.leaf||!m(v,M)?x?(y++,v=x.children[y],S=!1):v=null:(_.push(v),D.push(y),y=0,x=v,v=v.children[0])}return this},s.prototype.toBBox=function(f){return f},s.prototype.compareMinX=function(f,h){return f.minX-h.minX},s.prototype.compareMinY=function(f,h){return f.minY-h.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(f){return this.data=f,this},s.prototype._all=function(f,h){for(var y=[];f;)f.leaf?h.push.apply(h,f.children):y.push.apply(y,f.children),f=y.pop();return h},s.prototype._build=function(f,h,y,x){var S,v=y-h+1,M=this._maxEntries;if(v<=M)return u(S=F(f.slice(h,y+1)),this.toBBox),S;x||(x=Math.ceil(Math.log(v)/Math.log(M)),M=Math.ceil(v/Math.pow(M,x-1))),(S=F([])).leaf=!1,S.height=x;var _=Math.ceil(v/M),D=_*Math.ceil(Math.sqrt(M));X(f,h,y,D,this.compareMinX);for(var A=h;A<=y;A+=D){var Y=Math.min(A+D-1,y);X(f,A,Y,_,this.compareMinY);for(var R=A;R<=Y;R+=_){var q=Math.min(R+_-1,Y);S.children.push(this._build(f,R,q,x-1))}}return u(S,this.toBBox),S},s.prototype._chooseSubtree=function(f,h,y,x){for(;x.push(h),!h.leaf&&x.length-1!==y;){for(var S=1/0,v=1/0,M=void 0,_=0;_<h.children.length;_++){var D=h.children[_],A=p(D),Y=(R=f,q=D,(Math.max(q.maxX,R.maxX)-Math.min(q.minX,R.minX))*(Math.max(q.maxY,R.maxY)-Math.min(q.minY,R.minY))-A);Y<v?(v=Y,S=A<S?A:S,M=D):Y===v&&A<S&&(S=A,M=D)}h=M||h.children[0]}var R,q;return h},s.prototype._insert=function(f,h,y){var x=y?f:this.toBBox(f),S=[],v=this._chooseSubtree(x,this.data,h,S);for(v.children.push(f),l(v,x);h>=0&&S[h].children.length>this._maxEntries;)this._split(S,h),h--;this._adjustParentBBoxes(x,S,h)},s.prototype._split=function(f,h){var y=f[h],x=y.children.length,S=this._minEntries;this._chooseSplitAxis(y,S,x);var v=this._chooseSplitIndex(y,S,x),M=F(y.children.splice(v,y.children.length-v));M.height=y.height,M.leaf=y.leaf,u(y,this.toBBox),u(M,this.toBBox),h?f[h-1].children.push(M):this._splitRoot(y,M)},s.prototype._splitRoot=function(f,h){this.data=F([f,h]),this.data.height=f.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(f,h,y){for(var x,S,v,M,_,D,A,Y=1/0,R=1/0,q=h;q<=y-h;q++){var se=c(f,0,q,this.toBBox),H=c(f,q,y,this.toBBox),K=(S=se,v=H,M=void 0,_=void 0,D=void 0,A=void 0,M=Math.max(S.minX,v.minX),_=Math.max(S.minY,v.minY),D=Math.min(S.maxX,v.maxX),A=Math.min(S.maxY,v.maxY),Math.max(0,D-M)*Math.max(0,A-_)),W=p(se)+p(H);K<Y?(Y=K,x=q,R=W<R?W:R):K===Y&&W<R&&(R=W,x=q)}return x||y-h},s.prototype._chooseSplitAxis=function(f,h,y){var x=f.leaf?this.compareMinX:g,S=f.leaf?this.compareMinY:d;this._allDistMargin(f,h,y,x)<this._allDistMargin(f,h,y,S)&&f.children.sort(x)},s.prototype._allDistMargin=function(f,h,y,x){f.children.sort(x);for(var S=this.toBBox,v=c(f,0,h,S),M=c(f,y-h,y,S),_=z(v)+z(M),D=h;D<y-h;D++){var A=f.children[D];l(v,f.leaf?S(A):A),_+=z(v)}for(var Y=y-h-1;Y>=h;Y--){var R=f.children[Y];l(M,f.leaf?S(R):R),_+=z(M)}return _},s.prototype._adjustParentBBoxes=function(f,h,y){for(var x=y;x>=0;x--)l(h[x],f)},s.prototype._condense=function(f){for(var h=f.length-1,y=void 0;h>=0;h--)f[h].children.length===0?h>0?(y=f[h-1].children).splice(y.indexOf(f[h]),1):this.clear():u(f[h],this.toBBox)},s})})(vt);var tr=vt.exports;class rr{constructor(r=[],n=nr){if(this.data=r,this.length=this.data.length,this.compare=n,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(r){this.data.push(r),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const r=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:n,compare:o}=this,a=n[r];for(;r>0;){const s=r-1>>1,i=n[s];if(o(a,i)>=0)break;n[r]=i,r=s}n[r]=a}_down(r){const{data:n,compare:o}=this,a=this.length>>1,s=n[r];for(;r<a;){let i=(r<<1)+1,u=n[i];const c=i+1;if(c<this.length&&o(n[c],u)<0&&(i=c,u=n[c]),o(u,s)>=0)break;n[r]=u,r=i}n[r]=s}}function nr(e,r){return e<r?-1:e>r?1:0}const or=er(Object.freeze(Object.defineProperty({__proto__:null,default:rr},Symbol.toStringTag,{value:"Module"})));var $e={exports:{}},ir=function(r,n,o,a){var s=r[0],i=r[1],u=!1;o===void 0&&(o=0),a===void 0&&(a=n.length);for(var c=(a-o)/2,l=0,g=c-1;l<c;g=l++){var d=n[o+l*2+0],p=n[o+l*2+1],z=n[o+g*2+0],m=n[o+g*2+1],b=p>i!=m>i&&s<(z-d)*(i-p)/(m-p)+d;b&&(u=!u)}return u},sr=function(r,n,o,a){var s=r[0],i=r[1],u=!1;o===void 0&&(o=0),a===void 0&&(a=n.length);for(var c=a-o,l=0,g=c-1;l<c;g=l++){var d=n[l+o][0],p=n[l+o][1],z=n[g+o][0],m=n[g+o][1],b=p>i!=m>i&&s<(z-d)*(i-p)/(m-p)+d;b&&(u=!u)}return u},wt=ir,Mt=sr;$e.exports=function(r,n,o,a){return n.length>0&&Array.isArray(n[0])?Mt(r,n,o,a):wt(r,n,o,a)},$e.exports.nested=Mt,$e.exports.flat=wt;var ar=$e.exports,rt={exports:{}};(function(e,r){(function(n,o){o(r)})(mt,function(n){const a=33306690738754706e-32;function s(b,F,X,f,h){let y,x,S,v,M=F[0],_=f[0],D=0,A=0;_>M==_>-M?(y=M,M=F[++D]):(y=_,_=f[++A]);let Y=0;if(D<b&&A<X)for(_>M==_>-M?(S=y-((x=M+y)-M),M=F[++D]):(S=y-((x=_+y)-_),_=f[++A]),y=x,S!==0&&(h[Y++]=S);D<b&&A<X;)_>M==_>-M?(S=y-((x=y+M)-(v=x-y))+(M-v),M=F[++D]):(S=y-((x=y+_)-(v=x-y))+(_-v),_=f[++A]),y=x,S!==0&&(h[Y++]=S);for(;D<b;)S=y-((x=y+M)-(v=x-y))+(M-v),M=F[++D],y=x,S!==0&&(h[Y++]=S);for(;A<X;)S=y-((x=y+_)-(v=x-y))+(_-v),_=f[++A],y=x,S!==0&&(h[Y++]=S);return y===0&&Y!==0||(h[Y++]=y),Y}function i(b){return new Float64Array(b)}const u=33306690738754716e-32,c=22204460492503146e-32,l=11093356479670487e-47,g=i(4),d=i(8),p=i(12),z=i(16),m=i(4);n.orient2d=function(b,F,X,f,h,y){const x=(F-y)*(X-h),S=(b-h)*(f-y),v=x-S;if(x===0||S===0||x>0!=S>0)return v;const M=Math.abs(x+S);return Math.abs(v)>=u*M?v:-function(_,D,A,Y,R,q,se){let H,K,W,Q,k,O,w,E,C,G,B,$,J,U,V,ne,ie,j;const oe=_-R,ee=A-R,re=D-q,ae=Y-q;k=(V=(E=oe-(w=(O=134217729*oe)-(O-oe)))*(G=ae-(C=(O=134217729*ae)-(O-ae)))-((U=oe*ae)-w*C-E*C-w*G))-(B=V-(ie=(E=re-(w=(O=134217729*re)-(O-re)))*(G=ee-(C=(O=134217729*ee)-(O-ee)))-((ne=re*ee)-w*C-E*C-w*G))),g[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),g[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,g[2]=$-(j-k)+(B-k),g[3]=j;let de=function(qe,Ee){let Ze=Ee[0];for(let Ae=1;Ae<qe;Ae++)Ze+=Ee[Ae];return Ze}(4,g),_e=c*se;if(de>=_e||-de>=_e||(H=_-(oe+(k=_-oe))+(k-R),W=A-(ee+(k=A-ee))+(k-R),K=D-(re+(k=D-re))+(k-q),Q=Y-(ae+(k=Y-ae))+(k-q),H===0&&K===0&&W===0&&Q===0)||(_e=l*se+a*Math.abs(de),(de+=oe*Q+ae*H-(re*W+ee*K))>=_e||-de>=_e))return de;k=(V=(E=H-(w=(O=134217729*H)-(O-H)))*(G=ae-(C=(O=134217729*ae)-(O-ae)))-((U=H*ae)-w*C-E*C-w*G))-(B=V-(ie=(E=K-(w=(O=134217729*K)-(O-K)))*(G=ee-(C=(O=134217729*ee)-(O-ee)))-((ne=K*ee)-w*C-E*C-w*G))),m[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),m[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,m[2]=$-(j-k)+(B-k),m[3]=j;const je=s(4,g,4,m,d);k=(V=(E=oe-(w=(O=134217729*oe)-(O-oe)))*(G=Q-(C=(O=134217729*Q)-(O-Q)))-((U=oe*Q)-w*C-E*C-w*G))-(B=V-(ie=(E=re-(w=(O=134217729*re)-(O-re)))*(G=W-(C=(O=134217729*W)-(O-W)))-((ne=re*W)-w*C-E*C-w*G))),m[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),m[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,m[2]=$-(j-k)+(B-k),m[3]=j;const ht=s(je,d,4,m,p);k=(V=(E=H-(w=(O=134217729*H)-(O-H)))*(G=Q-(C=(O=134217729*Q)-(O-Q)))-((U=H*Q)-w*C-E*C-w*G))-(B=V-(ie=(E=K-(w=(O=134217729*K)-(O-K)))*(G=W-(C=(O=134217729*W)-(O-W)))-((ne=K*W)-w*C-E*C-w*G))),m[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),m[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,m[2]=$-(j-k)+(B-k),m[3]=j;const ke=s(ht,p,4,m,z);return z[ke-1]}(b,F,X,f,h,y,M)},n.orient2dfast=function(b,F,X,f,h,y){return(F-y)*(X-h)-(b-h)*(f-y)},Object.defineProperty(n,"__esModule",{value:!0})})})(rt,rt.exports);var ur=rt.exports,zt=tr,Ue=or,cr=ar,lr=ur.orient2d;Ue.default&&(Ue=Ue.default),tt.exports=St,tt.exports.default=St;function St(e,r,n){r=Math.max(0,r===void 0?2:r),n=n||0;var o=gr(e),a=new zt(16);a.toBBox=function(f){return{minX:f[0],minY:f[1],maxX:f[0],maxY:f[1]}},a.compareMinX=function(f,h){return f[0]-h[0]},a.compareMinY=function(f,h){return f[1]-h[1]},a.load(e);for(var s=[],i=0,u;i<o.length;i++){var c=o[i];a.remove(c),u=Pt(c,u),s.push(u)}var l=new zt(16);for(i=0;i<s.length;i++)l.insert(nt(s[i]));for(var g=r*r,d=n*n;s.length;){var p=s.shift(),z=p.p,m=p.next.p,b=ot(z,m);if(!(b<d)){var F=b/g;c=fr(a,p.prev.p,z,m,p.next.next.p,F,l),c&&Math.min(ot(c,z),ot(c,m))<=F&&(s.push(p),s.push(Pt(c,p)),a.remove(c),l.remove(p),l.insert(nt(p)),l.insert(nt(p.next)))}}p=u;var X=[];do X.push(p.p),p=p.next;while(p!==u);return X.push(p.p),X}function fr(e,r,n,o,a,s,i){for(var u=new Ue([],hr),c=e.data;c;){for(var l=0;l<c.children.length;l++){var g=c.children[l],d=c.leaf?it(g,n,o):yr(n,o,g);d>s||u.push({node:g,dist:d})}for(;u.length&&!u.peek().node.children;){var p=u.pop(),z=p.node,m=it(z,r,n),b=it(z,o,a);if(p.dist<m&&p.dist<b&&Lt(n,z,i)&&Lt(o,z,i))return z}c=u.pop(),c&&(c=c.node)}return null}function hr(e,r){return e.dist-r.dist}function yr(e,r,n){if(_t(e,n)||_t(r,n))return 0;var o=Je(e[0],e[1],r[0],r[1],n.minX,n.minY,n.maxX,n.minY);if(o===0)return 0;var a=Je(e[0],e[1],r[0],r[1],n.minX,n.minY,n.minX,n.maxY);if(a===0)return 0;var s=Je(e[0],e[1],r[0],r[1],n.maxX,n.minY,n.maxX,n.maxY);if(s===0)return 0;var i=Je(e[0],e[1],r[0],r[1],n.minX,n.maxY,n.maxX,n.maxY);return i===0?0:Math.min(o,a,s,i)}function _t(e,r){return e[0]>=r.minX&&e[0]<=r.maxX&&e[1]>=r.minY&&e[1]<=r.maxY}function Lt(e,r,n){for(var o=Math.min(e[0],r[0]),a=Math.min(e[1],r[1]),s=Math.max(e[0],r[0]),i=Math.max(e[1],r[1]),u=n.search({minX:o,minY:a,maxX:s,maxY:i}),c=0;c<u.length;c++)if(dr(u[c].p,u[c].next.p,e,r))return!1;return!0}function De(e,r,n){return lr(e[0],e[1],r[0],r[1],n[0],n[1])}function dr(e,r,n,o){return e!==o&&r!==n&&De(e,r,n)>0!=De(e,r,o)>0&&De(n,o,e)>0!=De(n,o,r)>0}function nt(e){var r=e.p,n=e.next.p;return e.minX=Math.min(r[0],n[0]),e.minY=Math.min(r[1],n[1]),e.maxX=Math.max(r[0],n[0]),e.maxY=Math.max(r[1],n[1]),e}function gr(e){for(var r=e[0],n=e[0],o=e[0],a=e[0],s=0;s<e.length;s++){var i=e[s];i[0]<r[0]&&(r=i),i[0]>o[0]&&(o=i),i[1]<n[1]&&(n=i),i[1]>a[1]&&(a=i)}var u=[r,n,o,a],c=u.slice();for(s=0;s<e.length;s++)cr(e[s],u)||c.push(e[s]);return pr(c)}function Pt(e,r){var n={p:e,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ot(e,r){var n=e[0]-r[0],o=e[1]-r[1];return n*n+o*o}function it(e,r,n){var o=r[0],a=r[1],s=n[0]-o,i=n[1]-a;if(s!==0||i!==0){var u=((e[0]-o)*s+(e[1]-a)*i)/(s*s+i*i);u>1?(o=n[0],a=n[1]):u>0&&(o+=s*u,a+=i*u)}return s=e[0]-o,i=e[1]-a,s*s+i*i}function Je(e,r,n,o,a,s,i,u){var c=n-e,l=o-r,g=i-a,d=u-s,p=e-a,z=r-s,m=c*c+l*l,b=c*g+l*d,F=g*g+d*d,X=c*p+l*z,f=g*p+d*z,h=m*F-b*b,y,x,S,v,M=h,_=h;h===0?(x=0,M=1,v=f,_=F):(x=b*f-F*X,v=m*f-b*X,x<0?(x=0,v=f,_=F):x>M&&(x=M,v=f+b,_=F)),v<0?(v=0,-X<0?x=0:-X>m?x=M:(x=-X,M=m)):v>_&&(v=_,-X+b<0?x=0:-X+b>m?x=M:(x=-X+b,M=m)),y=x===0?0:x/M,S=v===0?0:v/_;var D=(1-y)*e+y*n,A=(1-y)*r+y*o,Y=(1-S)*a+S*i,R=(1-S)*s+S*u,q=Y-D,se=R-A;return q*q+se*se}function xr(e,r){return e[0]===r[0]?e[1]-r[1]:e[0]-r[0]}function pr(e){e.sort(xr);for(var r=[],n=0;n<e.length;n++){for(;r.length>=2&&De(r[r.length-2],r[r.length-1],e[n])<=0;)r.pop();r.push(e[n])}for(var o=[],a=e.length-1;a>=0;a--){for(;o.length>=2&&De(o[o.length-2],o[o.length-1],e[a])<=0;)o.pop();o.push(e[a])}return o.pop(),r.pop(),r.concat(o)}var mr=tt.exports;const vr=Wt(mr);function wr(e,r){r===void 0&&(r={}),r.concavity=r.concavity||1/0;var n=[];if(Re(e,function(a){n.push([a[0],a[1]])}),!n.length)return null;var o=vr(n,r.concavity);return o.length>3?Ie([o]):null}function st(e,r,n){n===void 0&&(n={});var o=be(e),a=be(r),s=ye(a[1]-o[1]),i=ye(a[0]-o[0]),u=ye(o[1]),c=ye(a[1]),l=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(i/2),2)*Math.cos(u)*Math.cos(c);return jt(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}function te(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return bt(e);case"FeatureCollection":return Mr(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return at(e);default:throw new Error("unknown GeoJSON type")}}function bt(e){var r={type:"Feature"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:r[n]=e[n]}}),r.properties=Dt(e.properties),r.geometry=at(e.geometry),r}function Dt(e){var r={};return e&&Object.keys(e).forEach(function(n){var o=e[n];typeof o=="object"?o===null?r[n]=null:Array.isArray(o)?r[n]=o.map(function(a){return a}):r[n]=Dt(o):r[n]=o}),r}function Mr(e){var r={type:"FeatureCollection"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"features":return;default:r[n]=e[n]}}),r.features=e.features.map(function(n){return bt(n)}),r}function at(e){var r={type:e.type};return e.bbox&&(r.bbox=e.bbox),e.type==="GeometryCollection"?(r.geometries=e.geometries.map(function(n){return at(n)}),r):(r.coordinates=kt(e.coordinates),r)}function kt(e){var r=e;return typeof r[0]!="object"?r.slice():r.map(function(n){return kt(n)})}var zr=function(){function e(r){this.points=r.points||[],this.duration=r.duration||1e4,this.sharpness=r.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=r.stepLength||60,this.length=this.points.length,this.delay=0;for(var n=0;n<this.length;n++)this.points[n].z=this.points[n].z||0;for(var n=0;n<this.length-1;n++){var o=this.points[n],a=this.points[n+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var n=0;n<this.centers.length-1;n++){var s=this.points[n+1].x-(this.centers[n].x+this.centers[n+1].x)/2,i=this.points[n+1].y-(this.centers[n].y+this.centers[n+1].y)/2,u=this.points[n+1].z-(this.centers[n].y+this.centers[n+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[n+1].x+this.sharpness*(this.centers[n].x+s),y:(1-this.sharpness)*this.points[n+1].y+this.sharpness*(this.centers[n].y+i),z:(1-this.sharpness)*this.points[n+1].z+this.sharpness*(this.centers[n].z+u)},{x:(1-this.sharpness)*this.points[n+1].x+this.sharpness*(this.centers[n+1].x+s),y:(1-this.sharpness)*this.points[n+1].y+this.sharpness*(this.centers[n+1].y+i),z:(1-this.sharpness)*this.points[n+1].z+this.sharpness*(this.centers[n+1].z+u)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return e.prototype.cacheSteps=function(r){var n=[],o=this.pos(0);n.push(0);for(var a=0;a<this.duration;a+=10){var s=this.pos(a),i=Math.sqrt((s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y)+(s.z-o.z)*(s.z-o.z));i>r&&(n.push(a),o=s)}return n},e.prototype.vector=function(r){var n=this.pos(r+10),o=this.pos(r-10);return{angle:180*Math.atan2(n.y-o.y,n.x-o.x)/3.14,speed:Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)+(o.z-n.z)*(o.z-n.z))}},e.prototype.pos=function(r){var n=r-this.delay;n<0&&(n=0),n>this.duration&&(n=this.duration-1);var o=n/this.duration;if(o>=1)return this.points[this.length-1];var a=Math.floor((this.points.length-1)*o),s=(this.length-1)*o-a;return Sr(s,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},e}();function Sr(e,r,n,o,a){var s=_r(e),i={x:a.x*s[0]+o.x*s[1]+n.x*s[2]+r.x*s[3],y:a.y*s[0]+o.y*s[1]+n.y*s[2]+r.y*s[3],z:a.z*s[0]+o.z*s[1]+n.z*s[2]+r.z*s[3]};return i}function _r(e){var r=e*e,n=r*e;return[n,3*r*(1-e),3*e*(1-e)*(1-e),(1-e)*(1-e)*(1-e)]}function ut(e,r){r===void 0&&(r={});for(var n=r.resolution||1e4,o=r.sharpness||.85,a=[],s=Vt(e).coordinates.map(function(l){return{x:l[0],y:l[1]}}),i=new zr({duration:n,points:s,sharpness:o}),u=function(l){var g=i.pos(l);Math.floor(l/100)%2===0&&a.push([g.x,g.y])},c=0;c<i.duration;c+=10)u(c);return u(i.duration),Te(a,r.properties)}function Lr(e,r){r===void 0&&(r={});var n=Number(e[0]),o=Number(e[1]),a=Number(e[2]),s=Number(e[3]);if(e.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var i=[n,o],u=[n,s],c=[a,s],l=[a,o];return Ie([[i,l,c,u,i]],r.properties,{bbox:e,id:r.id})}function Et(e,r,n,o){o===void 0&&(o={});var a=be(e),s=ye(a[0]),i=ye(a[1]),u=ye(n),c=Zt(r,o.units),l=Math.asin(Math.sin(i)*Math.cos(c)+Math.cos(i)*Math.sin(c)*Math.cos(u)),g=s+Math.atan2(Math.sin(u)*Math.sin(c)*Math.cos(i),Math.cos(c)-Math.sin(i)*Math.sin(l)),d=We(g),p=We(l);return pe([d,p],o.properties)}function At(e,r,n){n===void 0&&(n={});for(var o=n.steps||64,a=n.properties?n.properties:!Array.isArray(e)&&e.type==="Feature"&&e.properties?e.properties:{},s=[],i=0;i<o;i++)s.push(Et(e,r,i*-360/o,n).geometry.coordinates);return s.push(s[0]),Ie([s],a)}function Xt(e,r,n){if(n===void 0&&(n={}),n.final===!0)return Pr(e,r);var o=be(e),a=be(r),s=ye(o[0]),i=ye(a[0]),u=ye(o[1]),c=ye(a[1]),l=Math.sin(i-s)*Math.cos(c),g=Math.cos(u)*Math.sin(c)-Math.sin(u)*Math.cos(c)*Math.cos(i-s);return We(Math.atan2(l,g))}function Pr(e,r){var n=Xt(r,e);return n=(n+180)%360,n}function br(e,r){var n=st(e,r),o=Xt(e,r),a=Et(e,n/2,o);return a}function Yt(e,r){r===void 0&&(r={});var n=0,o=0,a=0;return Re(e,function(s){n+=s[0],o+=s[1],a++},!0),pe([n/a,o/a],r.properties)}function ct(e,r){switch(r===void 0&&(r={}),Kt(e)){case"Point":return pe(be(e),r.properties);case"Polygon":var n=[];Re(e,function(y){n.push(y)});var o=Yt(e,{properties:r.properties}),a=o.geometry.coordinates,s=0,i=0,u=0,c,l,g,d,p,z,m,b,F=n.map(function(y){return[y[0]-a[0],y[1]-a[1]]});for(c=0;c<n.length-1;c++)l=F[c],d=l[0],z=l[1],g=F[c+1],p=g[0],m=g[1],b=d*m-p*z,u+=b,s+=(d+p)*b,i+=(z+m)*b;if(u===0)return o;var X=u*.5,f=1/(6*X);return pe([a[0]+f*s,a[1]+f*i],r.properties);default:var h=wr(e);return h?ct(h,{properties:r.properties}):Yt(e,{properties:r.properties})}}var Ct=6378137;function lt(e){return Qt(e,function(r,n){return r+Dr(n)},0)}function Dr(e){var r=0,n;switch(e.type){case"Polygon":return Ft(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)r+=Ft(e.coordinates[n]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function Ft(e){var r=0;if(e&&e.length>0){r+=Math.abs(Ot(e[0]));for(var n=1;n<e.length;n++)r-=Math.abs(Ot(e[n]))}return r}function Ot(e){var r,n,o,a,s,i,u,c=0,l=e.length;if(l>2){for(u=0;u<l;u++)u===l-2?(a=l-2,s=l-1,i=0):u===l-1?(a=l-1,s=0,i=1):(a=u,s=u+1,i=u+2),r=e[a],n=e[s],o=e[i],c+=(ft(o[0])-ft(r[0]))*Math.sin(ft(n[1]));c=c*Ct*Ct/2}return c}function ft(e){return e*Math.PI/180}const kr=(e,r,n,o)=>{e.addLayer({id:r,type:"symbol",source:n,layout:{"icon-image":o["icon-image"]||"","text-allow-overlap":!0,"icon-allow-overlap":!0,"text-ignore-placement":!0,"icon-ignore-placement":!0,"text-field":o["text-field"]||"{name}","text-line-height":1.1,"text-size":o["text-size"]||17,"text-anchor":o["text-anchor"]||"left","text-offset":o["text-offset"]||[1,0],"icon-size":o["icon-size"]||.5,"text-font":["Noto Sans Regular"]},paint:{"text-color":o["text-color"]||"#006e1a","text-halo-width":o["text-halo-width"]||3,"text-halo-color":o["text-halo-color"]||"rgba(255,255,255,1)"}})},ze=(e,r,n,o)=>{e.addLayer({id:r,type:"circle",source:n,paint:{"circle-color":(o==null?void 0:o["circle-color"])||"#ff0","circle-radius":(o==null?void 0:o["circle-radius"])||5,"circle-stroke-color":(o==null?void 0:o["circle-stroke-color"])||"#000","circle-stroke-width":(o==null?void 0:o["circle-stroke-width"])||2}})},me=(e,r,n,o)=>{e.addLayer({id:r,type:"line",source:n,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":(o==null?void 0:o["line-color"])||"#ff0","line-width":(o==null?void 0:o["line-width"])||4}})},Be=(e,r,n,o)=>{e.addLayer({id:r,type:"symbol",source:n,layout:{"text-font":["Noto Sans Regular"],"text-field":["get","result"],"text-allow-overlap":!0,"text-anchor":"bottom","text-overlap":"always","text-offset":[0,-.5],visibility:o!=null&&o.visibility?"visible":"none"}})},Se=(e,r,n,o)=>{e.addLayer({id:r,type:"fill",source:n,paint:{"fill-antialias":!1,"fill-color":(o==null?void 0:o["fill-color"])||"#ff0","fill-opacity":.8}})},It=e=>{let r=!1,n=e,o=[],a=n.length-1;for(let i=0;i<a;i++){let u=n[i],c=n[i+1];(u.x!=c.x||u.y!=c.y)&&o.push(u)}let s=o.length-1;for(let i=0;i<s;i++){let u=o[i],c=o[i+1];for(let l=i+2;l<s;l++){let g=o[l],d=o[l+1],p=Er(u,c,g,d);if(p==null&&c.x==d.x&&c.y==d.y&&(p={x:c.x,y:c.y}),p!=null){r=!0;break}}if(r)break}return r};function Er(e,r,n,o){var a=null,s=(e.x-n.x)*(r.y-n.y)-(e.y-n.y)*(r.x-n.x),i=(e.x-o.x)*(r.y-o.y)-(e.y-o.y)*(r.x-o.x);if(s*i>=0)return a;var u=(n.x-e.x)*(o.y-e.y)-(n.y-e.y)*(o.x-e.x),c=u+s-i;if(u*c>=0)return a;var l=u/(i-s),g=l*(r.x-e.x),d=l*(r.y-e.y);return a={x:e.x+g,y:e.y+d},a}function Ar(e,r,n,o,a){let s="free",i="",u=[],c=[],l={},g=!1,d=!0,p=!1,z=!0,m=[],b=!0,F=5e4,X=!1,f={type:"FeatureCollection",features:[]},h={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}},y={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[]}};const x=(P,I)=>{let N=0;return function(...T){const ue=new Date().getTime();ue-N<I||(N=ue,P(...T))}},S=P=>{switch(e.off("click",C),e.off("mousemove",re),e.off("contextmenu",J),Q(),ee(),g&&(d=!0,E(!1)),g=!0,s=P.type||"point",b=P.multipleLine||!1,p=P.smooth||!1,F=P.brushSize*1e3||3e4,l=P,z=P.showLayer,h.properties=P,y.properties=P,s){case"point":break;case"brush":Y();break}e.on("click",C),e.getCanvas().style.cursor=s=="brush"?"move":"crosshair"},v=P=>{s=P,h.properties.type=s,y.properties.type=s},M=P=>{if(n)if(u.length){const T=[u[u.length-1]];n(T)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:f}),ze(e,i,i,l),f.features.push({type:"Feature",properties:l,geometry:{type:"Point",coordinates:P.lngLat.toArray()}}),e.getSource(i).setData(te(f)),r&&r(j())},_=P=>{if(d){if(n)if(u.length){const N=u[u.length-1],T=[N,N+"point"];n(T)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:h}),me(e,i,i),ze(e,i+"point",i,l),d=!1,e.on("mousemove",re),e.on("contextmenu",J),e.dragRotate.enable()}h.geometry.coordinates.push(P.lngLat.toArray());const I=e.getSource(i);I.setData(h),!b&&h.geometry.coordinates.length==3&&(e.off("mousemove",re),e.off("contextmenu",J),d=!0,E(!1),h.geometry.coordinates.pop(),I.setData(te(h)),r&&r(j()))},D=P=>{if(d){if(n)if(u.length){const T=u[u.length-1],ue=[T,T+"outline",T+"point"];n(ue)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:y}),e.addSource(i+"point",{type:"geojson",data:f}),Se(e,i,i,l),me(e,i+"outline",i,{"line-color":"black","line-width":2,...l}),ze(e,i+"point",i+"point",l),d=!1,e.on("mousemove",re),e.on("contextmenu",J),e.dragRotate.enable()}y.geometry.coordinates[0].length>=3&&y.geometry.coordinates[0].pop(),y.geometry.coordinates[0].push(P.lngLat.toArray()),y.geometry.coordinates[0].push(y.geometry.coordinates[0][0]),f.features.push(te({type:"Feature",geometry:{type:"Point",coordinates:P.lngLat.toArray()}})),e.getSource(i+"point").setData(f);const N=e.getSource(i);y.geometry.coordinates[0].length<=3&&!p&&N.setData(y),E(!0)},A=P=>{if(d){if(n)if(u.length){const N=u[u.length-1],T=[N,N+"outline"];n(T)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:y}),Se(e,i,i,l),me(e,i+"outline",i,{"line-color":"black","line-width":2,...l}),d=!1,y.geometry.coordinates[0].push(P.lngLat.toArray()),e.getSource(i).setData(y),e.on("mousemove",re),e.on("contextmenu",J),E(!0),e.dragRotate.enable()}},Y=()=>{e.on("mousedown",U),e.on("mouseup",V),e.on("mousemove",B),e.on("mouseover",ne),e.on("mouseout",ie)},R=()=>{O(),ee(),e.addSource(i,{type:"geojson",data:y}),Se(e,i,i,l),me(e,i+"outline",i,{"line-color":"black","line-width":2,...l})},q=(P,I)=>{const N=pe([P.lng,P.lat]),T=I/2/111320,ue=et(At(N,T,{units:"degrees"}));return Lr(ue)},se=(P,I)=>{const N=q(P,I);y.geometry=N.geometry,e.getSource(i).setData(y)},H=()=>{const P=i,N=e.getSource(P).serialize().data;r&&r(N)},K=P=>{F=P*1e3},W=P=>{y.properties.MGValue=P},Q=()=>{e.off("mousedown",U),e.off("mouseup",V),e.off("mousemove",B),e.off("mouseover",ne),e.off("mouseout",ie)},k=P=>{let I=te(P);const N=Te(I.geometry.coordinates[0]),T=ut(N,{sharpness:.6});return I.geometry.coordinates[0]=T.geometry.coordinates,I},O=()=>{i=w(),u.push(i),c.push(i)},w=()=>{let P=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(N){const T=(P+Math.random()*16)%16|0;return P=Math.floor(P/16),(N==="x"?T:T&3|8).toString(16)})},E=P=>{["scrollZoom","boxZoom","dragPan","keyboard","doubleClickZoom","touchZoomRotate"].forEach(N=>{P?e[N].disable():e[N].enable()})},C=P=>{switch(s){case"point":M(P);break;case"line":_(P);break;case"polygon":D(P);break;case"free":A(P);break}},G=P=>{switch(s){case"line":h.geometry.coordinates.length&&(h.geometry.coordinates.length==1&&h.geometry.coordinates.push(P.lngLat.toArray()),h.geometry.coordinates[h.geometry.coordinates.length-1]=P.lngLat.toArray(),e.getSource(i).setData(h));break;case"polygon":const I=y.geometry.coordinates[0].length;if(I){I==2?y.geometry.coordinates[0][I-1]=P.lngLat.toArray():y.geometry.coordinates[0][I-2]=P.lngLat.toArray();const T=e.getSource(i);T.setData(y),p&&y.geometry.coordinates[0].length>=3&&T.setData(k(y))}break;case"free":y.geometry.coordinates[0].length&&(m.push(P.point),y.geometry.coordinates[0].length!=1&&y.geometry.coordinates[0].pop(),y.geometry.coordinates[0].push(P.lngLat.toArray()),y.geometry.coordinates[0].push(y.geometry.coordinates[0][0]),e.getSource(i).setData(y));break}},B=P=>{se(P.lngLat,F),X&&$()},$=x(H,0),J=P=>{P.preventDefault(),e.off("mousemove",re),e.off("contextmenu",J),d=!0,m.push(P.point),E(!1),e.dragRotate.disable();const I=e.getSource(i);switch(s){case"line":h.geometry.coordinates.length&&I.setData(te(h));break;case"polygon":if(y.geometry.coordinates[0].length){const N=y.geometry.coordinates[0].length;y.geometry.coordinates[0].splice(N-2,1),I.setData(te(y))}if(It(m)){alert("落区自相交,请重画"),u.pop(),c.pop(),e.removeLayer(i),e.removeLayer(i+"outline"),e.removeLayer(i+"point");return}z||(e.setLayoutProperty(i,"visibility","none"),e.setLayoutProperty(i+"outline","visibility","none")),e.setLayoutProperty(i+"point","visibility","none"),p&&I.setData(te(k(y)));break;case"free":if(y.geometry.coordinates[0].length){const N=y.geometry.coordinates[0].length;if(y.geometry.coordinates[0].splice(N-2,1),I.setData(te(y)),It(m)){alert("落区自相交,请重画"),u.pop(),c.pop(),e.removeLayer(i),e.removeLayer(i+"outline");return}if(z||(e.setLayoutProperty(i,"visibility","none"),e.setLayoutProperty(i+"outline","visibility","none")),p){const T=[...m.slice(m.length/5),...m.slice(0,m.length/5),m.slice(m.length/5)[0]],ue=T.length>10?5:3,ce=Math.ceil(T.length/ue),He=[];for(let he=0;he<T.length;he+=ce)He.push(T.slice(he,he+ce));let Le=[];He.forEach(he=>{if(he.length>1){const Yr=new Z(he).getLUT();Le.push(...Yr)}else Le.push(...he)}),y.geometry.coordinates[0].length=0;for(let he=0;he<Le.length;he++){const Bt=e.unproject(Le[he]);y.geometry.coordinates[0].push(Bt.toArray())}I.setData(te(y))}}break}r&&r(j())},U=()=>{e.dragPan.disable(),e.dragRotate.disable(),X=!0,H()},V=()=>{e.dragPan.enable(),e.dragRotate.enable(),X=!1},ne=()=>{R()},ie=()=>{e.getLayer(i)&&e.removeLayer(i),e.getLayer(i+"outline")&&e.removeLayer(i+"outline"),e.getSource(i)&&e.removeSource(i)},j=()=>{const P=u,I=[];return P.forEach((N,T)=>{if(e.getSource(N)){const ce=e.getSource(N).serialize().data;ce.features?(ce.features[0].properties.layerId=N,ce.features[0].properties.sourceId=c[T],I.push(...ce.features)):(ce.properties.layerId=N,ce.properties.sourceId=c[T],I.push(ce))}}),I},oe=()=>{u.forEach(P=>{e.getLayer(P)&&e.removeLayer(P),e.getLayer(P+"outline")&&e.removeLayer(P+"outline"),e.getLayer(P+"point")&&e.removeLayer(P+"point"),e.getLayer(P+"text")&&e.removeLayer(P+"text")}),c.forEach(P=>{e.getSource(P)&&e.removeSource(P),e.getSource(P+"point")&&e.removeSource(P+"point"),e.getSource(P+"text")&&e.removeSource(P+"text")}),u.length=0,c.length=0},ee=()=>{m.length=0,f.features.length=0,h.geometry.coordinates.length=0,y.geometry.coordinates.length=0,y.geometry.coordinates[0]=[],y.properties.result=""},re=x(G,30),ae=()=>{Q(),e.off("click",C),e.off("mousemove",re),e.off("contextmenu",J),e.getCanvas().style.cursor="pointer",E(!1)},de=()=>{(s=="free"||s=="polygon"||s=="point"||s=="line")&&u.length&&(e.removeLayer(u[u.length-1]),e.getLayer(u[u.length-1]+"outline")&&e.removeLayer(u[u.length-1]+"outline"),e.getLayer(u[u.length-1]+"point")&&e.removeLayer(u[u.length-1]+"point"),u.pop())},_e=()=>{if((s=="free"||s=="polygon")&&c.length){const P=u.length-c.length,I=c.slice(P);if(P!==0&&I.length){const ue=e.getSource(I[0]).serialize().data.valueOf();e.getLayer(I[0])||(u.push(I[0]),Se(e,I[0],I[0],{"fill-color":ue.properties["fill-color"]}),me(e,I[0]+"outline",I[0],{"line-color":"black","line-width":2,...ue.properties}))}}};let je=!1;const ht=P=>{je=P};let ke,qe=!1,Ee="";e.on("mousedown",P=>{const I=e.queryRenderedFeatures(P.point);I.length>0&&(Ee=I[0].layer.source,je&&Ze(P))});const Ze=P=>{e.dragPan.disable(),ke=P.lngLat,qe=!0,e.on("mouseup",Ae),e.on("mousemove",Rt),a&&a()},Ae=()=>{if(qe=!1,e.off("mouseup",Ae),e.off("mousemove",Rt),e.dragPan.enable(),o){const I=e.getSource(Ee).serialize().data;o(I)}},Rt=P=>{if(!qe)return;const I=P.lngLat,N=I.lng-ke.lng,T=I.lat-ke.lat;ke=I;const ue=e.getSource(Ee),ce=ue.serialize().data;ce.geometry.coordinates=ce.geometry.coordinates.map(He=>He.map(Le=>[Le[0]+N,Le[1]+T])),ue.setData(ce)};return{startDraw:S,revoke:de,redo:_e,getFeaturesFromDraw:j,clearDraw:oe,stopDraw:ae,setBrushSize:K,setValue:W,setDrawMethod:v,setDragMode:ht}}function Xr(e,r){let n="free",o="",a=[],s=[],i={},u=!1,c=!0,l=!0,g=!1,d=[],p={type:"FeatureCollection",features:[]},z={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}},m={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[]}},b={type:"Feature",properties:{result:""},geometry:{type:"Point",coordinates:[]}};const F=w=>{e.off("click",D),e.off("mousemove",O),e.off("contextmenu",Y),Q(),u&&(c=!0,_(!1)),u=!0,n=w.type||"point",l=w.measure||!1,g=w.smooth||!1,i=w,z.properties=w,m.properties=w,b.properties=w,e.on("click",D),e.getCanvas().style.cursor="crosshair"},X=w=>{v(),Q(),e.addSource(o,{type:"geojson",data:p}),ze(e,o,o,i),Be(e,o+"text",o,{visibility:l}),p.features.push({type:"Feature",properties:i,geometry:{type:"Point",coordinates:w.lngLat.toArray()}}),e.getSource(o).setData(te(p)),r&&r(R())},f=w=>{v(),Q(),e.addSource(o,{type:"geojson",data:p}),kr(e,o,o,i),p.features.push({type:"Feature",properties:i,geometry:{type:"Point",coordinates:w.lngLat.toArray()}}),e.getSource(o).setData(te(p)),r&&r(R())},h=w=>{c&&(v(),Q(),e.addSource(o,{type:"geojson",data:z}),e.addSource(o+"text",{type:"geojson",data:p}),me(e,o,o),ze(e,o+"point",o,i),Be(e,o+"text",o+"text",{visibility:l}),c=!1,e.on("mousemove",O),e.on("contextmenu",Y)),z.geometry.coordinates.push(w.lngLat.toArray()),e.getSource(o).setData(z),p.features.push({type:"Feature",properties:{},geometry:{type:"Point",coordinates:w.lngLat.toArray()}}),e.getSource(o+"text").setData(p)},y=w=>{c&&(v(),Q(),e.addSource(o,{type:"geojson",data:m}),e.addSource(o+"area",{type:"geojson",data:b}),Se(e,o,o),me(e,o+"outline",o,{"line-color":"black","line-width":2,...i}),ze(e,o+"point",o),Be(e,o+"area",o+"area",{visibility:l}),c=!1,e.on("mousemove",O),e.on("contextmenu",Y)),m.geometry.coordinates[0].length>=3&&m.geometry.coordinates[0].pop(),m.geometry.coordinates[0].push(w.lngLat.toArray()),m.geometry.coordinates[0].push(m.geometry.coordinates[0][0]),d.push(w.point),e.getSource(o).setData(m),_(!0)},x=w=>{c&&(v(),Q(),e.addSource(o,{type:"geojson",data:m}),e.addSource(o+"area",{type:"geojson",data:b}),Se(e,o,o,i),me(e,o+"outline",o,{"line-color":"black","line-width":2,...i}),Be(e,o+"area",o+"area",{visibility:l}),c=!1,m.geometry.coordinates[0].push(w.lngLat.toArray()),e.getSource(o).setData(m),e.on("mousemove",O),e.on("contextmenu",Y),_(!0))},S=w=>{if(c){v(),Q(),e.addSource(o,{type:"geojson",data:m}),e.addSource(o+"area",{type:"geojson",data:b}),e.addSource(o+"point",{type:"geojson",data:p}),Se(e,o,o,i),me(e,o+"outline",o,{"line-color":"black","line-width":2,...i}),ze(e,o+"point",o+"point"),Be(e,o+"area",o+"area",{visibility:l}),c=!1;const E={type:"Feature",properties:{},geometry:{type:"Point",coordinates:w.lngLat.toArray()}};p.features.push(te(E)),p.features.push(te(E)),b.geometry.coordinates=w.lngLat.toArray(),e.getSource(o+"point").setData(p),e.on("mousemove",O),e.on("contextmenu",Y),_(!0)}},v=()=>{o=M(),a.push(o),s.push(o)},M=()=>{let w=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(C){const G=(w+Math.random()*16)%16|0;return w=Math.floor(w/16),(C==="x"?G:G&3|8).toString(16)})},_=w=>{["scrollZoom","boxZoom","dragPan","keyboard","doubleClickZoom","touchZoomRotate"].forEach(C=>{w?e[C].disable():e[C].enable()})},D=w=>{switch(n){case"symbol":f(w);break;case"point":X(w);break;case"line":h(w);break;case"polygon":y(w);break;case"free":x(w);break;case"circle":S(w);break}},A=w=>{switch(n){case"line":if(z.geometry.coordinates.length){z.geometry.coordinates.length==1&&z.geometry.coordinates.push(w.lngLat.toArray()),z.geometry.coordinates[z.geometry.coordinates.length-1]=w.lngLat.toArray(),e.getSource(o).setData(z);const j=z.geometry.coordinates[z.geometry.coordinates.length-2],oe=z.geometry.coordinates[z.geometry.coordinates.length-1],ee=st(j,oe,{units:"kilometers"}),re=br(pe(j),pe(oe)),ae=p.features[p.features.length-1];ae.properties.result=Ge(ee,4)+"km",ae.geometry.coordinates=re.geometry.coordinates,e.getSource(o+"text").setData(te(p))}break;case"polygon":const V=m.geometry.coordinates[0].length;if(V){V==2?m.geometry.coordinates[0][V-1]=w.lngLat.toArray():m.geometry.coordinates[0][V-2]=w.lngLat.toArray();const ie=lt(m)/1e6;if(V>=4){var E=Ie(m.geometry.coordinates),C=ct(E);b.geometry.coordinates=C.geometry.coordinates,b.properties.result=Ge(ie,2)+"km²"}const j=e.getSource(o);j.setData(m),e.getSource(o+"area").setData(b),g&&m.geometry.coordinates[0].length>=3&&j.setData(q(m))}break;case"free":const ne=m.geometry.coordinates[0].length;if(ne){d.push(w.point),m.geometry.coordinates[0].length!=1&&m.geometry.coordinates[0].pop(),m.geometry.coordinates[0].push(w.lngLat.toArray()),m.geometry.coordinates[0].push(m.geometry.coordinates[0][0]);const ie=lt(m)/1e6;if(ne>=4){var E=Ie(m.geometry.coordinates),C=ct(E);b.geometry.coordinates=C.geometry.coordinates,b.properties.result=Ge(ie,2)+"km²"}e.getSource(o).setData(m),e.getSource(o+"area").setData(b)}break;case"circle":if(p.features.length){p.features[1].geometry.coordinates=w.lngLat.toArray();var G=pe(p.features[0].geometry.coordinates),B=pe(p.features[1].geometry.coordinates),$=st(G,B,{units:"miles"}),J={steps:500,units:"miles",properties:{foo:"bar"}},U=At(G,$,J);m.geometry.coordinates=U.geometry.coordinates;const ie=lt(m)/1e6;b.properties.result=Ge(ie,2)+"km²";const j=e.getSource(o+"point"),oe=e.getSource(o),ee=e.getSource(o+"area");j.setData(p),oe.setData(m),ee.setData(b)}break}},Y=w=>{w.preventDefault(),e.off("mousemove",O),e.off("contextmenu",Y),c=!0,d.push(w.point),_(!1);const E=e.getSource(o);switch(n){case"line":z.geometry.coordinates.length&&(console.log(z),E.setData(te(z)),e.removeLayer(o+"point"),g&&z.geometry.coordinates.length>=2&&E.setData(se(z)));break;case"polygon":m.geometry.coordinates[0].length&&E.setData(te(m)),e.setLayoutProperty(o+"point","visibility","none"),g&&E.setData(te(q(m)));break;case"free":if(m.geometry.coordinates[0].length&&(E.setData(te(m)),g)){const C=[...d.slice(d.length/5),...d.slice(0,d.length/5),d.slice(d.length/5)[0]],G=C.length>10?5:3,B=Math.ceil(C.length/G),$=[];for(let U=0;U<C.length;U+=B)$.push(C.slice(U,U+B));let J=[];$.forEach(U=>{if(U.length>1){const ne=new Z(U).getLUT();J.push(...ne)}else J.push(...U)}),m.geometry.coordinates[0].length=0;for(let U=0;U<J.length;U++){const V=e.unproject(J[U]);m.geometry.coordinates[0].push(V.toArray())}E.setData(te(m))}break;case"circle":e.removeLayer(o+"point"),e.removeSource(o+"point");break}r&&r(R())},R=()=>{const w=a,E=[];return w.forEach((C,G)=>{const $=e.getSource(C).serialize().data;$.features?($.features[0].properties.layerId=C,$.features[0].properties.sourceId=s[G],E.push(...$.features)):($.properties.layerId=C,$.properties.sourceId=s[G],E.push($))}),E},q=w=>{let E=te(w);const C=Te(E.geometry.coordinates[0]),G=ut(C,{sharpness:.6});return E.geometry.coordinates[0]=G.geometry.coordinates,E},se=w=>{let E=te(w);console.log(E,"lineFeature");const C=Te(E.geometry.coordinates),G=ut(C,{sharpness:.6});return E.geometry.coordinates=G.geometry.coordinates,E},H=w=>{e.getLayer(w)&&e.removeLayer(w),e.getLayer(w+"outline")&&e.removeLayer(w+"outline"),e.getLayer(w+"point")&&e.removeLayer(w+"point"),e.getLayer(w+"area")&&e.removeLayer(w+"area"),e.getLayer(w+"text")&&e.removeLayer(w+"text"),a=a.filter(E=>E!==w)},K=()=>{a.forEach(w=>{e.removeLayer(w),e.getLayer(w+"outline")&&e.removeLayer(w+"outline"),e.getLayer(w+"point")&&e.removeLayer(w+"point"),e.getLayer(w+"area")&&e.removeLayer(w+"area"),e.getLayer(w+"text")&&e.removeLayer(w+"text")}),s.forEach(w=>{e.removeSource(w),e.getSource(w+"point")&&e.removeSource(w+"point"),e.getSource(w+"text")&&e.removeSource(w+"text"),e.getSource(w+"area")&&e.removeSource(w+"area")}),a.length=0,s.length=0},W=()=>{e.off("click",D),e.off("mousemove",O),e.off("contextmenu",Y),e.getCanvas().style.cursor="pointer",_(!1)},Q=()=>{d.length=0,p.features.length=0,z.geometry.coordinates.length=0,m.geometry.coordinates.length=0,m.geometry.coordinates[0]=[],m.properties.result="",b.geometry.coordinates.length=0},O=((w,E)=>{let C=0;return function(...G){const B=new Date().getTime();B-C<E||(C=B,w(...G))}})(A,30);return{startMeasure:F,clearMeasure:K,stopMeasure:W,getFeaturesFromMeasure:R,clearLayerById:H}}Me.draw=Ar,Me.measure=Xr,Object.defineProperty(Me,Symbol.toStringTag,{value:"Module"})});
1
+ (function(Me,ge){typeof exports=="object"&&typeof module<"u"?ge(exports):typeof define=="function"&&define.amd?define(["exports"],ge):(Me=typeof globalThis<"u"?globalThis:Me||self,ge(Me.index={}))})(this,function(Me){"use strict";const{abs:ge,cos:xe,sin:Pe,acos:Bt,atan2:Xe,sqrt:ve,pow:fe}=Math;function Ye(e){return e<0?-fe(-e,1/3):fe(e,1/3)}const yt=Math.PI,Ne=2*yt,we=yt/2,qt=1e-6,Qe=Number.MAX_SAFE_INTEGER||9007199254740991,Ve=Number.MIN_SAFE_INTEGER||-9007199254740991,Nt={x:0,y:0,z:0},L={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,r){const n=r(e);let o=n.x*n.x+n.y*n.y;return typeof n.z<"u"&&(o+=n.z*n.z),ve(o)},compute:function(e,r,n){if(e===0)return r[0].t=0,r[0];const o=r.length-1;if(e===1)return r[o].t=1,r[o];const a=1-e;let s=r;if(o===0)return r[0].t=e,r[0];if(o===1){const u={x:a*s[0].x+e*s[1].x,y:a*s[0].y+e*s[1].y,t:e};return n&&(u.z=a*s[0].z+e*s[1].z),u}if(o<4){let u=a*a,c=e*e,l,g,d,p=0;o===2?(s=[s[0],s[1],s[2],Nt],l=u,g=a*e*2,d=c):o===3&&(l=u*a,g=u*e*3,d=a*c*3,p=e*c);const z={x:l*s[0].x+g*s[1].x+d*s[2].x+p*s[3].x,y:l*s[0].y+g*s[1].y+d*s[2].y+p*s[3].y,t:e};return n&&(z.z=l*s[0].z+g*s[1].z+d*s[2].z+p*s[3].z),z}const i=JSON.parse(JSON.stringify(r));for(;i.length>1;){for(let u=0;u<i.length-1;u++)i[u]={x:i[u].x+(i[u+1].x-i[u].x)*e,y:i[u].y+(i[u+1].y-i[u].y)*e},typeof i[u].z<"u"&&(i[u].z=i[u].z+(i[u+1].z-i[u].z)*e);i.splice(i.length-1,1)}return i[0].t=e,i[0]},computeWithRatios:function(e,r,n,o){const a=1-e,s=n,i=r;let u=s[0],c=s[1],l=s[2],g=s[3],d;if(u*=a,c*=e,i.length===2)return d=u+c,{x:(u*i[0].x+c*i[1].x)/d,y:(u*i[0].y+c*i[1].y)/d,z:o?(u*i[0].z+c*i[1].z)/d:!1,t:e};if(u*=a,c*=2*a,l*=e*e,i.length===3)return d=u+c+l,{x:(u*i[0].x+c*i[1].x+l*i[2].x)/d,y:(u*i[0].y+c*i[1].y+l*i[2].y)/d,z:o?(u*i[0].z+c*i[1].z+l*i[2].z)/d:!1,t:e};if(u*=a,c*=1.5*a,l*=3*a,g*=e*e*e,i.length===4)return d=u+c+l+g,{x:(u*i[0].x+c*i[1].x+l*i[2].x+g*i[3].x)/d,y:(u*i[0].y+c*i[1].y+l*i[2].y+g*i[3].y)/d,z:o?(u*i[0].z+c*i[1].z+l*i[2].z+g*i[3].z)/d:!1,t:e}},derive:function(e,r){const n=[];for(let o=e,a=o.length,s=a-1;a>1;a--,s--){const i=[];for(let u=0,c;u<s;u++)c={x:s*(o[u+1].x-o[u].x),y:s*(o[u+1].y-o[u].y)},r&&(c.z=s*(o[u+1].z-o[u].z)),i.push(c);n.push(i),o=i}return n},between:function(e,r,n){return r<=e&&e<=n||L.approximately(e,r)||L.approximately(e,n)},approximately:function(e,r,n){return ge(e-r)<=(n||qt)},length:function(e){const n=L.Tvalues.length;let o=0;for(let a=0,s;a<n;a++)s=.5*L.Tvalues[a]+.5,o+=L.Cvalues[a]*L.arcfn(s,e);return .5*o},map:function(e,r,n,o,a){const s=n-r,i=a-o,u=e-r,c=u/s;return o+i*c},lerp:function(e,r,n){const o={x:r.x+e*(n.x-r.x),y:r.y+e*(n.y-r.y)};return r.z!==void 0&&n.z!==void 0&&(o.z=r.z+e*(n.z-r.z)),o},pointToString:function(e){let r=e.x+"/"+e.y;return typeof e.z<"u"&&(r+="/"+e.z),r},pointsToString:function(e){return"["+e.map(L.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,r,n){const o=r.x-e.x,a=r.y-e.y,s=n.x-e.x,i=n.y-e.y,u=o*i-a*s,c=o*s+a*i;return Xe(u,c)},round:function(e,r){const n=""+e,o=n.indexOf(".");return parseFloat(n.substring(0,o+1+r))},dist:function(e,r){const n=e.x-r.x,o=e.y-r.y;return ve(n*n+o*o)},closest:function(e,r){let n=fe(2,63),o,a;return e.forEach(function(s,i){a=L.dist(r,s),a<n&&(n=a,o=i)}),{mdist:n,mpos:o}},abcratio:function(e,r){if(r!==2&&r!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const n=fe(e,r)+fe(1-e,r),o=n-1;return ge(o/n)},projectionratio:function(e,r){if(r!==2&&r!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const n=fe(1-e,r),o=fe(e,r)+n;return n/o},lli8:function(e,r,n,o,a,s,i,u){const c=(e*o-r*n)*(a-i)-(e-n)*(a*u-s*i),l=(e*o-r*n)*(s-u)-(r-o)*(a*u-s*i),g=(e-n)*(s-u)-(r-o)*(a-i);return g==0?!1:{x:c/g,y:l/g}},lli4:function(e,r,n,o){const a=e.x,s=e.y,i=r.x,u=r.y,c=n.x,l=n.y,g=o.x,d=o.y;return L.lli8(a,s,i,u,c,l,g,d)},lli:function(e,r){return L.lli4(e,e.c,r,r.c)},makeline:function(e,r){return new Z(e.x,e.y,(e.x+r.x)/2,(e.y+r.y)/2,r.x,r.y)},findbbox:function(e){let r=Qe,n=Qe,o=Ve,a=Ve;return e.forEach(function(s){const i=s.bbox();r>i.x.min&&(r=i.x.min),n>i.y.min&&(n=i.y.min),o<i.x.max&&(o=i.x.max),a<i.y.max&&(a=i.y.max)}),{x:{min:r,mid:(r+o)/2,max:o,size:o-r},y:{min:n,mid:(n+a)/2,max:a,size:a-n}}},shapeintersections:function(e,r,n,o,a){if(!L.bboxoverlap(r,o))return[];const s=[],i=[e.startcap,e.forward,e.back,e.endcap],u=[n.startcap,n.forward,n.back,n.endcap];return i.forEach(function(c){c.virtual||u.forEach(function(l){if(l.virtual)return;const g=c.intersects(l,a);g.length>0&&(g.c1=c,g.c2=l,g.s1=e,g.s2=n,s.push(g))})}),s},makeshape:function(e,r,n){const o=r.points.length,a=e.points.length,s=L.makeline(r.points[o-1],e.points[0]),i=L.makeline(e.points[a-1],r.points[0]),u={startcap:s,forward:e,back:r,endcap:i,bbox:L.findbbox([s,e,r,i])};return u.intersections=function(c){return L.shapeintersections(u,u.bbox,c,c.bbox,n)},u},getminmax:function(e,r,n){if(!n)return{min:0,max:0};let o=Qe,a=Ve,s,i;n.indexOf(0)===-1&&(n=[0].concat(n)),n.indexOf(1)===-1&&n.push(1);for(let u=0,c=n.length;u<c;u++)s=n[u],i=e.get(s),i[r]<o&&(o=i[r]),i[r]>a&&(a=i[r]);return{min:o,mid:(o+a)/2,max:a,size:a-o}},align:function(e,r){const n=r.p1.x,o=r.p1.y,a=-Xe(r.p2.y-o,r.p2.x-n),s=function(i){return{x:(i.x-n)*xe(a)-(i.y-o)*Pe(a),y:(i.x-n)*Pe(a)+(i.y-o)*xe(a)}};return e.map(s)},roots:function(e,r){r=r||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,o=L.align(e,r),a=function(v){return 0<=v&&v<=1};if(n===2){const v=o[0].y,M=o[1].y,_=o[2].y,D=v-2*M+_;if(D!==0){const A=-ve(M*M-v*_),Y=-v+M,R=-(A+Y)/D,q=-(-A+Y)/D;return[R,q].filter(a)}else if(M!==_&&D===0)return[(2*M-_)/(2*M-2*_)].filter(a);return[]}const s=o[0].y,i=o[1].y,u=o[2].y,c=o[3].y;let l=-s+3*i-3*u+c,g=3*s-6*i+3*u,d=-3*s+3*i,p=s;if(L.approximately(l,0)){if(L.approximately(g,0))return L.approximately(d,0)?[]:[-p/d].filter(a);const v=ve(d*d-4*g*p),M=2*g;return[(v-d)/M,(-d-v)/M].filter(a)}g/=l,d/=l,p/=l;const z=(3*d-g*g)/3,m=z/3,b=(2*g*g*g-9*g*d+27*p)/27,F=b/2,X=F*F+m*m*m;let f,h,y,x,S;if(X<0){const v=-z/3,M=v*v*v,_=ve(M),D=-b/(2*_),A=D<-1?-1:D>1?1:D,Y=Bt(A),R=Ye(_),q=2*R;return y=q*xe(Y/3)-g/3,x=q*xe((Y+Ne)/3)-g/3,S=q*xe((Y+2*Ne)/3)-g/3,[y,x,S].filter(a)}else{if(X===0)return f=F<0?Ye(-F):-Ye(F),y=2*f-g/3,x=-f-g/3,[y,x].filter(a);{const v=ve(X);return f=Ye(-F+v),h=Ye(F+v),[f-h-g/3].filter(a)}}},droots:function(e){if(e.length===3){const r=e[0],n=e[1],o=e[2],a=r-2*n+o;if(a!==0){const s=-ve(n*n-r*o),i=-r+n,u=-(s+i)/a,c=-(-s+i)/a;return[u,c]}else if(n!==o&&a===0)return[(2*n-o)/(2*(n-o))];return[]}if(e.length===2){const r=e[0],n=e[1];return r!==n?[r/(r-n)]:[]}return[]},curvature:function(e,r,n,o,a){let s,i,u,c,l=0,g=0;const d=L.compute(e,r),p=L.compute(e,n),z=d.x*d.x+d.y*d.y;if(o?(s=ve(fe(d.y*p.z-p.y*d.z,2)+fe(d.z*p.x-p.z*d.x,2)+fe(d.x*p.y-p.x*d.y,2)),i=fe(z+d.z*d.z,3/2)):(s=d.x*p.y-d.y*p.x,i=fe(z,3/2)),s===0||i===0)return{k:0,r:0};if(l=s/i,g=i/s,!a){const m=L.curvature(e-.001,r,n,o,!0).k,b=L.curvature(e+.001,r,n,o,!0).k;c=(b-l+(l-m))/2,u=(ge(b-l)+ge(l-m))/2}return{k:l,r:g,dk:c,adk:u}},inflections:function(e){if(e.length<4)return[];const r=L.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=r[2].x*r[1].y,o=r[3].x*r[1].y,a=r[1].x*r[2].y,s=r[3].x*r[2].y,i=18*(-3*n+2*o+3*a-s),u=18*(3*n-o-3*a),c=18*(a-n);if(L.approximately(i,0)){if(!L.approximately(u,0)){let p=-c/u;if(0<=p&&p<=1)return[p]}return[]}const l=2*i;if(L.approximately(l,0))return[];const g=u*u-4*i*c;if(g<0)return[];const d=Math.sqrt(g);return[(d-u)/l,-(u+d)/l].filter(function(p){return 0<=p&&p<=1})},bboxoverlap:function(e,r){const n=["x","y"],o=n.length;for(let a=0,s,i,u,c;a<o;a++)if(s=n[a],i=e[s].mid,u=r[s].mid,c=(e[s].size+r[s].size)/2,ge(i-u)>=c)return!1;return!0},expandbox:function(e,r){r.x.min<e.x.min&&(e.x.min=r.x.min),r.y.min<e.y.min&&(e.y.min=r.y.min),r.z&&r.z.min<e.z.min&&(e.z.min=r.z.min),r.x.max>e.x.max&&(e.x.max=r.x.max),r.y.max>e.y.max&&(e.y.max=r.y.max),r.z&&r.z.max>e.z.max&&(e.z.max=r.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,r,n){const o=e.bbox(),a=r.bbox(),s=1e5,i=n||.5;if(o.x.size+o.y.size<i&&a.x.size+a.y.size<i)return[(s*(e._t1+e._t2)/2|0)/s+"/"+(s*(r._t1+r._t2)/2|0)/s];let u=e.split(.5),c=r.split(.5),l=[{left:u.left,right:c.left},{left:u.left,right:c.right},{left:u.right,right:c.right},{left:u.right,right:c.left}];l=l.filter(function(d){return L.bboxoverlap(d.left.bbox(),d.right.bbox())});let g=[];return l.length===0||(l.forEach(function(d){g=g.concat(L.pairiteration(d.left,d.right,i))}),g=g.filter(function(d,p){return g.indexOf(d)===p})),g},getccenter:function(e,r,n){const o=r.x-e.x,a=r.y-e.y,s=n.x-r.x,i=n.y-r.y,u=o*xe(we)-a*Pe(we),c=o*Pe(we)+a*xe(we),l=s*xe(we)-i*Pe(we),g=s*Pe(we)+i*xe(we),d=(e.x+r.x)/2,p=(e.y+r.y)/2,z=(r.x+n.x)/2,m=(r.y+n.y)/2,b=d+u,F=p+c,X=z+l,f=m+g,h=L.lli8(d,p,b,F,z,m,X,f),y=L.dist(h,e);let x=Xe(e.y-h.y,e.x-h.x),S=Xe(r.y-h.y,r.x-h.x),v=Xe(n.y-h.y,n.x-h.x),M;return x<v?((x>S||S>v)&&(x+=Ne),x>v&&(M=v,v=x,x=M)):v<S&&S<x?(M=v,v=x,x=M):v+=Ne,h.s=x,h.e=v,h.r=y,h},numberSort:function(e,r){return e-r}};class Ce{constructor(r){this.curves=[],this._3d=!1,r&&(this.curves=r,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(r){return L.pointsToString(r.points)}).join(", ")+"]"}addCurve(r){this.curves.push(r),this._3d=this._3d||r._3d}length(){return this.curves.map(function(r){return r.length()}).reduce(function(r,n){return r+n})}curve(r){return this.curves[r]}bbox(){const r=this.curves;for(var n=r[0].bbox(),o=1;o<r.length;o++)L.expandbox(n,r[o].bbox());return n}offset(r){const n=[];return this.curves.forEach(function(o){n.push(...o.offset(r))}),new Ce(n)}}const{abs:Fe,min:dt,max:gt,cos:Tt,sin:Gt,acos:$t,sqrt:Oe}=Math,Ut=Math.PI;class Z{constructor(r){let n=r&&r.forEach?r:Array.from(arguments).slice(),o=!1;if(typeof n[0]=="object"){o=n.length;const z=[];n.forEach(function(m){["x","y","z"].forEach(function(b){typeof m[b]<"u"&&z.push(m[b])})}),n=z}let a=!1;const s=n.length;if(o){if(o>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");a=!0}}else if(s!==6&&s!==8&&s!==9&&s!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const i=this._3d=!a&&(s===9||s===12)||r&&r[0]&&typeof r[0].z<"u",u=this.points=[];for(let z=0,m=i?3:2;z<s;z+=m){var c={x:n[z],y:n[z+1]};i&&(c.z=n[z+2]),u.push(c)}const l=this.order=u.length-1,g=this.dims=["x","y"];i&&g.push("z"),this.dimlen=g.length;const d=L.align(u,{p1:u[0],p2:u[l]}),p=L.dist(u[0],u[l]);this._linear=d.reduce((z,m)=>z+Fe(m.y),0)<p/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(r,n,o,a){if(typeof a>"u"&&(a=.5),a===0)return new Z(n,n,o);if(a===1)return new Z(r,n,n);const s=Z.getABC(2,r,n,o,a);return new Z(r,s.A,o)}static cubicFromPoints(r,n,o,a,s){typeof a>"u"&&(a=.5);const i=Z.getABC(3,r,n,o,a);typeof s>"u"&&(s=L.dist(n,i.C));const u=s*(1-a)/a,c=L.dist(r,o),l=(o.x-r.x)/c,g=(o.y-r.y)/c,d=s*l,p=s*g,z=u*l,m=u*g,b={x:n.x-d,y:n.y-p},F={x:n.x+z,y:n.y+m},X=i.A,f={x:X.x+(b.x-X.x)/(1-a),y:X.y+(b.y-X.y)/(1-a)},h={x:X.x+(F.x-X.x)/a,y:X.y+(F.y-X.y)/a},y={x:r.x+(f.x-r.x)/a,y:r.y+(f.y-r.y)/a},x={x:o.x+(h.x-o.x)/(1-a),y:o.y+(h.y-o.y)/(1-a)};return new Z(r,y,x,o)}static getUtils(){return L}getUtils(){return Z.getUtils()}static get PolyBezier(){return Ce}valueOf(){return this.toString()}toString(){return L.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const r=this.points,n=r[0].x,o=r[0].y,a=["M",n,o,this.order===2?"Q":"C"];for(let s=1,i=r.length;s<i;s++)a.push(r[s].x),a.push(r[s].y);return a.join(" ")}setRatios(r){if(r.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=r,this._lut=[]}verify(){const r=this.coordDigest();r!==this._print&&(this._print=r,this.update())}coordDigest(){return this.points.map(function(r,n){return""+n+r.x+r.y+(r.z?r.z:0)}).join("")}update(){this._lut=[],this.dpoints=L.derive(this.points,this._3d),this.computedirection()}computedirection(){const r=this.points,n=L.angle(r[0],r[this.order],r[1]);this.clockwise=n>0}length(){return L.length(this.derivative.bind(this))}static getABC(r=2,n,o,a,s=.5){const i=L.projectionratio(s,r),u=1-i,c={x:i*n.x+u*a.x,y:i*n.y+u*a.y},l=L.abcratio(s,r);return{A:{x:o.x+(o.x-c.x)/l,y:o.y+(o.y-c.y)/l},B:o,C:c,S:n,E:a}}getABC(r,n){n=n||this.get(r);let o=this.points[0],a=this.points[this.order];return Z.getABC(this.order,o,n,a,r)}getLUT(r){if(this.verify(),r=r||100,this._lut.length===r+1)return this._lut;this._lut=[],r++,this._lut=[];for(let n=0,o,a;n<r;n++)a=n/(r-1),o=this.compute(a),o.t=a,this._lut.push(o);return this._lut}on(r,n){n=n||5;const o=this.getLUT(),a=[];for(let s=0,i,u=0;s<o.length;s++)i=o[s],L.dist(i,r)<n&&(a.push(i),u+=s/o.length);return a.length?t/=a.length:!1}project(r){const n=this.getLUT(),o=n.length-1,a=L.closest(n,r),s=a.mpos,i=(s-1)/o,u=(s+1)/o,c=.1/o;let l=a.mdist,g=i,d=g,p;l+=1;for(let z;g<u+c;g+=c)p=this.compute(g),z=L.dist(r,p),z<l&&(l=z,d=g);return d=d<0?0:d>1?1:d,p=this.compute(d),p.t=d,p.d=l,p}get(r){return this.compute(r)}point(r){return this.points[r]}compute(r){return this.ratios?L.computeWithRatios(r,this.points,this.ratios,this._3d):L.compute(r,this.points,this._3d,this.ratios)}raise(){const r=this.points,n=[r[0]],o=r.length;for(let a=1,s,i;a<o;a++)s=r[a],i=r[a-1],n[a]={x:(o-a)/o*s.x+a/o*i.x,y:(o-a)/o*s.y+a/o*i.y};return n[o]=r[o-1],new Z(n)}derivative(r){return L.compute(r,this.dpoints[0],this._3d)}dderivative(r){return L.compute(r,this.dpoints[1],this._3d)}align(){let r=this.points;return new Z(L.align(r,{p1:r[0],p2:r[r.length-1]}))}curvature(r){return L.curvature(r,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return L.inflections(this.points)}normal(r){return this._3d?this.__normal3(r):this.__normal2(r)}__normal2(r){const n=this.derivative(r),o=Oe(n.x*n.x+n.y*n.y);return{t:r,x:-n.y/o,y:n.x/o}}__normal3(r){const n=this.derivative(r),o=this.derivative(r+.01),a=Oe(n.x*n.x+n.y*n.y+n.z*n.z),s=Oe(o.x*o.x+o.y*o.y+o.z*o.z);n.x/=a,n.y/=a,n.z/=a,o.x/=s,o.y/=s,o.z/=s;const i={x:o.y*n.z-o.z*n.y,y:o.z*n.x-o.x*n.z,z:o.x*n.y-o.y*n.x},u=Oe(i.x*i.x+i.y*i.y+i.z*i.z);i.x/=u,i.y/=u,i.z/=u;const c=[i.x*i.x,i.x*i.y-i.z,i.x*i.z+i.y,i.x*i.y+i.z,i.y*i.y,i.y*i.z-i.x,i.x*i.z-i.y,i.y*i.z+i.x,i.z*i.z];return{t:r,x:c[0]*n.x+c[1]*n.y+c[2]*n.z,y:c[3]*n.x+c[4]*n.y+c[5]*n.z,z:c[6]*n.x+c[7]*n.y+c[8]*n.z}}hull(r){let n=this.points,o=[],a=[],s=0;for(a[s++]=n[0],a[s++]=n[1],a[s++]=n[2],this.order===3&&(a[s++]=n[3]);n.length>1;){o=[];for(let i=0,u,c=n.length-1;i<c;i++)u=L.lerp(r,n[i],n[i+1]),a[s++]=u,o.push(u);n=o}return a}split(r,n){if(r===0&&n)return this.split(n).left;if(n===1)return this.split(r).right;const o=this.hull(r),a={left:this.order===2?new Z([o[0],o[3],o[5]]):new Z([o[0],o[4],o[7],o[9]]),right:this.order===2?new Z([o[5],o[4],o[2]]):new Z([o[9],o[8],o[6],o[3]]),span:o};return a.left._t1=L.map(0,0,1,this._t1,this._t2),a.left._t2=L.map(r,0,1,this._t1,this._t2),a.right._t1=L.map(r,0,1,this._t1,this._t2),a.right._t2=L.map(1,0,1,this._t1,this._t2),n?(n=L.map(n,r,1,0,1),a.right.split(n).left):a}extrema(){const r={};let n=[];return this.dims.forEach((function(o){let a=function(i){return i[o]},s=this.dpoints[0].map(a);r[o]=L.droots(s),this.order===3&&(s=this.dpoints[1].map(a),r[o]=r[o].concat(L.droots(s))),r[o]=r[o].filter(function(i){return i>=0&&i<=1}),n=n.concat(r[o].sort(L.numberSort))}).bind(this)),r.values=n.sort(L.numberSort).filter(function(o,a){return n.indexOf(o)===a}),r}bbox(){const r=this.extrema(),n={};return this.dims.forEach((function(o){n[o]=L.getminmax(this,o,r[o])}).bind(this)),n}overlaps(r){const n=this.bbox(),o=r.bbox();return L.bboxoverlap(n,o)}offset(r,n){if(typeof n<"u"){const o=this.get(r),a=this.normal(r),s={c:o,n:a,x:o.x+a.x*n,y:o.y+a.y*n};return this._3d&&(s.z=o.z+a.z*n),s}if(this._linear){const o=this.normal(0),a=this.points.map(function(s){const i={x:s.x+r*o.x,y:s.y+r*o.y};return s.z&&o.z&&(i.z=s.z+r*o.z),i});return[new Z(a)]}return this.reduce().map(function(o){return o._linear?o.offset(r)[0]:o.scale(r)})}simple(){if(this.order===3){const a=L.angle(this.points[0],this.points[3],this.points[1]),s=L.angle(this.points[0],this.points[3],this.points[2]);if(a>0&&s<0||a<0&&s>0)return!1}const r=this.normal(0),n=this.normal(1);let o=r.x*n.x+r.y*n.y;return this._3d&&(o+=r.z*n.z),Fe($t(o))<Ut/3}reduce(){let r,n=0,o=0,a=.01,s,i=[],u=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),n=c[0],r=1;r<c.length;r++)o=c[r],s=this.split(n,o),s._t1=n,s._t2=o,i.push(s),n=o;return i.forEach(function(l){for(n=0,o=0;o<=1;)for(o=n+a;o<=1+a;o+=a)if(s=l.split(n,o),!s.simple()){if(o-=a,Fe(n-o)<a)return[];s=l.split(n,o),s._t1=L.map(n,0,1,l._t1,l._t2),s._t2=L.map(o,0,1,l._t1,l._t2),u.push(s),n=o;break}n<1&&(s=l.split(n,1),s._t1=L.map(n,0,1,l._t1,l._t2),s._t2=l._t2,u.push(s))}),u}translate(r,n,o){o=typeof o=="number"?o:n;const a=this.order;let s=this.points.map((i,u)=>(1-u/a)*n+u/a*o);return new Z(this.points.map((i,u)=>({x:i.x+r.x*s[u],y:i.y+r.y*s[u]})))}scale(r){const n=this.order;let o=!1;if(typeof r=="function"&&(o=r),o&&n===2)return this.raise().scale(o);const a=this.clockwise,s=this.points;if(this._linear)return this.translate(this.normal(0),o?o(0):r,o?o(1):r);const i=o?o(0):r,u=o?o(1):r,c=[this.offset(0,10),this.offset(1,10)],l=[],g=L.lli4(c[0],c[0].c,c[1],c[1].c);if(!g)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(d){const p=l[d*n]=L.copy(s[d*n]);p.x+=(d?u:i)*c[d].n.x,p.y+=(d?u:i)*c[d].n.y}),o?([0,1].forEach(function(d){if(!(n===2&&d)){var p=s[d+1],z={x:p.x-g.x,y:p.y-g.y},m=o?o((d+1)/n):r;o&&!a&&(m=-m);var b=Oe(z.x*z.x+z.y*z.y);z.x/=b,z.y/=b,l[d+1]={x:p.x+m*z.x,y:p.y+m*z.y}}}),new Z(l)):([0,1].forEach(d=>{if(n===2&&d)return;const p=l[d*n],z=this.derivative(d),m={x:p.x+z.x,y:p.y+z.y};l[d+1]=L.lli4(p,m,g,s[d+1])}),new Z(l))}outline(r,n,o,a){if(n=n===void 0?r:n,this._linear){const x=this.normal(0),S=this.points[0],v=this.points[this.points.length-1];let M,_,D;o===void 0&&(o=r,a=n),M={x:S.x+x.x*r,y:S.y+x.y*r},D={x:v.x+x.x*o,y:v.y+x.y*o},_={x:(M.x+D.x)/2,y:(M.y+D.y)/2};const A=[M,_,D];M={x:S.x-x.x*n,y:S.y-x.y*n},D={x:v.x-x.x*a,y:v.y-x.y*a},_={x:(M.x+D.x)/2,y:(M.y+D.y)/2};const Y=[D,_,M],R=L.makeline(Y[2],A[0]),q=L.makeline(A[2],Y[0]),se=[R,new Z(A),q,new Z(Y)];return new Ce(se)}const s=this.reduce(),i=s.length,u=[];let c=[],l,g=0,d=this.length();const p=typeof o<"u"&&typeof a<"u";function z(x,S,v,M,_){return function(D){const A=M/v,Y=(M+_)/v,R=S-x;return L.map(D,0,1,x+A*R,x+Y*R)}}s.forEach(function(x){const S=x.length();p?(u.push(x.scale(z(r,o,d,g,S))),c.push(x.scale(z(-n,-a,d,g,S)))):(u.push(x.scale(r)),c.push(x.scale(-n))),g+=S}),c=c.map(function(x){return l=x.points,l[3]?x.points=[l[3],l[2],l[1],l[0]]:x.points=[l[2],l[1],l[0]],x}).reverse();const m=u[0].points[0],b=u[i-1].points[u[i-1].points.length-1],F=c[i-1].points[c[i-1].points.length-1],X=c[0].points[0],f=L.makeline(F,m),h=L.makeline(b,X),y=[f].concat(u).concat([h]).concat(c);return new Ce(y)}outlineshapes(r,n,o){n=n||r;const a=this.outline(r,n).curves,s=[];for(let i=1,u=a.length;i<u/2;i++){const c=L.makeshape(a[i],a[u-i],o);c.startcap.virtual=i>1,c.endcap.virtual=i<u/2-1,s.push(c)}return s}intersects(r,n){return r?r.p1&&r.p2?this.lineIntersects(r):(r instanceof Z&&(r=r.reduce()),this.curveintersects(this.reduce(),r,n)):this.selfintersects(n)}lineIntersects(r){const n=dt(r.p1.x,r.p2.x),o=dt(r.p1.y,r.p2.y),a=gt(r.p1.x,r.p2.x),s=gt(r.p1.y,r.p2.y);return L.roots(this.points,r).filter(i=>{var u=this.get(i);return L.between(u.x,n,a)&&L.between(u.y,o,s)})}selfintersects(r){const n=this.reduce(),o=n.length-2,a=[];for(let s=0,i,u,c;s<o;s++)u=n.slice(s,s+1),c=n.slice(s+2),i=this.curveintersects(u,c,r),a.push(...i);return a}curveintersects(r,n,o){const a=[];r.forEach(function(i){n.forEach(function(u){i.overlaps(u)&&a.push({left:i,right:u})})});let s=[];return a.forEach(function(i){const u=L.pairiteration(i.left,i.right,o);u.length>0&&(s=s.concat(u))}),s}arcs(r){return r=r||.5,this._iterate(r,[])}_error(r,n,o,a){const s=(a-o)/4,i=this.get(o+s),u=this.get(a-s),c=L.dist(r,n),l=L.dist(r,i),g=L.dist(r,u);return Fe(l-c)+Fe(g-c)}_iterate(r,n){let o=0,a=1,s;do{s=0,a=1;let i=this.get(o),u,c,l,g,d=!1,p=!1,z,m=a,b=1;do if(p=d,g=l,m=(o+a)/2,u=this.get(m),c=this.get(a),l=L.getccenter(i,u,c),l.interval={start:o,end:a},d=this._error(l,i,o,a)<=r,z=p&&!d,z||(b=a),d){if(a>=1){if(l.interval.end=b=1,g=l,a>1){let X={x:l.x+l.r*Tt(l.e),y:l.y+l.r*Gt(l.e)};l.e+=L.angle({x:l.x,y:l.y},X,this.get(1))}break}a=a+(a-o)/2}else a=m;while(!z&&s++<100);if(s>=100)break;g=g||l,n.push(g),o=b}while(a<1);return n}}var le=63710088e-1,xt={centimeters:le*100,centimetres:le*100,degrees:le/111325,feet:le*3.28084,inches:le*39.37,kilometers:le/1e3,kilometres:le/1e3,meters:le,metres:le,miles:le/1609.344,millimeters:le*1e3,millimetres:le*1e3,nauticalmiles:le/1852,radians:1,yards:le*1.0936};function Ke(e,r,n){n===void 0&&(n={});var o={type:"Feature"};return(n.id===0||n.id)&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.properties=r||{},o.geometry=e,o}function pe(e,r,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!pt(e[0])||!pt(e[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:e};return Ke(o,r,n)}function Ie(e,r,n){n===void 0&&(n={});for(var o=0,a=e;o<a.length;o++){var s=a[o];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var i=0;i<s[s.length-1].length;i++)if(s[s.length-1][i]!==s[0][i])throw new Error("First and last Position are not equivalent.")}var u={type:"Polygon",coordinates:e};return Ke(u,r,n)}function Te(e,r,n){if(n===void 0&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:e};return Ke(o,r,n)}function Ge(e,r){if(r===void 0&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,r||0);return Math.round(e*n)/n}function Jt(e,r){r===void 0&&(r="kilometers");var n=xt[r];if(!n)throw new Error(r+" units is invalid");return e*n}function jt(e,r){r===void 0&&(r="kilometers");var n=xt[r];if(!n)throw new Error(r+" units is invalid");return e/n}function We(e){var r=e%(2*Math.PI);return r*180/Math.PI}function ye(e){var r=e%360;return r*Math.PI/180}function pt(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Re(e,r,n){if(e!==null)for(var o,a,s,i,u,c,l,g=0,d=0,p,z=e.type,m=z==="FeatureCollection",b=z==="Feature",F=m?e.features.length:1,X=0;X<F;X++){l=m?e.features[X].geometry:b?e.geometry:e,p=l?l.type==="GeometryCollection":!1,u=p?l.geometries.length:1;for(var f=0;f<u;f++){var h=0,y=0;if(i=p?l.geometries[f]:l,i!==null){c=i.coordinates;var x=i.type;switch(g=n&&(x==="Polygon"||x==="MultiPolygon")?1:0,x){case null:break;case"Point":if(r(c,d,X,h,y)===!1)return!1;d++,h++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++){if(r(c[o],d,X,h,y)===!1)return!1;d++,x==="MultiPoint"&&h++}x==="LineString"&&h++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(a=0;a<c[o].length-g;a++){if(r(c[o][a],d,X,h,y)===!1)return!1;d++}x==="MultiLineString"&&h++,x==="Polygon"&&y++}x==="Polygon"&&h++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(y=0,a=0;a<c[o].length;a++){for(s=0;s<c[o][a].length-g;s++){if(r(c[o][a][s],d,X,h,y)===!1)return!1;d++}y++}h++}break;case"GeometryCollection":for(o=0;o<i.geometries.length;o++)if(Re(i.geometries[o],r,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Zt(e,r){var n,o,a,s,i,u,c,l,g,d,p=0,z=e.type==="FeatureCollection",m=e.type==="Feature",b=z?e.features.length:1;for(n=0;n<b;n++){for(u=z?e.features[n].geometry:m?e.geometry:e,l=z?e.features[n].properties:m?e.properties:{},g=z?e.features[n].bbox:m?e.bbox:void 0,d=z?e.features[n].id:m?e.id:void 0,c=u?u.type==="GeometryCollection":!1,i=c?u.geometries.length:1,a=0;a<i;a++){if(s=c?u.geometries[a]:u,s===null){if(r(null,p,l,g,d)===!1)return!1;continue}switch(s.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(s,p,l,g,d)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<s.geometries.length;o++)if(r(s.geometries[o],p,l,g,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}p++}}function Ht(e,r,n){var o=n;return Zt(e,function(a,s,i,u,c){s===0&&n===void 0?o=a:o=r(o,a,s,i,u,c)}),o}function et(e){var r=[1/0,1/0,-1/0,-1/0];return Re(e,function(n){r[0]>n[0]&&(r[0]=n[0]),r[1]>n[1]&&(r[1]=n[1]),r[2]<n[0]&&(r[2]=n[0]),r[3]<n[1]&&(r[3]=n[1])}),r}et.default=et;function be(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qt(e){return e.type==="Feature"?e.geometry:e}function Vt(e,r){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}var mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wt(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var n=function o(){return this instanceof o?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,a.get?a:{enumerable:!0,get:function(){return e[o]}})}),n}var tt={exports:{}},vt={exports:{}};(function(e,r){(function(n,o){e.exports=o()})(mt,function(){function n(f,h,y,x,S){(function v(M,_,D,A,Y){for(;A>D;){if(A-D>600){var R=A-D+1,q=_-D+1,se=Math.log(R),H=.5*Math.exp(2*se/3),K=.5*Math.sqrt(se*H*(R-H)/R)*(q-R/2<0?-1:1),W=Math.max(D,Math.floor(_-q*H/R+K)),Q=Math.min(A,Math.floor(_+(R-q)*H/R+K));v(M,_,W,Q,Y)}var k=M[_],O=D,w=A;for(o(M,D,_),Y(M[A],k)>0&&o(M,D,A);O<w;){for(o(M,O,w),O++,w--;Y(M[O],k)<0;)O++;for(;Y(M[w],k)>0;)w--}Y(M[D],k)===0?o(M,D,w):o(M,++w,A),w<=_&&(D=w+1),_<=w&&(A=w-1)}})(f,h,y||0,x||f.length-1,S||a)}function o(f,h,y){var x=f[h];f[h]=f[y],f[y]=x}function a(f,h){return f<h?-1:f>h?1:0}var s=function(f){f===void 0&&(f=9),this._maxEntries=Math.max(4,f),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(f,h,y){if(!y)return h.indexOf(f);for(var x=0;x<h.length;x++)if(y(f,h[x]))return x;return-1}function u(f,h){c(f,0,f.children.length,h,f)}function c(f,h,y,x,S){S||(S=F(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var v=h;v<y;v++){var M=f.children[v];l(S,f.leaf?x(M):M)}return S}function l(f,h){return f.minX=Math.min(f.minX,h.minX),f.minY=Math.min(f.minY,h.minY),f.maxX=Math.max(f.maxX,h.maxX),f.maxY=Math.max(f.maxY,h.maxY),f}function g(f,h){return f.minX-h.minX}function d(f,h){return f.minY-h.minY}function p(f){return(f.maxX-f.minX)*(f.maxY-f.minY)}function z(f){return f.maxX-f.minX+(f.maxY-f.minY)}function m(f,h){return f.minX<=h.minX&&f.minY<=h.minY&&h.maxX<=f.maxX&&h.maxY<=f.maxY}function b(f,h){return h.minX<=f.maxX&&h.minY<=f.maxY&&h.maxX>=f.minX&&h.maxY>=f.minY}function F(f){return{children:f,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X(f,h,y,x,S){for(var v=[h,y];v.length;)if(!((y=v.pop())-(h=v.pop())<=x)){var M=h+Math.ceil((y-h)/x/2)*x;n(f,M,h,y,S),v.push(h,M,M,y)}}return s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(f){var h=this.data,y=[];if(!b(f,h))return y;for(var x=this.toBBox,S=[];h;){for(var v=0;v<h.children.length;v++){var M=h.children[v],_=h.leaf?x(M):M;b(f,_)&&(h.leaf?y.push(M):m(f,_)?this._all(M,y):S.push(M))}h=S.pop()}return y},s.prototype.collides=function(f){var h=this.data;if(!b(f,h))return!1;for(var y=[];h;){for(var x=0;x<h.children.length;x++){var S=h.children[x],v=h.leaf?this.toBBox(S):S;if(b(f,v)){if(h.leaf||m(f,v))return!0;y.push(S)}}h=y.pop()}return!1},s.prototype.load=function(f){if(!f||!f.length)return this;if(f.length<this._minEntries){for(var h=0;h<f.length;h++)this.insert(f[h]);return this}var y=this._build(f.slice(),0,f.length-1,0);if(this.data.children.length)if(this.data.height===y.height)this._splitRoot(this.data,y);else{if(this.data.height<y.height){var x=this.data;this.data=y,y=x}this._insert(y,this.data.height-y.height-1,!0)}else this.data=y;return this},s.prototype.insert=function(f){return f&&this._insert(f,this.data.height-1),this},s.prototype.clear=function(){return this.data=F([]),this},s.prototype.remove=function(f,h){if(!f)return this;for(var y,x,S,v=this.data,M=this.toBBox(f),_=[],D=[];v||_.length;){if(v||(v=_.pop(),x=_[_.length-1],y=D.pop(),S=!0),v.leaf){var A=i(f,v.children,h);if(A!==-1)return v.children.splice(A,1),_.push(v),this._condense(_),this}S||v.leaf||!m(v,M)?x?(y++,v=x.children[y],S=!1):v=null:(_.push(v),D.push(y),y=0,x=v,v=v.children[0])}return this},s.prototype.toBBox=function(f){return f},s.prototype.compareMinX=function(f,h){return f.minX-h.minX},s.prototype.compareMinY=function(f,h){return f.minY-h.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(f){return this.data=f,this},s.prototype._all=function(f,h){for(var y=[];f;)f.leaf?h.push.apply(h,f.children):y.push.apply(y,f.children),f=y.pop();return h},s.prototype._build=function(f,h,y,x){var S,v=y-h+1,M=this._maxEntries;if(v<=M)return u(S=F(f.slice(h,y+1)),this.toBBox),S;x||(x=Math.ceil(Math.log(v)/Math.log(M)),M=Math.ceil(v/Math.pow(M,x-1))),(S=F([])).leaf=!1,S.height=x;var _=Math.ceil(v/M),D=_*Math.ceil(Math.sqrt(M));X(f,h,y,D,this.compareMinX);for(var A=h;A<=y;A+=D){var Y=Math.min(A+D-1,y);X(f,A,Y,_,this.compareMinY);for(var R=A;R<=Y;R+=_){var q=Math.min(R+_-1,Y);S.children.push(this._build(f,R,q,x-1))}}return u(S,this.toBBox),S},s.prototype._chooseSubtree=function(f,h,y,x){for(;x.push(h),!h.leaf&&x.length-1!==y;){for(var S=1/0,v=1/0,M=void 0,_=0;_<h.children.length;_++){var D=h.children[_],A=p(D),Y=(R=f,q=D,(Math.max(q.maxX,R.maxX)-Math.min(q.minX,R.minX))*(Math.max(q.maxY,R.maxY)-Math.min(q.minY,R.minY))-A);Y<v?(v=Y,S=A<S?A:S,M=D):Y===v&&A<S&&(S=A,M=D)}h=M||h.children[0]}var R,q;return h},s.prototype._insert=function(f,h,y){var x=y?f:this.toBBox(f),S=[],v=this._chooseSubtree(x,this.data,h,S);for(v.children.push(f),l(v,x);h>=0&&S[h].children.length>this._maxEntries;)this._split(S,h),h--;this._adjustParentBBoxes(x,S,h)},s.prototype._split=function(f,h){var y=f[h],x=y.children.length,S=this._minEntries;this._chooseSplitAxis(y,S,x);var v=this._chooseSplitIndex(y,S,x),M=F(y.children.splice(v,y.children.length-v));M.height=y.height,M.leaf=y.leaf,u(y,this.toBBox),u(M,this.toBBox),h?f[h-1].children.push(M):this._splitRoot(y,M)},s.prototype._splitRoot=function(f,h){this.data=F([f,h]),this.data.height=f.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(f,h,y){for(var x,S,v,M,_,D,A,Y=1/0,R=1/0,q=h;q<=y-h;q++){var se=c(f,0,q,this.toBBox),H=c(f,q,y,this.toBBox),K=(S=se,v=H,M=void 0,_=void 0,D=void 0,A=void 0,M=Math.max(S.minX,v.minX),_=Math.max(S.minY,v.minY),D=Math.min(S.maxX,v.maxX),A=Math.min(S.maxY,v.maxY),Math.max(0,D-M)*Math.max(0,A-_)),W=p(se)+p(H);K<Y?(Y=K,x=q,R=W<R?W:R):K===Y&&W<R&&(R=W,x=q)}return x||y-h},s.prototype._chooseSplitAxis=function(f,h,y){var x=f.leaf?this.compareMinX:g,S=f.leaf?this.compareMinY:d;this._allDistMargin(f,h,y,x)<this._allDistMargin(f,h,y,S)&&f.children.sort(x)},s.prototype._allDistMargin=function(f,h,y,x){f.children.sort(x);for(var S=this.toBBox,v=c(f,0,h,S),M=c(f,y-h,y,S),_=z(v)+z(M),D=h;D<y-h;D++){var A=f.children[D];l(v,f.leaf?S(A):A),_+=z(v)}for(var Y=y-h-1;Y>=h;Y--){var R=f.children[Y];l(M,f.leaf?S(R):R),_+=z(M)}return _},s.prototype._adjustParentBBoxes=function(f,h,y){for(var x=y;x>=0;x--)l(h[x],f)},s.prototype._condense=function(f){for(var h=f.length-1,y=void 0;h>=0;h--)f[h].children.length===0?h>0?(y=f[h-1].children).splice(y.indexOf(f[h]),1):this.clear():u(f[h],this.toBBox)},s})})(vt);var er=vt.exports;class tr{constructor(r=[],n=rr){if(this.data=r,this.length=this.data.length,this.compare=n,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(r){this.data.push(r),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const r=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:n,compare:o}=this,a=n[r];for(;r>0;){const s=r-1>>1,i=n[s];if(o(a,i)>=0)break;n[r]=i,r=s}n[r]=a}_down(r){const{data:n,compare:o}=this,a=this.length>>1,s=n[r];for(;r<a;){let i=(r<<1)+1,u=n[i];const c=i+1;if(c<this.length&&o(n[c],u)<0&&(i=c,u=n[c]),o(u,s)>=0)break;n[r]=u,r=i}n[r]=s}}function rr(e,r){return e<r?-1:e>r?1:0}const nr=Wt(Object.freeze(Object.defineProperty({__proto__:null,default:tr},Symbol.toStringTag,{value:"Module"})));var $e={exports:{}},or=function(r,n,o,a){var s=r[0],i=r[1],u=!1;o===void 0&&(o=0),a===void 0&&(a=n.length);for(var c=(a-o)/2,l=0,g=c-1;l<c;g=l++){var d=n[o+l*2+0],p=n[o+l*2+1],z=n[o+g*2+0],m=n[o+g*2+1],b=p>i!=m>i&&s<(z-d)*(i-p)/(m-p)+d;b&&(u=!u)}return u},ir=function(r,n,o,a){var s=r[0],i=r[1],u=!1;o===void 0&&(o=0),a===void 0&&(a=n.length);for(var c=a-o,l=0,g=c-1;l<c;g=l++){var d=n[l+o][0],p=n[l+o][1],z=n[g+o][0],m=n[g+o][1],b=p>i!=m>i&&s<(z-d)*(i-p)/(m-p)+d;b&&(u=!u)}return u},wt=or,Mt=ir;$e.exports=function(r,n,o,a){return n.length>0&&Array.isArray(n[0])?Mt(r,n,o,a):wt(r,n,o,a)},$e.exports.nested=Mt,$e.exports.flat=wt;var sr=$e.exports,rt={exports:{}};(function(e,r){(function(n,o){o(r)})(mt,function(n){const a=33306690738754706e-32;function s(b,F,X,f,h){let y,x,S,v,M=F[0],_=f[0],D=0,A=0;_>M==_>-M?(y=M,M=F[++D]):(y=_,_=f[++A]);let Y=0;if(D<b&&A<X)for(_>M==_>-M?(S=y-((x=M+y)-M),M=F[++D]):(S=y-((x=_+y)-_),_=f[++A]),y=x,S!==0&&(h[Y++]=S);D<b&&A<X;)_>M==_>-M?(S=y-((x=y+M)-(v=x-y))+(M-v),M=F[++D]):(S=y-((x=y+_)-(v=x-y))+(_-v),_=f[++A]),y=x,S!==0&&(h[Y++]=S);for(;D<b;)S=y-((x=y+M)-(v=x-y))+(M-v),M=F[++D],y=x,S!==0&&(h[Y++]=S);for(;A<X;)S=y-((x=y+_)-(v=x-y))+(_-v),_=f[++A],y=x,S!==0&&(h[Y++]=S);return y===0&&Y!==0||(h[Y++]=y),Y}function i(b){return new Float64Array(b)}const u=33306690738754716e-32,c=22204460492503146e-32,l=11093356479670487e-47,g=i(4),d=i(8),p=i(12),z=i(16),m=i(4);n.orient2d=function(b,F,X,f,h,y){const x=(F-y)*(X-h),S=(b-h)*(f-y),v=x-S;if(x===0||S===0||x>0!=S>0)return v;const M=Math.abs(x+S);return Math.abs(v)>=u*M?v:-function(_,D,A,Y,R,q,se){let H,K,W,Q,k,O,w,E,C,G,B,$,J,U,V,ne,ie,j;const oe=_-R,ee=A-R,re=D-q,ae=Y-q;k=(V=(E=oe-(w=(O=134217729*oe)-(O-oe)))*(G=ae-(C=(O=134217729*ae)-(O-ae)))-((U=oe*ae)-w*C-E*C-w*G))-(B=V-(ie=(E=re-(w=(O=134217729*re)-(O-re)))*(G=ee-(C=(O=134217729*ee)-(O-ee)))-((ne=re*ee)-w*C-E*C-w*G))),g[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),g[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,g[2]=$-(j-k)+(B-k),g[3]=j;let de=function(qe,Ee){let Ze=Ee[0];for(let Ae=1;Ae<qe;Ae++)Ze+=Ee[Ae];return Ze}(4,g),_e=c*se;if(de>=_e||-de>=_e||(H=_-(oe+(k=_-oe))+(k-R),W=A-(ee+(k=A-ee))+(k-R),K=D-(re+(k=D-re))+(k-q),Q=Y-(ae+(k=Y-ae))+(k-q),H===0&&K===0&&W===0&&Q===0)||(_e=l*se+a*Math.abs(de),(de+=oe*Q+ae*H-(re*W+ee*K))>=_e||-de>=_e))return de;k=(V=(E=H-(w=(O=134217729*H)-(O-H)))*(G=ae-(C=(O=134217729*ae)-(O-ae)))-((U=H*ae)-w*C-E*C-w*G))-(B=V-(ie=(E=K-(w=(O=134217729*K)-(O-K)))*(G=ee-(C=(O=134217729*ee)-(O-ee)))-((ne=K*ee)-w*C-E*C-w*G))),m[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),m[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,m[2]=$-(j-k)+(B-k),m[3]=j;const je=s(4,g,4,m,d);k=(V=(E=oe-(w=(O=134217729*oe)-(O-oe)))*(G=Q-(C=(O=134217729*Q)-(O-Q)))-((U=oe*Q)-w*C-E*C-w*G))-(B=V-(ie=(E=re-(w=(O=134217729*re)-(O-re)))*(G=W-(C=(O=134217729*W)-(O-W)))-((ne=re*W)-w*C-E*C-w*G))),m[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),m[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,m[2]=$-(j-k)+(B-k),m[3]=j;const ht=s(je,d,4,m,p);k=(V=(E=H-(w=(O=134217729*H)-(O-H)))*(G=Q-(C=(O=134217729*Q)-(O-Q)))-((U=H*Q)-w*C-E*C-w*G))-(B=V-(ie=(E=K-(w=(O=134217729*K)-(O-K)))*(G=W-(C=(O=134217729*W)-(O-W)))-((ne=K*W)-w*C-E*C-w*G))),m[0]=V-(B+k)+(k-ie),k=(J=U-(($=U+B)-(k=$-U))+(B-k))-(B=J-ne),m[1]=J-(B+k)+(k-ne),k=(j=$+B)-$,m[2]=$-(j-k)+(B-k),m[3]=j;const ke=s(ht,p,4,m,z);return z[ke-1]}(b,F,X,f,h,y,M)},n.orient2dfast=function(b,F,X,f,h,y){return(F-y)*(X-h)-(b-h)*(f-y)},Object.defineProperty(n,"__esModule",{value:!0})})})(rt,rt.exports);var ar=rt.exports,zt=er,Ue=nr,ur=sr,cr=ar.orient2d;Ue.default&&(Ue=Ue.default),tt.exports=St,tt.exports.default=St;function St(e,r,n){r=Math.max(0,r===void 0?2:r),n=n||0;var o=dr(e),a=new zt(16);a.toBBox=function(f){return{minX:f[0],minY:f[1],maxX:f[0],maxY:f[1]}},a.compareMinX=function(f,h){return f[0]-h[0]},a.compareMinY=function(f,h){return f[1]-h[1]},a.load(e);for(var s=[],i=0,u;i<o.length;i++){var c=o[i];a.remove(c),u=Pt(c,u),s.push(u)}var l=new zt(16);for(i=0;i<s.length;i++)l.insert(nt(s[i]));for(var g=r*r,d=n*n;s.length;){var p=s.shift(),z=p.p,m=p.next.p,b=ot(z,m);if(!(b<d)){var F=b/g;c=lr(a,p.prev.p,z,m,p.next.next.p,F,l),c&&Math.min(ot(c,z),ot(c,m))<=F&&(s.push(p),s.push(Pt(c,p)),a.remove(c),l.remove(p),l.insert(nt(p)),l.insert(nt(p.next)))}}p=u;var X=[];do X.push(p.p),p=p.next;while(p!==u);return X.push(p.p),X}function lr(e,r,n,o,a,s,i){for(var u=new Ue([],fr),c=e.data;c;){for(var l=0;l<c.children.length;l++){var g=c.children[l],d=c.leaf?it(g,n,o):hr(n,o,g);d>s||u.push({node:g,dist:d})}for(;u.length&&!u.peek().node.children;){var p=u.pop(),z=p.node,m=it(z,r,n),b=it(z,o,a);if(p.dist<m&&p.dist<b&&Lt(n,z,i)&&Lt(o,z,i))return z}c=u.pop(),c&&(c=c.node)}return null}function fr(e,r){return e.dist-r.dist}function hr(e,r,n){if(_t(e,n)||_t(r,n))return 0;var o=Je(e[0],e[1],r[0],r[1],n.minX,n.minY,n.maxX,n.minY);if(o===0)return 0;var a=Je(e[0],e[1],r[0],r[1],n.minX,n.minY,n.minX,n.maxY);if(a===0)return 0;var s=Je(e[0],e[1],r[0],r[1],n.maxX,n.minY,n.maxX,n.maxY);if(s===0)return 0;var i=Je(e[0],e[1],r[0],r[1],n.minX,n.maxY,n.maxX,n.maxY);return i===0?0:Math.min(o,a,s,i)}function _t(e,r){return e[0]>=r.minX&&e[0]<=r.maxX&&e[1]>=r.minY&&e[1]<=r.maxY}function Lt(e,r,n){for(var o=Math.min(e[0],r[0]),a=Math.min(e[1],r[1]),s=Math.max(e[0],r[0]),i=Math.max(e[1],r[1]),u=n.search({minX:o,minY:a,maxX:s,maxY:i}),c=0;c<u.length;c++)if(yr(u[c].p,u[c].next.p,e,r))return!1;return!0}function De(e,r,n){return cr(e[0],e[1],r[0],r[1],n[0],n[1])}function yr(e,r,n,o){return e!==o&&r!==n&&De(e,r,n)>0!=De(e,r,o)>0&&De(n,o,e)>0!=De(n,o,r)>0}function nt(e){var r=e.p,n=e.next.p;return e.minX=Math.min(r[0],n[0]),e.minY=Math.min(r[1],n[1]),e.maxX=Math.max(r[0],n[0]),e.maxY=Math.max(r[1],n[1]),e}function dr(e){for(var r=e[0],n=e[0],o=e[0],a=e[0],s=0;s<e.length;s++){var i=e[s];i[0]<r[0]&&(r=i),i[0]>o[0]&&(o=i),i[1]<n[1]&&(n=i),i[1]>a[1]&&(a=i)}var u=[r,n,o,a],c=u.slice();for(s=0;s<e.length;s++)ur(e[s],u)||c.push(e[s]);return xr(c)}function Pt(e,r){var n={p:e,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ot(e,r){var n=e[0]-r[0],o=e[1]-r[1];return n*n+o*o}function it(e,r,n){var o=r[0],a=r[1],s=n[0]-o,i=n[1]-a;if(s!==0||i!==0){var u=((e[0]-o)*s+(e[1]-a)*i)/(s*s+i*i);u>1?(o=n[0],a=n[1]):u>0&&(o+=s*u,a+=i*u)}return s=e[0]-o,i=e[1]-a,s*s+i*i}function Je(e,r,n,o,a,s,i,u){var c=n-e,l=o-r,g=i-a,d=u-s,p=e-a,z=r-s,m=c*c+l*l,b=c*g+l*d,F=g*g+d*d,X=c*p+l*z,f=g*p+d*z,h=m*F-b*b,y,x,S,v,M=h,_=h;h===0?(x=0,M=1,v=f,_=F):(x=b*f-F*X,v=m*f-b*X,x<0?(x=0,v=f,_=F):x>M&&(x=M,v=f+b,_=F)),v<0?(v=0,-X<0?x=0:-X>m?x=M:(x=-X,M=m)):v>_&&(v=_,-X+b<0?x=0:-X+b>m?x=M:(x=-X+b,M=m)),y=x===0?0:x/M,S=v===0?0:v/_;var D=(1-y)*e+y*n,A=(1-y)*r+y*o,Y=(1-S)*a+S*i,R=(1-S)*s+S*u,q=Y-D,se=R-A;return q*q+se*se}function gr(e,r){return e[0]===r[0]?e[1]-r[1]:e[0]-r[0]}function xr(e){e.sort(gr);for(var r=[],n=0;n<e.length;n++){for(;r.length>=2&&De(r[r.length-2],r[r.length-1],e[n])<=0;)r.pop();r.push(e[n])}for(var o=[],a=e.length-1;a>=0;a--){for(;o.length>=2&&De(o[o.length-2],o[o.length-1],e[a])<=0;)o.pop();o.push(e[a])}return o.pop(),r.pop(),r.concat(o)}var pr=tt.exports;const mr=Kt(pr);function vr(e,r){r===void 0&&(r={}),r.concavity=r.concavity||1/0;var n=[];if(Re(e,function(a){n.push([a[0],a[1]])}),!n.length)return null;var o=mr(n,r.concavity);return o.length>3?Ie([o]):null}function st(e,r,n){n===void 0&&(n={});var o=be(e),a=be(r),s=ye(a[1]-o[1]),i=ye(a[0]-o[0]),u=ye(o[1]),c=ye(a[1]),l=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(i/2),2)*Math.cos(u)*Math.cos(c);return Jt(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}function te(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return bt(e);case"FeatureCollection":return wr(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return at(e);default:throw new Error("unknown GeoJSON type")}}function bt(e){var r={type:"Feature"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:r[n]=e[n]}}),r.properties=Dt(e.properties),r.geometry=at(e.geometry),r}function Dt(e){var r={};return e&&Object.keys(e).forEach(function(n){var o=e[n];typeof o=="object"?o===null?r[n]=null:Array.isArray(o)?r[n]=o.map(function(a){return a}):r[n]=Dt(o):r[n]=o}),r}function wr(e){var r={type:"FeatureCollection"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"features":return;default:r[n]=e[n]}}),r.features=e.features.map(function(n){return bt(n)}),r}function at(e){var r={type:e.type};return e.bbox&&(r.bbox=e.bbox),e.type==="GeometryCollection"?(r.geometries=e.geometries.map(function(n){return at(n)}),r):(r.coordinates=kt(e.coordinates),r)}function kt(e){var r=e;return typeof r[0]!="object"?r.slice():r.map(function(n){return kt(n)})}var Mr=function(){function e(r){this.points=r.points||[],this.duration=r.duration||1e4,this.sharpness=r.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=r.stepLength||60,this.length=this.points.length,this.delay=0;for(var n=0;n<this.length;n++)this.points[n].z=this.points[n].z||0;for(var n=0;n<this.length-1;n++){var o=this.points[n],a=this.points[n+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var n=0;n<this.centers.length-1;n++){var s=this.points[n+1].x-(this.centers[n].x+this.centers[n+1].x)/2,i=this.points[n+1].y-(this.centers[n].y+this.centers[n+1].y)/2,u=this.points[n+1].z-(this.centers[n].y+this.centers[n+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[n+1].x+this.sharpness*(this.centers[n].x+s),y:(1-this.sharpness)*this.points[n+1].y+this.sharpness*(this.centers[n].y+i),z:(1-this.sharpness)*this.points[n+1].z+this.sharpness*(this.centers[n].z+u)},{x:(1-this.sharpness)*this.points[n+1].x+this.sharpness*(this.centers[n+1].x+s),y:(1-this.sharpness)*this.points[n+1].y+this.sharpness*(this.centers[n+1].y+i),z:(1-this.sharpness)*this.points[n+1].z+this.sharpness*(this.centers[n+1].z+u)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return e.prototype.cacheSteps=function(r){var n=[],o=this.pos(0);n.push(0);for(var a=0;a<this.duration;a+=10){var s=this.pos(a),i=Math.sqrt((s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y)+(s.z-o.z)*(s.z-o.z));i>r&&(n.push(a),o=s)}return n},e.prototype.vector=function(r){var n=this.pos(r+10),o=this.pos(r-10);return{angle:180*Math.atan2(n.y-o.y,n.x-o.x)/3.14,speed:Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)+(o.z-n.z)*(o.z-n.z))}},e.prototype.pos=function(r){var n=r-this.delay;n<0&&(n=0),n>this.duration&&(n=this.duration-1);var o=n/this.duration;if(o>=1)return this.points[this.length-1];var a=Math.floor((this.points.length-1)*o),s=(this.length-1)*o-a;return zr(s,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},e}();function zr(e,r,n,o,a){var s=Sr(e),i={x:a.x*s[0]+o.x*s[1]+n.x*s[2]+r.x*s[3],y:a.y*s[0]+o.y*s[1]+n.y*s[2]+r.y*s[3],z:a.z*s[0]+o.z*s[1]+n.z*s[2]+r.z*s[3]};return i}function Sr(e){var r=e*e,n=r*e;return[n,3*r*(1-e),3*e*(1-e)*(1-e),(1-e)*(1-e)*(1-e)]}function ut(e,r){r===void 0&&(r={});for(var n=r.resolution||1e4,o=r.sharpness||.85,a=[],s=Qt(e).coordinates.map(function(l){return{x:l[0],y:l[1]}}),i=new Mr({duration:n,points:s,sharpness:o}),u=function(l){var g=i.pos(l);Math.floor(l/100)%2===0&&a.push([g.x,g.y])},c=0;c<i.duration;c+=10)u(c);return u(i.duration),Te(a,r.properties)}function _r(e,r){r===void 0&&(r={});var n=Number(e[0]),o=Number(e[1]),a=Number(e[2]),s=Number(e[3]);if(e.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var i=[n,o],u=[n,s],c=[a,s],l=[a,o];return Ie([[i,l,c,u,i]],r.properties,{bbox:e,id:r.id})}function Et(e,r,n,o){o===void 0&&(o={});var a=be(e),s=ye(a[0]),i=ye(a[1]),u=ye(n),c=jt(r,o.units),l=Math.asin(Math.sin(i)*Math.cos(c)+Math.cos(i)*Math.sin(c)*Math.cos(u)),g=s+Math.atan2(Math.sin(u)*Math.sin(c)*Math.cos(i),Math.cos(c)-Math.sin(i)*Math.sin(l)),d=We(g),p=We(l);return pe([d,p],o.properties)}function At(e,r,n){n===void 0&&(n={});for(var o=n.steps||64,a=n.properties?n.properties:!Array.isArray(e)&&e.type==="Feature"&&e.properties?e.properties:{},s=[],i=0;i<o;i++)s.push(Et(e,r,i*-360/o,n).geometry.coordinates);return s.push(s[0]),Ie([s],a)}function Xt(e,r,n){if(n===void 0&&(n={}),n.final===!0)return Lr(e,r);var o=be(e),a=be(r),s=ye(o[0]),i=ye(a[0]),u=ye(o[1]),c=ye(a[1]),l=Math.sin(i-s)*Math.cos(c),g=Math.cos(u)*Math.sin(c)-Math.sin(u)*Math.cos(c)*Math.cos(i-s);return We(Math.atan2(l,g))}function Lr(e,r){var n=Xt(r,e);return n=(n+180)%360,n}function Pr(e,r){var n=st(e,r),o=Xt(e,r),a=Et(e,n/2,o);return a}function Yt(e,r){r===void 0&&(r={});var n=0,o=0,a=0;return Re(e,function(s){n+=s[0],o+=s[1],a++},!0),pe([n/a,o/a],r.properties)}function ct(e,r){switch(r===void 0&&(r={}),Vt(e)){case"Point":return pe(be(e),r.properties);case"Polygon":var n=[];Re(e,function(y){n.push(y)});var o=Yt(e,{properties:r.properties}),a=o.geometry.coordinates,s=0,i=0,u=0,c,l,g,d,p,z,m,b,F=n.map(function(y){return[y[0]-a[0],y[1]-a[1]]});for(c=0;c<n.length-1;c++)l=F[c],d=l[0],z=l[1],g=F[c+1],p=g[0],m=g[1],b=d*m-p*z,u+=b,s+=(d+p)*b,i+=(z+m)*b;if(u===0)return o;var X=u*.5,f=1/(6*X);return pe([a[0]+f*s,a[1]+f*i],r.properties);default:var h=vr(e);return h?ct(h,{properties:r.properties}):Yt(e,{properties:r.properties})}}var Ct=6378137;function lt(e){return Ht(e,function(r,n){return r+br(n)},0)}function br(e){var r=0,n;switch(e.type){case"Polygon":return Ft(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)r+=Ft(e.coordinates[n]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function Ft(e){var r=0;if(e&&e.length>0){r+=Math.abs(Ot(e[0]));for(var n=1;n<e.length;n++)r-=Math.abs(Ot(e[n]))}return r}function Ot(e){var r,n,o,a,s,i,u,c=0,l=e.length;if(l>2){for(u=0;u<l;u++)u===l-2?(a=l-2,s=l-1,i=0):u===l-1?(a=l-1,s=0,i=1):(a=u,s=u+1,i=u+2),r=e[a],n=e[s],o=e[i],c+=(ft(o[0])-ft(r[0]))*Math.sin(ft(n[1]));c=c*Ct*Ct/2}return c}function ft(e){return e*Math.PI/180}const Dr=(e,r,n,o)=>{e.addLayer({id:r,type:"symbol",source:n,layout:{"icon-image":o["icon-image"]||"","text-allow-overlap":!0,"icon-allow-overlap":!0,"text-ignore-placement":!0,"icon-ignore-placement":!0,"text-field":o["text-field"]||"{name}","text-line-height":1.1,"text-size":o["text-size"]||17,"text-anchor":o["text-anchor"]||"left","text-offset":o["text-offset"]||[1,0],"icon-size":o["icon-size"]||.5,"text-font":["Noto Sans Regular"]},paint:{"text-color":o["text-color"]||"#006e1a","text-halo-width":o["text-halo-width"]||3,"text-halo-color":o["text-halo-color"]||"rgba(255,255,255,1)"}})},ze=(e,r,n,o)=>{e.addLayer({id:r,type:"circle",source:n,paint:{"circle-color":(o==null?void 0:o["circle-color"])||"#ff0","circle-radius":(o==null?void 0:o["circle-radius"])||5,"circle-stroke-color":(o==null?void 0:o["circle-stroke-color"])||"#000","circle-stroke-width":(o==null?void 0:o["circle-stroke-width"])||2}})},me=(e,r,n,o)=>{e.addLayer({id:r,type:"line",source:n,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":(o==null?void 0:o["line-color"])||"#ff0","line-width":(o==null?void 0:o["line-width"])||4}})},Be=(e,r,n,o)=>{e.addLayer({id:r,type:"symbol",source:n,layout:{"text-font":["Noto Sans Regular"],"text-field":["get","result"],"text-allow-overlap":!0,"text-anchor":"bottom","text-overlap":"always","text-offset":[0,-.5],visibility:o!=null&&o.visibility?"visible":"none"}})},Se=(e,r,n,o)=>{e.addLayer({id:r,type:"fill",source:n,paint:{"fill-antialias":!1,"fill-color":(o==null?void 0:o["fill-color"])||"#ff0","fill-opacity":.8}})},kr=e=>{let r=!1,n=e,o=[],a=n.length-1;for(let i=0;i<a;i++){let u=n[i],c=n[i+1];(u.x!=c.x||u.y!=c.y)&&o.push(u)}let s=o.length-1;for(let i=0;i<s;i++){let u=o[i],c=o[i+1];for(let l=i+2;l<s;l++){let g=o[l],d=o[l+1],p=Er(u,c,g,d);if(p==null&&c.x==d.x&&c.y==d.y&&(p={x:c.x,y:c.y}),p!=null){r=!0;break}}if(r)break}return r};function Er(e,r,n,o){var a=null,s=(e.x-n.x)*(r.y-n.y)-(e.y-n.y)*(r.x-n.x),i=(e.x-o.x)*(r.y-o.y)-(e.y-o.y)*(r.x-o.x);if(s*i>=0)return a;var u=(n.x-e.x)*(o.y-e.y)-(n.y-e.y)*(o.x-e.x),c=u+s-i;if(u*c>=0)return a;var l=u/(i-s),g=l*(r.x-e.x),d=l*(r.y-e.y);return a={x:e.x+g,y:e.y+d},a}function Ar(e,r,n,o,a){let s="free",i="",u=[],c=[],l={},g=!1,d=!0,p=!1,z=!0,m=[],b=!0,F=5e4,X=!1,f={type:"FeatureCollection",features:[]},h={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}},y={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[]}};const x=(P,I)=>{let N=0;return function(...T){const ue=new Date().getTime();ue-N<I||(N=ue,P(...T))}},S=P=>{switch(e.off("click",C),e.off("mousemove",re),e.off("contextmenu",J),Q(),ee(),g&&(d=!0,E(!1)),g=!0,s=P.type||"point",b=P.multipleLine||!1,p=P.smooth||!1,F=P.brushSize*1e3||3e4,l=P,z=P.showLayer,h.properties=P,y.properties=P,s){case"point":break;case"brush":Y();break}e.on("click",C),e.getCanvas().style.cursor=s=="brush"?"move":"crosshair"},v=P=>{s=P,h.properties.type=s,y.properties.type=s},M=P=>{if(n)if(u.length){const T=[u[u.length-1]];n(T)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:f}),ze(e,i,i,l),f.features.push({type:"Feature",properties:l,geometry:{type:"Point",coordinates:P.lngLat.toArray()}}),e.getSource(i).setData(te(f)),r&&r(j())},_=P=>{if(d){if(n)if(u.length){const N=u[u.length-1],T=[N,N+"point"];n(T)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:h}),me(e,i,i),ze(e,i+"point",i,l),d=!1,e.on("mousemove",re),e.on("contextmenu",J),e.dragRotate.enable()}h.geometry.coordinates.push(P.lngLat.toArray());const I=e.getSource(i);I.setData(h),!b&&h.geometry.coordinates.length==3&&(e.off("mousemove",re),e.off("contextmenu",J),d=!0,E(!1),h.geometry.coordinates.pop(),I.setData(te(h)),r&&r(j()))},D=P=>{if(d){if(n)if(u.length){const T=u[u.length-1],ue=[T,T+"outline",T+"point"];n(ue)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:y}),e.addSource(i+"point",{type:"geojson",data:f}),Se(e,i,i,l),me(e,i+"outline",i,{"line-color":"black","line-width":2,...l}),ze(e,i+"point",i+"point",l),d=!1,e.on("mousemove",re),e.on("contextmenu",J),e.dragRotate.enable()}y.geometry.coordinates[0].length>=3&&y.geometry.coordinates[0].pop(),y.geometry.coordinates[0].push(P.lngLat.toArray()),y.geometry.coordinates[0].push(y.geometry.coordinates[0][0]),f.features.push(te({type:"Feature",geometry:{type:"Point",coordinates:P.lngLat.toArray()}})),e.getSource(i+"point").setData(f);const N=e.getSource(i);y.geometry.coordinates[0].length<=3&&!p&&N.setData(y),E(!0)},A=P=>{if(d){if(n)if(u.length){const N=u[u.length-1],T=[N,N+"outline"];n(T)}else n([]);O(),ee(),e.addSource(i,{type:"geojson",data:y}),Se(e,i,i,l),me(e,i+"outline",i,{"line-color":"black","line-width":2,...l}),d=!1,y.geometry.coordinates[0].push(P.lngLat.toArray()),e.getSource(i).setData(y),e.on("mousemove",re),e.on("contextmenu",J),E(!0),e.dragRotate.enable()}},Y=()=>{e.on("mousedown",U),e.on("mouseup",V),e.on("mousemove",B),e.on("mouseover",ne),e.on("mouseout",ie)},R=()=>{O(),ee(),e.addSource(i,{type:"geojson",data:y}),Se(e,i,i,l),me(e,i+"outline",i,{"line-color":"black","line-width":2,...l})},q=(P,I)=>{const N=pe([P.lng,P.lat]),T=I/2/111320,ue=et(At(N,T,{units:"degrees"}));return _r(ue)},se=(P,I)=>{const N=q(P,I);y.geometry=N.geometry,e.getSource(i).setData(y)},H=()=>{const P=i,N=e.getSource(P).serialize().data;r&&r(N)},K=P=>{F=P*1e3},W=P=>{y.properties.MGValue=P},Q=()=>{e.off("mousedown",U),e.off("mouseup",V),e.off("mousemove",B),e.off("mouseover",ne),e.off("mouseout",ie)},k=P=>{let I=te(P);const N=Te(I.geometry.coordinates[0]),T=ut(N,{sharpness:.6});return I.geometry.coordinates[0]=T.geometry.coordinates,I},O=()=>{i=w(),u.push(i),c.push(i)},w=()=>{let P=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(N){const T=(P+Math.random()*16)%16|0;return P=Math.floor(P/16),(N==="x"?T:T&3|8).toString(16)})},E=P=>{["scrollZoom","boxZoom","dragPan","keyboard","doubleClickZoom","touchZoomRotate"].forEach(N=>{P?e[N].disable():e[N].enable()})},C=P=>{switch(s){case"point":M(P);break;case"line":_(P);break;case"polygon":D(P);break;case"free":A(P);break}},G=P=>{switch(s){case"line":h.geometry.coordinates.length&&(h.geometry.coordinates.length==1&&h.geometry.coordinates.push(P.lngLat.toArray()),h.geometry.coordinates[h.geometry.coordinates.length-1]=P.lngLat.toArray(),e.getSource(i).setData(h));break;case"polygon":const I=y.geometry.coordinates[0].length;if(I){I==2?y.geometry.coordinates[0][I-1]=P.lngLat.toArray():y.geometry.coordinates[0][I-2]=P.lngLat.toArray();const T=e.getSource(i);T.setData(y),p&&y.geometry.coordinates[0].length>=3&&T.setData(k(y))}break;case"free":y.geometry.coordinates[0].length&&(m.push(P.point),y.geometry.coordinates[0].length!=1&&y.geometry.coordinates[0].pop(),y.geometry.coordinates[0].push(P.lngLat.toArray()),y.geometry.coordinates[0].push(y.geometry.coordinates[0][0]),e.getSource(i).setData(y));break}},B=P=>{se(P.lngLat,F),X&&$()},$=x(H,0),J=P=>{P.preventDefault(),e.off("mousemove",re),e.off("contextmenu",J),d=!0,m.push(P.point),E(!1),e.dragRotate.disable();const I=e.getSource(i);switch(s){case"line":h.geometry.coordinates.length&&I.setData(te(h));break;case"polygon":if(y.geometry.coordinates[0].length){const N=y.geometry.coordinates[0].length;y.geometry.coordinates[0].splice(N-2,1),I.setData(te(y))}z||(e.setLayoutProperty(i,"visibility","none"),e.setLayoutProperty(i+"outline","visibility","none")),e.setLayoutProperty(i+"point","visibility","none"),p&&I.setData(te(k(y)));break;case"free":if(y.geometry.coordinates[0].length){const N=y.geometry.coordinates[0].length;if(y.geometry.coordinates[0].splice(N-2,1),I.setData(te(y)),kr(m)){alert("落区自相交,请重画"),u.pop(),c.pop(),e.removeLayer(i),e.removeLayer(i+"outline");return}if(z||(e.setLayoutProperty(i,"visibility","none"),e.setLayoutProperty(i+"outline","visibility","none")),p){const T=[...m.slice(m.length/5),...m.slice(0,m.length/5),m.slice(m.length/5)[0]],ue=T.length>10?5:3,ce=Math.ceil(T.length/ue),He=[];for(let he=0;he<T.length;he+=ce)He.push(T.slice(he,he+ce));let Le=[];He.forEach(he=>{if(he.length>1){const Yr=new Z(he).getLUT();Le.push(...Yr)}else Le.push(...he)}),y.geometry.coordinates[0].length=0;for(let he=0;he<Le.length;he++){const Rt=e.unproject(Le[he]);y.geometry.coordinates[0].push(Rt.toArray())}I.setData(te(y))}}break}r&&r(j())},U=()=>{e.dragPan.disable(),e.dragRotate.disable(),X=!0,H()},V=()=>{e.dragPan.enable(),e.dragRotate.enable(),X=!1},ne=()=>{R()},ie=()=>{e.getLayer(i)&&e.removeLayer(i),e.getLayer(i+"outline")&&e.removeLayer(i+"outline"),e.getSource(i)&&e.removeSource(i)},j=()=>{const P=u,I=[];return P.forEach((N,T)=>{if(e.getSource(N)){const ce=e.getSource(N).serialize().data;ce.features?(ce.features[0].properties.layerId=N,ce.features[0].properties.sourceId=c[T],I.push(...ce.features)):(ce.properties.layerId=N,ce.properties.sourceId=c[T],I.push(ce))}}),I},oe=()=>{u.forEach(P=>{e.getLayer(P)&&e.removeLayer(P),e.getLayer(P+"outline")&&e.removeLayer(P+"outline"),e.getLayer(P+"point")&&e.removeLayer(P+"point"),e.getLayer(P+"text")&&e.removeLayer(P+"text")}),c.forEach(P=>{e.getSource(P)&&e.removeSource(P),e.getSource(P+"point")&&e.removeSource(P+"point"),e.getSource(P+"text")&&e.removeSource(P+"text")}),u.length=0,c.length=0},ee=()=>{m.length=0,f.features.length=0,h.geometry.coordinates.length=0,y.geometry.coordinates.length=0,y.geometry.coordinates[0]=[],y.properties.result=""},re=x(G,30),ae=()=>{Q(),e.off("click",C),e.off("mousemove",re),e.off("contextmenu",J),e.getCanvas().style.cursor="pointer",E(!1)},de=()=>{(s=="free"||s=="polygon"||s=="point"||s=="line")&&u.length&&(e.removeLayer(u[u.length-1]),e.getLayer(u[u.length-1]+"outline")&&e.removeLayer(u[u.length-1]+"outline"),e.getLayer(u[u.length-1]+"point")&&e.removeLayer(u[u.length-1]+"point"),u.pop())},_e=()=>{if((s=="free"||s=="polygon")&&c.length){const P=u.length-c.length,I=c.slice(P);if(P!==0&&I.length){const ue=e.getSource(I[0]).serialize().data.valueOf();e.getLayer(I[0])||(u.push(I[0]),Se(e,I[0],I[0],{"fill-color":ue.properties["fill-color"]}),me(e,I[0]+"outline",I[0],{"line-color":"black","line-width":2,...ue.properties}))}}};let je=!1;const ht=P=>{je=P};let ke,qe=!1,Ee="";e.on("mousedown",P=>{const I=e.queryRenderedFeatures(P.point);I.length>0&&(Ee=I[0].layer.source,je&&Ze(P))});const Ze=P=>{e.dragPan.disable(),ke=P.lngLat,qe=!0,e.on("mouseup",Ae),e.on("mousemove",It),a&&a()},Ae=()=>{if(qe=!1,e.off("mouseup",Ae),e.off("mousemove",It),e.dragPan.enable(),o){const I=e.getSource(Ee).serialize().data;o(I)}},It=P=>{if(!qe)return;const I=P.lngLat,N=I.lng-ke.lng,T=I.lat-ke.lat;ke=I;const ue=e.getSource(Ee),ce=ue.serialize().data;ce.geometry.coordinates=ce.geometry.coordinates.map(He=>He.map(Le=>[Le[0]+N,Le[1]+T])),ue.setData(ce)};return{startDraw:S,revoke:de,redo:_e,getFeaturesFromDraw:j,clearDraw:oe,stopDraw:ae,setBrushSize:K,setValue:W,setDrawMethod:v,setDragMode:ht}}function Xr(e,r){let n="free",o="",a=[],s=[],i={},u=!1,c=!0,l=!0,g=!1,d=[],p={type:"FeatureCollection",features:[]},z={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}},m={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[]}},b={type:"Feature",properties:{result:""},geometry:{type:"Point",coordinates:[]}};const F=w=>{e.off("click",D),e.off("mousemove",O),e.off("contextmenu",Y),Q(),u&&(c=!0,_(!1)),u=!0,n=w.type||"point",l=w.measure||!1,g=w.smooth||!1,i=w,z.properties=w,m.properties=w,b.properties=w,e.on("click",D),e.getCanvas().style.cursor="crosshair"},X=w=>{v(),Q(),e.addSource(o,{type:"geojson",data:p}),ze(e,o,o,i),Be(e,o+"text",o,{visibility:l}),p.features.push({type:"Feature",properties:i,geometry:{type:"Point",coordinates:w.lngLat.toArray()}}),e.getSource(o).setData(te(p)),r&&r(R())},f=w=>{v(),Q(),e.addSource(o,{type:"geojson",data:p}),Dr(e,o,o,i),p.features.push({type:"Feature",properties:i,geometry:{type:"Point",coordinates:w.lngLat.toArray()}}),e.getSource(o).setData(te(p)),r&&r(R())},h=w=>{c&&(v(),Q(),e.addSource(o,{type:"geojson",data:z}),e.addSource(o+"text",{type:"geojson",data:p}),me(e,o,o),ze(e,o+"point",o,i),Be(e,o+"text",o+"text",{visibility:l}),c=!1,e.on("mousemove",O),e.on("contextmenu",Y)),z.geometry.coordinates.push(w.lngLat.toArray()),e.getSource(o).setData(z),p.features.push({type:"Feature",properties:{},geometry:{type:"Point",coordinates:w.lngLat.toArray()}}),e.getSource(o+"text").setData(p)},y=w=>{c&&(v(),Q(),e.addSource(o,{type:"geojson",data:m}),e.addSource(o+"area",{type:"geojson",data:b}),Se(e,o,o),me(e,o+"outline",o,{"line-color":"black","line-width":2,...i}),ze(e,o+"point",o),Be(e,o+"area",o+"area",{visibility:l}),c=!1,e.on("mousemove",O),e.on("contextmenu",Y)),m.geometry.coordinates[0].length>=3&&m.geometry.coordinates[0].pop(),m.geometry.coordinates[0].push(w.lngLat.toArray()),m.geometry.coordinates[0].push(m.geometry.coordinates[0][0]),d.push(w.point),e.getSource(o).setData(m),_(!0)},x=w=>{c&&(v(),Q(),e.addSource(o,{type:"geojson",data:m}),e.addSource(o+"area",{type:"geojson",data:b}),Se(e,o,o,i),me(e,o+"outline",o,{"line-color":"black","line-width":2,...i}),Be(e,o+"area",o+"area",{visibility:l}),c=!1,m.geometry.coordinates[0].push(w.lngLat.toArray()),e.getSource(o).setData(m),e.on("mousemove",O),e.on("contextmenu",Y),_(!0))},S=w=>{if(c){v(),Q(),e.addSource(o,{type:"geojson",data:m}),e.addSource(o+"area",{type:"geojson",data:b}),e.addSource(o+"point",{type:"geojson",data:p}),Se(e,o,o,i),me(e,o+"outline",o,{"line-color":"black","line-width":2,...i}),ze(e,o+"point",o+"point"),Be(e,o+"area",o+"area",{visibility:l}),c=!1;const E={type:"Feature",properties:{},geometry:{type:"Point",coordinates:w.lngLat.toArray()}};p.features.push(te(E)),p.features.push(te(E)),b.geometry.coordinates=w.lngLat.toArray(),e.getSource(o+"point").setData(p),e.on("mousemove",O),e.on("contextmenu",Y),_(!0)}},v=()=>{o=M(),a.push(o),s.push(o)},M=()=>{let w=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(C){const G=(w+Math.random()*16)%16|0;return w=Math.floor(w/16),(C==="x"?G:G&3|8).toString(16)})},_=w=>{["scrollZoom","boxZoom","dragPan","keyboard","doubleClickZoom","touchZoomRotate"].forEach(C=>{w?e[C].disable():e[C].enable()})},D=w=>{switch(n){case"symbol":f(w);break;case"point":X(w);break;case"line":h(w);break;case"polygon":y(w);break;case"free":x(w);break;case"circle":S(w);break}},A=w=>{switch(n){case"line":if(z.geometry.coordinates.length){z.geometry.coordinates.length==1&&z.geometry.coordinates.push(w.lngLat.toArray()),z.geometry.coordinates[z.geometry.coordinates.length-1]=w.lngLat.toArray(),e.getSource(o).setData(z);const j=z.geometry.coordinates[z.geometry.coordinates.length-2],oe=z.geometry.coordinates[z.geometry.coordinates.length-1],ee=st(j,oe,{units:"kilometers"}),re=Pr(pe(j),pe(oe)),ae=p.features[p.features.length-1];ae.properties.result=Ge(ee,4)+"km",ae.geometry.coordinates=re.geometry.coordinates,e.getSource(o+"text").setData(te(p))}break;case"polygon":const V=m.geometry.coordinates[0].length;if(V){V==2?m.geometry.coordinates[0][V-1]=w.lngLat.toArray():m.geometry.coordinates[0][V-2]=w.lngLat.toArray();const ie=lt(m)/1e6;if(V>=4){var E=Ie(m.geometry.coordinates),C=ct(E);b.geometry.coordinates=C.geometry.coordinates,b.properties.result=Ge(ie,2)+"km²"}const j=e.getSource(o);j.setData(m),e.getSource(o+"area").setData(b),g&&m.geometry.coordinates[0].length>=3&&j.setData(q(m))}break;case"free":const ne=m.geometry.coordinates[0].length;if(ne){d.push(w.point),m.geometry.coordinates[0].length!=1&&m.geometry.coordinates[0].pop(),m.geometry.coordinates[0].push(w.lngLat.toArray()),m.geometry.coordinates[0].push(m.geometry.coordinates[0][0]);const ie=lt(m)/1e6;if(ne>=4){var E=Ie(m.geometry.coordinates),C=ct(E);b.geometry.coordinates=C.geometry.coordinates,b.properties.result=Ge(ie,2)+"km²"}e.getSource(o).setData(m),e.getSource(o+"area").setData(b)}break;case"circle":if(p.features.length){p.features[1].geometry.coordinates=w.lngLat.toArray();var G=pe(p.features[0].geometry.coordinates),B=pe(p.features[1].geometry.coordinates),$=st(G,B,{units:"miles"}),J={steps:500,units:"miles",properties:{foo:"bar"}},U=At(G,$,J);m.geometry.coordinates=U.geometry.coordinates;const ie=lt(m)/1e6;b.properties.result=Ge(ie,2)+"km²";const j=e.getSource(o+"point"),oe=e.getSource(o),ee=e.getSource(o+"area");j.setData(p),oe.setData(m),ee.setData(b)}break}},Y=w=>{w.preventDefault(),e.off("mousemove",O),e.off("contextmenu",Y),c=!0,d.push(w.point),_(!1);const E=e.getSource(o);switch(n){case"line":z.geometry.coordinates.length&&(console.log(z),E.setData(te(z)),e.removeLayer(o+"point"),g&&z.geometry.coordinates.length>=2&&E.setData(se(z)));break;case"polygon":m.geometry.coordinates[0].length&&E.setData(te(m)),e.setLayoutProperty(o+"point","visibility","none"),g&&E.setData(te(q(m)));break;case"free":if(m.geometry.coordinates[0].length&&(E.setData(te(m)),g)){const C=[...d.slice(d.length/5),...d.slice(0,d.length/5),d.slice(d.length/5)[0]],G=C.length>10?5:3,B=Math.ceil(C.length/G),$=[];for(let U=0;U<C.length;U+=B)$.push(C.slice(U,U+B));let J=[];$.forEach(U=>{if(U.length>1){const ne=new Z(U).getLUT();J.push(...ne)}else J.push(...U)}),m.geometry.coordinates[0].length=0;for(let U=0;U<J.length;U++){const V=e.unproject(J[U]);m.geometry.coordinates[0].push(V.toArray())}E.setData(te(m))}break;case"circle":e.removeLayer(o+"point"),e.removeSource(o+"point");break}r&&r(R())},R=()=>{const w=a,E=[];return w.forEach((C,G)=>{const $=e.getSource(C).serialize().data;$.features?($.features[0].properties.layerId=C,$.features[0].properties.sourceId=s[G],E.push(...$.features)):($.properties.layerId=C,$.properties.sourceId=s[G],E.push($))}),E},q=w=>{let E=te(w);const C=Te(E.geometry.coordinates[0]),G=ut(C,{sharpness:.6});return E.geometry.coordinates[0]=G.geometry.coordinates,E},se=w=>{let E=te(w);console.log(E,"lineFeature");const C=Te(E.geometry.coordinates),G=ut(C,{sharpness:.6});return E.geometry.coordinates=G.geometry.coordinates,E},H=w=>{e.getLayer(w)&&e.removeLayer(w),e.getLayer(w+"outline")&&e.removeLayer(w+"outline"),e.getLayer(w+"point")&&e.removeLayer(w+"point"),e.getLayer(w+"area")&&e.removeLayer(w+"area"),e.getLayer(w+"text")&&e.removeLayer(w+"text"),a=a.filter(E=>E!==w)},K=()=>{a.forEach(w=>{e.removeLayer(w),e.getLayer(w+"outline")&&e.removeLayer(w+"outline"),e.getLayer(w+"point")&&e.removeLayer(w+"point"),e.getLayer(w+"area")&&e.removeLayer(w+"area"),e.getLayer(w+"text")&&e.removeLayer(w+"text")}),s.forEach(w=>{e.removeSource(w),e.getSource(w+"point")&&e.removeSource(w+"point"),e.getSource(w+"text")&&e.removeSource(w+"text"),e.getSource(w+"area")&&e.removeSource(w+"area")}),a.length=0,s.length=0},W=()=>{e.off("click",D),e.off("mousemove",O),e.off("contextmenu",Y),e.getCanvas().style.cursor="pointer",_(!1)},Q=()=>{d.length=0,p.features.length=0,z.geometry.coordinates.length=0,m.geometry.coordinates.length=0,m.geometry.coordinates[0]=[],m.properties.result="",b.geometry.coordinates.length=0},O=((w,E)=>{let C=0;return function(...G){const B=new Date().getTime();B-C<E||(C=B,w(...G))}})(A,30);return{startMeasure:F,clearMeasure:K,stopMeasure:W,getFeaturesFromMeasure:R,clearLayerById:H}}Me.draw=Ar,Me.measure=Xr,Object.defineProperty(Me,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gs-maplibre-draw",
3
3
  "private": false,
4
- "version": "0.0.69",
4
+ "version": "0.0.71",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",