@watergis/maplibre-gl-terradraw 0.6.1 → 0.6.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,6 +1,6 @@
1
- var pe = Object.defineProperty;
2
- var ye = (s, t, e) => t in s ? pe(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var W = (s, t, e) => ye(s, typeof t != "symbol" ? t + "" : t, e);
1
+ var Me = Object.defineProperty;
2
+ var be = (s, t, e) => t in s ? Me(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var k = (s, t, e) => be(s, typeof t != "symbol" ? t + "" : t, e);
4
4
  function x() {
5
5
  return x = Object.assign ? Object.assign.bind() : function(s) {
6
6
  for (var t = 1; t < arguments.length; t++) {
@@ -14,7 +14,7 @@ function E(s, t = 9) {
14
14
  const e = Math.pow(10, t);
15
15
  return Math.round(s * e) / e;
16
16
  }
17
- const _ = (s, t) => {
17
+ const F = (s, t) => {
18
18
  const { x: e, y: i } = s, { x: o, y: r } = t, n = o - e, a = r - i;
19
19
  return Math.sqrt(a * a + n * n);
20
20
  };
@@ -68,7 +68,7 @@ class Qt {
68
68
  if (e) if (this._dragState === "not-dragging") this._currentModeCallbacks.onMouseMove(e), this._lastDrawEvent = e;
69
69
  else if (this._dragState === "pre-dragging") {
70
70
  if (!this._lastDrawEvent) return;
71
- const i = { x: this._lastDrawEvent.containerX, y: this._lastDrawEvent.containerY }, o = { x: e.containerX, y: e.containerY }, r = this._currentModeCallbacks.getState(), n = _(i, o);
71
+ const i = { x: this._lastDrawEvent.containerX, y: this._lastDrawEvent.containerY }, o = { x: e.containerX, y: e.containerY }, r = this._currentModeCallbacks.getState(), n = F(i, o);
72
72
  let a = !1;
73
73
  if (a = r === "drawing" ? n < this._minPixelDragDistanceDrawing : r === "selecting" ? n < this._minPixelDragDistanceSelecting : n < this._minPixelDragDistance, a) return;
74
74
  this._dragState = "dragging", this._currentModeCallbacks.onDragStart(e, (l) => {
@@ -117,7 +117,7 @@ class Qt {
117
117
  }), this.clear();
118
118
  }
119
119
  }
120
- class fe extends Qt {
120
+ class we extends Qt {
121
121
  constructor(t) {
122
122
  super(t), this._nextRender = void 0, this._map = void 0, this._container = void 0, this._rendered = !1, this.changedIds = { deletion: !1, points: !1, linestrings: !1, polygons: !1, styling: !1 }, this._map = t.map, this._container = this._map.getContainer();
123
123
  }
@@ -187,13 +187,13 @@ class fe extends Qt {
187
187
  this.updateChangedIds(t), this._nextRender && cancelAnimationFrame(this._nextRender), this._nextRender = requestAnimationFrame(() => {
188
188
  const i = [...t.created, ...t.updated, ...t.unchanged], o = [], r = [], n = [];
189
189
  for (let a = 0; a < i.length; a++) {
190
- const l = i[a], { properties: h } = l, c = e[h.mode](l);
191
- l.geometry.type === "Point" ? (h.pointColor = c.pointColor, h.pointOutlineColor = c.pointOutlineColor, h.pointOutlineWidth = c.pointOutlineWidth, h.pointWidth = c.pointWidth, o.push(l)) : l.geometry.type === "LineString" ? (h.lineStringColor = c.lineStringColor, h.lineStringWidth = c.lineStringWidth, r.push(l)) : l.geometry.type === "Polygon" && (h.polygonFillColor = c.polygonFillColor, h.polygonFillOpacity = c.polygonFillOpacity, h.polygonOutlineColor = c.polygonOutlineColor, h.polygonOutlineWidth = c.polygonOutlineWidth, n.push(l));
190
+ const l = i[a], { properties: c } = l, h = e[c.mode](l);
191
+ l.geometry.type === "Point" ? (c.pointColor = h.pointColor, c.pointOutlineColor = h.pointOutlineColor, c.pointOutlineWidth = h.pointOutlineWidth, c.pointWidth = h.pointWidth, o.push(l)) : l.geometry.type === "LineString" ? (c.lineStringColor = h.lineStringColor, c.lineStringWidth = h.lineStringWidth, r.push(l)) : l.geometry.type === "Polygon" && (c.polygonFillColor = h.polygonFillColor, c.polygonFillOpacity = h.polygonFillOpacity, c.polygonOutlineColor = h.polygonOutlineColor, c.polygonOutlineWidth = h.polygonOutlineWidth, n.push(l));
192
192
  }
193
193
  if (this._rendered) {
194
- const a = this.changedIds.deletion || this.changedIds.styling, l = a || this.changedIds.linestrings, h = a || this.changedIds.polygons;
195
- let c;
196
- (a || this.changedIds.points) && (c = this._setGeoJSONLayerData("Point", o)), l && this._setGeoJSONLayerData("LineString", r), h && this._setGeoJSONLayerData("Polygon", n), c && this._map.moveLayer(c);
194
+ const a = this.changedIds.deletion || this.changedIds.styling, l = a || this.changedIds.linestrings, c = a || this.changedIds.polygons;
195
+ let h;
196
+ (a || this.changedIds.points) && (h = this._setGeoJSONLayerData("Point", o)), l && this._setGeoJSONLayerData("LineString", r), c && this._setGeoJSONLayerData("Polygon", n), h && this._map.moveLayer(h);
197
197
  } else {
198
198
  const a = this._addGeoJSONLayer("Point", o);
199
199
  this._addGeoJSONLayer("LineString", r), this._addGeoJSONLayer("Polygon", n), this._rendered = !0, a && this._map.moveLayer(a);
@@ -214,9 +214,9 @@ class fe extends Qt {
214
214
  super.register(t), this._currentModeCallbacks && this._currentModeCallbacks.onReady && this._currentModeCallbacks.onReady();
215
215
  }
216
216
  }
217
- class me extends Qt {
217
+ class Ee extends Qt {
218
218
  constructor(t) {
219
- super(t), this.mapboxglAdapter = void 0, this.mapboxglAdapter = new fe(t);
219
+ super(t), this.mapboxglAdapter = void 0, this.mapboxglAdapter = new we(t);
220
220
  }
221
221
  register(t) {
222
222
  this.mapboxglAdapter.register(t);
@@ -255,7 +255,7 @@ class me extends Qt {
255
255
  this.mapboxglAdapter.clear();
256
256
  }
257
257
  }
258
- const Ce = { radians: 6370997 / (2 * Math.PI), degrees: 2 * Math.PI * 6370997 / 360, ft: 0.3048, m: 1, "us-ft": 1200 / 3937 };
258
+ const Ie = { radians: 6370997 / (2 * Math.PI), degrees: 2 * Math.PI * 6370997 / 360, ft: 0.3048, m: 1, "us-ft": 1200 / 3937 };
259
259
  var te = class {
260
260
  constructor(s) {
261
261
  this.code_ = s.code, this.units_ = s.units, this.extent_ = s.extent !== void 0 ? s.extent : null, this.worldExtent_ = s.worldExtent !== void 0 ? s.worldExtent : null, this.axisOrientation_ = s.axisOrientation !== void 0 ? s.axisOrientation : "enu", this.global_ = s.global !== void 0 && s.global, this.canWrapX_ = !(!this.global_ || !this.extent_), this.getPointResolutionFunc_ = s.getPointResolution, this.defaultTileGrid_ = null, this.metersPerUnit_ = s.metersPerUnit;
@@ -273,7 +273,7 @@ var te = class {
273
273
  return this.units_;
274
274
  }
275
275
  getMetersPerUnit() {
276
- return this.metersPerUnit_ || Ce[this.units_];
276
+ return this.metersPerUnit_ || Ie[this.units_];
277
277
  }
278
278
  getWorldExtent() {
279
279
  return this.worldExtent_;
@@ -306,18 +306,18 @@ var te = class {
306
306
  return this.getPointResolutionFunc_;
307
307
  }
308
308
  };
309
- const it = 6378137, J = Math.PI * it, ve = [-J, -J, J, J], Pe = [-180, -85, 180, 85], st = it * Math.log(Math.tan(Math.PI / 2));
309
+ const it = 6378137, J = Math.PI * it, Fe = [-J, -J, J, J], _e = [-180, -85, 180, 85], st = it * Math.log(Math.tan(Math.PI / 2));
310
310
  class z extends te {
311
311
  constructor(t) {
312
- super({ code: t, units: "m", extent: ve, global: !0, worldExtent: Pe, getPointResolution: function(e, i) {
312
+ super({ code: t, units: "m", extent: Fe, global: !0, worldExtent: _e, getPointResolution: function(e, i) {
313
313
  return e / Math.cosh(i[1] / it);
314
314
  } });
315
315
  }
316
316
  }
317
- const Ft = [new z("EPSG:3857"), new z("EPSG:102100"), new z("EPSG:102113"), new z("EPSG:900913"), new z("http://www.opengis.net/def/crs/EPSG/0/3857"), new z("http://www.opengis.net/gml/srs/epsg.xml#3857")], Ot = [-180, -90, 180, 90], xe = 6378137 * Math.PI / 180;
317
+ const Dt = [new z("EPSG:3857"), new z("EPSG:102100"), new z("EPSG:102113"), new z("EPSG:900913"), new z("http://www.opengis.net/def/crs/EPSG/0/3857"), new z("http://www.opengis.net/gml/srs/epsg.xml#3857")], Ot = [-180, -90, 180, 90], De = 6378137 * Math.PI / 180;
318
318
  class A extends te {
319
319
  constructor(t, e) {
320
- super({ code: t, units: "degrees", extent: Ot, axisOrientation: e, global: !0, metersPerUnit: xe, worldExtent: Ot });
320
+ super({ code: t, units: "degrees", extent: Ot, axisOrientation: e, global: !0, metersPerUnit: De, worldExtent: Ot });
321
321
  }
322
322
  }
323
323
  const kt = [new A("CRS:84"), new A("EPSG:4326", "neu"), new A("urn:ogc:def:crs:OGC:1.3:CRS84"), new A("urn:ogc:def:crs:OGC:2:84"), new A("http://www.opengis.net/def/crs/OGC/1.3/CRS84"), new A("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"), new A("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")];
@@ -331,20 +331,20 @@ function ee(s, t) {
331
331
  else t = s.slice();
332
332
  return t;
333
333
  }
334
- function Se(s) {
334
+ function Oe(s) {
335
335
  s.getCode(), ut(s, s, ee);
336
336
  }
337
337
  function Lt(s) {
338
338
  (function(t) {
339
- t.forEach(Se);
339
+ t.forEach(Oe);
340
340
  })(s), s.forEach(function(t) {
341
341
  s.forEach(function(e) {
342
342
  t !== e && ut(t, e, ee);
343
343
  });
344
344
  });
345
345
  }
346
- var Wt, jt, Bt, w;
347
- Lt(Ft), Lt(kt), Wt = Ft, jt = function(s, t, e) {
346
+ var Wt, jt, Bt, b;
347
+ Lt(Dt), Lt(kt), Wt = Dt, jt = function(s, t, e) {
348
348
  const i = s.length;
349
349
  e = e > 1 ? e : 2, t === void 0 && (t = e > 2 ? s.slice() : new Array(i));
350
350
  for (let o = 0; o < i; o += e) {
@@ -365,8 +365,8 @@ Lt(Ft), Lt(kt), Wt = Ft, jt = function(s, t, e) {
365
365
  });
366
366
  (function(s) {
367
367
  s.Commit = "commit", s.Provisional = "provisional", s.Finish = "finish";
368
- })(w || (w = {}));
369
- const wt = "selected", et = "midPoint", Nt = "closingPoint";
368
+ })(b || (b = {}));
369
+ const bt = "selected", et = "midPoint", Nt = "closingPoint";
370
370
  function Pt(s) {
371
371
  return !!(s && typeof s == "object" && s !== null && !Array.isArray(s));
372
372
  }
@@ -380,7 +380,7 @@ var U;
380
380
  (function(s) {
381
381
  s.Drawing = "drawing", s.Select = "select", s.Static = "static", s.Render = "render";
382
382
  })(U || (U = {}));
383
- class L {
383
+ class W {
384
384
  get state() {
385
385
  return this._state;
386
386
  }
@@ -432,7 +432,7 @@ class L {
432
432
  if (r) throw new Error(r);
433
433
  return !0;
434
434
  }(t, this.store.idStrategy.isValidId);
435
- return this.validate ? this.validate(t, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: w.Provisional }) : e;
435
+ return this.validate ? this.validate(t, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }) : e;
436
436
  }
437
437
  onFinish(t, e) {
438
438
  }
@@ -464,34 +464,34 @@ class L {
464
464
  return t === void 0 ? e : typeof t == "function" ? t(i) : t;
465
465
  }
466
466
  }
467
- class Me extends L {
467
+ class ke extends W {
468
468
  constructor(...t) {
469
469
  super(...t), this.type = U.Select;
470
470
  }
471
471
  }
472
472
  function G(s, t) {
473
- const e = (h) => h * Math.PI / 180, i = e(s[1]), o = e(s[0]), r = e(t[1]), n = r - i, a = e(t[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);
473
+ const e = (c) => c * Math.PI / 180, i = e(s[1]), o = e(s[0]), r = e(t[1]), n = r - i, a = e(t[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);
474
474
  return 2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)) * 6371e3 / 1e3;
475
475
  }
476
- const bt = 63710088e-1;
477
- function D(s) {
476
+ const wt = 63710088e-1;
477
+ function _(s) {
478
478
  return s % 360 * Math.PI / 180;
479
479
  }
480
480
  function ie(s) {
481
- return s / (bt / 1e3);
481
+ return s / (wt / 1e3);
482
482
  }
483
483
  function q(s) {
484
484
  return s % (2 * Math.PI) * 180 / Math.PI;
485
485
  }
486
- const At = 57.29577951308232, Vt = 0.017453292519943295, gt = 6378137, M = (s, t) => ({ x: s === 0 ? 0 : s * Vt * gt, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * Vt / 2)) * gt }), k = (s, t) => ({ lng: s === 0 ? 0 : At * (s / gt), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / gt)) - Math.PI / 2) * At });
487
- function we(s, t, e) {
488
- const i = D(s[0]), o = D(s[1]), r = D(e), n = ie(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
486
+ const At = 57.29577951308232, Vt = 0.017453292519943295, gt = 6378137, M = (s, t) => ({ x: s === 0 ? 0 : s * Vt * gt, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * Vt / 2)) * gt }), L = (s, t) => ({ lng: s === 0 ? 0 : At * (s / gt), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / gt)) - Math.PI / 2) * At });
487
+ function Le(s, t, e) {
488
+ const i = _(s[0]), o = _(s[1]), r = _(e), n = ie(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
489
489
  return [q(i + Math.atan2(Math.sin(r) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), q(a)];
490
490
  }
491
491
  function Ut(s) {
492
492
  const { center: t, radiusKilometers: e, coordinatePrecision: i } = s, o = s.steps ? s.steps : 64, r = [];
493
493
  for (let n = 0; n < o; n++) {
494
- const a = we(t, e, -360 * n / o);
494
+ const a = Le(t, e, -360 * n / o);
495
495
  r.push([E(a[0], i), E(a[1], i)]);
496
496
  }
497
497
  return r.push(r[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [r] }, properties: {} };
@@ -505,20 +505,20 @@ function Et(s) {
505
505
  e = [s.geometry.coordinates];
506
506
  }
507
507
  const i = [];
508
- for (let n = 0; n < e.length; n++) for (let a = 0; a < e[n].length - 1; a++) for (let l = 0; l < e.length; l++) for (let h = 0; h < e[l].length - 1; h++) r(n, a, l, h);
508
+ for (let n = 0; n < e.length; n++) for (let a = 0; a < e[n].length - 1; a++) for (let l = 0; l < e.length; l++) for (let c = 0; c < e[l].length - 1; c++) r(n, a, l, c);
509
509
  return i.length > 0;
510
510
  function o(n) {
511
511
  return n < 0 - t.epsilon || n > 1 + t.epsilon;
512
512
  }
513
- function r(n, a, l, h) {
514
- const c = e[n][a], d = e[n][a + 1], u = e[l][h], g = e[l][h + 1], p = function(f, v, C, S) {
513
+ function r(n, a, l, c) {
514
+ const h = e[n][a], d = e[n][a + 1], u = e[l][c], g = e[l][c + 1], p = function(f, v, C, S) {
515
515
  if (nt(f, C) || nt(f, S) || nt(v, C) || nt(S, C)) return null;
516
- const P = f[0], b = f[1], I = v[0], B = v[1], T = C[0], X = C[1], N = S[0], rt = S[1], Ct = (P - I) * (X - rt) - (b - B) * (T - N);
517
- return Ct === 0 ? null : [((P * B - b * I) * (T - N) - (P - I) * (T * rt - X * N)) / Ct, ((P * B - b * I) * (X - rt) - (b - B) * (T * rt - X * N)) / Ct];
518
- }(c, d, u, g);
516
+ const P = f[0], w = f[1], I = v[0], B = v[1], T = C[0], X = C[1], N = S[0], rt = S[1], Ct = (P - I) * (X - rt) - (w - B) * (T - N);
517
+ return Ct === 0 ? null : [((P * B - w * I) * (T - N) - (P - I) * (T * rt - X * N)) / Ct, ((P * B - w * I) * (X - rt) - (w - B) * (T * rt - X * N)) / Ct];
518
+ }(h, d, u, g);
519
519
  if (p === null) return;
520
520
  let y, m;
521
- y = d[0] !== c[0] ? (p[0] - c[0]) / (d[0] - c[0]) : (p[1] - c[1]) / (d[1] - c[1]), m = g[0] !== u[0] ? (p[0] - u[0]) / (g[0] - u[0]) : (p[1] - u[1]) / (g[1] - u[1]), o(y) || o(m) || (p.toString(), i.push(p));
521
+ y = d[0] !== h[0] ? (p[0] - h[0]) / (d[0] - h[0]) : (p[1] - h[1]) / (d[1] - h[1]), m = g[0] !== u[0] ? (p[0] - u[0]) / (g[0] - u[0]) : (p[1] - u[1]) / (g[1] - u[1]), o(y) || o(m) || (p.toString(), i.push(p));
522
522
  }
523
523
  }
524
524
  function nt(s, t) {
@@ -540,7 +540,7 @@ function R(s, t) {
540
540
  function oe(s, t) {
541
541
  return R(s, t) && !Et(s);
542
542
  }
543
- class be extends L {
543
+ class re extends W {
544
544
  constructor(t) {
545
545
  var e;
546
546
  super(t), this.mode = "circle", this.center = void 0, this.clickCount = 0, this.currentCircleId = void 0, this.keyEvents = void 0, this.cursors = void 0, this.startingRadiusKilometers = 1e-5;
@@ -557,7 +557,7 @@ class be extends L {
557
557
  const t = this.currentCircleId;
558
558
  if (this.validate && t) {
559
559
  const e = this.store.getGeometryCopy(t);
560
- if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: w.Finish })) return;
560
+ if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish })) return;
561
561
  }
562
562
  this.center = void 0, this.currentCircleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
563
563
  }
@@ -611,14 +611,14 @@ class be extends L {
611
611
  const o = function(r, n) {
612
612
  const a = 1e3 * G(r, n);
613
613
  if (a === 0) return 1;
614
- const { x: l, y: h } = M(r[0], r[1]), { x: c, y: d } = M(n[0], n[1]);
615
- return Math.sqrt(Math.pow(c - l, 2) + Math.pow(d - h, 2)) / a;
614
+ const { x: l, y: c } = M(r[0], r[1]), { x: h, y: d } = M(n[0], n[1]);
615
+ return Math.sqrt(Math.pow(h - l, 2) + Math.pow(d - c, 2)) / a;
616
616
  }(this.center, [t.lng, t.lat]);
617
617
  i = function(r) {
618
- const { center: n, radiusKilometers: a, coordinatePrecision: l } = r, h = r.steps ? r.steps : 64, c = 1e3 * a, [d, u] = n, { x: g, y: p } = M(d, u), y = [];
619
- for (let m = 0; m < h; m++) {
620
- const f = 360 * m / h * Math.PI / 180, v = c * Math.cos(f), C = c * Math.sin(f), [S, P] = [g + v, p + C], { lng: b, lat: I } = k(S, P);
621
- y.push([E(b, l), E(I, l)]);
618
+ const { center: n, radiusKilometers: a, coordinatePrecision: l } = r, c = r.steps ? r.steps : 64, h = 1e3 * a, [d, u] = n, { x: g, y: p } = M(d, u), y = [];
619
+ for (let m = 0; m < c; m++) {
620
+ const f = 360 * m / c * Math.PI / 180, v = h * Math.cos(f), C = h * Math.sin(f), [S, P] = [g + v, p + C], { lng: w, lat: I } = L(S, P);
621
+ y.push([E(w, l), E(I, l)]);
622
622
  }
623
623
  return y.push(y[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [y] }, properties: {} };
624
624
  }({ center: this.center, radiusKilometers: e * o, coordinatePrecision: this.coordinatePrecision });
@@ -626,12 +626,12 @@ class be extends L {
626
626
  if (this.projection !== "globe") throw new Error("Invalid projection");
627
627
  i = Ut({ center: this.center, radiusKilometers: e, coordinatePrecision: this.coordinatePrecision });
628
628
  }
629
- if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: e } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: w.Provisional })) return;
629
+ if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: e } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional })) return;
630
630
  this.store.updateGeometry([{ id: this.currentCircleId, geometry: i.geometry }]), this.store.updateProperty([{ id: this.currentCircleId, property: "radiusKilometers", value: e }]);
631
631
  }
632
632
  }
633
633
  }
634
- class Ee extends L {
634
+ class se extends W {
635
635
  constructor(t) {
636
636
  super(t), this.mode = "freehand", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = void 0, this.keyEvents = void 0, this.cursors = void 0, this.preventPointsNearClose = void 0;
637
637
  const e = { start: "crosshair", close: "pointer" };
@@ -647,7 +647,7 @@ class Ee extends L {
647
647
  const t = this.currentId;
648
648
  if (this.validate && t) {
649
649
  const e = this.store.getGeometryCopy(t);
650
- if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: w.Finish })) return;
650
+ if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish })) return;
651
651
  }
652
652
  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(t, { mode: this.mode, action: "draw" });
653
653
  }
@@ -659,14 +659,14 @@ class Ee extends L {
659
659
  }
660
660
  onMouseMove(t) {
661
661
  if (this.currentId === void 0 || this.startingClick === !1) return;
662
- const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates[0].length - 2, [o, r] = e.coordinates[0][i], { x: n, y: a } = this.project(o, r), l = _({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [h, c] = e.coordinates[0][0], { x: d, y: u } = this.project(h, c);
663
- if (_({ x: d, y: u }, { x: t.containerX, y: t.containerY }) < this.pointerDistance) {
662
+ const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates[0].length - 2, [o, r] = e.coordinates[0][i], { x: n, y: a } = this.project(o, r), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [c, h] = e.coordinates[0][0], { x: d, y: u } = this.project(c, h);
663
+ if (F({ x: d, y: u }, { x: t.containerX, y: t.containerY }) < this.pointerDistance) {
664
664
  if (this.setCursor(this.cursors.close), this.preventPointsNearClose) return;
665
665
  } else this.setCursor(this.cursors.start);
666
666
  if (l < this.minDistance) return;
667
667
  e.coordinates[0].pop();
668
668
  const g = { type: "Polygon", coordinates: [[...e.coordinates[0], [t.lng, t.lat], e.coordinates[0][0]]] };
669
- this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: w.Provisional }) || this.store.updateGeometry([{ id: this.currentId, geometry: g }]);
669
+ this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }) || this.store.updateGeometry([{ id: this.currentId, geometry: g }]);
670
670
  }
671
671
  onClick(t) {
672
672
  if (this.startingClick === !1) {
@@ -707,7 +707,7 @@ class O {
707
707
  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 = t, this.mode = e, this.project = i, this.unproject = o, this.pointerDistance = r, this.coordinatePrecision = n, this.projection = a;
708
708
  }
709
709
  }
710
- function re({ unproject: s, point: t, pointerDistance: e }) {
710
+ function ne({ unproject: s, point: t, pointerDistance: e }) {
711
711
  const i = e / 2, { x: o, y: r } = t;
712
712
  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])] } };
713
713
  }
@@ -717,19 +717,19 @@ class It extends O {
717
717
  }
718
718
  create(t) {
719
719
  const { containerX: e, containerY: i } = t;
720
- return re({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
720
+ return ne({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
721
721
  }
722
722
  }
723
- class _t extends O {
723
+ class Ft extends O {
724
724
  constructor(t) {
725
725
  super(t);
726
726
  }
727
727
  measure(t, e) {
728
728
  const { x: i, y: o } = this.project(e[0], e[1]);
729
- return _({ x: i, y: o }, { x: t.containerX, y: t.containerY });
729
+ return F({ x: i, y: o }, { x: t.containerX, y: t.containerY });
730
730
  }
731
731
  }
732
- class se extends O {
732
+ class ae extends O {
733
733
  constructor(t, e, i) {
734
734
  super(t), 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)), this.getSnappableCoordinate = (o, r) => this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode && n.id !== r)), this.config = t, this.pixelDistance = e, this.clickBoundingBox = i;
735
735
  }
@@ -743,22 +743,22 @@ class se extends O {
743
743
  a = n.geometry.coordinates;
744
744
  }
745
745
  a.forEach((l) => {
746
- const h = this.pixelDistance.measure(t, l);
747
- h < r.minDist && h < this.pointerDistance && (r.coord = l, r.minDist = h);
746
+ const c = this.pixelDistance.measure(t, l);
747
+ c < r.minDist && c < this.pointerDistance && (r.coord = l, r.minDist = c);
748
748
  });
749
749
  }), r.coord;
750
750
  }
751
751
  }
752
752
  function Tt(s, t, e) {
753
- const i = D(s[0]), o = D(s[1]), r = D(e), n = ie(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
753
+ const i = _(s[0]), o = _(s[1]), r = _(e), n = ie(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
754
754
  return [q(i + Math.atan2(Math.sin(r) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), q(a)];
755
755
  }
756
756
  function ot({ x: s, y: t }, e, i) {
757
- const o = D(i);
757
+ const o = _(i);
758
758
  return { x: s + e * Math.cos(o), y: t + e * Math.sin(o) };
759
759
  }
760
760
  function Xt(s, t) {
761
- const e = D(s[0]), i = D(t[0]), o = D(s[1]), r = D(t[1]), n = Math.sin(i - e) * Math.cos(r), a = Math.cos(o) * Math.sin(r) - Math.sin(o) * Math.cos(r) * Math.cos(i - e);
761
+ const e = _(s[0]), i = _(t[0]), o = _(s[1]), r = _(t[1]), n = Math.sin(i - e) * Math.cos(r), a = Math.cos(o) * Math.sin(r) - Math.sin(o) * Math.cos(r) * Math.cos(i - e);
762
762
  return q(Math.atan2(n, a));
763
763
  }
764
764
  function j({ x: s, y: t }, { x: e, y: i }) {
@@ -768,21 +768,21 @@ function j({ x: s, y: t }, { x: e, y: i }) {
768
768
  function V(s) {
769
769
  return (s + 360) % 360;
770
770
  }
771
- function Ie(s, t, e) {
771
+ function We(s, t, e) {
772
772
  const i = [], o = s.length;
773
773
  let r, n, a, l = 0;
774
- for (let c = 0; c < s.length && !(t >= l && c === s.length - 1); c++) {
774
+ for (let h = 0; h < s.length && !(t >= l && h === s.length - 1); h++) {
775
775
  if (l > t && i.length === 0) {
776
- if (r = t - l, !r) return i.push(s[c]), i;
777
- n = Xt(s[c], s[c - 1]) - 180, a = Tt(s[c], r, n), i.push(a);
776
+ if (r = t - l, !r) return i.push(s[h]), i;
777
+ n = Xt(s[h], s[h - 1]) - 180, a = Tt(s[h], r, n), i.push(a);
778
778
  }
779
- if (l >= e) return r = e - l, r ? (n = Xt(s[c], s[c - 1]) - 180, a = Tt(s[c], r, n), i.push(a), i) : (i.push(s[c]), i);
780
- if (l >= t && i.push(s[c]), c === s.length - 1) return i;
781
- l += G(s[c], s[c + 1]);
779
+ if (l >= e) return r = e - l, r ? (n = Xt(s[h], s[h - 1]) - 180, a = Tt(s[h], r, n), i.push(a), i) : (i.push(s[h]), i);
780
+ if (l >= t && i.push(s[h]), h === s.length - 1) return i;
781
+ l += G(s[h], s[h + 1]);
782
782
  }
783
783
  if (l < t && s.length === o) throw new Error("Start position is beyond line");
784
- const h = s[s.length - 1];
785
- return [h, h];
784
+ const c = s[s.length - 1];
785
+ return [c, c];
786
786
  }
787
787
  function at(s) {
788
788
  return s * (Math.PI / 180);
@@ -790,39 +790,39 @@ function at(s) {
790
790
  function Kt(s) {
791
791
  return s * (180 / Math.PI);
792
792
  }
793
- class _e extends O {
793
+ class je extends O {
794
794
  constructor(t) {
795
795
  super(t), this.config = void 0, this.config = t;
796
796
  }
797
797
  generateInsertionCoordinates(t, e, i) {
798
798
  const o = [t, e];
799
799
  let r = 0;
800
- for (let h = 0; h < o.length - 1; h++) r += G(o[0], o[1]);
800
+ for (let c = 0; c < o.length - 1; c++) r += G(o[0], o[1]);
801
801
  if (r <= i) return o;
802
802
  let n = r / i - 1;
803
803
  Number.isInteger(n) || (n = Math.floor(n) + 1);
804
804
  const a = [];
805
- for (let h = 0; h < n; h++) {
806
- const c = Ie(o, i * h, i * (h + 1));
807
- a.push(c);
805
+ for (let c = 0; c < n; c++) {
806
+ const h = We(o, i * c, i * (c + 1));
807
+ a.push(h);
808
808
  }
809
809
  const l = [];
810
- for (let h = 0; h < a.length; h++) l.push(a[h][1]);
810
+ for (let c = 0; c < a.length; c++) l.push(a[c][1]);
811
811
  return this.limitCoordinates(l);
812
812
  }
813
813
  generateInsertionGeodesicCoordinates(t, e, i) {
814
814
  const o = G(t, e), r = function(n, a, l) {
815
- const h = [], c = at(n[1]), d = at(n[0]), u = at(a[1]), g = at(a[0]);
815
+ const c = [], h = at(n[1]), d = at(n[0]), u = at(a[1]), g = at(a[0]);
816
816
  l += 1;
817
- const p = 2 * Math.asin(Math.sqrt(Math.sin((u - c) / 2) ** 2 + Math.cos(c) * Math.cos(u) * Math.sin((g - d) / 2) ** 2));
818
- if (p === 0 || isNaN(p)) return h;
817
+ const p = 2 * Math.asin(Math.sqrt(Math.sin((u - h) / 2) ** 2 + Math.cos(h) * Math.cos(u) * Math.sin((g - d) / 2) ** 2));
818
+ if (p === 0 || isNaN(p)) return c;
819
819
  for (let y = 0; y <= l; y++) {
820
- const m = y / l, f = Math.sin((1 - m) * p) / Math.sin(p), v = Math.sin(m * p) / Math.sin(p), C = f * Math.cos(c) * Math.cos(d) + v * Math.cos(u) * Math.cos(g), S = f * Math.cos(c) * Math.sin(d) + v * Math.cos(u) * Math.sin(g), P = f * Math.sin(c) + v * Math.sin(u);
820
+ const m = y / l, f = Math.sin((1 - m) * p) / Math.sin(p), v = Math.sin(m * p) / Math.sin(p), C = f * Math.cos(h) * Math.cos(d) + v * Math.cos(u) * Math.cos(g), S = f * Math.cos(h) * Math.sin(d) + v * Math.cos(u) * Math.sin(g), P = f * Math.sin(h) + v * Math.sin(u);
821
821
  if (isNaN(C) || isNaN(S) || isNaN(P)) continue;
822
- const b = Math.atan2(P, Math.sqrt(C ** 2 + S ** 2)), I = Math.atan2(S, C);
823
- isNaN(b) || isNaN(I) || h.push([Kt(I), Kt(b)]);
822
+ const w = Math.atan2(P, Math.sqrt(C ** 2 + S ** 2)), I = Math.atan2(S, C);
823
+ isNaN(w) || isNaN(I) || c.push([Kt(I), Kt(w)]);
824
824
  }
825
- return h.slice(1, -1);
825
+ return c.slice(1, -1);
826
826
  }(t, e, Math.floor(o / i));
827
827
  return this.limitCoordinates(r);
828
828
  }
@@ -833,7 +833,7 @@ class _e extends O {
833
833
  function $(s, t) {
834
834
  return s[0] === t[0] && s[1] === t[1];
835
835
  }
836
- class De extends L {
836
+ class le extends W {
837
837
  constructor(t) {
838
838
  super(t), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents = void 0, this.snappingEnabled = void 0, this.cursors = void 0, this.mouseMove = !1, this.insertCoordinates = void 0, this.lastCommitedCoordinates = void 0, this.snapping = void 0, this.insertPoint = void 0;
839
839
  const e = { start: "crosshair", close: "pointer" };
@@ -847,7 +847,7 @@ class De extends L {
847
847
  close() {
848
848
  if (this.currentId === void 0) return;
849
849
  const t = this.store.getGeometryCopy(this.currentId);
850
- t.coordinates.pop(), this.updateGeometries([...t.coordinates], void 0, w.Commit);
850
+ t.coordinates.pop(), this.updateGeometries([...t.coordinates], void 0, b.Commit);
851
851
  const e = this.currentId;
852
852
  this.closingPointId && this.store.delete([this.closingPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.lastCommitedCoordinates = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
853
853
  }
@@ -874,18 +874,18 @@ class De extends L {
874
874
  const e = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...t] }, properties: { mode: this.mode } }]);
875
875
  this.closingPointId = i, this.setCursor(this.cursors.close);
876
876
  const o = [...e, t];
877
- this.updateGeometries(o, void 0, w.Commit), this.currentCoordinate++;
877
+ this.updateGeometries(o, void 0, b.Commit), this.currentCoordinate++;
878
878
  }
879
879
  updateToLine(t, e) {
880
880
  if (!this.currentId) return;
881
881
  const i = this.store.getGeometryCopy(this.currentId).coordinates, [o, r] = this.lastCommitedCoordinates ? this.lastCommitedCoordinates[this.lastCommitedCoordinates.length - 1] : i[i.length - 2], { x: n, y: a } = this.project(o, r);
882
- if (_({ x: n, y: a }, { x: e.x, y: e.y }) < this.pointerDistance) return void this.close();
882
+ if (F({ x: n, y: a }, { x: e.x, y: e.y }) < this.pointerDistance) return void this.close();
883
883
  this.setCursor(this.cursors.close);
884
884
  const l = [...i, t];
885
- this.updateGeometries(l, i[i.length - 1], w.Commit), this.currentCoordinate++;
885
+ this.updateGeometries(l, i[i.length - 1], b.Commit), this.currentCoordinate++;
886
886
  }
887
887
  registerBehaviors(t) {
888
- this.snapping = new se(t, new _t(t), new It(t)), this.insertPoint = new _e(t);
888
+ this.snapping = new ae(t, new Ft(t), new It(t)), this.insertPoint = new je(t);
889
889
  }
890
890
  start() {
891
891
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -900,7 +900,7 @@ class De extends L {
900
900
  const i = this.snappingEnabled && this.snapping.getSnappableCoordinate(t, this.currentId) || [t.lng, t.lat];
901
901
  if (this.closingPointId) {
902
902
  const [r, n] = e[e.length - 1], { x: a, y: l } = this.project(r, n);
903
- _({ x: a, y: l }, { x: t.containerX, y: t.containerY }) < this.pointerDistance && this.setCursor(this.cursors.close);
903
+ F({ x: a, y: l }, { x: t.containerX, y: t.containerY }) < this.pointerDistance && this.setCursor(this.cursors.close);
904
904
  }
905
905
  let o = [...e, i];
906
906
  if (this.insertCoordinates && this.currentId && this.lastCommitedCoordinates) {
@@ -910,7 +910,7 @@ class De extends L {
910
910
  o = [...this.lastCommitedCoordinates.slice(0, -1), ...a, i];
911
911
  }
912
912
  }
913
- this.updateGeometries(o, void 0, w.Provisional);
913
+ this.updateGeometries(o, void 0, b.Provisional);
914
914
  }
915
915
  onClick(t) {
916
916
  this.currentCoordinate > 0 && !this.mouseMove && this.onMouseMove(t), this.mouseMove = !1;
@@ -944,10 +944,10 @@ class De extends L {
944
944
  return !!super.validateFeature(t) && t.geometry.type === "LineString" && t.properties.mode === this.mode && t.geometry.coordinates.length >= 2;
945
945
  }
946
946
  }
947
- function ne(s, t) {
947
+ function ce(s, t) {
948
948
  return s.geometry.type === "Point" && mt(s.geometry.coordinates, t);
949
949
  }
950
- class Fe extends L {
950
+ class Be extends W {
951
951
  constructor(t) {
952
952
  super(t), this.mode = "point", this.cursors = void 0;
953
953
  const e = { create: "crosshair" };
@@ -962,7 +962,7 @@ class Fe extends L {
962
962
  onClick(t) {
963
963
  if (!this.store) throw new Error("Mode must be registered first");
964
964
  const e = { type: "Point", coordinates: [t.lng, t.lat] }, i = { mode: this.mode };
965
- if (this.validate && !this.validate({ type: "Feature", geometry: e, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: w.Finish })) return;
965
+ if (this.validate && !this.validate({ type: "Feature", geometry: e, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish })) return;
966
966
  const [o] = this.store.create([{ geometry: e, properties: i }]);
967
967
  this.onFinish(o, { mode: this.mode, action: "draw" });
968
968
  }
@@ -985,10 +985,10 @@ class Fe extends L {
985
985
  return t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode && (e.pointWidth = this.getNumericStylingValue(this.styles.pointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.pointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.pointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.pointOutlineWidth, 2, t), e.zIndex = 30), e;
986
986
  }
987
987
  validateFeature(t) {
988
- return !!super.validateFeature(t) && t.properties.mode === this.mode && ne(t, this.coordinatePrecision);
988
+ return !!super.validateFeature(t) && t.properties.mode === this.mode && ce(t, this.coordinatePrecision);
989
989
  }
990
990
  }
991
- class Oe extends O {
991
+ class Ne extends O {
992
992
  constructor(t, e) {
993
993
  super(t), this.config = void 0, this.pixelDistance = void 0, this._startEndPoints = [], this.config = t, this.pixelDistance = e;
994
994
  }
@@ -1014,7 +1014,7 @@ class Oe extends O {
1014
1014
  return { isClosing: o < this.pointerDistance, isPreviousClosing: r < this.pointerDistance };
1015
1015
  }
1016
1016
  }
1017
- class ke extends L {
1017
+ class he extends W {
1018
1018
  constructor(t) {
1019
1019
  super(t), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = void 0, this.snappingEnabled = void 0, this.snapping = void 0, this.pixelDistance = void 0, this.closingPoints = void 0, this.cursors = void 0, this.mouseMove = !1;
1020
1020
  const e = { start: "crosshair", close: "pointer" };
@@ -1027,12 +1027,12 @@ class ke extends L {
1027
1027
  close() {
1028
1028
  if (this.currentId === void 0) return;
1029
1029
  const t = this.store.getGeometryCopy(this.currentId).coordinates[0];
1030
- if (t.length < 5 || !this.updatePolygonGeometry([...t.slice(0, -2), t[0]], w.Finish)) return;
1030
+ if (t.length < 5 || !this.updatePolygonGeometry([...t.slice(0, -2), t[0]], b.Finish)) return;
1031
1031
  const e = this.currentId;
1032
1032
  this.currentCoordinate = 0, this.currentId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
1033
1033
  }
1034
1034
  registerBehaviors(t) {
1035
- this.pixelDistance = new _t(t), this.snapping = new se(t, this.pixelDistance, new It(t)), this.closingPoints = new Oe(t, this.pixelDistance);
1035
+ this.pixelDistance = new Ft(t), this.snapping = new ae(t, this.pixelDistance, new It(t)), this.closingPoints = new Ne(t, this.pixelDistance);
1036
1036
  }
1037
1037
  start() {
1038
1038
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -1052,7 +1052,7 @@ class ke extends L {
1052
1052
  const { isClosing: r, isPreviousClosing: n } = this.closingPoints.isClosingPoint(t);
1053
1053
  n || r ? (this.setCursor(this.cursors.close), o = [...i.slice(0, -2), i[0], i[0]]) : o = [...i.slice(0, -2), [t.lng, t.lat], i[0]];
1054
1054
  }
1055
- this.updatePolygonGeometry(o, w.Provisional);
1055
+ this.updatePolygonGeometry(o, b.Provisional);
1056
1056
  }
1057
1057
  updatePolygonGeometry(t, e) {
1058
1058
  if (!this.currentId) return !1;
@@ -1069,13 +1069,13 @@ class ke extends L {
1069
1069
  const e = this.snappingEnabled ? this.snapping.getSnappableCoordinate(t, this.currentId) : void 0;
1070
1070
  e && (t.lng = e[0], t.lat = e[1]);
1071
1071
  const i = this.store.getGeometryCopy(this.currentId);
1072
- if ($([t.lng, t.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], i.coordinates[0][0]], w.Commit)) return;
1072
+ if ($([t.lng, t.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], i.coordinates[0][0]], b.Commit)) return;
1073
1073
  this.currentCoordinate++;
1074
1074
  } else if (this.currentCoordinate === 2 && this.currentId) {
1075
1075
  const e = this.snappingEnabled ? this.snapping.getSnappableCoordinate(t, this.currentId) : void 0;
1076
1076
  e && (t.lng = e[0], t.lat = e[1]);
1077
1077
  const i = this.store.getGeometryCopy(this.currentId).coordinates[0];
1078
- if ($([t.lng, t.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [t.lng, t.lat], [t.lng, t.lat], i[0]], w.Commit)) return;
1078
+ if ($([t.lng, t.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [t.lng, t.lat], [t.lng, t.lat], i[0]], b.Commit)) return;
1079
1079
  this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.currentCoordinate++;
1080
1080
  } else if (this.currentId) {
1081
1081
  const e = this.snappingEnabled ? this.snapping.getSnappableCoordinate(t, this.currentId) : void 0, i = this.store.getGeometryCopy(this.currentId).coordinates[0], { isClosing: o, isPreviousClosing: r } = this.closingPoints.isClosingPoint(t);
@@ -1085,7 +1085,7 @@ class ke extends L {
1085
1085
  const n = /* @__PURE__ */ function(a = [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]) {
1086
1086
  return { type: "Feature", geometry: { type: "Polygon", coordinates: a }, properties: {} };
1087
1087
  }([[...i.slice(0, -1), [t.lng, t.lat], i[0]]]);
1088
- if (!this.updatePolygonGeometry(n.geometry.coordinates[0], w.Commit)) return;
1088
+ if (!this.updatePolygonGeometry(n.geometry.coordinates[0], b.Commit)) return;
1089
1089
  this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1090
1090
  }
1091
1091
  }
@@ -1123,7 +1123,7 @@ class ke extends L {
1123
1123
  return !!super.validateFeature(t) && t.properties.mode === this.mode && R(t, this.coordinatePrecision);
1124
1124
  }
1125
1125
  }
1126
- class Le extends L {
1126
+ class de extends W {
1127
1127
  constructor(t) {
1128
1128
  super(t), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = void 0, this.cursors = void 0;
1129
1129
  const e = { start: "crosshair" };
@@ -1155,10 +1155,10 @@ class Le extends L {
1155
1155
  this.center = [t.lng, t.lat];
1156
1156
  const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode } }]);
1157
1157
  this.currentRectangleId = e, this.clickCount++, this.setDrawing();
1158
- } else this.updateRectangle(t, w.Finish), this.close();
1158
+ } else this.updateRectangle(t, b.Finish), this.close();
1159
1159
  }
1160
1160
  onMouseMove(t) {
1161
- this.updateRectangle(t, w.Provisional);
1161
+ this.updateRectangle(t, b.Provisional);
1162
1162
  }
1163
1163
  onKeyDown() {
1164
1164
  }
@@ -1183,7 +1183,7 @@ class Le extends L {
1183
1183
  return !!super.validateFeature(t) && t.properties.mode === this.mode && oe(t, this.coordinatePrecision);
1184
1184
  }
1185
1185
  }
1186
- class dt extends L {
1186
+ class dt extends W {
1187
1187
  constructor(t) {
1188
1188
  super({ styles: t.styles }), this.type = U.Render, this.mode = "render", this.mode = t.modeName;
1189
1189
  }
@@ -1216,49 +1216,49 @@ class dt extends L {
1216
1216
  return { pointColor: this.getHexColorStylingValue(this.styles.pointColor, "#3f97e0", t), pointWidth: this.getNumericStylingValue(this.styles.pointWidth, 6, t), pointOutlineColor: this.getHexColorStylingValue(this.styles.pointOutlineColor, "#ffffff", t), pointOutlineWidth: this.getNumericStylingValue(this.styles.pointOutlineWidth, 0, t), polygonFillColor: this.getHexColorStylingValue(this.styles.polygonFillColor, "#3f97e0", t), polygonFillOpacity: this.getNumericStylingValue(this.styles.polygonFillOpacity, 0.3, t), polygonOutlineColor: this.getHexColorStylingValue(this.styles.polygonOutlineColor, "#3f97e0", t), polygonOutlineWidth: this.getNumericStylingValue(this.styles.polygonOutlineWidth, 4, t), lineStringWidth: this.getNumericStylingValue(this.styles.lineStringWidth, 4, t), lineStringColor: this.getHexColorStylingValue(this.styles.lineStringColor, "#3f97e0", t), zIndex: this.getNumericStylingValue(this.styles.zIndex, 0, t) };
1217
1217
  }
1218
1218
  validateFeature(t) {
1219
- return super.validateFeature(t) && (ne(t, this.coordinatePrecision) || R(t, this.coordinatePrecision) || function(e, i) {
1219
+ return super.validateFeature(t) && (ce(t, this.coordinatePrecision) || R(t, this.coordinatePrecision) || function(e, i) {
1220
1220
  return e.geometry.type === "LineString" && e.geometry.coordinates.length >= 2 && e.geometry.coordinates.every((o) => mt(o, i));
1221
1221
  }(t, this.coordinatePrecision));
1222
1222
  }
1223
1223
  }
1224
1224
  function pt(s, t) {
1225
- const e = s, i = t, o = D(e[1]), r = D(i[1]);
1226
- let n = D(i[0] - e[0]);
1225
+ const e = s, i = t, o = _(e[1]), r = _(i[1]);
1226
+ let n = _(i[0] - e[0]);
1227
1227
  n > Math.PI && (n -= 2 * Math.PI), n < -Math.PI && (n += 2 * Math.PI);
1228
1228
  const a = Math.log(Math.tan(r / 2 + Math.PI / 4) / Math.tan(o / 2 + Math.PI / 4)), l = (q(Math.atan2(n, a)) + 360) % 360;
1229
1229
  return l > 180 ? -(360 - l) : l;
1230
1230
  }
1231
- function Dt(s, t, e) {
1231
+ function _t(s, t, e) {
1232
1232
  let i = t;
1233
1233
  t < 0 && (i = -Math.abs(i));
1234
- const o = i / bt, r = s[0] * Math.PI / 180, n = D(s[1]), a = D(e), l = o * Math.cos(a);
1235
- let h = n + l;
1236
- Math.abs(h) > Math.PI / 2 && (h = h > 0 ? Math.PI - h : -Math.PI - h);
1237
- const c = Math.log(Math.tan(h / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), d = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), u = [(180 * (r + o * Math.sin(a) / d) / Math.PI + 540) % 360 - 180, 180 * h / Math.PI];
1234
+ const o = i / wt, r = s[0] * Math.PI / 180, n = _(s[1]), a = _(e), l = o * Math.cos(a);
1235
+ let c = n + l;
1236
+ Math.abs(c) > Math.PI / 2 && (c = c > 0 ? Math.PI - c : -Math.PI - c);
1237
+ const h = Math.log(Math.tan(c / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), d = Math.abs(h) > 1e-11 ? l / h : Math.cos(n), u = [(180 * (r + o * Math.sin(a) / d) / Math.PI + 540) % 360 - 180, 180 * c / Math.PI];
1238
1238
  return u[0] += u[0] - s[0] > 180 ? -360 : s[0] - u[0] > 180 ? 360 : 0, u;
1239
1239
  }
1240
- function ae(s, t, e, i, o) {
1240
+ function ue(s, t, e, i, o) {
1241
1241
  const r = i(s[0], s[1]), n = i(t[0], t[1]), { lng: a, lat: l } = o((r.x + n.x) / 2, (r.y + n.y) / 2);
1242
1242
  return [E(a, e), E(l, e)];
1243
1243
  }
1244
- function We(s, t, e) {
1245
- const i = Dt(s, 1e3 * G(s, t) / 2, pt(s, t));
1244
+ function Ge(s, t, e) {
1245
+ const i = _t(s, 1e3 * G(s, t) / 2, pt(s, t));
1246
1246
  return [E(i[0], e), E(i[1], e)];
1247
1247
  }
1248
1248
  function zt({ featureCoords: s, precision: t, unproject: e, project: i, projection: o }) {
1249
1249
  const r = [];
1250
1250
  for (let n = 0; n < s.length - 1; n++) {
1251
1251
  let a;
1252
- if (o === "web-mercator") a = ae(s[n], s[n + 1], t, i, e);
1252
+ if (o === "web-mercator") a = ue(s[n], s[n + 1], t, i, e);
1253
1253
  else {
1254
1254
  if (o !== "globe") throw new Error("Invalid projection");
1255
- a = We(s[n], s[n + 1], t);
1255
+ a = Ge(s[n], s[n + 1], t);
1256
1256
  }
1257
1257
  r.push(a);
1258
1258
  }
1259
1259
  return r;
1260
1260
  }
1261
- class je extends O {
1261
+ class Ae extends O {
1262
1262
  constructor(t, e) {
1263
1263
  super(t), this.config = void 0, this.selectionPointBehavior = void 0, this._midPoints = [], this.config = t, this.selectionPointBehavior = e;
1264
1264
  }
@@ -1273,8 +1273,8 @@ class je extends O {
1273
1273
  }
1274
1274
  create(t, e, i) {
1275
1275
  if (!this.store.has(e)) throw new Error("Store does not have feature with this id");
1276
- this._midPoints = this.store.create(function(o, r, n, a, l, h) {
1277
- return zt({ featureCoords: o, precision: n, project: a, unproject: l, projection: h }).map((c, d) => ({ geometry: { type: "Point", coordinates: c }, properties: r(d) }));
1276
+ this._midPoints = this.store.create(function(o, r, n, a, l, c) {
1277
+ return zt({ featureCoords: o, precision: n, project: a, unproject: l, projection: c }).map((h, d) => ({ geometry: { type: "Point", coordinates: h }, properties: r(d) }));
1278
1278
  }(t, (o) => ({ mode: this.mode, [et]: !0, midPointSegment: o, midPointFeatureId: e }), i, this.config.project, this.config.unproject, this.projection));
1279
1279
  }
1280
1280
  delete() {
@@ -1284,7 +1284,7 @@ class je extends O {
1284
1284
  if (this._midPoints.length !== 0) return zt({ featureCoords: t, precision: this.coordinatePrecision, project: this.config.project, unproject: this.config.unproject, projection: this.config.projection }).map((e, i) => ({ id: this._midPoints[i], geometry: { type: "Point", coordinates: e } }));
1285
1285
  }
1286
1286
  }
1287
- class Be extends O {
1287
+ class Ve extends O {
1288
1288
  constructor(t) {
1289
1289
  super(t), this._selectionPoints = [];
1290
1290
  }
@@ -1296,7 +1296,7 @@ class Be extends O {
1296
1296
  create(t, e, i) {
1297
1297
  this._selectionPoints = this.store.create(function(o, r, n) {
1298
1298
  const a = [], l = r === "Polygon" ? o.length - 1 : o.length;
1299
- for (let h = 0; h < l; h++) a.push({ geometry: { type: "Point", coordinates: o[h] }, properties: n(h) });
1299
+ for (let c = 0; c < l; c++) a.push({ geometry: { type: "Point", coordinates: o[c] }, properties: n(c) });
1300
1300
  return a;
1301
1301
  }(t, e, (o) => ({ mode: this.mode, selectionPoint: !0, selectionPointFeatureId: i, index: o })));
1302
1302
  }
@@ -1310,52 +1310,52 @@ class Be extends O {
1310
1310
  if (this._selectionPoints[t] !== void 0) return { id: this._selectionPoints[t], geometry: { type: "Point", coordinates: e } };
1311
1311
  }
1312
1312
  }
1313
- function le(s, t) {
1313
+ function ge(s, t) {
1314
1314
  let e = !1;
1315
1315
  for (let n = 0, a = t.length; n < a; n++) {
1316
1316
  const l = t[n];
1317
- for (let h = 0, c = l.length, d = c - 1; h < c; d = h++) (o = l[h])[1] > (i = s)[1] != (r = l[d])[1] > i[1] && i[0] < (r[0] - o[0]) * (i[1] - o[1]) / (r[1] - o[1]) + o[0] && (e = !e);
1317
+ for (let c = 0, h = l.length, d = h - 1; c < h; d = c++) (o = l[c])[1] > (i = s)[1] != (r = l[d])[1] > i[1] && i[0] < (r[0] - o[0]) * (i[1] - o[1]) / (r[1] - o[1]) + o[0] && (e = !e);
1318
1318
  }
1319
1319
  var i, o, r;
1320
1320
  return e;
1321
1321
  }
1322
- const he = (s, t, e) => {
1322
+ const pe = (s, t, e) => {
1323
1323
  const i = (r) => r * r, o = (r, n) => i(r.x - n.x) + i(r.y - n.y);
1324
1324
  return Math.sqrt(((r, n, a) => {
1325
1325
  const l = o(n, a);
1326
1326
  if (l === 0) return o(r, n);
1327
- let h = ((r.x - n.x) * (a.x - n.x) + (r.y - n.y) * (a.y - n.y)) / l;
1328
- return h = Math.max(0, Math.min(1, h)), o(r, { x: n.x + h * (a.x - n.x), y: n.y + h * (a.y - n.y) });
1327
+ let c = ((r.x - n.x) * (a.x - n.x) + (r.y - n.y) * (a.y - n.y)) / l;
1328
+ return c = Math.max(0, Math.min(1, c)), o(r, { x: n.x + c * (a.x - n.x), y: n.y + c * (a.y - n.y) });
1329
1329
  })(s, t, e));
1330
1330
  };
1331
- class Ne extends O {
1331
+ class Ue extends O {
1332
1332
  constructor(t, e, i) {
1333
1333
  super(t), this.config = void 0, this.createClickBoundingBox = void 0, this.pixelDistance = void 0, this.config = t, this.createClickBoundingBox = e, this.pixelDistance = i;
1334
1334
  }
1335
1335
  find(t, e) {
1336
- let i, o, r, n, a = 1 / 0, l = 1 / 0, h = 1 / 0;
1337
- const c = this.createClickBoundingBox.create(t), d = this.store.search(c);
1336
+ let i, o, r, n, a = 1 / 0, l = 1 / 0, c = 1 / 0;
1337
+ const h = this.createClickBoundingBox.create(t), d = this.store.search(h);
1338
1338
  for (let u = 0; u < d.length; u++) {
1339
1339
  const g = d[u], p = g.geometry;
1340
1340
  if (p.type === "Point") {
1341
1341
  if (g.properties.selectionPoint || !e && g.properties[et]) continue;
1342
1342
  const y = this.pixelDistance.measure(t, p.coordinates);
1343
- g.properties[et] && y < this.pointerDistance && y < h ? (h = y, r = g) : !g.properties[et] && y < this.pointerDistance && y < a && (a = y, i = g);
1343
+ g.properties[et] && y < this.pointerDistance && y < c ? (c = y, r = g) : !g.properties[et] && y < this.pointerDistance && y < a && (a = y, i = g);
1344
1344
  } else if (p.type === "LineString") {
1345
1345
  if (i) continue;
1346
1346
  for (let y = 0; y < p.coordinates.length - 1; y++) {
1347
- const m = p.coordinates[y], f = p.coordinates[y + 1], v = he({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(f[0], f[1]));
1347
+ const m = p.coordinates[y], f = p.coordinates[y + 1], v = pe({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(f[0], f[1]));
1348
1348
  v < this.pointerDistance && v < l && (l = v, o = g);
1349
1349
  }
1350
1350
  } else if (p.type === "Polygon") {
1351
1351
  if (i || o) continue;
1352
- le([t.lng, t.lat], p.coordinates) && (n = g);
1352
+ ge([t.lng, t.lat], p.coordinates) && (n = g);
1353
1353
  }
1354
1354
  }
1355
1355
  return { clickedFeature: i || o || n, clickedMidPoint: r };
1356
1356
  }
1357
1357
  }
1358
- class Ge extends O {
1358
+ class Re extends O {
1359
1359
  constructor(t, e, i, o) {
1360
1360
  super(t), this.config = void 0, this.featuresAtMouseEvent = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.draggedFeatureId = null, this.dragPosition = void 0, this.config = t, this.featuresAtMouseEvent = e, this.selectionPoints = i, this.midPoints = o;
1361
1361
  }
@@ -1378,19 +1378,19 @@ class Ge extends O {
1378
1378
  if (i.type === "Polygon" || i.type === "LineString") {
1379
1379
  let r, n;
1380
1380
  if (i.type === "Polygon" ? (r = i.coordinates[0], n = r.length - 1) : (r = i.coordinates, n = r.length), !this.dragPosition) return !1;
1381
- for (let h = 0; h < n; h++) {
1382
- const c = r[h], d = [this.dragPosition[0] - o[0], this.dragPosition[1] - o[1]], u = E(c[0] - d[0], this.config.coordinatePrecision), g = E(c[1] - d[1], this.config.coordinatePrecision);
1381
+ for (let c = 0; c < n; c++) {
1382
+ const h = r[c], d = [this.dragPosition[0] - o[0], this.dragPosition[1] - o[1]], u = E(h[0] - d[0], this.config.coordinatePrecision), g = E(h[1] - d[1], this.config.coordinatePrecision);
1383
1383
  if (u > 180 || u < -180 || g > 90 || g < -90) return !1;
1384
- r[h] = [u, g];
1384
+ r[c] = [u, g];
1385
1385
  }
1386
1386
  i.type === "Polygon" && (r[r.length - 1] = [r[0][0], r[0][1]]);
1387
1387
  const a = this.selectionPoints.getUpdated(r) || [], l = this.midPoints.getUpdated(r) || [];
1388
- if (e && !e({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: w.Provisional })) return !1;
1388
+ if (e && !e({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional })) return !1;
1389
1389
  this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: i }, ...a, ...l]), this.dragPosition = [t.lng, t.lat];
1390
1390
  } else i.type === "Point" && (this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: { type: "Point", coordinates: o } }]), this.dragPosition = [t.lng, t.lat]);
1391
1391
  }
1392
1392
  }
1393
- class Ae extends O {
1393
+ class Te extends O {
1394
1394
  constructor(t, e, i, o) {
1395
1395
  super(t), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.draggedCoordinate = { id: null, index: -1 }, this.config = t, this.pixelDistance = e, this.selectionPoints = i, this.midPoints = o;
1396
1396
  }
@@ -1424,8 +1424,8 @@ class Ae extends O {
1424
1424
  const d = n.length - 1;
1425
1425
  n[0] = a, n[d] = a;
1426
1426
  }
1427
- const l = this.selectionPoints.getOneUpdated(o, a), h = l ? [l] : [], c = this.midPoints.getUpdated(n) || [];
1428
- return !(r.type !== "Point" && !e && Et({ type: "Feature", geometry: r, properties: {} }) || i && !i({ type: "Feature", id: this.draggedCoordinate.id, geometry: r, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: w.Provisional }) || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: r }, ...h, ...c]), 0));
1427
+ const l = this.selectionPoints.getOneUpdated(o, a), c = l ? [l] : [], h = this.midPoints.getUpdated(n) || [];
1428
+ return !(r.type !== "Point" && !e && Et({ type: "Feature", geometry: r, properties: {} }) || i && !i({ type: "Feature", id: this.draggedCoordinate.id, geometry: r, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }) || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: r }, ...c, ...h]), 0));
1429
1429
  }
1430
1430
  isDragging() {
1431
1431
  return this.draggedCoordinate.id !== null;
@@ -1443,9 +1443,9 @@ function yt(s) {
1443
1443
  t += o[0], e += o[1], i++;
1444
1444
  }, !0), [t / i, e / i];
1445
1445
  }
1446
- function ce(s, t) {
1446
+ function ye(s, t) {
1447
1447
  s[0] += s[0] - t[0] > 180 ? -360 : t[0] - s[0] > 180 ? 360 : 0;
1448
- const e = bt, i = t[1] * Math.PI / 180, o = s[1] * Math.PI / 180, r = o - i;
1448
+ const e = wt, i = t[1] * Math.PI / 180, o = s[1] * Math.PI / 180, r = o - i;
1449
1449
  let n = Math.abs(s[0] - t[0]) * Math.PI / 180;
1450
1450
  n > Math.PI && (n -= 2 * Math.PI);
1451
1451
  const a = Math.log(Math.tan(o / 2 + Math.PI / 4) / Math.tan(i / 2 + Math.PI / 4)), l = Math.abs(a) > 1e-11 ? r / a : Math.cos(i);
@@ -1460,8 +1460,8 @@ function ft(s) {
1460
1460
  let i = 0, o = 0, r = 0;
1461
1461
  const n = e.length;
1462
1462
  for (let a = 0; a < n - 1; a++) {
1463
- const [l, h] = e[a], [c, d] = e[a + 1], u = l * d - c * h;
1464
- i += u, o += (l + c) * u, r += (h + d) * u;
1463
+ const [l, c] = e[a], [h, d] = e[a + 1], u = l * d - h * c;
1464
+ i += u, o += (l + h) * u, r += (c + d) * u;
1465
1465
  }
1466
1466
  return i /= 2, o /= 6 * i, r /= 6 * i, { x: o, y: r };
1467
1467
  }(t) : function(e) {
@@ -1474,7 +1474,7 @@ function ft(s) {
1474
1474
  return { x: o / i, y: r / i };
1475
1475
  }(t);
1476
1476
  }
1477
- class Ve extends O {
1477
+ class Xe extends O {
1478
1478
  constructor(t, e, i) {
1479
1479
  super(t), this.config = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.lastBearing = void 0, this.config = t, this.selectionPoints = e, this.midPoints = i;
1480
1480
  }
@@ -1493,7 +1493,7 @@ class Ve extends O {
1493
1493
  if (u === 0 || u === 360 || u === -360) return d;
1494
1494
  const g = 0.017453292519943295 * u, p = (d.geometry.type === "Polygon" ? d.geometry.coordinates[0] : d.geometry.coordinates).map(([f, v]) => M(f, v)), y = p.reduce((f, v) => ({ x: f.x + v.x, y: f.y + v.y }), { x: 0, y: 0 });
1495
1495
  y.x /= p.length, y.y /= p.length;
1496
- const m = p.map((f) => ({ x: y.x + (f.x - y.x) * Math.cos(g) - (f.y - y.y) * Math.sin(g), y: y.y + (f.x - y.x) * Math.sin(g) + (f.y - y.y) * Math.cos(g) })).map(({ x: f, y: v }) => [k(f, v).lng, k(f, v).lat]);
1496
+ const m = p.map((f) => ({ x: y.x + (f.x - y.x) * Math.cos(g) - (f.y - y.y) * Math.sin(g), y: y.y + (f.x - y.x) * Math.sin(g) + (f.y - y.y) * Math.cos(g) })).map(({ x: f, y: v }) => [L(f, v).lng, L(f, v).lat]);
1497
1497
  d.geometry.type === "Polygon" ? d.geometry.coordinates[0] = m : d.geometry.coordinates = m;
1498
1498
  })(a, -(this.lastBearing - n));
1499
1499
  } else {
@@ -1503,7 +1503,7 @@ class Ve extends O {
1503
1503
  if (u === 0 || u === 360 || u === -360) return d;
1504
1504
  const g = yt(d);
1505
1505
  (d.geometry.type === "Polygon" ? d.geometry.coordinates[0] : d.geometry.coordinates).forEach((p) => {
1506
- const y = pt(g, p) + u, m = ce(g, p), f = Dt(g, m, y);
1506
+ const y = pt(g, p) + u, m = ye(g, p), f = _t(g, m, y);
1507
1507
  p[0] = f[0], p[1] = f[1];
1508
1508
  });
1509
1509
  })(a, -(this.lastBearing - (n + 180)));
@@ -1512,12 +1512,12 @@ class Ve extends O {
1512
1512
  l.forEach((d) => {
1513
1513
  d[0] = E(d[0], this.coordinatePrecision), d[1] = E(d[1], this.coordinatePrecision);
1514
1514
  });
1515
- const h = this.midPoints.getUpdated(l) || [], c = this.selectionPoints.getUpdated(l) || [];
1516
- if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: w.Provisional })) return !1;
1517
- this.store.updateGeometry([{ id: e, geometry: o }, ...c, ...h]), this.projection === "web-mercator" ? this.lastBearing = n : this.projection === "globe" && (this.lastBearing = n + 180);
1515
+ const c = this.midPoints.getUpdated(l) || [], h = this.selectionPoints.getUpdated(l) || [];
1516
+ if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional })) return !1;
1517
+ this.store.updateGeometry([{ id: e, geometry: o }, ...h, ...c]), this.projection === "web-mercator" ? this.lastBearing = n : this.projection === "globe" && (this.lastBearing = n + 180);
1518
1518
  }
1519
1519
  }
1520
- class Ue extends O {
1520
+ class Ke extends O {
1521
1521
  constructor(t, e, i) {
1522
1522
  super(t), this.config = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.lastDistance = void 0, this.config = t, this.selectionPoints = e, this.midPoints = i;
1523
1523
  }
@@ -1532,36 +1532,36 @@ class Ue extends O {
1532
1532
  const l = ft(n);
1533
1533
  if (this.config.projection === "web-mercator") {
1534
1534
  const g = M(t.lng, t.lat);
1535
- a = _(l, g);
1535
+ a = F(l, g);
1536
1536
  } else {
1537
1537
  if (this.config.projection !== "globe") throw new Error("Invalid projection");
1538
1538
  a = G(yt({ type: "Feature", geometry: o, properties: {} }), r);
1539
1539
  }
1540
1540
  if (!this.lastDistance) return void (this.lastDistance = a);
1541
- const h = 1 - (this.lastDistance - a) / a;
1541
+ const c = 1 - (this.lastDistance - a) / a;
1542
1542
  if (this.config.projection === "web-mercator") {
1543
- const { lng: g, lat: p } = k(l.x, l.y);
1543
+ const { lng: g, lat: p } = L(l.x, l.y);
1544
1544
  (function(y, m, f) {
1545
1545
  if (m === 1) return y;
1546
- const v = (y.geometry.type === "Polygon" ? y.geometry.coordinates[0] : y.geometry.coordinates).map(([P, b]) => M(P, b)), C = M(f[0], f[1]), S = v.map((P) => ({ x: C.x + (P.x - C.x) * m, y: C.y + (P.y - C.y) * m })).map(({ x: P, y: b }) => [k(P, b).lng, k(P, b).lat]);
1546
+ const v = (y.geometry.type === "Polygon" ? y.geometry.coordinates[0] : y.geometry.coordinates).map(([P, w]) => M(P, w)), C = M(f[0], f[1]), S = v.map((P) => ({ x: C.x + (P.x - C.x) * m, y: C.y + (P.y - C.y) * m })).map(({ x: P, y: w }) => [L(P, w).lng, L(P, w).lat]);
1547
1547
  y.geometry.type === "Polygon" ? y.geometry.coordinates[0] = S : y.geometry.coordinates = S;
1548
- })(n, h, [g, p]);
1548
+ })(n, c, [g, p]);
1549
1549
  } else this.config.projection === "globe" && function(g, p, y, m = "xy") {
1550
1550
  p === 1 || (g.geometry.type === "Polygon" ? g.geometry.coordinates[0] : g.geometry.coordinates).forEach((f) => {
1551
- const v = ce(y, f), C = pt(y, f), S = Dt(y, v * p, C);
1551
+ const v = ye(y, f), C = pt(y, f), S = _t(y, v * p, C);
1552
1552
  m !== "x" && m !== "xy" || (f[0] = S[0]), m !== "y" && m !== "xy" || (f[1] = S[1]);
1553
1553
  });
1554
- }(n, h, yt(n));
1555
- const c = o.type === "Polygon" ? o.coordinates[0] : o.coordinates;
1556
- c.forEach((g) => {
1554
+ }(n, c, yt(n));
1555
+ const h = o.type === "Polygon" ? o.coordinates[0] : o.coordinates;
1556
+ h.forEach((g) => {
1557
1557
  g[0] = E(g[0], this.coordinatePrecision), g[1] = E(g[1], this.coordinatePrecision);
1558
1558
  });
1559
- const d = this.midPoints.getUpdated(c) || [], u = this.selectionPoints.getUpdated(c) || [];
1560
- if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: w.Provisional })) return !1;
1559
+ const d = this.midPoints.getUpdated(h) || [], u = this.selectionPoints.getUpdated(h) || [];
1560
+ if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional })) return !1;
1561
1561
  this.store.updateGeometry([{ id: e, geometry: o }, ...u, ...d]), this.lastDistance = a;
1562
1562
  }
1563
1563
  }
1564
- class Re extends O {
1564
+ class ze extends O {
1565
1565
  constructor(t, e, i, o) {
1566
1566
  super(t), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = 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 = t, this.pixelDistance = e, this.selectionPoints = i, this.midPoints = o;
1567
1567
  }
@@ -1622,41 +1622,41 @@ class Re extends O {
1622
1622
  if (!e) return null;
1623
1623
  const { feature: i, boundingBox: o, updatedCoords: r, selectedCoordinate: n } = e, a = ft(i);
1624
1624
  if (!a) return null;
1625
- const l = M(n[0], n[1]), { closestBBoxIndex: h } = this.getIndexesWebMercator(o, l), c = M(t.lng, t.lat);
1626
- return this.scaleWebMercator({ closestBBoxIndex: h, updatedCoords: r, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), r;
1625
+ const l = M(n[0], n[1]), { closestBBoxIndex: c } = this.getIndexesWebMercator(o, l), h = M(t.lng, t.lat);
1626
+ return this.scaleWebMercator({ closestBBoxIndex: c, updatedCoords: r, webMercatorCursor: h, webMercatorSelected: l, webMercatorOrigin: a }), r;
1627
1627
  }
1628
1628
  centerFixedWebMercatorDrag(t) {
1629
1629
  const e = this.getSelectedFeatureDataWebMercator();
1630
1630
  if (!e) return null;
1631
1631
  const { feature: i, boundingBox: o, updatedCoords: r, selectedCoordinate: n } = e, a = ft(i);
1632
1632
  if (!a) return null;
1633
- const l = M(n[0], n[1]), { closestBBoxIndex: h } = this.getIndexesWebMercator(o, l), c = M(t.lng, t.lat);
1634
- return this.scaleFixedWebMercator({ closestBBoxIndex: h, updatedCoords: r, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), r;
1633
+ const l = M(n[0], n[1]), { closestBBoxIndex: c } = this.getIndexesWebMercator(o, l), h = M(t.lng, t.lat);
1634
+ return this.scaleFixedWebMercator({ closestBBoxIndex: c, updatedCoords: r, webMercatorCursor: h, webMercatorSelected: l, webMercatorOrigin: a }), r;
1635
1635
  }
1636
1636
  scaleFixedWebMercator({ closestBBoxIndex: t, webMercatorOrigin: e, webMercatorSelected: i, webMercatorCursor: o, updatedCoords: r }) {
1637
1637
  if (!this.isValidDragWebMercator(t, e.x - o.x, e.y - o.y)) return null;
1638
- let n = _(e, o) / _(e, i);
1638
+ let n = F(e, o) / F(e, i);
1639
1639
  return n < 0 && (n = this.minimumScale), this.performWebMercatorScale(r, e.x, e.y, n, n), r;
1640
1640
  }
1641
1641
  oppositeFixedWebMercatorDrag(t) {
1642
1642
  const e = this.getSelectedFeatureDataWebMercator();
1643
1643
  if (!e) return null;
1644
- const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = e, n = M(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), h = { x: i[a][0], y: i[a][1] }, c = M(t.lng, t.lat);
1645
- return this.scaleFixedWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: c, webMercatorSelected: n, webMercatorOrigin: h }), o;
1644
+ const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = e, n = M(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), c = { x: i[a][0], y: i[a][1] }, h = M(t.lng, t.lat);
1645
+ return this.scaleFixedWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: h, webMercatorSelected: n, webMercatorOrigin: c }), o;
1646
1646
  }
1647
1647
  oppositeWebMercatorDrag(t) {
1648
1648
  const e = this.getSelectedFeatureDataWebMercator();
1649
1649
  if (!e) return null;
1650
- const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = e, n = M(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), h = { x: i[a][0], y: i[a][1] }, c = M(t.lng, t.lat);
1651
- return this.scaleWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: c, webMercatorSelected: n, webMercatorOrigin: h }), o;
1650
+ const { boundingBox: i, updatedCoords: o, selectedCoordinate: r } = e, n = M(r[0], r[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), c = { x: i[a][0], y: i[a][1] }, h = M(t.lng, t.lat);
1651
+ return this.scaleWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: h, webMercatorSelected: n, webMercatorOrigin: c }), o;
1652
1652
  }
1653
1653
  scaleWebMercator({ closestBBoxIndex: t, webMercatorOrigin: e, webMercatorSelected: i, webMercatorCursor: o, updatedCoords: r }) {
1654
1654
  const n = e.x - o.x, a = e.y - o.y;
1655
1655
  if (!this.isValidDragWebMercator(t, n, a)) return null;
1656
1656
  let l = 1;
1657
1657
  n !== 0 && t !== 1 && t !== 5 && (l = 1 - (e.x - i.x - n) / n);
1658
- let h = 1;
1659
- return a !== 0 && t !== 3 && t !== 7 && (h = 1 - (e.y - i.y - a) / a), this.validateScale(l, h) ? (l < 0 && (l = this.minimumScale), h < 0 && (h = this.minimumScale), this.performWebMercatorScale(r, e.x, e.y, l, h), r) : null;
1658
+ let c = 1;
1659
+ return a !== 0 && t !== 3 && t !== 7 && (c = 1 - (e.y - i.y - a) / a), this.validateScale(l, c) ? (l < 0 && (l = this.minimumScale), c < 0 && (c = this.minimumScale), this.performWebMercatorScale(r, e.x, e.y, l, c), r) : null;
1660
1660
  }
1661
1661
  getFeature(t) {
1662
1662
  if (this.draggedCoordinate.id === null) return null;
@@ -1672,15 +1672,15 @@ class Re extends O {
1672
1672
  }
1673
1673
  performWebMercatorScale(t, e, i, o, r) {
1674
1674
  t.forEach((n) => {
1675
- const { x: a, y: l } = M(n[0], n[1]), h = e + (a - e) * o, c = i + (l - i) * r, { lng: d, lat: u } = k(h, c);
1675
+ const { x: a, y: l } = M(n[0], n[1]), c = e + (a - e) * o, h = i + (l - i) * r, { lng: d, lat: u } = L(c, h);
1676
1676
  n[0] = d, n[1] = u;
1677
1677
  });
1678
1678
  }
1679
1679
  getBBoxWebMercator(t) {
1680
1680
  const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
1681
1681
  (t = t.map((a) => {
1682
- const { x: l, y: h } = M(a[0], a[1]);
1683
- return [l, h];
1682
+ const { x: l, y: c } = M(a[0], a[1]);
1683
+ return [l, c];
1684
1684
  })).forEach(([a, l]) => {
1685
1685
  a < e[0] && (e[0] = a), l < e[1] && (e[1] = l), a > e[2] && (e[2] = a), l > e[3] && (e[3] = l);
1686
1686
  });
@@ -1690,7 +1690,7 @@ class Re extends O {
1690
1690
  getIndexesWebMercator(t, e) {
1691
1691
  let i, o = 1 / 0;
1692
1692
  for (let r = 0; r < t.length; r++) {
1693
- const n = _({ x: e.x, y: e.y }, { x: t[r][0], y: t[r][1] });
1693
+ const n = F({ x: e.x, y: e.y }, { x: t[r][0], y: t[r][1] });
1694
1694
  n < o && (i = r, o = n);
1695
1695
  }
1696
1696
  if (i === void 0) throw new Error("No closest coordinate found");
@@ -1715,15 +1715,15 @@ class Re extends O {
1715
1715
  if (!o) return !1;
1716
1716
  let r = null;
1717
1717
  if (e === "center" ? r = this.centerWebMercatorDrag(t) : e === "opposite" ? r = this.oppositeWebMercatorDrag(t) : e === "center-fixed" ? r = this.centerFixedWebMercatorDrag(t) : e === "opposite-fixed" && (r = this.oppositeFixedWebMercatorDrag(t)), !r) return !1;
1718
- for (let h = 0; h < r.length; h++) {
1719
- const c = r[h];
1720
- if (c[0] = E(c[0], this.coordinatePrecision), c[1] = E(c[1], this.coordinatePrecision), !mt(c, this.coordinatePrecision)) return !1;
1718
+ for (let c = 0; c < r.length; c++) {
1719
+ const h = r[c];
1720
+ if (h[0] = E(h[0], this.coordinatePrecision), h[1] = E(h[1], this.coordinatePrecision), !mt(h, this.coordinatePrecision)) return !1;
1721
1721
  }
1722
1722
  const n = this.midPoints.getUpdated(r) || [], a = this.selectionPoints.getUpdated(r) || [], l = { type: o.geometry.type, coordinates: o.geometry.type === "Polygon" ? [r] : r };
1723
- return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: l, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: w.Provisional }) || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: l }, ...a, ...n]), 0));
1723
+ return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: l, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }) || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: l }, ...a, ...n]), 0));
1724
1724
  }
1725
1725
  }
1726
- class Te extends Me {
1726
+ class Ye extends ke {
1727
1727
  constructor(t) {
1728
1728
  var e;
1729
1729
  super(t), this.mode = "select", this.allowManualDeselection = !0, this.dragEventThrottle = 5, this.dragEventCount = 0, this.selected = [], this.flags = void 0, this.keyEvents = void 0, this.selectionPoints = void 0, this.midPoints = 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.cursors = void 0, this.validations = {}, this.flags = t && t.flags ? t.flags : {};
@@ -1746,13 +1746,13 @@ class Te extends Me {
1746
1746
  this._state = "selecting";
1747
1747
  }
1748
1748
  registerBehaviors(t) {
1749
- this.pixelDistance = new _t(t), this.clickBoundingBox = new It(t), this.featuresAtMouseEvent = new Ne(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Be(t), this.midPoints = new je(t, this.selectionPoints), this.rotateFeature = new Ve(t, this.selectionPoints, this.midPoints), this.scaleFeature = new Ue(t, this.selectionPoints, this.midPoints), this.dragFeature = new Ge(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints), this.dragCoordinate = new Ae(t, this.pixelDistance, this.selectionPoints, this.midPoints), this.dragCoordinateResizeFeature = new Re(t, this.pixelDistance, this.selectionPoints, this.midPoints);
1749
+ this.pixelDistance = new Ft(t), this.clickBoundingBox = new It(t), this.featuresAtMouseEvent = new Ue(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Ve(t), this.midPoints = new Ae(t, this.selectionPoints), this.rotateFeature = new Xe(t, this.selectionPoints, this.midPoints), this.scaleFeature = new Ke(t, this.selectionPoints, this.midPoints), this.dragFeature = new Re(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints), this.dragCoordinate = new Te(t, this.pixelDistance, this.selectionPoints, this.midPoints), this.dragCoordinateResizeFeature = new ze(t, this.pixelDistance, this.selectionPoints, this.midPoints);
1750
1750
  }
1751
1751
  deselectFeature() {
1752
1752
  this.deselect();
1753
1753
  }
1754
1754
  deselect() {
1755
- const t = this.selected.filter((e) => this.store.has(e)).map((e) => ({ id: e, property: wt, value: !1 }));
1755
+ const t = this.selected.filter((e) => this.store.has(e)).map((e) => ({ id: e, property: bt, value: !1 }));
1756
1756
  this.store.updateProperty(t), this.onDeselect(this.selected[0]), this.selected = [], this.selectionPoints.delete(), this.midPoints.delete();
1757
1757
  }
1758
1758
  deleteSelected() {
@@ -1767,14 +1767,14 @@ class Te extends Me {
1767
1767
  }), !e) return;
1768
1768
  const o = e.selectionPointFeatureId, r = e.index, n = this.store.getPropertiesCopy(o), a = this.flags[n.mode], l = this.validations[n.mode];
1769
1769
  if (!(a && a.feature && a.feature.coordinates && a.feature.coordinates.deletable)) return;
1770
- const h = this.store.getGeometryCopy(o);
1771
- let c;
1772
- if (h.type === "Polygon") {
1773
- if (c = h.coordinates[0], c.length <= 4) return;
1774
- } else if (h.type === "LineString" && (c = h.coordinates, c.length <= 3)) return;
1775
- if (c) {
1776
- if (h.type === "Polygon" && r === 0 || r === c.length - 1 ? (c.shift(), c.pop(), c.push([c[0][0], c[0][1]])) : c.splice(r, 1), l && !l({ id: o, type: "Feature", geometry: h, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: w.Commit })) return;
1777
- this.store.delete([...this.midPoints.ids, ...this.selectionPoints.ids]), this.store.updateGeometry([{ id: o, geometry: h }]), this.selectionPoints.create(c, h.type, o), a && a.feature && a.feature.coordinates && a.feature.coordinates.midpoints && this.midPoints.create(c, o, this.coordinatePrecision);
1770
+ const c = this.store.getGeometryCopy(o);
1771
+ let h;
1772
+ if (c.type === "Polygon") {
1773
+ if (h = c.coordinates[0], h.length <= 4) return;
1774
+ } else if (c.type === "LineString" && (h = c.coordinates, h.length <= 3)) return;
1775
+ if (h) {
1776
+ if (c.type === "Polygon" && r === 0 || r === h.length - 1 ? (h.shift(), h.pop(), h.push([h[0][0], h[0][1]])) : h.splice(r, 1), l && !l({ id: o, type: "Feature", geometry: c, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Commit })) return;
1777
+ this.store.delete([...this.midPoints.ids, ...this.selectionPoints.ids]), this.store.updateGeometry([{ id: o, geometry: c }]), this.selectionPoints.create(h, c.type, o), a && a.feature && a.feature.coordinates && a.feature.coordinates.midpoints && this.midPoints.create(h, o, this.coordinatePrecision);
1778
1778
  }
1779
1779
  }
1780
1780
  select(t, e = !0) {
@@ -1876,7 +1876,7 @@ class Te extends Me {
1876
1876
  if (t.properties.mode === this.mode && t.geometry.type === "Point") {
1877
1877
  if (t.properties.selectionPoint) return e.pointColor = this.getHexColorStylingValue(this.styles.selectionPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectionPointOutlineColor, e.pointOutlineColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.selectionPointWidth, e.pointWidth, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectionPointOutlineWidth, 2, t), e.zIndex = 30, e;
1878
1878
  if (t.properties.midPoint) return e.pointColor = this.getHexColorStylingValue(this.styles.midPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.midPointOutlineColor, e.pointOutlineColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.midPointWidth, 4, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.midPointOutlineWidth, 2, t), e.zIndex = 40, e;
1879
- } else if (t.properties[wt]) {
1879
+ } else if (t.properties[bt]) {
1880
1880
  if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.selectedPolygonColor, e.polygonFillColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.selectedPolygonOutlineWidth, e.polygonOutlineWidth, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.selectedPolygonOutlineColor, e.polygonOutlineColor, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.selectedPolygonFillOpacity, e.polygonFillOpacity, t), e.zIndex = 10, e;
1881
1881
  if (t.geometry.type === "LineString") return e.lineStringColor = this.getHexColorStylingValue(this.styles.selectedLineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.selectedLineStringWidth, e.lineStringWidth, t), e.zIndex = 10, e;
1882
1882
  if (t.geometry.type === "Point") return e.pointWidth = this.getNumericStylingValue(this.styles.selectedPointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.selectedPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectedPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectedPointOutlineWidth, e.pointOutlineWidth, t), e.zIndex = 10, e;
@@ -1884,7 +1884,7 @@ class Te extends Me {
1884
1884
  return e;
1885
1885
  }
1886
1886
  }
1887
- class Xe extends L {
1887
+ class He extends W {
1888
1888
  constructor(...t) {
1889
1889
  super(...t), this.type = U.Static, this.mode = "static";
1890
1890
  }
@@ -1912,11 +1912,11 @@ class Xe extends L {
1912
1912
  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 });
1913
1913
  }
1914
1914
  }
1915
- function de(s, t, e, i, o) {
1915
+ function fe(s, t, e, i, o) {
1916
1916
  for (; i > e; ) {
1917
1917
  if (i - e > 600) {
1918
- const l = i - e + 1, h = t - e + 1, c = Math.log(l), d = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * d * (l - d) / l) * (h - l / 2 < 0 ? -1 : 1);
1919
- de(s, t, Math.max(e, Math.floor(t - h * d / l + u)), Math.min(i, Math.floor(t + (l - h) * d / l + u)), o);
1918
+ const l = i - e + 1, c = t - e + 1, h = Math.log(l), d = 0.5 * Math.exp(2 * h / 3), u = 0.5 * Math.sqrt(h * d * (l - d) / l) * (c - l / 2 < 0 ? -1 : 1);
1919
+ fe(s, t, Math.max(e, Math.floor(t - c * d / l + u)), Math.min(i, Math.floor(t + (l - c) * d / l + u)), o);
1920
1920
  }
1921
1921
  const r = s[t];
1922
1922
  let n = e, a = i;
@@ -1945,10 +1945,10 @@ function Q(s, t, e, i, o) {
1945
1945
  function tt(s, t) {
1946
1946
  return s.minX = Math.min(s.minX, t.minX), s.minY = Math.min(s.minY, t.minY), s.maxX = Math.max(s.maxX, t.maxX), s.maxY = Math.max(s.maxY, t.maxY), s;
1947
1947
  }
1948
- function Ke(s, t) {
1948
+ function Je(s, t) {
1949
1949
  return s.minX - t.minX;
1950
1950
  }
1951
- function ze(s, t) {
1951
+ function $e(s, t) {
1952
1952
  return s.minY - t.minY;
1953
1953
  }
1954
1954
  function xt(s) {
@@ -1957,14 +1957,14 @@ function xt(s) {
1957
1957
  function lt(s) {
1958
1958
  return s.maxX - s.minX + (s.maxY - s.minY);
1959
1959
  }
1960
- function Ye(s, t) {
1960
+ function qe(s, t) {
1961
1961
  const e = Math.max(s.minX, t.minX), i = Math.max(s.minY, t.minY), o = Math.min(s.maxX, t.maxX), r = Math.min(s.maxY, t.maxY);
1962
1962
  return Math.max(0, o - e) * Math.max(0, r - i);
1963
1963
  }
1964
1964
  function St(s, t) {
1965
1965
  return s.minX <= t.minX && s.minY <= t.minY && t.maxX <= s.maxX && t.maxY <= s.maxY;
1966
1966
  }
1967
- function ht(s, t) {
1967
+ function ct(s, t) {
1968
1968
  return t.minX <= s.maxX && t.minY <= s.maxY && t.maxX >= s.minX && t.maxY >= s.minY;
1969
1969
  }
1970
1970
  function H(s) {
@@ -1975,22 +1975,22 @@ function Yt(s, t, e, i, o) {
1975
1975
  for (; r.length; ) {
1976
1976
  if ((e = r.pop()) - (t = r.pop()) <= i) continue;
1977
1977
  const n = t + Math.ceil((e - t) / i / 2) * i;
1978
- de(s, n, t, e, o), r.push(t, n, n, e);
1978
+ fe(s, n, t, e, o), r.push(t, n, n, e);
1979
1979
  }
1980
1980
  }
1981
- class He {
1981
+ class Ze {
1982
1982
  constructor(t) {
1983
1983
  this._maxEntries = void 0, this._minEntries = void 0, this.data = void 0, this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
1984
1984
  }
1985
1985
  search(t) {
1986
1986
  let e = this.data;
1987
1987
  const i = [];
1988
- if (!ht(t, e)) return i;
1988
+ if (!ct(t, e)) return i;
1989
1989
  const o = this.toBBox, r = [];
1990
1990
  for (; e; ) {
1991
1991
  for (let n = 0; n < e.children.length; n++) {
1992
1992
  const a = e.children[n], l = e.leaf ? o(a) : a;
1993
- ht(t, l) && (e.leaf ? i.push(a) : St(t, l) ? this._all(a, i) : r.push(a));
1993
+ ct(t, l) && (e.leaf ? i.push(a) : St(t, l) ? this._all(a, i) : r.push(a));
1994
1994
  }
1995
1995
  e = r.pop();
1996
1996
  }
@@ -1998,12 +1998,12 @@ class He {
1998
1998
  }
1999
1999
  collides(t) {
2000
2000
  let e = this.data;
2001
- if (ht(t, e)) {
2001
+ if (ct(t, e)) {
2002
2002
  const i = [];
2003
2003
  for (; e; ) {
2004
2004
  for (let o = 0; o < e.children.length; o++) {
2005
2005
  const r = e.children[o], n = e.leaf ? this.toBBox(r) : r;
2006
- if (ht(t, n)) {
2006
+ if (ct(t, n)) {
2007
2007
  if (e.leaf || St(t, n)) return !0;
2008
2008
  i.push(r);
2009
2009
  }
@@ -2041,8 +2041,8 @@ class He {
2041
2041
  let n, a, l = !1;
2042
2042
  for (; e || o.length; ) {
2043
2043
  if (e || (e = o.pop(), a = o[o.length - 1], n = r.pop(), l = !0), e.leaf) {
2044
- const h = e.children.indexOf(t);
2045
- h !== -1 && (e.children.splice(h, 1), o.push(e), this._condense(o));
2044
+ const c = e.children.indexOf(t);
2045
+ c !== -1 && (e.children.splice(c, 1), o.push(e), this._condense(o));
2046
2046
  }
2047
2047
  l || e.leaf || !St(e, i) ? a ? (n++, e = a.children[n], l = !1) : e = null : (o.push(e), r.push(n), n = 0, a = e, e = e.children[0]);
2048
2048
  }
@@ -2066,12 +2066,12 @@ class He {
2066
2066
  let n, a = this._maxEntries;
2067
2067
  if (r <= a) return n = H(t.slice(e, i + 1)), Y(n, this.toBBox), n;
2068
2068
  o || (o = Math.ceil(Math.log(r) / Math.log(a)), a = Math.ceil(r / Math.pow(a, o - 1))), n = H([]), n.leaf = !1, n.height = o;
2069
- const l = Math.ceil(r / a), h = l * Math.ceil(Math.sqrt(a));
2070
- Yt(t, e, i, h, this.compareMinX);
2071
- for (let c = e; c <= i; c += h) {
2072
- const d = Math.min(c + h - 1, i);
2073
- Yt(t, c, d, l, this.compareMinY);
2074
- for (let u = c; u <= d; u += l) {
2069
+ const l = Math.ceil(r / a), c = l * Math.ceil(Math.sqrt(a));
2070
+ Yt(t, e, i, c, this.compareMinX);
2071
+ for (let h = e; h <= i; h += c) {
2072
+ const d = Math.min(h + c - 1, i);
2073
+ Yt(t, h, d, l, this.compareMinY);
2074
+ for (let u = h; u <= d; u += l) {
2075
2075
  const g = Math.min(u + l - 1, d);
2076
2076
  n.children.push(this._build(t, u, g, o - 1));
2077
2077
  }
@@ -2080,10 +2080,10 @@ class He {
2080
2080
  }
2081
2081
  _chooseSubtree(t, e, i, o) {
2082
2082
  for (; o.push(e), !e.leaf && o.length - 1 !== i; ) {
2083
- let a, l = 1 / 0, h = 1 / 0;
2084
- for (let c = 0; c < e.children.length; c++) {
2085
- const d = e.children[c], u = xt(d), g = (r = t, n = d, (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);
2086
- g < h ? (h = g, l = u < l ? u : l, a = d) : g === h && u < l && (l = u, a = d);
2083
+ let a, l = 1 / 0, c = 1 / 0;
2084
+ for (let h = 0; h < e.children.length; h++) {
2085
+ const d = e.children[h], u = xt(d), g = (r = t, n = d, (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);
2086
+ g < c ? (c = g, l = u < l ? u : l, a = d) : g === c && u < l && (l = u, a = d);
2087
2087
  }
2088
2088
  e = a || e.children[0];
2089
2089
  }
@@ -2107,26 +2107,26 @@ class He {
2107
2107
  _chooseSplitIndex(t, e, i) {
2108
2108
  let o, r = 1 / 0, n = 1 / 0;
2109
2109
  for (let a = e; a <= i - e; a++) {
2110
- const l = Q(t, 0, a, this.toBBox), h = Q(t, a, i, this.toBBox), c = Ye(l, h), d = xt(l) + xt(h);
2111
- c < r ? (r = c, o = a, n = d < n ? d : n) : c === r && d < n && (n = d, o = a);
2110
+ const l = Q(t, 0, a, this.toBBox), c = Q(t, a, i, this.toBBox), h = qe(l, c), d = xt(l) + xt(c);
2111
+ h < r ? (r = h, o = a, n = d < n ? d : n) : h === r && d < n && (n = d, o = a);
2112
2112
  }
2113
2113
  return o || i - e;
2114
2114
  }
2115
2115
  _chooseSplitAxis(t, e, i) {
2116
- const o = t.leaf ? this.compareMinX : Ke, r = t.leaf ? this.compareMinY : ze;
2116
+ const o = t.leaf ? this.compareMinX : Je, r = t.leaf ? this.compareMinY : $e;
2117
2117
  this._allDistMargin(t, e, i, o) < this._allDistMargin(t, e, i, r) && t.children.sort(o);
2118
2118
  }
2119
2119
  _allDistMargin(t, e, i, o) {
2120
2120
  t.children.sort(o);
2121
2121
  const r = this.toBBox, n = Q(t, 0, e, r), a = Q(t, i - e, i, r);
2122
2122
  let l = lt(n) + lt(a);
2123
- for (let h = e; h < i - e; h++) {
2124
- const c = t.children[h];
2125
- tt(n, t.leaf ? r(c) : c), l += lt(n);
2123
+ for (let c = e; c < i - e; c++) {
2124
+ const h = t.children[c];
2125
+ tt(n, t.leaf ? r(h) : h), l += lt(n);
2126
2126
  }
2127
- for (let h = i - e - 1; h >= e; h--) {
2128
- const c = t.children[h];
2129
- tt(a, t.leaf ? r(c) : c), l += lt(a);
2127
+ for (let c = i - e - 1; c >= e; c--) {
2128
+ const h = t.children[c];
2129
+ tt(a, t.leaf ? r(h) : h), l += lt(a);
2130
2130
  }
2131
2131
  return l;
2132
2132
  }
@@ -2137,9 +2137,9 @@ class He {
2137
2137
  for (let e, i = t.length - 1; i >= 0; i--) t[i].children.length === 0 ? i > 0 ? (e = t[i - 1].children, e.splice(e.indexOf(t[i]), 1)) : this.clear() : Y(t[i], this.toBBox);
2138
2138
  }
2139
2139
  }
2140
- class Je {
2140
+ class Qe {
2141
2141
  constructor(t) {
2142
- this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new He(t && t.maxEntries ? t.maxEntries : 9), this.idToNode = /* @__PURE__ */ new Map(), this.nodeToId = /* @__PURE__ */ new Map();
2142
+ this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new Ze(t && t.maxEntries ? t.maxEntries : 9), this.idToNode = /* @__PURE__ */ new Map(), this.nodeToId = /* @__PURE__ */ new Map();
2143
2143
  }
2144
2144
  setMaps(t, e) {
2145
2145
  this.idToNode.set(t.id, e), this.nodeToId.set(e, t.id);
@@ -2190,14 +2190,14 @@ class Je {
2190
2190
  return this.tree.collides(this.toBBox(t));
2191
2191
  }
2192
2192
  }
2193
- const $e = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) {
2193
+ const ti = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) {
2194
2194
  const t = 16 * Math.random() | 0;
2195
2195
  return (s == "x" ? t : 3 & t | 8).toString(16);
2196
2196
  }), isValidId: (s) => typeof s == "string" && s.length === 36 };
2197
- class qe {
2197
+ class ei {
2198
2198
  constructor(t) {
2199
2199
  this.idStrategy = void 0, this.tracked = void 0, this.spatialIndex = void 0, this.store = void 0, this._onChange = () => {
2200
- }, this.store = {}, this.spatialIndex = new Je(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : $e;
2200
+ }, this.store = {}, this.spatialIndex = new Qe(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : ti;
2201
2201
  }
2202
2202
  clone(t) {
2203
2203
  return JSON.parse(JSON.stringify(t));
@@ -2283,13 +2283,13 @@ class qe {
2283
2283
  return Object.keys(this.store).length;
2284
2284
  }
2285
2285
  }
2286
- const Ze = (s) => (s.geometry.type === "Polygon" || s.geometry.type === "LineString") && !Et(s);
2286
+ const me = (s) => (s.geometry.type === "Polygon" || s.geometry.type === "LineString") && !Et(s);
2287
2287
  function Ht(s, t, e) {
2288
2288
  const i = j(s, t);
2289
2289
  let o = j(t, e) - i;
2290
2290
  return o < 0 && (o += 360), 180 - Math.abs(o - 90 - 90);
2291
2291
  }
2292
- class Qe extends L {
2292
+ class Ce extends W {
2293
2293
  constructor(t) {
2294
2294
  super(t), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = void 0, this.cursors = void 0, this.mouseMove = !1;
2295
2295
  const e = { start: "crosshair", close: "pointer" };
@@ -2318,13 +2318,13 @@ class Qe extends L {
2318
2318
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), r = Math.max(1e-6, o);
2319
2319
  i = [e[0], [t.lng, t.lat], [t.lng, t.lat - r], e[0]];
2320
2320
  } else if (this.currentCoordinate === 2) {
2321
- const o = e[0], r = e[1], n = ae(o, r, this.coordinatePrecision, this.project, this.unproject), a = M(o[0], o[1]), l = M(n[0], n[1]), h = M(r[0], r[1]), c = M(t.lng, t.lat), d = _(c, a) < _(c, h), u = Ht(a, l, c), g = d ? 90 - u : Ht(a, l, c) - 90, p = _(l, c), y = Math.cos(D(g)) * p, m = j(a, h) + (function(P, b, I) {
2322
- const B = (I.x - b.x) * (P.y - b.y) - (I.y - b.y) * (P.x - b.x);
2321
+ const o = e[0], r = e[1], n = ue(o, r, this.coordinatePrecision, this.project, this.unproject), a = M(o[0], o[1]), l = M(n[0], n[1]), c = M(r[0], r[1]), h = M(t.lng, t.lat), d = F(h, a) < F(h, c), u = Ht(a, l, h), g = d ? 90 - u : Ht(a, l, h) - 90, p = F(l, h), y = Math.cos(_(g)) * p, m = j(a, c) + (function(P, w, I) {
2322
+ const B = (I.x - w.x) * (P.y - w.y) - (I.y - w.y) * (P.x - w.x);
2323
2323
  return B > 1e-10 ? "left" : B < -1e-10 ? "right" : "left";
2324
- }(a, h, c) === "right" ? -90 : 90), f = ot(a, y, m), v = ot(h, y, m), C = k(f.x, f.y), S = k(v.x, v.y);
2324
+ }(a, c, h) === "right" ? -90 : 90), f = ot(a, y, m), v = ot(c, y, m), C = L(f.x, f.y), S = L(v.x, v.y);
2325
2325
  i = [e[0], e[1], [S.lng, S.lat], [C.lng, C.lat], e[0]];
2326
2326
  }
2327
- i && this.updatePolygonGeometry(this.currentId, i, w.Provisional);
2327
+ i && this.updatePolygonGeometry(this.currentId, i, b.Provisional);
2328
2328
  }
2329
2329
  updatePolygonGeometry(t, e, i) {
2330
2330
  const o = { type: "Polygon", coordinates: [e] };
@@ -2336,7 +2336,7 @@ class Qe extends L {
2336
2336
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2337
2337
  } else if (this.currentCoordinate === 1 && this.currentId) {
2338
2338
  const e = this.store.getGeometryCopy(this.currentId);
2339
- if ($([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], w.Commit)) return;
2339
+ if ($([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], b.Commit)) return;
2340
2340
  this.currentCoordinate++;
2341
2341
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2342
2342
  }
@@ -2366,10 +2366,10 @@ class Qe extends L {
2366
2366
  return !!super.validateFeature(t) && t.properties.mode === this.mode && R(t, this.coordinatePrecision);
2367
2367
  }
2368
2368
  }
2369
- function ue(s, t, e) {
2369
+ function ve(s, t, e) {
2370
2370
  return (t.x - s.x) * (e.y - s.y) - (t.y - s.y) * (e.x - s.x) <= 0;
2371
2371
  }
2372
- class ti extends L {
2372
+ class Pe extends W {
2373
2373
  constructor(t) {
2374
2374
  super(t), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = void 0, this.direction = void 0, this.arcPoints = void 0, this.cursors = void 0, this.mouseMove = !1;
2375
2375
  const e = { start: "crosshair", close: "pointer" };
@@ -2399,23 +2399,23 @@ class ti extends L {
2399
2399
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), r = Math.max(1e-6, o);
2400
2400
  i = [e[0], [t.lng, t.lat], [t.lng, t.lat - r], e[0]];
2401
2401
  } else if (this.currentCoordinate === 2) {
2402
- const o = e[0], r = e[1], n = [t.lng, t.lat], a = M(o[0], o[1]), l = M(r[0], r[1]), h = M(n[0], n[1]);
2402
+ const o = e[0], r = e[1], n = [t.lng, t.lat], a = M(o[0], o[1]), l = M(r[0], r[1]), c = M(n[0], n[1]);
2403
2403
  if (this.direction === void 0) {
2404
- const C = ue(a, l, h);
2404
+ const C = ve(a, l, c);
2405
2405
  this.direction = C ? "clockwise" : "anticlockwise";
2406
2406
  }
2407
- const c = _(a, l), d = j(a, l), u = j(a, h), g = this.arcPoints, p = [o], y = V(d), m = V(u);
2407
+ const h = F(a, l), d = j(a, l), u = j(a, c), g = this.arcPoints, p = [o], y = V(d), m = V(u);
2408
2408
  let f;
2409
2409
  this.direction === "anticlockwise" ? (f = m - y, f < 0 && (f += 360)) : (f = y - m, f < 0 && (f += 360));
2410
2410
  const v = (this.direction === "anticlockwise" ? 1 : -1) * f / g;
2411
2411
  p.push(r);
2412
2412
  for (let C = 0; C <= g; C++) {
2413
- const S = ot(a, c, y + C * v), { lng: P, lat: b } = k(S.x, S.y), I = [E(P, this.coordinatePrecision), E(b, this.coordinatePrecision)];
2413
+ const S = ot(a, h, y + C * v), { lng: P, lat: w } = L(S.x, S.y), I = [E(P, this.coordinatePrecision), E(w, this.coordinatePrecision)];
2414
2414
  I[0] !== p[p.length - 1][0] && I[1] !== p[p.length - 1][1] && p.push(I);
2415
2415
  }
2416
2416
  p.push(o), i = [...p];
2417
2417
  }
2418
- i && this.updatePolygonGeometry(this.currentId, i, w.Provisional);
2418
+ i && this.updatePolygonGeometry(this.currentId, i, b.Provisional);
2419
2419
  }
2420
2420
  updatePolygonGeometry(t, e, i) {
2421
2421
  const o = { type: "Polygon", coordinates: [e] };
@@ -2427,7 +2427,7 @@ class ti extends L {
2427
2427
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2428
2428
  } else if (this.currentCoordinate === 1 && this.currentId) {
2429
2429
  const e = this.store.getGeometryCopy(this.currentId);
2430
- if ($([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], w.Commit)) return;
2430
+ if ($([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], b.Commit)) return;
2431
2431
  this.currentCoordinate++;
2432
2432
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2433
2433
  }
@@ -2457,7 +2457,7 @@ class ti extends L {
2457
2457
  return !!super.validateFeature(t) && t.properties.mode === this.mode && R(t, this.coordinatePrecision);
2458
2458
  }
2459
2459
  }
2460
- class ei extends L {
2460
+ class xe extends W {
2461
2461
  constructor(t) {
2462
2462
  super(t), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents = void 0, this.direction = void 0, this.arcPoints = void 0, this.cursors = void 0, this.mouseMove = !1;
2463
2463
  const e = { start: "crosshair", close: "pointer" };
@@ -2482,31 +2482,31 @@ class ei extends L {
2482
2482
  onMouseMove(t) {
2483
2483
  if (this.mouseMove = !0, this.setCursor(this.cursors.start), this.currentInitialArcId !== void 0 && this.currentStartingPointId !== void 0 && this.currentCoordinate !== 0) {
2484
2484
  if (this.currentCoordinate === 2) {
2485
- const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates, i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], r = [t.lng, t.lat], n = M(o[0], o[1]), a = M(r[0], r[1]), l = M(i[0], i[1]), h = _(l, n);
2485
+ const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates, i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], r = [t.lng, t.lat], n = M(o[0], o[1]), a = M(r[0], r[1]), l = M(i[0], i[1]), c = F(l, n);
2486
2486
  if (this.direction === void 0) {
2487
- const v = ue(l, n, a);
2487
+ const v = ve(l, n, a);
2488
2488
  this.direction = v ? "clockwise" : "anticlockwise";
2489
2489
  }
2490
- const c = j(l, n), d = j(l, a), u = this.arcPoints, g = [o], p = V(c), y = V(d);
2490
+ const h = j(l, n), d = j(l, a), u = this.arcPoints, g = [o], p = V(h), y = V(d);
2491
2491
  let m;
2492
2492
  this.direction === "anticlockwise" ? (m = y - p, m < 0 && (m += 360)) : (m = p - y, m < 0 && (m += 360));
2493
2493
  const f = (this.direction === "anticlockwise" ? 1 : -1) * m / u;
2494
2494
  for (let v = 0; v <= u; v++) {
2495
- const C = ot(l, h, p + v * f), { lng: S, lat: P } = k(C.x, C.y), b = [E(S, this.coordinatePrecision), E(P, this.coordinatePrecision)];
2496
- b[0] !== g[g.length - 1][0] && b[1] !== g[g.length - 1][1] && g.push(b);
2495
+ const C = ot(l, c, p + v * f), { lng: S, lat: P } = L(C.x, C.y), w = [E(S, this.coordinatePrecision), E(P, this.coordinatePrecision)];
2496
+ w[0] !== g[g.length - 1][0] && w[1] !== g[g.length - 1][1] && g.push(w);
2497
2497
  }
2498
- this.updateLineStringGeometry(this.currentInitialArcId, g, w.Provisional);
2498
+ this.updateLineStringGeometry(this.currentInitialArcId, g, b.Provisional);
2499
2499
  } else if (this.currentCoordinate === 3) {
2500
2500
  const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates;
2501
2501
  if (e.length < 2 || !this.direction) return;
2502
- const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], r = e[e.length - 1], n = M(t.lng, t.lat), a = M(o[0], o[1]), l = M(r[0], r[1]), h = M(i[0], i[1]), c = _(h, a), d = _(h, n) < c ? a : n, u = j(h, n), g = j(h, a), p = j(h, l), y = V(g), m = V(p), f = V(u);
2502
+ const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], r = e[e.length - 1], n = M(t.lng, t.lat), a = M(o[0], o[1]), l = M(r[0], r[1]), c = M(i[0], i[1]), h = F(c, a), d = F(c, n) < h ? a : n, u = j(c, n), g = j(c, a), p = j(c, l), y = V(g), m = V(p), f = V(u);
2503
2503
  if (this.notInSector({ normalizedCursor: f, normalizedStart: y, normalizedEnd: m, direction: this.direction })) return;
2504
- const v = this.getDeltaBearing(this.direction, y, m), C = this.arcPoints, S = (this.direction === "anticlockwise" ? 1 : -1) * v / C, P = _(h, d), b = [];
2504
+ const v = this.getDeltaBearing(this.direction, y, m), C = this.arcPoints, S = (this.direction === "anticlockwise" ? 1 : -1) * v / C, P = F(c, d), w = [];
2505
2505
  for (let I = 0; I <= C; I++) {
2506
- const B = ot(h, P, y + I * S), { lng: T, lat: X } = k(B.x, B.y), N = [E(T, this.coordinatePrecision), E(X, this.coordinatePrecision)];
2507
- N[0] !== e[e.length - 1][0] && N[1] !== e[e.length - 1][1] && b.unshift(N);
2506
+ const B = ot(c, P, y + I * S), { lng: T, lat: X } = L(B.x, B.y), N = [E(T, this.coordinatePrecision), E(X, this.coordinatePrecision)];
2507
+ N[0] !== e[e.length - 1][0] && N[1] !== e[e.length - 1][1] && w.unshift(N);
2508
2508
  }
2509
- e.push(...b), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, w.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode } }]);
2509
+ e.push(...w), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, b.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode } }]);
2510
2510
  }
2511
2511
  }
2512
2512
  }
@@ -2562,49 +2562,49 @@ class ei extends L {
2562
2562
  }
2563
2563
  class ii {
2564
2564
  constructor(t) {
2565
- 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 = t.adapter, this._mode = new Xe();
2566
- const e = /* @__PURE__ */ new Set(), i = t.modes.reduce((c, d) => {
2565
+ 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 = t.adapter, this._mode = new He();
2566
+ const e = /* @__PURE__ */ new Set(), i = t.modes.reduce((h, d) => {
2567
2567
  if (e.has(d.mode)) throw new Error(`There is already a ${d.mode} mode provided`);
2568
- return e.add(d.mode), c[d.mode] = d, c;
2568
+ return e.add(d.mode), h[d.mode] = d, h;
2569
2569
  }, {}), o = Object.keys(i);
2570
2570
  if (o.length === 0) throw new Error("No modes provided");
2571
- o.forEach((c) => {
2572
- if (i[c].type === U.Select) {
2571
+ o.forEach((h) => {
2572
+ if (i[h].type === U.Select) {
2573
2573
  if (this._instanceSelectMode) throw new Error("only one type of select mode can be provided");
2574
- this._instanceSelectMode = c;
2574
+ this._instanceSelectMode = h;
2575
2575
  }
2576
- }), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new qe({ tracked: !!t.tracked, idStrategy: t.idStrategy ? t.idStrategy : void 0 });
2577
- const r = (c) => {
2578
- const d = [], u = this._store.copyAll().filter((g) => !c.includes(g.id) || (d.push(g), !1));
2576
+ }), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new ei({ tracked: !!t.tracked, idStrategy: t.idStrategy ? t.idStrategy : void 0 });
2577
+ const r = (h) => {
2578
+ const d = [], u = this._store.copyAll().filter((g) => !h.includes(g.id) || (d.push(g), !1));
2579
2579
  return { changed: d, unchanged: u };
2580
- }, n = (c, d) => {
2580
+ }, n = (h, d) => {
2581
2581
  this._enabled && this._eventListeners.finish.forEach((u) => {
2582
- u(c, d);
2582
+ u(h, d);
2583
2583
  });
2584
- }, a = (c, d) => {
2584
+ }, a = (h, d) => {
2585
2585
  if (!this._enabled) return;
2586
2586
  this._eventListeners.change.forEach((p) => {
2587
- p(c, d);
2587
+ p(h, d);
2588
2588
  });
2589
- const { changed: u, unchanged: g } = r(c);
2590
- d === "create" ? this._adapter.render({ created: u, deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles()) : d === "update" ? this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: u }, this.getModeStyles()) : d === "delete" ? this._adapter.render({ created: [], deletedIds: c, unchanged: g, updated: [] }, this.getModeStyles()) : d === "styling" && this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles());
2591
- }, l = (c) => {
2589
+ const { changed: u, unchanged: g } = r(h);
2590
+ d === "create" ? this._adapter.render({ created: u, deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles()) : d === "update" ? this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: u }, this.getModeStyles()) : d === "delete" ? this._adapter.render({ created: [], deletedIds: h, unchanged: g, updated: [] }, this.getModeStyles()) : d === "styling" && this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles());
2591
+ }, l = (h) => {
2592
2592
  if (!this._enabled) return;
2593
2593
  this._eventListeners.select.forEach((g) => {
2594
- g(c);
2594
+ g(h);
2595
2595
  });
2596
- const { changed: d, unchanged: u } = r([c]);
2596
+ const { changed: d, unchanged: u } = r([h]);
2597
2597
  this._adapter.render({ created: [], deletedIds: [], unchanged: u, updated: d }, this.getModeStyles());
2598
- }, h = (c) => {
2598
+ }, c = (h) => {
2599
2599
  if (!this._enabled) return;
2600
2600
  this._eventListeners.deselect.forEach((g) => {
2601
2601
  g();
2602
2602
  });
2603
- const { changed: d, unchanged: u } = r([c]);
2603
+ const { changed: d, unchanged: u } = r([h]);
2604
2604
  d && this._adapter.render({ created: [], deletedIds: [], unchanged: u, updated: d }, this.getModeStyles());
2605
2605
  };
2606
- Object.keys(this._modes).forEach((c) => {
2607
- this._modes[c].register({ mode: c, store: this._store, setCursor: this._adapter.setCursor.bind(this._adapter), project: this._adapter.project.bind(this._adapter), unproject: this._adapter.unproject.bind(this._adapter), setDoubleClickToZoom: this._adapter.setDoubleClickToZoom.bind(this._adapter), onChange: a, onSelect: l, onDeselect: h, onFinish: n, coordinatePrecision: this._adapter.getCoordinatePrecision() });
2606
+ Object.keys(this._modes).forEach((h) => {
2607
+ this._modes[h].register({ mode: h, store: this._store, setCursor: this._adapter.setCursor.bind(this._adapter), project: this._adapter.project.bind(this._adapter), unproject: this._adapter.unproject.bind(this._adapter), setDoubleClickToZoom: this._adapter.setDoubleClickToZoom.bind(this._adapter), onChange: a, onSelect: l, onDeselect: c, onFinish: n, coordinatePrecision: this._adapter.getCoordinatePrecision() });
2608
2608
  });
2609
2609
  }
2610
2610
  checkEnabled() {
@@ -2613,26 +2613,26 @@ class ii {
2613
2613
  getModeStyles() {
2614
2614
  const t = {};
2615
2615
  return Object.keys(this._modes).forEach((e) => {
2616
- t[e] = (i) => this._instanceSelectMode && i.properties[wt] ? this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(i) : this._modes[e].styleFeature.bind(this._modes[e])(i);
2616
+ t[e] = (i) => this._instanceSelectMode && i.properties[bt] ? this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(i) : this._modes[e].styleFeature.bind(this._modes[e])(i);
2617
2617
  }), t;
2618
2618
  }
2619
2619
  featuresAtLocation({ lng: t, lat: e }, i) {
2620
- const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, r = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = this._adapter.unproject.bind(this._adapter), a = this._adapter.project.bind(this._adapter), l = a(t, e), h = re({ unproject: n, point: l, pointerDistance: o });
2621
- return this._store.search(h).filter((c) => {
2622
- if (r && (c.properties[et] || c.properties.selectionPoint)) return !1;
2623
- if (c.geometry.type === "Point") {
2624
- const d = c.geometry.coordinates, u = a(d[0], d[1]);
2625
- return _(l, u) < o;
2620
+ const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, r = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = this._adapter.unproject.bind(this._adapter), a = this._adapter.project.bind(this._adapter), l = a(t, e), c = ne({ unproject: n, point: l, pointerDistance: o });
2621
+ return this._store.search(c).filter((h) => {
2622
+ if (r && (h.properties[et] || h.properties.selectionPoint)) return !1;
2623
+ if (h.geometry.type === "Point") {
2624
+ const d = h.geometry.coordinates, u = a(d[0], d[1]);
2625
+ return F(l, u) < o;
2626
2626
  }
2627
- if (c.geometry.type === "LineString") {
2628
- const d = c.geometry.coordinates;
2627
+ if (h.geometry.type === "LineString") {
2628
+ const d = h.geometry.coordinates;
2629
2629
  for (let u = 0; u < d.length - 1; u++) {
2630
2630
  const g = d[u], p = d[u + 1];
2631
- if (he(l, a(g[0], g[1]), a(p[0], p[1])) < o) return !0;
2631
+ if (pe(l, a(g[0], g[1]), a(p[0], p[1])) < o) return !0;
2632
2632
  }
2633
2633
  return !1;
2634
2634
  }
2635
- return !!le([t, e], c.geometry.coordinates) || void 0;
2635
+ return !!ge([t, e], h.geometry.coordinates) || void 0;
2636
2636
  });
2637
2637
  }
2638
2638
  getSelectMode() {
@@ -2729,7 +2729,34 @@ class ii {
2729
2729
  i.includes(e) && i.splice(i.indexOf(e), 1);
2730
2730
  }
2731
2731
  }
2732
- const oi = {
2732
+ const vi = [
2733
+ "render",
2734
+ "point",
2735
+ "linestring",
2736
+ "polygon",
2737
+ "rectangle",
2738
+ "circle",
2739
+ "freehand",
2740
+ "angled-rectangle",
2741
+ "sensor",
2742
+ "sector",
2743
+ "select",
2744
+ "delete-selection",
2745
+ "delete"
2746
+ ], Pi = [
2747
+ "render",
2748
+ "linestring",
2749
+ "polygon",
2750
+ "rectangle",
2751
+ "circle",
2752
+ "freehand",
2753
+ "angled-rectangle",
2754
+ "sensor",
2755
+ "sector",
2756
+ "select",
2757
+ "delete-selection",
2758
+ "delete"
2759
+ ], oi = {
2733
2760
  modes: [
2734
2761
  "render",
2735
2762
  "point",
@@ -2760,7 +2787,90 @@ const oi = {
2760
2787
  "delete"
2761
2788
  ],
2762
2789
  open: !1,
2763
- linelayerSpec: {
2790
+ // see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
2791
+ modeOptions: {
2792
+ linestring: new le({
2793
+ styles: {
2794
+ lineStringColor: "#000000",
2795
+ lineStringWidth: 2,
2796
+ closingPointColor: "#FFFFFF",
2797
+ closingPointWidth: 5,
2798
+ closingPointOutlineColor: "#000000",
2799
+ closingPointOutlineWidth: 1
2800
+ }
2801
+ }),
2802
+ polygon: new he({
2803
+ styles: {
2804
+ fillColor: "#FFFFFF",
2805
+ fillOpacity: 0.7,
2806
+ outlineColor: "#000000",
2807
+ outlineWidth: 2,
2808
+ closingPointColor: "#FFFFFF",
2809
+ closingPointWidth: 5,
2810
+ closingPointOutlineColor: "#000000",
2811
+ closingPointOutlineWidth: 1
2812
+ },
2813
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2814
+ // @ts-ignore
2815
+ validation: (s, t) => {
2816
+ const e = t.updateType;
2817
+ return e === "finish" || e === "commit" ? me(s) : !0;
2818
+ }
2819
+ }),
2820
+ rectangle: new de({
2821
+ styles: {
2822
+ fillColor: "#FFFFFF",
2823
+ fillOpacity: 0.7,
2824
+ outlineColor: "#000000",
2825
+ outlineWidth: 2
2826
+ }
2827
+ }),
2828
+ "angled-rectangle": new Ce({
2829
+ styles: {
2830
+ fillColor: "#FFFFFF",
2831
+ fillOpacity: 0.7,
2832
+ outlineColor: "#000000",
2833
+ outlineWidth: 2
2834
+ }
2835
+ }),
2836
+ circle: new re({
2837
+ styles: {
2838
+ fillColor: "#FFFFFF",
2839
+ fillOpacity: 0.7,
2840
+ outlineColor: "#000000",
2841
+ outlineWidth: 2
2842
+ }
2843
+ }),
2844
+ freehand: new se({
2845
+ styles: {
2846
+ fillColor: "#FFFFFF",
2847
+ fillOpacity: 0.7,
2848
+ outlineColor: "#000000",
2849
+ outlineWidth: 2
2850
+ }
2851
+ }),
2852
+ sensor: new xe({
2853
+ styles: {
2854
+ fillColor: "#FFFFFF",
2855
+ fillOpacity: 0.7,
2856
+ outlineColor: "#000000",
2857
+ outlineWidth: 2,
2858
+ centerPointColor: "#FFFFFF",
2859
+ centerPointWidth: 5,
2860
+ centerPointOutlineColor: "#000000",
2861
+ centerPointOutlineWidth: 1
2862
+ }
2863
+ }),
2864
+ sector: new Pe({
2865
+ styles: {
2866
+ fillColor: "#FFFFFF",
2867
+ fillOpacity: 0.7,
2868
+ outlineColor: "#000000",
2869
+ outlineWidth: 2
2870
+ }
2871
+ })
2872
+ },
2873
+ lineLayerLabelSpec: {
2764
2874
  id: "terradraw-measure-line-label",
2765
2875
  type: "symbol",
2766
2876
  source: "terradraw-measure-line-source",
@@ -2793,6 +2903,19 @@ const oi = {
2793
2903
  "text-color": "#000000"
2794
2904
  }
2795
2905
  },
2906
+ lineLayerNodeSpec: {
2907
+ id: "terradraw-measure-line-node",
2908
+ type: "circle",
2909
+ source: "terradraw-measure-line-source",
2910
+ filter: ["match", ["geometry-type"], ["Point"], !0, !1],
2911
+ layout: {},
2912
+ paint: {
2913
+ "circle-radius": 5,
2914
+ "circle-color": "#FFFFFF",
2915
+ "circle-stroke-color": "#000000",
2916
+ "circle-stroke-width": 1
2917
+ }
2918
+ },
2796
2919
  polygonLayerSpec: {
2797
2920
  id: "terradraw-measure-polygon-label",
2798
2921
  type: "symbol",
@@ -2816,23 +2939,23 @@ const oi = {
2816
2939
  modeName: "render",
2817
2940
  styles: {}
2818
2941
  }),
2819
- point: new Fe(),
2820
- linestring: new De(),
2821
- polygon: new ke({
2942
+ point: new Be(),
2943
+ linestring: new le(),
2944
+ polygon: new he({
2822
2945
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2823
2946
  // @ts-ignore
2824
2947
  validation: (t, e) => {
2825
2948
  const i = e.updateType;
2826
- return i === "finish" || i === "commit" ? Ze(t) : !0;
2949
+ return i === "finish" || i === "commit" ? me(t) : !0;
2827
2950
  }
2828
2951
  }),
2829
- rectangle: new Le(),
2830
- "angled-rectangle": new Qe(),
2831
- circle: new be(),
2832
- freehand: new Ee(),
2833
- sensor: new ei(),
2834
- sector: new ti(),
2835
- select: new Te({
2952
+ rectangle: new de(),
2953
+ "angled-rectangle": new Ce(),
2954
+ circle: new re(),
2955
+ freehand: new se(),
2956
+ sensor: new xe(),
2957
+ sector: new Pe(),
2958
+ select: new Ye({
2836
2959
  flags: {
2837
2960
  point: {
2838
2961
  feature: {
@@ -2948,14 +3071,14 @@ class ni {
2948
3071
  * @param options Plugin control options
2949
3072
  */
2950
3073
  constructor(t) {
2951
- W(this, "controlContainer");
2952
- W(this, "map");
2953
- W(this, "modeButtons", {});
2954
- W(this, "isExpanded", !1);
2955
- W(this, "terradraw");
2956
- W(this, "options", oi);
2957
- W(this, "events", {});
2958
- W(this, "defaultMode", "render");
3074
+ k(this, "controlContainer");
3075
+ k(this, "map");
3076
+ k(this, "modeButtons", {});
3077
+ k(this, "isExpanded", !1);
3078
+ k(this, "terradraw");
3079
+ k(this, "options", oi);
3080
+ k(this, "events", {});
3081
+ k(this, "defaultMode", "render");
2959
3082
  this.modeButtons = {}, t && (this.options = Object.assign(this.options, t));
2960
3083
  }
2961
3084
  /**
@@ -2978,17 +3101,17 @@ class ni {
2978
3101
  const e = si(), i = [];
2979
3102
  return (r = (o = this.options) == null ? void 0 : o.modes) == null || r.forEach((l) => {
2980
3103
  if (this.options.modeOptions && this.options.modeOptions[l]) {
2981
- const h = this.options.modeOptions[l];
3104
+ const c = this.options.modeOptions[l];
2982
3105
  if (l === "select") {
2983
- const c = e[l];
2984
- if (c) {
2985
- const d = c.flags;
3106
+ const h = e[l];
3107
+ if (h) {
3108
+ const d = h.flags;
2986
3109
  Object.keys(d).forEach((u) => {
2987
- h.flags[u] || (h.flags[u] = d[u]);
3110
+ c.flags[u] || (c.flags[u] = d[u]);
2988
3111
  });
2989
3112
  }
2990
3113
  }
2991
- i.push(h);
3114
+ i.push(c);
2992
3115
  } else e[l] && i.push(e[l]);
2993
3116
  }), i.forEach((l) => {
2994
3117
  l.state !== "unregistered" && (l._state = "unregistered");
@@ -2998,13 +3121,13 @@ class ni {
2998
3121
  styles: {}
2999
3122
  })
3000
3123
  ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new ii({
3001
- adapter: new me({ map: t }),
3124
+ adapter: new Ee({ map: t }),
3002
3125
  modes: i
3003
3126
  }), this.terradraw.start(), this.controlContainer = document.createElement("div"), this.controlContainer.classList.add("maplibregl-ctrl"), this.controlContainer.classList.add("maplibregl-ctrl-group"), i.forEach((l) => {
3004
3127
  l.mode !== "default" && this.addTerradrawButton(l.mode);
3005
3128
  }), Object.values(this.modeButtons).forEach((l) => {
3006
- var h;
3007
- (h = this.controlContainer) == null || h.appendChild(l);
3129
+ var c;
3130
+ (c = this.controlContainer) == null || c.appendChild(l);
3008
3131
  }), this.controlContainer;
3009
3132
  }
3010
3133
  /**
@@ -3137,28 +3260,28 @@ class ni {
3137
3260
  return t.charAt(0).toUpperCase() + t.slice(1);
3138
3261
  }
3139
3262
  }
3140
- var F = 63710088e-1, ai = {
3141
- centimeters: F * 100,
3142
- centimetres: F * 100,
3263
+ var D = 63710088e-1, ai = {
3264
+ centimeters: D * 100,
3265
+ centimetres: D * 100,
3143
3266
  degrees: 360 / (2 * Math.PI),
3144
- feet: F * 3.28084,
3145
- inches: F * 39.37,
3146
- kilometers: F / 1e3,
3147
- kilometres: F / 1e3,
3148
- meters: F,
3149
- metres: F,
3150
- miles: F / 1609.344,
3151
- millimeters: F * 1e3,
3152
- millimetres: F * 1e3,
3153
- nauticalmiles: F / 1852,
3267
+ feet: D * 3.28084,
3268
+ inches: D * 39.37,
3269
+ kilometers: D / 1e3,
3270
+ kilometres: D / 1e3,
3271
+ meters: D,
3272
+ metres: D,
3273
+ miles: D / 1609.344,
3274
+ millimeters: D * 1e3,
3275
+ millimetres: D * 1e3,
3276
+ nauticalmiles: D / 1852,
3154
3277
  radians: 1,
3155
- yards: F * 1.0936
3278
+ yards: D * 1.0936
3156
3279
  };
3157
3280
  function li(s, t, e = {}) {
3158
3281
  const i = { type: "Feature" };
3159
3282
  return (e.id === 0 || e.id) && (i.id = e.id), e.bbox && (i.bbox = e.bbox), i.properties = t || {}, i.geometry = s, i;
3160
3283
  }
3161
- function hi(s, t, e = {}) {
3284
+ function ci(s, t, e = {}) {
3162
3285
  if (!s)
3163
3286
  throw new Error("coordinates is required");
3164
3287
  if (!Array.isArray(s))
@@ -3172,13 +3295,13 @@ function hi(s, t, e = {}) {
3172
3295
  coordinates: s
3173
3296
  }, t, e);
3174
3297
  }
3175
- function ci(s, t = "kilometers") {
3298
+ function hi(s, t = "kilometers") {
3176
3299
  const e = ai[t];
3177
3300
  if (!e)
3178
3301
  throw new Error(t + " units is invalid");
3179
3302
  return s * e;
3180
3303
  }
3181
- function ct(s) {
3304
+ function ht(s) {
3182
3305
  return s % 360 * Math.PI / 180;
3183
3306
  }
3184
3307
  function Jt(s) {
@@ -3198,22 +3321,22 @@ function $t(s) {
3198
3321
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
3199
3322
  }
3200
3323
  function di(s, t, e = {}) {
3201
- var i = $t(s), o = $t(t), r = ct(o[1] - i[1]), n = ct(o[0] - i[0]), a = ct(i[1]), l = ct(o[1]), h = Math.pow(Math.sin(r / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
3202
- return ci(
3203
- 2 * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h)),
3324
+ var i = $t(s), o = $t(t), r = ht(o[1] - i[1]), n = ht(o[0] - i[0]), a = ht(i[1]), l = ht(o[1]), c = Math.pow(Math.sin(r / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
3325
+ return hi(
3326
+ 2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)),
3204
3327
  e.units
3205
3328
  );
3206
3329
  }
3207
- function ge(s, t, e) {
3330
+ function Se(s, t, e) {
3208
3331
  if (s !== null)
3209
- for (var i, o, r, n, a, l, h, c = 0, d = 0, u, g = s.type, p = g === "FeatureCollection", y = g === "Feature", m = p ? s.features.length : 1, f = 0; f < m; f++) {
3210
- h = p ? s.features[f].geometry : y ? s.geometry : s, u = h ? h.type === "GeometryCollection" : !1, a = u ? h.geometries.length : 1;
3332
+ for (var i, o, r, n, a, l, c, h = 0, d = 0, u, g = s.type, p = g === "FeatureCollection", y = g === "Feature", m = p ? s.features.length : 1, f = 0; f < m; f++) {
3333
+ c = p ? s.features[f].geometry : y ? s.geometry : s, u = c ? c.type === "GeometryCollection" : !1, a = u ? c.geometries.length : 1;
3211
3334
  for (var v = 0; v < a; v++) {
3212
3335
  var C = 0, S = 0;
3213
- if (n = u ? h.geometries[v] : h, n !== null) {
3336
+ if (n = u ? c.geometries[v] : c, n !== null) {
3214
3337
  l = n.coordinates;
3215
3338
  var P = n.type;
3216
- switch (c = P === "Polygon" || P === "MultiPolygon" ? 1 : 0, P) {
3339
+ switch (h = P === "Polygon" || P === "MultiPolygon" ? 1 : 0, P) {
3217
3340
  case null:
3218
3341
  break;
3219
3342
  case "Point":
@@ -3245,7 +3368,7 @@ function ge(s, t, e) {
3245
3368
  case "Polygon":
3246
3369
  case "MultiLineString":
3247
3370
  for (i = 0; i < l.length; i++) {
3248
- for (o = 0; o < l[i].length - c; o++) {
3371
+ for (o = 0; o < l[i].length - h; o++) {
3249
3372
  if (t(
3250
3373
  l[i][o],
3251
3374
  d,
@@ -3263,7 +3386,7 @@ function ge(s, t, e) {
3263
3386
  case "MultiPolygon":
3264
3387
  for (i = 0; i < l.length; i++) {
3265
3388
  for (S = 0, o = 0; o < l[i].length; o++) {
3266
- for (r = 0; r < l[i][o].length - c; r++) {
3389
+ for (r = 0; r < l[i][o].length - h; r++) {
3267
3390
  if (t(
3268
3391
  l[i][o][r],
3269
3392
  d,
@@ -3281,7 +3404,7 @@ function ge(s, t, e) {
3281
3404
  break;
3282
3405
  case "GeometryCollection":
3283
3406
  for (i = 0; i < n.geometries.length; i++)
3284
- if (ge(n.geometries[i], t) === !1)
3407
+ if (Se(n.geometries[i], t) === !1)
3285
3408
  return !1;
3286
3409
  break;
3287
3410
  default:
@@ -3292,15 +3415,15 @@ function ge(s, t, e) {
3292
3415
  }
3293
3416
  }
3294
3417
  function ui(s, t) {
3295
- var e, i, o, r, n, a, l, h, c, d, u = 0, g = s.type === "FeatureCollection", p = s.type === "Feature", y = g ? s.features.length : 1;
3418
+ var e, i, o, r, n, a, l, c, h, d, u = 0, g = s.type === "FeatureCollection", p = s.type === "Feature", y = g ? s.features.length : 1;
3296
3419
  for (e = 0; e < y; e++) {
3297
- for (a = g ? s.features[e].geometry : p ? s.geometry : s, h = g ? s.features[e].properties : p ? s.properties : {}, c = g ? s.features[e].bbox : p ? s.bbox : void 0, d = g ? s.features[e].id : p ? s.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
3420
+ for (a = g ? s.features[e].geometry : p ? s.geometry : s, c = g ? s.features[e].properties : p ? s.properties : {}, h = g ? s.features[e].bbox : p ? s.bbox : void 0, d = g ? s.features[e].id : p ? s.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
3298
3421
  if (r = l ? a.geometries[o] : a, r === null) {
3299
3422
  if (t(
3300
3423
  null,
3301
3424
  u,
3302
- h,
3303
3425
  c,
3426
+ h,
3304
3427
  d
3305
3428
  ) === !1)
3306
3429
  return !1;
@@ -3316,8 +3439,8 @@ function ui(s, t) {
3316
3439
  if (t(
3317
3440
  r,
3318
3441
  u,
3319
- h,
3320
3442
  c,
3443
+ h,
3321
3444
  d
3322
3445
  ) === !1)
3323
3446
  return !1;
@@ -3328,8 +3451,8 @@ function ui(s, t) {
3328
3451
  if (t(
3329
3452
  r.geometries[i],
3330
3453
  u,
3331
- h,
3332
3454
  c,
3455
+ h,
3333
3456
  d
3334
3457
  ) === !1)
3335
3458
  return !1;
@@ -3391,28 +3514,28 @@ function qt(s) {
3391
3514
  }
3392
3515
  return t;
3393
3516
  }
3394
- var fi = F * F / 2, Mt = Math.PI / 180;
3517
+ var fi = D * D / 2, Mt = Math.PI / 180;
3395
3518
  function Zt(s) {
3396
3519
  const t = s.length - 1;
3397
3520
  if (t <= 2)
3398
3521
  return 0;
3399
3522
  let e = 0, i = 0;
3400
3523
  for (; i < t; ) {
3401
- const o = s[i], r = s[i + 1 === t ? 0 : i + 1], n = s[i + 2 >= t ? (i + 2) % t : i + 2], a = o[0] * Mt, l = r[1] * Mt, h = n[0] * Mt;
3402
- e += (h - a) * Math.sin(l), i++;
3524
+ const o = s[i], r = s[i + 1 === t ? 0 : i + 1], n = s[i + 2 >= t ? (i + 2) % t : i + 2], a = o[0] * Mt, l = r[1] * Mt, c = n[0] * Mt;
3525
+ e += (c - a) * Math.sin(l), i++;
3403
3526
  }
3404
3527
  return e * fi;
3405
3528
  }
3406
3529
  function mi(s, t = {}) {
3407
3530
  let e = 0, i = 0, o = 0;
3408
- return ge(
3531
+ return Se(
3409
3532
  s,
3410
3533
  function(r) {
3411
3534
  e += r[0], i += r[1], o++;
3412
3535
  }
3413
- ), hi([e / o, i / o], t.properties);
3536
+ ), ci([e / o, i / o], t.properties);
3414
3537
  }
3415
- class vi extends ni {
3538
+ class xi extends ni {
3416
3539
  /**
3417
3540
  * Constructor
3418
3541
  * @param options Plugin control options
@@ -3422,11 +3545,13 @@ class vi extends ni {
3422
3545
  e && (i = Object.assign(i, e));
3423
3546
  super({
3424
3547
  modes: i.modes,
3425
- open: i.open
3548
+ open: i.open,
3549
+ modeOptions: i.modeOptions
3426
3550
  });
3427
- W(this, "linelayerSpec");
3428
- W(this, "polygonLayerSpec");
3429
- this.linelayerSpec = i.linelayerSpec, this.polygonLayerSpec = i.polygonLayerSpec;
3551
+ k(this, "lineLayerLabelSpec");
3552
+ k(this, "lineLayerNodeSpec");
3553
+ k(this, "polygonLayerSpec");
3554
+ this.lineLayerLabelSpec = i.lineLayerLabelSpec, this.lineLayerNodeSpec = i.lineLayerNodeSpec, this.polygonLayerSpec = i.polygonLayerSpec;
3430
3555
  }
3431
3556
  /**
3432
3557
  * add the plugin control to maplibre
@@ -3450,10 +3575,10 @@ class vi extends ni {
3450
3575
  var o, r;
3451
3576
  if (!this.map) return;
3452
3577
  const e = (o = this.options.modes) == null ? void 0 : o.filter((n) => ["linestring"].includes(n));
3453
- e && e.length > 0 && (this.map.getSource(this.linelayerSpec.source) || this.map.addSource(this.linelayerSpec.source, {
3578
+ e && e.length > 0 && (this.map.getSource(this.lineLayerLabelSpec.source) || this.map.addSource(this.lineLayerLabelSpec.source, {
3454
3579
  type: "geojson",
3455
3580
  data: { type: "FeatureCollection", features: [] }
3456
- }), this.map.getLayer(this.linelayerSpec.id) || this.map.addLayer(this.linelayerSpec));
3581
+ }), this.map.getLayer(this.lineLayerNodeSpec.id) || this.map.addLayer(this.lineLayerNodeSpec), this.map.getLayer(this.lineLayerLabelSpec.id) || this.map.addLayer(this.lineLayerLabelSpec));
3457
3582
  const i = (r = this.options.modes) == null ? void 0 : r.filter(
3458
3583
  (n) => [
3459
3584
  "polygon",
@@ -3470,12 +3595,17 @@ class vi extends ni {
3470
3595
  data: { type: "FeatureCollection", features: [] }
3471
3596
  }), this.map.getLayer(this.polygonLayerSpec.id) || this.map.addLayer(this.polygonLayerSpec)), e && e.length > 0 || i && i.length > 0) {
3472
3597
  const n = this.getTerraDrawInstance();
3473
- n && (n.on("finish", (a) => {
3598
+ n && (n.on("change", (a) => {
3474
3599
  if (!this.map) return;
3475
3600
  const l = this.getTerraDrawInstance();
3476
3601
  if (!l) return;
3477
- const h = l.getSnapshot(), d = (h == null ? void 0 : h.find((u) => u.id === a)).geometry.type;
3478
- d === "LineString" ? this.measureLine(a) : d === "Polygon" && this.measurePolygon(a);
3602
+ const c = l.getSnapshot();
3603
+ for (const h of a) {
3604
+ const d = c == null ? void 0 : c.find((p) => p.id === h);
3605
+ if (!d) continue;
3606
+ const u = d.geometry.type, g = d.properties.mode;
3607
+ g === "linestring" && u === "LineString" ? this.measureLine(h) : !["point", "linestring", "select", "render"].includes(g) && u === "Polygon" && this.measurePolygon(h);
3608
+ }
3479
3609
  }), this.on("feature-deleted", this.onFeatureDeleted.bind(this)));
3480
3610
  }
3481
3611
  }
@@ -3483,7 +3613,7 @@ class vi extends ni {
3483
3613
  * Unregister measure control related maplibre sources and layers
3484
3614
  */
3485
3615
  unregisterMesureControl() {
3486
- this.off("feature-deleted", this.onFeatureDeleted.bind(this)), this.map && (this.map.getLayer(this.linelayerSpec.id) && this.map.removeLayer(this.linelayerSpec.id), this.map.getLayer(this.polygonLayerSpec.id) && this.map.removeLayer(this.polygonLayerSpec.id), this.map.getSource(this.linelayerSpec.source) && this.map.removeSource(this.linelayerSpec.source), this.map.getSource(this.polygonLayerSpec.source) && this.map.removeSource(this.polygonLayerSpec.source));
3616
+ this.off("feature-deleted", this.onFeatureDeleted.bind(this)), this.map && (this.map.getLayer(this.lineLayerLabelSpec.id) && this.map.removeLayer(this.lineLayerLabelSpec.id), this.map.getLayer(this.lineLayerNodeSpec.id) && this.map.removeLayer(this.lineLayerNodeSpec.id), this.map.getLayer(this.polygonLayerSpec.id) && this.map.removeLayer(this.polygonLayerSpec.id), this.map.getSource(this.lineLayerLabelSpec.source) && this.map.removeSource(this.lineLayerLabelSpec.source), this.map.getSource(this.polygonLayerSpec.source) && this.map.removeSource(this.polygonLayerSpec.source));
3487
3617
  }
3488
3618
  /**
3489
3619
  * measure polygon area for given feature ID
@@ -3498,10 +3628,16 @@ class vi extends ni {
3498
3628
  if (r) {
3499
3629
  const a = this.map.getStyle().sources[this.polygonLayerSpec.source];
3500
3630
  if (a) {
3501
- const l = pi(r.geometry), h = JSON.parse(JSON.stringify(r));
3502
- h.id = h.id + "-area-label", h.geometry = mi(r.geometry).geometry, h.properties.originalId = r.id;
3503
- let c = l, d = "m2";
3504
- l > 1e4 ? (c = l / 1e4, d = "ha") : l > 1e3 && (c = l / 1e3, d = "km2"), h.properties.area = c.toFixed(2), h.properties.unit = d, typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(h), (n = this.map.getSource(this.polygonLayerSpec.source)) == null || n.setData(
3631
+ typeof a.data != "string" && a.data.type === "FeatureCollection" && (a.data.features = a.data.features.filter(
3632
+ (u) => {
3633
+ var g;
3634
+ return ((g = u.properties) == null ? void 0 : g.originalId) !== e;
3635
+ }
3636
+ ));
3637
+ const l = pi(r.geometry), c = JSON.parse(JSON.stringify(r));
3638
+ c.id = c.id + "-area-label", c.geometry = mi(r.geometry).geometry, c.properties.originalId = r.id;
3639
+ let h = l, d = "m2";
3640
+ l > 1e4 ? (h = l / 1e4, d = "ha") : l > 1e3 && (h = l / 1e3, d = "km2"), c.properties.area = h.toFixed(2), c.properties.unit = d, typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(c), (n = this.map.getSource(this.polygonLayerSpec.source)) == null || n.setData(
3505
3641
  a.data
3506
3642
  ), this.map.moveLayer(this.polygonLayerSpec.id);
3507
3643
  }
@@ -3518,30 +3654,36 @@ class vi extends ni {
3518
3654
  if (!i) return;
3519
3655
  const o = i.getSnapshot(), r = o == null ? void 0 : o.find((a) => a.id === e && a.geometry.type === "LineString");
3520
3656
  if (r) {
3521
- const a = this.map.getStyle().sources[this.linelayerSpec.source];
3657
+ const a = this.map.getStyle().sources[this.lineLayerLabelSpec.source];
3522
3658
  if (a) {
3523
3659
  const l = r.geometry.coordinates;
3524
- let h = 0;
3525
- for (let c = 0; c < l.length - 1; c++) {
3526
- const d = l[c], u = l[c + 1], g = di(d, u, { units: "kilometers" });
3527
- h += g;
3660
+ typeof a.data != "string" && a.data.type === "FeatureCollection" && (a.data.features = a.data.features.filter(
3661
+ (h) => {
3662
+ var d;
3663
+ return ((d = h.properties) == null ? void 0 : d.originalId) !== e;
3664
+ }
3665
+ ));
3666
+ let c = 0;
3667
+ for (let h = 0; h < l.length - 1; h++) {
3668
+ const d = l[h], u = l[h + 1], g = di(d, u, { units: "kilometers" });
3669
+ c += g;
3528
3670
  const p = JSON.parse(JSON.stringify(r));
3529
- if (p.id = `${p.id}-${c}`, p.geometry.coordinates = [d, u], p.properties.originalId = r.id, p.properties.distance = g.toFixed(2), p.properties.total = h.toFixed(2), p.properties.unit = "km", typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(p), c === 0) {
3671
+ if (p.id = `${p.id}-${h}`, p.geometry.coordinates = [d, u], p.properties.originalId = r.id, p.properties.distance = g.toFixed(2), p.properties.total = c.toFixed(2), p.properties.unit = "km", typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(p), h === 0) {
3530
3672
  const m = JSON.parse(JSON.stringify(r));
3531
- m.id = `${p.id}-node-${c}`, m.geometry = {
3673
+ m.id = `${p.id}-node-${h}`, m.geometry = {
3532
3674
  type: "Point",
3533
3675
  coordinates: d
3534
3676
  }, m.properties.originalId = r.id, m.properties.distance = 0, m.properties.total = 0, m.properties.unit = "km", typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(m);
3535
3677
  }
3536
3678
  const y = JSON.parse(JSON.stringify(r));
3537
- y.id = `${p.id}-node-${c + 1}`, y.geometry = {
3679
+ y.id = `${p.id}-node-${h + 1}`, y.geometry = {
3538
3680
  type: "Point",
3539
3681
  coordinates: u
3540
- }, y.properties.originalId = r.id, y.properties.distance = g.toFixed(2), y.properties.total = h.toFixed(2), y.properties.unit = "km", typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(y);
3682
+ }, y.properties.originalId = r.id, y.properties.distance = g.toFixed(2), y.properties.total = c.toFixed(2), y.properties.unit = "km", typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(y);
3541
3683
  }
3542
- (n = this.map.getSource(this.linelayerSpec.source)) == null || n.setData(
3684
+ (n = this.map.getSource(this.lineLayerLabelSpec.source)) == null || n.setData(
3543
3685
  a.data
3544
- ), this.map.moveLayer(this.linelayerSpec.id);
3686
+ ), this.map.moveLayer(this.lineLayerLabelSpec.id), this.map.moveLayer(this.lineLayerNodeSpec.id);
3545
3687
  }
3546
3688
  }
3547
3689
  }
@@ -3553,21 +3695,21 @@ class vi extends ni {
3553
3695
  if (!this.map) return;
3554
3696
  const e = this.getTerraDrawInstance();
3555
3697
  if (e) {
3556
- const r = [this.linelayerSpec.source, this.polygonLayerSpec.source];
3698
+ const r = [this.lineLayerLabelSpec.source, this.polygonLayerSpec.source];
3557
3699
  for (const n of r) {
3558
3700
  const a = this.map.getStyle().sources[n];
3559
3701
  if (a) {
3560
- const l = e.getSnapshot(), c = (l == null ? void 0 : l.filter(
3702
+ const l = e.getSnapshot(), h = (l == null ? void 0 : l.filter(
3561
3703
  (d) => ["LineString", "Polygon"].includes(d.geometry.type)
3562
3704
  )).map((d) => d.id);
3563
3705
  typeof a.data != "string" && a.data.type === "FeatureCollection" && (a.data.features = a.data.features.filter(
3564
3706
  (d) => {
3565
3707
  var u;
3566
- return c.includes((u = d.properties) == null ? void 0 : u.originalId);
3708
+ return h.includes((u = d.properties) == null ? void 0 : u.originalId);
3567
3709
  }
3568
- )), n === this.linelayerSpec.source ? ((i = this.map.getSource(this.linelayerSpec.source)) == null || i.setData(
3710
+ )), n === this.lineLayerLabelSpec.source ? ((i = this.map.getSource(this.lineLayerLabelSpec.source)) == null || i.setData(
3569
3711
  a.data
3570
- ), this.map.getLayer(this.linelayerSpec.id) && this.map.moveLayer(this.linelayerSpec.id)) : n === this.polygonLayerSpec.source && ((o = this.map.getSource(this.polygonLayerSpec.source)) == null || o.setData(
3712
+ ), this.map.getLayer(this.lineLayerNodeSpec.id) && this.map.moveLayer(this.lineLayerNodeSpec.id), this.map.getLayer(this.lineLayerLabelSpec.id) && this.map.moveLayer(this.lineLayerLabelSpec.id)) : n === this.polygonLayerSpec.source && ((o = this.map.getSource(this.polygonLayerSpec.source)) == null || o.setData(
3571
3713
  a.data
3572
3714
  ), this.map.getLayer(this.polygonLayerSpec.id) && this.map.moveLayer(this.polygonLayerSpec.id));
3573
3715
  }
@@ -3575,36 +3717,10 @@ class vi extends ni {
3575
3717
  }
3576
3718
  }
3577
3719
  }
3578
- const Pi = [
3579
- "render",
3580
- "point",
3581
- "linestring",
3582
- "polygon",
3583
- "rectangle",
3584
- "circle",
3585
- "freehand",
3586
- "angled-rectangle",
3587
- "sensor",
3588
- "sector",
3589
- "select",
3590
- "delete-selection",
3591
- "delete"
3592
- ], xi = [
3593
- "render",
3594
- "linestring",
3595
- "polygon",
3596
- "rectangle",
3597
- "circle",
3598
- "freehand",
3599
- "angled-rectangle",
3600
- "sensor",
3601
- "sector",
3602
- "delete"
3603
- ];
3604
3720
  export {
3605
- xi as AvailableMeasureModes,
3606
- Pi as AvailableModes,
3607
- vi as MaplibreMeasureControl,
3721
+ Pi as AvailableMeasureModes,
3722
+ vi as AvailableModes,
3723
+ xi as MaplibreMeasureControl,
3608
3724
  ni as MaplibreTerradrawControl,
3609
3725
  oi as defaultControlOptions,
3610
3726
  ri as defaultMeasureControlOptions,