@watergis/maplibre-gl-terradraw 1.3.9 → 1.3.11

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.
@@ -15,7 +15,7 @@ var M;
15
15
  (function(s) {
16
16
  s.Commit = "commit", s.Provisional = "provisional", s.Finish = "finish";
17
17
  })(M || (M = {}));
18
- const T = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT: "selectionPoint" }, V = "edited", st = "closingPoint", Lt = "snappingPoint", kt = "coordinatePoint", rt = "coordinatePointIds";
18
+ const T = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT: "selectionPoint" }, V = "edited", rt = "closingPoint", _t = "snappingPoint", kt = "coordinatePoint", nt = "coordinatePointIds";
19
19
  function wt(s) {
20
20
  return !!(s && typeof s == "object" && s !== null && !Array.isArray(s));
21
21
  }
@@ -181,16 +181,16 @@ function Bt(s) {
181
181
  }
182
182
  function o(r, n, a, l) {
183
183
  const d = t[r][n], h = t[r][n + 1], c = t[a][l], u = t[a][l + 1], p = function(m, v, f, C) {
184
- if (ct(m, f) || ct(m, C) || ct(v, f) || ct(C, f)) return null;
185
- const P = m[0], S = m[1], b = v[0], w = v[1], D = f[0], G = f[1], _ = C[0], j = C[1], z = (P - b) * (G - j) - (S - w) * (D - _);
186
- return z === 0 ? null : [((P * w - S * b) * (D - _) - (P - b) * (D * j - G * _)) / z, ((P * w - S * b) * (G - j) - (S - w) * (D * j - G * _)) / z];
184
+ if (ut(m, f) || ut(m, C) || ut(v, f) || ut(C, f)) return null;
185
+ const P = m[0], S = m[1], b = v[0], w = v[1], D = f[0], G = f[1], L = C[0], j = C[1], z = (P - b) * (G - j) - (S - w) * (D - L);
186
+ return z === 0 ? null : [((P * w - S * b) * (D - L) - (P - b) * (D * j - G * L)) / z, ((P * w - S * b) * (G - j) - (S - w) * (D * j - G * L)) / z];
187
187
  }(d, h, c, u);
188
188
  if (p === null) return;
189
189
  let g, y;
190
190
  g = h[0] !== d[0] ? (p[0] - d[0]) / (h[0] - d[0]) : (p[1] - d[1]) / (h[1] - d[1]), y = u[0] !== c[0] ? (p[0] - c[0]) / (u[0] - c[0]) : (p[1] - c[1]) / (u[1] - c[1]), i(g) || i(y) || (p.toString(), e.push(p));
191
191
  }
192
192
  }
193
- function ct(s, t) {
193
+ function ut(s, t) {
194
194
  return s[0] === t[0] && s[1] === t[1];
195
195
  }
196
196
  function It(s, t) {
@@ -217,7 +217,7 @@ function bt(s, t) {
217
217
  return (e = s.geometry.coordinates[0][0])[0] !== (i = s.geometry.coordinates[0][s.geometry.coordinates[0].length - 1])[0] || e[1] !== i[1] ? { valid: !1, reason: Qe } : { valid: !0 };
218
218
  var e, i;
219
219
  }
220
- function dt(s, t) {
220
+ function ht(s, t) {
221
221
  const e = bt(s, t);
222
222
  return e.valid ? Bt(s) ? { valid: !1, reason: "Feature intersects itself" } : { valid: !0 } : e;
223
223
  }
@@ -278,7 +278,7 @@ class Ce extends N {
278
278
  return t.type === "Feature" && t.geometry.type === "Polygon" && t.properties.mode === this.mode && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = 10), e;
279
279
  }
280
280
  validateFeature(t) {
281
- return this.validateModeFeature(t, (e) => dt(e, this.coordinatePrecision));
281
+ return this.validateModeFeature(t, (e) => ht(e, this.coordinatePrecision));
282
282
  }
283
283
  updateCircle(t) {
284
284
  if (this.clickCount === 1 && this.center && this.currentCircleId) {
@@ -312,7 +312,7 @@ const E = (s, t) => {
312
312
  const { x: e, y: i } = s, { x: o, y: r } = t, n = o - e, a = r - i;
313
313
  return Math.sqrt(a * a + n * n);
314
314
  };
315
- function ht(s) {
315
+ function ct(s) {
316
316
  if (!function(e) {
317
317
  const i = e.coordinates[0];
318
318
  let o = 0;
@@ -334,7 +334,7 @@ class Pe extends N {
334
334
  close() {
335
335
  if (this.currentId === void 0) return;
336
336
  if (this.currentId) {
337
- const e = ht(this.store.getGeometryCopy(this.currentId));
337
+ const e = ct(this.store.getGeometryCopy(this.currentId));
338
338
  e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]);
339
339
  }
340
340
  const t = this.currentId;
@@ -366,7 +366,7 @@ class Pe extends N {
366
366
  onClick(t) {
367
367
  if (!this.preventNewFeature) {
368
368
  if (this.startingClick === !1) {
369
- const [e, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [st]: !0 } }]);
369
+ const [e, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [rt]: !0 } }]);
370
370
  return this.currentId = e, this.closingPointId = i, this.startingClick = !0, void this.setDrawing();
371
371
  }
372
372
  this.close();
@@ -408,7 +408,7 @@ function Se({ unproject: s, point: t, pointerDistance: e }) {
408
408
  const i = e / 2, { x: o, y: r } = t;
409
409
  return { type: "Feature", properties: {}, geometry: { type: "Polygon", coordinates: [[s(o - i, r - i), s(o + i, r - i), s(o + i, r + i), s(o - i, r + i), s(o - i, r - i)].map((n) => [n.lng, n.lat])] } };
410
410
  }
411
- class nt extends k {
411
+ class at extends k {
412
412
  constructor(t) {
413
413
  super(t);
414
414
  }
@@ -417,7 +417,7 @@ class nt extends k {
417
417
  return Se({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
418
418
  }
419
419
  }
420
- class at extends k {
420
+ class lt extends k {
421
421
  constructor(t) {
422
422
  super(t);
423
423
  }
@@ -450,7 +450,7 @@ function Jt(s, t, e) {
450
450
  const i = O(s[0]), o = O(s[1]), r = O(e), n = ve(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
451
451
  return [R(i + Math.atan2(Math.sin(r) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), R(a)];
452
452
  }
453
- function lt({ x: s, y: t }, e, i) {
453
+ function dt({ x: s, y: t }, e, i) {
454
454
  const o = O(i);
455
455
  return { x: s + e * Math.cos(o), y: t + e * Math.sin(o) };
456
456
  }
@@ -481,7 +481,7 @@ function si(s, t, e) {
481
481
  const d = s[s.length - 1];
482
482
  return [d, d];
483
483
  }
484
- function ut(s) {
484
+ function pt(s) {
485
485
  return s * (Math.PI / 180);
486
486
  }
487
487
  function Zt(s) {
@@ -509,7 +509,7 @@ class ri extends k {
509
509
  }
510
510
  generateInsertionGeodesicCoordinates(t, e, i) {
511
511
  const o = U(t, e), r = function(n, a, l) {
512
- const d = [], h = ut(n[1]), c = ut(n[0]), u = ut(a[1]), p = ut(a[0]);
512
+ const d = [], h = pt(n[1]), c = pt(n[0]), u = pt(a[1]), p = pt(a[0]);
513
513
  l += 1;
514
514
  const g = 2 * Math.asin(Math.sqrt(Math.sin((u - h) / 2) ** 2 + Math.cos(h) * Math.cos(u) * Math.sin((p - c) / 2) ** 2));
515
515
  if (g === 0 || isNaN(g)) return d;
@@ -562,8 +562,8 @@ function ni(s, t, e) {
562
562
  const [Gt, At, Tt] = j, [Ut, Vt, Rt] = z;
563
563
  return [At * Rt - Tt * Vt, Tt * Ut - Gt * Rt, Gt * Vt - At * Ut];
564
564
  }(i, o), u = h * l - c * a, p = c * n - d * l, g = d * a - h * n, y = g * h - p * c, m = u * c - g * d, v = p * d - u * h, f = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(m, 2) + Math.pow(v, 2)), C = [y * f, m * f, v * f], P = [-1 * y * f, -1 * m * f, -1 * v * f], S = X(i, o), b = X(i, C), w = X(o, C), D = X(i, P), G = X(o, P);
565
- let _;
566
- return _ = b < D && b < G || w < D && w < G ? C : P, X(i, _) > S || X(o, _) > S ? U(K(_), K(i)) <= U(K(_), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(_), !1, !1];
565
+ let L;
566
+ return L = b < D && b < G || w < D && w < G ? C : P, X(i, L) > S || X(o, L) > S ? U(K(L), K(i)) <= U(K(L), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(L), !1, !1];
567
567
  }
568
568
  function ai(s, t, e) {
569
569
  const i = t.x - s.x, o = t.y - s.y, r = Math.max(0, Math.min(1, ((e.x - s.x) * i + (e.y - s.y) * o) / (i * i + o * o)));
@@ -595,7 +595,7 @@ class Ie extends k {
595
595
  if (f[0] === u[0] && f[1] === u[1]) P = f;
596
596
  else if (C[0] === u[0] && C[1] === u[1]) P = C;
597
597
  else {
598
- const { x: G, y: _ } = ai(b, w, D), { lng: j, lat: z } = W(G, _);
598
+ const { x: G, y: L } = ai(b, w, D), { lng: j, lat: z } = W(G, L);
599
599
  P = [j, z];
600
600
  }
601
601
  P && (S = E(D, x(P[0], P[1])), S < y && (g = P, y = S, m = p.indexOf(v)));
@@ -664,7 +664,7 @@ class be extends N {
664
664
  this.updateGeometries(l, i[i.length - 1], M.Commit), this.currentCoordinate++;
665
665
  }
666
666
  registerBehaviors(t) {
667
- this.coordinateSnapping = new vt(t, new at(t), new nt(t)), this.insertPoint = new ri(t), this.clickBoundingBox = new nt(t), this.pixelDistance = new at(t), this.lineSnapping = new Ie(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new vt(t, this.pixelDistance, this.clickBoundingBox);
667
+ this.coordinateSnapping = new vt(t, new lt(t), new at(t)), this.insertPoint = new ri(t), this.clickBoundingBox = new at(t), this.pixelDistance = new lt(t), this.lineSnapping = new Ie(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new vt(t, this.pixelDistance, this.clickBoundingBox);
668
668
  }
669
669
  start() {
670
670
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -678,7 +678,7 @@ class be extends N {
678
678
  if (e) {
679
679
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
680
680
  else {
681
- const [n] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [Lt]: !0 } }]);
681
+ const [n] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [_t]: !0 } }]);
682
682
  this.snappedPointId = n;
683
683
  }
684
684
  t.lng = e[0], t.lat = e[1];
@@ -763,7 +763,7 @@ class be extends N {
763
763
  const e = I({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
764
764
  if (t.type === "Feature" && t.geometry.type === "LineString" && t.properties.mode === this.mode) return e.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, e.lineStringWidth, t), e.zIndex = 10, e;
765
765
  if (t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode) {
766
- const i = t.properties[st];
766
+ const i = t.properties[rt];
767
767
  return e.pointColor = this.getHexColorStylingValue(i ? this.styles.closingPointColor : this.styles.snappingPointColor, e.pointColor, t), e.pointWidth = this.getNumericStylingValue(i ? this.styles.closingPointWidth : this.styles.snappingPointWidth, e.pointWidth, t), e.pointOutlineColor = this.getHexColorStylingValue(i ? this.styles.closingPointOutlineColor : this.styles.snappingPointOutlineColor, "#ffffff", t), e.pointOutlineWidth = this.getNumericStylingValue(i ? this.styles.closingPointOutlineWidth : this.styles.snappingPointOutlineWidth, 2, t), e.zIndex = 40, e;
768
768
  }
769
769
  return e;
@@ -825,7 +825,7 @@ class we extends N {
825
825
  this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: V, value: !1 }]), this.editedFeatureId = void 0, e(!0));
826
826
  }
827
827
  registerBehaviors(t) {
828
- this.pixelDistance = new at(t), this.clickBoundingBox = new nt(t);
828
+ this.pixelDistance = new lt(t), this.clickBoundingBox = new at(t);
829
829
  }
830
830
  styleFeature(t) {
831
831
  const e = I({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
@@ -873,7 +873,7 @@ class gi extends k {
873
873
  create(t, e) {
874
874
  if (this.ids.length) throw new Error("Opening and closing points already created");
875
875
  if (t.length <= 3) throw new Error("Requires at least 4 coordinates");
876
- this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: t[0] }, properties: { mode: e, [st]: !0 } }, { geometry: { type: "Point", coordinates: t[t.length - 2] }, properties: { mode: e, [st]: !0 } }]);
876
+ this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: t[0] }, properties: { mode: e, [rt]: !0 } }, { geometry: { type: "Point", coordinates: t[t.length - 2] }, properties: { mode: e, [rt]: !0 } }]);
877
877
  }
878
878
  delete() {
879
879
  this.ids.length && (this.store.delete(this.ids), this._startEndPoints = []);
@@ -931,7 +931,7 @@ class Fe extends k {
931
931
  return this.store.create(t.map((i) => ({ geometry: { type: "Point", coordinates: i }, properties: { mode: e, [kt]: !0 } })));
932
932
  }
933
933
  setFeatureCoordinatePoints(t, e) {
934
- this.store.updateProperty([{ id: t, property: rt, value: e }]);
934
+ this.store.updateProperty([{ id: t, property: nt, value: e }]);
935
935
  }
936
936
  deleteCoordinatePoints(t) {
937
937
  const e = t.filter((i) => this.store.has(i));
@@ -953,7 +953,7 @@ class Ee extends N {
953
953
  this.coordinatePoints.createOrUpdate(e);
954
954
  });
955
955
  else if (this.coordinatePoints && this.showCoordinatePoints === !1) {
956
- const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[rt]);
956
+ const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[nt]);
957
957
  this.coordinatePoints.deletePointsByFeatureIds(e.map((i) => i.id));
958
958
  }
959
959
  }
@@ -964,13 +964,13 @@ class Ee extends N {
964
964
  if (t.length < 5 || !this.updatePolygonGeometry([...t.slice(0, -2), t[0]], M.Finish)) return;
965
965
  const e = this.currentId;
966
966
  if (this.currentId) {
967
- const i = ht(this.store.getGeometryCopy(this.currentId));
967
+ const i = ct(this.store.getGeometryCopy(this.currentId));
968
968
  i && this.store.updateGeometry([{ id: this.currentId, geometry: i }]);
969
969
  }
970
970
  this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.snappedPointId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
971
971
  }
972
972
  registerBehaviors(t) {
973
- this.clickBoundingBox = new nt(t), this.pixelDistance = new at(t), this.lineSnapping = new Ie(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new vt(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new gi(t, this.pixelDistance), this.coordinatePoints = new Fe(t);
973
+ this.clickBoundingBox = new at(t), this.pixelDistance = new lt(t), this.lineSnapping = new Ie(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new vt(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new gi(t, this.pixelDistance), this.coordinatePoints = new Fe(t);
974
974
  }
975
975
  start() {
976
976
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -984,7 +984,7 @@ class Ee extends N {
984
984
  if (e) {
985
985
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
986
986
  else {
987
- const [r] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [Lt]: !0 } }]);
987
+ const [r] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [_t]: !0 } }]);
988
988
  this.snappedPointId = r;
989
989
  }
990
990
  t.lng = e[0], t.lat = e[1];
@@ -1111,7 +1111,7 @@ class Ee extends N {
1111
1111
  if (t.properties.mode === this.mode) {
1112
1112
  if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = 10, e;
1113
1113
  if (t.geometry.type === "Point") {
1114
- const i = t.properties[V], o = t.properties[kt], r = i ? "editedPoint" : t.properties[st] ? "closingPoint" : t.properties[Lt] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1114
+ const i = t.properties[V], o = t.properties[kt], r = i ? "editedPoint" : t.properties[rt] ? "closingPoint" : t.properties[_t] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1115
1115
  if (!r) return e;
1116
1116
  const n = { editedPoint: { width: this.styles.editedPointOutlineWidth, color: this.styles.editedPointColor, outlineColor: this.styles.editedPointOutlineColor, outlineWidth: this.styles.editedPointOutlineWidth }, closingPoint: { width: this.styles.closingPointWidth, color: this.styles.closingPointColor, outlineColor: this.styles.closingPointOutlineColor, outlineWidth: this.styles.closingPointOutlineWidth }, snappingPoint: { width: this.styles.snappingPointWidth, color: this.styles.snappingPointColor, outlineColor: this.styles.snappingPointOutlineColor, outlineWidth: this.styles.snappingPointOutlineWidth }, coordinatePoint: { width: this.styles.coordinatePointWidth, color: this.styles.coordinatePointColor, outlineColor: this.styles.coordinatePointOutlineColor, outlineWidth: this.styles.coordinatePointOutlineWidth } };
1117
1117
  return e.pointWidth = this.getNumericStylingValue(n[r].width, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(n[r].color, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(n[r].outlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(n[r].outlineWidth, 2, t), e.zIndex = i ? 35 : o ? 25 : 30, e;
@@ -1144,7 +1144,7 @@ class Oe extends N {
1144
1144
  close() {
1145
1145
  const t = this.currentRectangleId;
1146
1146
  if (t) {
1147
- const e = ht(this.store.getGeometryCopy(t));
1147
+ const e = ct(this.store.getGeometryCopy(t));
1148
1148
  e && this.store.updateGeometry([{ id: t, geometry: e }]);
1149
1149
  }
1150
1150
  this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), t !== void 0 && this.onFinish(t, { mode: this.mode, action: "draw" });
@@ -1185,7 +1185,7 @@ class Oe extends N {
1185
1185
  return t.type === "Feature" && t.geometry.type === "Polygon" && t.properties.mode === this.mode && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = 10), e;
1186
1186
  }
1187
1187
  validateFeature(t) {
1188
- return this.validateModeFeature(t, (e) => dt(e, this.coordinatePrecision));
1188
+ return this.validateModeFeature(t, (e) => ht(e, this.coordinatePrecision));
1189
1189
  }
1190
1190
  }
1191
1191
  class et extends N {
@@ -1281,7 +1281,7 @@ class Pi extends k {
1281
1281
  }
1282
1282
  insert(t, e, i) {
1283
1283
  const o = this.store.getGeometryCopy(e), { midPointFeatureId: r, midPointSegment: n } = this.store.getPropertiesCopy(e), a = this.store.getGeometryCopy(r), l = a.type === "Polygon" ? a.coordinates[0] : a.coordinates;
1284
- l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: r, geometry: a }]), this.store.getPropertiesCopy(t)[rt] && this.coordinatePointBehavior.createOrUpdate(t), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, r, i), this.selectionPointBehavior.create(l, a.type, r);
1284
+ l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: r, geometry: a }]), this.store.getPropertiesCopy(t)[nt] && this.coordinatePointBehavior.createOrUpdate(t), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, r, i), this.selectionPointBehavior.create(l, a.type, r);
1285
1285
  }
1286
1286
  create(t, e, i) {
1287
1287
  if (!this.store.has(e)) throw new Error("Store does not have feature with this id");
@@ -1322,7 +1322,7 @@ class Si extends k {
1322
1322
  if (this._selectionPoints[t] !== void 0) return { id: this._selectionPoints[t], geometry: { type: "Point", coordinates: e } };
1323
1323
  }
1324
1324
  }
1325
- function _e(s, t) {
1325
+ function Le(s, t) {
1326
1326
  let e = !1;
1327
1327
  for (let n = 0, a = t.length; n < a; n++) {
1328
1328
  const l = t[n];
@@ -1331,7 +1331,7 @@ function _e(s, t) {
1331
1331
  var i, o, r;
1332
1332
  return e;
1333
1333
  }
1334
- const Le = (s, t, e) => {
1334
+ const _e = (s, t, e) => {
1335
1335
  const i = (r) => r * r, o = (r, n) => i(r.x - n.x) + i(r.y - n.y);
1336
1336
  return Math.sqrt(((r, n, a) => {
1337
1337
  const l = o(n, a);
@@ -1356,12 +1356,12 @@ class xi extends k {
1356
1356
  } else if (g.type === "LineString") {
1357
1357
  if (i) continue;
1358
1358
  for (let y = 0; y < g.coordinates.length - 1; y++) {
1359
- const m = g.coordinates[y], v = g.coordinates[y + 1], f = Le({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
1359
+ const m = g.coordinates[y], v = g.coordinates[y + 1], f = _e({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
1360
1360
  f < this.pointerDistance && f < l && (l = f, o = p);
1361
1361
  }
1362
1362
  } else if (g.type === "Polygon") {
1363
1363
  if (i || o) continue;
1364
- _e([t.lng, t.lat], g.coordinates) && (n = p);
1364
+ Le([t.lng, t.lat], g.coordinates) && (n = p);
1365
1365
  }
1366
1366
  }
1367
1367
  return { clickedFeature: i || o || n, clickedMidPoint: r };
@@ -1775,7 +1775,7 @@ class Be extends Ye {
1775
1775
  this._state = "selecting";
1776
1776
  }
1777
1777
  registerBehaviors(t) {
1778
- this.pixelDistance = new at(t), this.clickBoundingBox = new nt(t), this.featuresAtMouseEvent = new xi(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Si(t), this.coordinatePoints = new Fe(t), this.midPoints = new Pi(t, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new vt(t, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new Mi(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new wi(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Ii(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new bi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap), this.dragCoordinateResizeFeature = new Fi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints);
1778
+ this.pixelDistance = new lt(t), this.clickBoundingBox = new at(t), this.featuresAtMouseEvent = new xi(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Si(t), this.coordinatePoints = new Fe(t), this.midPoints = new Pi(t, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new vt(t, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new Mi(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new wi(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Ii(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new bi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap), this.dragCoordinateResizeFeature = new Fi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints);
1779
1779
  }
1780
1780
  deselectFeature() {
1781
1781
  this.deselect();
@@ -1989,23 +1989,23 @@ function ot(s, t) {
1989
1989
  function Di(s, t) {
1990
1990
  return s.minX - t.minX;
1991
1991
  }
1992
- function _i(s, t) {
1992
+ function Li(s, t) {
1993
1993
  return s.minY - t.minY;
1994
1994
  }
1995
1995
  function Et(s) {
1996
1996
  return (s.maxX - s.minX) * (s.maxY - s.minY);
1997
1997
  }
1998
- function pt(s) {
1998
+ function gt(s) {
1999
1999
  return s.maxX - s.minX + (s.maxY - s.minY);
2000
2000
  }
2001
- function Li(s, t) {
2001
+ function _i(s, t) {
2002
2002
  const e = Math.max(s.minX, t.minX), i = Math.max(s.minY, t.minY), o = Math.min(s.maxX, t.maxX), r = Math.min(s.maxY, t.maxY);
2003
2003
  return Math.max(0, o - e) * Math.max(0, r - i);
2004
2004
  }
2005
2005
  function Ot(s, t) {
2006
2006
  return s.minX <= t.minX && s.minY <= t.minY && t.maxX <= s.maxX && t.maxY <= s.maxY;
2007
2007
  }
2008
- function gt(s, t) {
2008
+ function yt(s, t) {
2009
2009
  return t.minX <= s.maxX && t.minY <= s.maxY && t.maxX >= s.minX && t.maxY >= s.minY;
2010
2010
  }
2011
2011
  function q(s) {
@@ -2026,12 +2026,12 @@ class ki {
2026
2026
  search(t) {
2027
2027
  let e = this.data;
2028
2028
  const i = [];
2029
- if (!gt(t, e)) return i;
2029
+ if (!yt(t, e)) return i;
2030
2030
  const o = this.toBBox, r = [];
2031
2031
  for (; e; ) {
2032
2032
  for (let n = 0; n < e.children.length; n++) {
2033
2033
  const a = e.children[n], l = e.leaf ? o(a) : a;
2034
- gt(t, l) && (e.leaf ? i.push(a) : Ot(t, l) ? this._all(a, i) : r.push(a));
2034
+ yt(t, l) && (e.leaf ? i.push(a) : Ot(t, l) ? this._all(a, i) : r.push(a));
2035
2035
  }
2036
2036
  e = r.pop();
2037
2037
  }
@@ -2039,12 +2039,12 @@ class ki {
2039
2039
  }
2040
2040
  collides(t) {
2041
2041
  let e = this.data;
2042
- if (gt(t, e)) {
2042
+ if (yt(t, e)) {
2043
2043
  const i = [];
2044
2044
  for (; e; ) {
2045
2045
  for (let o = 0; o < e.children.length; o++) {
2046
2046
  const r = e.children[o], n = e.leaf ? this.toBBox(r) : r;
2047
- if (gt(t, n)) {
2047
+ if (yt(t, n)) {
2048
2048
  if (e.leaf || Ot(t, n)) return !0;
2049
2049
  i.push(r);
2050
2050
  }
@@ -2148,26 +2148,26 @@ class ki {
2148
2148
  _chooseSplitIndex(t, e, i) {
2149
2149
  let o, r = 1 / 0, n = 1 / 0;
2150
2150
  for (let a = e; a <= i - e; a++) {
2151
- const l = it(t, 0, a, this.toBBox), d = it(t, a, i, this.toBBox), h = Li(l, d), c = Et(l) + Et(d);
2151
+ const l = it(t, 0, a, this.toBBox), d = it(t, a, i, this.toBBox), h = _i(l, d), c = Et(l) + Et(d);
2152
2152
  h < r ? (r = h, o = a, n = c < n ? c : n) : h === r && c < n && (n = c, o = a);
2153
2153
  }
2154
2154
  return o || i - e;
2155
2155
  }
2156
2156
  _chooseSplitAxis(t, e, i) {
2157
- const o = t.leaf ? this.compareMinX : Di, r = t.leaf ? this.compareMinY : _i;
2157
+ const o = t.leaf ? this.compareMinX : Di, r = t.leaf ? this.compareMinY : Li;
2158
2158
  this._allDistMargin(t, e, i, o) < this._allDistMargin(t, e, i, r) && t.children.sort(o);
2159
2159
  }
2160
2160
  _allDistMargin(t, e, i, o) {
2161
2161
  t.children.sort(o);
2162
2162
  const r = this.toBBox, n = it(t, 0, e, r), a = it(t, i - e, i, r);
2163
- let l = pt(n) + pt(a);
2163
+ let l = gt(n) + gt(a);
2164
2164
  for (let d = e; d < i - e; d++) {
2165
2165
  const h = t.children[d];
2166
- ot(n, t.leaf ? r(h) : h), l += pt(n);
2166
+ ot(n, t.leaf ? r(h) : h), l += gt(n);
2167
2167
  }
2168
2168
  for (let d = i - e - 1; d >= e; d--) {
2169
2169
  const h = t.children[d];
2170
- ot(a, t.leaf ? r(h) : h), l += pt(a);
2170
+ ot(a, t.leaf ? r(h) : h), l += gt(a);
2171
2171
  }
2172
2172
  return l;
2173
2173
  }
@@ -2374,7 +2374,7 @@ class je extends N {
2374
2374
  const o = e[0], r = e[1], n = De(o, r, this.coordinatePrecision, this.project, this.unproject), a = x(o[0], o[1]), l = x(n[0], n[1]), d = x(r[0], r[1]), h = x(t.lng, t.lat), c = E(h, a) < E(h, d), u = oe(a, l, h), p = c ? 90 - u : oe(a, l, h) - 90, g = E(l, h), y = Math.cos(O(p)) * g, m = A(a, d) + (function(S, b, w) {
2375
2375
  const D = (w.x - b.x) * (S.y - b.y) - (w.y - b.y) * (S.x - b.x);
2376
2376
  return D > 1e-10 ? "left" : D < -1e-10 ? "right" : "left";
2377
- }(a, d, h) === "right" ? -90 : 90), v = lt(a, y, m), f = lt(d, y, m), C = W(v.x, v.y), P = W(f.x, f.y);
2377
+ }(a, d, h) === "right" ? -90 : 90), v = dt(a, y, m), f = dt(d, y, m), C = W(v.x, v.y), P = W(f.x, f.y);
2378
2378
  i = [e[0], e[1], [P.lng, P.lat], [C.lng, C.lat], e[0]];
2379
2379
  }
2380
2380
  i && this.updatePolygonGeometry(this.currentId, i, M.Provisional);
@@ -2420,7 +2420,7 @@ class je extends N {
2420
2420
  return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = 10), e;
2421
2421
  }
2422
2422
  validateFeature(t) {
2423
- return this.validateModeFeature(t, (e) => dt(e, this.coordinatePrecision));
2423
+ return this.validateModeFeature(t, (e) => ht(e, this.coordinatePrecision));
2424
2424
  }
2425
2425
  }
2426
2426
  function Ne(s, t, e) {
@@ -2436,7 +2436,7 @@ class Ge extends N {
2436
2436
  }
2437
2437
  close() {
2438
2438
  if (this.currentId === void 0) return;
2439
- const t = ht(this.store.getGeometryCopy(this.currentId));
2439
+ const t = ct(this.store.getGeometryCopy(this.currentId));
2440
2440
  t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]);
2441
2441
  const e = this.currentId;
2442
2442
  this.currentCoordinate = 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
@@ -2466,7 +2466,7 @@ class Ge extends N {
2466
2466
  const f = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
2467
2467
  g.push(r);
2468
2468
  for (let C = 0; C <= p; C++) {
2469
- const P = lt(a, h, y + C * f), { lng: S, lat: b } = W(P.x, P.y), w = [F(S, this.coordinatePrecision), F(b, this.coordinatePrecision)];
2469
+ const P = dt(a, h, y + C * f), { lng: S, lat: b } = W(P.x, P.y), w = [F(S, this.coordinatePrecision), F(b, this.coordinatePrecision)];
2470
2470
  w[0] !== g[g.length - 1][0] && w[1] !== g[g.length - 1][1] && g.push(w);
2471
2471
  }
2472
2472
  g.push(o), i = [...g];
@@ -2510,7 +2510,7 @@ class Ge extends N {
2510
2510
  return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = 10), e;
2511
2511
  }
2512
2512
  validateFeature(t) {
2513
- return this.validateModeFeature(t, (e) => dt(e, this.coordinatePrecision));
2513
+ return this.validateModeFeature(t, (e) => ht(e, this.coordinatePrecision));
2514
2514
  }
2515
2515
  }
2516
2516
  const zi = { cancel: "Escape", finish: "Enter" }, Xi = { start: "crosshair", close: "pointer" };
@@ -2525,7 +2525,7 @@ class Ae extends N {
2525
2525
  if (this.currentStartingPointId === void 0) return;
2526
2526
  const t = this.currentStartingPointId, e = this.currentInitialArcId, i = this.currentId;
2527
2527
  if (t && this.store.delete([t]), e && this.store.delete([e]), this.currentId) {
2528
- const o = ht(this.store.getGeometryCopy(this.currentId));
2528
+ const o = ct(this.store.getGeometryCopy(this.currentId));
2529
2529
  o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]);
2530
2530
  }
2531
2531
  this.currentCoordinate = 0, this.currentStartingPointId = void 0, this.currentInitialArcId = void 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), i && this.onFinish(i, { mode: this.mode, action: "draw" });
@@ -2549,7 +2549,7 @@ class Ae extends N {
2549
2549
  this.direction === "anticlockwise" ? (m = y - g, m < 0 && (m += 360)) : (m = g - y, m < 0 && (m += 360));
2550
2550
  const v = (this.direction === "anticlockwise" ? 1 : -1) * m / u;
2551
2551
  for (let f = 0; f <= u; f++) {
2552
- const C = lt(l, d, g + f * v), { lng: P, lat: S } = W(C.x, C.y), b = [F(P, this.coordinatePrecision), F(S, this.coordinatePrecision)];
2552
+ const C = dt(l, d, g + f * v), { lng: P, lat: S } = W(C.x, C.y), b = [F(P, this.coordinatePrecision), F(S, this.coordinatePrecision)];
2553
2553
  b[0] !== p[p.length - 1][0] && b[1] !== p[p.length - 1][1] && p.push(b);
2554
2554
  }
2555
2555
  this.updateLineStringGeometry(this.currentInitialArcId, p, M.Provisional);
@@ -2560,7 +2560,7 @@ class Ae extends N {
2560
2560
  if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: m, direction: this.direction })) return;
2561
2561
  const f = this.getDeltaBearing(this.direction, y, m), C = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * f / C, S = E(d, c), b = [];
2562
2562
  for (let w = 0; w <= C; w++) {
2563
- const D = lt(d, S, y + w * P), { lng: G, lat: _ } = W(D.x, D.y), j = [F(G, this.coordinatePrecision), F(_, this.coordinatePrecision)];
2563
+ const D = dt(d, S, y + w * P), { lng: G, lat: L } = W(D.x, D.y), j = [F(G, this.coordinatePrecision), F(L, this.coordinatePrecision)];
2564
2564
  j[0] !== e[e.length - 1][0] && j[1] !== e[e.length - 1][1] && b.unshift(j);
2565
2565
  }
2566
2566
  e.push(...b), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, M.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode } }]);
@@ -2607,7 +2607,7 @@ class Ae extends N {
2607
2607
  return t.properties.mode === this.mode && (t.geometry.type === "Polygon" ? (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = 10) : t.geometry.type === "LineString" ? (e.lineStringColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.zIndex = 10) : t.geometry.type === "Point" && (e.pointColor = this.getHexColorStylingValue(this.styles.centerPointColor, e.pointColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.centerPointWidth, e.pointWidth, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.centerPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.centerPointOutlineWidth, e.pointOutlineWidth, t), e.zIndex = 20)), e;
2608
2608
  }
2609
2609
  validateFeature(t) {
2610
- return this.validateModeFeature(t, (e) => dt(e, this.coordinatePrecision));
2610
+ return this.validateModeFeature(t, (e) => ht(e, this.coordinatePrecision));
2611
2611
  }
2612
2612
  getDeltaBearing(t, e, i) {
2613
2613
  let o;
@@ -2784,11 +2784,11 @@ class $i {
2784
2784
  const c = h.geometry.coordinates;
2785
2785
  for (let u = 0; u < c.length - 1; u++) {
2786
2786
  const p = c[u], g = c[u + 1];
2787
- if (Le(l, a(p[0], p[1]), a(g[0], g[1])) < o) return !0;
2787
+ if (_e(l, a(p[0], p[1]), a(g[0], g[1])) < o) return !0;
2788
2788
  }
2789
2789
  return !1;
2790
2790
  }
2791
- return !!_e([t, e], h.geometry.coordinates) || void 0;
2791
+ return !!Le([t, e], h.geometry.coordinates) || void 0;
2792
2792
  });
2793
2793
  }
2794
2794
  getSelectMode() {
@@ -2831,7 +2831,7 @@ class $i {
2831
2831
  t.forEach((i) => {
2832
2832
  if (!this._store.has(i)) throw new Error(`No feature with id ${i}, can not delete`);
2833
2833
  const o = this._store.copy(i);
2834
- o.properties[T.SELECTED] && this.deselectFeature(i), o.properties[rt] && e.push(...o.properties[rt]);
2834
+ o.properties[T.SELECTED] && this.deselectFeature(i), o.properties[nt] && e.push(...o.properties[nt]);
2835
2835
  }), this._store.delete([...t, ...e]);
2836
2836
  }
2837
2837
  selectFeature(t) {
@@ -3035,7 +3035,7 @@ const ko = [
3035
3035
  "download"
3036
3036
  ],
3037
3037
  open: !1
3038
- }, ft = {
3038
+ }, st = {
3039
3039
  modes: [
3040
3040
  "render",
3041
3041
  "point",
@@ -3538,22 +3538,22 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3538
3538
  styles: {}
3539
3539
  })
3540
3540
  });
3541
- var L = 63710088e-1, qi = {
3542
- centimeters: L * 100,
3543
- centimetres: L * 100,
3541
+ var _ = 63710088e-1, qi = {
3542
+ centimeters: _ * 100,
3543
+ centimetres: _ * 100,
3544
3544
  degrees: 360 / (2 * Math.PI),
3545
- feet: L * 3.28084,
3546
- inches: L * 39.37,
3547
- kilometers: L / 1e3,
3548
- kilometres: L / 1e3,
3549
- meters: L,
3550
- metres: L,
3551
- miles: L / 1609.344,
3552
- millimeters: L * 1e3,
3553
- millimetres: L * 1e3,
3554
- nauticalmiles: L / 1852,
3545
+ feet: _ * 3.28084,
3546
+ inches: _ * 39.37,
3547
+ kilometers: _ / 1e3,
3548
+ kilometres: _ / 1e3,
3549
+ meters: _,
3550
+ metres: _,
3551
+ miles: _ / 1609.344,
3552
+ millimeters: _ * 1e3,
3553
+ millimetres: _ * 1e3,
3554
+ nauticalmiles: _ / 1852,
3555
3555
  radians: 1,
3556
- yards: L * 1.0936
3556
+ yards: _ * 1.0936
3557
3557
  };
3558
3558
  function Zi(s, t, e = {}) {
3559
3559
  const i = { type: "Feature" };
@@ -3579,7 +3579,7 @@ function to(s, t = "kilometers") {
3579
3579
  throw new Error(t + " units is invalid");
3580
3580
  return s * e;
3581
3581
  }
3582
- function yt(s) {
3582
+ function ft(s) {
3583
3583
  return s % 360 * Math.PI / 180;
3584
3584
  }
3585
3585
  function se(s) {
@@ -3772,7 +3772,7 @@ function re(s) {
3772
3772
  }
3773
3773
  return t;
3774
3774
  }
3775
- var ro = L * L / 2, Dt = Math.PI / 180;
3775
+ var ro = _ * _ / 2, Dt = Math.PI / 180;
3776
3776
  function ne(s) {
3777
3777
  const t = s.length - 1;
3778
3778
  if (t <= 2) return 0;
@@ -3806,14 +3806,14 @@ function le(s) {
3806
3806
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
3807
3807
  }
3808
3808
  function lo(s, t, e = {}) {
3809
- var i = le(s), o = le(t), r = yt(o[1] - i[1]), n = yt(o[0] - i[0]), a = yt(i[1]), l = yt(o[1]), d = Math.pow(Math.sin(r / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
3809
+ var i = le(s), o = le(t), r = ft(o[1] - i[1]), n = ft(o[0] - i[0]), a = ft(i[1]), l = ft(o[1]), d = Math.pow(Math.sin(r / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
3810
3810
  return to(
3811
3811
  2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
3812
3812
  e.units
3813
3813
  );
3814
3814
  }
3815
3815
  var ho = lo;
3816
- const de = (s) => s === "degrees" ? "°" : s === "miles" ? "mi" : s === "radians" ? "rad" : "km", _t = (s) => {
3816
+ const de = (s) => s === "degrees" ? "°" : s === "miles" ? "mi" : s === "radians" ? "rad" : "km", Lt = (s) => {
3817
3817
  if (s >= 1)
3818
3818
  return {
3819
3819
  distance: s,
@@ -3845,12 +3845,12 @@ const de = (s) => s === "degrees" ? "°" : s === "miles" ? "mi" : s === "radians
3845
3845
  l.push(p);
3846
3846
  }
3847
3847
  if (s.properties.distance = l[l.length - 1].properties.total, s.properties.unit = l[l.length - 1].properties.unit, s.properties.segments = JSON.parse(JSON.stringify(l)), t === "kilometers") {
3848
- const d = _t(s.properties.distance);
3848
+ const d = Lt(s.properties.distance);
3849
3849
  s.properties.distance = d.distance, s.properties.unit = d.unit, s.properties.segments.forEach(
3850
3850
  (h) => {
3851
- const c = _t(h.properties.distance);
3851
+ const c = Lt(h.properties.distance);
3852
3852
  h.properties.distance = c.distance, h.properties.unit = c.unit;
3853
- const u = _t(h.properties.total);
3853
+ const u = Lt(h.properties.total);
3854
3854
  h.properties.total = u.distance, h.properties.totalUnit = u.unit;
3855
3855
  }
3856
3856
  );
@@ -3870,9 +3870,9 @@ const de = (s) => s === "degrees" ? "°" : s === "miles" ? "mi" : s === "radians
3870
3870
  var ge, ye, fe;
3871
3871
  const Bo = [
3872
3872
  ...Mt,
3873
- (ge = ft.polygonLayerSpec) == null ? void 0 : ge.source,
3874
- (ye = ft.lineLayerLabelSpec) == null ? void 0 : ye.source,
3875
- (fe = ft.pointLayerLabelSpec) == null ? void 0 : fe.source
3873
+ (ge = st.polygonLayerSpec) == null ? void 0 : ge.source,
3874
+ (ye = st.lineLayerLabelSpec) == null ? void 0 : ye.source,
3875
+ (fe = st.pointLayerLabelSpec) == null ? void 0 : fe.source
3876
3876
  ], Ue = (s, t, e = Mt) => {
3877
3877
  const i = JSON.parse(JSON.stringify(s));
3878
3878
  return t && (t.onlyTerraDrawLayers === !0 ? (i.layers = i.layers.filter((o) => "source" in o && e.includes(o.source)), Object.keys(i.sources).forEach((o) => {
@@ -4502,8 +4502,8 @@ class jo extends Fo {
4502
4502
  * @param options Plugin control options
4503
4503
  */
4504
4504
  constructor(e) {
4505
- let i = ft;
4506
- e && (i = Object.assign(i, e));
4505
+ let i = structuredClone(st);
4506
+ i.modeOptions = st.modeOptions, e && (i = Object.assign(i, e));
4507
4507
  super({
4508
4508
  modes: i.modes,
4509
4509
  open: i.open,
@@ -4649,6 +4649,41 @@ class jo extends Fo {
4649
4649
  const i = this.measureOptions.computeElevation === e;
4650
4650
  this.measureOptions.computeElevation = e, i || this.recalc();
4651
4651
  }
4652
+ /**
4653
+ * Get/Set font glyph for measure control layers
4654
+ *
4655
+ * As default, this maesure control uses maplibre's default font glyphs(`Open Sans Regular,Arial Unicode MS Regular`) described at https://maplibre.org/maplibre-style-spec/layers/#text-font
4656
+ *
4657
+ * If you are using your own maplibre style or different map privider, you probably need to set the font glyphs to match your maplibre style.
4658
+ *
4659
+ * Font glyph availability depends on what types of glyphs are supported by your maplibre style (e.g., Carto, Openmap tiles, Protomap, Maptiler, etc.)
4660
+ * Please make sure the font glyphs are available in your maplibre style.
4661
+ *
4662
+ * Usage:
4663
+ *
4664
+ * ```js
4665
+ * const drawControl = new MaplibreMeasureControl()
4666
+ * drawControl.fontGlyphs = ['Open Sans Italic']
4667
+ * map.addControl(drawControl)
4668
+ * ```
4669
+ */
4670
+ get fontGlyphs() {
4671
+ const i = [
4672
+ this.measureOptions.pointLayerLabelSpec,
4673
+ this.measureOptions.lineLayerLabelSpec,
4674
+ this.measureOptions.polygonLayerSpec
4675
+ ][0];
4676
+ return i && i.layout && i.layout["text-font"];
4677
+ }
4678
+ set fontGlyphs(e) {
4679
+ const i = [
4680
+ this.measureOptions.pointLayerLabelSpec,
4681
+ this.measureOptions.lineLayerLabelSpec,
4682
+ this.measureOptions.polygonLayerSpec
4683
+ ];
4684
+ for (const o of i)
4685
+ o && o.layout && (o.layout["text-font"] = e), this.map && o && this.map.getLayer(o.id) && this.map.setLayoutProperty(o.id, "text-font", e);
4686
+ }
4652
4687
  /**
4653
4688
  * add the plugin control to maplibre
4654
4689
  * @param map Maplibre Map object
@@ -5044,10 +5079,10 @@ export {
5044
5079
  ce as capitalize,
5045
5080
  Ue as cleanMaplibreStyle,
5046
5081
  ao as convertAreaUnit,
5047
- _t as convertMetricDistance,
5082
+ Lt as convertMetricDistance,
5048
5083
  co as debounce,
5049
5084
  Hi as defaultControlOptions,
5050
- ft as defaultMeasureControlOptions,
5085
+ st as defaultMeasureControlOptions,
5051
5086
  Ji as getDefaultModeOptions,
5052
5087
  de as getDistanceUnitName,
5053
5088
  ue as queryElevationByPoint,