@watergis/maplibre-gl-terradraw 1.9.1 → 1.9.3

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.
@@ -1,4 +1,4 @@
1
- import { LngLat as Zt } from "maplibre-gl";
1
+ import { LngLat as qt } from "maplibre-gl";
2
2
  function x() {
3
3
  return x = Object.assign ? Object.assign.bind() : function(s) {
4
4
  for (var e = 1; e < arguments.length; e++) {
@@ -8,12 +8,12 @@ function x() {
8
8
  return s;
9
9
  }, x.apply(null, arguments);
10
10
  }
11
- var E;
11
+ var O;
12
12
  (function(s) {
13
13
  s.Commit = "commit", s.Provisional = "provisional", s.Finish = "finish";
14
- })(E || (E = {}));
15
- const _ = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, S = { MODE: "mode", CURRENTLY_DRAWING: "currentlyDrawing", EDITED: "edited", CLOSING_POINT: "closingPoint", SNAPPING_POINT: "snappingPoint", COORDINATE_POINT: "coordinatePoint", COORDINATE_POINT_FEATURE_ID: "coordinatePointFeatureId", COORDINATE_POINT_IDS: "coordinatePointIds", PROVISIONAL_COORDINATE_COUNT: "provisionalCoordinateCount", COMMITTED_COORDINATE_COUNT: "committedCoordinateCount" }, U = 10;
16
- function Le(s) {
14
+ })(O || (O = {}));
15
+ const St = "https://raw.githubusercontent.com/JamesLMilner/terra-draw/refs/heads/main/assets/markers/marker-blue.png", D = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, P = { MODE: "mode", CURRENTLY_DRAWING: "currentlyDrawing", EDITED: "edited", CLOSING_POINT: "closingPoint", SNAPPING_POINT: "snappingPoint", COORDINATE_POINT: "coordinatePoint", COORDINATE_POINT_FEATURE_ID: "coordinatePointFeatureId", COORDINATE_POINT_IDS: "coordinatePointIds", PROVISIONAL_COORDINATE_COUNT: "provisionalCoordinateCount", COMMITTED_COORDINATE_COUNT: "committedCoordinateCount", MARKER: "marker" }, U = 10;
16
+ function Fe(s) {
17
17
  return !!(s && typeof s == "object" && s !== null && !Array.isArray(s));
18
18
  }
19
19
  function tt(s) {
@@ -24,13 +24,13 @@ function it(s) {
24
24
  return typeof e == "number" && !isNaN(new Date(e).valueOf());
25
25
  })(s);
26
26
  }
27
- const Qt = "Feature mode property does not match the mode being added to";
27
+ const Jt = "Feature mode property does not match the mode being added to";
28
28
  var X;
29
29
  (function(s) {
30
30
  s.Drawing = "drawing", s.Select = "select", s.Static = "static", s.Render = "render";
31
31
  })(X || (X = {}));
32
- const ei = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
33
- class j {
32
+ const Zt = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
33
+ let j = class {
34
34
  get state() {
35
35
  return this._state;
36
36
  }
@@ -47,7 +47,7 @@ class j {
47
47
  registerBehaviors(e) {
48
48
  }
49
49
  constructor(e, t = !1) {
50
- this._state = "unregistered", this._styles = {}, this.pointerEvents = ei, this.behaviors = [], this.validate = void 0, this.pointerDistance = 40, this.coordinatePrecision = void 0, this.onStyleChange = void 0, this.store = void 0, this.projection = "web-mercator", this.setDoubleClickToZoom = void 0, this.unproject = void 0, this.project = void 0, this.setCursor = void 0, this.type = X.Drawing, this.mode = "base", t || this.updateOptions(e);
50
+ this._state = "unregistered", this._styles = {}, this.pointerEvents = Zt, this.behaviors = [], this.validate = void 0, this.pointerDistance = 40, this.coordinatePrecision = void 0, this.onStyleChange = void 0, this.store = void 0, this.projection = "web-mercator", this.setDoubleClickToZoom = void 0, this.unproject = void 0, this.project = void 0, this.setCursor = void 0, this.type = X.Drawing, this.mode = "base", t || this.updateOptions(e);
51
51
  }
52
52
  updateOptions(e) {
53
53
  e != null && e.styles && (this.styles = x({}, this._styles, e.styles)), e != null && e.pointerDistance && (this.pointerDistance = e.pointerDistance), e != null && e.validation && (this.validate = e && e.validation), e != null && e.projection && (this.projection = e.projection), e?.pointerEvents !== void 0 && (this.pointerEvents = e.pointerEvents);
@@ -82,9 +82,9 @@ class j {
82
82
  if (this._state === "unregistered") throw new Error("Mode must be registered");
83
83
  const t = (function(i, o) {
84
84
  let r;
85
- if (Le(i)) if (i.id == null) r = "Feature has no id";
85
+ if (Fe(i)) if (i.id == null) r = "Feature has no id";
86
86
  else if (typeof i.id != "string" && typeof i.id != "number") r = "Feature must be string or number as per GeoJSON spec";
87
- else if (o(i.id)) if (Le(i.geometry)) if (Le(i.properties)) if (typeof i.geometry.type == "string" && ["Polygon", "LineString", "Point"].includes(i.geometry.type)) if (Array.isArray(i.geometry.coordinates)) {
87
+ else if (o(i.id)) if (Fe(i.geometry)) if (Fe(i.properties)) if (typeof i.geometry.type == "string" && ["Polygon", "LineString", "Point"].includes(i.geometry.type)) if (Array.isArray(i.geometry.coordinates)) {
88
88
  if (!i.properties.mode || typeof i.properties.mode != "string") return { valid: !1, reason: "Feature does not have a valid mode property" };
89
89
  } else r = "Feature coordinates is not an array";
90
90
  else r = "Feature is not Point, LineString or Polygon";
@@ -95,14 +95,14 @@ class j {
95
95
  return r ? { valid: !1, reason: r } : { valid: !0 };
96
96
  })(e, this.store.idStrategy.isValidId);
97
97
  if (this.validate) {
98
- const i = this.validate(e, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional });
98
+ const i = this.validate(e, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Provisional });
99
99
  return { valid: t.valid && i.valid, reason: i.reason };
100
100
  }
101
101
  return { valid: t.valid, reason: t.reason };
102
102
  }
103
103
  validateModeFeature(e, t) {
104
104
  const i = this.performFeatureValidation(e);
105
- return i.valid ? e.properties.mode !== this.mode ? { valid: !1, reason: Qt } : t(e) : { valid: !1, reason: i.reason };
105
+ return i.valid ? e.properties.mode !== this.mode ? { valid: !1, reason: Jt } : t(e) : { valid: !1, reason: i.reason };
106
106
  }
107
107
  onFinish(e, t) {
108
108
  }
@@ -136,8 +136,7 @@ class j {
136
136
  getStylingValue(e, t, i) {
137
137
  return e === void 0 ? t : typeof e == "function" ? e(i) : e;
138
138
  }
139
- }
140
- let ti = class extends j {
139
+ }, Qt = class extends j {
141
140
  constructor(...e) {
142
141
  super(...e), this.type = X.Select;
143
142
  }
@@ -146,30 +145,30 @@ function G(s, e) {
146
145
  const t = (d) => d * Math.PI / 180, i = t(s[1]), o = t(s[0]), r = t(e[1]), n = r - i, a = t(e[0]) - o, l = Math.sin(n / 2) * Math.sin(n / 2) + Math.cos(i) * Math.cos(r) * Math.sin(a / 2) * Math.sin(a / 2);
147
146
  return 2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)) * 6371e3 / 1e3;
148
147
  }
149
- const Et = 63710088e-1;
150
- function D(s) {
148
+ const xt = 63710088e-1;
149
+ function k(s) {
151
150
  return s % 360 * Math.PI / 180;
152
151
  }
153
- function bt(s) {
152
+ function Et(s) {
154
153
  return s / 6371.0088;
155
154
  }
156
155
  function V(s) {
157
156
  return s % (2 * Math.PI) * 180 / Math.PI;
158
157
  }
159
- function b(s, e = 9) {
158
+ function w(s, e = 9) {
160
159
  const t = Math.pow(10, e);
161
160
  return Math.round(s * t) / t;
162
161
  }
163
- const ot = 57.29577951308232, rt = 0.017453292519943295, xe = 6378137, O = (s, e) => ({ x: s === 0 ? 0 : s * rt * xe, y: e === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + e * rt / 2)) * xe }), A = (s, e) => ({ lng: s === 0 ? 0 : ot * (s / xe), lat: e === 0 ? 0 : (2 * Math.atan(Math.exp(e / xe)) - Math.PI / 2) * ot });
164
- function ii(s, e, t) {
165
- const i = D(s[0]), o = D(s[1]), r = D(t), n = bt(e), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
162
+ const ot = 57.29577951308232, rt = 0.017453292519943295, Se = 6378137, E = (s, e) => ({ x: s === 0 ? 0 : s * rt * Se, y: e === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + e * rt / 2)) * Se }), R = (s, e) => ({ lng: s === 0 ? 0 : ot * (s / Se), lat: e === 0 ? 0 : (2 * Math.atan(Math.exp(e / Se)) - Math.PI / 2) * ot });
163
+ function ei(s, e, t) {
164
+ const i = k(s[0]), o = k(s[1]), r = k(t), n = Et(e), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
166
165
  return [V(i + Math.atan2(Math.sin(r) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), V(a)];
167
166
  }
168
167
  function st(s) {
169
168
  const { center: e, radiusKilometers: t, coordinatePrecision: i } = s, o = s.steps ? s.steps : 64, r = [];
170
169
  for (let n = 0; n < o; n++) {
171
- const a = ii(e, t, -360 * n / o);
172
- r.push([b(a[0], i), b(a[1], i)]);
170
+ const a = ei(e, t, -360 * n / o);
171
+ r.push([w(a[0], i), w(a[1], i)]);
173
172
  }
174
173
  return r.push(r[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [r] }, properties: {} };
175
174
  }
@@ -188,22 +187,22 @@ function Ue(s) {
188
187
  }
189
188
  function o(r, n, a, l) {
190
189
  const d = e[r][n], c = e[r][n + 1], h = e[a][l], u = e[a][l + 1], p = (function(f, v, C, m) {
191
- if (fe(f, C) || fe(f, m) || fe(v, C) || fe(m, C)) return null;
192
- const P = f[0], I = f[1], w = v[0], L = v[1], M = C[0], N = C[1], k = m[0], T = m[1], $ = (P - w) * (N - T) - (I - L) * (M - k);
193
- return $ === 0 ? null : [((P * L - I * w) * (M - k) - (P - w) * (M * T - N * k)) / $, ((P * L - I * w) * (N - T) - (I - L) * (M * T - N * k)) / $];
190
+ if (ye(f, C) || ye(f, m) || ye(v, C) || ye(m, C)) return null;
191
+ const I = f[0], S = f[1], b = v[0], F = v[1], L = C[0], N = C[1], _ = m[0], T = m[1], $ = (I - b) * (N - T) - (S - F) * (L - _);
192
+ return $ === 0 ? null : [((I * F - S * b) * (L - _) - (I - b) * (L * T - N * _)) / $, ((I * F - S * b) * (N - T) - (S - F) * (L * T - N * _)) / $];
194
193
  })(d, c, h, u);
195
194
  if (p === null) return;
196
195
  let g, y;
197
196
  g = c[0] !== d[0] ? (p[0] - d[0]) / (c[0] - d[0]) : (p[1] - d[1]) / (c[1] - d[1]), y = u[0] !== h[0] ? (p[0] - h[0]) / (u[0] - h[0]) : (p[1] - h[1]) / (u[1] - h[1]), i(g) || i(y) || (p.toString(), t.push(p));
198
197
  }
199
198
  }
200
- function fe(s, e) {
199
+ function ye(s, e) {
201
200
  return s[0] === e[0] && s[1] === e[1];
202
201
  }
203
- function be(s, e) {
202
+ function we(s, e) {
204
203
  return nt(s[0]) <= e && nt(s[1]) <= e;
205
204
  }
206
- function Ae(s) {
205
+ function Re(s) {
207
206
  return s.length === 2 && typeof s[0] == "number" && typeof s[1] == "number" && s[0] !== 1 / 0 && s[1] !== 1 / 0 && (t = s[0]) >= -180 && t <= 180 && (e = s[1]) >= -90 && e <= 90;
208
207
  var e, t;
209
208
  }
@@ -212,37 +211,37 @@ function nt(s) {
212
211
  for (; Math.round(s * e) / e !== s; ) e *= 10, t++;
213
212
  return t;
214
213
  }
215
- const oi = "Feature has holes", ri = "Feature has less than 4 coordinates", si = "Feature has invalid coordinates", ni = "Feature coordinates are not closed";
216
- function we(s, e) {
214
+ const ti = "Feature has holes", ii = "Feature has less than 4 coordinates", oi = "Feature has invalid coordinates", ri = "Feature coordinates are not closed";
215
+ function be(s, e) {
217
216
  if (s.geometry.type !== "Polygon") return { valid: !1, reason: "Feature is not a Polygon" };
218
- if (s.geometry.coordinates.length !== 1) return { valid: !1, reason: oi };
219
- if (s.geometry.coordinates[0].length < 4) return { valid: !1, reason: ri };
217
+ if (s.geometry.coordinates.length !== 1) return { valid: !1, reason: ti };
218
+ if (s.geometry.coordinates[0].length < 4) return { valid: !1, reason: ii };
220
219
  for (let o = 0; o < s.geometry.coordinates[0].length; o++) {
221
- if (!Ae(s.geometry.coordinates[0][o])) return { valid: !1, reason: si };
222
- if (!be(s.geometry.coordinates[0][o], e)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
220
+ if (!Re(s.geometry.coordinates[0][o])) return { valid: !1, reason: oi };
221
+ if (!we(s.geometry.coordinates[0][o], e)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
223
222
  }
224
- return (t = s.geometry.coordinates[0][0])[0] !== (i = s.geometry.coordinates[0][s.geometry.coordinates[0].length - 1])[0] || t[1] !== i[1] ? { valid: !1, reason: ni } : { valid: !0 };
223
+ return (t = s.geometry.coordinates[0][0])[0] !== (i = s.geometry.coordinates[0][s.geometry.coordinates[0].length - 1])[0] || t[1] !== i[1] ? { valid: !1, reason: ri } : { valid: !0 };
225
224
  var t, i;
226
225
  }
227
- function ge(s, e) {
228
- const t = we(s, e);
226
+ function pe(s, e) {
227
+ const t = be(s, e);
229
228
  return t.valid ? Ue(s) ? { valid: !1, reason: "Feature intersects itself" } : { valid: !0 } : t;
230
229
  }
231
- const ai = { cancel: "Escape", finish: "Enter" }, li = { start: "crosshair" };
232
- let wt = class extends j {
230
+ const si = { cancel: "Escape", finish: "Enter" }, ni = { start: "crosshair" };
231
+ let Ot = class extends j {
233
232
  constructor(e) {
234
- super(e, !0), this.mode = "circle", this.center = void 0, this.clickCount = 0, this.currentCircleId = void 0, this.keyEvents = ai, this.cursors = li, this.startingRadiusKilometers = 1e-5, this.cursorMovedAfterInitialCursorDown = !1, this.updateOptions(e);
233
+ super(e, !0), this.mode = "circle", this.center = void 0, this.clickCount = 0, this.currentCircleId = void 0, this.keyEvents = si, this.cursors = ni, this.startingRadiusKilometers = 1e-5, this.cursorMovedAfterInitialCursorDown = !1, this.updateOptions(e);
235
234
  }
236
235
  updateOptions(e) {
237
236
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e != null && e.startingRadiusKilometers && (this.startingRadiusKilometers = e.startingRadiusKilometers);
238
237
  }
239
238
  close() {
240
239
  if (this.currentCircleId === void 0) return;
241
- this.store.updateProperty([{ id: this.currentCircleId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
240
+ this.store.updateProperty([{ id: this.currentCircleId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
242
241
  const e = this.currentCircleId;
243
242
  if (this.validate && e) {
244
243
  const t = this.store.getGeometryCopy(e);
245
- if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
244
+ if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Finish }).valid) return;
246
245
  }
247
246
  this.cursorMovedAfterInitialCursorDown = !1, this.center = void 0, this.currentCircleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
248
247
  }
@@ -255,7 +254,7 @@ let wt = class extends j {
255
254
  onClick(e) {
256
255
  if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) if (this.clickCount === 0) {
257
256
  this.center = [e.lng, e.lat];
258
- const t = st({ center: this.center, radiusKilometers: this.startingRadiusKilometers, coordinatePrecision: this.coordinatePrecision }), [i] = this.store.create([{ geometry: t.geometry, properties: { mode: this.mode, radiusKilometers: this.startingRadiusKilometers, [S.CURRENTLY_DRAWING]: !0 } }]);
257
+ const t = st({ center: this.center, radiusKilometers: this.startingRadiusKilometers, coordinatePrecision: this.coordinatePrecision }), [i] = this.store.create([{ geometry: t.geometry, properties: { mode: this.mode, radiusKilometers: this.startingRadiusKilometers, [P.CURRENTLY_DRAWING]: !0 } }]);
259
258
  this.currentCircleId = i, this.clickCount++, this.cursorMovedAfterInitialCursorDown = !1, this.setDrawing();
260
259
  } else this.clickCount === 1 && this.center && this.currentCircleId !== void 0 && this.cursorMovedAfterInitialCursorDown && this.updateCircle(e), this.close();
261
260
  }
@@ -286,7 +285,7 @@ let wt = class extends j {
286
285
  return e.type === "Feature" && e.geometry.type === "Polygon" && e.properties.mode === this.mode && (t.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, t.polygonFillColor, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, t.polygonFillOpacity, e), t.zIndex = U), t;
287
286
  }
288
287
  validateFeature(e) {
289
- return this.validateModeFeature(e, (t) => ge(t, this.coordinatePrecision));
288
+ return this.validateModeFeature(e, (t) => pe(t, this.coordinatePrecision));
290
289
  }
291
290
  updateCircle(e) {
292
291
  if (this.clickCount === 1 && this.center && this.currentCircleId) {
@@ -296,14 +295,14 @@ let wt = class extends j {
296
295
  const o = (function(r, n) {
297
296
  const a = 1e3 * G(r, n);
298
297
  if (a === 0) return 1;
299
- const { x: l, y: d } = O(r[0], r[1]), { x: c, y: h } = O(n[0], n[1]);
298
+ const { x: l, y: d } = E(r[0], r[1]), { x: c, y: h } = E(n[0], n[1]);
300
299
  return Math.sqrt(Math.pow(c - l, 2) + Math.pow(h - d, 2)) / a;
301
300
  })(this.center, [e.lng, e.lat]);
302
301
  i = (function(r) {
303
- const { center: n, radiusKilometers: a, coordinatePrecision: l } = r, d = r.steps ? r.steps : 64, c = 1e3 * a, [h, u] = n, { x: p, y: g } = O(h, u), y = [];
302
+ const { center: n, radiusKilometers: a, coordinatePrecision: l } = r, d = r.steps ? r.steps : 64, c = 1e3 * a, [h, u] = n, { x: p, y: g } = E(h, u), y = [];
304
303
  for (let f = 0; f < d; f++) {
305
- const v = 360 * f / d * Math.PI / 180, C = c * Math.cos(v), m = c * Math.sin(v), [P, I] = [p + C, g + m], { lng: w, lat: L } = A(P, I);
306
- y.push([b(w, l), b(L, l)]);
304
+ const v = 360 * f / d * Math.PI / 180, C = c * Math.cos(v), m = c * Math.sin(v), [I, S] = [p + C, g + m], { lng: b, lat: F } = R(I, S);
305
+ y.push([w(b, l), w(F, l)]);
307
306
  }
308
307
  return y.push(y[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [y] }, properties: {} };
309
308
  })({ center: this.center, radiusKilometers: t * o, coordinatePrecision: this.coordinatePrecision });
@@ -311,7 +310,7 @@ let wt = class extends j {
311
310
  if (this.projection !== "globe") throw new Error("Invalid projection");
312
311
  i = st({ center: this.center, radiusKilometers: t, coordinatePrecision: this.coordinatePrecision });
313
312
  }
314
- if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: t } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid) return;
313
+ if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: t } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Provisional }).valid) return;
315
314
  this.store.updateGeometry([{ id: this.currentCircleId, geometry: i.geometry }]), this.store.updateProperty([{ id: this.currentCircleId, property: "radiusKilometers", value: t }]);
316
315
  }
317
316
  }
@@ -319,11 +318,11 @@ let wt = class extends j {
319
318
  this.currentCircleId === e.id && (this.cursorMovedAfterInitialCursorDown = !1, this.center = void 0, this.currentCircleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted());
320
319
  }
321
320
  };
322
- const F = (s, e) => {
321
+ const M = (s, e) => {
323
322
  const { x: t, y: i } = s, { x: o, y: r } = e, n = o - t, a = r - i;
324
323
  return Math.sqrt(a * a + n * n);
325
324
  };
326
- function ye(s) {
325
+ function ge(s) {
327
326
  if (!(function(t) {
328
327
  const i = t.coordinates[0];
329
328
  let o = 0;
@@ -334,10 +333,10 @@ function ye(s) {
334
333
  return o < 0;
335
334
  })(s)) return { type: "Polygon", coordinates: [s.coordinates[0].reverse()] };
336
335
  }
337
- const di = { cancel: "Escape", finish: "Enter" }, ci = { start: "crosshair", close: "pointer" };
338
- class Lt extends j {
336
+ const ai = { cancel: "Escape", finish: "Enter" }, li = { start: "crosshair", close: "pointer" };
337
+ let wt = class extends j {
339
338
  constructor(e) {
340
- super(e, !0), this.mode = "freehand", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = di, this.cursors = ci, this.preventPointsNearClose = !0, this.autoClose = !1, this.autoCloseTimeout = 500, this.hasLeftStartingPoint = !1, this.preventNewFeature = !1, this.updateOptions(e);
339
+ super(e, !0), this.mode = "freehand", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = ai, this.cursors = li, this.preventPointsNearClose = !0, this.autoClose = !1, this.autoCloseTimeout = 500, this.hasLeftStartingPoint = !1, this.preventNewFeature = !1, this.updateOptions(e);
341
340
  }
342
341
  updateOptions(e) {
343
342
  super.updateOptions(e), e != null && e.minDistance && (this.minDistance = e.minDistance), e?.preventPointsNearClose !== void 0 && (this.preventPointsNearClose = e.preventPointsNearClose), e?.autoClose !== void 0 && (this.autoClose = e.autoClose), e != null && e.autoCloseTimeout && (this.autoCloseTimeout = e.autoCloseTimeout), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors));
@@ -345,13 +344,13 @@ class Lt extends j {
345
344
  close() {
346
345
  if (this.currentId === void 0) return;
347
346
  if (this.currentId) {
348
- const t = ye(this.store.getGeometryCopy(this.currentId));
349
- t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
347
+ const t = ge(this.store.getGeometryCopy(this.currentId));
348
+ t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
350
349
  }
351
350
  const e = this.currentId;
352
351
  if (this.validate && e) {
353
352
  const t = this.store.getGeometryCopy(e);
354
- if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
353
+ if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Finish }).valid) return;
355
354
  }
356
355
  this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.hasLeftStartingPoint = !1, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
357
356
  }
@@ -363,8 +362,8 @@ class Lt extends j {
363
362
  }
364
363
  onMouseMove(e) {
365
364
  if (this.currentId === void 0 || this.startingClick === !1) return void this.setCursor(this.cursors.start);
366
- const t = this.store.getGeometryCopy(this.currentId), i = t.coordinates[0].length - 2, [o, r] = t.coordinates[0][i], { x: n, y: a } = this.project(o, r), l = F({ x: n, y: a }, { x: e.containerX, y: e.containerY }), [d, c] = t.coordinates[0][0], { x: h, y: u } = this.project(d, c);
367
- if (F({ x: h, y: u }, { x: e.containerX, y: e.containerY }) < this.pointerDistance) {
365
+ const t = this.store.getGeometryCopy(this.currentId), i = t.coordinates[0].length - 2, [o, r] = t.coordinates[0][i], { x: n, y: a } = this.project(o, r), l = M({ x: n, y: a }, { x: e.containerX, y: e.containerY }), [d, c] = t.coordinates[0][0], { x: h, y: u } = this.project(d, c);
366
+ if (M({ x: h, y: u }, { x: e.containerX, y: e.containerY }) < this.pointerDistance) {
368
367
  if (this.autoClose && this.hasLeftStartingPoint && (this.preventNewFeature = !0, setTimeout(() => {
369
368
  this.preventNewFeature = !1;
370
369
  }, this.autoCloseTimeout), this.close()), this.setCursor(this.cursors.close), this.preventPointsNearClose) return;
@@ -372,13 +371,13 @@ class Lt extends j {
372
371
  if (l < this.minDistance) return;
373
372
  t.coordinates[0].pop();
374
373
  const p = { type: "Polygon", coordinates: [[...t.coordinates[0], [e.lng, e.lat], t.coordinates[0][0]]] };
375
- this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: p }]);
374
+ this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: p }]);
376
375
  }
377
376
  onClick(e) {
378
377
  if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) {
379
378
  if (this.preventNewFeature) return;
380
379
  if (this.startingClick === !1) {
381
- const [t, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
380
+ const [t, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: { mode: this.mode, [P.CLOSING_POINT]: !0 } }]);
382
381
  return this.currentId = t, this.closingPointId = i, this.startingClick = !0, void (this.state !== "drawing" && this.setDrawing());
383
382
  }
384
383
  this.close();
@@ -408,18 +407,18 @@ class Lt extends j {
408
407
  return e.type === "Feature" && e.geometry.type === "Polygon" && e.properties.mode === this.mode ? (t.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, t.polygonFillColor, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, t.polygonFillOpacity, e), t.zIndex = U, t) : (e.type === "Feature" && e.geometry.type === "Point" && e.properties.mode === this.mode && (t.pointWidth = this.getNumericStylingValue(this.styles.closingPointWidth, t.pointWidth, e), t.pointColor = this.getHexColorStylingValue(this.styles.closingPointColor, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.closingPointOutlineColor, t.pointOutlineColor, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.closingPointOutlineWidth, 2, e), t.zIndex = 50), t);
409
408
  }
410
409
  validateFeature(e) {
411
- return this.validateModeFeature(e, (t) => we(t, this.coordinatePrecision));
410
+ return this.validateModeFeature(e, (t) => be(t, this.coordinatePrecision));
412
411
  }
413
412
  afterFeatureUpdated(e) {
414
413
  this.currentId === e.id && (this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.hasLeftStartingPoint = !1);
415
414
  }
416
- }
417
- let B = class {
415
+ };
416
+ class B {
418
417
  constructor({ store: e, mode: t, project: i, unproject: o, pointerDistance: r, coordinatePrecision: n, projection: a }) {
419
418
  this.store = void 0, this.mode = void 0, this.project = void 0, this.unproject = void 0, this.pointerDistance = void 0, this.coordinatePrecision = void 0, this.projection = void 0, this.store = e, this.mode = t, this.project = i, this.unproject = o, this.pointerDistance = r, this.coordinatePrecision = n, this.projection = a;
420
419
  }
421
- };
422
- function Ft({ unproject: s, point: e, pointerDistance: t }) {
420
+ }
421
+ function bt({ unproject: s, point: e, pointerDistance: t }) {
423
422
  const i = t / 2, { x: o, y: r } = e;
424
423
  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])] } };
425
424
  }
@@ -429,19 +428,19 @@ class ie extends B {
429
428
  }
430
429
  create(e) {
431
430
  const { containerX: t, containerY: i } = e;
432
- return Ft({ unproject: this.unproject, point: { x: t, y: i }, pointerDistance: this.pointerDistance });
431
+ return bt({ unproject: this.unproject, point: { x: t, y: i }, pointerDistance: this.pointerDistance });
433
432
  }
434
433
  }
435
- class oe extends B {
434
+ let oe = class extends B {
436
435
  constructor(e) {
437
436
  super(e);
438
437
  }
439
438
  measure(e, t) {
440
439
  const { x: i, y: o } = this.project(t[0], t[1]);
441
- return F({ x: i, y: o }, { x: e.containerX, y: e.containerY });
440
+ return M({ x: i, y: o }, { x: e.containerX, y: e.containerY });
442
441
  }
443
- }
444
- let Oe = class extends B {
442
+ };
443
+ class xe extends B {
445
444
  constructor(e, t, i) {
446
445
  super(e), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => this.getSnappable(o, (r) => !!(r.properties && r.properties.mode === this.mode)).coordinate, this.getSnappableCoordinate = (o, r) => this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode && n.id !== r)).coordinate, this.config = e, this.pixelDistance = t, this.clickBoundingBox = i;
447
446
  }
@@ -460,20 +459,20 @@ let Oe = class extends B {
460
459
  });
461
460
  }), r;
462
461
  }
463
- };
462
+ }
464
463
  function at(s, e, t) {
465
- const i = D(s[0]), o = D(s[1]), r = D(t), n = bt(e), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
464
+ const i = k(s[0]), o = k(s[1]), r = k(t), n = Et(e), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
466
465
  return [V(i + Math.atan2(Math.sin(r) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), V(a)];
467
466
  }
468
- function ue({ x: s, y: e }, t, i) {
469
- const o = D(i);
467
+ function he({ x: s, y: e }, t, i) {
468
+ const o = k(i);
470
469
  return { x: s + t * Math.cos(o), y: e + t * Math.sin(o) };
471
470
  }
472
471
  function lt(s, e) {
473
- const t = D(s[0]), i = D(e[0]), o = D(s[1]), r = D(e[1]), n = Math.sin(i - t) * Math.cos(r), a = Math.cos(o) * Math.sin(r) - Math.sin(o) * Math.cos(r) * Math.cos(i - t);
472
+ const t = k(s[0]), i = k(e[0]), o = k(s[1]), r = k(e[1]), n = Math.sin(i - t) * Math.cos(r), a = Math.cos(o) * Math.sin(r) - Math.sin(o) * Math.cos(r) * Math.cos(i - t);
474
473
  return V(Math.atan2(n, a));
475
474
  }
476
- function R({ x: s, y: e }, { x: t, y: i }) {
475
+ function A({ x: s, y: e }, { x: t, y: i }) {
477
476
  const o = t - s, r = i - e;
478
477
  if (o === 0 && r === 0) return 0;
479
478
  let n = Math.atan2(r, o);
@@ -482,7 +481,7 @@ function R({ x: s, y: e }, { x: t, y: i }) {
482
481
  function H(s) {
483
482
  return (s + 360) % 360;
484
483
  }
485
- function hi(s, e, t) {
484
+ function di(s, e, t) {
486
485
  const i = [], o = s.length;
487
486
  let r, n, a, l = 0;
488
487
  for (let c = 0; c < s.length && !(e >= l && c === s.length - 1); c++) {
@@ -498,13 +497,13 @@ function hi(s, e, t) {
498
497
  const d = s[s.length - 1];
499
498
  return [d, d];
500
499
  }
501
- function me(s) {
500
+ function fe(s) {
502
501
  return s * (Math.PI / 180);
503
502
  }
504
503
  function dt(s) {
505
504
  return s * (180 / Math.PI);
506
505
  }
507
- class ui extends B {
506
+ class ci extends B {
508
507
  constructor(e) {
509
508
  super(e), this.config = void 0, this.config = e;
510
509
  }
@@ -517,7 +516,7 @@ class ui extends B {
517
516
  Number.isInteger(n) || (n = Math.floor(n) + 1);
518
517
  const a = [];
519
518
  for (let d = 0; d < n; d++) {
520
- const c = hi(o, i * d, i * (d + 1));
519
+ const c = di(o, i * d, i * (d + 1));
521
520
  a.push(c);
522
521
  }
523
522
  const l = [];
@@ -526,33 +525,33 @@ class ui extends B {
526
525
  }
527
526
  generateInsertionGeodesicCoordinates(e, t, i) {
528
527
  const o = G(e, t), r = (function(n, a, l) {
529
- const d = [], c = me(n[1]), h = me(n[0]), u = me(a[1]), p = me(a[0]);
528
+ const d = [], c = fe(n[1]), h = fe(n[0]), u = fe(a[1]), p = fe(a[0]);
530
529
  l += 1;
531
530
  const g = 2 * Math.asin(Math.sqrt(Math.sin((u - c) / 2) ** 2 + Math.cos(c) * Math.cos(u) * Math.sin((p - h) / 2) ** 2));
532
531
  if (g === 0 || isNaN(g)) return d;
533
532
  for (let y = 0; y <= l; y++) {
534
- const f = y / l, v = Math.sin((1 - f) * g) / Math.sin(g), C = Math.sin(f * g) / Math.sin(g), m = v * Math.cos(c) * Math.cos(h) + C * Math.cos(u) * Math.cos(p), P = v * Math.cos(c) * Math.sin(h) + C * Math.cos(u) * Math.sin(p), I = v * Math.sin(c) + C * Math.sin(u);
535
- if (isNaN(m) || isNaN(P) || isNaN(I)) continue;
536
- const w = Math.atan2(I, Math.sqrt(m ** 2 + P ** 2)), L = Math.atan2(P, m);
537
- isNaN(w) || isNaN(L) || d.push([dt(L), dt(w)]);
533
+ const f = y / l, v = Math.sin((1 - f) * g) / Math.sin(g), C = Math.sin(f * g) / Math.sin(g), m = v * Math.cos(c) * Math.cos(h) + C * Math.cos(u) * Math.cos(p), I = v * Math.cos(c) * Math.sin(h) + C * Math.cos(u) * Math.sin(p), S = v * Math.sin(c) + C * Math.sin(u);
534
+ if (isNaN(m) || isNaN(I) || isNaN(S)) continue;
535
+ const b = Math.atan2(S, Math.sqrt(m ** 2 + I ** 2)), F = Math.atan2(I, m);
536
+ isNaN(b) || isNaN(F) || d.push([dt(F), dt(b)]);
538
537
  }
539
538
  return d.slice(1, -1);
540
539
  })(e, t, Math.floor(o / i));
541
540
  return this.limitCoordinates(r);
542
541
  }
543
542
  limitCoordinates(e) {
544
- return e.map((t) => [b(t[0], this.config.coordinatePrecision), b(t[1], this.config.coordinatePrecision)]);
543
+ return e.map((t) => [w(t[0], this.config.coordinatePrecision), w(t[1], this.config.coordinatePrecision)]);
545
544
  }
546
545
  }
547
546
  function te(s, e) {
548
547
  return s[0] === e[0] && s[1] === e[1];
549
548
  }
550
- function Re(s, e) {
549
+ function Ae(s, e) {
551
550
  if (s.geometry.type !== "LineString") return { valid: !1, reason: "Feature is not a LineString" };
552
551
  if (s.geometry.coordinates.length < 2) return { valid: !1, reason: "Feature has less than 2 coordinates" };
553
552
  for (let t = 0; t < s.geometry.coordinates.length; t++) {
554
- if (!Ae(s.geometry.coordinates[t])) return { valid: !1, reason: "Feature has invalid coordinates" };
555
- if (!be(s.geometry.coordinates[t], e)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
553
+ if (!Re(s.geometry.coordinates[t])) return { valid: !1, reason: "Feature has invalid coordinates" };
554
+ if (!we(s.geometry.coordinates[t], e)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
556
555
  }
557
556
  return { valid: !0 };
558
557
  }
@@ -566,23 +565,23 @@ function Y(s, e) {
566
565
  })(s, e) / (ct(s) * ct(e));
567
566
  return Math.acos(Math.min(Math.max(t, -1), 1));
568
567
  }
569
- function Fe(s) {
570
- const e = D(s[1]), t = D(s[0]);
568
+ function Me(s) {
569
+ const e = k(s[1]), t = k(s[0]);
571
570
  return [Math.cos(e) * Math.cos(t), Math.cos(e) * Math.sin(t), Math.sin(e)];
572
571
  }
573
572
  function K(s) {
574
573
  const [e, t, i] = s, o = V(Math.asin(i));
575
574
  return [V(Math.atan2(t, e)), o];
576
575
  }
577
- function pi(s, e, t) {
578
- const i = Fe(s), o = Fe(e), r = Fe(t), [n, a, l] = r, [d, c, h] = (function(T, $) {
576
+ function hi(s, e, t) {
577
+ const i = Me(s), o = Me(e), r = Me(t), [n, a, l] = r, [d, c, h] = (function(T, $) {
579
578
  const [Xe, qe, Je] = T, [Ze, Qe, et] = $;
580
579
  return [qe * et - Je * Qe, Je * Ze - Xe * et, Xe * Qe - qe * Ze];
581
- })(i, o), u = c * l - h * a, p = h * n - d * l, g = d * a - c * n, y = g * c - p * h, f = u * h - g * d, v = p * d - u * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(f, 2) + Math.pow(v, 2)), m = [y * C, f * C, v * C], P = [-1 * y * C, -1 * f * C, -1 * v * C], I = Y(i, o), w = Y(i, m), L = Y(o, m), M = Y(i, P), N = Y(o, P);
582
- let k;
583
- return k = w < M && w < N || L < M && L < N ? m : P, Y(i, k) > I || Y(o, k) > I ? G(K(k), K(i)) <= G(K(k), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(k), !1, !1];
580
+ })(i, o), u = c * l - h * a, p = h * n - d * l, g = d * a - c * n, y = g * c - p * h, f = u * h - g * d, v = p * d - u * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(f, 2) + Math.pow(v, 2)), m = [y * C, f * C, v * C], I = [-1 * y * C, -1 * f * C, -1 * v * C], S = Y(i, o), b = Y(i, m), F = Y(o, m), L = Y(i, I), N = Y(o, I);
581
+ let _;
582
+ return _ = b < L && b < N || F < L && F < N ? m : I, Y(i, _) > S || Y(o, _) > S ? G(K(_), K(i)) <= G(K(_), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(_), !1, !1];
584
583
  }
585
- function gi(s, e, t) {
584
+ function ui(s, e, t) {
586
585
  const i = e.x - s.x, o = e.y - s.y, r = Math.max(0, Math.min(1, ((t.x - s.x) * i + (t.y - s.y) * o) / (i * i + o * o)));
587
586
  return { x: s.x + r * i, y: s.y + r * o };
588
587
  }
@@ -590,10 +589,10 @@ class Ge extends B {
590
589
  constructor(e, t, i) {
591
590
  super(e), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => {
592
591
  const r = this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode));
593
- return r.coordinate ? [b(r.coordinate[0], this.config.coordinatePrecision), b(r.coordinate[1], this.config.coordinatePrecision)] : void 0;
592
+ return r.coordinate ? [w(r.coordinate[0], this.config.coordinatePrecision), w(r.coordinate[1], this.config.coordinatePrecision)] : void 0;
594
593
  }, this.getSnappableCoordinate = (o, r) => {
595
594
  const n = this.getSnappable(o, (a) => !!(a.properties && a.properties.mode === this.mode && a.id !== r));
596
- return n.coordinate ? [b(n.coordinate[0], this.config.coordinatePrecision), b(n.coordinate[1], this.config.coordinatePrecision)] : void 0;
595
+ return n.coordinate ? [w(n.coordinate[0], this.config.coordinatePrecision), w(n.coordinate[1], this.config.coordinatePrecision)] : void 0;
597
596
  }, this.config = e, this.pixelDistance = t, this.clickBoundingBox = i;
598
597
  }
599
598
  getSnappable(e, t) {
@@ -613,35 +612,35 @@ class Ge extends B {
613
612
  let g = [1 / 0, 1 / 0], y = 1 / 0, f = 0;
614
613
  for (let v of p) {
615
614
  const C = v[0], m = v[1];
616
- let P, I = 1 / 0;
617
- const w = O(C[0], C[1]), L = O(m[0], m[1]), M = O(u[0], u[1]);
618
- if (C[0] === u[0] && C[1] === u[1]) P = C;
619
- else if (m[0] === u[0] && m[1] === u[1]) P = m;
615
+ let I, S = 1 / 0;
616
+ const b = E(C[0], C[1]), F = E(m[0], m[1]), L = E(u[0], u[1]);
617
+ if (C[0] === u[0] && C[1] === u[1]) I = C;
618
+ else if (m[0] === u[0] && m[1] === u[1]) I = m;
620
619
  else {
621
- const { x: N, y: k } = gi(w, L, M), { lng: T, lat: $ } = A(N, k);
622
- P = [T, $];
620
+ const { x: N, y: _ } = ui(b, F, L), { lng: T, lat: $ } = R(N, _);
621
+ I = [T, $];
623
622
  }
624
- P && (I = F(M, O(P[0], P[1])), I < y && (g = P, y = I, f = p.indexOf(v)));
623
+ I && (S = M(L, E(I[0], I[1])), S < y && (g = I, y = S, f = p.indexOf(v)));
625
624
  }
626
625
  return y === 1 / 0 ? void 0 : { coordinate: g, lineIndex: f, distance: y };
627
626
  })(c, l) : this.config.projection === "globe" && (d = (function(u, p) {
628
627
  let g = [1 / 0, 1 / 0], y = 1 / 0, f = 0;
629
628
  for (let v of p) {
630
629
  const C = v[0], m = v[1];
631
- let P, I = 1 / 0;
632
- C[0] === u[0] && C[1] === u[1] ? P = C : m[0] === u[0] && m[1] === u[1] ? P = m : [P] = pi(C, m, u), P && (I = G(u, P), I < y && (g = P, y = I, f = p.indexOf(v)));
630
+ let I, S = 1 / 0;
631
+ C[0] === u[0] && C[1] === u[1] ? I = C : m[0] === u[0] && m[1] === u[1] ? I = m : [I] = hi(C, m, u), I && (S = G(u, I), S < y && (g = I, y = S, f = p.indexOf(v)));
633
632
  }
634
633
  return y === 1 / 0 ? void 0 : { coordinate: g, distance: y, lineIndex: f };
635
634
  })(c, l)), !d) return;
636
635
  const h = this.pixelDistance.measure(e, d.coordinate);
637
- h < r.minDistance && h < this.pointerDistance && (r.featureId = n.id, r.coordinate = [b(d.coordinate[0], this.config.coordinatePrecision), b(d.coordinate[1], this.config.coordinatePrecision)], r.featureCoordinateIndex = d.lineIndex, r.minDistance = h);
636
+ h < r.minDistance && h < this.pointerDistance && (r.featureId = n.id, r.coordinate = [w(d.coordinate[0], this.config.coordinatePrecision), w(d.coordinate[1], this.config.coordinatePrecision)], r.featureCoordinateIndex = d.lineIndex, r.minDistance = h);
638
637
  }), r;
639
638
  }
640
639
  }
641
- const yi = { cancel: "Escape", finish: "Enter" }, fi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
640
+ const pi = { cancel: "Escape", finish: "Enter" }, gi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
642
641
  class ze extends j {
643
642
  constructor(e) {
644
- super(e, !0), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents = yi, this.snapping = void 0, this.cursors = fi, this.mouseMove = !1, this.insertCoordinates = void 0, this.lastCommittedCoordinates = void 0, this.snappedPointId = void 0, this.lastMouseMoveEvent = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinateSnapping = void 0, this.insertPoint = void 0, this.lineSnapping = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
643
+ super(e, !0), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents = pi, this.snapping = void 0, this.cursors = gi, this.mouseMove = !1, this.insertCoordinates = void 0, this.lastCommittedCoordinates = void 0, this.snappedPointId = void 0, this.lastMouseMoveEvent = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinateSnapping = void 0, this.insertPoint = void 0, this.lineSnapping = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
645
644
  }
646
645
  updateOptions(e) {
647
646
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e != null && e.snapping && (this.snapping = e.snapping), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e != null && e.insertCoordinates && (this.insertCoordinates = e.insertCoordinates), e && e.editable && (this.editable = e.editable);
@@ -651,7 +650,7 @@ class ze extends j {
651
650
  if (t) {
652
651
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: t } }]);
653
652
  else {
654
- const [i] = this.store.create([{ geometry: { type: "Point", coordinates: t }, properties: { mode: this.mode, [S.SNAPPING_POINT]: !0 } }]);
653
+ const [i] = this.store.create([{ geometry: { type: "Point", coordinates: t }, properties: { mode: this.mode, [P.SNAPPING_POINT]: !0 } }]);
655
654
  this.snappedPointId = i;
656
655
  }
657
656
  e.lng = t[0], e.lat = t[1];
@@ -661,7 +660,7 @@ class ze extends j {
661
660
  close() {
662
661
  if (this.currentId === void 0) return;
663
662
  const e = this.store.getGeometryCopy(this.currentId);
664
- e.coordinates.pop(), this.updateGeometries([...e.coordinates], void 0, E.Commit), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
663
+ e.coordinates.pop(), this.updateGeometries([...e.coordinates], void 0, O.Commit), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
665
664
  const t = this.currentId;
666
665
  this.closingPointId && this.store.delete([this.closingPointId]), this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.snappedPointId = void 0, this.lastCommittedCoordinates = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
667
666
  }
@@ -680,26 +679,26 @@ class ze extends j {
680
679
  return this.projection === "globe" ? o = this.insertPoint.generateInsertionGeodesicCoordinates(e, t, i) : this.projection === "web-mercator" && (o = this.insertPoint.generateInsertionCoordinates(e, t, i)), o;
681
680
  }
682
681
  createLine(e) {
683
- const [t] = this.store.create([{ geometry: { type: "LineString", coordinates: [e, e] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
682
+ const [t] = this.store.create([{ geometry: { type: "LineString", coordinates: [e, e] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
684
683
  this.lastCommittedCoordinates = [e, e], this.currentId = t, this.currentCoordinate++, this.setDrawing();
685
684
  }
686
685
  firstUpdateToLine(e) {
687
686
  if (!this.currentId) return;
688
- const t = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...e] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
687
+ const t = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...e] }, properties: { mode: this.mode, [P.CLOSING_POINT]: !0 } }]);
689
688
  this.closingPointId = i, this.setCursor(this.cursors.close);
690
689
  const o = [...t, e];
691
- this.updateGeometries(o, void 0, E.Commit), this.currentCoordinate++;
690
+ this.updateGeometries(o, void 0, O.Commit), this.currentCoordinate++;
692
691
  }
693
692
  updateToLine(e, t) {
694
693
  if (!this.currentId) return;
695
694
  const i = this.store.getGeometryCopy(this.currentId).coordinates, [o, r] = this.lastCommittedCoordinates ? this.lastCommittedCoordinates[this.lastCommittedCoordinates.length - 1] : i[i.length - 2], { x: n, y: a } = this.project(o, r);
696
- if (F({ x: n, y: a }, { x: t.x, y: t.y }) < this.pointerDistance) return void this.close();
695
+ if (M({ x: n, y: a }, { x: t.x, y: t.y }) < this.pointerDistance) return void this.close();
697
696
  this.setCursor(this.cursors.close);
698
697
  const l = [...i, e];
699
- this.updateGeometries(l, i[i.length - 1], E.Commit), this.currentCoordinate++;
698
+ this.updateGeometries(l, i[i.length - 1], O.Commit), this.currentCoordinate++;
700
699
  }
701
700
  registerBehaviors(e) {
702
- this.coordinateSnapping = new Oe(e, new oe(e), new ie(e)), this.insertPoint = new ui(e), this.clickBoundingBox = new ie(e), this.pixelDistance = new oe(e), this.lineSnapping = new Ge(e, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Oe(e, this.pixelDistance, this.clickBoundingBox);
701
+ this.coordinateSnapping = new xe(e, new oe(e), new ie(e)), this.insertPoint = new ci(e), this.clickBoundingBox = new ie(e), this.pixelDistance = new oe(e), this.lineSnapping = new Ge(e, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new xe(e, this.pixelDistance, this.clickBoundingBox);
703
702
  }
704
703
  start() {
705
704
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -714,7 +713,7 @@ class ze extends j {
714
713
  const i = this.store.getGeometryCopy(this.currentId).coordinates;
715
714
  if (i.pop(), this.closingPointId) {
716
715
  const [r, n] = i[i.length - 1], { x: a, y: l } = this.project(r, n);
717
- F({ x: a, y: l }, { x: e.containerX, y: e.containerY }) < this.pointerDistance && this.setCursor(this.cursors.close);
716
+ M({ x: a, y: l }, { x: e.containerX, y: e.containerY }) < this.pointerDistance && this.setCursor(this.cursors.close);
718
717
  }
719
718
  let o = [...i, t];
720
719
  if (this.insertCoordinates && this.currentId && this.lastCommittedCoordinates) {
@@ -724,7 +723,7 @@ class ze extends j {
724
723
  o = [...this.lastCommittedCoordinates.slice(0, -1), ...a, t];
725
724
  }
726
725
  }
727
- this.updateGeometries(o, void 0, E.Provisional);
726
+ this.updateGeometries(o, void 0, O.Provisional);
728
727
  }
729
728
  onRightClick(e) {
730
729
  if (!this.editable || this.state !== "started") return;
@@ -733,7 +732,7 @@ class ze extends j {
733
732
  const o = this.store.getGeometryCopy(t);
734
733
  let r;
735
734
  if (o.type === "LineString" && (r = o.coordinates, !(r.length <= 2))) {
736
- if (r.splice(i, 1), this.validate && !this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid) return;
735
+ if (r.splice(i, 1), this.validate && !this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Commit }).valid) return;
737
736
  this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: t, geometry: o }]), this.onFinish(t, { mode: this.mode, action: "edit" });
738
737
  }
739
738
  }
@@ -761,7 +760,7 @@ class ze extends j {
761
760
  }
762
761
  if (this.editedFeatureId && i) {
763
762
  if (!this.editedPointId) {
764
- const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [S.EDITED]: !0 } }]);
763
+ const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [P.EDITED]: !0 } }]);
765
764
  this.editedPointId = o;
766
765
  }
767
766
  this.setCursor(this.cursors.dragStart), t(!1);
@@ -772,10 +771,10 @@ class ze extends j {
772
771
  const i = this.store.getGeometryCopy(this.editedFeatureId);
773
772
  this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? i.coordinates[this.editedFeatureCoordinateIndex] = [e.lng, e.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates.splice(this.editedInsertIndex, 0, [e.lng, e.lat]), this.editedFeatureCoordinateIndex++);
774
773
  const o = { type: "LineString", coordinates: i.coordinates };
775
- this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
774
+ this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !0 }]));
776
775
  }
777
776
  onDragEnd(e, t) {
778
- this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, t(!0));
777
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, t(!0));
779
778
  }
780
779
  cleanUp() {
781
780
  const e = this.currentId, t = this.closingPointId, i = this.snappedPointId;
@@ -789,13 +788,13 @@ class ze extends j {
789
788
  const t = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0, markerUrl: void 0, markerHeight: void 0, markerWidth: void 0 });
790
789
  if (e.type === "Feature" && e.geometry.type === "LineString" && e.properties.mode === this.mode) return t.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, t.lineStringColor, e), t.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, t.lineStringWidth, e), t.zIndex = U, t;
791
790
  if (e.type === "Feature" && e.geometry.type === "Point" && e.properties.mode === this.mode) {
792
- const i = e.properties[S.CLOSING_POINT];
791
+ const i = e.properties[P.CLOSING_POINT];
793
792
  return t.pointColor = this.getHexColorStylingValue(i ? this.styles.closingPointColor : this.styles.snappingPointColor, t.pointColor, e), t.pointWidth = this.getNumericStylingValue(i ? this.styles.closingPointWidth : this.styles.snappingPointWidth, t.pointWidth, e), t.pointOutlineColor = this.getHexColorStylingValue(i ? this.styles.closingPointOutlineColor : this.styles.snappingPointOutlineColor, "#ffffff", e), t.pointOutlineWidth = this.getNumericStylingValue(i ? this.styles.closingPointOutlineWidth : this.styles.snappingPointOutlineWidth, 2, e), t.zIndex = 50, t;
794
793
  }
795
794
  return t;
796
795
  }
797
796
  validateFeature(e) {
798
- return this.validateModeFeature(e, (t) => Re(t, this.coordinatePrecision));
797
+ return this.validateModeFeature(e, (t) => Ae(t, this.coordinatePrecision));
799
798
  }
800
799
  lineStringFilter(e) {
801
800
  return !!(e.geometry.type === "LineString" && e.properties && e.properties.mode === this.mode);
@@ -813,14 +812,14 @@ class ze extends j {
813
812
  this.editedFeatureId === e.id && this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0), this.snappedPointId && this.lastMouseMoveEvent && this.updateSnappedCoordinate(this.lastMouseMoveEvent), this.currentId === e.id && (this.closingPointId && (this.store.delete([this.closingPointId]), this.closingPointId = void 0), this.currentCoordinate = 0, this.currentId = void 0, this.state === "drawing" && this.setStarted());
814
813
  }
815
814
  }
816
- const mi = "Feature is not a Point", vi = "Feature has invalid coordinates", Ci = "Feature has coordinates with excessive precision";
815
+ const yi = "Feature is not a Point", fi = "Feature has invalid coordinates", mi = "Feature has coordinates with excessive precision";
817
816
  function Ve(s, e) {
818
- return s.geometry.type !== "Point" ? { valid: !1, reason: mi } : Ae(s.geometry.coordinates) ? be(s.geometry.coordinates, e) ? { valid: !0 } : { valid: !1, reason: Ci } : { valid: !1, reason: vi };
817
+ return s.geometry.type !== "Point" ? { valid: !1, reason: yi } : Re(s.geometry.coordinates) ? we(s.geometry.coordinates, e) ? { valid: !0 } : { valid: !1, reason: mi } : { valid: !1, reason: fi };
819
818
  }
820
- const Pi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
819
+ const vi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
821
820
  class $e extends j {
822
821
  constructor(e) {
823
- super(e, !0), this.mode = "point", this.cursors = Pi, this.editable = !1, this.editedFeatureId = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
822
+ super(e, !0), this.mode = "point", this.cursors = vi, this.editable = !1, this.editedFeatureId = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
824
823
  }
825
824
  updateOptions(e) {
826
825
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e != null && e.editable && (this.editable = e.editable);
@@ -853,10 +852,10 @@ class $e extends j {
853
852
  }
854
853
  }
855
854
  onDrag(e, t) {
856
- this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
855
+ this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !0 }])));
857
856
  }
858
857
  onDragEnd(e, t) {
859
- this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && 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: S.EDITED, value: !1 }]), this.editedFeatureId = void 0, t(!0));
858
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && 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: P.EDITED, value: !1 }]), this.editedFeatureId = void 0, t(!0));
860
859
  }
861
860
  registerBehaviors(e) {
862
861
  this.pixelDistance = new oe(e), this.clickBoundingBox = new ie(e);
@@ -874,7 +873,7 @@ class $e extends j {
874
873
  }
875
874
  onLeftClick(e) {
876
875
  const t = { type: "Point", coordinates: [e.lng, e.lat] }, i = { mode: this.mode };
877
- if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
876
+ if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Finish }).valid) return;
878
877
  const [o] = this.store.create([{ geometry: t, properties: i }]);
879
878
  this.onFinish(o, { mode: this.mode, action: "draw" });
880
879
  }
@@ -898,7 +897,7 @@ class $e extends j {
898
897
  this.editedFeatureId === e.id && (this.editedFeatureId = void 0, this.setCursor(this.cursors.create));
899
898
  }
900
899
  }
901
- class Si extends B {
900
+ class Ci extends B {
902
901
  constructor(e, t) {
903
902
  super(e), this.config = void 0, this.pixelDistance = void 0, this._startEndPoints = [], this.config = e, this.pixelDistance = t;
904
903
  }
@@ -910,7 +909,7 @@ class Si extends B {
910
909
  create(e, t) {
911
910
  if (this.ids.length) throw new Error("Opening and closing points already created");
912
911
  if (e.length <= 3) throw new Error("Requires at least 4 coordinates");
913
- this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: e[0] }, properties: { mode: t, [S.CLOSING_POINT]: !0 } }, { geometry: { type: "Point", coordinates: e[e.length - 2] }, properties: { mode: t, [S.CLOSING_POINT]: !0 } }]);
912
+ this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: e[0] }, properties: { mode: t, [P.CLOSING_POINT]: !0 } }, { geometry: { type: "Point", coordinates: e[e.length - 2] }, properties: { mode: t, [P.CLOSING_POINT]: !0 } }]);
914
913
  }
915
914
  delete() {
916
915
  this.ids.length && (this.store.delete(this.ids), this._startEndPoints = []);
@@ -924,7 +923,7 @@ class Si extends B {
924
923
  return { isClosing: o < this.pointerDistance, isPreviousClosing: r < this.pointerDistance };
925
924
  }
926
925
  }
927
- class Mt extends B {
926
+ class Ft extends B {
928
927
  constructor(e) {
929
928
  super(e);
930
929
  }
@@ -965,10 +964,10 @@ class Mt extends B {
965
964
  if (i.coordinatePointIds) return i.coordinatePointIds.map((o, r) => ({ id: o, geometry: x({}, this.store.getGeometryCopy(o), { coordinates: t[r] }) }));
966
965
  }
967
966
  createPoints(e, t, i) {
968
- return this.store.create(e.map((o, r) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: t, [S.COORDINATE_POINT]: !0, [S.COORDINATE_POINT_FEATURE_ID]: i, index: r } })));
967
+ return this.store.create(e.map((o, r) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: t, [P.COORDINATE_POINT]: !0, [P.COORDINATE_POINT_FEATURE_ID]: i, index: r } })));
969
968
  }
970
969
  setFeatureCoordinatePoints(e, t) {
971
- this.store.updateProperty([{ id: e, property: S.COORDINATE_POINT_IDS, value: t }]);
970
+ this.store.updateProperty([{ id: e, property: P.COORDINATE_POINT_IDS, value: t }]);
972
971
  }
973
972
  deleteCoordinatePoints(e) {
974
973
  const t = e.filter((i) => this.store.has(i));
@@ -979,10 +978,10 @@ class Mt extends B {
979
978
  t && (this.deleteCoordinatePoints(t), this.setFeatureCoordinatePoints(e, null));
980
979
  }
981
980
  }
982
- const Ii = { cancel: "Escape", finish: "Enter" }, xi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
983
- class Dt extends j {
981
+ const Pi = { cancel: "Escape", finish: "Enter" }, Ii = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
982
+ class Mt extends j {
984
983
  constructor(e) {
985
- super(e, !0), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ii, this.cursors = xi, this.mouseMove = !1, this.showCoordinatePoints = !1, this.lastMouseMoveEvent = void 0, this.snapping = void 0, this.snappedPointId = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinatePoints = void 0, this.lineSnapping = void 0, this.coordinateSnapping = void 0, this.pixelDistance = void 0, this.closingPoints = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
984
+ super(e, !0), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Pi, this.cursors = Ii, this.mouseMove = !1, this.showCoordinatePoints = !1, this.lastMouseMoveEvent = void 0, this.snapping = void 0, this.snappedPointId = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinatePoints = void 0, this.lineSnapping = void 0, this.coordinateSnapping = void 0, this.pixelDistance = void 0, this.closingPoints = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
986
985
  }
987
986
  updateOptions(e) {
988
987
  if (super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e != null && e.snapping && (this.snapping = e.snapping), e?.editable !== void 0 && (this.editable = e.editable), e?.pointerEvents !== void 0 && (this.pointerEvents = e.pointerEvents), e?.showCoordinatePoints !== void 0) {
@@ -990,7 +989,7 @@ class Dt extends j {
990
989
  this.coordinatePoints.createOrUpdate(t);
991
990
  });
992
991
  else if (this.coordinatePoints && this.showCoordinatePoints === !1) {
993
- const t = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[S.COORDINATE_POINT_IDS]);
992
+ const t = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[P.COORDINATE_POINT_IDS]);
994
993
  this.coordinatePoints.deletePointsByFeatureIds(t.map((i) => i.id));
995
994
  }
996
995
  }
@@ -998,16 +997,16 @@ class Dt extends j {
998
997
  close() {
999
998
  if (this.currentId === void 0) return;
1000
999
  const e = this.store.getGeometryCopy(this.currentId).coordinates[0];
1001
- if (e.length < 5 || !this.updatePolygonGeometry([...e.slice(0, -2), e[0]], E.Finish)) return;
1000
+ if (e.length < 5 || !this.updatePolygonGeometry([...e.slice(0, -2), e[0]], O.Finish)) return;
1002
1001
  const t = this.currentId;
1003
1002
  if (this.currentId) {
1004
- const i = ye(this.store.getGeometryCopy(this.currentId));
1005
- i && (this.store.updateGeometry([{ id: this.currentId, geometry: i }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.currentId)), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }, { id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: void 0 }, { id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: void 0 }]);
1003
+ const i = ge(this.store.getGeometryCopy(this.currentId));
1004
+ i && (this.store.updateGeometry([{ id: this.currentId, geometry: i }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.currentId)), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }, { id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: void 0 }, { id: this.currentId, property: P.PROVISIONAL_COORDINATE_COUNT, value: void 0 }]);
1006
1005
  }
1007
1006
  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(t, { mode: this.mode, action: "draw" });
1008
1007
  }
1009
1008
  registerBehaviors(e) {
1010
- this.clickBoundingBox = new ie(e), this.pixelDistance = new oe(e), this.lineSnapping = new Ge(e, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Oe(e, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new Si(e, this.pixelDistance), this.coordinatePoints = new Mt(e);
1009
+ this.clickBoundingBox = new ie(e), this.pixelDistance = new oe(e), this.lineSnapping = new Ge(e, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new xe(e, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new Ci(e, this.pixelDistance), this.coordinatePoints = new Ft(e);
1011
1010
  }
1012
1011
  start() {
1013
1012
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -1020,7 +1019,7 @@ class Dt extends j {
1020
1019
  if (t) {
1021
1020
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: t } }]);
1022
1021
  else {
1023
- const [i] = this.store.create([{ geometry: { type: "Point", coordinates: t }, properties: { mode: this.mode, [S.SNAPPING_POINT]: !0 } }]);
1022
+ const [i] = this.store.create([{ geometry: { type: "Point", coordinates: t }, properties: { mode: this.mode, [P.SNAPPING_POINT]: !0 } }]);
1024
1023
  this.snappedPointId = i;
1025
1024
  }
1026
1025
  e.lng = t[0], e.lat = t[1];
@@ -1038,7 +1037,7 @@ class Dt extends j {
1038
1037
  const { isClosing: o, isPreviousClosing: r } = this.closingPoints.isClosingPoint(e);
1039
1038
  r || o ? (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.setCursor(this.cursors.close), i = [...t.slice(0, -2), t[0], t[0]]) : i = [...t.slice(0, -2), [e.lng, e.lat], t[0]];
1040
1039
  }
1041
- this.store.updateProperty([{ id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, E.Provisional);
1040
+ this.store.updateProperty([{ id: this.currentId, property: P.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, O.Provisional);
1042
1041
  }
1043
1042
  updatePolygonGeometry(e, t) {
1044
1043
  if (!this.currentId) return !1;
@@ -1067,26 +1066,26 @@ class Dt extends j {
1067
1066
  if (!t || i === void 0) return;
1068
1067
  const o = this.store.getGeometryCopy(t);
1069
1068
  let r;
1070
- o.type === "Polygon" && (r = o.coordinates[0], r.length <= 4 || (o.type !== "Polygon" || i !== 0 && i !== r.length - 1 ? r.splice(i, 1) : (r.shift(), r.pop(), r.push([r[0][0], r[0][1]])), (!this.validate || this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid) && (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: t, geometry: o }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(t), this.onFinish(t, { mode: this.mode, action: "edit" }))));
1069
+ o.type === "Polygon" && (r = o.coordinates[0], r.length <= 4 || (o.type !== "Polygon" || i !== 0 && i !== r.length - 1 ? r.splice(i, 1) : (r.shift(), r.pop(), r.push([r[0][0], r[0][1]])), (!this.validate || this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Commit }).valid) && (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: t, geometry: o }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(t), this.onFinish(t, { mode: this.mode, action: "edit" }))));
1071
1070
  }
1072
1071
  onLeftClick(e) {
1073
1072
  if (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.currentCoordinate === 0) {
1074
1073
  const t = this.snapCoordinate(e);
1075
1074
  t && (e.lng = t[0], e.lat = t[1]);
1076
- const [i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0, [S.COMMITTED_COORDINATE_COUNT]: this.currentCoordinate + 1, [S.PROVISIONAL_COORDINATE_COUNT]: this.currentCoordinate + 1 } }]);
1075
+ const [i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0, [P.COMMITTED_COORDINATE_COUNT]: this.currentCoordinate + 1, [P.PROVISIONAL_COORDINATE_COUNT]: this.currentCoordinate + 1 } }]);
1077
1076
  this.currentId = i, this.currentCoordinate++, this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(i), this.setDrawing();
1078
1077
  } else if (this.currentCoordinate === 1 && this.currentId) {
1079
1078
  const t = this.snapCoordinate(e);
1080
1079
  t && (e.lng = t[0], e.lat = t[1]);
1081
1080
  const i = this.store.getGeometryCopy(this.currentId);
1082
- if (te([e.lng, e.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], i.coordinates[0][0]], E.Commit)) return;
1083
- this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1081
+ if (te([e.lng, e.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], i.coordinates[0][0]], O.Commit)) return;
1082
+ this.store.updateProperty([{ id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1084
1083
  } else if (this.currentCoordinate === 2 && this.currentId) {
1085
1084
  const t = this.snapCoordinate(e);
1086
1085
  t && (e.lng = t[0], e.lat = t[1]);
1087
1086
  const i = this.store.getGeometryCopy(this.currentId).coordinates[0];
1088
- if (te([e.lng, e.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [e.lng, e.lat], [e.lng, e.lat], i[0]], E.Commit)) return;
1089
- this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1087
+ if (te([e.lng, e.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [e.lng, e.lat], [e.lng, e.lat], i[0]], O.Commit)) return;
1088
+ this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.store.updateProperty([{ id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1090
1089
  } else if (this.currentId) {
1091
1090
  const t = this.store.getGeometryCopy(this.currentId).coordinates[0], { isClosing: i, isPreviousClosing: o } = this.closingPoints.isClosingPoint(e);
1092
1091
  if (o || i) this.close();
@@ -1096,8 +1095,8 @@ class Dt extends j {
1096
1095
  const n = /* @__PURE__ */ (function(a = [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]) {
1097
1096
  return { type: "Feature", geometry: { type: "Polygon", coordinates: a }, properties: {} };
1098
1097
  })([[...t.slice(0, -1), [e.lng, e.lat], t[0]]]);
1099
- if (!this.updatePolygonGeometry(n.geometry.coordinates[0], E.Commit)) return;
1100
- this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1098
+ if (!this.updatePolygonGeometry(n.geometry.coordinates[0], O.Commit)) return;
1099
+ this.store.updateProperty([{ id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1101
1100
  }
1102
1101
  }
1103
1102
  }
@@ -1120,7 +1119,7 @@ class Dt extends j {
1120
1119
  }
1121
1120
  if (this.editedFeatureId && i) {
1122
1121
  if (!this.editedPointId) {
1123
- const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [S.EDITED]: !0 } }]);
1122
+ const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [P.EDITED]: !0 } }]);
1124
1123
  this.editedPointId = o;
1125
1124
  }
1126
1125
  this.setCursor(this.cursors.dragStart), t(!1);
@@ -1131,10 +1130,10 @@ class Dt extends j {
1131
1130
  const i = this.store.getGeometryCopy(this.editedFeatureId), o = i.coordinates[0];
1132
1131
  this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? this.editedFeatureCoordinateIndex === 0 || this.editedFeatureCoordinateIndex === i.coordinates[0].length - 1 ? (o[0] = [e.lng, e.lat], o[o.length - 1] = [e.lng, e.lat]) : o[this.editedFeatureCoordinateIndex] = [e.lng, e.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates[0].splice(this.editedInsertIndex, 0, [e.lng, e.lat]), this.editedFeatureCoordinateIndex++);
1133
1132
  const r = { type: "Polygon", coordinates: i.coordinates };
1134
- this.validate && !this.validate({ type: "Feature", geometry: r, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: r }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
1133
+ this.validate && !this.validate({ type: "Feature", geometry: r, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: r }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !0 }]));
1135
1134
  }
1136
1135
  onDragEnd(e, t) {
1137
- this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, t(!0));
1136
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, t(!0));
1138
1137
  }
1139
1138
  cleanUp() {
1140
1139
  const e = this.currentId, t = this.snappedPointId, i = this.editedPointId;
@@ -1149,7 +1148,7 @@ class Dt extends j {
1149
1148
  if (e.properties.mode === this.mode) {
1150
1149
  if (e.geometry.type === "Polygon") return t.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, t.polygonFillColor, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, t.polygonFillOpacity, e), t.zIndex = U, t;
1151
1150
  if (e.geometry.type === "Point") {
1152
- const i = e.properties[S.EDITED], o = e.properties[S.COORDINATE_POINT], r = i ? "editedPoint" : e.properties[S.CLOSING_POINT] ? "closingPoint" : e.properties[S.SNAPPING_POINT] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1151
+ const i = e.properties[P.EDITED], o = e.properties[P.COORDINATE_POINT], r = i ? "editedPoint" : e.properties[P.CLOSING_POINT] ? "closingPoint" : e.properties[P.SNAPPING_POINT] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1153
1152
  if (!r) return t;
1154
1153
  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 } };
1155
1154
  return t.pointWidth = this.getNumericStylingValue(n[r].width, t.pointWidth, e), t.pointColor = this.getHexColorStylingValue(n[r].color, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(n[r].outlineColor, t.pointOutlineColor, e), t.pointOutlineWidth = this.getNumericStylingValue(n[r].outlineWidth, 2, e), t.zIndex = i ? 40 : o ? 20 : 30, t;
@@ -1164,13 +1163,13 @@ class Dt extends j {
1164
1163
  this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(e.id), this.editedFeatureId === e.id && this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0), this.snappedPointId && this.lastMouseMoveEvent && this.updateSnappedCoordinate(this.lastMouseMoveEvent), this.currentId === e.id && (this.currentCoordinate = 0, this.currentId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted());
1165
1164
  }
1166
1165
  validateFeature(e) {
1167
- return this.validateModeFeature(e, (t) => we(t, this.coordinatePrecision));
1166
+ return this.validateModeFeature(e, (t) => be(t, this.coordinatePrecision));
1168
1167
  }
1169
1168
  }
1170
- const Oi = { cancel: "Escape", finish: "Enter" }, Ei = { start: "crosshair" };
1171
- class kt extends j {
1169
+ const Si = { cancel: "Escape", finish: "Enter" }, xi = { start: "crosshair" };
1170
+ class Lt extends j {
1172
1171
  constructor(e) {
1173
- super(e, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = Oi, this.cursors = Ei, this.updateOptions(e);
1172
+ super(e, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = Si, this.cursors = xi, this.updateOptions(e);
1174
1173
  }
1175
1174
  updateOptions(e) {
1176
1175
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents));
@@ -1185,8 +1184,8 @@ class kt extends j {
1185
1184
  close() {
1186
1185
  const e = this.currentRectangleId;
1187
1186
  if (e) {
1188
- const t = ye(this.store.getGeometryCopy(e));
1189
- t && this.store.updateGeometry([{ id: e, geometry: t }]), this.store.updateProperty([{ id: e, property: S.CURRENTLY_DRAWING, value: void 0 }]);
1187
+ const t = ge(this.store.getGeometryCopy(e));
1188
+ t && this.store.updateGeometry([{ id: e, geometry: t }]), this.store.updateProperty([{ id: e, property: P.CURRENTLY_DRAWING, value: void 0 }]);
1190
1189
  }
1191
1190
  this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), e !== void 0 && this.onFinish(e, { mode: this.mode, action: "draw" });
1192
1191
  }
@@ -1199,12 +1198,12 @@ class kt extends j {
1199
1198
  onClick(e) {
1200
1199
  if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) if (this.clickCount === 0) {
1201
1200
  this.center = [e.lng, e.lat];
1202
- const [t] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
1201
+ const [t] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
1203
1202
  this.currentRectangleId = t, this.clickCount++, this.setDrawing();
1204
- } else this.updateRectangle(e, E.Finish), this.close();
1203
+ } else this.updateRectangle(e, O.Finish), this.close();
1205
1204
  }
1206
1205
  onMouseMove(e) {
1207
- this.updateRectangle(e, E.Provisional);
1206
+ this.updateRectangle(e, O.Provisional);
1208
1207
  }
1209
1208
  onKeyDown() {
1210
1209
  }
@@ -1226,7 +1225,7 @@ class kt extends j {
1226
1225
  return e.type === "Feature" && e.geometry.type === "Polygon" && e.properties.mode === this.mode && (t.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, t.polygonFillColor, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, t.polygonFillOpacity, e), t.zIndex = U), t;
1227
1226
  }
1228
1227
  validateFeature(e) {
1229
- return this.validateModeFeature(e, (t) => ge(t, this.coordinatePrecision));
1228
+ return this.validateModeFeature(e, (t) => pe(t, this.coordinatePrecision));
1230
1229
  }
1231
1230
  afterFeatureUpdated(e) {
1232
1231
  this.currentRectangleId === e.id && (this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted());
@@ -1271,50 +1270,50 @@ class ee extends j {
1271
1270
  validateFeature(e) {
1272
1271
  const t = super.validateFeature(e);
1273
1272
  if (t.valid) {
1274
- const i = e, o = Ve(i, this.coordinatePrecision).valid || we(i, this.coordinatePrecision).valid || Re(i, this.coordinatePrecision).valid;
1273
+ const i = e, o = Ve(i, this.coordinatePrecision).valid || be(i, this.coordinatePrecision).valid || Ae(i, this.coordinatePrecision).valid;
1275
1274
  return o ? { valid: !0 } : { valid: o, reason: "Feature is not a valid Point, Polygon or LineString feature" };
1276
1275
  }
1277
1276
  return t;
1278
1277
  }
1279
1278
  }
1280
1279
  function Ne(s, e) {
1281
- const t = s, i = e, o = D(t[1]), r = D(i[1]);
1282
- let n = D(i[0] - t[0]);
1280
+ const t = s, i = e, o = k(t[1]), r = k(i[1]);
1281
+ let n = k(i[0] - t[0]);
1283
1282
  n > Math.PI && (n -= 2 * Math.PI), n < -Math.PI && (n += 2 * Math.PI);
1284
1283
  const a = Math.log(Math.tan(r / 2 + Math.PI / 4) / Math.tan(o / 2 + Math.PI / 4)), l = (V(Math.atan2(n, a)) + 360) % 360;
1285
1284
  return l > 180 ? -(360 - l) : l;
1286
1285
  }
1287
- function _t(s, e, t) {
1286
+ function Dt(s, e, t) {
1288
1287
  let i = e;
1289
1288
  e < 0 && (i = -Math.abs(i));
1290
- const o = i / Et, r = s[0] * Math.PI / 180, n = D(s[1]), a = D(t), l = o * Math.cos(a);
1289
+ const o = i / xt, r = s[0] * Math.PI / 180, n = k(s[1]), a = k(t), l = o * Math.cos(a);
1291
1290
  let d = n + l;
1292
1291
  Math.abs(d) > Math.PI / 2 && (d = d > 0 ? Math.PI - d : -Math.PI - d);
1293
1292
  const c = Math.log(Math.tan(d / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), h = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), u = [(180 * (r + o * Math.sin(a) / h) / Math.PI + 540) % 360 - 180, 180 * d / Math.PI];
1294
1293
  return u[0] += u[0] - s[0] > 180 ? -360 : s[0] - u[0] > 180 ? 360 : 0, u;
1295
1294
  }
1296
- function Nt(s, e, t, i, o) {
1295
+ function kt(s, e, t, i, o) {
1297
1296
  const r = i(s[0], s[1]), n = i(e[0], e[1]), { lng: a, lat: l } = o((r.x + n.x) / 2, (r.y + n.y) / 2);
1298
- return [b(a, t), b(l, t)];
1297
+ return [w(a, t), w(l, t)];
1299
1298
  }
1300
- function bi(s, e, t) {
1301
- const i = _t(s, 1e3 * G(s, e) / 2, Ne(s, e));
1302
- return [b(i[0], t), b(i[1], t)];
1299
+ function Ei(s, e, t) {
1300
+ const i = Dt(s, 1e3 * G(s, e) / 2, Ne(s, e));
1301
+ return [w(i[0], t), w(i[1], t)];
1303
1302
  }
1304
1303
  function ht({ featureCoords: s, precision: e, unproject: t, project: i, projection: o }) {
1305
1304
  const r = [];
1306
1305
  for (let n = 0; n < s.length - 1; n++) {
1307
1306
  let a;
1308
- if (o === "web-mercator") a = Nt(s[n], s[n + 1], e, i, t);
1307
+ if (o === "web-mercator") a = kt(s[n], s[n + 1], e, i, t);
1309
1308
  else {
1310
1309
  if (o !== "globe") throw new Error("Invalid projection");
1311
- a = bi(s[n], s[n + 1], e);
1310
+ a = Ei(s[n], s[n + 1], e);
1312
1311
  }
1313
1312
  r.push(a);
1314
1313
  }
1315
1314
  return r;
1316
1315
  }
1317
- class wi extends B {
1316
+ class Oi extends B {
1318
1317
  constructor(e, t, i) {
1319
1318
  super(e), this.config = void 0, this.selectionPointBehavior = void 0, this.coordinatePointBehavior = void 0, this._midPoints = [], this.config = e, this.selectionPointBehavior = t, this.coordinatePointBehavior = i;
1320
1319
  }
@@ -1325,13 +1324,13 @@ class wi extends B {
1325
1324
  }
1326
1325
  insert(e, t, i) {
1327
1326
  const o = this.store.getGeometryCopy(t), { midPointFeatureId: r, midPointSegment: n } = this.store.getPropertiesCopy(t), a = this.store.getGeometryCopy(r), l = a.type === "Polygon" ? a.coordinates[0] : a.coordinates;
1328
- l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: r, geometry: a }]), this.store.getPropertiesCopy(e)[S.COORDINATE_POINT_IDS] && this.coordinatePointBehavior.createOrUpdate(e), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, r, i), this.selectionPointBehavior.create(l, a.type, r);
1327
+ l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: r, geometry: a }]), this.store.getPropertiesCopy(e)[P.COORDINATE_POINT_IDS] && this.coordinatePointBehavior.createOrUpdate(e), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, r, i), this.selectionPointBehavior.create(l, a.type, r);
1329
1328
  }
1330
1329
  create(e, t, i) {
1331
1330
  if (!this.store.has(t)) throw new Error("Store does not have feature with this id");
1332
1331
  this._midPoints = this.store.create((function(o, r, n, a, l, d) {
1333
1332
  return ht({ featureCoords: o, precision: n, project: a, unproject: l, projection: d }).map((c, h) => ({ geometry: { type: "Point", coordinates: c }, properties: r(h) }));
1334
- })(e, (o) => ({ mode: this.mode, [_.MID_POINT]: !0, midPointSegment: o, midPointFeatureId: t }), i, this.config.project, this.config.unproject, this.projection));
1333
+ })(e, (o) => ({ mode: this.mode, [D.MID_POINT]: !0, midPointSegment: o, midPointFeatureId: t }), i, this.config.project, this.config.unproject, this.projection));
1335
1334
  }
1336
1335
  delete() {
1337
1336
  this._midPoints.length && (this.store.delete(this._midPoints), this._midPoints = []);
@@ -1340,7 +1339,7 @@ class wi extends B {
1340
1339
  if (this._midPoints.length !== 0) return ht({ featureCoords: e, precision: this.coordinatePrecision, project: this.config.project, unproject: this.config.unproject, projection: this.config.projection }).map((t, i) => ({ id: this._midPoints[i], geometry: { type: "Point", coordinates: t } }));
1341
1340
  }
1342
1341
  }
1343
- class Li extends B {
1342
+ class wi extends B {
1344
1343
  constructor(e) {
1345
1344
  super(e), this._selectionPoints = [];
1346
1345
  }
@@ -1354,7 +1353,7 @@ class Li extends B {
1354
1353
  const a = [], l = r === "Polygon" ? o.length - 1 : o.length;
1355
1354
  for (let d = 0; d < l; d++) a.push({ geometry: { type: "Point", coordinates: o[d] }, properties: n(d) });
1356
1355
  return a;
1357
- })(e, t, (o) => ({ mode: this.mode, index: o, [_.SELECTION_POINT]: !0, [_.SELECTION_POINT_FEATURE_ID]: i })));
1356
+ })(e, t, (o) => ({ mode: this.mode, index: o, [D.SELECTION_POINT]: !0, [D.SELECTION_POINT_FEATURE_ID]: i })));
1358
1357
  }
1359
1358
  delete() {
1360
1359
  this.ids.length && (this.store.delete(this.ids), this._selectionPoints = []);
@@ -1366,7 +1365,7 @@ class Li extends B {
1366
1365
  if (this._selectionPoints[e] !== void 0) return { id: this._selectionPoints[e], geometry: { type: "Point", coordinates: t } };
1367
1366
  }
1368
1367
  }
1369
- function Tt(s, e) {
1368
+ function _t(s, e) {
1370
1369
  let t = !1;
1371
1370
  for (let n = 0, a = e.length; n < a; n++) {
1372
1371
  const l = e[n];
@@ -1384,7 +1383,7 @@ const Te = (s, e, t) => {
1384
1383
  return d = Math.max(0, Math.min(1, d)), o(r, { x: n.x + d * (a.x - n.x), y: n.y + d * (a.y - n.y) });
1385
1384
  })(s, e, t));
1386
1385
  };
1387
- class Fi extends B {
1386
+ class bi extends B {
1388
1387
  constructor(e, t, i) {
1389
1388
  super(e), this.config = void 0, this.createClickBoundingBox = void 0, this.pixelDistance = void 0, this.config = e, this.createClickBoundingBox = t, this.pixelDistance = i;
1390
1389
  }
@@ -1394,9 +1393,9 @@ class Fi extends B {
1394
1393
  for (let u = 0; u < h.length; u++) {
1395
1394
  const p = h[u], g = p.geometry;
1396
1395
  if (g.type === "Point") {
1397
- if (p.properties.selectionPoint || p.properties.coordinatePoint || !t && p.properties[_.MID_POINT]) continue;
1396
+ if (p.properties.selectionPoint || p.properties.coordinatePoint || !t && p.properties[D.MID_POINT]) continue;
1398
1397
  const y = this.pixelDistance.measure(e, g.coordinates);
1399
- p.properties[_.MID_POINT] && y < this.pointerDistance && y < d ? (d = y, r = p) : !p.properties[_.MID_POINT] && y < this.pointerDistance && y < a && (a = y, i = p);
1398
+ p.properties[D.MID_POINT] && y < this.pointerDistance && y < d ? (d = y, r = p) : !p.properties[D.MID_POINT] && y < this.pointerDistance && y < a && (a = y, i = p);
1400
1399
  } else if (g.type === "LineString") {
1401
1400
  if (i) continue;
1402
1401
  for (let y = 0; y < g.coordinates.length - 1; y++) {
@@ -1405,13 +1404,13 @@ class Fi extends B {
1405
1404
  }
1406
1405
  } else if (g.type === "Polygon") {
1407
1406
  if (i || o) continue;
1408
- Tt([e.lng, e.lat], g.coordinates) && (n = p);
1407
+ _t([e.lng, e.lat], g.coordinates) && (n = p);
1409
1408
  }
1410
1409
  }
1411
1410
  return { clickedFeature: i || o || n, clickedMidPoint: r };
1412
1411
  }
1413
1412
  }
1414
- class Mi extends B {
1413
+ class Fi extends B {
1415
1414
  constructor(e, t, i, o, r) {
1416
1415
  super(e), this.config = void 0, this.featuresAtCursorEvent = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.draggedFeatureId = null, this.dragPosition = void 0, this.config = e, this.featuresAtCursorEvent = t, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = r;
1417
1416
  }
@@ -1438,23 +1437,23 @@ class Mi extends B {
1438
1437
  const h = r[c];
1439
1438
  let u, p;
1440
1439
  if (this.config.projection === "web-mercator") {
1441
- const g = O(this.dragPosition[0], this.dragPosition[1]), y = O(o[0], o[1]), f = O(h[0], h[1]), v = { x: g.x - y.x, y: g.y - y.y }, C = f.x - v.x, m = f.y - v.y, { lng: P, lat: I } = A(C, m);
1442
- u = P, p = I;
1440
+ const g = E(this.dragPosition[0], this.dragPosition[1]), y = E(o[0], o[1]), f = E(h[0], h[1]), v = { x: g.x - y.x, y: g.y - y.y }, C = f.x - v.x, m = f.y - v.y, { lng: I, lat: S } = R(C, m);
1441
+ u = I, p = S;
1443
1442
  } else {
1444
1443
  const g = [this.dragPosition[0] - o[0], this.dragPosition[1] - o[1]];
1445
1444
  u = h[0] - g[0], p = h[1] - g[1];
1446
1445
  }
1447
- if (u = b(u, this.config.coordinatePrecision), p = b(p, this.config.coordinatePrecision), u > 180 || u < -180 || p > 90 || p < -90) return !1;
1446
+ if (u = w(u, this.config.coordinatePrecision), p = w(p, this.config.coordinatePrecision), u > 180 || u < -180 || p > 90 || p < -90) return !1;
1448
1447
  r[c] = [u, p];
1449
1448
  }
1450
1449
  i.type === "Polygon" && (r[r.length - 1] = [r[0][0], r[0][1]]);
1451
1450
  const a = this.selectionPoints.getUpdated(r) || [], l = this.midPoints.getUpdated(r) || [], d = this.coordinatePoints.getUpdated(this.draggedFeatureId, r) || [];
1452
- if (t && !t({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional }).valid) return !1;
1451
+ if (t && !t({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: O.Provisional }).valid) return !1;
1453
1452
  this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: i }, ...a, ...l, ...d]), this.dragPosition = [e.lng, e.lat];
1454
1453
  } else i.type === "Point" && (this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: { type: "Point", coordinates: o } }]), this.dragPosition = [e.lng, e.lat]);
1455
1454
  }
1456
1455
  }
1457
- class Di extends B {
1456
+ class Mi extends B {
1458
1457
  constructor(e, t, i, o, r, n, a) {
1459
1458
  super(e), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.coordinateSnapping = void 0, this.lineSnapping = void 0, this.draggedCoordinate = { id: null, index: -1 }, this.config = e, this.pixelDistance = t, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = r, this.coordinateSnapping = n, this.lineSnapping = a;
1460
1459
  }
@@ -1506,7 +1505,7 @@ class Di extends B {
1506
1505
  d[0] = u, d[v] = u;
1507
1506
  } else d[n] = u;
1508
1507
  const p = this.selectionPoints.getOneUpdated(n, u), g = p ? [p] : [], y = this.midPoints.getUpdated(d) || [], f = this.coordinatePoints.getUpdated(r, d) || [];
1509
- return !(a.type !== "Point" && !t && Ue({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional }).valid || (this.store.updateGeometry([{ id: r, geometry: a }, ...g, ...y, ...f]), 0));
1508
+ return !(a.type !== "Point" && !t && Ue({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: O.Provisional }).valid || (this.store.updateGeometry([{ id: r, geometry: a }, ...g, ...y, ...f]), 0));
1510
1509
  }
1511
1510
  isDragging() {
1512
1511
  return this.draggedCoordinate.id !== null;
@@ -1524,16 +1523,16 @@ function ut(s) {
1524
1523
  e += o[0], t += o[1], i++;
1525
1524
  }, !0), [e / i, t / i];
1526
1525
  }
1527
- const Wt = (s, e) => {
1526
+ const Nt = (s, e) => {
1528
1527
  if (e === 0 || e === 360 || e === -360) return s;
1529
- const t = 0.017453292519943295 * e, i = (s.geometry.type === "Polygon" ? s.geometry.coordinates[0] : s.geometry.coordinates).map(([n, a]) => O(n, a)), o = i.reduce((n, a) => ({ x: n.x + a.x, y: n.y + a.y }), { x: 0, y: 0 });
1528
+ const t = 0.017453292519943295 * e, i = (s.geometry.type === "Polygon" ? s.geometry.coordinates[0] : s.geometry.coordinates).map(([n, a]) => E(n, a)), o = i.reduce((n, a) => ({ x: n.x + a.x, y: n.y + a.y }), { x: 0, y: 0 });
1530
1529
  o.x /= i.length, o.y /= i.length;
1531
- const r = i.map((n) => ({ x: o.x + (n.x - o.x) * Math.cos(t) - (n.y - o.y) * Math.sin(t), y: o.y + (n.x - o.x) * Math.sin(t) + (n.y - o.y) * Math.cos(t) })).map(({ x: n, y: a }) => [A(n, a).lng, A(n, a).lat]);
1530
+ const r = i.map((n) => ({ x: o.x + (n.x - o.x) * Math.cos(t) - (n.y - o.y) * Math.sin(t), y: o.y + (n.x - o.x) * Math.sin(t) + (n.y - o.y) * Math.cos(t) })).map(({ x: n, y: a }) => [R(n, a).lng, R(n, a).lat]);
1532
1531
  return s.geometry.type === "Polygon" ? s.geometry.coordinates[0] = r : s.geometry.coordinates = r, s;
1533
1532
  };
1534
1533
  function We(s) {
1535
1534
  const e = (s.geometry.type === "Polygon" ? s.geometry.coordinates[0] : s.geometry.coordinates).map((t) => {
1536
- const { x: i, y: o } = O(t[0], t[1]);
1535
+ const { x: i, y: o } = E(t[0], t[1]);
1537
1536
  return [i, o];
1538
1537
  });
1539
1538
  return s.geometry.type === "Polygon" ? (function(t) {
@@ -1554,7 +1553,7 @@ function We(s) {
1554
1553
  return { x: o / i, y: r / i };
1555
1554
  })(e);
1556
1555
  }
1557
- class ki extends B {
1556
+ class Li extends B {
1558
1557
  constructor(e, t, i, o) {
1559
1558
  super(e), this.config = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.lastBearing = void 0, this.selectedGeometry = void 0, this.selectedGeometryCentroid = void 0, this.selectedGeometryWebMercatorCentroid = void 0, this.config = e, this.selectionPoints = t, this.midPoints = i, this.coordinatePoints = o;
1560
1559
  }
@@ -1570,10 +1569,10 @@ class ki extends B {
1570
1569
  const a = { type: "Feature", geometry: o, properties: {} };
1571
1570
  if (this.config.projection === "web-mercator") {
1572
1571
  this.selectedGeometryWebMercatorCentroid || (this.selectedGeometryWebMercatorCentroid = We(a));
1573
- const u = O(e.lng, e.lat);
1574
- if (n = R(this.selectedGeometryWebMercatorCentroid, u), n === 0) return;
1572
+ const u = E(e.lng, e.lat);
1573
+ if (n = A(this.selectedGeometryWebMercatorCentroid, u), n === 0) return;
1575
1574
  if (!this.lastBearing) return void (this.lastBearing = n);
1576
- Wt(a, -(this.lastBearing - n));
1575
+ Nt(a, -(this.lastBearing - n));
1577
1576
  } else {
1578
1577
  if (this.config.projection !== "globe") throw new Error("Unsupported projection");
1579
1578
  if (this.selectedGeometryCentroid || (this.selectedGeometryCentroid = ut({ geometry: o })), n = Ne(this.selectedGeometryCentroid, r), !this.lastBearing) return void (this.lastBearing = n + 180);
@@ -1581,28 +1580,28 @@ class ki extends B {
1581
1580
  if (p === 0 || p === 360 || p === -360) return u;
1582
1581
  const g = ut(u);
1583
1582
  (u.geometry.type === "Polygon" ? u.geometry.coordinates[0] : u.geometry.coordinates).forEach((y) => {
1584
- const f = Ne(g, y) + p, v = (function(m, P) {
1585
- m[0] += m[0] - P[0] > 180 ? -360 : P[0] - m[0] > 180 ? 360 : 0;
1586
- const I = Et, w = P[1] * Math.PI / 180, L = m[1] * Math.PI / 180, M = L - w;
1587
- let N = Math.abs(m[0] - P[0]) * Math.PI / 180;
1583
+ const f = Ne(g, y) + p, v = (function(m, I) {
1584
+ m[0] += m[0] - I[0] > 180 ? -360 : I[0] - m[0] > 180 ? 360 : 0;
1585
+ const S = xt, b = I[1] * Math.PI / 180, F = m[1] * Math.PI / 180, L = F - b;
1586
+ let N = Math.abs(m[0] - I[0]) * Math.PI / 180;
1588
1587
  N > Math.PI && (N -= 2 * Math.PI);
1589
- const k = Math.log(Math.tan(L / 2 + Math.PI / 4) / Math.tan(w / 2 + Math.PI / 4)), T = Math.abs(k) > 1e-11 ? M / k : Math.cos(w);
1590
- return Math.sqrt(M * M + T * T * N * N) * I;
1591
- })(g, y), C = _t(g, v, f);
1588
+ const _ = Math.log(Math.tan(F / 2 + Math.PI / 4) / Math.tan(b / 2 + Math.PI / 4)), T = Math.abs(_) > 1e-11 ? L / _ : Math.cos(b);
1589
+ return Math.sqrt(L * L + T * T * N * N) * S;
1590
+ })(g, y), C = Dt(g, v, f);
1592
1591
  y[0] = C[0], y[1] = C[1];
1593
1592
  });
1594
1593
  })(a, -(this.lastBearing - (n + 180)));
1595
1594
  }
1596
1595
  const l = o.type === "Polygon" ? o.coordinates[0] : o.coordinates;
1597
1596
  l.forEach((u) => {
1598
- u[0] = b(u[0], this.coordinatePrecision), u[1] = b(u[1], this.coordinatePrecision);
1597
+ u[0] = w(u[0], this.coordinatePrecision), u[1] = w(u[1], this.coordinatePrecision);
1599
1598
  });
1600
1599
  const d = this.midPoints.getUpdated(l) || [], c = this.selectionPoints.getUpdated(l) || [], h = this.coordinatePoints.getUpdated(t, l) || [];
1601
- if (i && !i({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional })) return !1;
1600
+ if (i && !i({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: O.Provisional })) return !1;
1602
1601
  this.store.updateGeometry([{ id: t, geometry: o }, ...c, ...d, ...h]), this.projection === "web-mercator" ? this.lastBearing = n : this.projection === "globe" && (this.lastBearing = n + 180);
1603
1602
  }
1604
1603
  }
1605
- class _i extends B {
1604
+ class Di extends B {
1606
1605
  constructor(e, t) {
1607
1606
  super(e), this.config = void 0, this.dragCoordinateResizeBehavior = void 0, this.config = e, this.dragCoordinateResizeBehavior = t;
1608
1607
  }
@@ -1617,13 +1616,13 @@ class _i extends B {
1617
1616
  this.dragCoordinateResizeBehavior.stopDragging();
1618
1617
  }
1619
1618
  }
1620
- function Bt({ coordinates: s, originX: e, originY: t, xScale: i, yScale: o }) {
1619
+ function Tt({ coordinates: s, originX: e, originY: t, xScale: i, yScale: o }) {
1621
1620
  i === 1 && o === 1 || s.forEach((r) => {
1622
- const { x: n, y: a } = O(r[0], r[1]), l = e + (n - e) * i, d = t + (a - t) * o, { lng: c, lat: h } = A(l, d);
1621
+ const { x: n, y: a } = E(r[0], r[1]), l = e + (n - e) * i, d = t + (a - t) * o, { lng: c, lat: h } = R(l, d);
1623
1622
  r[0] = c, r[1] = h;
1624
1623
  });
1625
1624
  }
1626
- class Ni extends B {
1625
+ class ki extends B {
1627
1626
  constructor(e, t, i, o, r) {
1628
1627
  super(e), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.minimumScale = 1e-4, this.draggedCoordinate = { id: null, index: -1 }, this.boundingBoxMaps = { opposite: { 0: 4, 1: 5, 2: 6, 3: 7, 4: 0, 5: 1, 6: 2, 7: 3 } }, this.config = e, this.pixelDistance = t, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = r;
1629
1628
  }
@@ -1684,7 +1683,7 @@ class Ni extends B {
1684
1683
  if (!t) return null;
1685
1684
  const { feature: i, boundingBox: o, updatedCoords: r, selectedCoordinate: n } = t, a = We(i);
1686
1685
  if (!a) return null;
1687
- const l = O(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = O(e.lng, e.lat);
1686
+ const l = E(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = E(e.lng, e.lat);
1688
1687
  return this.scaleWebMercator({ closestBBoxIndex: d, updatedCoords: r, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), r;
1689
1688
  }
1690
1689
  centerFixedWebMercatorDrag(e) {
@@ -1692,24 +1691,24 @@ class Ni extends B {
1692
1691
  if (!t) return null;
1693
1692
  const { feature: i, boundingBox: o, updatedCoords: r, selectedCoordinate: n } = t, a = We(i);
1694
1693
  if (!a) return null;
1695
- const l = O(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = O(e.lng, e.lat);
1694
+ const l = E(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = E(e.lng, e.lat);
1696
1695
  return this.scaleFixedWebMercator({ closestBBoxIndex: d, updatedCoords: r, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), r;
1697
1696
  }
1698
1697
  scaleFixedWebMercator({ closestBBoxIndex: e, webMercatorOrigin: t, webMercatorSelected: i, webMercatorCursor: o, updatedCoords: r }) {
1699
1698
  if (!this.isValidDragWebMercator(e, t.x - o.x, t.y - o.y)) return null;
1700
- let n = F(t, o) / F(t, i);
1701
- return n < 0 && (n = this.minimumScale), Bt({ coordinates: r, originX: t.x, originY: t.y, xScale: n, yScale: n }), r;
1699
+ let n = M(t, o) / M(t, i);
1700
+ return n < 0 && (n = this.minimumScale), Tt({ coordinates: r, originX: t.x, originY: t.y, xScale: n, yScale: n }), r;
1702
1701
  }
1703
1702
  oppositeFixedWebMercatorDrag(e) {
1704
1703
  const t = this.getSelectedFeatureDataWebMercator();
1705
1704
  if (!t) return null;
1706
- const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = t, n = O(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = O(e.lng, e.lat);
1705
+ const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = t, n = E(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = E(e.lng, e.lat);
1707
1706
  return this.scaleFixedWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: c, webMercatorSelected: n, webMercatorOrigin: d }), o;
1708
1707
  }
1709
1708
  oppositeWebMercatorDrag(e) {
1710
1709
  const t = this.getSelectedFeatureDataWebMercator();
1711
1710
  if (!t) return null;
1712
- const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = t, n = O(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = O(e.lng, e.lat);
1711
+ const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = t, n = E(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = E(e.lng, e.lat);
1713
1712
  return this.scaleWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: c, webMercatorSelected: n, webMercatorOrigin: d }), o;
1714
1713
  }
1715
1714
  scaleWebMercator({ closestBBoxIndex: e, webMercatorOrigin: t, webMercatorSelected: i, webMercatorCursor: o, updatedCoords: r }) {
@@ -1734,14 +1733,14 @@ class Ni extends B {
1734
1733
  }
1735
1734
  performWebMercatorScale(e, t, i, o, r) {
1736
1735
  e.forEach((n) => {
1737
- const { x: a, y: l } = O(n[0], n[1]), d = t + (a - t) * o, c = i + (l - i) * r, { lng: h, lat: u } = A(d, c);
1736
+ const { x: a, y: l } = E(n[0], n[1]), d = t + (a - t) * o, c = i + (l - i) * r, { lng: h, lat: u } = R(d, c);
1738
1737
  n[0] = h, n[1] = u;
1739
1738
  });
1740
1739
  }
1741
1740
  getBBoxWebMercator(e) {
1742
1741
  const t = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
1743
1742
  (e = e.map((a) => {
1744
- const { x: l, y: d } = O(a[0], a[1]);
1743
+ const { x: l, y: d } = E(a[0], a[1]);
1745
1744
  return [l, d];
1746
1745
  })).forEach(([a, l]) => {
1747
1746
  a < t[0] && (t[0] = a), l < t[1] && (t[1] = l), a > t[2] && (t[2] = a), l > t[3] && (t[3] = l);
@@ -1752,7 +1751,7 @@ class Ni extends B {
1752
1751
  getIndexesWebMercator(e, t) {
1753
1752
  let i, o = 1 / 0;
1754
1753
  for (let r = 0; r < e.length; r++) {
1755
- const n = F({ x: t.x, y: t.y }, { x: e[r][0], y: e[r][1] });
1754
+ const n = M({ x: t.x, y: t.y }, { x: e[r][0], y: e[r][1] });
1756
1755
  n < o && (i = r, o = n);
1757
1756
  }
1758
1757
  if (i === void 0) throw new Error("No closest coordinate found");
@@ -1779,16 +1778,16 @@ class Ni extends B {
1779
1778
  if (t === "center" ? r = this.centerWebMercatorDrag(e) : t === "opposite" ? r = this.oppositeWebMercatorDrag(e) : t === "center-fixed" ? r = this.centerFixedWebMercatorDrag(e) : t === "opposite-fixed" && (r = this.oppositeFixedWebMercatorDrag(e)), !r) return !1;
1780
1779
  for (let c = 0; c < r.length; c++) {
1781
1780
  const h = r[c];
1782
- if (h[0] = b(h[0], this.coordinatePrecision), h[1] = b(h[1], this.coordinatePrecision), !be(h, this.coordinatePrecision)) return !1;
1781
+ if (h[0] = w(h[0], this.coordinatePrecision), h[1] = w(h[1], this.coordinatePrecision), !we(h, this.coordinatePrecision)) return !1;
1783
1782
  }
1784
1783
  const n = this.midPoints.getUpdated(r) || [], a = this.selectionPoints.getUpdated(r) || [], l = this.coordinatePoints.getUpdated(o.id, r) || [], d = { type: o.geometry.type, coordinates: o.geometry.type === "Polygon" ? [r] : r };
1785
- return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: d, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional }).valid || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: d }, ...a, ...n, ...l]), 0));
1784
+ return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: d, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: O.Provisional }).valid || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: d }, ...a, ...n, ...l]), 0));
1786
1785
  }
1787
1786
  }
1788
- const Ti = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, pt = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
1789
- class Ye extends ti {
1787
+ const _i = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, pt = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
1788
+ class Ye extends Qt {
1790
1789
  constructor(e) {
1791
- super(e, !0), this.mode = "select", this.allowManualDeselection = !0, this.dragEventThrottle = 5, this.dragEventCount = 0, this.selected = [], this.flags = {}, this.keyEvents = Ti, this.cursors = pt, this.validations = {}, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinateSnap = void 0, this.featuresAtMouseEvent = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.dragFeature = void 0, this.dragCoordinate = void 0, this.rotateFeature = void 0, this.scaleFeature = void 0, this.dragCoordinateResizeFeature = void 0, this.coordinatePoints = void 0, this.lineSnap = void 0, this.updateOptions(e);
1790
+ super(e, !0), this.mode = "select", this.allowManualDeselection = !0, this.dragEventThrottle = 5, this.dragEventCount = 0, this.selected = [], this.flags = {}, this.keyEvents = _i, this.cursors = pt, this.validations = {}, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinateSnap = void 0, this.featuresAtMouseEvent = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.dragFeature = void 0, this.dragCoordinate = void 0, this.rotateFeature = void 0, this.scaleFeature = void 0, this.dragCoordinateResizeFeature = void 0, this.coordinatePoints = void 0, this.lineSnap = void 0, this.updateOptions(e);
1792
1791
  }
1793
1792
  updateOptions(e) {
1794
1793
  if (super.updateOptions(e), this.cursors = e && e.cursors ? x({}, this.cursors, e.cursors) : pt, e?.keyEvents === null ? this.keyEvents = { deselect: null, delete: null, rotate: null, scale: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e?.dragEventThrottle !== void 0 && (this.dragEventThrottle = e.dragEventThrottle), e?.allowManualDeselection !== void 0 && (this.allowManualDeselection = e.allowManualDeselection), e != null && e.flags) {
@@ -1807,13 +1806,13 @@ class Ye extends ti {
1807
1806
  this._state = "selecting";
1808
1807
  }
1809
1808
  registerBehaviors(e) {
1810
- this.pixelDistance = new oe(e), this.clickBoundingBox = new ie(e), this.featuresAtMouseEvent = new Fi(e, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Li(e), this.coordinatePoints = new Mt(e), this.midPoints = new wi(e, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new Oe(e, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new Ge(e, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new ki(e, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Mi(e, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new Di(e, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap, this.lineSnap), this.dragCoordinateResizeFeature = new Ni(e, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new _i(e, this.dragCoordinateResizeFeature);
1809
+ this.pixelDistance = new oe(e), this.clickBoundingBox = new ie(e), this.featuresAtMouseEvent = new bi(e, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new wi(e), this.coordinatePoints = new Ft(e), this.midPoints = new Oi(e, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new xe(e, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new Ge(e, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new Li(e, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Fi(e, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new Mi(e, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap, this.lineSnap), this.dragCoordinateResizeFeature = new ki(e, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new Di(e, this.dragCoordinateResizeFeature);
1811
1810
  }
1812
1811
  deselectFeature() {
1813
1812
  this.deselect();
1814
1813
  }
1815
1814
  deselect() {
1816
- const e = this.selected.filter((t) => this.store.has(t)).map((t) => ({ id: t, property: _.SELECTED, value: !1 }));
1815
+ const e = this.selected.filter((t) => this.store.has(t)).map((t) => ({ id: t, property: D.SELECTED, value: !1 }));
1817
1816
  this.store.updateProperty(e), this.onDeselect(this.selected[0]), this.selected = [], this.selectionPoints.delete(), this.midPoints.delete();
1818
1817
  }
1819
1818
  deleteSelected() {
@@ -1833,7 +1832,7 @@ class Ye extends ti {
1833
1832
  if (d.type === "Polygon") {
1834
1833
  if (c = d.coordinates[0], c.length <= 4) return;
1835
1834
  } else if (d.type === "LineString" && (c = d.coordinates, c.length <= 2)) return;
1836
- if (!c || (d.type !== "Polygon" || r !== 0 && r !== c.length - 1 ? c.splice(r, 1) : (c.shift(), c.pop(), c.push([c[0][0], c[0][1]])), l && !l({ id: o, type: "Feature", geometry: d, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid)) return;
1835
+ if (!c || (d.type !== "Polygon" || r !== 0 && r !== c.length - 1 ? c.splice(r, 1) : (c.shift(), c.pop(), c.push([c[0][0], c[0][1]])), l && !l({ id: o, type: "Feature", geometry: d, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Commit }).valid)) return;
1837
1836
  const h = [...this.midPoints.ids, ...this.selectionPoints.ids];
1838
1837
  this.store.delete(h), this.store.updateGeometry([{ id: o, geometry: d }]), n.coordinatePointIds && this.coordinatePoints.createOrUpdate(o), this.selectionPoints.create(c, d.type, o), a && a.feature && a.feature.coordinates && a.feature.coordinates.midpoints && this.midPoints.create(c, o, this.coordinatePrecision);
1839
1838
  }
@@ -1846,7 +1845,7 @@ class Ye extends ti {
1846
1845
  if (r === e) return;
1847
1846
  this.deselect();
1848
1847
  }
1849
- t && this.setCursor(this.cursors.pointerOver), this.selected = [e], this.store.updateProperty([{ id: e, property: _.SELECTED, value: !0 }]), this.onSelect(e);
1848
+ t && this.setCursor(this.cursors.pointerOver), this.selected = [e], this.store.updateProperty([{ id: e, property: D.SELECTED, value: !0 }]), this.onSelect(e);
1850
1849
  const { type: n, coordinates: a } = this.store.getGeometryCopy(e);
1851
1850
  if (n !== "LineString" && n !== "Polygon") return;
1852
1851
  const l = n === "LineString" ? a : a[0];
@@ -1951,9 +1950,10 @@ class Ye extends ti {
1951
1950
  styleFeature(e) {
1952
1951
  const t = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0, markerUrl: void 0, markerHeight: void 0, markerWidth: void 0 });
1953
1952
  if (e.properties.mode === this.mode && e.geometry.type === "Point") {
1954
- if (e.properties.selectionPoint) return t.pointColor = this.getHexColorStylingValue(this.styles.selectionPointColor, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectionPointOutlineColor, t.pointOutlineColor, e), t.pointWidth = this.getNumericStylingValue(this.styles.selectionPointWidth, t.pointWidth, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectionPointOutlineWidth, 2, e), t.zIndex = 30, t;
1955
- if (e.properties.midPoint) return t.pointColor = this.getHexColorStylingValue(this.styles.midPointColor, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.midPointOutlineColor, t.pointOutlineColor, e), t.pointWidth = this.getNumericStylingValue(this.styles.midPointWidth, 4, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.midPointOutlineWidth, 2, e), t.zIndex = 50, t;
1956
- } else if (e.properties[_.SELECTED]) {
1953
+ if (e.properties[D.SELECTION_POINT]) return t.pointColor = this.getHexColorStylingValue(this.styles.selectionPointColor, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectionPointOutlineColor, t.pointOutlineColor, e), t.pointWidth = this.getNumericStylingValue(this.styles.selectionPointWidth, t.pointWidth, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectionPointOutlineWidth, 2, e), t.zIndex = 30, t;
1954
+ if (e.properties[D.MID_POINT]) return t.pointColor = this.getHexColorStylingValue(this.styles.midPointColor, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.midPointOutlineColor, t.pointOutlineColor, e), t.pointWidth = this.getNumericStylingValue(this.styles.midPointWidth, 4, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.midPointOutlineWidth, 2, e), t.zIndex = 50, t;
1955
+ } else if (e.properties[D.SELECTED]) {
1956
+ if (e.geometry.type === "Point" && e.properties[P.MARKER]) return t.markerUrl = this.getUrlStylingValue(this.styles.selectedMarkerUrl, St, e), t.markerHeight = this.getNumericStylingValue(this.styles.selectedMarkerHeight, 40, e), t.markerWidth = this.getNumericStylingValue(this.styles.selectedMarkerWidth, 32, e), t;
1957
1957
  if (e.geometry.type === "Polygon") return t.polygonFillColor = this.getHexColorStylingValue(this.styles.selectedPolygonColor, t.polygonFillColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.selectedPolygonOutlineWidth, t.polygonOutlineWidth, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.selectedPolygonOutlineColor, t.polygonOutlineColor, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.selectedPolygonFillOpacity, t.polygonFillOpacity, e), t.zIndex = U, t;
1958
1958
  if (e.geometry.type === "LineString") return t.lineStringColor = this.getHexColorStylingValue(this.styles.selectedLineStringColor, t.lineStringColor, e), t.lineStringWidth = this.getNumericStylingValue(this.styles.selectedLineStringWidth, t.lineStringWidth, e), t.zIndex = U, t;
1959
1959
  if (e.geometry.type === "Point") return t.pointWidth = this.getNumericStylingValue(this.styles.selectedPointWidth, t.pointWidth, e), t.pointColor = this.getHexColorStylingValue(this.styles.selectedPointColor, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectedPointOutlineColor, t.pointOutlineColor, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectedPointOutlineWidth, t.pointOutlineWidth, e), t.zIndex = U, t;
@@ -1976,7 +1976,7 @@ class Ye extends ti {
1976
1976
  }
1977
1977
  }
1978
1978
  }
1979
- class Wi extends j {
1979
+ class Ni extends j {
1980
1980
  constructor(...e) {
1981
1981
  super(...e), this.type = X.Static, this.mode = "static";
1982
1982
  }
@@ -2004,11 +2004,11 @@ class Wi extends j {
2004
2004
  return x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0, markerUrl: void 0, markerHeight: void 0, markerWidth: void 0 });
2005
2005
  }
2006
2006
  }
2007
- function jt(s, e, t, i, o) {
2007
+ function Wt(s, e, t, i, o) {
2008
2008
  for (; i > t; ) {
2009
2009
  if (i - t > 600) {
2010
2010
  const l = i - t + 1, d = e - t + 1, c = Math.log(l), h = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * h * (l - h) / l) * (d - l / 2 < 0 ? -1 : 1);
2011
- jt(s, e, Math.max(t, Math.floor(e - d * h / l + u)), Math.min(i, Math.floor(e + (l - d) * h / l + u)), o);
2011
+ Wt(s, e, Math.max(t, Math.floor(e - d * h / l + u)), Math.min(i, Math.floor(e + (l - d) * h / l + u)), o);
2012
2012
  }
2013
2013
  const r = s[e];
2014
2014
  let n = t, a = i;
@@ -2037,26 +2037,26 @@ function de(s, e, t, i, o) {
2037
2037
  function ce(s, e) {
2038
2038
  return s.minX = Math.min(s.minX, e.minX), s.minY = Math.min(s.minY, e.minY), s.maxX = Math.max(s.maxX, e.maxX), s.maxY = Math.max(s.maxY, e.maxY), s;
2039
2039
  }
2040
- function Bi(s, e) {
2040
+ function Ti(s, e) {
2041
2041
  return s.minX - e.minX;
2042
2042
  }
2043
- function ji(s, e) {
2043
+ function Wi(s, e) {
2044
2044
  return s.minY - e.minY;
2045
2045
  }
2046
- function Me(s) {
2046
+ function Le(s) {
2047
2047
  return (s.maxX - s.minX) * (s.maxY - s.minY);
2048
2048
  }
2049
- function ve(s) {
2049
+ function me(s) {
2050
2050
  return s.maxX - s.minX + (s.maxY - s.minY);
2051
2051
  }
2052
- function Ui(s, e) {
2052
+ function Bi(s, e) {
2053
2053
  const t = Math.max(s.minX, e.minX), i = Math.max(s.minY, e.minY), o = Math.min(s.maxX, e.maxX), r = Math.min(s.maxY, e.maxY);
2054
2054
  return Math.max(0, o - t) * Math.max(0, r - i);
2055
2055
  }
2056
2056
  function De(s, e) {
2057
2057
  return s.minX <= e.minX && s.minY <= e.minY && e.maxX <= s.maxX && e.maxY <= s.maxY;
2058
2058
  }
2059
- function Ce(s, e) {
2059
+ function ve(s, e) {
2060
2060
  return e.minX <= s.maxX && e.minY <= s.maxY && e.maxX >= s.minX && e.maxY >= s.minY;
2061
2061
  }
2062
2062
  function Q(s) {
@@ -2067,22 +2067,22 @@ function gt(s, e, t, i, o) {
2067
2067
  for (; r.length; ) {
2068
2068
  if ((t = r.pop()) - (e = r.pop()) <= i) continue;
2069
2069
  const n = e + Math.ceil((t - e) / i / 2) * i;
2070
- jt(s, n, e, t, o), r.push(e, n, n, t);
2070
+ Wt(s, n, e, t, o), r.push(e, n, n, t);
2071
2071
  }
2072
2072
  }
2073
- class Ai {
2073
+ class ji {
2074
2074
  constructor(e) {
2075
2075
  this._maxEntries = void 0, this._minEntries = void 0, this.data = void 0, this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
2076
2076
  }
2077
2077
  search(e) {
2078
2078
  let t = this.data;
2079
2079
  const i = [];
2080
- if (!Ce(e, t)) return i;
2080
+ if (!ve(e, t)) return i;
2081
2081
  const o = this.toBBox, r = [];
2082
2082
  for (; t; ) {
2083
2083
  for (let n = 0; n < t.children.length; n++) {
2084
2084
  const a = t.children[n], l = t.leaf ? o(a) : a;
2085
- Ce(e, l) && (t.leaf ? i.push(a) : De(e, l) ? this._all(a, i) : r.push(a));
2085
+ ve(e, l) && (t.leaf ? i.push(a) : De(e, l) ? this._all(a, i) : r.push(a));
2086
2086
  }
2087
2087
  t = r.pop();
2088
2088
  }
@@ -2090,12 +2090,12 @@ class Ai {
2090
2090
  }
2091
2091
  collides(e) {
2092
2092
  let t = this.data;
2093
- if (Ce(e, t)) {
2093
+ if (ve(e, t)) {
2094
2094
  const i = [];
2095
2095
  for (; t; ) {
2096
2096
  for (let o = 0; o < t.children.length; o++) {
2097
2097
  const r = t.children[o], n = t.leaf ? this.toBBox(r) : r;
2098
- if (Ce(e, n)) {
2098
+ if (ve(e, n)) {
2099
2099
  if (t.leaf || De(e, n)) return !0;
2100
2100
  i.push(r);
2101
2101
  }
@@ -2174,7 +2174,7 @@ class Ai {
2174
2174
  for (; o.push(t), !t.leaf && o.length - 1 !== i; ) {
2175
2175
  let a, l = 1 / 0, d = 1 / 0;
2176
2176
  for (let c = 0; c < t.children.length; c++) {
2177
- const h = t.children[c], u = Me(h), p = (r = e, n = h, (Math.max(n.maxX, r.maxX) - Math.min(n.minX, r.minX)) * (Math.max(n.maxY, r.maxY) - Math.min(n.minY, r.minY)) - u);
2177
+ const h = t.children[c], u = Le(h), p = (r = e, n = h, (Math.max(n.maxX, r.maxX) - Math.min(n.minX, r.minX)) * (Math.max(n.maxY, r.maxY) - Math.min(n.minY, r.minY)) - u);
2178
2178
  p < d ? (d = p, l = u < l ? u : l, a = h) : p === d && u < l && (l = u, a = h);
2179
2179
  }
2180
2180
  t = a || t.children[0];
@@ -2199,26 +2199,26 @@ class Ai {
2199
2199
  _chooseSplitIndex(e, t, i) {
2200
2200
  let o, r = 1 / 0, n = 1 / 0;
2201
2201
  for (let a = t; a <= i - t; a++) {
2202
- const l = de(e, 0, a, this.toBBox), d = de(e, a, i, this.toBBox), c = Ui(l, d), h = Me(l) + Me(d);
2202
+ const l = de(e, 0, a, this.toBBox), d = de(e, a, i, this.toBBox), c = Bi(l, d), h = Le(l) + Le(d);
2203
2203
  c < r ? (r = c, o = a, n = h < n ? h : n) : c === r && h < n && (n = h, o = a);
2204
2204
  }
2205
2205
  return o || i - t;
2206
2206
  }
2207
2207
  _chooseSplitAxis(e, t, i) {
2208
- const o = e.leaf ? this.compareMinX : Bi, r = e.leaf ? this.compareMinY : ji;
2208
+ const o = e.leaf ? this.compareMinX : Ti, r = e.leaf ? this.compareMinY : Wi;
2209
2209
  this._allDistMargin(e, t, i, o) < this._allDistMargin(e, t, i, r) && e.children.sort(o);
2210
2210
  }
2211
2211
  _allDistMargin(e, t, i, o) {
2212
2212
  e.children.sort(o);
2213
2213
  const r = this.toBBox, n = de(e, 0, t, r), a = de(e, i - t, i, r);
2214
- let l = ve(n) + ve(a);
2214
+ let l = me(n) + me(a);
2215
2215
  for (let d = t; d < i - t; d++) {
2216
2216
  const c = e.children[d];
2217
- ce(n, e.leaf ? r(c) : c), l += ve(n);
2217
+ ce(n, e.leaf ? r(c) : c), l += me(n);
2218
2218
  }
2219
2219
  for (let d = i - t - 1; d >= t; d--) {
2220
2220
  const c = e.children[d];
2221
- ce(a, e.leaf ? r(c) : c), l += ve(a);
2221
+ ce(a, e.leaf ? r(c) : c), l += me(a);
2222
2222
  }
2223
2223
  return l;
2224
2224
  }
@@ -2229,9 +2229,9 @@ class Ai {
2229
2229
  for (let t, i = e.length - 1; i >= 0; i--) e[i].children.length === 0 ? i > 0 ? (t = e[i - 1].children, t.splice(t.indexOf(e[i]), 1)) : this.clear() : J(e[i], this.toBBox);
2230
2230
  }
2231
2231
  }
2232
- class Ri {
2232
+ class Ui {
2233
2233
  constructor(e) {
2234
- this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new Ai(e && e.maxEntries ? e.maxEntries : 9), this.idToNode = /* @__PURE__ */ new Map(), this.nodeToId = /* @__PURE__ */ new Map();
2234
+ this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new ji(e && e.maxEntries ? e.maxEntries : 9), this.idToNode = /* @__PURE__ */ new Map(), this.nodeToId = /* @__PURE__ */ new Map();
2235
2235
  }
2236
2236
  setMaps(e, t) {
2237
2237
  this.idToNode.set(e.id, t), this.nodeToId.set(t, e.id);
@@ -2282,14 +2282,14 @@ class Ri {
2282
2282
  return this.tree.collides(this.toBBox(e));
2283
2283
  }
2284
2284
  }
2285
- const Gi = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) {
2285
+ const Ri = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) {
2286
2286
  const e = 16 * Math.random() | 0;
2287
2287
  return (s == "x" ? e : 3 & e | 8).toString(16);
2288
2288
  }), isValidId: (s) => typeof s == "string" && s.length === 36 };
2289
- class zi {
2289
+ class Ai {
2290
2290
  constructor(e) {
2291
2291
  this.idStrategy = void 0, this.tracked = void 0, this.spatialIndex = void 0, this.store = void 0, this._onChange = () => {
2292
- }, this.store = {}, this.spatialIndex = new Ri(), this.tracked = !e || e.tracked !== !1, this.idStrategy = e && e.idStrategy ? e.idStrategy : Gi;
2292
+ }, this.store = {}, this.spatialIndex = new Ui(), this.tracked = !e || e.tracked !== !1, this.idStrategy = e && e.idStrategy ? e.idStrategy : Ri;
2293
2293
  }
2294
2294
  clone(e) {
2295
2295
  return JSON.parse(JSON.stringify(e));
@@ -2393,23 +2393,23 @@ class zi {
2393
2393
  return Object.keys(this.store).length;
2394
2394
  }
2395
2395
  }
2396
- const Vi = "Feature is not a Polygon or LineString", $i = "Feature intersects itself", Yi = (s) => s.geometry.type !== "Polygon" && s.geometry.type !== "LineString" ? { valid: !1, reason: Vi } : Ue(s) ? { valid: !1, reason: $i } : { valid: !0 };
2396
+ const Gi = "Feature is not a Polygon or LineString", zi = "Feature intersects itself", Vi = (s) => s.geometry.type !== "Polygon" && s.geometry.type !== "LineString" ? { valid: !1, reason: Gi } : Ue(s) ? { valid: !1, reason: zi } : { valid: !0 };
2397
2397
  function yt(s, e, t) {
2398
- const i = R(s, e);
2399
- let o = R(e, t) - i;
2398
+ const i = A(s, e);
2399
+ let o = A(e, t) - i;
2400
2400
  return o < 0 && (o += 360), 180 - Math.abs(o - 90 - 90);
2401
2401
  }
2402
- const Ki = { cancel: "Escape", finish: "Enter" }, Hi = { start: "crosshair", close: "pointer" };
2403
- class Ut extends j {
2402
+ const $i = { cancel: "Escape", finish: "Enter" }, Yi = { start: "crosshair", close: "pointer" };
2403
+ class Bt extends j {
2404
2404
  constructor(e) {
2405
- super(e, !0), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ki, this.cursors = Hi, this.mouseMove = !1, this.updateOptions(e);
2405
+ super(e, !0), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = $i, this.cursors = Yi, this.mouseMove = !1, this.updateOptions(e);
2406
2406
  }
2407
2407
  updateOptions(e) {
2408
2408
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents));
2409
2409
  }
2410
2410
  close() {
2411
2411
  if (this.currentId === void 0) return;
2412
- this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2412
+ this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2413
2413
  const e = this.currentId;
2414
2414
  this.currentCoordinate = 0, this.currentId = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
2415
2415
  }
@@ -2427,13 +2427,13 @@ class Ut extends j {
2427
2427
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), r = Math.max(1e-6, o);
2428
2428
  i = [t[0], [e.lng, e.lat], [e.lng, e.lat - r], t[0]];
2429
2429
  } else if (this.currentCoordinate === 2) {
2430
- const o = t[0], r = t[1], n = Nt(o, r, this.coordinatePrecision, this.project, this.unproject), a = O(o[0], o[1]), l = O(n[0], n[1]), d = O(r[0], r[1]), c = O(e.lng, e.lat), h = F(c, a) < F(c, d), u = yt(a, l, c), p = h ? 90 - u : yt(a, l, c) - 90, g = F(l, c), y = Math.cos(D(p)) * g, f = R(a, d) + ((function(I, w, L) {
2431
- const M = (L.x - w.x) * (I.y - w.y) - (L.y - w.y) * (I.x - w.x);
2432
- return M > 1e-10 ? "left" : M < -1e-10 ? "right" : "left";
2433
- })(a, d, c) === "right" ? -90 : 90), v = ue(a, y, f), C = ue(d, y, f), m = A(v.x, v.y), P = A(C.x, C.y);
2434
- i = [t[0], t[1], [b(P.lng, this.coordinatePrecision), b(P.lat, this.coordinatePrecision)], [b(m.lng, this.coordinatePrecision), b(m.lat, this.coordinatePrecision)], t[0]];
2430
+ const o = t[0], r = t[1], n = kt(o, r, this.coordinatePrecision, this.project, this.unproject), a = E(o[0], o[1]), l = E(n[0], n[1]), d = E(r[0], r[1]), c = E(e.lng, e.lat), h = M(c, a) < M(c, d), u = yt(a, l, c), p = h ? 90 - u : yt(a, l, c) - 90, g = M(l, c), y = Math.cos(k(p)) * g, f = A(a, d) + ((function(S, b, F) {
2431
+ const L = (F.x - b.x) * (S.y - b.y) - (F.y - b.y) * (S.x - b.x);
2432
+ return L > 1e-10 ? "left" : L < -1e-10 ? "right" : "left";
2433
+ })(a, d, c) === "right" ? -90 : 90), v = he(a, y, f), C = he(d, y, f), m = R(v.x, v.y), I = R(C.x, C.y);
2434
+ i = [t[0], t[1], [w(I.lng, this.coordinatePrecision), w(I.lat, this.coordinatePrecision)], [w(m.lng, this.coordinatePrecision), w(m.lat, this.coordinatePrecision)], t[0]];
2435
2435
  }
2436
- i && this.updatePolygonGeometry(this.currentId, i, E.Provisional);
2436
+ i && this.updatePolygonGeometry(this.currentId, i, O.Provisional);
2437
2437
  }
2438
2438
  updatePolygonGeometry(e, t, i) {
2439
2439
  const o = { type: "Polygon", coordinates: [t] };
@@ -2441,11 +2441,11 @@ class Ut extends j {
2441
2441
  }
2442
2442
  onClick(e) {
2443
2443
  if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) if (this.currentCoordinate > 0 && !this.mouseMove && this.onMouseMove(e), this.mouseMove = !1, this.currentCoordinate === 0) {
2444
- const [t] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2444
+ const [t] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
2445
2445
  this.currentId = t, this.currentCoordinate++, this.setDrawing();
2446
2446
  } else if (this.currentCoordinate === 1 && this.currentId) {
2447
2447
  const t = this.store.getGeometryCopy(this.currentId);
2448
- if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]], E.Commit)) return;
2448
+ if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]], O.Commit)) return;
2449
2449
  this.currentCoordinate++;
2450
2450
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2451
2451
  }
@@ -2476,27 +2476,27 @@ class Ut extends j {
2476
2476
  return e.properties.mode === this.mode && e.geometry.type === "Polygon" && (t.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, t.polygonFillColor, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, t.polygonFillOpacity, e), t.zIndex = U), t;
2477
2477
  }
2478
2478
  validateFeature(e) {
2479
- return this.validateModeFeature(e, (t) => ge(t, this.coordinatePrecision));
2479
+ return this.validateModeFeature(e, (t) => pe(t, this.coordinatePrecision));
2480
2480
  }
2481
2481
  afterFeatureUpdated(e) {
2482
2482
  this.currentId === e.id && (this.currentId = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
2483
2483
  }
2484
2484
  }
2485
- function At(s, e, t) {
2485
+ function jt(s, e, t) {
2486
2486
  return (e.x - s.x) * (t.y - s.y) - (e.y - s.y) * (t.x - s.x) <= 0;
2487
2487
  }
2488
- const Xi = { cancel: "Escape", finish: "Enter" }, qi = { start: "crosshair", close: "pointer" };
2489
- class Rt extends j {
2488
+ const Ki = { cancel: "Escape", finish: "Enter" }, Hi = { start: "crosshair", close: "pointer" };
2489
+ class Ut extends j {
2490
2490
  constructor(e) {
2491
- super(e, !0), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Xi, this.direction = void 0, this.arcPoints = 64, this.cursors = qi, this.mouseMove = !1, this.updateOptions(e);
2491
+ super(e, !0), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ki, this.direction = void 0, this.arcPoints = 64, this.cursors = Hi, this.mouseMove = !1, this.updateOptions(e);
2492
2492
  }
2493
2493
  updateOptions(e) {
2494
2494
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e != null && e.arcPoints && (this.arcPoints = e.arcPoints);
2495
2495
  }
2496
2496
  close() {
2497
2497
  if (this.currentId === void 0) return;
2498
- const e = ye(this.store.getGeometryCopy(this.currentId));
2499
- e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2498
+ const e = ge(this.store.getGeometryCopy(this.currentId));
2499
+ e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2500
2500
  const t = this.currentId;
2501
2501
  this.currentCoordinate = 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
2502
2502
  }
@@ -2514,23 +2514,23 @@ class Rt extends j {
2514
2514
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), r = Math.max(1e-6, o);
2515
2515
  i = [t[0], [e.lng, e.lat], [e.lng, e.lat - r], t[0]];
2516
2516
  } else if (this.currentCoordinate === 2) {
2517
- const o = t[0], r = t[1], n = [e.lng, e.lat], a = O(o[0], o[1]), l = O(r[0], r[1]), d = O(n[0], n[1]);
2517
+ const o = t[0], r = t[1], n = [e.lng, e.lat], a = E(o[0], o[1]), l = E(r[0], r[1]), d = E(n[0], n[1]);
2518
2518
  if (this.direction === void 0) {
2519
- const m = At(a, l, d);
2519
+ const m = jt(a, l, d);
2520
2520
  this.direction = m ? "clockwise" : "anticlockwise";
2521
2521
  }
2522
- const c = F(a, l), h = R(a, l), u = R(a, d), p = this.arcPoints, g = [o], y = H(h), f = H(u);
2522
+ const c = M(a, l), h = A(a, l), u = A(a, d), p = this.arcPoints, g = [o], y = H(h), f = H(u);
2523
2523
  let v;
2524
2524
  this.direction === "anticlockwise" ? (v = f - y, v < 0 && (v += 360)) : (v = y - f, v < 0 && (v += 360));
2525
2525
  const C = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
2526
2526
  g.push(r);
2527
2527
  for (let m = 0; m <= p; m++) {
2528
- const P = ue(a, c, y + m * C), { lng: I, lat: w } = A(P.x, P.y), L = [b(I, this.coordinatePrecision), b(w, this.coordinatePrecision)];
2529
- L[0] !== g[g.length - 1][0] && L[1] !== g[g.length - 1][1] && g.push(L);
2528
+ const I = he(a, c, y + m * C), { lng: S, lat: b } = R(I.x, I.y), F = [w(S, this.coordinatePrecision), w(b, this.coordinatePrecision)];
2529
+ F[0] !== g[g.length - 1][0] && F[1] !== g[g.length - 1][1] && g.push(F);
2530
2530
  }
2531
2531
  g.push(o), i = [...g];
2532
2532
  }
2533
- i && this.updatePolygonGeometry(this.currentId, i, E.Provisional);
2533
+ i && this.updatePolygonGeometry(this.currentId, i, O.Provisional);
2534
2534
  }
2535
2535
  updatePolygonGeometry(e, t, i) {
2536
2536
  const o = { type: "Polygon", coordinates: [t] };
@@ -2538,11 +2538,11 @@ class Rt extends j {
2538
2538
  }
2539
2539
  onClick(e) {
2540
2540
  if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) if (this.currentCoordinate > 0 && !this.mouseMove && this.onMouseMove(e), this.mouseMove = !1, this.currentCoordinate === 0) {
2541
- const [t] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2541
+ const [t] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
2542
2542
  this.currentId = t, this.currentCoordinate++, this.setDrawing();
2543
2543
  } else if (this.currentCoordinate === 1 && this.currentId) {
2544
2544
  const t = this.store.getGeometryCopy(this.currentId);
2545
- if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]], E.Commit)) return;
2545
+ if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]], O.Commit)) return;
2546
2546
  this.currentCoordinate++;
2547
2547
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2548
2548
  }
@@ -2569,16 +2569,16 @@ class Rt extends j {
2569
2569
  return e.properties.mode === this.mode && e.geometry.type === "Polygon" && (t.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, t.polygonFillColor, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, t.polygonFillOpacity, e), t.zIndex = U), t;
2570
2570
  }
2571
2571
  validateFeature(e) {
2572
- return this.validateModeFeature(e, (t) => ge(t, this.coordinatePrecision));
2572
+ return this.validateModeFeature(e, (t) => pe(t, this.coordinatePrecision));
2573
2573
  }
2574
2574
  afterFeatureUpdated(e) {
2575
2575
  this.currentId === e.id && (this.currentId = void 0, this.direction = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
2576
2576
  }
2577
2577
  }
2578
- const Ji = { cancel: "Escape", finish: "Enter" }, Zi = { start: "crosshair", close: "pointer" };
2579
- class Gt extends j {
2578
+ const Xi = { cancel: "Escape", finish: "Enter" }, qi = { start: "crosshair", close: "pointer" };
2579
+ class Rt extends j {
2580
2580
  constructor(e) {
2581
- super(e, !0), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents = Ji, this.direction = void 0, this.arcPoints = 64, this.cursors = Zi, this.mouseMove = !1, this.updateOptions(e);
2581
+ super(e, !0), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents = Xi, this.direction = void 0, this.arcPoints = 64, this.cursors = qi, this.mouseMove = !1, this.updateOptions(e);
2582
2582
  }
2583
2583
  updateOptions(e) {
2584
2584
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e != null && e.arcPoints && (this.arcPoints = e.arcPoints);
@@ -2587,8 +2587,8 @@ class Gt extends j {
2587
2587
  if (this.currentStartingPointId === void 0) return;
2588
2588
  const e = this.currentStartingPointId, t = this.currentInitialArcId, i = this.currentId;
2589
2589
  if (e && this.store.delete([e]), t && this.store.delete([t]), this.currentId) {
2590
- const o = ye(this.store.getGeometryCopy(this.currentId));
2591
- o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2590
+ const o = ge(this.store.getGeometryCopy(this.currentId));
2591
+ o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2592
2592
  }
2593
2593
  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" });
2594
2594
  }
@@ -2601,31 +2601,31 @@ class Gt extends j {
2601
2601
  onMouseMove(e) {
2602
2602
  if (this.mouseMove = !0, this.setCursor(this.cursors.start), this.currentInitialArcId !== void 0 && this.currentStartingPointId !== void 0 && this.currentCoordinate !== 0) {
2603
2603
  if (this.currentCoordinate === 2) {
2604
- const t = this.store.getGeometryCopy(this.currentInitialArcId).coordinates, i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = t[0], r = [e.lng, e.lat], n = O(o[0], o[1]), a = O(r[0], r[1]), l = O(i[0], i[1]), d = F(l, n);
2604
+ const t = this.store.getGeometryCopy(this.currentInitialArcId).coordinates, i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = t[0], r = [e.lng, e.lat], n = E(o[0], o[1]), a = E(r[0], r[1]), l = E(i[0], i[1]), d = M(l, n);
2605
2605
  if (this.direction === void 0) {
2606
- const C = At(l, n, a);
2606
+ const C = jt(l, n, a);
2607
2607
  this.direction = C ? "clockwise" : "anticlockwise";
2608
2608
  }
2609
- const c = R(l, n), h = R(l, a), u = this.arcPoints, p = [o], g = H(c), y = H(h);
2609
+ const c = A(l, n), h = A(l, a), u = this.arcPoints, p = [o], g = H(c), y = H(h);
2610
2610
  let f;
2611
2611
  this.direction === "anticlockwise" ? (f = y - g, f < 0 && (f += 360)) : (f = g - y, f < 0 && (f += 360));
2612
2612
  const v = (this.direction === "anticlockwise" ? 1 : -1) * f / u;
2613
2613
  for (let C = 0; C <= u; C++) {
2614
- const m = ue(l, d, g + C * v), { lng: P, lat: I } = A(m.x, m.y), w = [b(P, this.coordinatePrecision), b(I, this.coordinatePrecision)];
2615
- w[0] !== p[p.length - 1][0] && w[1] !== p[p.length - 1][1] && p.push(w);
2614
+ const m = he(l, d, g + C * v), { lng: I, lat: S } = R(m.x, m.y), b = [w(I, this.coordinatePrecision), w(S, this.coordinatePrecision)];
2615
+ b[0] !== p[p.length - 1][0] && b[1] !== p[p.length - 1][1] && p.push(b);
2616
2616
  }
2617
- this.updateLineStringGeometry(this.currentInitialArcId, p, E.Provisional);
2617
+ this.updateLineStringGeometry(this.currentInitialArcId, p, O.Provisional);
2618
2618
  } else if (this.currentCoordinate === 3) {
2619
2619
  const t = this.store.getGeometryCopy(this.currentInitialArcId).coordinates;
2620
2620
  if (t.length < 2 || !this.direction) return;
2621
- const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = t[0], r = t[t.length - 1], n = O(e.lng, e.lat), a = O(o[0], o[1]), l = O(r[0], r[1]), d = O(i[0], i[1]), c = F(d, a), h = F(d, n) < c ? a : n, u = R(d, n), p = R(d, a), g = R(d, l), y = H(p), f = H(g), v = H(u);
2621
+ const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = t[0], r = t[t.length - 1], n = E(e.lng, e.lat), a = E(o[0], o[1]), l = E(r[0], r[1]), d = E(i[0], i[1]), c = M(d, a), h = M(d, n) < c ? a : n, u = A(d, n), p = A(d, a), g = A(d, l), y = H(p), f = H(g), v = H(u);
2622
2622
  if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: f, direction: this.direction })) return;
2623
- const C = this.getDeltaBearing(this.direction, y, f), m = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / m, I = F(d, h), w = [];
2624
- for (let L = 0; L <= m; L++) {
2625
- const M = ue(d, I, y + L * P), { lng: N, lat: k } = A(M.x, M.y), T = [b(N, this.coordinatePrecision), b(k, this.coordinatePrecision)];
2626
- T[0] !== t[t.length - 1][0] && T[1] !== t[t.length - 1][1] && w.unshift(T);
2623
+ const C = this.getDeltaBearing(this.direction, y, f), m = this.arcPoints, I = (this.direction === "anticlockwise" ? 1 : -1) * C / m, S = M(d, h), b = [];
2624
+ for (let F = 0; F <= m; F++) {
2625
+ const L = he(d, S, y + F * I), { lng: N, lat: _ } = R(L.x, L.y), T = [w(N, this.coordinatePrecision), w(_, this.coordinatePrecision)];
2626
+ T[0] !== t[t.length - 1][0] && T[1] !== t[t.length - 1][1] && b.unshift(T);
2627
2627
  }
2628
- t.push(...w), t.push(t[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, t, E.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [t] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2628
+ t.push(...b), t.push(t[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, t, O.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [t] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
2629
2629
  }
2630
2630
  }
2631
2631
  }
@@ -2669,7 +2669,7 @@ class Gt extends j {
2669
2669
  return e.properties.mode === this.mode && (e.geometry.type === "Polygon" ? (t.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, t.polygonFillColor, e), t.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, t.polygonFillOpacity, e), t.zIndex = U) : e.geometry.type === "LineString" ? (t.lineStringColor = this.getHexColorStylingValue(this.styles.outlineColor, t.polygonOutlineColor, e), t.lineStringWidth = this.getNumericStylingValue(this.styles.outlineWidth, t.polygonOutlineWidth, e), t.zIndex = U) : e.geometry.type === "Point" && (t.pointColor = this.getHexColorStylingValue(this.styles.centerPointColor, t.pointColor, e), t.pointWidth = this.getNumericStylingValue(this.styles.centerPointWidth, t.pointWidth, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.centerPointOutlineColor, t.pointOutlineColor, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.centerPointOutlineWidth, t.pointOutlineWidth, e), t.zIndex = 20)), t;
2670
2670
  }
2671
2671
  validateFeature(e) {
2672
- return this.validateModeFeature(e, (t) => ge(t, this.coordinatePrecision));
2672
+ return this.validateModeFeature(e, (t) => pe(t, this.coordinatePrecision));
2673
2673
  }
2674
2674
  afterFeatureUpdated(e) {
2675
2675
  this.currentId === e.id && (this.currentStartingPointId && this.store.delete([this.currentStartingPointId]), this.currentInitialArcId && this.store.delete([this.currentInitialArcId]), this.currentStartingPointId = void 0, this.direction = void 0, this.currentId = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
@@ -2691,7 +2691,7 @@ class Z {
2691
2691
  }, this.callback = t;
2692
2692
  }
2693
2693
  }
2694
- var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
2694
+ var Ji = { __proto__: null, TerraDrawBaseAdapter: class {
2695
2695
  constructor(s) {
2696
2696
  this._nextKeyUpIsContextMenu = !1, this._lastPointerDownEventTarget = void 0, this._ignoreMismatchedPointerEvents = !1, this._minPixelDragDistance = void 0, this._minPixelDragDistanceDrawing = void 0, this._minPixelDragDistanceSelecting = void 0, this._lastDrawEvent = void 0, this._coordinatePrecision = void 0, this._heldKeys = /* @__PURE__ */ new Set(), this._listeners = [], this._dragState = "not-dragging", this._currentModeCallbacks = void 0, this._ignoreMismatchedPointerEvents = typeof s.ignoreMismatchedPointerEvents == "boolean" && s.ignoreMismatchedPointerEvents, this._minPixelDragDistance = typeof s.minPixelDragDistance == "number" ? s.minPixelDragDistance : 1, this._minPixelDragDistanceSelecting = typeof s.minPixelDragDistanceSelecting == "number" ? s.minPixelDragDistanceSelecting : 1, this._minPixelDragDistanceDrawing = typeof s.minPixelDragDistanceDrawing == "number" ? s.minPixelDragDistanceDrawing : 8, this._coordinatePrecision = typeof s.coordinatePrecision == "number" ? s.coordinatePrecision : 9;
2697
2697
  }
@@ -2706,7 +2706,7 @@ var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
2706
2706
  const t = this.getLngLatFromEvent(s);
2707
2707
  if (!t) return null;
2708
2708
  const { lng: i, lat: o } = t, { containerX: r, containerY: n } = this.getMapElementXYPosition(s), a = this.getButton(s), l = Array.from(this._heldKeys);
2709
- return { lng: b(i, this._coordinatePrecision), lat: b(o, this._coordinatePrecision), containerX: r, containerY: n, button: a, heldKeys: l, isContextMenu: e };
2709
+ return { lng: w(i, this._coordinatePrecision), lat: w(o, this._coordinatePrecision), containerX: r, containerY: n, button: a, heldKeys: l, isContextMenu: e };
2710
2710
  }
2711
2711
  register(s) {
2712
2712
  this._currentModeCallbacks = s, this._listeners = this.getAdapterListeners(), this._listeners.forEach((e) => {
@@ -2732,7 +2732,7 @@ var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
2732
2732
  if (e) if (this._dragState === "not-dragging") this._currentModeCallbacks.onMouseMove(e), this._lastDrawEvent = e;
2733
2733
  else if (this._dragState === "pre-dragging") {
2734
2734
  if (!this._lastDrawEvent) return;
2735
- const t = { x: this._lastDrawEvent.containerX, y: this._lastDrawEvent.containerY }, i = { x: e.containerX, y: e.containerY }, o = this._currentModeCallbacks.getState(), r = F(t, i);
2735
+ const t = { x: this._lastDrawEvent.containerX, y: this._lastDrawEvent.containerY }, i = { x: e.containerX, y: e.containerY }, o = this._currentModeCallbacks.getState(), r = M(t, i);
2736
2736
  let n = !1;
2737
2737
  if (n = o === "drawing" ? r < this._minPixelDragDistanceDrawing : o === "selecting" ? r < this._minPixelDragDistanceSelecting : r < this._minPixelDragDistance, n) return;
2738
2738
  this._nextKeyUpIsContextMenu = !1, this._dragState = "dragging", this._currentModeCallbacks.onDragStart(e, (a) => {
@@ -2781,21 +2781,21 @@ var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
2781
2781
  }), this.clear(), this._currentModeCallbacks = void 0, this._lastDrawEvent = void 0, this._lastPointerDownEventTarget = void 0, this._nextKeyUpIsContextMenu = !1;
2782
2782
  }
2783
2783
  } };
2784
- const eo = { cancel: "Escape", finish: "Enter" }, to = { start: "crosshair", close: "pointer" };
2785
- class zt extends j {
2784
+ const Zi = { cancel: "Escape", finish: "Enter" }, Qi = { start: "crosshair", close: "pointer" };
2785
+ class At extends j {
2786
2786
  constructor(e) {
2787
- super(e, !0), this.mode = "freehand-linestring", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = eo, this.cursors = to, this.preventNewFeature = !1, this.updateOptions(e);
2787
+ super(e, !0), this.mode = "freehand-linestring", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = Zi, this.cursors = Qi, this.preventNewFeature = !1, this.updateOptions(e);
2788
2788
  }
2789
2789
  updateOptions(e) {
2790
2790
  super.updateOptions(e), e != null && e.minDistance && (this.minDistance = e.minDistance), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents)), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors));
2791
2791
  }
2792
2792
  close() {
2793
2793
  if (this.currentId === void 0) return;
2794
- this.currentId && this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2794
+ this.currentId && this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2795
2795
  const e = this.currentId;
2796
2796
  if (this.validate && e) {
2797
2797
  const t = this.store.getGeometryCopy(e);
2798
- if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
2798
+ if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Finish }).valid) return;
2799
2799
  }
2800
2800
  this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
2801
2801
  }
@@ -2807,16 +2807,16 @@ class zt extends j {
2807
2807
  }
2808
2808
  onMouseMove(e) {
2809
2809
  if (this.currentId === void 0 || this.startingClick === !1) return void this.setCursor(this.cursors.start);
2810
- const t = this.store.getGeometryCopy(this.currentId), i = t.coordinates.length - 2, [o, r] = t.coordinates[i], { x: n, y: a } = this.project(o, r), l = F({ x: n, y: a }, { x: e.containerX, y: e.containerY }), [d, c] = t.coordinates[t.coordinates.length - 1], { x: h, y: u } = this.project(d, c), p = F({ x: h, y: u }, { x: e.containerX, y: e.containerY });
2810
+ const t = this.store.getGeometryCopy(this.currentId), i = t.coordinates.length - 2, [o, r] = t.coordinates[i], { x: n, y: a } = this.project(o, r), l = M({ x: n, y: a }, { x: e.containerX, y: e.containerY }), [d, c] = t.coordinates[t.coordinates.length - 1], { x: h, y: u } = this.project(d, c), p = M({ x: h, y: u }, { x: e.containerX, y: e.containerY });
2811
2811
  if (this.setCursor(p < this.pointerDistance ? this.cursors.close : this.cursors.start), l < this.minDistance) return;
2812
2812
  const g = { type: "LineString", coordinates: [...t.coordinates, [e.lng, e.lat]] };
2813
- this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.store.updateGeometry([{ id: this.currentId, geometry: g }]), this.closingPointId && this.store.updateGeometry([{ id: this.closingPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]));
2813
+ this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Provisional }).valid || (this.store.updateGeometry([{ id: this.currentId, geometry: g }]), this.closingPointId && this.store.updateGeometry([{ id: this.closingPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]));
2814
2814
  }
2815
2815
  onClick(e) {
2816
2816
  if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) {
2817
2817
  if (this.preventNewFeature) return;
2818
2818
  if (this.startingClick === !1) {
2819
- const [t, i] = this.store.create([{ geometry: { type: "LineString", coordinates: [[e.lng, e.lat], [e.lng, e.lat]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
2819
+ const [t, i] = this.store.create([{ geometry: { type: "LineString", coordinates: [[e.lng, e.lat], [e.lng, e.lat]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: { mode: this.mode, [P.CLOSING_POINT]: !0 } }]);
2820
2820
  return this.currentId = t, this.closingPointId = i, this.startingClick = !0, void (this.state !== "drawing" && this.setDrawing());
2821
2821
  }
2822
2822
  this.close();
@@ -2846,7 +2846,7 @@ class zt extends j {
2846
2846
  return e.type === "Feature" && e.geometry.type === "LineString" && e.properties.mode === this.mode ? (t.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, t.lineStringColor, e), t.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, t.lineStringWidth, e), t.zIndex = U, t) : (e.type === "Feature" && e.geometry.type === "Point" && e.properties.mode === this.mode && (t.pointWidth = this.getNumericStylingValue(this.styles.closingPointWidth, t.pointWidth, e), t.pointColor = this.getHexColorStylingValue(this.styles.closingPointColor, t.pointColor, e), t.pointOutlineColor = this.getHexColorStylingValue(this.styles.closingPointOutlineColor, t.pointOutlineColor, e), t.pointOutlineWidth = this.getNumericStylingValue(this.styles.closingPointOutlineWidth, 2, e), t.zIndex = 50), t);
2847
2847
  }
2848
2848
  validateFeature(e) {
2849
- return this.validateModeFeature(e, (t) => Re(t, this.coordinatePrecision));
2849
+ return this.validateModeFeature(e, (t) => Ae(t, this.coordinatePrecision));
2850
2850
  }
2851
2851
  afterFeatureUpdated(e) {
2852
2852
  this.currentId === e.id && (this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0);
@@ -2867,10 +2867,10 @@ function Be(s) {
2867
2867
  }
2868
2868
  return typeof s == "object" && Object.keys(s).every((e) => typeof e == "string" && Be(s[e]));
2869
2869
  }
2870
- const io = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
2871
- class Vt extends j {
2870
+ const eo = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
2871
+ class Gt extends j {
2872
2872
  constructor(e) {
2873
- super(e, !0), this.mode = "marker", this.cursors = io, this.editable = !1, this.editedFeatureId = void 0, this.markerUrl = void 0, this.markerHeight = void 0, this.markerWidth = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
2873
+ super(e, !0), this.mode = "marker", this.cursors = eo, this.editable = !1, this.editedFeatureId = void 0, this.markerUrl = void 0, this.markerHeight = void 0, this.markerWidth = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(e);
2874
2874
  }
2875
2875
  updateOptions(e) {
2876
2876
  super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e != null && e.editable && (this.editable = e.editable);
@@ -2903,10 +2903,10 @@ class Vt extends j {
2903
2903
  }
2904
2904
  }
2905
2905
  onDrag(e, t) {
2906
- this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
2906
+ this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !0 }])));
2907
2907
  }
2908
2908
  onDragEnd(e, t) {
2909
- this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && 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: S.EDITED, value: !1 }]), this.editedFeatureId = void 0, t(!0));
2909
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && 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: P.EDITED, value: !1 }]), this.editedFeatureId = void 0, t(!0));
2910
2910
  }
2911
2911
  registerBehaviors(e) {
2912
2912
  this.pixelDistance = new oe(e), this.clickBoundingBox = new ie(e);
@@ -2914,14 +2914,14 @@ class Vt extends j {
2914
2914
  styleFeature(e) {
2915
2915
  const t = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0, markerUrl: void 0, markerHeight: void 0, markerWidth: void 0 });
2916
2916
  var i, o, r;
2917
- return e.type === "Feature" && e.geometry.type === "Point" && e.properties.mode === this.mode && (t.zIndex = 30, t.markerHeight = this.getNumericStylingValue((i = this.styles) == null ? void 0 : i.markerHeight, 30, e), t.markerWidth = this.getNumericStylingValue((o = this.styles) == null ? void 0 : o.markerWidth, 30, e), t.markerUrl = this.getUrlStylingValue((r = this.styles) == null ? void 0 : r.markerUrl, "", e)), t;
2917
+ return e.type === "Feature" && e.geometry.type === "Point" && e.properties.mode === this.mode && (t.zIndex = 30, t.markerHeight = this.getNumericStylingValue((i = this.styles) == null ? void 0 : i.markerHeight, 40, e), t.markerWidth = this.getNumericStylingValue((o = this.styles) == null ? void 0 : o.markerWidth, 32, e), t.markerUrl = this.getUrlStylingValue((r = this.styles) == null ? void 0 : r.markerUrl, St, e)), t;
2918
2918
  }
2919
2919
  validateFeature(e) {
2920
2920
  return this.validateModeFeature(e, (t) => Ve(t, this.coordinatePrecision));
2921
2921
  }
2922
2922
  onLeftClick(e) {
2923
- const t = { type: "Point", coordinates: [e.lng, e.lat] }, i = { mode: this.mode, markerUrl: this.markerUrl, markerHeight: this.markerHeight, markerWidth: this.markerWidth };
2924
- if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
2923
+ const t = { type: "Point", coordinates: [e.lng, e.lat] }, i = { mode: this.mode, [P.MARKER]: !0 };
2924
+ if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: O.Finish }).valid) return;
2925
2925
  const [o] = this.store.create([{ geometry: t, properties: i }]);
2926
2926
  this.onFinish(o, { mode: this.mode, action: "draw" });
2927
2927
  }
@@ -2945,9 +2945,9 @@ class Vt extends j {
2945
2945
  this.editedFeatureId === e.id && (this.editedFeatureId = void 0, this.setCursor(this.cursors.create));
2946
2946
  }
2947
2947
  }
2948
- class oo {
2948
+ class to {
2949
2949
  constructor(e) {
2950
- this._modes = void 0, this._mode = void 0, this._adapter = void 0, this._enabled = !1, this._store = void 0, this._eventListeners = void 0, this._instanceSelectMode = void 0, this._adapter = e.adapter, this._mode = new Wi();
2950
+ this._modes = void 0, this._mode = void 0, this._adapter = void 0, this._enabled = !1, this._store = void 0, this._eventListeners = void 0, this._instanceSelectMode = void 0, this._adapter = e.adapter, this._mode = new Ni();
2951
2951
  const t = /* @__PURE__ */ new Set(), i = e.modes.reduce((c, h) => {
2952
2952
  if (t.has(h.mode)) throw new Error(`There is already a ${h.mode} mode provided`);
2953
2953
  return t.add(h.mode), c[h.mode] = h, c;
@@ -2958,7 +2958,7 @@ class oo {
2958
2958
  if (this._instanceSelectMode) throw new Error("only one type of select mode can be provided");
2959
2959
  this._instanceSelectMode = c;
2960
2960
  }
2961
- }), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new zi({ tracked: !!e.tracked, idStrategy: e.idStrategy ? e.idStrategy : void 0 });
2961
+ }), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new Ai({ tracked: !!e.tracked, idStrategy: e.idStrategy ? e.idStrategy : void 0 });
2962
2962
  const r = (c) => {
2963
2963
  const h = [], u = this._store.copyAll().filter((p) => !c.includes(p.id) || (h.push(p), !1));
2964
2964
  return { changed: h, unchanged: u };
@@ -2998,16 +2998,16 @@ class oo {
2998
2998
  getModeStyles() {
2999
2999
  const e = {};
3000
3000
  return Object.keys(this._modes).forEach((t) => {
3001
- e[t] = (i) => this._instanceSelectMode && i.properties[_.SELECTED] ? this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(i) : this._modes[t].styleFeature.bind(this._modes[t])(i);
3001
+ e[t] = (i) => this._instanceSelectMode && i.properties[D.SELECTED] ? this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(i) : this._modes[t].styleFeature.bind(this._modes[t])(i);
3002
3002
  }), e;
3003
3003
  }
3004
3004
  featuresAtLocation({ lng: e, lat: t }, i) {
3005
- const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, r = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = !(!i || i.ignoreSnappingPoints === void 0) && i.ignoreSnappingPoints, c = this._adapter.unproject.bind(this._adapter), h = this._adapter.project.bind(this._adapter), u = h(e, t), p = Ft({ unproject: c, point: u, pointerDistance: o });
3005
+ const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, r = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = !(!i || i.ignoreSnappingPoints === void 0) && i.ignoreSnappingPoints, c = this._adapter.unproject.bind(this._adapter), h = this._adapter.project.bind(this._adapter), u = h(e, t), p = bt({ unproject: c, point: u, pointerDistance: o });
3006
3006
  return this._store.search(p).filter((g) => {
3007
- if (r && (g.properties[_.MID_POINT] || g.properties[_.SELECTION_POINT]) || n && g.properties[S.COORDINATE_POINT] || l && g.properties[S.CLOSING_POINT] || a && g.properties[S.CURRENTLY_DRAWING] || d && g.properties[S.SNAPPING_POINT]) return !1;
3007
+ if (r && (g.properties[D.MID_POINT] || g.properties[D.SELECTION_POINT]) || n && g.properties[P.COORDINATE_POINT] || l && g.properties[P.CLOSING_POINT] || a && g.properties[P.CURRENTLY_DRAWING] || d && g.properties[P.SNAPPING_POINT]) return !1;
3008
3008
  if (g.geometry.type === "Point") {
3009
3009
  const y = g.geometry.coordinates, f = h(y[0], y[1]);
3010
- return F(u, f) < o;
3010
+ return M(u, f) < o;
3011
3011
  }
3012
3012
  if (g.geometry.type === "LineString") {
3013
3013
  const y = g.geometry.coordinates;
@@ -3017,12 +3017,12 @@ class oo {
3017
3017
  }
3018
3018
  return !1;
3019
3019
  }
3020
- if (Tt([e, t], g.geometry.coordinates)) return !0;
3020
+ if (_t([e, t], g.geometry.coordinates)) return !0;
3021
3021
  if (i != null && i.includePolygonsWithinPointerDistance) {
3022
3022
  const y = g.geometry.coordinates;
3023
3023
  for (const f of y) for (let v = 0; v < f.length - 1; v++) {
3024
- const C = f[v], m = f[v + 1], P = h(C[0], C[1]), I = h(m[0], m[1]);
3025
- if (Te(u, P, I) < o) return !0;
3024
+ const C = f[v], m = f[v + 1], I = h(C[0], C[1]), S = h(m[0], m[1]);
3025
+ if (Te(u, I, S) < o) return !0;
3026
3026
  }
3027
3027
  }
3028
3028
  return !1;
@@ -3036,8 +3036,8 @@ class oo {
3036
3036
  }
3037
3037
  let f, v = -1, C = 1 / 0;
3038
3038
  for (let m = 0; m < y.length; m++) {
3039
- const P = y[m], I = F(h(P[0], P[1]), u);
3040
- I < C && (v = m, C = I, f = P);
3039
+ const I = y[m], S = M(h(I[0], I[1]), u);
3040
+ S < C && (v = m, C = S, f = I);
3041
3041
  }
3042
3042
  return g.properties.closestCoordinateIndexToEvent = v, g.properties.closestCoordinatePixelDistanceToEvent = C, g.properties.closestCoordinateDistanceKmToEvent = G(f, [e, t]), g;
3043
3043
  });
@@ -3053,7 +3053,7 @@ class oo {
3053
3053
  return e && t !== this._instanceSelectMode && this.setMode(this._instanceSelectMode), this._modes[this._instanceSelectMode];
3054
3054
  }
3055
3055
  isGuidanceFeature(e) {
3056
- return !!(e.properties[_.MID_POINT] || e.properties[_.SELECTION_POINT] || e.properties[S.COORDINATE_POINT] || e.properties[S.SNAPPING_POINT]);
3056
+ return !!(e.properties[D.MID_POINT] || e.properties[D.SELECTION_POINT] || e.properties[P.COORDINATE_POINT] || e.properties[P.SNAPPING_POINT]);
3057
3057
  }
3058
3058
  setModeStyles(e, t) {
3059
3059
  if (this.checkEnabled(), !this._modes[e]) throw new Error("No mode with this name present");
@@ -3094,7 +3094,7 @@ class oo {
3094
3094
  e.forEach((i) => {
3095
3095
  if (!this._store.has(i)) throw new Error(`No feature with id ${i}, can not delete`);
3096
3096
  const o = this._store.copy(i);
3097
- o.properties[_.SELECTED] && this.deselectFeature(i), o.properties[S.COORDINATE_POINT_IDS] && t.push(...o.properties[S.COORDINATE_POINT_IDS]);
3097
+ o.properties[D.SELECTED] && this.deselectFeature(i), o.properties[P.COORDINATE_POINT_IDS] && t.push(...o.properties[P.COORDINATE_POINT_IDS]);
3098
3098
  }), this._store.delete([...e, ...t], { origin: "api" });
3099
3099
  }
3100
3100
  selectFeature(e) {
@@ -3110,7 +3110,7 @@ class oo {
3110
3110
  return this._store.has(e);
3111
3111
  }
3112
3112
  checkIsReservedProperty(e) {
3113
- return ![...Object.values(_), ...Object.values(S)].includes(e);
3113
+ return ![...Object.values(D), ...Object.values(P)].includes(e);
3114
3114
  }
3115
3115
  updateFeatureProperties(e, t) {
3116
3116
  if (!this._store.has(e)) throw new Error(`No feature with id ${e} present in store`);
@@ -3136,7 +3136,7 @@ class oo {
3136
3136
  if (!a.valid) throw new Error(`Feature validation failed: ${a.reason || "Unknown reason"}`);
3137
3137
  if (this._store.updateGeometry([{ id: i.id, geometry: t }], { origin: "api" }), r.afterFeatureUpdated) {
3138
3138
  r.afterFeatureUpdated(n);
3139
- const l = n.properties[_.SELECTED], d = this.getSelectMode({ switchToSelectMode: !1 });
3139
+ const l = n.properties[D.SELECTED], d = this.getSelectMode({ switchToSelectMode: !1 });
3140
3140
  d && l && d.afterFeatureUpdated(n);
3141
3141
  }
3142
3142
  }
@@ -3154,12 +3154,12 @@ class oo {
3154
3154
  }
3155
3155
  if (t.projection != "web-mercator") throw new Error(`Projection ${t.projection} is not currently supported for transformation`);
3156
3156
  if (t.type === "scale") {
3157
- const { x: a, y: l } = O(t.origin[0], t.origin[1]);
3158
- Bt({ coordinates: n, originX: a, originY: l, xScale: t.options.xScale || 1, yScale: t.options.yScale || 1 });
3159
- } else t.type === "rotate" && (i = Wt(i, t.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
3160
- if (n = n.map((a) => [b(a[0], this._adapter.getCoordinatePrecision()), b(a[1], this._adapter.getCoordinatePrecision())]), i.geometry.coordinates = i.geometry.type === "Polygon" ? [n] : n, this._store.updateGeometry([{ id: i.id, geometry: i.geometry }], { origin: "api" }), r.afterFeatureUpdated) {
3157
+ const { x: a, y: l } = E(t.origin[0], t.origin[1]);
3158
+ Tt({ coordinates: n, originX: a, originY: l, xScale: t.options.xScale || 1, yScale: t.options.yScale || 1 });
3159
+ } else t.type === "rotate" && (i = Nt(i, t.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
3160
+ if (n = n.map((a) => [w(a[0], this._adapter.getCoordinatePrecision()), w(a[1], this._adapter.getCoordinatePrecision())]), i.geometry.coordinates = i.geometry.type === "Polygon" ? [n] : n, this._store.updateGeometry([{ id: i.id, geometry: i.geometry }], { origin: "api" }), r.afterFeatureUpdated) {
3161
3161
  r.afterFeatureUpdated(i);
3162
- const a = i.properties[_.SELECTED], l = this.getSelectMode({ switchToSelectMode: !1 });
3162
+ const a = i.properties[D.SELECTED], l = this.getSelectMode({ switchToSelectMode: !1 });
3163
3163
  l && a && l.afterFeatureUpdated(i);
3164
3164
  }
3165
3165
  }
@@ -3222,7 +3222,7 @@ class oo {
3222
3222
  i.includes(t) && i.splice(i.indexOf(t), 1);
3223
3223
  }
3224
3224
  }
3225
- class ro extends Qi.TerraDrawBaseAdapter {
3225
+ class io extends Ji.TerraDrawBaseAdapter {
3226
3226
  constructor(e) {
3227
3227
  super(e), this._renderBeforeLayerId = void 0, this._prefixId = void 0, this._initialDragPan = void 0, this._initialDragRotate = void 0, this._nextRender = void 0, this._map = void 0, this._container = void 0, this.changedIds = { deletion: !1, points: !1, linestrings: !1, polygons: !1, styling: !1 }, this._map = e.map, this._container = this._map.getContainer(), this._initialDragRotate = this._map.dragRotate.isEnabled(), this._initialDragPan = this._map.dragPan.isEnabled(), this._renderBeforeLayerId = e.renderBelowLayerId, this._prefixId = e.prefixId || "td";
3228
3228
  }
@@ -3341,7 +3341,7 @@ class ro extends Qi.TerraDrawBaseAdapter {
3341
3341
  this._renderBeforeLayerId && (this._map.moveLayer(r, this._renderBeforeLayerId), this._map.moveLayer(o, r), this._map.moveLayer(i + "-outline", o), this._map.moveLayer(i, o)), (t = this._currentModeCallbacks) != null && t.onReady && ((n = this._currentModeCallbacks) == null || n.onReady());
3342
3342
  }
3343
3343
  }
3344
- const qo = [
3344
+ const Zo = [
3345
3345
  "render",
3346
3346
  "point",
3347
3347
  "marker",
@@ -3358,7 +3358,7 @@ const qo = [
3358
3358
  "delete-selection",
3359
3359
  "delete",
3360
3360
  "download"
3361
- ], Jo = [
3361
+ ], Qo = [
3362
3362
  "render",
3363
3363
  "linestring",
3364
3364
  "point",
@@ -3367,7 +3367,7 @@ const qo = [
3367
3367
  "delete",
3368
3368
  "download",
3369
3369
  "settings"
3370
- ], so = {
3370
+ ], oo = {
3371
3371
  modes: [
3372
3372
  "render",
3373
3373
  "point",
@@ -3402,7 +3402,7 @@ const qo = [
3402
3402
  "square yards": "yd²",
3403
3403
  acres: "acres",
3404
3404
  "square miles": "mi²"
3405
- }, no = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20inkscape:version='1.0%20(4035a4fb49,%202020-05-01)'%20sodipodi:docname='poi.svg'%20id='svg4460'%20height='100'%20width='100'%20version='1.1'%3e%3csodipodi:namedview%20inkscape:document-rotation='0'%20inkscape:current-layer='svg4460'%20inkscape:window-maximized='1'%20inkscape:window-y='-8'%20inkscape:window-x='-8'%20inkscape:cy='70.031285'%20inkscape:cx='-78.460726'%20inkscape:zoom='2.02'%20showgrid='false'%20id='namedview11'%20inkscape:window-height='1017'%20inkscape:window-width='1920'%20inkscape:pageshadow='2'%20inkscape:pageopacity='0'%20guidetolerance='10'%20gridtolerance='10'%20objecttolerance='10'%20borderopacity='1'%20bordercolor='%23666666'%20pagecolor='%23ffffff'%20/%3e%3cdefs%20id='defs4462'%20/%3e%3cmetadata%20id='metadata4465'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cpath%20d='M%2050.001528,3.3861402e-7%20C%2030.763177,3.3861402e-7%2015,15.718144%2015,34.901534%20c%200,7.432782%202.373565,14.339962%206.391689,20.019029%20l%2024.338528,42.073163%20c%203.40849,4.452814%205.674917,3.607154%208.509014,-0.23458%20L%2081.083105,51.075788%20C%2081.625418,50.0948%2082.050328,49.050173%2082.421327,47.983517%2084.078241,43.936622%2085.000002,39.521943%2085,34.901534%2085,15.718144%2069.23988,3.3861402e-7%2050.001528,3.3861402e-7%20Z%20m%200,16.35400066138598%20c%2010.359296,0%2018.597616,8.21783%2018.597618,18.547533%200,10.329703%20-8.238322,18.544487%20-18.597618,18.544487%20-10.359299,0%20-18.600672,-8.214784%20-18.600672,-18.544487%200,-10.329703%208.241373,-18.547533%2018.600672,-18.547533%20z'%20style='fill:rgb(95,%2099,%20104);stroke-width:4.26019'%20id='path4135'%20/%3e%3c/svg%3e", he = {
3405
+ }, ro = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20inkscape:version='1.0%20(4035a4fb49,%202020-05-01)'%20sodipodi:docname='poi.svg'%20id='svg4460'%20height='100'%20width='100'%20version='1.1'%3e%3csodipodi:namedview%20inkscape:document-rotation='0'%20inkscape:current-layer='svg4460'%20inkscape:window-maximized='1'%20inkscape:window-y='-8'%20inkscape:window-x='-8'%20inkscape:cy='70.031285'%20inkscape:cx='-78.460726'%20inkscape:zoom='2.02'%20showgrid='false'%20id='namedview11'%20inkscape:window-height='1017'%20inkscape:window-width='1920'%20inkscape:pageshadow='2'%20inkscape:pageopacity='0'%20guidetolerance='10'%20gridtolerance='10'%20objecttolerance='10'%20borderopacity='1'%20bordercolor='%23666666'%20pagecolor='%23ffffff'%20/%3e%3cdefs%20id='defs4462'%20/%3e%3cmetadata%20id='metadata4465'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cpath%20d='M%2050.001528,3.3861402e-7%20C%2030.763177,3.3861402e-7%2015,15.718144%2015,34.901534%20c%200,7.432782%202.373565,14.339962%206.391689,20.019029%20l%2024.338528,42.073163%20c%203.40849,4.452814%205.674917,3.607154%208.509014,-0.23458%20L%2081.083105,51.075788%20C%2081.625418,50.0948%2082.050328,49.050173%2082.421327,47.983517%2084.078241,43.936622%2085.000002,39.521943%2085,34.901534%2085,15.718144%2069.23988,3.3861402e-7%2050.001528,3.3861402e-7%20Z%20m%200,16.35400066138598%20c%2010.359296,0%2018.597616,8.21783%2018.597618,18.547533%200,10.329703%20-8.238322,18.544487%20-18.597618,18.544487%20-10.359299,0%20-18.600672,-8.214784%20-18.600672,-18.544487%200,-10.329703%208.241373,-18.547533%2018.600672,-18.547533%20z'%20style='fill:rgb(95,%2099,%20104);stroke-width:4.26019'%20id='path4135'%20/%3e%3c/svg%3e", Ee = {
3406
3406
  modes: [
3407
3407
  "render",
3408
3408
  "point",
@@ -3433,10 +3433,10 @@ const qo = [
3433
3433
  pointOutlineWidth: 1
3434
3434
  }
3435
3435
  }),
3436
- marker: new Vt({
3436
+ marker: new Gt({
3437
3437
  editable: !0,
3438
3438
  styles: {
3439
- markerUrl: no,
3439
+ markerUrl: ro,
3440
3440
  markerWidth: 27,
3441
3441
  markerHeight: 27
3442
3442
  }
@@ -3452,7 +3452,7 @@ const qo = [
3452
3452
  closingPointOutlineWidth: 1
3453
3453
  }
3454
3454
  }),
3455
- polygon: new Dt({
3455
+ polygon: new Mt({
3456
3456
  editable: !0,
3457
3457
  styles: {
3458
3458
  fillColor: "#EDEFF0",
@@ -3465,7 +3465,7 @@ const qo = [
3465
3465
  closingPointOutlineWidth: 1
3466
3466
  }
3467
3467
  }),
3468
- rectangle: new kt({
3468
+ rectangle: new Lt({
3469
3469
  styles: {
3470
3470
  fillColor: "#EDEFF0",
3471
3471
  fillOpacity: 0.7,
@@ -3473,7 +3473,7 @@ const qo = [
3473
3473
  outlineWidth: 2
3474
3474
  }
3475
3475
  }),
3476
- "angled-rectangle": new Ut({
3476
+ "angled-rectangle": new Bt({
3477
3477
  styles: {
3478
3478
  fillColor: "#EDEFF0",
3479
3479
  fillOpacity: 0.7,
@@ -3481,7 +3481,7 @@ const qo = [
3481
3481
  outlineWidth: 2
3482
3482
  }
3483
3483
  }),
3484
- circle: new wt({
3484
+ circle: new Ot({
3485
3485
  styles: {
3486
3486
  fillColor: "#EDEFF0",
3487
3487
  fillOpacity: 0.7,
@@ -3489,7 +3489,7 @@ const qo = [
3489
3489
  outlineWidth: 2
3490
3490
  }
3491
3491
  }),
3492
- freehand: new Lt({
3492
+ freehand: new wt({
3493
3493
  styles: {
3494
3494
  fillColor: "#EDEFF0",
3495
3495
  fillOpacity: 0.7,
@@ -3501,7 +3501,7 @@ const qo = [
3501
3501
  closingPointOutlineWidth: 1
3502
3502
  }
3503
3503
  }),
3504
- "freehand-linestring": new zt({
3504
+ "freehand-linestring": new At({
3505
3505
  styles: {
3506
3506
  lineStringColor: "#666666",
3507
3507
  lineStringWidth: 2,
@@ -3511,7 +3511,7 @@ const qo = [
3511
3511
  closingPointOutlineWidth: 1
3512
3512
  }
3513
3513
  }),
3514
- sensor: new Gt({
3514
+ sensor: new Rt({
3515
3515
  styles: {
3516
3516
  fillColor: "#EDEFF0",
3517
3517
  fillOpacity: 0.7,
@@ -3523,7 +3523,7 @@ const qo = [
3523
3523
  centerPointOutlineWidth: 1
3524
3524
  }
3525
3525
  }),
3526
- sector: new Rt({
3526
+ sector: new Ut({
3527
3527
  styles: {
3528
3528
  fillColor: "#EDEFF0",
3529
3529
  fillOpacity: 0.7,
@@ -3593,9 +3593,9 @@ const qo = [
3593
3593
  feature: {
3594
3594
  draggable: !0,
3595
3595
  coordinates: {
3596
- midpoints: !0,
3597
- draggable: !0,
3598
- deletable: !0
3596
+ resizable: "center",
3597
+ deletable: !1,
3598
+ midpoints: !1
3599
3599
  }
3600
3600
  }
3601
3601
  },
@@ -3603,11 +3603,10 @@ const qo = [
3603
3603
  feature: {
3604
3604
  draggable: !0,
3605
3605
  rotateable: !0,
3606
- scaleable: !0,
3607
3606
  coordinates: {
3608
- midpoints: !0,
3609
- draggable: !0,
3610
- deletable: !0
3607
+ resizable: "opposite",
3608
+ deletable: !1,
3609
+ midpoints: !0
3611
3610
  }
3612
3611
  }
3613
3612
  },
@@ -3615,11 +3614,10 @@ const qo = [
3615
3614
  feature: {
3616
3615
  draggable: !0,
3617
3616
  rotateable: !0,
3618
- scaleable: !0,
3619
3617
  coordinates: {
3620
- midpoints: !0,
3621
- draggable: !0,
3622
- deletable: !0
3618
+ resizable: "opposite",
3619
+ deletable: !1,
3620
+ midpoints: !0
3623
3621
  }
3624
3622
  }
3625
3623
  },
@@ -3653,7 +3651,7 @@ const qo = [
3653
3651
  pointLayerLabelSpec: {
3654
3652
  id: "{prefix}-point-label",
3655
3653
  type: "symbol",
3656
- source: "{prefix}-point-source",
3654
+ source: "{prefix}-point",
3657
3655
  filter: [
3658
3656
  "all",
3659
3657
  ["==", "$type", "Point"],
@@ -4060,7 +4058,7 @@ Alt. `,
4060
4058
  "text-halo-color": "rgb(255, 255, 255)"
4061
4059
  }
4062
4060
  }
4063
- }, ao = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20inkscape:version='1.0%20(4035a4fb49,%202020-05-01)'%20sodipodi:docname='poi.svg'%20id='svg4460'%20height='100'%20width='100'%20version='1.1'%3e%3csodipodi:namedview%20inkscape:document-rotation='0'%20inkscape:current-layer='svg4460'%20inkscape:window-maximized='1'%20inkscape:window-y='-8'%20inkscape:window-x='-8'%20inkscape:cy='70.031285'%20inkscape:cx='-78.460726'%20inkscape:zoom='2.02'%20showgrid='false'%20id='namedview11'%20inkscape:window-height='1017'%20inkscape:window-width='1920'%20inkscape:pageshadow='2'%20inkscape:pageopacity='0'%20guidetolerance='10'%20gridtolerance='10'%20objecttolerance='10'%20borderopacity='1'%20bordercolor='%23666666'%20pagecolor='%23ffffff'%20/%3e%3cdefs%20id='defs4462'%20/%3e%3cmetadata%20id='metadata4465'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cpath%20d='M%2050.001528,3.3861402e-7%20C%2030.763177,3.3861402e-7%2015,15.718144%2015,34.901534%20c%200,7.432782%202.373565,14.339962%206.391689,20.019029%20l%2024.338528,42.073163%20c%203.40849,4.452814%205.674917,3.607154%208.509014,-0.23458%20L%2081.083105,51.075788%20C%2081.625418,50.0948%2082.050328,49.050173%2082.421327,47.983517%2084.078241,43.936622%2085.000002,39.521943%2085,34.901534%2085,15.718144%2069.23988,3.3861402e-7%2050.001528,3.3861402e-7%20Z%20m%200,16.35400066138598%20c%2010.359296,0%2018.597616,8.21783%2018.597618,18.547533%200,10.329703%20-8.238322,18.544487%20-18.597618,18.544487%20-10.359299,0%20-18.600672,-8.214784%20-18.600672,-18.544487%200,-10.329703%208.241373,-18.547533%2018.600672,-18.547533%20z'%20style='fill:%233FB1CE;stroke-width:4.26019'%20id='path4135'%20/%3e%3c/svg%3e", lo = () => ({
4061
+ }, so = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20inkscape:version='1.0%20(4035a4fb49,%202020-05-01)'%20sodipodi:docname='poi.svg'%20id='svg4460'%20height='100'%20width='100'%20version='1.1'%3e%3csodipodi:namedview%20inkscape:document-rotation='0'%20inkscape:current-layer='svg4460'%20inkscape:window-maximized='1'%20inkscape:window-y='-8'%20inkscape:window-x='-8'%20inkscape:cy='70.031285'%20inkscape:cx='-78.460726'%20inkscape:zoom='2.02'%20showgrid='false'%20id='namedview11'%20inkscape:window-height='1017'%20inkscape:window-width='1920'%20inkscape:pageshadow='2'%20inkscape:pageopacity='0'%20guidetolerance='10'%20gridtolerance='10'%20objecttolerance='10'%20borderopacity='1'%20bordercolor='%23666666'%20pagecolor='%23ffffff'%20/%3e%3cdefs%20id='defs4462'%20/%3e%3cmetadata%20id='metadata4465'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cpath%20d='M%2050.001528,3.3861402e-7%20C%2030.763177,3.3861402e-7%2015,15.718144%2015,34.901534%20c%200,7.432782%202.373565,14.339962%206.391689,20.019029%20l%2024.338528,42.073163%20c%203.40849,4.452814%205.674917,3.607154%208.509014,-0.23458%20L%2081.083105,51.075788%20C%2081.625418,50.0948%2082.050328,49.050173%2082.421327,47.983517%2084.078241,43.936622%2085.000002,39.521943%2085,34.901534%2085,15.718144%2069.23988,3.3861402e-7%2050.001528,3.3861402e-7%20Z%20m%200,16.35400066138598%20c%2010.359296,0%2018.597616,8.21783%2018.597618,18.547533%200,10.329703%20-8.238322,18.544487%20-18.597618,18.544487%20-10.359299,0%20-18.600672,-8.214784%20-18.600672,-18.544487%200,-10.329703%208.241373,-18.547533%2018.600672,-18.547533%20z'%20style='fill:%233FB1CE;stroke-width:4.26019'%20id='path4135'%20/%3e%3c/svg%3e", no = () => ({
4064
4062
  render: new ee({
4065
4063
  modeName: "render",
4066
4064
  styles: {}
@@ -4068,10 +4066,10 @@ Alt. `,
4068
4066
  point: new $e({
4069
4067
  editable: !0
4070
4068
  }),
4071
- marker: new Vt({
4069
+ marker: new Gt({
4072
4070
  editable: !0,
4073
4071
  styles: {
4074
- markerUrl: ao,
4072
+ markerUrl: so,
4075
4073
  markerWidth: 27,
4076
4074
  markerHeight: 27
4077
4075
  }
@@ -4079,22 +4077,22 @@ Alt. `,
4079
4077
  linestring: new ze({
4080
4078
  editable: !0
4081
4079
  }),
4082
- polygon: new Dt({
4080
+ polygon: new Mt({
4083
4081
  editable: !0,
4084
4082
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4085
4083
  // @ts-ignore
4086
4084
  validation: (e, t) => {
4087
4085
  const i = t.updateType;
4088
- return i === "finish" || i === "commit" ? Yi(e) : { valid: !0 };
4086
+ return i === "finish" || i === "commit" ? Vi(e) : { valid: !0 };
4089
4087
  }
4090
4088
  }),
4091
- rectangle: new kt(),
4092
- "angled-rectangle": new Ut(),
4093
- circle: new wt(),
4094
- freehand: new Lt(),
4095
- "freehand-linestring": new zt(),
4096
- sensor: new Gt(),
4097
- sector: new Rt(),
4089
+ rectangle: new Lt(),
4090
+ "angled-rectangle": new Bt(),
4091
+ circle: new Ot(),
4092
+ freehand: new wt(),
4093
+ "freehand-linestring": new At(),
4094
+ sensor: new Rt(),
4095
+ sector: new Ut(),
4098
4096
  select: new Ye({
4099
4097
  flags: {
4100
4098
  point: {
@@ -4157,9 +4155,9 @@ Alt. `,
4157
4155
  feature: {
4158
4156
  draggable: !0,
4159
4157
  coordinates: {
4160
- midpoints: !0,
4161
- draggable: !0,
4162
- deletable: !0
4158
+ resizable: "center",
4159
+ deletable: !1,
4160
+ midpoints: !1
4163
4161
  }
4164
4162
  }
4165
4163
  },
@@ -4167,11 +4165,10 @@ Alt. `,
4167
4165
  feature: {
4168
4166
  draggable: !0,
4169
4167
  rotateable: !0,
4170
- scaleable: !0,
4171
4168
  coordinates: {
4172
- midpoints: !0,
4173
- draggable: !0,
4174
- deletable: !0
4169
+ resizable: "opposite",
4170
+ deletable: !1,
4171
+ midpoints: !0
4175
4172
  }
4176
4173
  }
4177
4174
  },
@@ -4179,11 +4176,10 @@ Alt. `,
4179
4176
  feature: {
4180
4177
  draggable: !0,
4181
4178
  rotateable: !0,
4182
- scaleable: !0,
4183
4179
  coordinates: {
4184
- midpoints: !0,
4185
- draggable: !0,
4186
- deletable: !0
4180
+ resizable: "opposite",
4181
+ deletable: !1,
4182
+ midpoints: !0
4187
4183
  }
4188
4184
  }
4189
4185
  },
@@ -4226,7 +4222,7 @@ Alt. `,
4226
4222
  styles: {}
4227
4223
  })
4228
4224
  });
4229
- var W = 63710088e-1, co = {
4225
+ var W = 63710088e-1, ao = {
4230
4226
  centimeters: W * 100,
4231
4227
  centimetres: W * 100,
4232
4228
  degrees: 360 / (2 * Math.PI),
@@ -4243,11 +4239,11 @@ var W = 63710088e-1, co = {
4243
4239
  radians: 1,
4244
4240
  yards: W * 1.0936
4245
4241
  };
4246
- function ho(s, e, t = {}) {
4242
+ function lo(s, e, t = {}) {
4247
4243
  const i = { type: "Feature" };
4248
4244
  return (t.id === 0 || t.id) && (i.id = t.id), t.bbox && (i.bbox = t.bbox), i.properties = e || {}, i.geometry = s, i;
4249
4245
  }
4250
- function uo(s, e, t = {}) {
4246
+ function co(s, e, t = {}) {
4251
4247
  if (!s)
4252
4248
  throw new Error("coordinates is required");
4253
4249
  if (!Array.isArray(s))
@@ -4256,33 +4252,33 @@ function uo(s, e, t = {}) {
4256
4252
  throw new Error("coordinates must be at least 2 numbers long");
4257
4253
  if (!ft(s[0]) || !ft(s[1]))
4258
4254
  throw new Error("coordinates must contain numbers");
4259
- return ho({
4255
+ return lo({
4260
4256
  type: "Point",
4261
4257
  coordinates: s
4262
4258
  }, e, t);
4263
4259
  }
4264
- function po(s, e = "kilometers") {
4265
- const t = co[e];
4260
+ function ho(s, e = "kilometers") {
4261
+ const t = ao[e];
4266
4262
  if (!t)
4267
4263
  throw new Error(e + " units is invalid");
4268
4264
  return s * t;
4269
4265
  }
4270
- function Pe(s) {
4266
+ function Ce(s) {
4271
4267
  return s % 360 * Math.PI / 180;
4272
4268
  }
4273
4269
  function ft(s) {
4274
4270
  return !isNaN(s) && s !== null && !Array.isArray(s);
4275
4271
  }
4276
- function $t(s, e, t) {
4272
+ function zt(s, e, t) {
4277
4273
  if (s !== null)
4278
4274
  for (var i, o, r, n, a, l, d, c = 0, h = 0, u, p = s.type, g = p === "FeatureCollection", y = p === "Feature", f = g ? s.features.length : 1, v = 0; v < f; v++) {
4279
4275
  d = g ? s.features[v].geometry : y ? s.geometry : s, u = d ? d.type === "GeometryCollection" : !1, a = u ? d.geometries.length : 1;
4280
4276
  for (var C = 0; C < a; C++) {
4281
- var m = 0, P = 0;
4277
+ var m = 0, I = 0;
4282
4278
  if (n = u ? d.geometries[C] : d, n !== null) {
4283
4279
  l = n.coordinates;
4284
- var I = n.type;
4285
- switch (c = I === "Polygon" || I === "MultiPolygon" ? 1 : 0, I) {
4280
+ var S = n.type;
4281
+ switch (c = S === "Polygon" || S === "MultiPolygon" ? 1 : 0, S) {
4286
4282
  case null:
4287
4283
  break;
4288
4284
  case "Point":
@@ -4291,7 +4287,7 @@ function $t(s, e, t) {
4291
4287
  h,
4292
4288
  v,
4293
4289
  m,
4294
- P
4290
+ I
4295
4291
  ) === !1)
4296
4292
  return !1;
4297
4293
  h++, m++;
@@ -4304,12 +4300,12 @@ function $t(s, e, t) {
4304
4300
  h,
4305
4301
  v,
4306
4302
  m,
4307
- P
4303
+ I
4308
4304
  ) === !1)
4309
4305
  return !1;
4310
- h++, I === "MultiPoint" && m++;
4306
+ h++, S === "MultiPoint" && m++;
4311
4307
  }
4312
- I === "LineString" && m++;
4308
+ S === "LineString" && m++;
4313
4309
  break;
4314
4310
  case "Polygon":
4315
4311
  case "MultiLineString":
@@ -4320,37 +4316,37 @@ function $t(s, e, t) {
4320
4316
  h,
4321
4317
  v,
4322
4318
  m,
4323
- P
4319
+ I
4324
4320
  ) === !1)
4325
4321
  return !1;
4326
4322
  h++;
4327
4323
  }
4328
- I === "MultiLineString" && m++, I === "Polygon" && P++;
4324
+ S === "MultiLineString" && m++, S === "Polygon" && I++;
4329
4325
  }
4330
- I === "Polygon" && m++;
4326
+ S === "Polygon" && m++;
4331
4327
  break;
4332
4328
  case "MultiPolygon":
4333
4329
  for (i = 0; i < l.length; i++) {
4334
- for (P = 0, o = 0; o < l[i].length; o++) {
4330
+ for (I = 0, o = 0; o < l[i].length; o++) {
4335
4331
  for (r = 0; r < l[i][o].length - c; r++) {
4336
4332
  if (e(
4337
4333
  l[i][o][r],
4338
4334
  h,
4339
4335
  v,
4340
4336
  m,
4341
- P
4337
+ I
4342
4338
  ) === !1)
4343
4339
  return !1;
4344
4340
  h++;
4345
4341
  }
4346
- P++;
4342
+ I++;
4347
4343
  }
4348
4344
  m++;
4349
4345
  }
4350
4346
  break;
4351
4347
  case "GeometryCollection":
4352
4348
  for (i = 0; i < n.geometries.length; i++)
4353
- if ($t(n.geometries[i], e) === !1)
4349
+ if (zt(n.geometries[i], e) === !1)
4354
4350
  return !1;
4355
4351
  break;
4356
4352
  default:
@@ -4360,7 +4356,7 @@ function $t(s, e, t) {
4360
4356
  }
4361
4357
  }
4362
4358
  }
4363
- function go(s, e) {
4359
+ function uo(s, e) {
4364
4360
  var t, i, o, r, n, a, l, d, c, h, u = 0, p = s.type === "FeatureCollection", g = s.type === "Feature", y = p ? s.features.length : 1;
4365
4361
  for (t = 0; t < y; t++) {
4366
4362
  for (a = p ? s.features[t].geometry : g ? s.geometry : s, d = p ? s.features[t].properties : g ? s.properties : {}, c = p ? s.features[t].bbox : g ? s.bbox : void 0, h = p ? s.features[t].id : g ? s.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
@@ -4411,9 +4407,9 @@ function go(s, e) {
4411
4407
  u++;
4412
4408
  }
4413
4409
  }
4414
- function yo(s, e, t) {
4410
+ function po(s, e, t) {
4415
4411
  var i = t;
4416
- return go(
4412
+ return uo(
4417
4413
  s,
4418
4414
  function(o, r, n, a, l) {
4419
4415
  r === 0 && t === void 0 ? i = o : i = e(
@@ -4427,14 +4423,14 @@ function yo(s, e, t) {
4427
4423
  }
4428
4424
  ), i;
4429
4425
  }
4430
- function fo(s) {
4431
- return yo(
4426
+ function go(s) {
4427
+ return po(
4432
4428
  s,
4433
- (e, t) => e + mo(t),
4429
+ (e, t) => e + yo(t),
4434
4430
  0
4435
4431
  );
4436
4432
  }
4437
- function mo(s) {
4433
+ function yo(s) {
4438
4434
  let e = 0, t;
4439
4435
  switch (s.type) {
4440
4436
  case "Polygon":
@@ -4460,7 +4456,7 @@ function mt(s) {
4460
4456
  }
4461
4457
  return e;
4462
4458
  }
4463
- var vo = W * W / 2, ke = Math.PI / 180;
4459
+ var fo = W * W / 2, ke = Math.PI / 180;
4464
4460
  function vt(s) {
4465
4461
  const e = s.length - 1;
4466
4462
  if (e <= 2) return 0;
@@ -4469,10 +4465,10 @@ function vt(s) {
4469
4465
  const o = s[i], r = s[i + 1 === e ? 0 : i + 1], n = s[i + 2 >= e ? (i + 2) % e : i + 2], a = o[0] * ke, l = r[1] * ke, d = n[0] * ke;
4470
4466
  t += (d - a) * Math.sin(l), i++;
4471
4467
  }
4472
- return t * vo;
4468
+ return t * fo;
4473
4469
  }
4474
- var Co = fo;
4475
- const Po = (s, e, t = "auto", i = q) => {
4470
+ var mo = go;
4471
+ const vo = (s, e, t = "auto", i = q) => {
4476
4472
  const o = ["square meters", "square kilometers", "ares", "hectares"], r = ["square feet", "square yards", "acres", "square miles"];
4477
4473
  let n = t;
4478
4474
  if (t !== "auto") {
@@ -4520,12 +4516,12 @@ const Po = (s, e, t = "auto", i = q) => {
4520
4516
  area: i,
4521
4517
  unit: o
4522
4518
  };
4523
- }, Ct = (s, e, t, i, o) => {
4519
+ }, Co = (s, e, t, i, o) => {
4524
4520
  if (s.geometry.type !== "Polygon") return s;
4525
- const r = Co(s.geometry), n = Po(r, e, i, o);
4521
+ const r = mo(s.geometry), n = vo(r, e, i, o);
4526
4522
  return n.area = parseFloat(n.area.toFixed(t)), s.properties.area = n.area, s.properties.unit = n.unit, s;
4527
4523
  };
4528
- function Pt(s) {
4524
+ function Ct(s) {
4529
4525
  if (!s)
4530
4526
  throw new Error("coord is required");
4531
4527
  if (!Array.isArray(s)) {
@@ -4538,14 +4534,14 @@ function Pt(s) {
4538
4534
  return [...s];
4539
4535
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
4540
4536
  }
4541
- function So(s, e, t = {}) {
4542
- var i = Pt(s), o = Pt(e), r = Pe(o[1] - i[1]), n = Pe(o[0] - i[0]), a = Pe(i[1]), l = Pe(o[1]), d = Math.pow(Math.sin(r / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
4543
- return po(
4537
+ function Po(s, e, t = {}) {
4538
+ var i = Ct(s), o = Ct(e), r = Ce(o[1] - i[1]), n = Ce(o[0] - i[0]), a = Ce(i[1]), l = Ce(o[1]), d = Math.pow(Math.sin(r / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
4539
+ return ho(
4544
4540
  2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
4545
4541
  t.units
4546
4542
  );
4547
4543
  }
4548
- var Io = So;
4544
+ var Io = Po;
4549
4545
  const _e = (s, e = "metric", t = "auto", i = q) => {
4550
4546
  const o = ["centimeter", "meter", "kilometer"], r = ["inch", "foot", "mile"];
4551
4547
  let n = t;
@@ -4557,8 +4553,8 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
4557
4553
  distance: s,
4558
4554
  unit: i.kilometer
4559
4555
  };
4560
- return e === "metric" ? a = Se(s, n, i) : e === "imperial" && (a = Ie(s, n, i)), a;
4561
- }, Se = (s, e, t) => {
4556
+ return e === "metric" ? a = Pe(s, n, i) : e === "imperial" && (a = Ie(s, n, i)), a;
4557
+ }, Pe = (s, e, t) => {
4562
4558
  let i = {
4563
4559
  distance: s,
4564
4560
  unit: t.kilometer
@@ -4574,7 +4570,7 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
4574
4570
  i.distance = s * 1e5, i.unit = t[e];
4575
4571
  break;
4576
4572
  case "auto":
4577
- s >= 1 ? i = Se(s, "kilometer", t) : s * 1e3 >= 1 ? i = Se(s, "meter", t) : i = Se(s, "centimeter", t);
4573
+ s >= 1 ? i = Pe(s, "kilometer", t) : s * 1e3 >= 1 ? i = Pe(s, "meter", t) : i = Pe(s, "centimeter", t);
4578
4574
  break;
4579
4575
  default:
4580
4576
  i.distance = s, i.unit = t.kilometer;
@@ -4604,7 +4600,7 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
4604
4600
  break;
4605
4601
  }
4606
4602
  return i;
4607
- }, St = (s, e, t, i, o, r, n, a) => {
4603
+ }, So = (s, e, t, i, o, r, n, a) => {
4608
4604
  if (s.geometry.type !== "LineString") return s;
4609
4605
  const l = s.geometry.coordinates;
4610
4606
  let d = 0;
@@ -4656,24 +4652,23 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
4656
4652
  );
4657
4653
  }
4658
4654
  ), s;
4659
- }, pe = (s, e = "metric", t = q) => e === "imperial" ? {
4655
+ }, ue = (s, e = "metric", t = q) => e === "imperial" ? {
4660
4656
  elevation: s * 3.28084,
4661
4657
  unit: t.foot
4662
4658
  } : {
4663
4659
  elevation: s,
4664
4660
  unit: t.meter
4665
- }, It = (s) => s.charAt(0).toUpperCase() + s.slice(1), re = [
4661
+ }, Pt = (s) => s.charAt(0).toUpperCase() + s.slice(1), re = [
4666
4662
  "{prefix}-point",
4667
4663
  "{prefix}-point-lower",
4668
4664
  "{prefix}-linestring",
4669
4665
  "{prefix}-polygon",
4670
4666
  "{prefix}-polygon-outline"
4671
- ], Zo = [
4667
+ ], er = [
4672
4668
  ...re,
4673
- he.polygonLayerSpec?.source,
4674
- he.lineLayerLabelSpec?.source,
4675
- he.pointLayerLabelSpec?.source
4676
- ], Qo = [
4669
+ Ee.polygonLayerSpec?.source,
4670
+ Ee.lineLayerLabelSpec?.source
4671
+ ], tr = [
4677
4672
  ...re,
4678
4673
  z.routingLineLayerNodeLabelSpec?.source,
4679
4674
  z.routingLineLayerNodeSpec?.source,
@@ -4688,13 +4683,13 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
4688
4683
  })) : e.excludeTerraDrawLayers === !0 && (o.layers = o.layers.filter((r) => "source" in r && !t.includes(r.source) || r.type === "background"), Object.keys(o.sources).forEach((r) => {
4689
4684
  t.includes(r) && delete o.sources[r];
4690
4685
  }))), o;
4691
- }, Yt = (s, e = 250) => {
4686
+ }, Vt = (s, e = 250) => {
4692
4687
  let t;
4693
4688
  return (...i) => {
4694
4689
  clearTimeout(t), t = setTimeout(() => s(...i), e);
4695
4690
  };
4696
4691
  };
4697
- class Kt {
4692
+ class $t {
4698
4693
  cache = /* @__PURE__ */ new Map();
4699
4694
  maxSize;
4700
4695
  ttl;
@@ -4861,14 +4856,14 @@ class xo {
4861
4856
  }), o;
4862
4857
  }
4863
4858
  }
4864
- const xt = (s, e, t, i, o = "metric", r = q) => {
4859
+ const Eo = (s, e, t, i, o = "metric", r = q) => {
4865
4860
  if (s.geometry.type !== "Point") return s;
4866
4861
  const n = s.geometry.coordinates;
4867
4862
  if (t === !0) {
4868
4863
  if (i === void 0) {
4869
4864
  const a = e?.queryTerrainElevation(n);
4870
4865
  if (a) {
4871
- const { elevation: l, unit: d } = pe(
4866
+ const { elevation: l, unit: d } = ue(
4872
4867
  a,
4873
4868
  o,
4874
4869
  r
@@ -4879,7 +4874,7 @@ const xt = (s, e, t, i, o = "metric", r = q) => {
4879
4874
  let a = s.properties.elevation;
4880
4875
  const l = s.properties.elevationUnit;
4881
4876
  (l === "ft" || l === "foot") && (a = a / 3.28084);
4882
- const { elevation: d, unit: c } = pe(
4877
+ const { elevation: d, unit: c } = ue(
4883
4878
  a,
4884
4879
  o,
4885
4880
  r
@@ -4889,58 +4884,58 @@ const xt = (s, e, t, i, o = "metric", r = q) => {
4889
4884
  }
4890
4885
  return s;
4891
4886
  };
4892
- var Oo = Object.defineProperty, Eo = (s, e, t) => e in s ? Oo(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, le = (s, e, t) => Eo(s, typeof e != "symbol" ? e + "" : e, t), Ee = 2 * Math.PI * 6378137 / 2;
4887
+ var Oo = Object.defineProperty, wo = (s, e, t) => e in s ? Oo(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, le = (s, e, t) => wo(s, typeof e != "symbol" ? e + "" : e, t), Oe = 2 * Math.PI * 6378137 / 2;
4893
4888
  function bo(s) {
4894
4889
  return s = s || 256, 2 * Math.PI * 6378137 / s;
4895
4890
  }
4896
- function wo(s, e, t = { enable: !0, decimal: 1 }) {
4891
+ function Fo(s, e, t = { enable: !0, decimal: 1 }) {
4897
4892
  s = He(s);
4898
- var i = s[0], o = s[1], r = i * Ee / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
4899
- return n = n * Ee / 180, t.enable && (r = Number(r.toFixed(t.decimal)), n = Number(n.toFixed(t.decimal))), [r, n];
4893
+ var i = s[0], o = s[1], r = i * Oe / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
4894
+ return n = n * Oe / 180, t.enable && (r = Number(r.toFixed(t.decimal)), n = Number(n.toFixed(t.decimal))), [r, n];
4900
4895
  }
4901
- function Lo(s, e, t) {
4902
- var i = s[0], o = s[1], r = No(e, t), n = (i + Ee) / r, a = (o + Ee) / r;
4896
+ function Mo(s, e, t) {
4897
+ var i = s[0], o = s[1], r = To(e, t), n = (i + Oe) / r, a = (o + Oe) / r;
4903
4898
  return [n, a, e];
4904
4899
  }
4905
- function Ht(s, e, t) {
4900
+ function Yt(s, e, t) {
4906
4901
  s = He(s);
4907
- var i = wo(s), o = Lo(i, e);
4908
- return Mo(o);
4902
+ var i = Fo(s), o = Mo(i, e);
4903
+ return Do(o);
4909
4904
  }
4910
- function Fo(s, e, t) {
4905
+ function Lo(s, e, t) {
4911
4906
  if (s = He(s), e === 0)
4912
4907
  return [0, 0, 0];
4913
- var i = Ht(s, e);
4914
- return Do(i);
4908
+ var i = Yt(s, e);
4909
+ return ko(i);
4915
4910
  }
4916
- function Mo(s, e, t) {
4911
+ function Do(s, e, t) {
4917
4912
  e = e || 256;
4918
4913
  var i = s[0], o = s[1], r = s[2];
4919
4914
  if (r === 0) return [0, 0, 0];
4920
- Xt(r);
4915
+ Kt(r);
4921
4916
  var n = Math.ceil(i / e) - 1, a = Math.ceil(o / e) - 1;
4922
4917
  return n < 0 && (n = 0), a < 0 && (a = 0), [n, a, r];
4923
4918
  }
4924
- function Do(s, e) {
4925
- ko(s);
4919
+ function ko(s, e) {
4920
+ _o(s);
4926
4921
  var t = s[0], i = s[1], o = s[2];
4927
4922
  if (o === 0)
4928
4923
  return [0, 0, 0];
4929
4924
  var r = t, n = Math.pow(2, o) - 1 - i;
4930
4925
  return [r, n, o];
4931
4926
  }
4932
- function ko(s, e) {
4927
+ function _o(s, e) {
4933
4928
  var t = s[0], i = s[1], o = s[2];
4934
4929
  if (o == null) throw new Error("<zoom> is required");
4935
4930
  if (t == null) throw new Error("<x> is required");
4936
4931
  if (i == null) throw new Error("<y> is required");
4937
- return o = Xt(o), s = _o(s), s;
4932
+ return o = Kt(o), s = No(s), s;
4938
4933
  }
4939
- function _o(s) {
4934
+ function No(s) {
4940
4935
  var e = s[0], t = s[1], i = s[2], o = Math.pow(2, i);
4941
4936
  return e = e % o, e < 0 && (e = e + o), [e, t, i];
4942
4937
  }
4943
- function Xt(s) {
4938
+ function Kt(s) {
4944
4939
  if (s === !1) return s;
4945
4940
  if (s == null)
4946
4941
  throw new Error("<zoom> is required");
@@ -4951,21 +4946,21 @@ function Xt(s) {
4951
4946
  return s;
4952
4947
  }
4953
4948
  function He(s, e) {
4954
- var t = Wo(s[0]), i = To(s[1]);
4949
+ var t = Bo(s[0]), i = Wo(s[1]);
4955
4950
  return i > 85 && (i = 85), i < -85 && (i = -85), [t, i];
4956
4951
  }
4957
- function No(s, e) {
4952
+ function To(s, e) {
4958
4953
  return bo(e) / Math.pow(2, s);
4959
4954
  }
4960
- function To(s) {
4955
+ function Wo(s) {
4961
4956
  if (s == null) throw new Error("lat is required");
4962
4957
  return (s > 90 || s < -90) && (s = s % 180, s > 90 && (s = -180 + s), s < -90 && (s = 180 + s), s === 0 && (s = 0)), s;
4963
4958
  }
4964
- function Wo(s) {
4959
+ function Bo(s) {
4965
4960
  if (s == null) throw new Error("lng is required");
4966
4961
  return (s > 180 || s < -180) && (s = s % 360, s > 180 && (s = -360 + s), s < -180 && (s = 360 + s), s === 0 && (s = 0)), s;
4967
4962
  }
4968
- class qt {
4963
+ class Ht {
4969
4964
  /**
4970
4965
  * Constructor
4971
4966
  * @param url URL for terrain RGB raster tilesets
@@ -4990,7 +4985,7 @@ class qt {
4990
4985
  const r = e[0], n = e[1];
4991
4986
  let a = t;
4992
4987
  t > this.maxzoom ? a = this.maxzoom : t < this.minzoom && (a = this.minzoom);
4993
- const l = this.tms ? Ht([r, n], a) : Fo([r, n], a), d = this.url.replace(/{x}/g, l[0].toString()).replace(/{y}/g, l[1].toString()).replace(/{z}/g, l[2].toString());
4988
+ const l = this.tms ? Yt([r, n], a) : Lo([r, n], a), d = this.url.replace(/{x}/g, l[0].toString()).replace(/{y}/g, l[1].toString()).replace(/{z}/g, l[2].toString());
4994
4989
  let c = this.getUrlExtension(d);
4995
4990
  switch (c || (c = "png"), c) {
4996
4991
  case "png":
@@ -5092,7 +5087,7 @@ class qt {
5092
5087
  return i * Math.atan(0.5 * (Math.exp(o) - Math.exp(-o)));
5093
5088
  }
5094
5089
  }
5095
- class Bo extends qt {
5090
+ class jo extends Ht {
5096
5091
  /**
5097
5092
  * Constructor
5098
5093
  * @param url URL for terrain RGB raster tilesets
@@ -5124,7 +5119,7 @@ class Bo extends qt {
5124
5119
  return -1e4 + (e * 256 * 256 + t * 256 + i) * 0.1;
5125
5120
  }
5126
5121
  }
5127
- class jo extends qt {
5122
+ class Uo extends Ht {
5128
5123
  /**
5129
5124
  * Constructor
5130
5125
  * @param url URL for terrarium raster tilesets
@@ -5158,10 +5153,10 @@ class jo extends qt {
5158
5153
  return parseInt(o.toFixed(0));
5159
5154
  }
5160
5155
  }
5161
- const Uo = (s, e = 8) => {
5156
+ const Ro = (s, e = 8) => {
5162
5157
  const [t, i] = s, o = Math.pow(10, e), r = Math.round(t * o) / o, n = Math.round(i * o) / o;
5163
5158
  return `${r},${n}`;
5164
- }, Ot = async (s, e, t, i, o = "metric", r = q) => {
5159
+ }, It = async (s, e, t, i, o = "metric", r = q) => {
5165
5160
  const n = [], a = {
5166
5161
  enabled: !0,
5167
5162
  maxSize: 1e3,
@@ -5171,24 +5166,24 @@ const Uo = (s, e = 8) => {
5171
5166
  ...t
5172
5167
  };
5173
5168
  let l;
5174
- a.enabled && (l = i || new Kt(a.maxSize, a.ttl));
5169
+ a.enabled && (l = i || new $t(a.maxSize, a.ttl));
5175
5170
  let d, c = 15;
5176
5171
  if (e) {
5177
5172
  const h = e.url, u = e.encoding ?? "mapbox", p = e.tileSize ?? 512, g = e.minzoom ?? 5;
5178
5173
  c = e.maxzoom ?? 15;
5179
5174
  const y = e.tms ?? !1;
5180
- d = u === "mapbox" ? new Bo(h, p, g, c, y) : new jo(h, p, g, c, y);
5175
+ d = u === "mapbox" ? new jo(h, p, g, c, y) : new Uo(h, p, g, c, y);
5181
5176
  }
5182
5177
  for (const h of s)
5183
5178
  n.push(
5184
5179
  new Promise((u) => {
5185
5180
  h.geometry.type !== "Point" && u(h);
5186
- const p = h.geometry.coordinates, g = Uo(p, a.precision);
5181
+ const p = h.geometry.coordinates, g = Ro(p, a.precision);
5187
5182
  if (l) {
5188
5183
  const y = l.get(g);
5189
5184
  if (y !== void 0) {
5190
5185
  if (!isNaN(y)) {
5191
- const { elevation: f, unit: v } = pe(
5186
+ const { elevation: f, unit: v } = ue(
5192
5187
  y,
5193
5188
  o,
5194
5189
  r
@@ -5202,7 +5197,7 @@ const Uo = (s, e = 8) => {
5202
5197
  d ? d.getElevation(h.geometry.coordinates, c).then((y) => {
5203
5198
  if (y != null && typeof y == "number") {
5204
5199
  l && l.set(g, y);
5205
- const { elevation: f, unit: v } = pe(
5200
+ const { elevation: f, unit: v } = ue(
5206
5201
  y,
5207
5202
  o,
5208
5203
  r
@@ -5216,7 +5211,7 @@ const Uo = (s, e = 8) => {
5216
5211
  })
5217
5212
  );
5218
5213
  return await Promise.all(n);
5219
- }, er = (s, e = 9) => {
5214
+ }, ir = (s, e = 9) => {
5220
5215
  function t(o) {
5221
5216
  return [Number(o[0].toFixed(e)), Number(o[1].toFixed(e))];
5222
5217
  }
@@ -5254,7 +5249,7 @@ const Uo = (s, e = 8) => {
5254
5249
  { value: "time", label: "Time" },
5255
5250
  { value: "distance", label: "Distance" }
5256
5251
  ];
5257
- class Ro {
5252
+ class Go {
5258
5253
  url;
5259
5254
  /**
5260
5255
  * Constructor
@@ -5290,11 +5285,11 @@ const je = [
5290
5285
  { value: "pedestrian", label: "Pedestrian" },
5291
5286
  { value: "bicycle", label: "Bicycle" },
5292
5287
  { value: "auto", label: "Car" }
5293
- ], Go = [
5288
+ ], zo = [
5294
5289
  { value: "kilometers", label: "km" },
5295
5290
  { value: "miles", label: "mile" }
5296
5291
  ];
5297
- class zo {
5292
+ class Vo {
5298
5293
  tripData = [];
5299
5294
  /**
5300
5295
  * get the raw trip data from the valhalla routing API.
@@ -5361,12 +5356,12 @@ class zo {
5361
5356
  const h = [];
5362
5357
  let u = 0, p = 0;
5363
5358
  const g = [], y = this.geoPoint(this.tripData.map((m) => [m.lng, m.lat]));
5364
- l.trip.legs.forEach((m, P) => {
5365
- const I = this.decodeShape(m.shape);
5366
- h.push(...I), u += Number(m.summary.length.toFixed(2)), p += Number((m.summary.time / 60).toFixed()), g.push(...m.maneuvers);
5367
- const w = y.features[P + 1];
5368
- w.properties = {
5369
- ...w.properties,
5359
+ l.trip.legs.forEach((m, I) => {
5360
+ const S = this.decodeShape(m.shape);
5361
+ h.push(...S), u += Number(m.summary.length.toFixed(2)), p += Number((m.summary.time / 60).toFixed()), g.push(...m.maneuvers);
5362
+ const b = y.features[I + 1];
5363
+ b.properties = {
5364
+ ...b.properties,
5370
5365
  distance: u,
5371
5366
  distance_unit: i === "kilometers" ? "km" : "mi",
5372
5367
  time: p,
@@ -5448,7 +5443,7 @@ class zo {
5448
5443
  return n;
5449
5444
  }
5450
5445
  }
5451
- class Jt {
5446
+ class Xt {
5452
5447
  controlContainer;
5453
5448
  map;
5454
5449
  modeButtons = {};
@@ -5487,7 +5482,7 @@ class Jt {
5487
5482
  i && i.length > 0 && (this.isExpanded ? i.item(0)?.classList.add("enabled") : (i.item(0)?.classList.remove("enabled"), this.resetActiveMode())), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.isExpanded ? this.dispatchEvent("expanded") : this.dispatchEvent("collapsed");
5488
5483
  }
5489
5484
  terradraw;
5490
- options = so;
5485
+ options = oo;
5491
5486
  events = {};
5492
5487
  defaultMode = "render";
5493
5488
  /**
@@ -5515,7 +5510,7 @@ class Jt {
5515
5510
  if (this.options && this.options.modes && this.options.modes.length === 0)
5516
5511
  throw new Error("At least a mode must be enabled.");
5517
5512
  this.map = e;
5518
- const t = lo(), i = [];
5513
+ const t = no(), i = [];
5519
5514
  return this.options?.modes?.forEach((o) => {
5520
5515
  if (this.options.modeOptions && this.options.modeOptions[o]) {
5521
5516
  const r = this.options.modeOptions[o];
@@ -5537,8 +5532,8 @@ class Jt {
5537
5532
  modeName: "default",
5538
5533
  styles: {}
5539
5534
  })
5540
- ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new oo({
5541
- adapter: new ro({ map: e, ...this.options.adapterOptions }),
5535
+ ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new to({
5536
+ adapter: new io({ map: e, ...this.options.adapterOptions }),
5542
5537
  modes: i
5543
5538
  }), this.map?.loaded() ? this.terradraw.start() : this.map?.once("load", () => {
5544
5539
  this.terradraw?.start();
@@ -5546,7 +5541,9 @@ class Jt {
5546
5541
  o.mode !== "default" && this.addTerradrawButton(o.mode);
5547
5542
  }), Object.values(this.modeButtons).forEach((o) => {
5548
5543
  this.controlContainer?.appendChild(o);
5549
- }), this.terradraw?.on("change", this.toggleButtonsWhenNoFeature.bind(this)), this.toggleButtonsWhenNoFeature(), this.controlContainer;
5544
+ }), this.toggleButtonsWhenNoFeature(), this.terradraw?.on("finish", this.toggleButtonsWhenNoFeature.bind(this)), this.map.once("idle", () => {
5545
+ this.toggleButtonsWhenNoFeature();
5546
+ }), this.controlContainer;
5550
5547
  }
5551
5548
  /**
5552
5549
  * Remove the plugin control from maplibre
@@ -5660,8 +5657,8 @@ class Jt {
5660
5657
  */
5661
5658
  addTerradrawButton(e) {
5662
5659
  const t = document.createElement("button");
5663
- t.type = "button", this.modeButtons[e] = t, e === "render" ? (t.classList.add(`maplibregl-terradraw-${this.cssPrefix}${e}-button`), this.isExpanded && t.classList.add("enabled"), t.type = "button", t.title = It("expand or collapse drawing tool"), t.addEventListener("click", this.toggleEditor.bind(this))) : (t.classList.add(`maplibregl-terradraw-${this.cssPrefix}add-control`), this.isExpanded || t.classList.add("hidden"), t.title = It(e.replace(/-/g, " ")), e === "delete" ? (t.classList.add(`maplibregl-terradraw-${this.cssPrefix}${e}-button`), t.addEventListener("click", () => {
5664
- this.terradraw && this.terradraw.enabled && (this.terradraw.clear(), this.deactivate(), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.dispatchEvent("feature-deleted"));
5660
+ t.type = "button", this.modeButtons[e] = t, e === "render" ? (t.classList.add(`maplibregl-terradraw-${this.cssPrefix}${e}-button`), this.isExpanded && t.classList.add("enabled"), t.type = "button", t.title = Pt("expand or collapse drawing tool"), t.addEventListener("click", this.toggleEditor.bind(this))) : (t.classList.add(`maplibregl-terradraw-${this.cssPrefix}add-control`), this.isExpanded || t.classList.add("hidden"), t.title = Pt(e.replace(/-/g, " ")), e === "delete" ? (t.classList.add(`maplibregl-terradraw-${this.cssPrefix}${e}-button`), t.addEventListener("click", () => {
5661
+ this.terradraw && this.terradraw.enabled && (this.terradraw.clear(), this.resetActiveMode(), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.dispatchEvent("feature-deleted"));
5665
5662
  })) : e === "delete-selection" ? (t.classList.add(`maplibregl-terradraw-${this.cssPrefix}${e}-button`), t.classList.add("hidden-delete-selection"), t.addEventListener("click", () => {
5666
5663
  if (!this.terradraw || !this.terradraw.enabled) return;
5667
5664
  const o = (this.terradraw?.getSnapshot()).filter((r) => r.properties.selected === !0);
@@ -5727,16 +5724,16 @@ class Jt {
5727
5724
  */
5728
5725
  toggleButtonsWhenNoFeature() {
5729
5726
  if (!this.controlContainer) return;
5730
- const e = this.getFeatures(!1), t = !!(e && e.features.length > 0), i = [
5727
+ const t = this.terradraw?.getSnapshot()?.filter((r) => r.properties.mode !== "select"), i = !!(t && t.length > 0), o = [
5731
5728
  `maplibregl-terradraw-${this.cssPrefix}add-select-button`,
5732
5729
  `maplibregl-terradraw-${this.cssPrefix}download-button`,
5733
5730
  `maplibregl-terradraw-${this.cssPrefix}delete-button`
5734
5731
  ];
5735
- for (const o of i) {
5736
- const r = this.controlContainer.getElementsByClassName(o);
5737
- for (let n = 0; n < r.length; n++) {
5738
- const a = r.item(n);
5739
- a && (a.disabled = !t);
5732
+ for (const r of o) {
5733
+ const n = this.controlContainer.getElementsByClassName(r);
5734
+ for (let a = 0; a < n.length; a++) {
5735
+ const l = n.item(a);
5736
+ l && (l.disabled = !i);
5740
5737
  }
5741
5738
  }
5742
5739
  }
@@ -5775,16 +5772,16 @@ class Jt {
5775
5772
  }
5776
5773
  }
5777
5774
  }
5778
- function Vo(s, e = {}) {
5775
+ function $o(s, e = {}) {
5779
5776
  let t = 0, i = 0, o = 0;
5780
- return $t(
5777
+ return zt(
5781
5778
  s,
5782
5779
  function(r) {
5783
5780
  t += r[0], i += r[1], o++;
5784
5781
  }
5785
- ), uo([t / o, i / o], e.properties);
5782
+ ), co([t / o, i / o], e.properties);
5786
5783
  }
5787
- class tr extends Jt {
5784
+ class or extends Xt {
5788
5785
  measureOptions;
5789
5786
  elevationCache;
5790
5787
  /**
@@ -5904,8 +5901,8 @@ class tr extends Jt {
5904
5901
  */
5905
5902
  constructor(e) {
5906
5903
  let t = {
5907
- ...JSON.parse(JSON.stringify(he)),
5908
- modeOptions: { ...he.modeOptions }
5904
+ ...JSON.parse(JSON.stringify(Ee)),
5905
+ modeOptions: { ...Ee.modeOptions }
5909
5906
  };
5910
5907
  e && (t = Object.assign(t, e));
5911
5908
  const i = t.adapterOptions?.prefixId ?? "td-measure";
@@ -5914,7 +5911,7 @@ class tr extends Jt {
5914
5911
  open: t.open,
5915
5912
  modeOptions: t.modeOptions,
5916
5913
  adapterOptions: t.adapterOptions
5917
- }), this._cssPrefix = "measure-", this.measureOptions = t, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new Kt(
5914
+ }), this._cssPrefix = "measure-", this.measureOptions = t, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new $t(
5918
5915
  this.measureOptions.elevationCacheConfig.maxSize,
5919
5916
  this.measureOptions.elevationCacheConfig.ttl
5920
5917
  ));
@@ -5960,9 +5957,9 @@ class tr extends Jt {
5960
5957
  const t = e.getSnapshot();
5961
5958
  for (const i of t) {
5962
5959
  const o = i.id, r = i.geometry.type, n = i.properties.mode;
5963
- ["linestring", "freehand-linestring"].includes(n) && r === "LineString" ? (this.measureLine(o), this.computeElevationByLineFeatureID(o)) : ["point", "marker"].includes(n) && r === "Point" ? (this.measurePoint(o), this.computeElevationByPointFeatureID(o)) : !["point", "marker", "linestring", "freehand-linestring", "select", "render"].includes(
5960
+ ["linestring", "freehand-linestring"].includes(n) && r === "LineString" ? this.measureLine(o, !1) : ["point", "marker"].includes(n) && r === "Point" ? this.measurePoint(o, !1) : !["point", "marker", "linestring", "freehand-linestring", "select", "render"].includes(
5964
5961
  n
5965
- ) && r === "Polygon" && this.measurePolygon(o);
5962
+ ) && r === "Polygon" && this.measurePolygon(o, !1);
5966
5963
  }
5967
5964
  }
5968
5965
  }
@@ -5985,9 +5982,7 @@ class tr extends Jt {
5985
5982
  const i = re, o = this.measureOptions.polygonLayerSpec?.source;
5986
5983
  o && i.push(o);
5987
5984
  const r = this.measureOptions.lineLayerLabelSpec?.source;
5988
- r && i.push(r);
5989
- const n = this.measureOptions.pointLayerLabelSpec?.source;
5990
- return n && i.push(n), Ke(
5985
+ return r && i.push(r), Ke(
5991
5986
  e,
5992
5987
  t,
5993
5988
  i,
@@ -6002,15 +5997,7 @@ class tr extends Jt {
6002
5997
  const e = this.options.modes?.filter(
6003
5998
  (o) => ["linestring", "freehand-linestring"].includes(o)
6004
5999
  );
6005
- this.options.modes?.find((o) => ["point", "marker"].includes(o)) && (this.map.getSource(
6006
- this.measureOptions.pointLayerLabelSpec.source
6007
- ) || this.map.addSource(
6008
- this.measureOptions.pointLayerLabelSpec.source,
6009
- {
6010
- type: "geojson",
6011
- data: { type: "FeatureCollection", features: [] }
6012
- }
6013
- ), this.map.getLayer(this.measureOptions.pointLayerLabelSpec.id) || this.map.addLayer(this.measureOptions.pointLayerLabelSpec)), e && e.length > 0 && (this.map.getSource(
6000
+ this.options.modes?.find((o) => ["point", "marker"].includes(o)) && (this.map.getLayer(this.measureOptions.pointLayerLabelSpec.id) || this.map.addLayer(this.measureOptions.pointLayerLabelSpec)), e && e.length > 0 && (this.map.getSource(
6014
6001
  this.measureOptions.lineLayerLabelSpec.source
6015
6002
  ) || this.map.addSource(
6016
6003
  this.measureOptions.lineLayerLabelSpec.source,
@@ -6063,15 +6050,21 @@ class tr extends Jt {
6063
6050
  );
6064
6051
  if (o.length > 0)
6065
6052
  for (const r of o)
6066
- this.computeElevationByPointFeatureID(r.id);
6053
+ this.measurePoint(r.id);
6067
6054
  }
6068
6055
  };
6069
6056
  /**
6070
6057
  * Handle finish event of terradraw. It will be called after finishing adding a feature
6071
6058
  * @param id Feature ID
6072
6059
  */
6073
- handleTerradrawFeatureReady = Yt((e) => {
6074
- this.map && (this.computeElevationByLineFeatureID(e), this.computeElevationByPointFeatureID(e));
6060
+ handleTerradrawFeatureReady = Vt((e) => {
6061
+ if (!this.map || !this.terradraw) return;
6062
+ const t = this.terradraw.getSnapshotFeature(e);
6063
+ if (!t) return;
6064
+ const i = t.geometry.type, o = t.properties.mode;
6065
+ ["linestring", "freehand-linestring"].includes(o) && i === "LineString" ? this.measureLine(e, !1) : ["point", "marker"].includes(o) && i === "Point" ? this.measurePoint(e, !1) : !["point", "marker", "linestring", "freehand-linestring", "select", "render"].includes(
6066
+ o
6067
+ ) && i === "Polygon" && this.measurePolygon(e, !1);
6075
6068
  }, 300);
6076
6069
  /**
6077
6070
  * Handle change event of TerraDraw
@@ -6080,28 +6073,26 @@ class tr extends Jt {
6080
6073
  handleTerradrawFeatureChanged(e, t) {
6081
6074
  if (!this.map || t === "styling") return;
6082
6075
  const o = [
6083
- this.measureOptions.pointLayerLabelSpec,
6084
6076
  this.measureOptions.lineLayerLabelSpec,
6085
6077
  this.measureOptions.routingLineLayerNodeSpec,
6086
6078
  this.measureOptions.polygonLayerSpec
6087
- ].map((a) => a.source);
6079
+ ].map((n) => n.source);
6088
6080
  if (t === "delete") {
6089
6081
  this.clearExtendedFeatures(o, e);
6090
6082
  return;
6091
6083
  }
6092
6084
  const r = this.getTerraDrawInstance();
6093
- if (!r) return;
6094
- const n = r.getSnapshot();
6095
- for (const a of e) {
6096
- const l = n.find((d) => d.id === a);
6097
- if (l) {
6098
- const d = l.geometry.type, c = l.properties.mode;
6099
- ["linestring", "freehand-linestring"].includes(c) && d === "LineString" ? this.measureLine(a) : ["point", "marker"].includes(c) && d === "Point" ? this.measurePoint(a) : !["point", "marker", "linestring", "freehand-linestring", "select", "render"].includes(
6100
- c
6101
- ) && d === "Polygon" && this.measurePolygon(a);
6102
- } else
6103
- this.clearExtendedFeatures(o, [a]);
6104
- }
6085
+ if (r)
6086
+ for (const n of e) {
6087
+ const a = r.getSnapshotFeature(n);
6088
+ if (a) {
6089
+ const l = a.geometry.type, d = a.properties.mode;
6090
+ ["linestring", "freehand-linestring"].includes(d) && l === "LineString" ? this.measureLine(n, !0) : ["point", "marker"].includes(d) && l === "Point" ? this.measurePoint(n, !0) : !["point", "marker", "linestring", "freehand-linestring", "select", "render"].includes(
6091
+ d
6092
+ ) && l === "Polygon" && this.measurePolygon(n, !0);
6093
+ } else
6094
+ this.clearExtendedFeatures(o, [n]);
6095
+ }
6105
6096
  }
6106
6097
  /**
6107
6098
  * Unregister measure control related maplibre sources and layers
@@ -6114,10 +6105,6 @@ class tr extends Jt {
6114
6105
  ) && this.map.removeLayer(
6115
6106
  this.measureOptions.routingLineLayerNodeSpec.id
6116
6107
  ), this.map.getLayer(this.measureOptions.polygonLayerSpec.id) && this.map.removeLayer(this.measureOptions.polygonLayerSpec.id), this.map.getSource(
6117
- this.measureOptions.pointLayerLabelSpec.source
6118
- ) && this.map.removeSource(
6119
- this.measureOptions.pointLayerLabelSpec.source
6120
- ), this.map.getSource(
6121
6108
  this.measureOptions.lineLayerLabelSpec.source
6122
6109
  ) && this.map.removeSource(
6123
6110
  this.measureOptions.lineLayerLabelSpec.source
@@ -6171,7 +6158,7 @@ class tr extends Jt {
6171
6158
  (o) => o.properties?.originalId === e && o.geometry.type === "Point"
6172
6159
  );
6173
6160
  if (i && i.length > 0) {
6174
- const o = await Ot(
6161
+ const o = await It(
6175
6162
  i,
6176
6163
  this.measureOptions.terrainSource,
6177
6164
  this.measureOptions.elevationCacheConfig,
@@ -6188,35 +6175,6 @@ class tr extends Jt {
6188
6175
  }
6189
6176
  }
6190
6177
  };
6191
- /**
6192
- * Compute elevation by a Point feature ID
6193
- * @param id FeatureID
6194
- */
6195
- computeElevationByPointFeatureID = async (e) => {
6196
- if (this.map && this.computeElevation === !0) {
6197
- const t = this.map.getStyle().sources[this.measureOptions.pointLayerLabelSpec.source];
6198
- if (t && typeof t.data != "string" && t.data.type === "FeatureCollection") {
6199
- const i = t.data.features.filter(
6200
- (o) => o.id === e && o.geometry.type === "Point" && ["point", "marker"].includes(o.properties?.mode)
6201
- );
6202
- if (i && i.length > 0) {
6203
- const o = await Ot(
6204
- i,
6205
- this.measureOptions.terrainSource,
6206
- this.measureOptions.elevationCacheConfig,
6207
- this.elevationCache,
6208
- this.measureUnitType,
6209
- this.measureUnitSymbols
6210
- );
6211
- this.replaceGeoJSONSource(
6212
- o,
6213
- this.measureOptions.pointLayerLabelSpec.source,
6214
- "point"
6215
- );
6216
- }
6217
- }
6218
- }
6219
- };
6220
6178
  /**
6221
6179
  * Recalculate elevation units for existing features without re-querying elevation data
6222
6180
  * This is called when measureUnitType changes to convert elevation values between metric and imperial
@@ -6241,7 +6199,7 @@ class tr extends Jt {
6241
6199
  const r = o.properties.elevationUnit;
6242
6200
  let n = o.properties.elevation;
6243
6201
  (r === "ft" || r === "foot") && (n = n / 3.28084);
6244
- const { elevation: a, unit: l } = pe(
6202
+ const { elevation: a, unit: l } = ue(
6245
6203
  n,
6246
6204
  this.measureUnitType,
6247
6205
  this.measureUnitSymbols
@@ -6255,27 +6213,30 @@ class tr extends Jt {
6255
6213
  * measure polygon area for given feature ID
6256
6214
  * @param id terradraw feature id
6257
6215
  */
6258
- measurePolygon(e) {
6216
+ async measurePolygon(e, t = !1) {
6259
6217
  if (!this.map) return;
6260
- const t = this.getTerraDrawInstance();
6261
- if (!t) return;
6262
- let o = t.getSnapshot()?.find((r) => r.id === e && r.geometry.type === "Polygon");
6263
- if (o) {
6264
- const r = this.map.getStyle().sources[this.measureOptions.polygonLayerSpec.source];
6265
- if (r) {
6266
- typeof r.data != "string" && r.data.type === "FeatureCollection" && (r.data.features = r.data.features.filter(
6267
- (a) => a.properties?.originalId !== e
6218
+ const i = this.getTerraDrawInstance();
6219
+ if (!i) return;
6220
+ let r = i.getSnapshot()?.find((n) => n.id === e && n.geometry.type === "Polygon");
6221
+ if (r) {
6222
+ const n = this.map.getStyle().sources[this.measureOptions.polygonLayerSpec.source];
6223
+ if (n) {
6224
+ typeof n.data != "string" && n.data.type === "FeatureCollection" && (n.data.features = n.data.features.filter(
6225
+ (l) => l.properties?.originalId !== e
6268
6226
  ));
6269
- const n = JSON.parse(JSON.stringify(o));
6270
- n.id = n.id + "-area-label", n.geometry = Vo(o.geometry).geometry, n.properties.originalId = o.id, o = Ct(
6271
- o,
6227
+ const a = JSON.parse(JSON.stringify(r));
6228
+ a.id = a.id + "-area-label", a.geometry = $o(r.geometry).geometry, a.properties.originalId = r.id, r = Co(
6229
+ r,
6272
6230
  this.measureUnitType,
6273
6231
  this.areaPrecision,
6274
6232
  this.forceAreaUnit,
6275
6233
  this.measureUnitSymbols
6276
- ), n.properties.area = o.properties.area, n.properties.unit = o.properties.unit, typeof r.data != "string" && r.data.type === "FeatureCollection" && r.data.features.push(n), this.map.getSource(
6234
+ ), a.properties.area = r.properties.area, a.properties.unit = r.properties.unit, t || this.terradraw?.updateFeatureProperties(e, {
6235
+ area: a.properties.area,
6236
+ unit: a.properties.unit
6237
+ }), typeof n.data != "string" && n.data.type === "FeatureCollection" && n.data.features.push(a), this.map.getSource(
6277
6238
  this.measureOptions.polygonLayerSpec.source
6278
- )?.setData(r.data), this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.getLayer(this.measureOptions.lineLayerLabelSpec.id) && this.map.moveLayer(
6239
+ )?.setData(n.data), this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.getLayer(this.measureOptions.lineLayerLabelSpec.id) && this.map.moveLayer(
6279
6240
  this.measureOptions.lineLayerLabelSpec.id
6280
6241
  ), this.map.getLayer(
6281
6242
  this.measureOptions.routingLineLayerNodeSpec.id
@@ -6293,17 +6254,17 @@ class tr extends Jt {
6293
6254
  * measure line distance for given feature ID
6294
6255
  * @param id terradraw feature id
6295
6256
  */
6296
- measureLine(e) {
6257
+ measureLine(e, t = !1) {
6297
6258
  if (!this.map) return;
6298
- const t = this.getTerraDrawInstance();
6299
- if (!t) return;
6300
- let o = t.getSnapshot()?.find((r) => r.id === e && r.geometry.type === "LineString");
6259
+ const i = this.getTerraDrawInstance();
6260
+ if (!i) return;
6261
+ let o = i.getSnapshotFeature(e);
6301
6262
  if (o) {
6302
6263
  const r = this.map.getStyle().sources[this.measureOptions.lineLayerLabelSpec.source];
6303
6264
  if (r) {
6304
6265
  typeof r.data != "string" && r.data.type === "FeatureCollection" && (r.data.features = r.data.features.filter(
6305
6266
  (a) => a.properties?.originalId !== e
6306
- )), o = St(
6267
+ )), o = So(
6307
6268
  o,
6308
6269
  this.measureUnitType,
6309
6270
  this.distancePrecision,
@@ -6329,6 +6290,15 @@ class tr extends Jt {
6329
6290
  coordinates: h
6330
6291
  }, l.properties.elevation_end && (u.properties.elevation = l.properties.elevation_end), typeof r.data != "string" && r.data.type === "FeatureCollection" && r.data.features.push(u);
6331
6292
  }
6293
+ if (!t) {
6294
+ this.computeElevation === !0 && this.measureOptions.terrainSource !== void 0 && this.computeElevationByLineFeatureID(e);
6295
+ const l = n[n.length - 1].properties.totalUnit;
6296
+ this.terradraw?.updateFeatureProperties(e, {
6297
+ distance: o.properties.distance,
6298
+ distanceUnit: l,
6299
+ segments: o.properties.segments
6300
+ });
6301
+ }
6332
6302
  this.map.getSource(
6333
6303
  this.measureOptions.lineLayerLabelSpec.source
6334
6304
  )?.setData(r.data), this.map.getLayer(this.measureOptions.polygonLayerSpec.id) && this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.moveLayer(this.measureOptions.lineLayerLabelSpec.id), this.map.moveLayer(
@@ -6345,29 +6315,34 @@ class tr extends Jt {
6345
6315
  * measure point elevation for given feature ID
6346
6316
  * @param id terradraw feature id
6347
6317
  */
6348
- measurePoint(e) {
6318
+ async measurePoint(e, t = !1) {
6349
6319
  if (!this.map) return;
6350
- const t = this.getTerraDrawInstance();
6351
- if (!t) return;
6352
- let o = t.getSnapshot()?.find((r) => r.id === e && r.geometry.type === "Point");
6320
+ const i = this.getTerraDrawInstance();
6321
+ if (!i) return;
6322
+ let o = i.getSnapshotFeature(e);
6353
6323
  if (o) {
6354
- const r = this.map.getStyle().sources[this.measureOptions.pointLayerLabelSpec.source];
6355
- r && (typeof r.data != "string" && r.data.type === "FeatureCollection" && (r.data.features = r.data.features.filter((n) => n.id !== e)), o = xt(
6324
+ let r = {
6325
+ elevation: void 0,
6326
+ elevationUnit: void 0
6327
+ };
6328
+ this.computeElevation && (this.measureOptions.terrainSource === void 0 ? o = Eo(
6356
6329
  o,
6357
6330
  this.map,
6358
6331
  this.computeElevation,
6359
6332
  this.measureOptions.terrainSource,
6360
6333
  this.measureUnitType,
6361
6334
  this.measureUnitSymbols
6362
- ), this.computeElevation === !0 && typeof r.data != "string" && r.data.type === "FeatureCollection" && r.data.features.push(o), this.map.getSource(
6363
- this.measureOptions.pointLayerLabelSpec.source
6364
- )?.setData(r.data), this.map.getLayer(this.measureOptions.polygonLayerSpec.id) && this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.getLayer(this.measureOptions.lineLayerLabelSpec.id) && (this.map.moveLayer(
6365
- this.measureOptions.lineLayerLabelSpec.id
6366
- ), this.map.moveLayer(
6367
- this.measureOptions.routingLineLayerNodeSpec.id
6368
- )), this.map.moveLayer(
6369
- this.measureOptions.pointLayerLabelSpec.id
6370
- ));
6335
+ ) : o = (await It(
6336
+ [o],
6337
+ this.measureOptions.terrainSource,
6338
+ this.measureOptions.elevationCacheConfig,
6339
+ this.elevationCache,
6340
+ this.measureUnitType,
6341
+ this.measureUnitSymbols
6342
+ ))[0], r = {
6343
+ elevation: o.properties.elevation,
6344
+ elevationUnit: o.properties.elevationUnit
6345
+ }), t || this.terradraw?.updateFeatureProperties(e, r);
6371
6346
  }
6372
6347
  }
6373
6348
  /**
@@ -6379,7 +6354,6 @@ class tr extends Jt {
6379
6354
  let i = [];
6380
6355
  typeof e == "object" && e !== null && "deletedIds" in e && (i = e.deletedIds);
6381
6356
  const r = [
6382
- this.measureOptions.pointLayerLabelSpec,
6383
6357
  this.measureOptions.lineLayerLabelSpec,
6384
6358
  this.measureOptions.routingLineLayerNodeSpec,
6385
6359
  this.measureOptions.polygonLayerSpec
@@ -6387,46 +6361,8 @@ class tr extends Jt {
6387
6361
  i && i.length > 0 ? this.clearExtendedFeatures(r, i) : this.clearExtendedFeatures(r, void 0);
6388
6362
  }
6389
6363
  }
6390
- /**
6391
- * get GeoJSON features
6392
- * @param onlySelected If true, returns only selected features. Default is false.
6393
- * @returns FeatureCollection in GeoJSON format
6394
- */
6395
- getFeatures(e = !1) {
6396
- const t = super.getFeatures(e);
6397
- if (!t || !this.terradraw) return t;
6398
- for (let i = 0; i < t.features.length; i++) {
6399
- const o = t.features[i];
6400
- if (!this.map || !this.map.loaded()) continue;
6401
- const r = o.geometry.type;
6402
- r === "LineString" ? t.features[i] = St(
6403
- o,
6404
- this.measureUnitType,
6405
- this.distancePrecision,
6406
- this.forceDistanceUnit,
6407
- this.measureUnitSymbols,
6408
- this.map,
6409
- this.computeElevation,
6410
- this.measureOptions.terrainSource
6411
- ) : r === "Polygon" ? t.features[i] = Ct(
6412
- o,
6413
- this.measureUnitType,
6414
- this.areaPrecision,
6415
- this.forceAreaUnit,
6416
- this.measureUnitSymbols
6417
- ) : r === "Point" && (t.features[i] = xt(
6418
- o,
6419
- this.map,
6420
- this.computeElevation,
6421
- this.measureOptions.terrainSource,
6422
- this.measureUnitType,
6423
- this.measureUnitSymbols
6424
- ));
6425
- }
6426
- return t;
6427
- }
6428
6364
  }
6429
- class ir extends Jt {
6365
+ class rr extends Xt {
6430
6366
  controlOptions;
6431
6367
  valhallaOptions;
6432
6368
  _modalDialog;
@@ -6685,7 +6621,7 @@ class ir extends Jt {
6685
6621
  const r = document.createElement("label");
6686
6622
  return r.textContent = "Distance Unit", r.classList.add("setting-label"), o.appendChild(r), o.appendChild(
6687
6623
  this.settingDialog.createSegmentButtons(
6688
- Go,
6624
+ zo,
6689
6625
  this.routingDistanceUnit,
6690
6626
  (n) => {
6691
6627
  this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.distanceUnit = n, this.dispatchEvent("setting-changed");
@@ -6897,14 +6833,14 @@ class ir extends Jt {
6897
6833
  * Handle finish event of terradraw. It will be called after finishing adding a feature
6898
6834
  * @param id Feature ID
6899
6835
  */
6900
- handleTerradrawFeatureReady = Yt((e) => {
6836
+ handleTerradrawFeatureReady = Vt((e) => {
6901
6837
  this.map && (this.computeRouteByLineFeatureID(e), this.computeIsochroneByPointFeatureID(e));
6902
6838
  }, 300);
6903
6839
  computeIsochroneByPointFeatureID = async (e) => {
6904
6840
  if (!this.map || !this.valhallaOptions.url) return;
6905
6841
  const t = this.terradraw?.getSnapshotFeature(e);
6906
6842
  if (!t || t && t.geometry.type !== "Point") return;
6907
- const i = t.geometry.coordinates, n = (await new Ro(this.valhallaUrl).calcIsochrone(
6843
+ const i = t.geometry.coordinates, n = (await new Go(this.valhallaUrl).calcIsochrone(
6908
6844
  i[0],
6909
6845
  i[1],
6910
6846
  this.isochroneContourType,
@@ -6938,9 +6874,9 @@ class ir extends Jt {
6938
6874
  if (!this.map || !this.valhallaOptions.url) return;
6939
6875
  const t = this.terradraw?.getSnapshotFeature(e);
6940
6876
  if (!t || t && t.geometry.type !== "LineString") return;
6941
- const i = new zo(this.valhallaUrl), o = t.geometry.coordinates.map((c) => {
6877
+ const i = new Vo(this.valhallaUrl), o = t.geometry.coordinates.map((c) => {
6942
6878
  const h = c;
6943
- return new Zt(h[0], h[1]);
6879
+ return new qt(h[0], h[1]);
6944
6880
  });
6945
6881
  if (!o || o && o.length < 2) return;
6946
6882
  const r = await i.calcRoute(
@@ -7013,36 +6949,36 @@ class ir extends Jt {
7013
6949
  }
7014
6950
  }
7015
6951
  export {
7016
- qo as AvailableModes,
7017
- Jo as AvailableValhallaModes,
7018
- tr as MaplibreMeasureControl,
7019
- Jt as MaplibreTerradrawControl,
7020
- ir as MaplibreValhallaControl,
7021
- Kt as MemoryCache,
6952
+ Zo as AvailableModes,
6953
+ Qo as AvailableValhallaModes,
6954
+ or as MaplibreMeasureControl,
6955
+ Xt as MaplibreTerradrawControl,
6956
+ rr as MaplibreValhallaControl,
6957
+ $t as MemoryCache,
7022
6958
  xo as ModalDialog,
7023
- Zo as TERRADRAW_MEASURE_SOURCE_IDS,
6959
+ er as TERRADRAW_MEASURE_SOURCE_IDS,
7024
6960
  re as TERRADRAW_SOURCE_IDS,
7025
- Qo as TERRADRAW_VALHALLA_SOURCE_IDS,
7026
- Ro as ValhallaIsochrone,
7027
- zo as ValhallaRouting,
7028
- Ct as calcArea,
7029
- St as calcDistance,
7030
- It as capitalize,
6961
+ tr as TERRADRAW_VALHALLA_SOURCE_IDS,
6962
+ Go as ValhallaIsochrone,
6963
+ Vo as ValhallaRouting,
6964
+ Co as calcArea,
6965
+ So as calcDistance,
6966
+ Pt as capitalize,
7031
6967
  Ke as cleanMaplibreStyle,
7032
6968
  Ao as contourTypeOptions,
7033
- Po as convertArea,
6969
+ vo as convertArea,
7034
6970
  _e as convertDistance,
7035
- pe as convertElevation,
6971
+ ue as convertElevation,
7036
6972
  je as costingModelOptions,
7037
- Yt as debounce,
7038
- so as defaultControlOptions,
7039
- he as defaultMeasureControlOptions,
6973
+ Vt as debounce,
6974
+ oo as defaultControlOptions,
6975
+ Ee as defaultMeasureControlOptions,
7040
6976
  q as defaultMeasureUnitSymbols,
7041
6977
  z as defaultValhallaControlOptions,
7042
- lo as getDefaultModeOptions,
7043
- xt as queryElevationByPoint,
7044
- Ot as queryElevationFromRasterDEM,
7045
- er as roundFeatureCoordinates,
7046
- Go as routingDistanceUnitOptions
6978
+ no as getDefaultModeOptions,
6979
+ Eo as queryElevationByPoint,
6980
+ It as queryElevationFromRasterDEM,
6981
+ ir as roundFeatureCoordinates,
6982
+ zo as routingDistanceUnitOptions
7047
6983
  };
7048
6984
  //# sourceMappingURL=maplibre-gl-terradraw.es.js.map