@vitessce/image-utils 4.0.10 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,7 +79,7 @@ var reTrimStart = /^\s+/;
79
79
  function baseTrim(string) {
80
80
  return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
81
81
  }
82
- function isObject$5(value) {
82
+ function isObject$3(value) {
83
83
  var type = typeof value;
84
84
  return value != null && (type == "object" || type == "function");
85
85
  }
@@ -95,9 +95,9 @@ function toNumber(value) {
95
95
  if (isSymbol(value)) {
96
96
  return NAN;
97
97
  }
98
- if (isObject$5(value)) {
98
+ if (isObject$3(value)) {
99
99
  var other = typeof value.valueOf == "function" ? value.valueOf() : value;
100
- value = isObject$5(other) ? other + "" : other;
100
+ value = isObject$3(other) ? other + "" : other;
101
101
  }
102
102
  if (typeof value != "string") {
103
103
  return value === 0 ? value : +value;
@@ -120,7 +120,7 @@ function toFinite$1(value) {
120
120
  }
121
121
  var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
122
122
  function isFunction$2(value) {
123
- if (!isObject$5(value)) {
123
+ if (!isObject$3(value)) {
124
124
  return false;
125
125
  }
126
126
  var tag2 = baseGetTag(value);
@@ -158,7 +158,7 @@ var reIsNative = RegExp(
158
158
  "^" + funcToString.call(hasOwnProperty$a).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
159
159
  );
160
160
  function baseIsNative(value) {
161
- if (!isObject$5(value) || isMasked(value)) {
161
+ if (!isObject$3(value) || isMasked(value)) {
162
162
  return false;
163
163
  }
164
164
  var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
@@ -190,7 +190,7 @@ function isArrayLike(value) {
190
190
  return value != null && isLength(value.length) && !isFunction$2(value);
191
191
  }
192
192
  function isIterateeCall(value, index2, object2) {
193
- if (!isObject$5(object2)) {
193
+ if (!isObject$3(object2)) {
194
194
  return false;
195
195
  }
196
196
  var type = typeof index2;
@@ -1587,10 +1587,10 @@ function normalize$4(out, a2) {
1587
1587
  out[2] = a2[2] * len2;
1588
1588
  return out;
1589
1589
  }
1590
- function dot$4(a2, b) {
1590
+ function dot$3(a2, b) {
1591
1591
  return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
1592
1592
  }
1593
- function cross$1(out, a2, b) {
1593
+ function cross(out, a2, b) {
1594
1594
  var ax = a2[0], ay = a2[1], az = a2[2];
1595
1595
  var bx = b[0], by = b[1], bz = b[2];
1596
1596
  out[0] = ay * bz - az * by;
@@ -1679,8 +1679,8 @@ function rotateZ$2(out, a2, b, rad) {
1679
1679
  out[2] = r2[2] + b[2];
1680
1680
  return out;
1681
1681
  }
1682
- function angle$2(a2, b) {
1683
- var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine2 = mag && dot$4(a2, b) / mag;
1682
+ function angle$1(a2, b) {
1683
+ var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine2 = mag && dot$3(a2, b) / mag;
1684
1684
  return Math.acos(Math.min(Math.max(cosine2, -1), 1));
1685
1685
  }
1686
1686
  var sub$1 = subtract$1;
@@ -1779,10 +1779,10 @@ class Vector3 extends Vector {
1779
1779
  this[2] = checkNumber(value);
1780
1780
  }
1781
1781
  angle(vector) {
1782
- return angle$2(this, vector);
1782
+ return angle$1(this, vector);
1783
1783
  }
1784
1784
  cross(vector) {
1785
- cross$1(this, this, vector);
1785
+ cross(this, this, vector);
1786
1786
  return this.check();
1787
1787
  }
1788
1788
  rotateX({
@@ -2899,7 +2899,7 @@ function normalize$3(out, a2) {
2899
2899
  out[3] = w2 * len2;
2900
2900
  return out;
2901
2901
  }
2902
- function dot$3(a2, b) {
2902
+ function dot$2(a2, b) {
2903
2903
  return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2] + a2[3] * b[3];
2904
2904
  }
2905
2905
  function lerp$2(out, a2, b, t) {
@@ -3515,7 +3515,7 @@ function fromMat3(out, m) {
3515
3515
  }
3516
3516
  var add$3 = add$4;
3517
3517
  var scale = scale$1;
3518
- var dot$2 = dot$3;
3518
+ var dot$1 = dot$2;
3519
3519
  var lerp$1 = lerp$2;
3520
3520
  var length$2 = length$3;
3521
3521
  var squaredLength = squaredLength$1;
@@ -3525,10 +3525,10 @@ var rotationTo = function() {
3525
3525
  var xUnitVec3 = fromValues(1, 0, 0);
3526
3526
  var yUnitVec3 = fromValues(0, 1, 0);
3527
3527
  return function(out, a2, b) {
3528
- var dot2 = dot$4(a2, b);
3528
+ var dot2 = dot$3(a2, b);
3529
3529
  if (dot2 < -0.999999) {
3530
- cross$1(tmpvec3, xUnitVec3, a2);
3531
- if (len(tmpvec3) < 1e-6) cross$1(tmpvec3, yUnitVec3, a2);
3530
+ cross(tmpvec3, xUnitVec3, a2);
3531
+ if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2);
3532
3532
  normalize$4(tmpvec3, tmpvec3);
3533
3533
  setAxisAngle(out, tmpvec3, Math.PI);
3534
3534
  return out;
@@ -3539,7 +3539,7 @@ var rotationTo = function() {
3539
3539
  out[3] = 1;
3540
3540
  return out;
3541
3541
  } else {
3542
- cross$1(tmpvec3, a2, b);
3542
+ cross(tmpvec3, a2, b);
3543
3543
  out[0] = tmpvec3[0];
3544
3544
  out[1] = tmpvec3[1];
3545
3545
  out[2] = tmpvec3[2];
@@ -3653,7 +3653,7 @@ class Quaternion extends MathArray {
3653
3653
  return squaredLength(this);
3654
3654
  }
3655
3655
  dot(a2) {
3656
- return dot$2(this, a2);
3656
+ return dot$1(this, a2);
3657
3657
  }
3658
3658
  rotationTo(vectorA, vectorB) {
3659
3659
  rotationTo(this, vectorA, vectorB);
@@ -4577,7 +4577,7 @@ function isDate(x) {
4577
4577
  function isRegExp(x) {
4578
4578
  return x instanceof RegExp;
4579
4579
  }
4580
- function isObject$4(x) {
4580
+ function isObject$2(x) {
4581
4581
  return !!(x && typeof x === "object" && x.constructor === Object && !isComplex(x) && !isFraction(x));
4582
4582
  }
4583
4583
  function isNull(x) {
@@ -4684,7 +4684,7 @@ function mapObject(object2, callback) {
4684
4684
  }
4685
4685
  return clone2;
4686
4686
  }
4687
- function extend$1(a2, b) {
4687
+ function extend(a2, b) {
4688
4688
  for (var prop in b) {
4689
4689
  if (hasOwnProperty$2(b, prop)) {
4690
4690
  a2[prop] = b[prop];
@@ -6582,7 +6582,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies$P, function crea
6582
6582
  },
6583
6583
  {
6584
6584
  name: "Object",
6585
- test: isObject$4
6585
+ test: isObject$2
6586
6586
  }
6587
6587
  // order 'Object' last, it matches on other classes too
6588
6588
  ];
@@ -13657,7 +13657,7 @@ var createMultiply = /* @__PURE__ */ factory(name$u, dependencies$n, (_ref) => {
13657
13657
  cptr[bcolumns] = cindex.length;
13658
13658
  return c;
13659
13659
  }
13660
- return typed2(name$u, extend$1({
13660
+ return typed2(name$u, extend({
13661
13661
  // we extend the signatures of multiplyScalar with signatures dealing with matrices
13662
13662
  "Array, Array": function ArrayArray(x, y) {
13663
13663
  _validateMatrixDimensions(arraySize(x), arraySize(y));
@@ -18984,7 +18984,7 @@ var createDivide = /* @__PURE__ */ factory(name$7, dependencies, (_ref) => {
18984
18984
  var algorithm14 = createAlgorithm14({
18985
18985
  typed: typed2
18986
18986
  });
18987
- return typed2("divide", extend$1({
18987
+ return typed2("divide", extend({
18988
18988
  // we extend the signatures of divideScalar with signatures dealing with matrices
18989
18989
  "Array | Matrix, Array | Matrix": function ArrayMatrixArrayMatrix(x, y) {
18990
18990
  return multiply2(x, inv2(y));
@@ -19110,7 +19110,7 @@ var FibonacciHeap = /* @__PURE__ */ createFibonacciHeapClass({
19110
19110
  larger,
19111
19111
  smaller: smaller$1
19112
19112
  });
19113
- var dot$1 = /* @__PURE__ */ createDot({
19113
+ var dot = /* @__PURE__ */ createDot({
19114
19114
  addScalar,
19115
19115
  conj,
19116
19116
  multiplyScalar,
@@ -19126,7 +19126,7 @@ var floor = /* @__PURE__ */ createFloor({
19126
19126
  });
19127
19127
  var multiply = /* @__PURE__ */ createMultiply({
19128
19128
  addScalar,
19129
- dot: dot$1,
19129
+ dot,
19130
19130
  equalScalar,
19131
19131
  matrix,
19132
19132
  multiplyScalar,
@@ -19159,7 +19159,7 @@ var subtract = /* @__PURE__ */ createSubtract({
19159
19159
  typed,
19160
19160
  unaryMinus
19161
19161
  });
19162
- var equal$2 = /* @__PURE__ */ createEqual({
19162
+ var equal = /* @__PURE__ */ createEqual({
19163
19163
  DenseMatrix,
19164
19164
  equalScalar,
19165
19165
  matrix,
@@ -19238,7 +19238,7 @@ var Unit = /* @__PURE__ */ createUnitClass({
19238
19238
  addScalar,
19239
19239
  config: config$1,
19240
19240
  divideScalar,
19241
- equal: equal$2,
19241
+ equal,
19242
19242
  fix,
19243
19243
  format,
19244
19244
  isNumeric: isNumeric$1,
@@ -20915,15 +20915,15 @@ function dirname(url) {
20915
20915
  }
20916
20916
  const isBoolean = (x) => typeof x === "boolean";
20917
20917
  const isFunction = (x) => typeof x === "function";
20918
- const isObject$3 = (x) => x !== null && typeof x === "object";
20919
- const isPureObject = (x) => isObject$3(x) && x.constructor === {}.constructor;
20918
+ const isObject$1 = (x) => x !== null && typeof x === "object";
20919
+ const isPureObject = (x) => isObject$1(x) && x.constructor === {}.constructor;
20920
20920
  const isIterable = (x) => x && typeof x[Symbol.iterator] === "function";
20921
20921
  const isAsyncIterable$1 = (x) => x && typeof x[Symbol.asyncIterator] === "function";
20922
20922
  const isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
20923
20923
  const isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
20924
20924
  const isBuffer = (x) => x && typeof x === "object" && x.isBuffer;
20925
- const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$3(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
20926
- const isReadableNodeStream = (x) => isObject$3(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
20925
+ const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$1(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
20926
+ const isReadableNodeStream = (x) => isObject$1(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
20927
20927
  const isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
20928
20928
  const DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
20929
20929
  const MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
@@ -21722,7 +21722,7 @@ function getFetchFunction(options, context) {
21722
21722
  if (typeof fetchOptions.fetch === "function") {
21723
21723
  return fetchOptions.fetch;
21724
21724
  }
21725
- if (isObject$3(fetchOptions.fetch)) {
21725
+ if (isObject$1(fetchOptions.fetch)) {
21726
21726
  return (url) => fetchFile(url, fetchOptions);
21727
21727
  }
21728
21728
  if (context !== null && context !== void 0 && context.fetch) {
@@ -21743,7 +21743,7 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
21743
21743
  const loaderName = id || "Top level";
21744
21744
  const prefix = id ? "".concat(id, ".") : "";
21745
21745
  for (const key in options) {
21746
- const isSubOptions = !id && isObject$3(options[key]);
21746
+ const isSubOptions = !id && isObject$1(options[key]);
21747
21747
  const isBaseUriOption = key === "baseUri" && !id;
21748
21748
  const isWorkerUrlOption = key === "workerUrl" && id;
21749
21749
  if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
@@ -44923,7 +44923,7 @@ function getPropTypes(props) {
44923
44923
  const ERR_NOT_OBJECT = "count(): argument not an object";
44924
44924
  const ERR_NOT_CONTAINER = "count(): argument not a container";
44925
44925
  function count(container) {
44926
- if (!isObject$2(container)) {
44926
+ if (!isObject(container)) {
44927
44927
  throw new Error(ERR_NOT_OBJECT);
44928
44928
  }
44929
44929
  if (typeof container.count === "function") {
@@ -44943,7 +44943,7 @@ function count(container) {
44943
44943
  function isPlainObject(value) {
44944
44944
  return value !== null && typeof value === "object" && value.constructor === Object;
44945
44945
  }
44946
- function isObject$2(value) {
44946
+ function isObject(value) {
44947
44947
  return value !== null && typeof value === "object";
44948
44948
  }
44949
44949
  function mergeShaders(target, source) {
@@ -49276,35 +49276,35 @@ function getPointAtIndex(positions, index2, size2, offset, out = []) {
49276
49276
  }
49277
49277
  return out;
49278
49278
  }
49279
- function intersect(a2, b, edge, bbox2, out = []) {
49279
+ function intersect(a2, b, edge, bbox, out = []) {
49280
49280
  let t;
49281
49281
  let snap;
49282
49282
  if (edge & 8) {
49283
- t = (bbox2[3] - a2[1]) / (b[1] - a2[1]);
49283
+ t = (bbox[3] - a2[1]) / (b[1] - a2[1]);
49284
49284
  snap = 3;
49285
49285
  } else if (edge & 4) {
49286
- t = (bbox2[1] - a2[1]) / (b[1] - a2[1]);
49286
+ t = (bbox[1] - a2[1]) / (b[1] - a2[1]);
49287
49287
  snap = 1;
49288
49288
  } else if (edge & 2) {
49289
- t = (bbox2[2] - a2[0]) / (b[0] - a2[0]);
49289
+ t = (bbox[2] - a2[0]) / (b[0] - a2[0]);
49290
49290
  snap = 2;
49291
49291
  } else if (edge & 1) {
49292
- t = (bbox2[0] - a2[0]) / (b[0] - a2[0]);
49292
+ t = (bbox[0] - a2[0]) / (b[0] - a2[0]);
49293
49293
  snap = 0;
49294
49294
  } else {
49295
49295
  return null;
49296
49296
  }
49297
49297
  for (let i2 = 0; i2 < a2.length; i2++) {
49298
- out[i2] = (snap & 1) === i2 ? bbox2[snap] : t * (b[i2] - a2[i2]) + a2[i2];
49298
+ out[i2] = (snap & 1) === i2 ? bbox[snap] : t * (b[i2] - a2[i2]) + a2[i2];
49299
49299
  }
49300
49300
  return out;
49301
49301
  }
49302
- function bitCode(p, bbox2) {
49302
+ function bitCode(p, bbox) {
49303
49303
  let code = 0;
49304
- if (p[0] < bbox2[0]) code |= 1;
49305
- else if (p[0] > bbox2[2]) code |= 2;
49306
- if (p[1] < bbox2[1]) code |= 4;
49307
- else if (p[1] > bbox2[3]) code |= 8;
49304
+ if (p[0] < bbox[0]) code |= 1;
49305
+ else if (p[0] > bbox[2]) code |= 2;
49306
+ if (p[1] < bbox[1]) code |= 4;
49307
+ else if (p[1] > bbox[3]) code |= 8;
49308
49308
  return code;
49309
49309
  }
49310
49310
  function cutPolylineByGrid(positions, options) {
@@ -49374,7 +49374,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
49374
49374
  types: edgeTypes ? new Array(positions.length / size2).fill(TYPE_BORDER) : null,
49375
49375
  holes: holeIndices || []
49376
49376
  }];
49377
- const bbox2 = [[], []];
49377
+ const bbox = [[], []];
49378
49378
  let cell = [];
49379
49379
  while (queue.length) {
49380
49380
  const {
@@ -49382,9 +49382,9 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
49382
49382
  types,
49383
49383
  holes
49384
49384
  } = queue.shift();
49385
- getBoundingBox$2(pos, size2, holes[0] || pos.length, bbox2);
49386
- cell = getGridCell(bbox2[0], gridResolution, gridOffset, cell);
49387
- const code = bitCode(bbox2[1], cell);
49385
+ getBoundingBox$2(pos, size2, holes[0] || pos.length, bbox);
49386
+ cell = getGridCell(bbox[0], gridResolution, gridOffset, cell);
49387
+ const code = bitCode(bbox[1], cell);
49388
49388
  if (code) {
49389
49389
  let parts = bisectPolygon(pos, types, size2, 0, holes[0] || pos.length, cell, code);
49390
49390
  const polygonLow = {
@@ -49430,7 +49430,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
49430
49430
  }
49431
49431
  return result;
49432
49432
  }
49433
- function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox2, edge) {
49433
+ function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox, edge) {
49434
49434
  const numPoints = (endIndex - startIndex) / size2;
49435
49435
  const resultLow = [];
49436
49436
  const resultHigh = [];
@@ -49441,16 +49441,16 @@ function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox2,
49441
49441
  let side;
49442
49442
  let type;
49443
49443
  const prev = getPointAtIndex(positions, numPoints - 1, size2, startIndex);
49444
- let prevSide = Math.sign(edge & 8 ? prev[1] - bbox2[3] : prev[0] - bbox2[2]);
49444
+ let prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]);
49445
49445
  let prevType = edgeTypes && edgeTypes[numPoints - 1];
49446
49446
  let lowPointCount = 0;
49447
49447
  let highPointCount = 0;
49448
49448
  for (let i2 = 0; i2 < numPoints; i2++) {
49449
49449
  p = getPointAtIndex(positions, i2, size2, startIndex, p);
49450
- side = Math.sign(edge & 8 ? p[1] - bbox2[3] : p[0] - bbox2[2]);
49450
+ side = Math.sign(edge & 8 ? p[1] - bbox[3] : p[0] - bbox[2]);
49451
49451
  type = edgeTypes && edgeTypes[startIndex / size2 + i2];
49452
49452
  if (side && prevSide && prevSide !== side) {
49453
- intersect(prev, p, edge, bbox2, scratchPoint);
49453
+ intersect(prev, p, edge, bbox, scratchPoint);
49454
49454
  push(resultLow, scratchPoint) && typesLow.push(prevType);
49455
49455
  push(resultHigh, scratchPoint) && typesHigh.push(prevType);
49456
49456
  }
@@ -50582,7 +50582,7 @@ function requireEarcut() {
50582
50582
  var p = start;
50583
50583
  do {
50584
50584
  var a2 = p.prev, b = p.next.next;
50585
- if (!equals2(a2, b) && intersects2(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
50585
+ if (!equals2(a2, b) && intersects(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
50586
50586
  triangles.push(a2.i / dim | 0);
50587
50587
  triangles.push(p.i / dim | 0);
50588
50588
  triangles.push(b.i / dim | 0);
@@ -50757,7 +50757,7 @@ function requireEarcut() {
50757
50757
  function equals2(p1, p2) {
50758
50758
  return p1.x === p2.x && p1.y === p2.y;
50759
50759
  }
50760
- function intersects2(p1, q1, p2, q2) {
50760
+ function intersects(p1, q1, p2, q2) {
50761
50761
  var o1 = sign2(area2(p1, q1, p2));
50762
50762
  var o2 = sign2(area2(p1, q1, q2));
50763
50763
  var o3 = sign2(area2(p2, q2, p1));
@@ -50778,7 +50778,7 @@ function requireEarcut() {
50778
50778
  function intersectsPolygon(a2, b) {
50779
50779
  var p = a2;
50780
50780
  do {
50781
- if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i && intersects2(p, p.next, a2, b)) return true;
50781
+ if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a2, b)) return true;
50782
50782
  p = p.next;
50783
50783
  } while (p !== a2);
50784
50784
  return false;
@@ -56814,7 +56814,7 @@ class Tile2DHeader {
56814
56814
  const {
56815
56815
  index: index2,
56816
56816
  id,
56817
- bbox: bbox2,
56817
+ bbox,
56818
56818
  userData,
56819
56819
  zoom
56820
56820
  } = this;
@@ -56840,7 +56840,7 @@ class Tile2DHeader {
56840
56840
  tileData = await getData({
56841
56841
  index: index2,
56842
56842
  id,
56843
- bbox: bbox2,
56843
+ bbox,
56844
56844
  userData,
56845
56845
  zoom,
56846
56846
  signal
@@ -57714,8 +57714,8 @@ const urlType = {
57714
57714
  return true;
57715
57715
  }
57716
57716
  };
57717
- function transformBox(bbox2, modelMatrix2) {
57718
- const transformedCoords = [modelMatrix2.transformAsPoint([bbox2[0], bbox2[1]]), modelMatrix2.transformAsPoint([bbox2[2], bbox2[1]]), modelMatrix2.transformAsPoint([bbox2[0], bbox2[3]]), modelMatrix2.transformAsPoint([bbox2[2], bbox2[3]])];
57717
+ function transformBox(bbox, modelMatrix2) {
57718
+ const transformedCoords = [modelMatrix2.transformAsPoint([bbox[0], bbox[1]]), modelMatrix2.transformAsPoint([bbox[2], bbox[1]]), modelMatrix2.transformAsPoint([bbox[0], bbox[3]]), modelMatrix2.transformAsPoint([bbox[2], bbox[3]])];
57719
57719
  const transformedBox = [Math.min(...transformedCoords.map((i2) => i2[0])), Math.min(...transformedCoords.map((i2) => i2[1])), Math.max(...transformedCoords.map((i2) => i2[0])), Math.max(...transformedCoords.map((i2) => i2[1]))];
57720
57720
  return transformedBox;
57721
57721
  }
@@ -57783,12 +57783,12 @@ function getCullBoundsInViewport(viewport, z, cullRect) {
57783
57783
  const bounds1 = getCullBoundsInViewport(viewport, z[1], cullRect);
57784
57784
  return [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
57785
57785
  }
57786
- function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
57786
+ function getIndexingCoords(bbox, scale2, modelMatrixInverse) {
57787
57787
  if (modelMatrixInverse) {
57788
- const transformedTileIndex = transformBox(bbox2, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
57788
+ const transformedTileIndex = transformBox(bbox, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
57789
57789
  return transformedTileIndex;
57790
57790
  }
57791
- return bbox2.map((i2) => i2 * scale2 / TILE_SIZE$1);
57791
+ return bbox.map((i2) => i2 * scale2 / TILE_SIZE$1);
57792
57792
  }
57793
57793
  function getScale(z, tileSize) {
57794
57794
  return Math.pow(2, z) * TILE_SIZE$1 / tileSize;
@@ -57825,9 +57825,9 @@ function tileToBoundingBox(viewport, x, y, z, tileSize = TILE_SIZE$1) {
57825
57825
  };
57826
57826
  }
57827
57827
  function getIdentityTileIndices(viewport, z, tileSize, extent2, modelMatrixInverse) {
57828
- const bbox2 = getBoundingBox(viewport, null, extent2);
57828
+ const bbox = getBoundingBox(viewport, null, extent2);
57829
57829
  const scale2 = getScale(z, tileSize);
57830
- const [minX, minY, maxX, maxY] = getIndexingCoords(bbox2, scale2, modelMatrixInverse);
57830
+ const [minX, minY, maxX, maxY] = getIndexingCoords(bbox, scale2, modelMatrixInverse);
57831
57831
  const indices = [];
57832
57832
  for (let x = Math.floor(minX); x < maxX; x++) {
57833
57833
  for (let y = Math.floor(minY); y < maxY; y++) {
@@ -58016,16 +58016,16 @@ class Tileset2D {
58016
58016
  cullRect
58017
58017
  });
58018
58018
  const {
58019
- bbox: bbox2
58019
+ bbox
58020
58020
  } = tile;
58021
58021
  for (const [minX, minY, maxX, maxY] of boundsArr) {
58022
58022
  let overlaps;
58023
- if ("west" in bbox2) {
58024
- overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
58023
+ if ("west" in bbox) {
58024
+ overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
58025
58025
  } else {
58026
- const y02 = Math.min(bbox2.top, bbox2.bottom);
58027
- const y12 = Math.max(bbox2.top, bbox2.bottom);
58028
- overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
58026
+ const y02 = Math.min(bbox.top, bbox.bottom);
58027
+ const y12 = Math.max(bbox.top, bbox.bottom);
58028
+ overlaps = bbox.left < maxX && bbox.right > minX && y02 < maxY && y12 > minY;
58029
58029
  }
58030
58030
  if (overlaps) {
58031
58031
  return true;
@@ -75315,7 +75315,7 @@ class Ellipsoid {
75315
75315
  h.copy(scratchCartesian).subtract(point2);
75316
75316
  const longitude = Math.atan2(normal.y, normal.x);
75317
75317
  const latitude = Math.asin(normal.z);
75318
- const height = Math.sign(dot$4(h, scratchCartesian)) * length$4(h);
75318
+ const height = Math.sign(dot$3(h, scratchCartesian)) * length$4(h);
75319
75319
  return toCartographicFromRadians([longitude, latitude, height], result);
75320
75320
  }
75321
75321
  eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
@@ -79719,13 +79719,13 @@ class TerrainLayer extends CompositeLayer {
79719
79719
  let bottomLeft = [0, 0];
79720
79720
  let topRight = [0, 0];
79721
79721
  if (viewport.isGeospatial) {
79722
- const bbox2 = tile.bbox;
79723
- bottomLeft = viewport.projectFlat([bbox2.west, bbox2.south]);
79724
- topRight = viewport.projectFlat([bbox2.east, bbox2.north]);
79722
+ const bbox = tile.bbox;
79723
+ bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
79724
+ topRight = viewport.projectFlat([bbox.east, bbox.north]);
79725
79725
  } else {
79726
- const bbox2 = tile.bbox;
79727
- bottomLeft = [bbox2.left, bbox2.bottom];
79728
- topRight = [bbox2.right, bbox2.top];
79726
+ const bbox = tile.bbox;
79727
+ bottomLeft = [bbox.left, bbox.bottom];
79728
+ topRight = [bbox.right, bbox.top];
79729
79729
  }
79730
79730
  const bounds2 = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
79731
79731
  const terrain = this.loadTerrain({
@@ -80096,27 +80096,27 @@ function Point([pointX, pointY], [nw, se], viewport) {
80096
80096
  const y = lerp$5(nw[1], se[1], pointY);
80097
80097
  return viewport.unprojectFlat([x, y]);
80098
80098
  }
80099
- function getPoints(geometry2, bbox2, viewport) {
80100
- return geometry2.map((g2) => Point(g2, bbox2, viewport));
80099
+ function getPoints(geometry2, bbox, viewport) {
80100
+ return geometry2.map((g2) => Point(g2, bbox, viewport));
80101
80101
  }
80102
- function MultiPoint(multiPoint, bbox2, viewport) {
80103
- return getPoints(multiPoint, bbox2, viewport);
80102
+ function MultiPoint(multiPoint, bbox, viewport) {
80103
+ return getPoints(multiPoint, bbox, viewport);
80104
80104
  }
80105
- function LineString(line, bbox2, viewport) {
80106
- return getPoints(line, bbox2, viewport);
80105
+ function LineString(line, bbox, viewport) {
80106
+ return getPoints(line, bbox, viewport);
80107
80107
  }
80108
- function MultiLineString(multiLineString, bbox2, viewport) {
80109
- return multiLineString.map((lineString2) => LineString(lineString2, bbox2, viewport));
80108
+ function MultiLineString(multiLineString, bbox, viewport) {
80109
+ return multiLineString.map((lineString) => LineString(lineString, bbox, viewport));
80110
80110
  }
80111
- function Polygon(polygon2, bbox2, viewport) {
80112
- return polygon2.map((polygonRing) => getPoints(polygonRing, bbox2, viewport));
80111
+ function Polygon(polygon2, bbox, viewport) {
80112
+ return polygon2.map((polygonRing) => getPoints(polygonRing, bbox, viewport));
80113
80113
  }
80114
- function MultiPolygon(multiPolygon2, bbox2, viewport) {
80115
- return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox2, viewport));
80114
+ function MultiPolygon(multiPolygon2, bbox, viewport) {
80115
+ return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox, viewport));
80116
80116
  }
80117
- function transform$1(geometry2, bbox2, viewport) {
80118
- const nw = viewport.projectFlat([bbox2.west, bbox2.north]);
80119
- const se = viewport.projectFlat([bbox2.east, bbox2.south]);
80117
+ function transform$1(geometry2, bbox, viewport) {
80118
+ const nw = viewport.projectFlat([bbox.west, bbox.north]);
80119
+ const se = viewport.projectFlat([bbox.east, bbox.south]);
80120
80120
  const projectedBbox = [nw, se];
80121
80121
  return {
80122
80122
  ...geometry2,
@@ -80506,11 +80506,11 @@ class MVTLayer extends TileLayer {
80506
80506
  return [];
80507
80507
  }
80508
80508
  const {
80509
- bbox: bbox2
80509
+ bbox
80510
80510
  } = tile;
80511
- if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox2)) {
80511
+ if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox)) {
80512
80512
  const content = this.state.binary ? binaryToGeojson(tile.content) : tile.content;
80513
- tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox2, this.context.viewport));
80513
+ tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox, this.context.viewport));
80514
80514
  }
80515
80515
  return tile._contentWGS84;
80516
80516
  }
@@ -80537,7 +80537,7 @@ function getFeatureLayerName(feature2) {
80537
80537
  function isFeatureIdDefined(value) {
80538
80538
  return value !== void 0 && value !== null && value !== "";
80539
80539
  }
80540
- function transformTileCoordsToWGS84(object2, bbox2, viewport) {
80540
+ function transformTileCoordsToWGS84(object2, bbox, viewport) {
80541
80541
  const feature2 = {
80542
80542
  ...object2,
80543
80543
  geometry: {
@@ -80546,7 +80546,7 @@ function transformTileCoordsToWGS84(object2, bbox2, viewport) {
80546
80546
  };
80547
80547
  Object.defineProperty(feature2.geometry, "coordinates", {
80548
80548
  get: () => {
80549
- const wgs84Geom = transform$1(object2.geometry, bbox2, viewport);
80549
+ const wgs84Geom = transform$1(object2.geometry, bbox, viewport);
80550
80550
  return wgs84Geom.coordinates;
80551
80551
  }
80552
80552
  });
@@ -80717,16 +80717,6 @@ function polygons(coordinates2, properties, options = {}) {
80717
80717
  options
80718
80718
  );
80719
80719
  }
80720
- function lineString(coordinates2, properties, options = {}) {
80721
- if (coordinates2.length < 2) {
80722
- throw new Error("coordinates must be an array of two or more positions");
80723
- }
80724
- const geom = {
80725
- type: "LineString",
80726
- coordinates: coordinates2
80727
- };
80728
- return feature$1(geom, properties, options);
80729
- }
80730
80720
  function featureCollection(features, options = {}) {
80731
80721
  const fc = { type: "FeatureCollection" };
80732
80722
  if (options.id) {
@@ -80752,10 +80742,6 @@ function radiansToLength(radians2, units = "kilometers") {
80752
80742
  }
80753
80743
  return radians2 * factor;
80754
80744
  }
80755
- function radiansToDegrees(radians2) {
80756
- const normalisedRadians = radians2 % (2 * Math.PI);
80757
- return normalisedRadians * 180 / Math.PI;
80758
- }
80759
80745
  function degreesToRadians(degrees2) {
80760
80746
  const normalisedDegrees = degrees2 % 360;
80761
80747
  return normalisedDegrees * Math.PI / 180;
@@ -80763,428 +80749,6 @@ function degreesToRadians(degrees2) {
80763
80749
  function isNumber(num) {
80764
80750
  return !isNaN(num) && num !== null && !Array.isArray(num);
80765
80751
  }
80766
- function isObject$1(input) {
80767
- return input !== null && typeof input === "object" && !Array.isArray(input);
80768
- }
80769
- function coordEach(geojson, callback, excludeWrapCoord) {
80770
- if (geojson === null) return;
80771
- var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
80772
- for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
80773
- geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
80774
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
80775
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
80776
- for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
80777
- var multiFeatureIndex = 0;
80778
- var geometryIndex = 0;
80779
- geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
80780
- if (geometry2 === null) continue;
80781
- coords = geometry2.coordinates;
80782
- var geomType = geometry2.type;
80783
- wrapShrink = 0;
80784
- switch (geomType) {
80785
- case null:
80786
- break;
80787
- case "Point":
80788
- if (callback(
80789
- coords,
80790
- coordIndex,
80791
- featureIndex,
80792
- multiFeatureIndex,
80793
- geometryIndex
80794
- ) === false)
80795
- return false;
80796
- coordIndex++;
80797
- multiFeatureIndex++;
80798
- break;
80799
- case "LineString":
80800
- case "MultiPoint":
80801
- for (j = 0; j < coords.length; j++) {
80802
- if (callback(
80803
- coords[j],
80804
- coordIndex,
80805
- featureIndex,
80806
- multiFeatureIndex,
80807
- geometryIndex
80808
- ) === false)
80809
- return false;
80810
- coordIndex++;
80811
- if (geomType === "MultiPoint") multiFeatureIndex++;
80812
- }
80813
- if (geomType === "LineString") multiFeatureIndex++;
80814
- break;
80815
- case "Polygon":
80816
- case "MultiLineString":
80817
- for (j = 0; j < coords.length; j++) {
80818
- for (k = 0; k < coords[j].length - wrapShrink; k++) {
80819
- if (callback(
80820
- coords[j][k],
80821
- coordIndex,
80822
- featureIndex,
80823
- multiFeatureIndex,
80824
- geometryIndex
80825
- ) === false)
80826
- return false;
80827
- coordIndex++;
80828
- }
80829
- if (geomType === "MultiLineString") multiFeatureIndex++;
80830
- if (geomType === "Polygon") geometryIndex++;
80831
- }
80832
- if (geomType === "Polygon") multiFeatureIndex++;
80833
- break;
80834
- case "MultiPolygon":
80835
- for (j = 0; j < coords.length; j++) {
80836
- geometryIndex = 0;
80837
- for (k = 0; k < coords[j].length; k++) {
80838
- for (l2 = 0; l2 < coords[j][k].length - wrapShrink; l2++) {
80839
- if (callback(
80840
- coords[j][k][l2],
80841
- coordIndex,
80842
- featureIndex,
80843
- multiFeatureIndex,
80844
- geometryIndex
80845
- ) === false)
80846
- return false;
80847
- coordIndex++;
80848
- }
80849
- geometryIndex++;
80850
- }
80851
- multiFeatureIndex++;
80852
- }
80853
- break;
80854
- case "GeometryCollection":
80855
- for (j = 0; j < geometry2.geometries.length; j++)
80856
- if (coordEach(geometry2.geometries[j], callback) === false)
80857
- return false;
80858
- break;
80859
- default:
80860
- throw new Error("Unknown Geometry Type");
80861
- }
80862
- }
80863
- }
80864
- }
80865
- function featureEach(geojson, callback) {
80866
- if (geojson.type === "Feature") {
80867
- callback(geojson, 0);
80868
- } else if (geojson.type === "FeatureCollection") {
80869
- for (var i2 = 0; i2 < geojson.features.length; i2++) {
80870
- if (callback(geojson.features[i2], i2) === false) break;
80871
- }
80872
- }
80873
- }
80874
- function geomEach(geojson, callback) {
80875
- var i2, j, g2, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId2, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
80876
- for (i2 = 0; i2 < stop; i2++) {
80877
- geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
80878
- featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
80879
- featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
80880
- featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
80881
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
80882
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
80883
- for (g2 = 0; g2 < stopG; g2++) {
80884
- geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
80885
- if (geometry2 === null) {
80886
- if (callback(
80887
- null,
80888
- featureIndex,
80889
- featureProperties,
80890
- featureBBox,
80891
- featureId2
80892
- ) === false)
80893
- return false;
80894
- continue;
80895
- }
80896
- switch (geometry2.type) {
80897
- case "Point":
80898
- case "LineString":
80899
- case "MultiPoint":
80900
- case "Polygon":
80901
- case "MultiLineString":
80902
- case "MultiPolygon": {
80903
- if (callback(
80904
- geometry2,
80905
- featureIndex,
80906
- featureProperties,
80907
- featureBBox,
80908
- featureId2
80909
- ) === false)
80910
- return false;
80911
- break;
80912
- }
80913
- case "GeometryCollection": {
80914
- for (j = 0; j < geometry2.geometries.length; j++) {
80915
- if (callback(
80916
- geometry2.geometries[j],
80917
- featureIndex,
80918
- featureProperties,
80919
- featureBBox,
80920
- featureId2
80921
- ) === false)
80922
- return false;
80923
- }
80924
- break;
80925
- }
80926
- default:
80927
- throw new Error("Unknown Geometry Type");
80928
- }
80929
- }
80930
- featureIndex++;
80931
- }
80932
- }
80933
- function geomReduce(geojson, callback, initialValue) {
80934
- var previousValue = initialValue;
80935
- geomEach(
80936
- geojson,
80937
- function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
80938
- previousValue = callback(
80939
- previousValue,
80940
- currentGeometry,
80941
- featureIndex,
80942
- featureProperties,
80943
- featureBBox,
80944
- featureId2
80945
- );
80946
- }
80947
- );
80948
- return previousValue;
80949
- }
80950
- function flattenEach(geojson, callback) {
80951
- geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
80952
- var type = geometry2 === null ? null : geometry2.type;
80953
- switch (type) {
80954
- case null:
80955
- case "Point":
80956
- case "LineString":
80957
- case "Polygon":
80958
- if (callback(
80959
- feature$1(geometry2, properties, { bbox: bbox2, id }),
80960
- featureIndex,
80961
- 0
80962
- ) === false)
80963
- return false;
80964
- return;
80965
- }
80966
- var geomType;
80967
- switch (type) {
80968
- case "MultiPoint":
80969
- geomType = "Point";
80970
- break;
80971
- case "MultiLineString":
80972
- geomType = "LineString";
80973
- break;
80974
- case "MultiPolygon":
80975
- geomType = "Polygon";
80976
- break;
80977
- }
80978
- for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
80979
- var coordinate = geometry2.coordinates[multiFeatureIndex];
80980
- var geom = {
80981
- type: geomType,
80982
- coordinates: coordinate
80983
- };
80984
- if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
80985
- return false;
80986
- }
80987
- });
80988
- }
80989
- function flattenReduce(geojson, callback, initialValue) {
80990
- var previousValue = initialValue;
80991
- flattenEach(
80992
- geojson,
80993
- function(currentFeature, featureIndex, multiFeatureIndex) {
80994
- if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
80995
- previousValue = currentFeature;
80996
- else
80997
- previousValue = callback(
80998
- previousValue,
80999
- currentFeature,
81000
- featureIndex,
81001
- multiFeatureIndex
81002
- );
81003
- }
81004
- );
81005
- return previousValue;
81006
- }
81007
- function segmentEach(geojson, callback) {
81008
- flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
81009
- var segmentIndex = 0;
81010
- if (!feature2.geometry) return;
81011
- var type = feature2.geometry.type;
81012
- if (type === "Point" || type === "MultiPoint") return;
81013
- var previousCoords;
81014
- var previousFeatureIndex = 0;
81015
- var previousMultiIndex = 0;
81016
- var prevGeomIndex = 0;
81017
- if (coordEach(
81018
- feature2,
81019
- function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
81020
- if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
81021
- previousCoords = currentCoord;
81022
- previousFeatureIndex = featureIndex;
81023
- previousMultiIndex = multiPartIndexCoord;
81024
- prevGeomIndex = geometryIndex;
81025
- segmentIndex = 0;
81026
- return;
81027
- }
81028
- var currentSegment = lineString(
81029
- [previousCoords, currentCoord],
81030
- feature2.properties
81031
- );
81032
- if (callback(
81033
- currentSegment,
81034
- featureIndex,
81035
- multiFeatureIndex,
81036
- geometryIndex,
81037
- segmentIndex
81038
- ) === false)
81039
- return false;
81040
- segmentIndex++;
81041
- previousCoords = currentCoord;
81042
- }
81043
- ) === false)
81044
- return false;
81045
- });
81046
- }
81047
- function bbox$1(geojson, options = {}) {
81048
- if (geojson.bbox != null && true !== options.recompute) {
81049
- return geojson.bbox;
81050
- }
81051
- const result = [Infinity, Infinity, -Infinity, -Infinity];
81052
- coordEach(geojson, (coord) => {
81053
- if (result[0] > coord[0]) {
81054
- result[0] = coord[0];
81055
- }
81056
- if (result[1] > coord[1]) {
81057
- result[1] = coord[1];
81058
- }
81059
- if (result[2] < coord[0]) {
81060
- result[2] = coord[0];
81061
- }
81062
- if (result[3] < coord[1]) {
81063
- result[3] = coord[1];
81064
- }
81065
- });
81066
- return result;
81067
- }
81068
- function getCoord(coord) {
81069
- if (!coord) {
81070
- throw new Error("coord is required");
81071
- }
81072
- if (!Array.isArray(coord)) {
81073
- if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
81074
- return [...coord.geometry.coordinates];
81075
- }
81076
- if (coord.type === "Point") {
81077
- return [...coord.coordinates];
81078
- }
81079
- }
81080
- if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
81081
- return [...coord];
81082
- }
81083
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
81084
- }
81085
- function getCoords(coords) {
81086
- if (Array.isArray(coords)) {
81087
- return coords;
81088
- }
81089
- if (coords.type === "Feature") {
81090
- if (coords.geometry !== null) {
81091
- return coords.geometry.coordinates;
81092
- }
81093
- } else {
81094
- if (coords.coordinates) {
81095
- return coords.coordinates;
81096
- }
81097
- }
81098
- throw new Error(
81099
- "coords must be GeoJSON Feature, Geometry Object or an Array"
81100
- );
81101
- }
81102
- function getGeom(geojson) {
81103
- if (geojson.type === "Feature") {
81104
- return geojson.geometry;
81105
- }
81106
- return geojson;
81107
- }
81108
- function booleanPointOnLine(pt, line, options = {}) {
81109
- const ptCoords = getCoord(pt);
81110
- const lineCoords = getCoords(line);
81111
- for (let i2 = 0; i2 < lineCoords.length - 1; i2++) {
81112
- let ignoreBoundary = false;
81113
- if (options.ignoreEndVertices) {
81114
- if (i2 === 0) {
81115
- ignoreBoundary = "start";
81116
- }
81117
- if (i2 === lineCoords.length - 2) {
81118
- ignoreBoundary = "end";
81119
- }
81120
- if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
81121
- ignoreBoundary = "both";
81122
- }
81123
- }
81124
- if (isPointOnLineSegment(
81125
- lineCoords[i2],
81126
- lineCoords[i2 + 1],
81127
- ptCoords,
81128
- ignoreBoundary,
81129
- typeof options.epsilon === "undefined" ? null : options.epsilon
81130
- )) {
81131
- return true;
81132
- }
81133
- }
81134
- return false;
81135
- }
81136
- function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon3) {
81137
- const x = pt[0];
81138
- const y = pt[1];
81139
- const x12 = lineSegmentStart[0];
81140
- const y12 = lineSegmentStart[1];
81141
- const x2 = lineSegmentEnd[0];
81142
- const y2 = lineSegmentEnd[1];
81143
- const dxc = pt[0] - x12;
81144
- const dyc = pt[1] - y12;
81145
- const dxl = x2 - x12;
81146
- const dyl = y2 - y12;
81147
- const cross2 = dxc * dyl - dyc * dxl;
81148
- if (epsilon3 !== null) {
81149
- if (Math.abs(cross2) > epsilon3) {
81150
- return false;
81151
- }
81152
- } else if (cross2 !== 0) {
81153
- return false;
81154
- }
81155
- if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {
81156
- if (excludeBoundary) {
81157
- return false;
81158
- }
81159
- if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {
81160
- return true;
81161
- } else {
81162
- return false;
81163
- }
81164
- }
81165
- if (!excludeBoundary) {
81166
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81167
- return dxl > 0 ? x12 <= x && x <= x2 : x2 <= x && x <= x12;
81168
- }
81169
- return dyl > 0 ? y12 <= y && y <= y2 : y2 <= y && y <= y12;
81170
- } else if (excludeBoundary === "start") {
81171
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81172
- return dxl > 0 ? x12 < x && x <= x2 : x2 <= x && x < x12;
81173
- }
81174
- return dyl > 0 ? y12 < y && y <= y2 : y2 <= y && y < y12;
81175
- } else if (excludeBoundary === "end") {
81176
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81177
- return dxl > 0 ? x12 <= x && x < x2 : x2 < x && x <= x12;
81178
- }
81179
- return dyl > 0 ? y12 <= y && y < y2 : y2 < y && y <= y12;
81180
- } else if (excludeBoundary === "both") {
81181
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81182
- return dxl > 0 ? x12 < x && x < x2 : x2 < x && x < x12;
81183
- }
81184
- return dyl > 0 ? y12 < y && y < y2 : y2 < y && y < y12;
81185
- }
81186
- return false;
81187
- }
81188
80752
  const epsilon$1 = 11102230246251565e-32;
81189
80753
  const splitter = 134217729;
81190
80754
  const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1;
@@ -81481,6 +81045,29 @@ function pointInPolygon(p, polygon2) {
81481
81045
  }
81482
81046
  return true;
81483
81047
  }
81048
+ function getCoord(coord) {
81049
+ if (!coord) {
81050
+ throw new Error("coord is required");
81051
+ }
81052
+ if (!Array.isArray(coord)) {
81053
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
81054
+ return [...coord.geometry.coordinates];
81055
+ }
81056
+ if (coord.type === "Point") {
81057
+ return [...coord.coordinates];
81058
+ }
81059
+ }
81060
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
81061
+ return [...coord];
81062
+ }
81063
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
81064
+ }
81065
+ function getGeom(geojson) {
81066
+ if (geojson.type === "Feature") {
81067
+ return geojson.geometry;
81068
+ }
81069
+ return geojson;
81070
+ }
81484
81071
  function booleanPointInPolygon(point2, polygon2, options = {}) {
81485
81072
  if (!point2) {
81486
81073
  throw new Error("point is required");
@@ -81491,9 +81078,9 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
81491
81078
  const pt = getCoord(point2);
81492
81079
  const geom = getGeom(polygon2);
81493
81080
  const type = geom.type;
81494
- const bbox2 = polygon2.bbox;
81081
+ const bbox = polygon2.bbox;
81495
81082
  let polys = geom.coordinates;
81496
- if (bbox2 && inBBox(pt, bbox2) === false) {
81083
+ if (bbox && inBBox(pt, bbox) === false) {
81497
81084
  return false;
81498
81085
  }
81499
81086
  if (type === "Polygon") {
@@ -81507,1607 +81094,8 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
81507
81094
  }
81508
81095
  return result;
81509
81096
  }
81510
- function inBBox(pt, bbox2) {
81511
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
81512
- }
81513
- function booleanWithin(feature1, feature2) {
81514
- var geom1 = getGeom(feature1);
81515
- var geom2 = getGeom(feature2);
81516
- var type1 = geom1.type;
81517
- var type2 = geom2.type;
81518
- switch (type1) {
81519
- case "Point":
81520
- switch (type2) {
81521
- case "MultiPoint":
81522
- return isPointInMultiPoint$1(geom1, geom2);
81523
- case "LineString":
81524
- return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
81525
- case "Polygon":
81526
- case "MultiPolygon":
81527
- return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
81528
- default:
81529
- throw new Error("feature2 " + type2 + " geometry not supported");
81530
- }
81531
- case "MultiPoint":
81532
- switch (type2) {
81533
- case "MultiPoint":
81534
- return isMultiPointInMultiPoint$1(geom1, geom2);
81535
- case "LineString":
81536
- return isMultiPointOnLine$1(geom1, geom2);
81537
- case "Polygon":
81538
- case "MultiPolygon":
81539
- return isMultiPointInPoly$1(geom1, geom2);
81540
- default:
81541
- throw new Error("feature2 " + type2 + " geometry not supported");
81542
- }
81543
- case "LineString":
81544
- switch (type2) {
81545
- case "LineString":
81546
- return isLineOnLine$1(geom1, geom2);
81547
- case "Polygon":
81548
- case "MultiPolygon":
81549
- return isLineInPoly$1(geom1, geom2);
81550
- default:
81551
- throw new Error("feature2 " + type2 + " geometry not supported");
81552
- }
81553
- case "Polygon":
81554
- switch (type2) {
81555
- case "Polygon":
81556
- case "MultiPolygon":
81557
- return isPolyInPoly$1(geom1, geom2);
81558
- default:
81559
- throw new Error("feature2 " + type2 + " geometry not supported");
81560
- }
81561
- default:
81562
- throw new Error("feature1 " + type1 + " geometry not supported");
81563
- }
81564
- }
81565
- function isPointInMultiPoint$1(point2, multiPoint) {
81566
- var i2;
81567
- var output = false;
81568
- for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81569
- if (compareCoords$1(multiPoint.coordinates[i2], point2.coordinates)) {
81570
- output = true;
81571
- break;
81572
- }
81573
- }
81574
- return output;
81575
- }
81576
- function isMultiPointInMultiPoint$1(multiPoint1, multiPoint2) {
81577
- for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
81578
- var anyMatch = false;
81579
- for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
81580
- if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
81581
- anyMatch = true;
81582
- }
81583
- }
81584
- if (!anyMatch) {
81585
- return false;
81586
- }
81587
- }
81588
- return true;
81589
- }
81590
- function isMultiPointOnLine$1(multiPoint, lineString2) {
81591
- var foundInsidePoint = false;
81592
- for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81593
- if (!booleanPointOnLine(multiPoint.coordinates[i2], lineString2)) {
81594
- return false;
81595
- }
81596
- if (!foundInsidePoint) {
81597
- foundInsidePoint = booleanPointOnLine(
81598
- multiPoint.coordinates[i2],
81599
- lineString2,
81600
- { ignoreEndVertices: true }
81601
- );
81602
- }
81603
- }
81604
- return foundInsidePoint;
81605
- }
81606
- function isMultiPointInPoly$1(multiPoint, polygon2) {
81607
- var output = true;
81608
- var isInside = false;
81609
- for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81610
- isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2);
81611
- if (!isInside) {
81612
- output = false;
81613
- break;
81614
- }
81615
- {
81616
- isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2, {
81617
- ignoreBoundary: true
81618
- });
81619
- }
81620
- }
81621
- return output && isInside;
81622
- }
81623
- function isLineOnLine$1(lineString1, lineString2) {
81624
- for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
81625
- if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
81626
- return false;
81627
- }
81628
- }
81629
- return true;
81630
- }
81631
- function isLineInPoly$1(linestring, polygon2) {
81632
- var polyBbox = bbox$1(polygon2);
81633
- var lineBbox = bbox$1(linestring);
81634
- if (!doBBoxOverlap$1(polyBbox, lineBbox)) {
81635
- return false;
81636
- }
81637
- var foundInsidePoint = false;
81638
- for (var i2 = 0; i2 < linestring.coordinates.length; i2++) {
81639
- if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
81640
- return false;
81641
- }
81642
- if (!foundInsidePoint) {
81643
- foundInsidePoint = booleanPointInPolygon(
81644
- linestring.coordinates[i2],
81645
- polygon2,
81646
- { ignoreBoundary: true }
81647
- );
81648
- }
81649
- if (!foundInsidePoint && i2 < linestring.coordinates.length - 1) {
81650
- var midpoint = getMidpoint$1(
81651
- linestring.coordinates[i2],
81652
- linestring.coordinates[i2 + 1]
81653
- );
81654
- foundInsidePoint = booleanPointInPolygon(midpoint, polygon2, {
81655
- ignoreBoundary: true
81656
- });
81657
- }
81658
- }
81659
- return foundInsidePoint;
81660
- }
81661
- function isPolyInPoly$1(geometry1, geometry2) {
81662
- var poly1Bbox = bbox$1(geometry1);
81663
- var poly2Bbox = bbox$1(geometry2);
81664
- if (!doBBoxOverlap$1(poly2Bbox, poly1Bbox)) {
81665
- return false;
81666
- }
81667
- for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
81668
- if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
81669
- return false;
81670
- }
81671
- }
81672
- return true;
81673
- }
81674
- function doBBoxOverlap$1(bbox1, bbox2) {
81675
- if (bbox1[0] > bbox2[0]) return false;
81676
- if (bbox1[2] < bbox2[2]) return false;
81677
- if (bbox1[1] > bbox2[1]) return false;
81678
- if (bbox1[3] < bbox2[3]) return false;
81679
- return true;
81680
- }
81681
- function compareCoords$1(pair1, pair2) {
81682
- return pair1[0] === pair2[0] && pair1[1] === pair2[1];
81683
- }
81684
- function getMidpoint$1(pair1, pair2) {
81685
- return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
81686
- }
81687
- function booleanContains(feature1, feature2) {
81688
- const geom1 = getGeom(feature1);
81689
- const geom2 = getGeom(feature2);
81690
- const type1 = geom1.type;
81691
- const type2 = geom2.type;
81692
- const coords1 = geom1.coordinates;
81693
- const coords2 = geom2.coordinates;
81694
- switch (type1) {
81695
- case "Point":
81696
- switch (type2) {
81697
- case "Point":
81698
- return compareCoords(coords1, coords2);
81699
- default:
81700
- throw new Error("feature2 " + type2 + " geometry not supported");
81701
- }
81702
- case "MultiPoint":
81703
- switch (type2) {
81704
- case "Point":
81705
- return isPointInMultiPoint(geom1, geom2);
81706
- case "MultiPoint":
81707
- return isMultiPointInMultiPoint(geom1, geom2);
81708
- default:
81709
- throw new Error("feature2 " + type2 + " geometry not supported");
81710
- }
81711
- case "LineString":
81712
- switch (type2) {
81713
- case "Point":
81714
- return booleanPointOnLine(geom2, geom1, { ignoreEndVertices: true });
81715
- case "LineString":
81716
- return isLineOnLine(geom1, geom2);
81717
- case "MultiPoint":
81718
- return isMultiPointOnLine(geom1, geom2);
81719
- default:
81720
- throw new Error("feature2 " + type2 + " geometry not supported");
81721
- }
81722
- case "Polygon":
81723
- switch (type2) {
81724
- case "Point":
81725
- return booleanPointInPolygon(geom2, geom1, { ignoreBoundary: true });
81726
- case "LineString":
81727
- return isLineInPoly(geom1, geom2);
81728
- case "Polygon":
81729
- return isPolyInPoly(geom1, geom2);
81730
- case "MultiPoint":
81731
- return isMultiPointInPoly(geom1, geom2);
81732
- default:
81733
- throw new Error("feature2 " + type2 + " geometry not supported");
81734
- }
81735
- case "MultiPolygon":
81736
- switch (type2) {
81737
- case "Polygon":
81738
- return isPolygonInMultiPolygon(geom1, geom2);
81739
- default:
81740
- throw new Error("feature2 " + type2 + " geometry not supported");
81741
- }
81742
- default:
81743
- throw new Error("feature1 " + type1 + " geometry not supported");
81744
- }
81745
- }
81746
- function isPolygonInMultiPolygon(multiPolygon2, polygon2) {
81747
- return multiPolygon2.coordinates.some(
81748
- (coords) => isPolyInPoly({ type: "Polygon", coordinates: coords }, polygon2)
81749
- );
81750
- }
81751
- function isPointInMultiPoint(multiPoint, pt) {
81752
- let i2;
81753
- let output = false;
81754
- for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81755
- if (compareCoords(multiPoint.coordinates[i2], pt.coordinates)) {
81756
- output = true;
81757
- break;
81758
- }
81759
- }
81760
- return output;
81761
- }
81762
- function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
81763
- for (const coord2 of multiPoint2.coordinates) {
81764
- let matchFound = false;
81765
- for (const coord1 of multiPoint1.coordinates) {
81766
- if (compareCoords(coord2, coord1)) {
81767
- matchFound = true;
81768
- break;
81769
- }
81770
- }
81771
- if (!matchFound) {
81772
- return false;
81773
- }
81774
- }
81775
- return true;
81776
- }
81777
- function isMultiPointOnLine(lineString2, multiPoint) {
81778
- let haveFoundInteriorPoint = false;
81779
- for (const coord of multiPoint.coordinates) {
81780
- if (booleanPointOnLine(coord, lineString2, { ignoreEndVertices: true })) {
81781
- haveFoundInteriorPoint = true;
81782
- }
81783
- if (!booleanPointOnLine(coord, lineString2)) {
81784
- return false;
81785
- }
81786
- }
81787
- if (haveFoundInteriorPoint) {
81788
- return true;
81789
- }
81790
- return false;
81791
- }
81792
- function isMultiPointInPoly(polygon2, multiPoint) {
81793
- for (const coord of multiPoint.coordinates) {
81794
- if (!booleanPointInPolygon(coord, polygon2, { ignoreBoundary: true })) {
81795
- return false;
81796
- }
81797
- }
81798
- return true;
81799
- }
81800
- function isLineOnLine(lineString1, lineString2) {
81801
- let haveFoundInteriorPoint = false;
81802
- for (const coords of lineString2.coordinates) {
81803
- if (booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
81804
- ignoreEndVertices: true
81805
- })) {
81806
- haveFoundInteriorPoint = true;
81807
- }
81808
- if (!booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
81809
- ignoreEndVertices: false
81810
- })) {
81811
- return false;
81812
- }
81813
- }
81814
- return haveFoundInteriorPoint;
81815
- }
81816
- function isLineInPoly(polygon2, linestring) {
81817
- let output = false;
81818
- let i2 = 0;
81819
- const polyBbox = bbox$1(polygon2);
81820
- const lineBbox = bbox$1(linestring);
81821
- if (!doBBoxOverlap(polyBbox, lineBbox)) {
81822
- return false;
81823
- }
81824
- for (i2; i2 < linestring.coordinates.length - 1; i2++) {
81825
- const midPoint = getMidpoint(
81826
- linestring.coordinates[i2],
81827
- linestring.coordinates[i2 + 1]
81828
- );
81829
- if (booleanPointInPolygon({ type: "Point", coordinates: midPoint }, polygon2, {
81830
- ignoreBoundary: true
81831
- })) {
81832
- output = true;
81833
- break;
81834
- }
81835
- }
81836
- return output;
81837
- }
81838
- function isPolyInPoly(feature1, feature2) {
81839
- if (feature1.type === "Feature" && feature1.geometry === null) {
81840
- return false;
81841
- }
81842
- if (feature2.type === "Feature" && feature2.geometry === null) {
81843
- return false;
81844
- }
81845
- const poly1Bbox = bbox$1(feature1);
81846
- const poly2Bbox = bbox$1(feature2);
81847
- if (!doBBoxOverlap(poly1Bbox, poly2Bbox)) {
81848
- return false;
81849
- }
81850
- const coords = getGeom(feature2).coordinates;
81851
- for (const ring of coords) {
81852
- for (const coord of ring) {
81853
- if (!booleanPointInPolygon(coord, feature1)) {
81854
- return false;
81855
- }
81856
- }
81857
- }
81858
- return true;
81859
- }
81860
- function doBBoxOverlap(bbox1, bbox2) {
81861
- if (bbox1[0] > bbox2[0]) {
81862
- return false;
81863
- }
81864
- if (bbox1[2] < bbox2[2]) {
81865
- return false;
81866
- }
81867
- if (bbox1[1] > bbox2[1]) {
81868
- return false;
81869
- }
81870
- if (bbox1[3] < bbox2[3]) {
81871
- return false;
81872
- }
81873
- return true;
81874
- }
81875
- function compareCoords(pair1, pair2) {
81876
- return pair1[0] === pair2[0] && pair1[1] === pair2[1];
81877
- }
81878
- function getMidpoint(pair1, pair2) {
81879
- return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
81880
- }
81881
- function quickselect(arr, k, left, right, compare2) {
81882
- quickselectStep(arr, k, left || 0, right || arr.length - 1, compare2 || defaultCompare$1);
81883
- }
81884
- function quickselectStep(arr, k, left, right, compare2) {
81885
- while (right > left) {
81886
- if (right - left > 600) {
81887
- var n3 = right - left + 1;
81888
- var m = k - left + 1;
81889
- var z = Math.log(n3);
81890
- var s2 = 0.5 * Math.exp(2 * z / 3);
81891
- var sd = 0.5 * Math.sqrt(z * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
81892
- var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
81893
- var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
81894
- quickselectStep(arr, k, newLeft, newRight, compare2);
81895
- }
81896
- var t = arr[k];
81897
- var i2 = left;
81898
- var j = right;
81899
- swap(arr, left, k);
81900
- if (compare2(arr[right], t) > 0) swap(arr, left, right);
81901
- while (i2 < j) {
81902
- swap(arr, i2, j);
81903
- i2++;
81904
- j--;
81905
- while (compare2(arr[i2], t) < 0) i2++;
81906
- while (compare2(arr[j], t) > 0) j--;
81907
- }
81908
- if (compare2(arr[left], t) === 0) swap(arr, left, j);
81909
- else {
81910
- j++;
81911
- swap(arr, j, right);
81912
- }
81913
- if (j <= k) left = j + 1;
81914
- if (k <= j) right = j - 1;
81915
- }
81916
- }
81917
- function swap(arr, i2, j) {
81918
- var tmp = arr[i2];
81919
- arr[i2] = arr[j];
81920
- arr[j] = tmp;
81921
- }
81922
- function defaultCompare$1(a2, b) {
81923
- return a2 < b ? -1 : a2 > b ? 1 : 0;
81924
- }
81925
- class RBush {
81926
- constructor(maxEntries = 9) {
81927
- this._maxEntries = Math.max(4, maxEntries);
81928
- this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
81929
- this.clear();
81930
- }
81931
- all() {
81932
- return this._all(this.data, []);
81933
- }
81934
- search(bbox2) {
81935
- let node2 = this.data;
81936
- const result = [];
81937
- if (!intersects(bbox2, node2)) return result;
81938
- const toBBox = this.toBBox;
81939
- const nodesToSearch = [];
81940
- while (node2) {
81941
- for (let i2 = 0; i2 < node2.children.length; i2++) {
81942
- const child = node2.children[i2];
81943
- const childBBox = node2.leaf ? toBBox(child) : child;
81944
- if (intersects(bbox2, childBBox)) {
81945
- if (node2.leaf) result.push(child);
81946
- else if (contains$1(bbox2, childBBox)) this._all(child, result);
81947
- else nodesToSearch.push(child);
81948
- }
81949
- }
81950
- node2 = nodesToSearch.pop();
81951
- }
81952
- return result;
81953
- }
81954
- collides(bbox2) {
81955
- let node2 = this.data;
81956
- if (!intersects(bbox2, node2)) return false;
81957
- const nodesToSearch = [];
81958
- while (node2) {
81959
- for (let i2 = 0; i2 < node2.children.length; i2++) {
81960
- const child = node2.children[i2];
81961
- const childBBox = node2.leaf ? this.toBBox(child) : child;
81962
- if (intersects(bbox2, childBBox)) {
81963
- if (node2.leaf || contains$1(bbox2, childBBox)) return true;
81964
- nodesToSearch.push(child);
81965
- }
81966
- }
81967
- node2 = nodesToSearch.pop();
81968
- }
81969
- return false;
81970
- }
81971
- load(data) {
81972
- if (!(data && data.length)) return this;
81973
- if (data.length < this._minEntries) {
81974
- for (let i2 = 0; i2 < data.length; i2++) {
81975
- this.insert(data[i2]);
81976
- }
81977
- return this;
81978
- }
81979
- let node2 = this._build(data.slice(), 0, data.length - 1, 0);
81980
- if (!this.data.children.length) {
81981
- this.data = node2;
81982
- } else if (this.data.height === node2.height) {
81983
- this._splitRoot(this.data, node2);
81984
- } else {
81985
- if (this.data.height < node2.height) {
81986
- const tmpNode = this.data;
81987
- this.data = node2;
81988
- node2 = tmpNode;
81989
- }
81990
- this._insert(node2, this.data.height - node2.height - 1, true);
81991
- }
81992
- return this;
81993
- }
81994
- insert(item) {
81995
- if (item) this._insert(item, this.data.height - 1);
81996
- return this;
81997
- }
81998
- clear() {
81999
- this.data = createNode([]);
82000
- return this;
82001
- }
82002
- remove(item, equalsFn) {
82003
- if (!item) return this;
82004
- let node2 = this.data;
82005
- const bbox2 = this.toBBox(item);
82006
- const path = [];
82007
- const indexes = [];
82008
- let i2, parent, goingUp;
82009
- while (node2 || path.length) {
82010
- if (!node2) {
82011
- node2 = path.pop();
82012
- parent = path[path.length - 1];
82013
- i2 = indexes.pop();
82014
- goingUp = true;
82015
- }
82016
- if (node2.leaf) {
82017
- const index2 = findItem(item, node2.children, equalsFn);
82018
- if (index2 !== -1) {
82019
- node2.children.splice(index2, 1);
82020
- path.push(node2);
82021
- this._condense(path);
82022
- return this;
82023
- }
82024
- }
82025
- if (!goingUp && !node2.leaf && contains$1(node2, bbox2)) {
82026
- path.push(node2);
82027
- indexes.push(i2);
82028
- i2 = 0;
82029
- parent = node2;
82030
- node2 = node2.children[0];
82031
- } else if (parent) {
82032
- i2++;
82033
- node2 = parent.children[i2];
82034
- goingUp = false;
82035
- } else node2 = null;
82036
- }
82037
- return this;
82038
- }
82039
- toBBox(item) {
82040
- return item;
82041
- }
82042
- compareMinX(a2, b) {
82043
- return a2.minX - b.minX;
82044
- }
82045
- compareMinY(a2, b) {
82046
- return a2.minY - b.minY;
82047
- }
82048
- toJSON() {
82049
- return this.data;
82050
- }
82051
- fromJSON(data) {
82052
- this.data = data;
82053
- return this;
82054
- }
82055
- _all(node2, result) {
82056
- const nodesToSearch = [];
82057
- while (node2) {
82058
- if (node2.leaf) result.push(...node2.children);
82059
- else nodesToSearch.push(...node2.children);
82060
- node2 = nodesToSearch.pop();
82061
- }
82062
- return result;
82063
- }
82064
- _build(items, left, right, height) {
82065
- const N2 = right - left + 1;
82066
- let M = this._maxEntries;
82067
- let node2;
82068
- if (N2 <= M) {
82069
- node2 = createNode(items.slice(left, right + 1));
82070
- calcBBox(node2, this.toBBox);
82071
- return node2;
82072
- }
82073
- if (!height) {
82074
- height = Math.ceil(Math.log(N2) / Math.log(M));
82075
- M = Math.ceil(N2 / Math.pow(M, height - 1));
82076
- }
82077
- node2 = createNode([]);
82078
- node2.leaf = false;
82079
- node2.height = height;
82080
- const N22 = Math.ceil(N2 / M);
82081
- const N1 = N22 * Math.ceil(Math.sqrt(M));
82082
- multiSelect(items, left, right, N1, this.compareMinX);
82083
- for (let i2 = left; i2 <= right; i2 += N1) {
82084
- const right2 = Math.min(i2 + N1 - 1, right);
82085
- multiSelect(items, i2, right2, N22, this.compareMinY);
82086
- for (let j = i2; j <= right2; j += N22) {
82087
- const right3 = Math.min(j + N22 - 1, right2);
82088
- node2.children.push(this._build(items, j, right3, height - 1));
82089
- }
82090
- }
82091
- calcBBox(node2, this.toBBox);
82092
- return node2;
82093
- }
82094
- _chooseSubtree(bbox2, node2, level, path) {
82095
- while (true) {
82096
- path.push(node2);
82097
- if (node2.leaf || path.length - 1 === level) break;
82098
- let minArea = Infinity;
82099
- let minEnlargement = Infinity;
82100
- let targetNode;
82101
- for (let i2 = 0; i2 < node2.children.length; i2++) {
82102
- const child = node2.children[i2];
82103
- const area2 = bboxArea(child);
82104
- const enlargement = enlargedArea(bbox2, child) - area2;
82105
- if (enlargement < minEnlargement) {
82106
- minEnlargement = enlargement;
82107
- minArea = area2 < minArea ? area2 : minArea;
82108
- targetNode = child;
82109
- } else if (enlargement === minEnlargement) {
82110
- if (area2 < minArea) {
82111
- minArea = area2;
82112
- targetNode = child;
82113
- }
82114
- }
82115
- }
82116
- node2 = targetNode || node2.children[0];
82117
- }
82118
- return node2;
82119
- }
82120
- _insert(item, level, isNode2) {
82121
- const bbox2 = isNode2 ? item : this.toBBox(item);
82122
- const insertPath = [];
82123
- const node2 = this._chooseSubtree(bbox2, this.data, level, insertPath);
82124
- node2.children.push(item);
82125
- extend(node2, bbox2);
82126
- while (level >= 0) {
82127
- if (insertPath[level].children.length > this._maxEntries) {
82128
- this._split(insertPath, level);
82129
- level--;
82130
- } else break;
82131
- }
82132
- this._adjustParentBBoxes(bbox2, insertPath, level);
82133
- }
82134
- // split overflowed node into two
82135
- _split(insertPath, level) {
82136
- const node2 = insertPath[level];
82137
- const M = node2.children.length;
82138
- const m = this._minEntries;
82139
- this._chooseSplitAxis(node2, m, M);
82140
- const splitIndex = this._chooseSplitIndex(node2, m, M);
82141
- const newNode = createNode(node2.children.splice(splitIndex, node2.children.length - splitIndex));
82142
- newNode.height = node2.height;
82143
- newNode.leaf = node2.leaf;
82144
- calcBBox(node2, this.toBBox);
82145
- calcBBox(newNode, this.toBBox);
82146
- if (level) insertPath[level - 1].children.push(newNode);
82147
- else this._splitRoot(node2, newNode);
82148
- }
82149
- _splitRoot(node2, newNode) {
82150
- this.data = createNode([node2, newNode]);
82151
- this.data.height = node2.height + 1;
82152
- this.data.leaf = false;
82153
- calcBBox(this.data, this.toBBox);
82154
- }
82155
- _chooseSplitIndex(node2, m, M) {
82156
- let index2;
82157
- let minOverlap = Infinity;
82158
- let minArea = Infinity;
82159
- for (let i2 = m; i2 <= M - m; i2++) {
82160
- const bbox1 = distBBox(node2, 0, i2, this.toBBox);
82161
- const bbox2 = distBBox(node2, i2, M, this.toBBox);
82162
- const overlap = intersectionArea(bbox1, bbox2);
82163
- const area2 = bboxArea(bbox1) + bboxArea(bbox2);
82164
- if (overlap < minOverlap) {
82165
- minOverlap = overlap;
82166
- index2 = i2;
82167
- minArea = area2 < minArea ? area2 : minArea;
82168
- } else if (overlap === minOverlap) {
82169
- if (area2 < minArea) {
82170
- minArea = area2;
82171
- index2 = i2;
82172
- }
82173
- }
82174
- }
82175
- return index2 || M - m;
82176
- }
82177
- // sorts node children by the best axis for split
82178
- _chooseSplitAxis(node2, m, M) {
82179
- const compareMinX = node2.leaf ? this.compareMinX : compareNodeMinX;
82180
- const compareMinY = node2.leaf ? this.compareMinY : compareNodeMinY;
82181
- const xMargin = this._allDistMargin(node2, m, M, compareMinX);
82182
- const yMargin = this._allDistMargin(node2, m, M, compareMinY);
82183
- if (xMargin < yMargin) node2.children.sort(compareMinX);
82184
- }
82185
- // total margin of all possible split distributions where each node is at least m full
82186
- _allDistMargin(node2, m, M, compare2) {
82187
- node2.children.sort(compare2);
82188
- const toBBox = this.toBBox;
82189
- const leftBBox = distBBox(node2, 0, m, toBBox);
82190
- const rightBBox = distBBox(node2, M - m, M, toBBox);
82191
- let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
82192
- for (let i2 = m; i2 < M - m; i2++) {
82193
- const child = node2.children[i2];
82194
- extend(leftBBox, node2.leaf ? toBBox(child) : child);
82195
- margin += bboxMargin(leftBBox);
82196
- }
82197
- for (let i2 = M - m - 1; i2 >= m; i2--) {
82198
- const child = node2.children[i2];
82199
- extend(rightBBox, node2.leaf ? toBBox(child) : child);
82200
- margin += bboxMargin(rightBBox);
82201
- }
82202
- return margin;
82203
- }
82204
- _adjustParentBBoxes(bbox2, path, level) {
82205
- for (let i2 = level; i2 >= 0; i2--) {
82206
- extend(path[i2], bbox2);
82207
- }
82208
- }
82209
- _condense(path) {
82210
- for (let i2 = path.length - 1, siblings; i2 >= 0; i2--) {
82211
- if (path[i2].children.length === 0) {
82212
- if (i2 > 0) {
82213
- siblings = path[i2 - 1].children;
82214
- siblings.splice(siblings.indexOf(path[i2]), 1);
82215
- } else this.clear();
82216
- } else calcBBox(path[i2], this.toBBox);
82217
- }
82218
- }
82219
- }
82220
- function findItem(item, items, equalsFn) {
82221
- if (!equalsFn) return items.indexOf(item);
82222
- for (let i2 = 0; i2 < items.length; i2++) {
82223
- if (equalsFn(item, items[i2])) return i2;
82224
- }
82225
- return -1;
82226
- }
82227
- function calcBBox(node2, toBBox) {
82228
- distBBox(node2, 0, node2.children.length, toBBox, node2);
82229
- }
82230
- function distBBox(node2, k, p, toBBox, destNode) {
82231
- if (!destNode) destNode = createNode(null);
82232
- destNode.minX = Infinity;
82233
- destNode.minY = Infinity;
82234
- destNode.maxX = -Infinity;
82235
- destNode.maxY = -Infinity;
82236
- for (let i2 = k; i2 < p; i2++) {
82237
- const child = node2.children[i2];
82238
- extend(destNode, node2.leaf ? toBBox(child) : child);
82239
- }
82240
- return destNode;
82241
- }
82242
- function extend(a2, b) {
82243
- a2.minX = Math.min(a2.minX, b.minX);
82244
- a2.minY = Math.min(a2.minY, b.minY);
82245
- a2.maxX = Math.max(a2.maxX, b.maxX);
82246
- a2.maxY = Math.max(a2.maxY, b.maxY);
82247
- return a2;
82248
- }
82249
- function compareNodeMinX(a2, b) {
82250
- return a2.minX - b.minX;
82251
- }
82252
- function compareNodeMinY(a2, b) {
82253
- return a2.minY - b.minY;
82254
- }
82255
- function bboxArea(a2) {
82256
- return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
82257
- }
82258
- function bboxMargin(a2) {
82259
- return a2.maxX - a2.minX + (a2.maxY - a2.minY);
82260
- }
82261
- function enlargedArea(a2, b) {
82262
- return (Math.max(b.maxX, a2.maxX) - Math.min(b.minX, a2.minX)) * (Math.max(b.maxY, a2.maxY) - Math.min(b.minY, a2.minY));
82263
- }
82264
- function intersectionArea(a2, b) {
82265
- const minX = Math.max(a2.minX, b.minX);
82266
- const minY = Math.max(a2.minY, b.minY);
82267
- const maxX = Math.min(a2.maxX, b.maxX);
82268
- const maxY = Math.min(a2.maxY, b.maxY);
82269
- return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
82270
- }
82271
- function contains$1(a2, b) {
82272
- return a2.minX <= b.minX && a2.minY <= b.minY && b.maxX <= a2.maxX && b.maxY <= a2.maxY;
82273
- }
82274
- function intersects(a2, b) {
82275
- return b.minX <= a2.maxX && b.minY <= a2.maxY && b.maxX >= a2.minX && b.maxY >= a2.minY;
82276
- }
82277
- function createNode(children) {
82278
- return {
82279
- children,
82280
- height: 1,
82281
- leaf: true,
82282
- minX: Infinity,
82283
- minY: Infinity,
82284
- maxX: -Infinity,
82285
- maxY: -Infinity
82286
- };
82287
- }
82288
- function multiSelect(arr, left, right, n3, compare2) {
82289
- const stack2 = [left, right];
82290
- while (stack2.length) {
82291
- right = stack2.pop();
82292
- left = stack2.pop();
82293
- if (right - left <= n3) continue;
82294
- const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
82295
- quickselect(arr, mid, left, right, compare2);
82296
- stack2.push(left, mid, mid, right);
82297
- }
82298
- }
82299
- function geojsonRbush(maxEntries) {
82300
- var tree = new RBush(maxEntries);
82301
- tree.insert = function(feature2) {
82302
- if (feature2.type !== "Feature") throw new Error("invalid feature");
82303
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82304
- return RBush.prototype.insert.call(this, feature2);
82305
- };
82306
- tree.load = function(features) {
82307
- var load2 = [];
82308
- if (Array.isArray(features)) {
82309
- features.forEach(function(feature2) {
82310
- if (feature2.type !== "Feature") throw new Error("invalid features");
82311
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82312
- load2.push(feature2);
82313
- });
82314
- } else {
82315
- featureEach(features, function(feature2) {
82316
- if (feature2.type !== "Feature") throw new Error("invalid features");
82317
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82318
- load2.push(feature2);
82319
- });
82320
- }
82321
- return RBush.prototype.load.call(this, load2);
82322
- };
82323
- tree.remove = function(feature2, equals2) {
82324
- if (feature2.type !== "Feature") throw new Error("invalid feature");
82325
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82326
- return RBush.prototype.remove.call(this, feature2, equals2);
82327
- };
82328
- tree.clear = function() {
82329
- return RBush.prototype.clear.call(this);
82330
- };
82331
- tree.search = function(geojson) {
82332
- var features = RBush.prototype.search.call(this, this.toBBox(geojson));
82333
- return featureCollection(features);
82334
- };
82335
- tree.collides = function(geojson) {
82336
- return RBush.prototype.collides.call(this, this.toBBox(geojson));
82337
- };
82338
- tree.all = function() {
82339
- var features = RBush.prototype.all.call(this);
82340
- return featureCollection(features);
82341
- };
82342
- tree.toJSON = function() {
82343
- return RBush.prototype.toJSON.call(this);
82344
- };
82345
- tree.fromJSON = function(json) {
82346
- return RBush.prototype.fromJSON.call(this, json);
82347
- };
82348
- tree.toBBox = function(geojson) {
82349
- var bbox2;
82350
- if (geojson.bbox) bbox2 = geojson.bbox;
82351
- else if (Array.isArray(geojson) && geojson.length === 4) bbox2 = geojson;
82352
- else if (Array.isArray(geojson) && geojson.length === 6)
82353
- bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
82354
- else if (geojson.type === "Feature") bbox2 = bbox$1(geojson);
82355
- else if (geojson.type === "FeatureCollection") bbox2 = bbox$1(geojson);
82356
- else throw new Error("invalid geojson");
82357
- return {
82358
- minX: bbox2[0],
82359
- minY: bbox2[1],
82360
- maxX: bbox2[2],
82361
- maxY: bbox2[3]
82362
- };
82363
- };
82364
- return tree;
82365
- }
82366
- function lineSegment(geojson) {
82367
- if (!geojson) {
82368
- throw new Error("geojson is required");
82369
- }
82370
- const results = [];
82371
- flattenEach(geojson, (feature2) => {
82372
- lineSegmentFeature(feature2, results);
82373
- });
82374
- return featureCollection(results);
82375
- }
82376
- function lineSegmentFeature(geojson, results) {
82377
- let coords = [];
82378
- const geometry2 = geojson.geometry;
82379
- if (geometry2 !== null) {
82380
- switch (geometry2.type) {
82381
- case "Polygon":
82382
- coords = getCoords(geometry2);
82383
- break;
82384
- case "LineString":
82385
- coords = [getCoords(geometry2)];
82386
- }
82387
- coords.forEach((coord) => {
82388
- const segments = createSegments(coord, geojson.properties);
82389
- segments.forEach((segment) => {
82390
- segment.id = results.length;
82391
- results.push(segment);
82392
- });
82393
- });
82394
- }
82395
- }
82396
- function createSegments(coords, properties) {
82397
- const segments = [];
82398
- coords.reduce((previousCoords, currentCoords) => {
82399
- const segment = lineString([previousCoords, currentCoords], properties);
82400
- segment.bbox = bbox(previousCoords, currentCoords);
82401
- segments.push(segment);
82402
- return currentCoords;
82403
- });
82404
- return segments;
82405
- }
82406
- function bbox(coords1, coords2) {
82407
- const x12 = coords1[0];
82408
- const y12 = coords1[1];
82409
- const x2 = coords2[0];
82410
- const y2 = coords2[1];
82411
- const west = x12 < x2 ? x12 : x2;
82412
- const south = y12 < y2 ? y12 : y2;
82413
- const east = x12 > x2 ? x12 : x2;
82414
- const north = y12 > y2 ? y12 : y2;
82415
- return [west, south, east, north];
82416
- }
82417
- function distance$1(from, to, options = {}) {
82418
- var coordinates1 = getCoord(from);
82419
- var coordinates2 = getCoord(to);
82420
- var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
82421
- var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
82422
- var lat1 = degreesToRadians(coordinates1[1]);
82423
- var lat2 = degreesToRadians(coordinates2[1]);
82424
- var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
82425
- return radiansToLength(
82426
- 2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
82427
- options.units
82428
- );
82429
- }
82430
- var __defProp$1 = Object.defineProperty;
82431
- var __defProps = Object.defineProperties;
82432
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
82433
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
82434
- var __hasOwnProp = Object.prototype.hasOwnProperty;
82435
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
82436
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
82437
- var __spreadValues = (a2, b) => {
82438
- for (var prop in b || (b = {}))
82439
- if (__hasOwnProp.call(b, prop))
82440
- __defNormalProp(a2, prop, b[prop]);
82441
- if (__getOwnPropSymbols)
82442
- for (var prop of __getOwnPropSymbols(b)) {
82443
- if (__propIsEnum.call(b, prop))
82444
- __defNormalProp(a2, prop, b[prop]);
82445
- }
82446
- return a2;
82447
- };
82448
- var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
82449
- function nearestPointOnLine(lines, pt, options = {}) {
82450
- if (!lines || !pt) {
82451
- throw new Error("lines and pt are required arguments");
82452
- }
82453
- const ptPos = getCoord(pt);
82454
- let closestPt = point([Infinity, Infinity], {
82455
- dist: Infinity,
82456
- index: -1,
82457
- multiFeatureIndex: -1,
82458
- location: -1
82459
- });
82460
- let length2 = 0;
82461
- flattenEach(
82462
- lines,
82463
- function(line, _featureIndex, multiFeatureIndex) {
82464
- const coords = getCoords(line);
82465
- for (let i2 = 0; i2 < coords.length - 1; i2++) {
82466
- const start = point(coords[i2]);
82467
- start.properties.dist = distance$1(pt, start, options);
82468
- const startPos = getCoord(start);
82469
- const stop = point(coords[i2 + 1]);
82470
- stop.properties.dist = distance$1(pt, stop, options);
82471
- const stopPos = getCoord(stop);
82472
- const sectionLength = distance$1(start, stop, options);
82473
- let intersectPos;
82474
- let wasEnd;
82475
- if (startPos[0] === ptPos[0] && startPos[1] === ptPos[1]) {
82476
- [intersectPos, , wasEnd] = [startPos, void 0, false];
82477
- } else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
82478
- [intersectPos, , wasEnd] = [stopPos, void 0, true];
82479
- } else {
82480
- [intersectPos, , wasEnd] = nearestPointOnSegment(
82481
- start.geometry.coordinates,
82482
- stop.geometry.coordinates,
82483
- getCoord(pt)
82484
- );
82485
- }
82486
- let intersectPt;
82487
- if (intersectPos) {
82488
- intersectPt = point(intersectPos, {
82489
- dist: distance$1(pt, intersectPos, options),
82490
- multiFeatureIndex,
82491
- location: length2 + distance$1(start, intersectPos, options)
82492
- });
82493
- }
82494
- if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
82495
- closestPt = __spreadProps(__spreadValues({}, intersectPt), {
82496
- properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
82497
- // Legacy behaviour where index progresses to next segment # if we
82498
- // went with the end point this iteration.
82499
- index: wasEnd ? i2 + 1 : i2
82500
- })
82501
- });
82502
- }
82503
- length2 += sectionLength;
82504
- }
82505
- }
82506
- );
82507
- return closestPt;
82508
- }
82509
- function dot(v12, v2) {
82510
- const [v1x, v1y, v1z] = v12;
82511
- const [v2x, v2y, v2z] = v2;
82512
- return v1x * v2x + v1y * v2y + v1z * v2z;
82513
- }
82514
- function cross(v12, v2) {
82515
- const [v1x, v1y, v1z] = v12;
82516
- const [v2x, v2y, v2z] = v2;
82517
- return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
82518
- }
82519
- function magnitude(v) {
82520
- return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
82521
- }
82522
- function angle$1(v12, v2) {
82523
- const theta = dot(v12, v2) / (magnitude(v12) * magnitude(v2));
82524
- return Math.acos(Math.min(Math.max(theta, -1), 1));
82525
- }
82526
- function lngLatToVector(a2) {
82527
- const lat = degreesToRadians(a2[1]);
82528
- const lng = degreesToRadians(a2[0]);
82529
- return [
82530
- Math.cos(lat) * Math.cos(lng),
82531
- Math.cos(lat) * Math.sin(lng),
82532
- Math.sin(lat)
82533
- ];
82534
- }
82535
- function vectorToLngLat(v) {
82536
- const [x, y, z] = v;
82537
- const lat = radiansToDegrees(Math.asin(z));
82538
- const lng = radiansToDegrees(Math.atan2(y, x));
82539
- return [lng, lat];
82540
- }
82541
- function nearestPointOnSegment(posA, posB, posC) {
82542
- const A2 = lngLatToVector(posA);
82543
- const B2 = lngLatToVector(posB);
82544
- const C3 = lngLatToVector(posC);
82545
- const [Cx, Cy, Cz] = C3;
82546
- const [D2, E2, F] = cross(A2, B2);
82547
- const a2 = E2 * Cz - F * Cy;
82548
- const b = F * Cx - D2 * Cz;
82549
- const c = D2 * Cy - E2 * Cx;
82550
- const f2 = c * E2 - b * F;
82551
- const g2 = a2 * F - c * D2;
82552
- const h = b * D2 - a2 * E2;
82553
- const t = 1 / Math.sqrt(Math.pow(f2, 2) + Math.pow(g2, 2) + Math.pow(h, 2));
82554
- const I1 = [f2 * t, g2 * t, h * t];
82555
- const I2 = [-1 * f2 * t, -1 * g2 * t, -1 * h * t];
82556
- const angleAB = angle$1(A2, B2);
82557
- const angleAI1 = angle$1(A2, I1);
82558
- const angleBI1 = angle$1(B2, I1);
82559
- const angleAI2 = angle$1(A2, I2);
82560
- const angleBI2 = angle$1(B2, I2);
82561
- let I3;
82562
- if (angleAI1 < angleAI2 && angleAI1 < angleBI2 || angleBI1 < angleAI2 && angleBI1 < angleBI2) {
82563
- I3 = I1;
82564
- } else {
82565
- I3 = I2;
82566
- }
82567
- if (angle$1(A2, I3) > angleAB || angle$1(B2, I3) > angleAB) {
82568
- if (distance$1(vectorToLngLat(I3), vectorToLngLat(A2)) <= distance$1(vectorToLngLat(I3), vectorToLngLat(B2))) {
82569
- return [vectorToLngLat(A2), true, false];
82570
- } else {
82571
- return [vectorToLngLat(B2), false, true];
82572
- }
82573
- }
82574
- return [vectorToLngLat(I3), false, false];
82575
- }
82576
- var fastDeepEqual;
82577
- var hasRequiredFastDeepEqual;
82578
- function requireFastDeepEqual() {
82579
- if (hasRequiredFastDeepEqual) return fastDeepEqual;
82580
- hasRequiredFastDeepEqual = 1;
82581
- fastDeepEqual = function equal2(a2, b) {
82582
- if (a2 === b) return true;
82583
- if (a2 && b && typeof a2 == "object" && typeof b == "object") {
82584
- if (a2.constructor !== b.constructor) return false;
82585
- var length2, i2, keys2;
82586
- if (Array.isArray(a2)) {
82587
- length2 = a2.length;
82588
- if (length2 != b.length) return false;
82589
- for (i2 = length2; i2-- !== 0; )
82590
- if (!equal2(a2[i2], b[i2])) return false;
82591
- return true;
82592
- }
82593
- if (a2.constructor === RegExp) return a2.source === b.source && a2.flags === b.flags;
82594
- if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b.valueOf();
82595
- if (a2.toString !== Object.prototype.toString) return a2.toString() === b.toString();
82596
- keys2 = Object.keys(a2);
82597
- length2 = keys2.length;
82598
- if (length2 !== Object.keys(b).length) return false;
82599
- for (i2 = length2; i2-- !== 0; )
82600
- if (!Object.prototype.hasOwnProperty.call(b, keys2[i2])) return false;
82601
- for (i2 = length2; i2-- !== 0; ) {
82602
- var key = keys2[i2];
82603
- if (!equal2(a2[key], b[key])) return false;
82604
- }
82605
- return true;
82606
- }
82607
- return a2 !== a2 && b !== b;
82608
- };
82609
- return fastDeepEqual;
82610
- }
82611
- var fastDeepEqualExports = requireFastDeepEqual();
82612
- const equal$1 = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
82613
- function lineOverlap(line1, line2, options = {}) {
82614
- options = options || {};
82615
- if (!isObject$1(options)) throw new Error("options is invalid");
82616
- var tolerance = options.tolerance || 0;
82617
- var features = [];
82618
- var tree = geojsonRbush();
82619
- const line = lineSegment(line1);
82620
- tree.load(line);
82621
- var overlapSegment;
82622
- let additionalSegments = [];
82623
- segmentEach(line2, function(segment) {
82624
- var doesOverlaps = false;
82625
- if (!segment) {
82626
- return;
82627
- }
82628
- featureEach(tree.search(segment), function(match) {
82629
- if (doesOverlaps === false) {
82630
- var coordsSegment = getCoords(segment).sort();
82631
- var coordsMatch = getCoords(match).sort();
82632
- if (equal$1(coordsSegment, coordsMatch)) {
82633
- doesOverlaps = true;
82634
- if (overlapSegment) {
82635
- overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
82636
- } else overlapSegment = segment;
82637
- } else if (tolerance === 0 ? booleanPointOnLine(coordsSegment[0], match) && booleanPointOnLine(coordsSegment[1], match) : nearestPointOnLine(match, coordsSegment[0]).properties.dist <= tolerance && nearestPointOnLine(match, coordsSegment[1]).properties.dist <= tolerance) {
82638
- doesOverlaps = true;
82639
- if (overlapSegment) {
82640
- overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
82641
- } else overlapSegment = segment;
82642
- } else if (tolerance === 0 ? booleanPointOnLine(coordsMatch[0], segment) && booleanPointOnLine(coordsMatch[1], segment) : nearestPointOnLine(segment, coordsMatch[0]).properties.dist <= tolerance && nearestPointOnLine(segment, coordsMatch[1]).properties.dist <= tolerance) {
82643
- if (overlapSegment) {
82644
- const combinedSegment = concatSegment(overlapSegment, match);
82645
- if (combinedSegment) {
82646
- overlapSegment = combinedSegment;
82647
- } else {
82648
- additionalSegments.push(match);
82649
- }
82650
- } else overlapSegment = match;
82651
- }
82652
- }
82653
- });
82654
- if (doesOverlaps === false && overlapSegment) {
82655
- features.push(overlapSegment);
82656
- if (additionalSegments.length) {
82657
- features = features.concat(additionalSegments);
82658
- additionalSegments = [];
82659
- }
82660
- overlapSegment = void 0;
82661
- }
82662
- });
82663
- if (overlapSegment) features.push(overlapSegment);
82664
- return featureCollection(features);
82665
- }
82666
- function concatSegment(line, segment) {
82667
- var coords = getCoords(segment);
82668
- var lineCoords = getCoords(line);
82669
- var start = lineCoords[0];
82670
- var end = lineCoords[lineCoords.length - 1];
82671
- var geom = line.geometry.coordinates;
82672
- if (equal$1(coords[0], start)) geom.unshift(coords[1]);
82673
- else if (equal$1(coords[0], end)) geom.push(coords[1]);
82674
- else if (equal$1(coords[1], start)) geom.unshift(coords[0]);
82675
- else if (equal$1(coords[1], end)) geom.push(coords[0]);
82676
- else return;
82677
- return line;
82678
- }
82679
- class TinyQueue {
82680
- constructor(data = [], compare2 = defaultCompare) {
82681
- this.data = data;
82682
- this.length = this.data.length;
82683
- this.compare = compare2;
82684
- if (this.length > 0) {
82685
- for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
82686
- }
82687
- }
82688
- push(item) {
82689
- this.data.push(item);
82690
- this.length++;
82691
- this._up(this.length - 1);
82692
- }
82693
- pop() {
82694
- if (this.length === 0) return void 0;
82695
- const top = this.data[0];
82696
- const bottom = this.data.pop();
82697
- this.length--;
82698
- if (this.length > 0) {
82699
- this.data[0] = bottom;
82700
- this._down(0);
82701
- }
82702
- return top;
82703
- }
82704
- peek() {
82705
- return this.data[0];
82706
- }
82707
- _up(pos) {
82708
- const { data, compare: compare2 } = this;
82709
- const item = data[pos];
82710
- while (pos > 0) {
82711
- const parent = pos - 1 >> 1;
82712
- const current = data[parent];
82713
- if (compare2(item, current) >= 0) break;
82714
- data[pos] = current;
82715
- pos = parent;
82716
- }
82717
- data[pos] = item;
82718
- }
82719
- _down(pos) {
82720
- const { data, compare: compare2 } = this;
82721
- const halfLength = this.length >> 1;
82722
- const item = data[pos];
82723
- while (pos < halfLength) {
82724
- let left = (pos << 1) + 1;
82725
- let best = data[left];
82726
- const right = left + 1;
82727
- if (right < this.length && compare2(data[right], best) < 0) {
82728
- left = right;
82729
- best = data[right];
82730
- }
82731
- if (compare2(best, item) >= 0) break;
82732
- data[pos] = best;
82733
- pos = left;
82734
- }
82735
- data[pos] = item;
82736
- }
82737
- }
82738
- function defaultCompare(a2, b) {
82739
- return a2 < b ? -1 : a2 > b ? 1 : 0;
82740
- }
82741
- function checkWhichEventIsLeft(e1, e2) {
82742
- if (e1.p.x > e2.p.x) return 1;
82743
- if (e1.p.x < e2.p.x) return -1;
82744
- if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
82745
- return 1;
82746
- }
82747
- function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
82748
- if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
82749
- if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
82750
- if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
82751
- return 1;
82752
- }
82753
- class Event {
82754
- constructor(p, featureId2, ringId2, eventId2) {
82755
- this.p = {
82756
- x: p[0],
82757
- y: p[1]
82758
- };
82759
- this.featureId = featureId2;
82760
- this.ringId = ringId2;
82761
- this.eventId = eventId2;
82762
- this.otherEvent = null;
82763
- this.isLeftEndpoint = null;
82764
- }
82765
- isSamePoint(eventToCheck) {
82766
- return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
82767
- }
82768
- }
82769
- function fillEventQueue(geojson, eventQueue) {
82770
- if (geojson.type === "FeatureCollection") {
82771
- const features = geojson.features;
82772
- for (let i2 = 0; i2 < features.length; i2++) {
82773
- processFeature(features[i2], eventQueue);
82774
- }
82775
- } else {
82776
- processFeature(geojson, eventQueue);
82777
- }
82778
- }
82779
- let featureId = 0;
82780
- let ringId = 0;
82781
- let eventId = 0;
82782
- function processFeature(featureOrGeometry, eventQueue) {
82783
- const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
82784
- let coords = geom.coordinates;
82785
- if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
82786
- if (geom.type === "LineString") coords = [[coords]];
82787
- for (let i2 = 0; i2 < coords.length; i2++) {
82788
- for (let ii = 0; ii < coords[i2].length; ii++) {
82789
- let currentP = coords[i2][ii][0];
82790
- let nextP = null;
82791
- ringId = ringId + 1;
82792
- for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
82793
- nextP = coords[i2][ii][iii + 1];
82794
- const e1 = new Event(currentP, featureId, ringId, eventId);
82795
- const e2 = new Event(nextP, featureId, ringId, eventId + 1);
82796
- e1.otherEvent = e2;
82797
- e2.otherEvent = e1;
82798
- if (checkWhichEventIsLeft(e1, e2) > 0) {
82799
- e2.isLeftEndpoint = true;
82800
- e1.isLeftEndpoint = false;
82801
- } else {
82802
- e1.isLeftEndpoint = true;
82803
- e2.isLeftEndpoint = false;
82804
- }
82805
- eventQueue.push(e1);
82806
- eventQueue.push(e2);
82807
- currentP = nextP;
82808
- eventId = eventId + 1;
82809
- }
82810
- }
82811
- }
82812
- featureId = featureId + 1;
82813
- }
82814
- let Segment$1 = class Segment {
82815
- constructor(event) {
82816
- this.leftSweepEvent = event;
82817
- this.rightSweepEvent = event.otherEvent;
82818
- }
82819
- };
82820
- function testSegmentIntersect(seg1, seg2) {
82821
- if (seg1 === null || seg2 === null) return false;
82822
- if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId && (seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent))) return false;
82823
- const x12 = seg1.leftSweepEvent.p.x;
82824
- const y12 = seg1.leftSweepEvent.p.y;
82825
- const x2 = seg1.rightSweepEvent.p.x;
82826
- const y2 = seg1.rightSweepEvent.p.y;
82827
- const x3 = seg2.leftSweepEvent.p.x;
82828
- const y3 = seg2.leftSweepEvent.p.y;
82829
- const x4 = seg2.rightSweepEvent.p.x;
82830
- const y4 = seg2.rightSweepEvent.p.y;
82831
- const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
82832
- const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
82833
- const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
82834
- if (denom === 0) {
82835
- if (numeA === 0 && numeB === 0) return false;
82836
- return false;
82837
- }
82838
- const uA = numeA / denom;
82839
- const uB = numeB / denom;
82840
- if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
82841
- const x = x12 + uA * (x2 - x12);
82842
- const y = y12 + uA * (y2 - y12);
82843
- return [x, y];
82844
- }
82845
- return false;
82846
- }
82847
- function runCheck(eventQueue, ignoreSelfIntersections) {
82848
- ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
82849
- const intersectionPoints = [];
82850
- const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
82851
- while (eventQueue.length) {
82852
- const event = eventQueue.pop();
82853
- if (event.isLeftEndpoint) {
82854
- const segment = new Segment$1(event);
82855
- for (let i2 = 0; i2 < outQueue.data.length; i2++) {
82856
- const otherSeg = outQueue.data[i2];
82857
- if (ignoreSelfIntersections) {
82858
- if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
82859
- }
82860
- const intersection2 = testSegmentIntersect(segment, otherSeg);
82861
- if (intersection2 !== false) intersectionPoints.push(intersection2);
82862
- }
82863
- outQueue.push(segment);
82864
- } else if (event.isLeftEndpoint === false) {
82865
- outQueue.pop();
82866
- }
82867
- }
82868
- return intersectionPoints;
82869
- }
82870
- function sweeplineIntersections$1(geojson, ignoreSelfIntersections) {
82871
- const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
82872
- fillEventQueue(geojson, eventQueue);
82873
- return runCheck(eventQueue, ignoreSelfIntersections);
82874
- }
82875
- const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
82876
- __proto__: null,
82877
- default: sweeplineIntersections$1
82878
- }, Symbol.toStringTag, { value: "Module" }));
82879
- var sweeplineIntersections = sweeplineIntersections$1;
82880
- function lineIntersect(line1, line2, options = {}) {
82881
- const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
82882
- let features = [];
82883
- if (line1.type === "FeatureCollection")
82884
- features = features.concat(line1.features);
82885
- else if (line1.type === "Feature") features.push(line1);
82886
- else if (line1.type === "LineString" || line1.type === "Polygon" || line1.type === "MultiLineString" || line1.type === "MultiPolygon") {
82887
- features.push(feature$1(line1));
82888
- }
82889
- if (line2.type === "FeatureCollection")
82890
- features = features.concat(line2.features);
82891
- else if (line2.type === "Feature") features.push(line2);
82892
- else if (line2.type === "LineString" || line2.type === "Polygon" || line2.type === "MultiLineString" || line2.type === "MultiPolygon") {
82893
- features.push(feature$1(line2));
82894
- }
82895
- const intersections = sweeplineIntersections(
82896
- featureCollection(features),
82897
- ignoreSelfIntersections
82898
- );
82899
- let results = [];
82900
- if (removeDuplicates) {
82901
- const unique2 = {};
82902
- intersections.forEach((intersection2) => {
82903
- const key = intersection2.join(",");
82904
- if (!unique2[key]) {
82905
- unique2[key] = true;
82906
- results.push(intersection2);
82907
- }
82908
- });
82909
- } else {
82910
- results = intersections;
82911
- }
82912
- return featureCollection(results.map((r2) => point(r2)));
82913
- }
82914
- var __defProp = Object.defineProperty;
82915
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
82916
- var _GeojsonEquality = class _GeojsonEquality2 {
82917
- constructor(opts) {
82918
- this.direction = false;
82919
- this.compareProperties = true;
82920
- var _a2, _b, _c;
82921
- this.precision = 10 ** -((_a2 = opts == null ? void 0 : opts.precision) != null ? _a2 : 17);
82922
- this.direction = (_b = opts == null ? void 0 : opts.direction) != null ? _b : false;
82923
- this.compareProperties = (_c = opts == null ? void 0 : opts.compareProperties) != null ? _c : true;
82924
- }
82925
- compare(g1, g2) {
82926
- if (g1.type !== g2.type) {
82927
- return false;
82928
- }
82929
- if (!sameLength(g1, g2)) {
82930
- return false;
82931
- }
82932
- switch (g1.type) {
82933
- case "Point":
82934
- return this.compareCoord(g1.coordinates, g2.coordinates);
82935
- case "LineString":
82936
- return this.compareLine(g1.coordinates, g2.coordinates);
82937
- case "Polygon":
82938
- return this.comparePolygon(g1, g2);
82939
- case "GeometryCollection":
82940
- return this.compareGeometryCollection(g1, g2);
82941
- case "Feature":
82942
- return this.compareFeature(g1, g2);
82943
- case "FeatureCollection":
82944
- return this.compareFeatureCollection(g1, g2);
82945
- default:
82946
- if (g1.type.startsWith("Multi")) {
82947
- const g1s = explode(g1);
82948
- const g2s = explode(
82949
- g2
82950
- );
82951
- return g1s.every(
82952
- (g1part) => g2s.some((g2part) => this.compare(g1part, g2part))
82953
- );
82954
- }
82955
- }
82956
- return false;
82957
- }
82958
- compareCoord(c1, c2) {
82959
- return c1.length === c2.length && c1.every((c, i2) => Math.abs(c - c2[i2]) < this.precision);
82960
- }
82961
- compareLine(path1, path2, ind = 0, isPoly = false) {
82962
- if (!sameLength(path1, path2)) {
82963
- return false;
82964
- }
82965
- const p1 = path1;
82966
- let p2 = path2;
82967
- if (isPoly && !this.compareCoord(p1[0], p2[0])) {
82968
- const startIndex = this.fixStartIndex(p2, p1);
82969
- if (!startIndex) {
82970
- return false;
82971
- } else {
82972
- p2 = startIndex;
82973
- }
82974
- }
82975
- const sameDirection = this.compareCoord(p1[ind], p2[ind]);
82976
- if (this.direction || sameDirection) {
82977
- return this.comparePath(p1, p2);
82978
- } else {
82979
- if (this.compareCoord(p1[ind], p2[p2.length - (1 + ind)])) {
82980
- return this.comparePath(p1.slice().reverse(), p2);
82981
- }
82982
- return false;
82983
- }
82984
- }
82985
- fixStartIndex(sourcePath, targetPath) {
82986
- let correctPath, ind = -1;
82987
- for (let i2 = 0; i2 < sourcePath.length; i2++) {
82988
- if (this.compareCoord(sourcePath[i2], targetPath[0])) {
82989
- ind = i2;
82990
- break;
82991
- }
82992
- }
82993
- if (ind >= 0) {
82994
- correctPath = [].concat(
82995
- sourcePath.slice(ind, sourcePath.length),
82996
- sourcePath.slice(1, ind + 1)
82997
- );
82998
- }
82999
- return correctPath;
83000
- }
83001
- comparePath(p1, p2) {
83002
- return p1.every((c, i2) => this.compareCoord(c, p2[i2]));
83003
- }
83004
- comparePolygon(g1, g2) {
83005
- if (this.compareLine(g1.coordinates[0], g2.coordinates[0], 1, true)) {
83006
- const holes1 = g1.coordinates.slice(1, g1.coordinates.length);
83007
- const holes2 = g2.coordinates.slice(1, g2.coordinates.length);
83008
- return holes1.every(
83009
- (h1) => holes2.some((h2) => this.compareLine(h1, h2, 1, true))
83010
- );
83011
- }
83012
- return false;
83013
- }
83014
- compareGeometryCollection(g1, g2) {
83015
- return sameLength(g1.geometries, g2.geometries) && this.compareBBox(g1, g2) && g1.geometries.every((g3, i2) => this.compare(g3, g2.geometries[i2]));
83016
- }
83017
- compareFeature(g1, g2) {
83018
- return g1.id === g2.id && (this.compareProperties ? equal(g1.properties, g2.properties) : true) && this.compareBBox(g1, g2) && this.compare(g1.geometry, g2.geometry);
83019
- }
83020
- compareFeatureCollection(g1, g2) {
83021
- return sameLength(g1.features, g2.features) && this.compareBBox(g1, g2) && g1.features.every((f2, i2) => this.compare(f2, g2.features[i2]));
83022
- }
83023
- compareBBox(g1, g2) {
83024
- return Boolean(!g1.bbox && !g2.bbox) || (g1.bbox && g2.bbox ? this.compareCoord(g1.bbox, g2.bbox) : false);
83025
- }
83026
- };
83027
- __name(_GeojsonEquality, "GeojsonEquality");
83028
- var GeojsonEquality = _GeojsonEquality;
83029
- function sameLength(g1, g2) {
83030
- return g1.coordinates ? g1.coordinates.length === g2.coordinates.length : g1.length === g2.length;
83031
- }
83032
- __name(sameLength, "sameLength");
83033
- function explode(g2) {
83034
- return g2.coordinates.map((part) => ({
83035
- type: g2.type.replace("Multi", ""),
83036
- coordinates: part
83037
- }));
83038
- }
83039
- __name(explode, "explode");
83040
- function geojsonEquality(g1, g2, opts) {
83041
- const eq2 = new GeojsonEquality(opts);
83042
- return eq2.compare(g1, g2);
83043
- }
83044
- __name(geojsonEquality, "geojsonEquality");
83045
- function equal(object1, object2) {
83046
- if (object1 === null && object2 === null) {
83047
- return true;
83048
- }
83049
- if (object1 === null || object2 === null) {
83050
- return false;
83051
- }
83052
- const objKeys1 = Object.keys(object1);
83053
- const objKeys2 = Object.keys(object2);
83054
- if (objKeys1.length !== objKeys2.length) return false;
83055
- for (var key of objKeys1) {
83056
- const value1 = object1[key];
83057
- const value2 = object2[key];
83058
- const isObjects = isObject(value1) && isObject(value2);
83059
- if (isObjects && !equal(value1, value2) || !isObjects && value1 !== value2) {
83060
- return false;
83061
- }
83062
- }
83063
- return true;
83064
- }
83065
- __name(equal, "equal");
83066
- var isObject = /* @__PURE__ */ __name((object2) => {
83067
- return object2 != null && typeof object2 === "object";
83068
- }, "isObject");
83069
- function booleanOverlap(feature1, feature2) {
83070
- const geom1 = getGeom(feature1);
83071
- const geom2 = getGeom(feature2);
83072
- const type1 = geom1.type;
83073
- const type2 = geom2.type;
83074
- if (type1 === "MultiPoint" && type2 !== "MultiPoint" || (type1 === "LineString" || type1 === "MultiLineString") && type2 !== "LineString" && type2 !== "MultiLineString" || (type1 === "Polygon" || type1 === "MultiPolygon") && type2 !== "Polygon" && type2 !== "MultiPolygon") {
83075
- throw new Error("features must be of the same type");
83076
- }
83077
- if (type1 === "Point") throw new Error("Point geometry not supported");
83078
- if (geojsonEquality(feature1, feature2, { precision: 6 }))
83079
- return false;
83080
- let overlap = 0;
83081
- switch (type1) {
83082
- case "MultiPoint":
83083
- for (var i2 = 0; i2 < geom1.coordinates.length; i2++) {
83084
- for (var j = 0; j < geom2.coordinates.length; j++) {
83085
- var coord1 = geom1.coordinates[i2];
83086
- var coord2 = geom2.coordinates[j];
83087
- if (coord1[0] === coord2[0] && coord1[1] === coord2[1]) {
83088
- return true;
83089
- }
83090
- }
83091
- }
83092
- return false;
83093
- case "LineString":
83094
- case "MultiLineString":
83095
- segmentEach(feature1, (segment1) => {
83096
- segmentEach(feature2, (segment2) => {
83097
- if (lineOverlap(segment1, segment2).features.length) overlap++;
83098
- });
83099
- });
83100
- break;
83101
- case "Polygon":
83102
- case "MultiPolygon":
83103
- segmentEach(feature1, (segment1) => {
83104
- segmentEach(feature2, (segment2) => {
83105
- if (lineIntersect(segment1, segment2).features.length) overlap++;
83106
- });
83107
- });
83108
- break;
83109
- }
83110
- return overlap > 0;
81097
+ function inBBox(pt, bbox) {
81098
+ return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
83111
81099
  }
83112
81100
  var distEs6$2 = {};
83113
81101
  var style$1 = {};
@@ -83204,7 +81192,7 @@ function requireCjs$f() {
83204
81192
  case "Point":
83205
81193
  return point2(coordinates2).geometry;
83206
81194
  case "LineString":
83207
- return lineString2(coordinates2).geometry;
81195
+ return lineString(coordinates2).geometry;
83208
81196
  case "Polygon":
83209
81197
  return polygon2(coordinates2).geometry;
83210
81198
  case "MultiPoint":
@@ -83274,7 +81262,7 @@ function requireCjs$f() {
83274
81262
  options
83275
81263
  );
83276
81264
  }
83277
- function lineString2(coordinates2, properties, options = {}) {
81265
+ function lineString(coordinates2, properties, options = {}) {
83278
81266
  if (coordinates2.length < 2) {
83279
81267
  throw new Error("coordinates must be an array of two or more positions");
83280
81268
  }
@@ -83287,7 +81275,7 @@ function requireCjs$f() {
83287
81275
  function lineStrings(coordinates2, properties, options = {}) {
83288
81276
  return featureCollection2(
83289
81277
  coordinates2.map((coords) => {
83290
- return lineString2(coords, properties);
81278
+ return lineString(coords, properties);
83291
81279
  }),
83292
81280
  options
83293
81281
  );
@@ -83353,7 +81341,7 @@ function requireCjs$f() {
83353
81341
  return distance2 / factor;
83354
81342
  }
83355
81343
  function lengthToDegrees(distance2, units) {
83356
- return radiansToDegrees2(lengthToRadians(distance2, units));
81344
+ return radiansToDegrees(lengthToRadians(distance2, units));
83357
81345
  }
83358
81346
  function bearingToAzimuth(bearing) {
83359
81347
  let angle2 = bearing % 360;
@@ -83371,7 +81359,7 @@ function requireCjs$f() {
83371
81359
  }
83372
81360
  return angle2;
83373
81361
  }
83374
- function radiansToDegrees2(radians2) {
81362
+ function radiansToDegrees(radians2) {
83375
81363
  const normalisedRadians = radians2 % (2 * Math.PI);
83376
81364
  return normalisedRadians * 180 / Math.PI;
83377
81365
  }
@@ -83405,17 +81393,17 @@ function requireCjs$f() {
83405
81393
  function isObject2(input) {
83406
81394
  return input !== null && typeof input === "object" && !Array.isArray(input);
83407
81395
  }
83408
- function validateBBox(bbox2) {
83409
- if (!bbox2) {
81396
+ function validateBBox(bbox) {
81397
+ if (!bbox) {
83410
81398
  throw new Error("bbox is required");
83411
81399
  }
83412
- if (!Array.isArray(bbox2)) {
81400
+ if (!Array.isArray(bbox)) {
83413
81401
  throw new Error("bbox must be an Array");
83414
81402
  }
83415
- if (bbox2.length !== 4 && bbox2.length !== 6) {
81403
+ if (bbox.length !== 4 && bbox.length !== 6) {
83416
81404
  throw new Error("bbox must be an Array of 4 or 6 numbers");
83417
81405
  }
83418
- bbox2.forEach((num) => {
81406
+ bbox.forEach((num) => {
83419
81407
  if (!isNumber2(num)) {
83420
81408
  throw new Error("bbox must only contain numbers");
83421
81409
  }
@@ -83445,7 +81433,7 @@ function requireCjs$f() {
83445
81433
  cjs$f.isObject = isObject2;
83446
81434
  cjs$f.lengthToDegrees = lengthToDegrees;
83447
81435
  cjs$f.lengthToRadians = lengthToRadians;
83448
- cjs$f.lineString = lineString2;
81436
+ cjs$f.lineString = lineString;
83449
81437
  cjs$f.lineStrings = lineStrings;
83450
81438
  cjs$f.multiLineString = multiLineString;
83451
81439
  cjs$f.multiPoint = multiPoint;
@@ -83454,7 +81442,7 @@ function requireCjs$f() {
83454
81442
  cjs$f.points = points;
83455
81443
  cjs$f.polygon = polygon2;
83456
81444
  cjs$f.polygons = polygons2;
83457
- cjs$f.radiansToDegrees = radiansToDegrees2;
81445
+ cjs$f.radiansToDegrees = radiansToDegrees;
83458
81446
  cjs$f.radiansToLength = radiansToLength2;
83459
81447
  cjs$f.round = round2;
83460
81448
  cjs$f.validateBBox = validateBBox;
@@ -83469,7 +81457,7 @@ function requireCjs$e() {
83469
81457
  hasRequiredCjs$e = 1;
83470
81458
  Object.defineProperty(cjs$d, "__esModule", { value: true });
83471
81459
  var _helpers = /* @__PURE__ */ requireCjs$f();
83472
- function coordEach2(geojson, callback, excludeWrapCoord) {
81460
+ function coordEach(geojson, callback, excludeWrapCoord) {
83473
81461
  if (geojson === null) return;
83474
81462
  var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
83475
81463
  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
@@ -83556,7 +81544,7 @@ function requireCjs$e() {
83556
81544
  break;
83557
81545
  case "GeometryCollection":
83558
81546
  for (j = 0; j < geometry2.geometries.length; j++)
83559
- if (coordEach2(geometry2.geometries[j], callback, excludeWrapCoord) === false)
81547
+ if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
83560
81548
  return false;
83561
81549
  break;
83562
81550
  default:
@@ -83567,7 +81555,7 @@ function requireCjs$e() {
83567
81555
  }
83568
81556
  function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
83569
81557
  var previousValue = initialValue;
83570
- coordEach2(
81558
+ coordEach(
83571
81559
  geojson,
83572
81560
  function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
83573
81561
  if (coordIndex === 0 && initialValue === void 0)
@@ -83609,7 +81597,7 @@ function requireCjs$e() {
83609
81597
  });
83610
81598
  return previousValue;
83611
81599
  }
83612
- function featureEach2(geojson, callback) {
81600
+ function featureEach(geojson, callback) {
83613
81601
  if (geojson.type === "Feature") {
83614
81602
  callback(geojson, 0);
83615
81603
  } else if (geojson.type === "FeatureCollection") {
@@ -83620,7 +81608,7 @@ function requireCjs$e() {
83620
81608
  }
83621
81609
  function featureReduce(geojson, callback, initialValue) {
83622
81610
  var previousValue = initialValue;
83623
- featureEach2(geojson, function(currentFeature, featureIndex) {
81611
+ featureEach(geojson, function(currentFeature, featureIndex) {
83624
81612
  if (featureIndex === 0 && initialValue === void 0)
83625
81613
  previousValue = currentFeature;
83626
81614
  else previousValue = callback(previousValue, currentFeature, featureIndex);
@@ -83629,7 +81617,7 @@ function requireCjs$e() {
83629
81617
  }
83630
81618
  function coordAll(geojson) {
83631
81619
  var coords = [];
83632
- coordEach2(geojson, function(coord) {
81620
+ coordEach(geojson, function(coord) {
83633
81621
  coords.push(coord);
83634
81622
  });
83635
81623
  return coords;
@@ -83714,7 +81702,7 @@ function requireCjs$e() {
83714
81702
  return previousValue;
83715
81703
  }
83716
81704
  function flattenEach2(geojson, callback) {
83717
- geomEach2(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
81705
+ geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
83718
81706
  var type = geometry2 === null ? null : geometry2.type;
83719
81707
  switch (type) {
83720
81708
  case null:
@@ -83722,7 +81710,7 @@ function requireCjs$e() {
83722
81710
  case "LineString":
83723
81711
  case "Polygon":
83724
81712
  if (callback(
83725
- _helpers.feature.call(void 0, geometry2, properties, { bbox: bbox2, id }),
81713
+ _helpers.feature.call(void 0, geometry2, properties, { bbox, id }),
83726
81714
  featureIndex,
83727
81715
  0
83728
81716
  ) === false)
@@ -83770,7 +81758,7 @@ function requireCjs$e() {
83770
81758
  );
83771
81759
  return previousValue;
83772
81760
  }
83773
- function segmentEach2(geojson, callback) {
81761
+ function segmentEach(geojson, callback) {
83774
81762
  flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
83775
81763
  var segmentIndex = 0;
83776
81764
  if (!feature2.geometry) return;
@@ -83780,7 +81768,7 @@ function requireCjs$e() {
83780
81768
  var previousFeatureIndex = 0;
83781
81769
  var previousMultiIndex = 0;
83782
81770
  var prevGeomIndex = 0;
83783
- if (coordEach2(
81771
+ if (coordEach(
83784
81772
  feature2,
83785
81773
  function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
83786
81774
  if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
@@ -83814,7 +81802,7 @@ function requireCjs$e() {
83814
81802
  function segmentReduce(geojson, callback, initialValue) {
83815
81803
  var previousValue = initialValue;
83816
81804
  var started = false;
83817
- segmentEach2(
81805
+ segmentEach(
83818
81806
  geojson,
83819
81807
  function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
83820
81808
  if (started === false && initialValue === void 0)
@@ -84041,9 +82029,9 @@ function requireCjs$e() {
84041
82029
  throw new Error("geojson is invalid");
84042
82030
  }
84043
82031
  cjs$d.coordAll = coordAll;
84044
- cjs$d.coordEach = coordEach2;
82032
+ cjs$d.coordEach = coordEach;
84045
82033
  cjs$d.coordReduce = coordReduce;
84046
- cjs$d.featureEach = featureEach2;
82034
+ cjs$d.featureEach = featureEach;
84047
82035
  cjs$d.featureReduce = featureReduce;
84048
82036
  cjs$d.findPoint = findPoint;
84049
82037
  cjs$d.findSegment = findSegment;
@@ -84055,7 +82043,7 @@ function requireCjs$e() {
84055
82043
  cjs$d.lineReduce = lineReduce;
84056
82044
  cjs$d.propEach = propEach;
84057
82045
  cjs$d.propReduce = propReduce;
84058
- cjs$d.segmentEach = segmentEach2;
82046
+ cjs$d.segmentEach = segmentEach;
84059
82047
  cjs$d.segmentReduce = segmentReduce;
84060
82048
  return cjs$d;
84061
82049
  }
@@ -84065,7 +82053,7 @@ function requireCjs$d() {
84065
82053
  hasRequiredCjs$d = 1;
84066
82054
  Object.defineProperty(cjs$e, "__esModule", { value: true });
84067
82055
  var _meta = /* @__PURE__ */ requireCjs$e();
84068
- function bbox2(geojson, options = {}) {
82056
+ function bbox(geojson, options = {}) {
84069
82057
  if (geojson.bbox != null && true !== options.recompute) {
84070
82058
  return geojson.bbox;
84071
82059
  }
@@ -84086,8 +82074,8 @@ function requireCjs$d() {
84086
82074
  });
84087
82075
  return result;
84088
82076
  }
84089
- var turf_bbox_default = bbox2;
84090
- cjs$e.bbox = bbox2;
82077
+ var turf_bbox_default = bbox;
82078
+ cjs$e.bbox = bbox;
84091
82079
  cjs$e.default = turf_bbox_default;
84092
82080
  return cjs$e;
84093
82081
  }
@@ -84171,7 +82159,7 @@ function requireJs$p() {
84171
82159
  case "Point":
84172
82160
  return point2(coordinates2).geometry;
84173
82161
  case "LineString":
84174
- return lineString2(coordinates2).geometry;
82162
+ return lineString(coordinates2).geometry;
84175
82163
  case "Polygon":
84176
82164
  return polygon2(coordinates2).geometry;
84177
82165
  case "MultiPoint":
@@ -84248,7 +82236,7 @@ function requireJs$p() {
84248
82236
  }), options);
84249
82237
  }
84250
82238
  exports2.polygons = polygons2;
84251
- function lineString2(coordinates2, properties, options) {
82239
+ function lineString(coordinates2, properties, options) {
84252
82240
  if (options === void 0) {
84253
82241
  options = {};
84254
82242
  }
@@ -84261,13 +82249,13 @@ function requireJs$p() {
84261
82249
  };
84262
82250
  return feature2(geom, properties, options);
84263
82251
  }
84264
- exports2.lineString = lineString2;
82252
+ exports2.lineString = lineString;
84265
82253
  function lineStrings(coordinates2, properties, options) {
84266
82254
  if (options === void 0) {
84267
82255
  options = {};
84268
82256
  }
84269
82257
  return featureCollection2(coordinates2.map(function(coords) {
84270
- return lineString2(coords, properties);
82258
+ return lineString(coords, properties);
84271
82259
  }), options);
84272
82260
  }
84273
82261
  exports2.lineStrings = lineStrings;
@@ -84364,7 +82352,7 @@ function requireJs$p() {
84364
82352
  }
84365
82353
  exports2.lengthToRadians = lengthToRadians;
84366
82354
  function lengthToDegrees(distance2, units) {
84367
- return radiansToDegrees2(lengthToRadians(distance2, units));
82355
+ return radiansToDegrees(lengthToRadians(distance2, units));
84368
82356
  }
84369
82357
  exports2.lengthToDegrees = lengthToDegrees;
84370
82358
  function bearingToAzimuth(bearing) {
@@ -84375,11 +82363,11 @@ function requireJs$p() {
84375
82363
  return angle2;
84376
82364
  }
84377
82365
  exports2.bearingToAzimuth = bearingToAzimuth;
84378
- function radiansToDegrees2(radians2) {
82366
+ function radiansToDegrees(radians2) {
84379
82367
  var degrees2 = radians2 % (2 * Math.PI);
84380
82368
  return degrees2 * 180 / Math.PI;
84381
82369
  }
84382
- exports2.radiansToDegrees = radiansToDegrees2;
82370
+ exports2.radiansToDegrees = radiansToDegrees;
84383
82371
  function degreesToRadians2(degrees2) {
84384
82372
  var radians2 = degrees2 % 360;
84385
82373
  return radians2 * Math.PI / 180;
@@ -84427,17 +82415,17 @@ function requireJs$p() {
84427
82415
  return !!input && input.constructor === Object;
84428
82416
  }
84429
82417
  exports2.isObject = isObject2;
84430
- function validateBBox(bbox2) {
84431
- if (!bbox2) {
82418
+ function validateBBox(bbox) {
82419
+ if (!bbox) {
84432
82420
  throw new Error("bbox is required");
84433
82421
  }
84434
- if (!Array.isArray(bbox2)) {
82422
+ if (!Array.isArray(bbox)) {
84435
82423
  throw new Error("bbox must be an Array");
84436
82424
  }
84437
- if (bbox2.length !== 4 && bbox2.length !== 6) {
82425
+ if (bbox.length !== 4 && bbox.length !== 6) {
84438
82426
  throw new Error("bbox must be an Array of 4 or 6 numbers");
84439
82427
  }
84440
- bbox2.forEach(function(num) {
82428
+ bbox.forEach(function(num) {
84441
82429
  if (!isNumber2(num)) {
84442
82430
  throw new Error("bbox must only contain numbers");
84443
82431
  }
@@ -84462,22 +82450,22 @@ function requireJs$o() {
84462
82450
  hasRequiredJs$o = 1;
84463
82451
  Object.defineProperty(js$p, "__esModule", { value: true });
84464
82452
  var helpers_1 = /* @__PURE__ */ requireJs$p();
84465
- function bboxPolygon(bbox2, options) {
82453
+ function bboxPolygon(bbox, options) {
84466
82454
  if (options === void 0) {
84467
82455
  options = {};
84468
82456
  }
84469
- var west = Number(bbox2[0]);
84470
- var south = Number(bbox2[1]);
84471
- var east = Number(bbox2[2]);
84472
- var north = Number(bbox2[3]);
84473
- if (bbox2.length === 6) {
82457
+ var west = Number(bbox[0]);
82458
+ var south = Number(bbox[1]);
82459
+ var east = Number(bbox[2]);
82460
+ var north = Number(bbox[3]);
82461
+ if (bbox.length === 6) {
84474
82462
  throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
84475
82463
  }
84476
82464
  var lowLeft = [west, south];
84477
82465
  var topLeft = [west, north];
84478
82466
  var topRight = [east, north];
84479
82467
  var lowRight = [east, south];
84480
- return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox: bbox2, id: options.id });
82468
+ return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox, id: options.id });
84481
82469
  }
84482
82470
  js$p.default = bboxPolygon;
84483
82471
  return js$p;
@@ -84492,7 +82480,7 @@ function requireJs$n() {
84492
82480
  hasRequiredJs$n = 1;
84493
82481
  Object.defineProperty(js$k, "__esModule", { value: true });
84494
82482
  var helpers = /* @__PURE__ */ requireJs$p();
84495
- function coordEach2(geojson, callback, excludeWrapCoord) {
82483
+ function coordEach(geojson, callback, excludeWrapCoord) {
84496
82484
  if (geojson === null) return;
84497
82485
  var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
84498
82486
  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
@@ -84579,7 +82567,7 @@ function requireJs$n() {
84579
82567
  break;
84580
82568
  case "GeometryCollection":
84581
82569
  for (j = 0; j < geometry2.geometries.length; j++)
84582
- if (coordEach2(geometry2.geometries[j], callback, excludeWrapCoord) === false)
82570
+ if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
84583
82571
  return false;
84584
82572
  break;
84585
82573
  default:
@@ -84590,7 +82578,7 @@ function requireJs$n() {
84590
82578
  }
84591
82579
  function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
84592
82580
  var previousValue = initialValue;
84593
- coordEach2(
82581
+ coordEach(
84594
82582
  geojson,
84595
82583
  function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
84596
82584
  if (coordIndex === 0 && initialValue === void 0)
@@ -84632,7 +82620,7 @@ function requireJs$n() {
84632
82620
  });
84633
82621
  return previousValue;
84634
82622
  }
84635
- function featureEach2(geojson, callback) {
82623
+ function featureEach(geojson, callback) {
84636
82624
  if (geojson.type === "Feature") {
84637
82625
  callback(geojson, 0);
84638
82626
  } else if (geojson.type === "FeatureCollection") {
@@ -84643,7 +82631,7 @@ function requireJs$n() {
84643
82631
  }
84644
82632
  function featureReduce(geojson, callback, initialValue) {
84645
82633
  var previousValue = initialValue;
84646
- featureEach2(geojson, function(currentFeature, featureIndex) {
82634
+ featureEach(geojson, function(currentFeature, featureIndex) {
84647
82635
  if (featureIndex === 0 && initialValue === void 0)
84648
82636
  previousValue = currentFeature;
84649
82637
  else previousValue = callback(previousValue, currentFeature, featureIndex);
@@ -84652,7 +82640,7 @@ function requireJs$n() {
84652
82640
  }
84653
82641
  function coordAll(geojson) {
84654
82642
  var coords = [];
84655
- coordEach2(geojson, function(coord) {
82643
+ coordEach(geojson, function(coord) {
84656
82644
  coords.push(coord);
84657
82645
  });
84658
82646
  return coords;
@@ -84737,7 +82725,7 @@ function requireJs$n() {
84737
82725
  return previousValue;
84738
82726
  }
84739
82727
  function flattenEach2(geojson, callback) {
84740
- geomEach2(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
82728
+ geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
84741
82729
  var type = geometry2 === null ? null : geometry2.type;
84742
82730
  switch (type) {
84743
82731
  case null:
@@ -84745,7 +82733,7 @@ function requireJs$n() {
84745
82733
  case "LineString":
84746
82734
  case "Polygon":
84747
82735
  if (callback(
84748
- helpers.feature(geometry2, properties, { bbox: bbox2, id }),
82736
+ helpers.feature(geometry2, properties, { bbox, id }),
84749
82737
  featureIndex,
84750
82738
  0
84751
82739
  ) === false)
@@ -84793,7 +82781,7 @@ function requireJs$n() {
84793
82781
  );
84794
82782
  return previousValue;
84795
82783
  }
84796
- function segmentEach2(geojson, callback) {
82784
+ function segmentEach(geojson, callback) {
84797
82785
  flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
84798
82786
  var segmentIndex = 0;
84799
82787
  if (!feature2.geometry) return;
@@ -84803,7 +82791,7 @@ function requireJs$n() {
84803
82791
  var previousFeatureIndex = 0;
84804
82792
  var previousMultiIndex = 0;
84805
82793
  var prevGeomIndex = 0;
84806
- if (coordEach2(
82794
+ if (coordEach(
84807
82795
  feature2,
84808
82796
  function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
84809
82797
  if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
@@ -84836,7 +82824,7 @@ function requireJs$n() {
84836
82824
  function segmentReduce(geojson, callback, initialValue) {
84837
82825
  var previousValue = initialValue;
84838
82826
  var started = false;
84839
- segmentEach2(
82827
+ segmentEach(
84840
82828
  geojson,
84841
82829
  function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
84842
82830
  if (started === false && initialValue === void 0)
@@ -85058,9 +83046,9 @@ function requireJs$n() {
85058
83046
  throw new Error("geojson is invalid");
85059
83047
  }
85060
83048
  js$k.coordAll = coordAll;
85061
- js$k.coordEach = coordEach2;
83049
+ js$k.coordEach = coordEach;
85062
83050
  js$k.coordReduce = coordReduce;
85063
- js$k.featureEach = featureEach2;
83051
+ js$k.featureEach = featureEach;
85064
83052
  js$k.featureReduce = featureReduce;
85065
83053
  js$k.findPoint = findPoint;
85066
83054
  js$k.findSegment = findSegment;
@@ -85072,7 +83060,7 @@ function requireJs$n() {
85072
83060
  js$k.lineReduce = lineReduce;
85073
83061
  js$k.propEach = propEach;
85074
83062
  js$k.propReduce = propReduce;
85075
- js$k.segmentEach = segmentEach2;
83063
+ js$k.segmentEach = segmentEach;
85076
83064
  js$k.segmentReduce = segmentReduce;
85077
83065
  return js$k;
85078
83066
  }
@@ -85082,7 +83070,7 @@ function requireJs$m() {
85082
83070
  hasRequiredJs$m = 1;
85083
83071
  Object.defineProperty(js$l, "__esModule", { value: true });
85084
83072
  var meta_1 = /* @__PURE__ */ requireJs$n();
85085
- function bbox2(geojson) {
83073
+ function bbox(geojson) {
85086
83074
  var result = [Infinity, Infinity, -Infinity, -Infinity];
85087
83075
  meta_1.coordEach(geojson, function(coord) {
85088
83076
  if (result[0] > coord[0]) {
@@ -85100,8 +83088,8 @@ function requireJs$m() {
85100
83088
  });
85101
83089
  return result;
85102
83090
  }
85103
- bbox2["default"] = bbox2;
85104
- js$l.default = bbox2;
83091
+ bbox["default"] = bbox;
83092
+ js$l.default = bbox;
85105
83093
  return js$l;
85106
83094
  }
85107
83095
  var hasRequiredJs$l;
@@ -95332,7 +93320,7 @@ function length$1(object2) {
95332
93320
  return +lengthSum$1;
95333
93321
  }
95334
93322
  var coordinates = [null, null], object = { type: "LineString", coordinates };
95335
- function distance(a2, b) {
93323
+ function distance$1(a2, b) {
95336
93324
  coordinates[0] = a2;
95337
93325
  coordinates[1] = b;
95338
93326
  return length$1(object);
@@ -95385,10 +93373,10 @@ function containsGeometry(geometry2, point2) {
95385
93373
  return geometry2 && containsGeometryType.hasOwnProperty(geometry2.type) ? containsGeometryType[geometry2.type](geometry2, point2) : false;
95386
93374
  }
95387
93375
  function containsPoint(coordinates2, point2) {
95388
- return distance(coordinates2, point2) === 0;
93376
+ return distance$1(coordinates2, point2) === 0;
95389
93377
  }
95390
93378
  function containsLine(coordinates2, point2) {
95391
- var ab = distance(coordinates2[0], coordinates2[1]), ao = distance(coordinates2[0], point2), ob = distance(point2, coordinates2[1]);
93379
+ var ab = distance$1(coordinates2[0], coordinates2[1]), ao = distance$1(coordinates2[0], point2), ob = distance$1(point2, coordinates2[1]);
95392
93380
  return ao + ob <= ab + epsilon;
95393
93381
  }
95394
93382
  function containsPolygon(coordinates2, point2) {
@@ -96605,7 +94593,7 @@ const d3Geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
96605
94593
  geoConicEquidistant: conicEquidistant,
96606
94594
  geoConicEquidistantRaw: conicEquidistantRaw,
96607
94595
  geoContains: contains,
96608
- geoDistance: distance,
94596
+ geoDistance: distance$1,
96609
94597
  geoEquirectangular: equirectangular,
96610
94598
  geoEquirectangularRaw: equirectangularRaw,
96611
94599
  geoGnomonic: gnomonic,
@@ -97305,8 +95293,8 @@ function requirePolygonClipping_umd() {
97305
95293
  sort(keys2, values, left, j, compare2);
97306
95294
  sort(keys2, values, j + 1, right, compare2);
97307
95295
  }
97308
- var isInBbox2 = function isInBbox3(bbox2, point2) {
97309
- return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
95296
+ var isInBbox2 = function isInBbox3(bbox, point2) {
95297
+ return bbox.ll.x <= point2.x && point2.x <= bbox.ur.x && bbox.ll.y <= point2.y && point2.y <= bbox.ur.y;
97310
95298
  };
97311
95299
  var getBboxOverlap2 = function getBboxOverlap3(b1, b2) {
97312
95300
  if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null;
@@ -97686,7 +95674,7 @@ function requirePolygonClipping_umd() {
97686
95674
  }
97687
95675
  }, {
97688
95676
  key: "bbox",
97689
- value: function bbox2() {
95677
+ value: function bbox() {
97690
95678
  var y12 = this.leftSE.point.y;
97691
95679
  var y2 = this.rightSE.point.y;
97692
95680
  return {
@@ -98623,7 +96611,7 @@ function requireJs$j() {
98623
96611
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
98624
96612
  }
98625
96613
  js$i.getCoord = getCoord2;
98626
- function getCoords2(coords) {
96614
+ function getCoords(coords) {
98627
96615
  if (Array.isArray(coords)) {
98628
96616
  return coords;
98629
96617
  }
@@ -98638,7 +96626,7 @@ function requireJs$j() {
98638
96626
  }
98639
96627
  throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
98640
96628
  }
98641
- js$i.getCoords = getCoords2;
96629
+ js$i.getCoords = getCoords;
98642
96630
  function containsNumber(coordinates2) {
98643
96631
  if (coordinates2.length > 1 && helpers_1.isNumber(coordinates2[0]) && helpers_1.isNumber(coordinates2[1])) {
98644
96632
  return true;
@@ -98768,7 +96756,7 @@ function requireCjs$c() {
98768
96756
  }
98769
96757
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
98770
96758
  }
98771
- function getCoords2(coords) {
96759
+ function getCoords(coords) {
98772
96760
  if (Array.isArray(coords)) {
98773
96761
  return coords;
98774
96762
  }
@@ -98870,7 +96858,7 @@ function requireCjs$c() {
98870
96858
  cjs$b.featureOf = featureOf;
98871
96859
  cjs$b.geojsonType = geojsonType;
98872
96860
  cjs$b.getCoord = getCoord2;
98873
- cjs$b.getCoords = getCoords2;
96861
+ cjs$b.getCoords = getCoords;
98874
96862
  cjs$b.getGeom = getGeom2;
98875
96863
  cjs$b.getType = getType;
98876
96864
  return cjs$b;
@@ -99343,7 +97331,7 @@ function requireFeature() {
99343
97331
  }
99344
97332
  _createClass(Feature2, [{
99345
97333
  key: "getCoords",
99346
- value: function getCoords2() {
97334
+ value: function getCoords() {
99347
97335
  return this.geoJson.geometry.coordinates;
99348
97336
  }
99349
97337
  }]);
@@ -101521,23 +99509,23 @@ var hasRequiredCjs$a;
101521
99509
  function requireCjs$a() {
101522
99510
  if (hasRequiredCjs$a) return cjs$9;
101523
99511
  hasRequiredCjs$a = 1;
101524
- var __defProp2 = Object.defineProperty;
99512
+ var __defProp = Object.defineProperty;
101525
99513
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
101526
99514
  var __getOwnPropNames = Object.getOwnPropertyNames;
101527
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
99515
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
101528
99516
  var __export = (target, all) => {
101529
99517
  for (var name2 in all)
101530
- __defProp2(target, name2, { get: all[name2], enumerable: true });
99518
+ __defProp(target, name2, { get: all[name2], enumerable: true });
101531
99519
  };
101532
99520
  var __copyProps = (to, from, except, desc) => {
101533
99521
  if (from && typeof from === "object" || typeof from === "function") {
101534
99522
  for (let key of __getOwnPropNames(from))
101535
- if (!__hasOwnProp2.call(to, key) && key !== except)
101536
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
99523
+ if (!__hasOwnProp.call(to, key) && key !== except)
99524
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
101537
99525
  }
101538
99526
  return to;
101539
99527
  };
101540
- var __toCommonJS = (mod2) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod2);
99528
+ var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
101541
99529
  var src_exports = {};
101542
99530
  __export(src_exports, {
101543
99531
  SplayTreeMap: () => SplayTreeMap,
@@ -102234,20 +100222,20 @@ function requireCjs$9() {
102234
100222
  if (hasRequiredCjs$9) return cjs$8;
102235
100223
  hasRequiredCjs$9 = 1;
102236
100224
  var __create = Object.create;
102237
- var __defProp2 = Object.defineProperty;
100225
+ var __defProp = Object.defineProperty;
102238
100226
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
102239
100227
  var __getOwnPropNames = Object.getOwnPropertyNames;
102240
100228
  var __getProtoOf = Object.getPrototypeOf;
102241
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
100229
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
102242
100230
  var __export = (target, all) => {
102243
100231
  for (var name2 in all)
102244
- __defProp2(target, name2, { get: all[name2], enumerable: true });
100232
+ __defProp(target, name2, { get: all[name2], enumerable: true });
102245
100233
  };
102246
100234
  var __copyProps = (to, from, except, desc) => {
102247
100235
  if (from && typeof from === "object" || typeof from === "function") {
102248
100236
  for (let key of __getOwnPropNames(from))
102249
- if (!__hasOwnProp2.call(to, key) && key !== except)
102250
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
100237
+ if (!__hasOwnProp.call(to, key) && key !== except)
100238
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
102251
100239
  }
102252
100240
  return to;
102253
100241
  };
@@ -102256,10 +100244,10 @@ function requireCjs$9() {
102256
100244
  // file that has been converted to a CommonJS file using a Babel-
102257
100245
  // compatible transform (i.e. "__esModule" has not been set), then set
102258
100246
  // "default" to the CommonJS "module.exports" for node compatibility.
102259
- __defProp2(target, "default", { value: mod2, enumerable: true }),
100247
+ __defProp(target, "default", { value: mod2, enumerable: true }),
102260
100248
  mod2
102261
100249
  ));
102262
- var __toCommonJS = (mod2) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod2);
100250
+ var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
102263
100251
  var src_exports = {};
102264
100252
  __export(src_exports, {
102265
100253
  difference: () => difference,
@@ -102328,8 +100316,8 @@ function requireCjs$9() {
102328
100316
  };
102329
100317
  };
102330
100318
  var precision2 = set2();
102331
- var isInBbox2 = (bbox2, point2) => {
102332
- return bbox2.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox2.ur.y);
100319
+ var isInBbox2 = (bbox, point2) => {
100320
+ return bbox.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox.ur.x) && bbox.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox.ur.y);
102333
100321
  };
102334
100322
  var getBboxOverlap2 = (b1, b2) => {
102335
100323
  if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
@@ -103904,7 +101892,7 @@ function requireUtils$2() {
103904
101892
  utils$2.distance2d = distance2d;
103905
101893
  utils$2.mix = mix;
103906
101894
  utils$2.nearestPointOnProjectedLine = nearestPointOnProjectedLine;
103907
- utils$2.nearestPointOnLine = nearestPointOnLine2;
101895
+ utils$2.nearestPointOnLine = nearestPointOnLine;
103908
101896
  utils$2.getPickedEditHandle = getPickedEditHandle;
103909
101897
  utils$2.getPickedSnapSourceEditHandle = getPickedSnapSourceEditHandle;
103910
101898
  utils$2.getNonGuidePicks = getNonGuidePicks;
@@ -104001,12 +101989,12 @@ function requireUtils$2() {
104001
101989
  return false;
104002
101990
  }
104003
101991
  function generatePointsParallelToLinePoints(p1, p2, mapCoords) {
104004
- var lineString2 = {
101992
+ var lineString = {
104005
101993
  type: "LineString",
104006
101994
  coordinates: [p1, p2]
104007
101995
  };
104008
101996
  var pt = (0, _helpers.point)(mapCoords);
104009
- var ddistance = (0, _pointToLineDistance["default"])(pt, lineString2);
101997
+ var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
104010
101998
  var lineBearing = (0, _bearing["default"])(p1, p2);
104011
101999
  var isPointToLeftOfLine = (mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);
104012
102000
  var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
@@ -104072,7 +102060,7 @@ function requireUtils$2() {
104072
102060
  }
104073
102061
  };
104074
102062
  }
104075
- function nearestPointOnLine2(lines, inPoint, viewport) {
102063
+ function nearestPointOnLine(lines, inPoint, viewport) {
104076
102064
  var _lines$geometry, _lines$geometry2;
104077
102065
  var mercator2;
104078
102066
  if (viewport) {
@@ -104592,8 +102580,8 @@ function requireImmutableFeatureCollection() {
104592
102580
  }
104593
102581
  function pruneMultiLineStringIfNecessary(geometry2) {
104594
102582
  for (var lineStringIndex = 0; lineStringIndex < geometry2.coordinates.length; lineStringIndex++) {
104595
- var lineString2 = geometry2.coordinates[lineStringIndex];
104596
- if (lineString2.length === 1) {
102583
+ var lineString = geometry2.coordinates[lineStringIndex];
102584
+ if (lineString.length === 1) {
104597
102585
  geometry2.coordinates.splice(lineStringIndex, 1);
104598
102586
  lineStringIndex--;
104599
102587
  }
@@ -105182,8 +103170,8 @@ function requireModifyMode() {
105182
103170
  var intermediatePoint = null;
105183
103171
  var positionIndexPrefix = [];
105184
103172
  var referencePoint = (0, _helpers.point)(mapCoords);
105185
- (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString2, prefix) {
105186
- var lineStringFeature = (0, _helpers.lineString)(lineString2);
103173
+ (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
103174
+ var lineStringFeature = (0, _helpers.lineString)(lineString);
105187
103175
  var candidateIntermediatePoint = _this.getNearestPoint(
105188
103176
  // @ts-ignore
105189
103177
  lineStringFeature,
@@ -105358,30 +103346,30 @@ function requireCjs$6() {
105358
103346
  if (hasRequiredCjs$6) return cjs$6;
105359
103347
  hasRequiredCjs$6 = 1;
105360
103348
  Object.defineProperty(cjs$6, "__esModule", { value: true });
105361
- var __defProp2 = Object.defineProperty;
105362
- var __defProps2 = Object.defineProperties;
105363
- var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
105364
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
105365
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
105366
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
105367
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
105368
- var __spreadValues2 = (a2, b) => {
103349
+ var __defProp = Object.defineProperty;
103350
+ var __defProps = Object.defineProperties;
103351
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
103352
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
103353
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
103354
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
103355
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
103356
+ var __spreadValues = (a2, b) => {
105369
103357
  for (var prop in b || (b = {}))
105370
- if (__hasOwnProp2.call(b, prop))
105371
- __defNormalProp2(a2, prop, b[prop]);
105372
- if (__getOwnPropSymbols2)
105373
- for (var prop of __getOwnPropSymbols2(b)) {
105374
- if (__propIsEnum2.call(b, prop))
105375
- __defNormalProp2(a2, prop, b[prop]);
103358
+ if (__hasOwnProp.call(b, prop))
103359
+ __defNormalProp(a2, prop, b[prop]);
103360
+ if (__getOwnPropSymbols)
103361
+ for (var prop of __getOwnPropSymbols(b)) {
103362
+ if (__propIsEnum.call(b, prop))
103363
+ __defNormalProp(a2, prop, b[prop]);
105376
103364
  }
105377
103365
  return a2;
105378
103366
  };
105379
- var __spreadProps2 = (a2, b) => __defProps2(a2, __getOwnPropDescs2(b));
103367
+ var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
105380
103368
  var _distance = /* @__PURE__ */ requireCjs$b();
105381
103369
  var _meta = /* @__PURE__ */ requireCjs$e();
105382
103370
  var _helpers = /* @__PURE__ */ requireCjs$f();
105383
103371
  var _invariant = /* @__PURE__ */ requireCjs$c();
105384
- function nearestPointOnLine2(lines, pt, options = {}) {
103372
+ function nearestPointOnLine(lines, pt, options = {}) {
105385
103373
  if (!lines || !pt) {
105386
103374
  throw new Error("lines and pt are required arguments");
105387
103375
  }
@@ -105413,7 +103401,7 @@ function requireCjs$6() {
105413
103401
  } else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
105414
103402
  [intersectPos, , wasEnd] = [stopPos, void 0, true];
105415
103403
  } else {
105416
- [intersectPos, , wasEnd] = nearestPointOnSegment2(
103404
+ [intersectPos, , wasEnd] = nearestPointOnSegment(
105417
103405
  start.geometry.coordinates,
105418
103406
  stop.geometry.coordinates,
105419
103407
  _invariant.getCoord.call(void 0, pt)
@@ -105428,8 +103416,8 @@ function requireCjs$6() {
105428
103416
  });
105429
103417
  }
105430
103418
  if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
105431
- closestPt = __spreadProps2(__spreadValues2({}, intersectPt), {
105432
- properties: __spreadProps2(__spreadValues2({}, intersectPt.properties), {
103419
+ closestPt = __spreadProps(__spreadValues({}, intersectPt), {
103420
+ properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
105433
103421
  // Legacy behaviour where index progresses to next segment # if we
105434
103422
  // went with the end point this iteration.
105435
103423
  index: wasEnd ? i2 + 1 : i2
@@ -105452,14 +103440,14 @@ function requireCjs$6() {
105452
103440
  const [v2x, v2y, v2z] = v2;
105453
103441
  return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
105454
103442
  }
105455
- function magnitude2(v) {
103443
+ function magnitude(v) {
105456
103444
  return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
105457
103445
  }
105458
103446
  function angle2(v12, v2) {
105459
- const theta = dot2(v12, v2) / (magnitude2(v12) * magnitude2(v2));
103447
+ const theta = dot2(v12, v2) / (magnitude(v12) * magnitude(v2));
105460
103448
  return Math.acos(Math.min(Math.max(theta, -1), 1));
105461
103449
  }
105462
- function lngLatToVector2(a2) {
103450
+ function lngLatToVector(a2) {
105463
103451
  const lat = _helpers.degreesToRadians.call(void 0, a2[1]);
105464
103452
  const lng = _helpers.degreesToRadians.call(void 0, a2[0]);
105465
103453
  return [
@@ -105468,16 +103456,16 @@ function requireCjs$6() {
105468
103456
  Math.sin(lat)
105469
103457
  ];
105470
103458
  }
105471
- function vectorToLngLat2(v) {
103459
+ function vectorToLngLat(v) {
105472
103460
  const [x, y, z] = v;
105473
103461
  const lat = _helpers.radiansToDegrees.call(void 0, Math.asin(z));
105474
103462
  const lng = _helpers.radiansToDegrees.call(void 0, Math.atan2(y, x));
105475
103463
  return [lng, lat];
105476
103464
  }
105477
- function nearestPointOnSegment2(posA, posB, posC) {
105478
- const A2 = lngLatToVector2(posA);
105479
- const B2 = lngLatToVector2(posB);
105480
- const C3 = lngLatToVector2(posC);
103465
+ function nearestPointOnSegment(posA, posB, posC) {
103466
+ const A2 = lngLatToVector(posA);
103467
+ const B2 = lngLatToVector(posB);
103468
+ const C3 = lngLatToVector(posC);
105481
103469
  const [Cx, Cy, Cz] = C3;
105482
103470
  const [D2, E2, F] = cross2(A2, B2);
105483
103471
  const a2 = E2 * Cz - F * Cy;
@@ -105501,17 +103489,17 @@ function requireCjs$6() {
105501
103489
  I3 = I2;
105502
103490
  }
105503
103491
  if (angle2(A2, I3) > angleAB || angle2(B2, I3) > angleAB) {
105504
- if (_distance.distance.call(void 0, vectorToLngLat2(I3), vectorToLngLat2(A2)) <= _distance.distance.call(void 0, vectorToLngLat2(I3), vectorToLngLat2(B2))) {
105505
- return [vectorToLngLat2(A2), true, false];
103492
+ if (_distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(A2)) <= _distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(B2))) {
103493
+ return [vectorToLngLat(A2), true, false];
105506
103494
  } else {
105507
- return [vectorToLngLat2(B2), false, true];
103495
+ return [vectorToLngLat(B2), false, true];
105508
103496
  }
105509
103497
  }
105510
- return [vectorToLngLat2(I3), false, false];
103498
+ return [vectorToLngLat(I3), false, false];
105511
103499
  }
105512
- var turf_nearest_point_on_line_default = nearestPointOnLine2;
103500
+ var turf_nearest_point_on_line_default = nearestPointOnLine;
105513
103501
  cjs$6.default = turf_nearest_point_on_line_default;
105514
- cjs$6.nearestPointOnLine = nearestPointOnLine2;
103502
+ cjs$6.nearestPointOnLine = nearestPointOnLine;
105515
103503
  return cjs$6;
105516
103504
  }
105517
103505
  var cjs$5 = {};
@@ -105711,8 +103699,8 @@ function requireResizeCircleMode() {
105711
103699
  var intermediatePoint = null;
105712
103700
  var positionIndexPrefix = [];
105713
103701
  var referencePoint = (0, _helpers.point)(mapCoords);
105714
- (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString2, prefix) {
105715
- var lineStringFeature = (0, _helpers.lineString)(lineString2);
103702
+ (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
103703
+ var lineStringFeature = (0, _helpers.lineString)(lineString);
105716
103704
  var candidateIntermediatePoint = _this2.getNearestPoint(
105717
103705
  // @ts-ignore
105718
103706
  lineStringFeature,
@@ -106350,11 +104338,11 @@ function requireJs$4() {
106350
104338
  if (origin === void 0 || origin === null) origin = "centroid";
106351
104339
  if (Array.isArray(origin) || typeof origin === "object")
106352
104340
  return invariant.getCoord(origin);
106353
- var bbox2 = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
106354
- var west = bbox2[0];
106355
- var south = bbox2[1];
106356
- var east = bbox2[2];
106357
- var north = bbox2[3];
104341
+ var bbox = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
104342
+ var west = bbox[0];
104343
+ var south = bbox[1];
104344
+ var east = bbox[2];
104345
+ var north = bbox[3];
106358
104346
  switch (origin) {
106359
104347
  case "sw":
106360
104348
  case "southwest":
@@ -107710,9 +105698,9 @@ function requireCjs$2() {
107710
105698
  const pt = _invariant.getCoord.call(void 0, point2);
107711
105699
  const geom = _invariant.getGeom.call(void 0, polygon2);
107712
105700
  const type = geom.type;
107713
- const bbox2 = polygon2.bbox;
105701
+ const bbox = polygon2.bbox;
107714
105702
  let polys = geom.coordinates;
107715
- if (bbox2 && inBBox2(pt, bbox2) === false) {
105703
+ if (bbox && inBBox2(pt, bbox) === false) {
107716
105704
  return false;
107717
105705
  }
107718
105706
  if (type === "Polygon") {
@@ -107726,8 +105714,8 @@ function requireCjs$2() {
107726
105714
  }
107727
105715
  return result;
107728
105716
  }
107729
- function inBBox2(pt, bbox2) {
107730
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
105717
+ function inBBox2(pt, bbox) {
105718
+ return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
107731
105719
  }
107732
105720
  var turf_boolean_point_in_polygon_default = booleanPointInPolygon2;
107733
105721
  cjs$3.booleanPointInPolygon = booleanPointInPolygon2;
@@ -107735,6 +105723,206 @@ function requireCjs$2() {
107735
105723
  return cjs$3;
107736
105724
  }
107737
105725
  var cjs$1 = {};
105726
+ class TinyQueue {
105727
+ constructor(data = [], compare2 = defaultCompare) {
105728
+ this.data = data;
105729
+ this.length = this.data.length;
105730
+ this.compare = compare2;
105731
+ if (this.length > 0) {
105732
+ for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
105733
+ }
105734
+ }
105735
+ push(item) {
105736
+ this.data.push(item);
105737
+ this.length++;
105738
+ this._up(this.length - 1);
105739
+ }
105740
+ pop() {
105741
+ if (this.length === 0) return void 0;
105742
+ const top = this.data[0];
105743
+ const bottom = this.data.pop();
105744
+ this.length--;
105745
+ if (this.length > 0) {
105746
+ this.data[0] = bottom;
105747
+ this._down(0);
105748
+ }
105749
+ return top;
105750
+ }
105751
+ peek() {
105752
+ return this.data[0];
105753
+ }
105754
+ _up(pos) {
105755
+ const { data, compare: compare2 } = this;
105756
+ const item = data[pos];
105757
+ while (pos > 0) {
105758
+ const parent = pos - 1 >> 1;
105759
+ const current = data[parent];
105760
+ if (compare2(item, current) >= 0) break;
105761
+ data[pos] = current;
105762
+ pos = parent;
105763
+ }
105764
+ data[pos] = item;
105765
+ }
105766
+ _down(pos) {
105767
+ const { data, compare: compare2 } = this;
105768
+ const halfLength = this.length >> 1;
105769
+ const item = data[pos];
105770
+ while (pos < halfLength) {
105771
+ let left = (pos << 1) + 1;
105772
+ let best = data[left];
105773
+ const right = left + 1;
105774
+ if (right < this.length && compare2(data[right], best) < 0) {
105775
+ left = right;
105776
+ best = data[right];
105777
+ }
105778
+ if (compare2(best, item) >= 0) break;
105779
+ data[pos] = best;
105780
+ pos = left;
105781
+ }
105782
+ data[pos] = item;
105783
+ }
105784
+ }
105785
+ function defaultCompare(a2, b) {
105786
+ return a2 < b ? -1 : a2 > b ? 1 : 0;
105787
+ }
105788
+ function checkWhichEventIsLeft(e1, e2) {
105789
+ if (e1.p.x > e2.p.x) return 1;
105790
+ if (e1.p.x < e2.p.x) return -1;
105791
+ if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
105792
+ return 1;
105793
+ }
105794
+ function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
105795
+ if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
105796
+ if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
105797
+ if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
105798
+ return 1;
105799
+ }
105800
+ class Event {
105801
+ constructor(p, featureId2, ringId2, eventId2) {
105802
+ this.p = {
105803
+ x: p[0],
105804
+ y: p[1]
105805
+ };
105806
+ this.featureId = featureId2;
105807
+ this.ringId = ringId2;
105808
+ this.eventId = eventId2;
105809
+ this.otherEvent = null;
105810
+ this.isLeftEndpoint = null;
105811
+ }
105812
+ isSamePoint(eventToCheck) {
105813
+ return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
105814
+ }
105815
+ }
105816
+ function fillEventQueue(geojson, eventQueue) {
105817
+ if (geojson.type === "FeatureCollection") {
105818
+ const features = geojson.features;
105819
+ for (let i2 = 0; i2 < features.length; i2++) {
105820
+ processFeature(features[i2], eventQueue);
105821
+ }
105822
+ } else {
105823
+ processFeature(geojson, eventQueue);
105824
+ }
105825
+ }
105826
+ let featureId = 0;
105827
+ let ringId = 0;
105828
+ let eventId = 0;
105829
+ function processFeature(featureOrGeometry, eventQueue) {
105830
+ const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
105831
+ let coords = geom.coordinates;
105832
+ if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
105833
+ if (geom.type === "LineString") coords = [[coords]];
105834
+ for (let i2 = 0; i2 < coords.length; i2++) {
105835
+ for (let ii = 0; ii < coords[i2].length; ii++) {
105836
+ let currentP = coords[i2][ii][0];
105837
+ let nextP = null;
105838
+ ringId = ringId + 1;
105839
+ for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
105840
+ nextP = coords[i2][ii][iii + 1];
105841
+ const e1 = new Event(currentP, featureId, ringId, eventId);
105842
+ const e2 = new Event(nextP, featureId, ringId, eventId + 1);
105843
+ e1.otherEvent = e2;
105844
+ e2.otherEvent = e1;
105845
+ if (checkWhichEventIsLeft(e1, e2) > 0) {
105846
+ e2.isLeftEndpoint = true;
105847
+ e1.isLeftEndpoint = false;
105848
+ } else {
105849
+ e1.isLeftEndpoint = true;
105850
+ e2.isLeftEndpoint = false;
105851
+ }
105852
+ eventQueue.push(e1);
105853
+ eventQueue.push(e2);
105854
+ currentP = nextP;
105855
+ eventId = eventId + 1;
105856
+ }
105857
+ }
105858
+ }
105859
+ featureId = featureId + 1;
105860
+ }
105861
+ let Segment$1 = class Segment {
105862
+ constructor(event) {
105863
+ this.leftSweepEvent = event;
105864
+ this.rightSweepEvent = event.otherEvent;
105865
+ }
105866
+ };
105867
+ function testSegmentIntersect(seg1, seg2) {
105868
+ if (seg1 === null || seg2 === null) return false;
105869
+ if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId && (seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent))) return false;
105870
+ const x12 = seg1.leftSweepEvent.p.x;
105871
+ const y12 = seg1.leftSweepEvent.p.y;
105872
+ const x2 = seg1.rightSweepEvent.p.x;
105873
+ const y2 = seg1.rightSweepEvent.p.y;
105874
+ const x3 = seg2.leftSweepEvent.p.x;
105875
+ const y3 = seg2.leftSweepEvent.p.y;
105876
+ const x4 = seg2.rightSweepEvent.p.x;
105877
+ const y4 = seg2.rightSweepEvent.p.y;
105878
+ const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
105879
+ const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
105880
+ const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
105881
+ if (denom === 0) {
105882
+ if (numeA === 0 && numeB === 0) return false;
105883
+ return false;
105884
+ }
105885
+ const uA = numeA / denom;
105886
+ const uB = numeB / denom;
105887
+ if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
105888
+ const x = x12 + uA * (x2 - x12);
105889
+ const y = y12 + uA * (y2 - y12);
105890
+ return [x, y];
105891
+ }
105892
+ return false;
105893
+ }
105894
+ function runCheck(eventQueue, ignoreSelfIntersections) {
105895
+ ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
105896
+ const intersectionPoints = [];
105897
+ const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
105898
+ while (eventQueue.length) {
105899
+ const event = eventQueue.pop();
105900
+ if (event.isLeftEndpoint) {
105901
+ const segment = new Segment$1(event);
105902
+ for (let i2 = 0; i2 < outQueue.data.length; i2++) {
105903
+ const otherSeg = outQueue.data[i2];
105904
+ if (ignoreSelfIntersections) {
105905
+ if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
105906
+ }
105907
+ const intersection2 = testSegmentIntersect(segment, otherSeg);
105908
+ if (intersection2 !== false) intersectionPoints.push(intersection2);
105909
+ }
105910
+ outQueue.push(segment);
105911
+ } else if (event.isLeftEndpoint === false) {
105912
+ outQueue.pop();
105913
+ }
105914
+ }
105915
+ return intersectionPoints;
105916
+ }
105917
+ function sweeplineIntersections(geojson, ignoreSelfIntersections) {
105918
+ const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
105919
+ fillEventQueue(geojson, eventQueue);
105920
+ return runCheck(eventQueue, ignoreSelfIntersections);
105921
+ }
105922
+ const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
105923
+ __proto__: null,
105924
+ default: sweeplineIntersections
105925
+ }, Symbol.toStringTag, { value: "Module" }));
107738
105926
  const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(sweeplineIntersections_esm);
107739
105927
  var hasRequiredCjs$1;
107740
105928
  function requireCjs$1() {
@@ -107748,7 +105936,7 @@ function requireCjs$1() {
107748
105936
  var _sweeplineintersections = require$$1$1;
107749
105937
  var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
107750
105938
  var sweeplineIntersections2 = _sweeplineintersections2.default;
107751
- function lineIntersect2(line1, line2, options = {}) {
105939
+ function lineIntersect(line1, line2, options = {}) {
107752
105940
  const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
107753
105941
  let features = [];
107754
105942
  if (line1.type === "FeatureCollection")
@@ -107782,9 +105970,9 @@ function requireCjs$1() {
107782
105970
  }
107783
105971
  return _helpers.featureCollection.call(void 0, results.map((r2) => _helpers.point.call(void 0, r2)));
107784
105972
  }
107785
- var turf_line_intersect_default = lineIntersect2;
105973
+ var turf_line_intersect_default = lineIntersect;
107786
105974
  cjs$1.default = turf_line_intersect_default;
107787
- cjs$1.lineIntersect = lineIntersect2;
105975
+ cjs$1.lineIntersect = lineIntersect;
107788
105976
  return cjs$1;
107789
105977
  }
107790
105978
  var hasRequiredSplitPolygonMode;
@@ -111648,8 +109836,8 @@ function requireDraw90degreePolygonMode() {
111648
109836
  return;
111649
109837
  }
111650
109838
  if (clickSequence.length === 3 && tentativeFeature.geometry.type === "LineString") {
111651
- var lineString2 = tentativeFeature.geometry;
111652
- clickSequence[clickSequence.length - 1] = lineString2.coordinates[lineString2.coordinates.length - 1];
109839
+ var lineString = tentativeFeature.geometry;
109840
+ clickSequence[clickSequence.length - 1] = lineString.coordinates[lineString.coordinates.length - 1];
111653
109841
  } else if (clickSequence.length > 3 && tentativeFeature.geometry.type === "Polygon") {
111654
109842
  var polygon2 = tentativeFeature.geometry;
111655
109843
  clickSequence[clickSequence.length - 1] = polygon2.coordinates[0][polygon2.coordinates[0].length - 2];
@@ -117519,12 +115707,12 @@ function requireUtils$1() {
117519
115707
  return false;
117520
115708
  }
117521
115709
  function generatePointsParallelToLinePoints(p1, p2, groundCoords) {
117522
- var lineString2 = {
115710
+ var lineString = {
117523
115711
  type: "LineString",
117524
115712
  coordinates: [p1, p2]
117525
115713
  };
117526
115714
  var pt = (0, _helpers.point)(groundCoords);
117527
- var ddistance = (0, _pointToLineDistance["default"])(pt, lineString2);
115715
+ var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
117528
115716
  var lineBearing = (0, _bearing["default"])(p1, p2);
117529
115717
  var isPointToLeftOfLine = (groundCoords[0] - p1[0]) * (p2[1] - p1[1]) - (groundCoords[1] - p1[1]) * (p2[0] - p1[0]);
117530
115718
  var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
@@ -119192,31 +117380,35 @@ class SelectionLayer extends CompositeLayer {
119192
117380
  const { flipY, obsLayers } = this.props;
119193
117381
  const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
119194
117382
  const selectedPolygon = polygon(flippedCoordinates);
117383
+ let minX = Infinity;
117384
+ let minY = Infinity;
117385
+ let maxX = -Infinity;
117386
+ let maxY = -Infinity;
117387
+ flippedCoordinates[0].forEach(([x, y]) => {
117388
+ minX = Math.min(minX, x);
117389
+ minY = Math.min(minY, y);
117390
+ maxX = Math.max(maxX, x);
117391
+ maxY = Math.max(maxY, y);
117392
+ });
119195
117393
  obsLayers.forEach((obsLayer) => {
119196
117394
  const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
119197
- const pickingInfos = [];
117395
+ const pickingIds = [];
119198
117396
  obsQuadTree?.visit((node2, x02, y02, x12, y12) => {
119199
- const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
119200
- const nodePolygon = polygon(nodePoints);
119201
- const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
119202
- const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
119203
- const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
119204
- if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
117397
+ if (x02 > maxX || y02 > maxY || x12 < minX || y12 < minY) {
119205
117398
  return true;
119206
117399
  }
119207
- if (node2.data) {
117400
+ if (!node2.length) {
119208
117401
  let current = node2;
119209
117402
  while (current) {
119210
- const pointCoords = [].slice.call(getObsCoords(current.data));
119211
- if (booleanPointInPolygon(point(pointCoords), selectedPolygon)) {
119212
- pickingInfos.push(current.data);
117403
+ const [x, y] = getObsCoords(current.data);
117404
+ if (booleanPointInPolygon([x, y], selectedPolygon)) {
117405
+ pickingIds.push(obsIndex[current.data]);
119213
117406
  }
119214
117407
  current = current.next;
119215
117408
  }
119216
117409
  }
119217
117410
  return false;
119218
117411
  });
119219
- const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
119220
117412
  layerOnSelect(pickingIds);
119221
117413
  });
119222
117414
  }
@@ -120391,22 +118583,22 @@ function addDecoder(cases, importFn) {
120391
118583
  }
120392
118584
  cases.forEach((c) => registry$1.set(c, importFn));
120393
118585
  }
120394
- addDecoder([void 0, 1], () => import("./raw-DqOqmksW.js").then((m) => m.default));
120395
- addDecoder(5, () => import("./lzw-Cj3FuoEM.js").then((m) => m.default));
118586
+ addDecoder([void 0, 1], () => import("./raw-BAHpKBOQ.js").then((m) => m.default));
118587
+ addDecoder(5, () => import("./lzw-Eqgdi-5y.js").then((m) => m.default));
120396
118588
  addDecoder(6, () => {
120397
118589
  throw new Error("old style JPEG compression is not supported.");
120398
118590
  });
120399
- addDecoder(7, () => import("./jpeg-DdRwUGtb.js").then((m) => m.default));
120400
- addDecoder([8, 32946], () => import("./deflate-CYRafIfN.js").then((m) => m.default));
120401
- addDecoder(32773, () => import("./packbits-QWSBfY1A.js").then((m) => m.default));
118591
+ addDecoder(7, () => import("./jpeg-8Fhu5IUP.js").then((m) => m.default));
118592
+ addDecoder([8, 32946], () => import("./deflate-GJVKgRjP.js").then((m) => m.default));
118593
+ addDecoder(32773, () => import("./packbits-DIQMV7Je.js").then((m) => m.default));
120402
118594
  addDecoder(
120403
118595
  34887,
120404
- () => import("./lerc-CbvtcHx_.js").then(async (m) => {
118596
+ () => import("./lerc-Bz4vYK5F.js").then(async (m) => {
120405
118597
  await m.zstd.init();
120406
118598
  return m;
120407
118599
  }).then((m) => m.default)
120408
118600
  );
120409
- addDecoder(50001, () => import("./webimage-8chAb-F3.js").then((m) => m.default));
118601
+ addDecoder(50001, () => import("./webimage-BNs5asyH.js").then((m) => m.default));
120410
118602
  function decodeRowAcc(row, stride) {
120411
118603
  let length2 = row.length - stride;
120412
118604
  let offset = 0;
@@ -131762,17 +129954,17 @@ function sizeToMeters(size2, unit2) {
131762
129954
  throw new Error("Received unknown unit");
131763
129955
  }
131764
129956
  function snapValue(value) {
131765
- let magnitude2 = 0;
129957
+ let magnitude = 0;
131766
129958
  if (value < MIN_TARGET || value > MAX_TARGET) {
131767
- magnitude2 = Math.floor(Math.log10(value));
129959
+ magnitude = Math.floor(Math.log10(value));
131768
129960
  }
131769
129961
  let snappedUnit = SI_PREFIXES.find(
131770
- (p) => p.exponent % 3 === 0 && p.exponent <= magnitude2
129962
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude
131771
129963
  );
131772
129964
  let adjustedValue = value / 10 ** snappedUnit.exponent;
131773
129965
  if (adjustedValue > 500 && adjustedValue <= 1e3) {
131774
129966
  snappedUnit = SI_PREFIXES.find(
131775
- (p) => p.exponent % 3 === 0 && p.exponent <= magnitude2 + 3
129967
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
131776
129968
  );
131777
129969
  adjustedValue = value / 10 ** snappedUnit.exponent;
131778
129970
  }
@@ -134324,6 +132516,139 @@ class BitmaskLayer2 extends XRLayer {
134324
132516
  }
134325
132517
  BitmaskLayer2.layerName = "BitmaskLayer";
134326
132518
  BitmaskLayer2.defaultProps = defaultProps$2;
132519
+ function geomEach(geojson, callback) {
132520
+ var i2, j, g2, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId2, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
132521
+ for (i2 = 0; i2 < stop; i2++) {
132522
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
132523
+ featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
132524
+ featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
132525
+ featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
132526
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
132527
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
132528
+ for (g2 = 0; g2 < stopG; g2++) {
132529
+ geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
132530
+ if (geometry2 === null) {
132531
+ if (callback(
132532
+ null,
132533
+ featureIndex,
132534
+ featureProperties,
132535
+ featureBBox,
132536
+ featureId2
132537
+ ) === false)
132538
+ return false;
132539
+ continue;
132540
+ }
132541
+ switch (geometry2.type) {
132542
+ case "Point":
132543
+ case "LineString":
132544
+ case "MultiPoint":
132545
+ case "Polygon":
132546
+ case "MultiLineString":
132547
+ case "MultiPolygon": {
132548
+ if (callback(
132549
+ geometry2,
132550
+ featureIndex,
132551
+ featureProperties,
132552
+ featureBBox,
132553
+ featureId2
132554
+ ) === false)
132555
+ return false;
132556
+ break;
132557
+ }
132558
+ case "GeometryCollection": {
132559
+ for (j = 0; j < geometry2.geometries.length; j++) {
132560
+ if (callback(
132561
+ geometry2.geometries[j],
132562
+ featureIndex,
132563
+ featureProperties,
132564
+ featureBBox,
132565
+ featureId2
132566
+ ) === false)
132567
+ return false;
132568
+ }
132569
+ break;
132570
+ }
132571
+ default:
132572
+ throw new Error("Unknown Geometry Type");
132573
+ }
132574
+ }
132575
+ featureIndex++;
132576
+ }
132577
+ }
132578
+ function geomReduce(geojson, callback, initialValue) {
132579
+ var previousValue = initialValue;
132580
+ geomEach(
132581
+ geojson,
132582
+ function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
132583
+ previousValue = callback(
132584
+ previousValue,
132585
+ currentGeometry,
132586
+ featureIndex,
132587
+ featureProperties,
132588
+ featureBBox,
132589
+ featureId2
132590
+ );
132591
+ }
132592
+ );
132593
+ return previousValue;
132594
+ }
132595
+ function flattenEach(geojson, callback) {
132596
+ geomEach(geojson, function(geometry2, featureIndex, properties, bbox, id) {
132597
+ var type = geometry2 === null ? null : geometry2.type;
132598
+ switch (type) {
132599
+ case null:
132600
+ case "Point":
132601
+ case "LineString":
132602
+ case "Polygon":
132603
+ if (callback(
132604
+ feature$1(geometry2, properties, { bbox, id }),
132605
+ featureIndex,
132606
+ 0
132607
+ ) === false)
132608
+ return false;
132609
+ return;
132610
+ }
132611
+ var geomType;
132612
+ switch (type) {
132613
+ case "MultiPoint":
132614
+ geomType = "Point";
132615
+ break;
132616
+ case "MultiLineString":
132617
+ geomType = "LineString";
132618
+ break;
132619
+ case "MultiPolygon":
132620
+ geomType = "Polygon";
132621
+ break;
132622
+ }
132623
+ for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
132624
+ var coordinate = geometry2.coordinates[multiFeatureIndex];
132625
+ var geom = {
132626
+ type: geomType,
132627
+ coordinates: coordinate
132628
+ };
132629
+ if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
132630
+ return false;
132631
+ }
132632
+ });
132633
+ }
132634
+ function flattenReduce(geojson, callback, initialValue) {
132635
+ var previousValue = initialValue;
132636
+ flattenEach(
132637
+ geojson,
132638
+ function(currentFeature, featureIndex, multiFeatureIndex) {
132639
+ if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
132640
+ previousValue = currentFeature;
132641
+ else
132642
+ previousValue = callback(
132643
+ previousValue,
132644
+ currentFeature,
132645
+ featureIndex,
132646
+ multiFeatureIndex
132647
+ );
132648
+ }
132649
+ );
132650
+ return previousValue;
132651
+ }
134327
132652
  var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
134328
132653
  function clone(configObject) {
134329
132654
  var div2, convertBase2, parseNumeric, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
@@ -136164,8 +134489,8 @@ var set = (eps) => {
136164
134489
  };
136165
134490
  };
136166
134491
  var precision = set();
136167
- var isInBbox = (bbox2, point2) => {
136168
- return bbox2.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox2.ur.y);
134492
+ var isInBbox = (bbox, point2) => {
134493
+ return bbox.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox.ur.x) && bbox.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox.ur.y);
136169
134494
  };
136170
134495
  var getBboxOverlap = (b1, b2) => {
136171
134496
  if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
@@ -137265,6 +135590,19 @@ function ringArea(coords) {
137265
135590
  }
137266
135591
  return total * FACTOR;
137267
135592
  }
135593
+ function distance(from, to, options = {}) {
135594
+ var coordinates1 = getCoord(from);
135595
+ var coordinates2 = getCoord(to);
135596
+ var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
135597
+ var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
135598
+ var lat1 = degreesToRadians(coordinates1[1]);
135599
+ var lat2 = degreesToRadians(coordinates2[1]);
135600
+ var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
135601
+ return radiansToLength(
135602
+ 2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
135603
+ options.units
135604
+ );
135605
+ }
137268
135606
  const DEFAULT_THRESHOLD = 1;
137269
135607
  const defaultProps$1 = {
137270
135608
  // for text
@@ -137361,7 +135699,7 @@ class ContourLayerWithText extends ContourLayer {
137361
135699
  const circlePoint = point(circleCoord);
137362
135700
  polygonVertices.forEach((polyCoord) => {
137363
135701
  const polyPoint = point(polyCoord);
137364
- const dist2 = distance$1(circlePoint, polyPoint);
135702
+ const dist2 = distance(circlePoint, polyPoint);
137365
135703
  if (dist2 < minDist) {
137366
135704
  minDist = dist2;
137367
135705
  minCirclePoint = circleCoord;
@@ -137834,10 +136172,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
137834
136172
  getLineColor: strokeColor,
137835
136173
  getLineWidth: strokeWidth,
137836
136174
  lineWidthUnits: "pixels",
137837
- ...dashArray ? {
137838
- extensions: [new PathStyleExtension({ dash: true })],
137839
- getDashArray: dashArray
137840
- } : {}
136175
+ extensions: dashExt,
136176
+ getDashArray: getDash
137841
136177
  }));
137842
136178
  if (shape.text && labelOpacity > 0) {
137843
136179
  layers.push(new TextLayer({
@@ -137872,8 +136208,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
137872
136208
  layers.push(new PathLayer({
137873
136209
  ...base,
137874
136210
  id: `annotation-line-${uid2}-${i2}`,
137875
- extensions: [new PathStyleExtension({ dash: true })],
137876
- getDashArray: dashArray ?? [0, 0],
136211
+ extensions: dashExt,
136212
+ getDashArray: getDash,
137877
136213
  data: [{ path: [[srcX, srcY], [tgtX, tgtY]] }],
137878
136214
  getPath: (d) => d.path,
137879
136215
  getColor: strokeColor,
@@ -138021,10 +136357,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
138021
136357
  getLineColor: strokeColor,
138022
136358
  getLineWidth: strokeWidth,
138023
136359
  lineWidthUnits: "pixels",
138024
- ...dashArray ? {
138025
- extensions: [new PathStyleExtension({ dash: true })],
138026
- getDashArray: dashArray
138027
- } : {}
136360
+ extensions: dashExt,
136361
+ getDashArray: getDash
138028
136362
  }));
138029
136363
  if (shape.text && labelOpacity > 0) {
138030
136364
  layers.push(new TextLayer({