@konfirm/geojson 1.0.0 → 1.0.1

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.
Files changed (127) hide show
  1. package/README.md +7 -7
  2. package/dist/{geojson.d.ts → main.d.mts} +18 -79
  3. package/dist/main.d.ts +137 -15
  4. package/dist/main.global.js +853 -0
  5. package/dist/main.global.js.map +1 -0
  6. package/dist/main.js +824 -0
  7. package/dist/main.js.map +1 -0
  8. package/dist/main.mjs +772 -0
  9. package/dist/main.mjs.map +1 -0
  10. package/package.json +101 -63
  11. package/.editorconfig +0 -16
  12. package/.github/workflows/release.yml +0 -21
  13. package/.github/workflows/tests.yml +0 -56
  14. package/CHANGELOG.md +0 -21
  15. package/dist/Domain/Constants.d.ts +0 -5
  16. package/dist/Domain/GeoJSON/Concept/Altitude.d.ts +0 -3
  17. package/dist/Domain/GeoJSON/Concept/BoundingBox.d.ts +0 -6
  18. package/dist/Domain/GeoJSON/Concept/ExteriorRing.d.ts +0 -4
  19. package/dist/Domain/GeoJSON/Concept/GeoJSONObject.d.ts +0 -11
  20. package/dist/Domain/GeoJSON/Concept/InteriorRing.d.ts +0 -4
  21. package/dist/Domain/GeoJSON/Concept/Latitude.d.ts +0 -3
  22. package/dist/Domain/GeoJSON/Concept/LinearRing.d.ts +0 -4
  23. package/dist/Domain/GeoJSON/Concept/Longitude.d.ts +0 -3
  24. package/dist/Domain/GeoJSON/Concept/Position.d.ts +0 -7
  25. package/dist/Domain/GeoJSON/Feature.d.ts +0 -12
  26. package/dist/Domain/GeoJSON/FeatureCollection.d.ts +0 -8
  27. package/dist/Domain/GeoJSON/GeoJSON.d.ts +0 -7
  28. package/dist/Domain/GeoJSON/Geometry/LineString.d.ts +0 -11
  29. package/dist/Domain/GeoJSON/Geometry/MultiLineString.d.ts +0 -7
  30. package/dist/Domain/GeoJSON/Geometry/MultiPoint.d.ts +0 -8
  31. package/dist/Domain/GeoJSON/Geometry/MultiPolygon.d.ts +0 -7
  32. package/dist/Domain/GeoJSON/Geometry/Point.d.ts +0 -11
  33. package/dist/Domain/GeoJSON/Geometry/Polygon.d.ts +0 -11
  34. package/dist/Domain/GeoJSON/Geometry.d.ts +0 -9
  35. package/dist/Domain/GeoJSON/GeometryCollection.d.ts +0 -8
  36. package/dist/Domain/GeoJSON/GeometryObject.d.ts +0 -12
  37. package/dist/Domain/Guards/Number.d.ts +0 -3
  38. package/dist/Domain/Guards/Tuple.d.ts +0 -3
  39. package/dist/Domain/Iterator/IterablePair.d.ts +0 -32
  40. package/dist/Domain/Iterator/SimpleGeometry.d.ts +0 -90
  41. package/dist/Domain/Utility/Calculate.d.ts +0 -9
  42. package/dist/Domain/Utility/Distance.d.ts +0 -3
  43. package/dist/Domain/Utility/Intersect.d.ts +0 -2
  44. package/dist/Domain/Utility/Segments.d.ts +0 -2
  45. package/dist/Domain/Utility/Winding.d.ts +0 -3
  46. package/dist/geojson.cjs.js +0 -655
  47. package/dist/geojson.cjs.min.js +0 -1
  48. package/dist/geojson.es.js +0 -627
  49. package/dist/geojson.es.min.js +0 -1
  50. package/dist/geojson.js +0 -660
  51. package/dist/geojson.min.js +0 -1
  52. package/rollup.config.mjs +0 -43
  53. package/source/Domain/Constants.ts +0 -5
  54. package/source/Domain/GeoJSON/Concept/Altitude.ts +0 -9
  55. package/source/Domain/GeoJSON/Concept/BoundingBox.ts +0 -31
  56. package/source/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -12
  57. package/source/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -23
  58. package/source/Domain/GeoJSON/Concept/InteriorRing.ts +0 -12
  59. package/source/Domain/GeoJSON/Concept/Latitude.ts +0 -7
  60. package/source/Domain/GeoJSON/Concept/LinearRing.ts +0 -14
  61. package/source/Domain/GeoJSON/Concept/Longitude.ts +0 -7
  62. package/source/Domain/GeoJSON/Concept/Position.ts +0 -18
  63. package/source/Domain/GeoJSON/Feature.ts +0 -24
  64. package/source/Domain/GeoJSON/FeatureCollection.ts +0 -16
  65. package/source/Domain/GeoJSON/GeoJSON.ts +0 -9
  66. package/source/Domain/GeoJSON/Geometry/LineString.ts +0 -12
  67. package/source/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -9
  68. package/source/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -10
  69. package/source/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -9
  70. package/source/Domain/GeoJSON/Geometry/Point.ts +0 -12
  71. package/source/Domain/GeoJSON/Geometry/Polygon.ts +0 -20
  72. package/source/Domain/GeoJSON/Geometry.ts +0 -11
  73. package/source/Domain/GeoJSON/GeometryCollection.ts +0 -23
  74. package/source/Domain/GeoJSON/GeometryObject.ts +0 -20
  75. package/source/Domain/Guards/Number.ts +0 -13
  76. package/source/Domain/Guards/Tuple.ts +0 -6
  77. package/source/Domain/Guards/Utility.ts +0 -1
  78. package/source/Domain/Iterator/IterablePair.ts +0 -47
  79. package/source/Domain/Iterator/SimpleGeometry.ts +0 -137
  80. package/source/Domain/Utility/Calculate.ts +0 -143
  81. package/source/Domain/Utility/Distance.ts +0 -56
  82. package/source/Domain/Utility/Intersect.ts +0 -42
  83. package/source/Domain/Utility/Numeric.ts +0 -8
  84. package/source/Domain/Utility/Segments.ts +0 -5
  85. package/source/Domain/Utility/Winding.ts +0 -19
  86. package/source/main.ts +0 -20
  87. package/test/Domain/GeoJSON/Concept/Altitude.ts +0 -58
  88. package/test/Domain/GeoJSON/Concept/BoundingBox.ts +0 -77
  89. package/test/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -65
  90. package/test/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -56
  91. package/test/Domain/GeoJSON/Concept/InteriorRing.ts +0 -65
  92. package/test/Domain/GeoJSON/Concept/Latitude.ts +0 -56
  93. package/test/Domain/GeoJSON/Concept/LinearRing.ts +0 -63
  94. package/test/Domain/GeoJSON/Concept/Longitude.ts +0 -56
  95. package/test/Domain/GeoJSON/Concept/Position.ts +0 -56
  96. package/test/Domain/GeoJSON/Feature.ts +0 -9
  97. package/test/Domain/GeoJSON/FeatureCollection.ts +0 -9
  98. package/test/Domain/GeoJSON/GeoJSON.ts +0 -21
  99. package/test/Domain/GeoJSON/Geometry/LineString.ts +0 -11
  100. package/test/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -11
  101. package/test/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -11
  102. package/test/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -11
  103. package/test/Domain/GeoJSON/Geometry/Point.ts +0 -11
  104. package/test/Domain/GeoJSON/Geometry/Polygon.ts +0 -11
  105. package/test/Domain/GeoJSON/Geometry.ts +0 -9
  106. package/test/Domain/GeoJSON/GeometryCollection.ts +0 -9
  107. package/test/Domain/GeoJSON/GeometryObject.ts +0 -4
  108. package/test/Domain/Guards/Number.ts +0 -49
  109. package/test/Domain/Guards/Tuple.ts +0 -27
  110. package/test/Domain/Iterator/IterablePair.ts +0 -203
  111. package/test/Domain/Iterator/SimpleGeometry.ts +0 -195
  112. package/test/Domain/Utility/Calculate.ts +0 -178
  113. package/test/Domain/Utility/Distance.ts +0 -19
  114. package/test/Domain/Utility/Intersect.ts +0 -54
  115. package/test/Domain/Utility/Numeric.ts +0 -30
  116. package/test/Domain/Utility/Winding.ts +0 -52
  117. package/test/README.ts +0 -123
  118. package/test/data/Distance.ts +0 -51
  119. package/test/data/HolySee.ts +0 -74
  120. package/test/data/Intersect.ts +0 -300
  121. package/test/data/Italy.ts +0 -2883
  122. package/test/data/SanMarino.ts +0 -83
  123. package/test/data/Shapes.ts +0 -107
  124. package/test/helper/geometry.ts +0 -76
  125. package/test/helper/malform.ts +0 -82
  126. package/test/main.ts +0 -4
  127. package/tsconfig.json +0 -12
package/dist/geojson.js DELETED
@@ -1,660 +0,0 @@
1
- var GeoJSON = (function (exports) {
2
- 'use strict';
3
-
4
- function segments(line) {
5
- return line.slice(1).map((point, index) => [line[index], point]);
6
- }
7
-
8
- const EARTH_RADIUS = 6371008.7714; // mean radius
9
- const EARTH_RADIUS_MAJOR = 6378137; // equatorial radius
10
- const EARTH_RADIUS_MINOR = 6356752.314245; // semiminor axis
11
- const EARTH_FLATTENING = 298.257223563;
12
- const GPS_SATELLITE_ORBIT = 20180000;
13
-
14
- const D2R = Math.PI / 180;
15
- const π = Math.PI;
16
- function constrain(value, min, max) {
17
- return Math.max(Math.min(value, max), min);
18
- }
19
- function squared(n) {
20
- return n * n;
21
- }
22
- function rad(n) {
23
- return n * D2R;
24
- }
25
- const EARTH_RADIUS_MAJOR_SQUARED = squared(EARTH_RADIUS_MAJOR);
26
- const EARTH_RADIUS_MINOR_SQUARED = squared(EARTH_RADIUS_MINOR);
27
- const EARTH_RADIUS_FACTOR = (EARTH_RADIUS_MAJOR_SQUARED - EARTH_RADIUS_MINOR_SQUARED) / EARTH_RADIUS_MINOR_SQUARED;
28
- const EARTH_INVERSE_FLATTENING = 1 / EARTH_FLATTENING;
29
- const PointToPoint = {
30
- cartesian([λa, φa], [λb, φb]) {
31
- return EARTH_RADIUS * rad(Math.sqrt(squared(λb - λa) + squared(φb - φa)));
32
- },
33
- haversine([λa, φa], [λb, φb]) {
34
- //https://www.movable-type.co.uk/scripts/latlong.html
35
- const Δ = squared(Math.sin(rad(φb - φa) / 2)) + Math.cos(rad(φa)) * Math.cos(rad(φb)) * squared(Math.sin(rad(λb - λa) / 2));
36
- return EARTH_RADIUS * Math.atan2(Math.sqrt(Δ), Math.sqrt(1 - Δ)) * 2;
37
- },
38
- vincenty(...points) {
39
- //https://www.movable-type.co.uk/scripts/latlong-vincenty.html
40
- const [[λ1, φ1], [λ2, φ2]] = points.map((p) => p.map(rad));
41
- const L = λ2 - λ1; // L = difference in longitude, U = reduced latitude, defined by tan U = (1-f)·tanφ.
42
- const tanU1 = (1 - EARTH_INVERSE_FLATTENING) * Math.tan(φ1), cosU1 = 1 / Math.sqrt((1 + tanU1 * tanU1)), sinU1 = tanU1 * cosU1;
43
- const tanU2 = (1 - EARTH_INVERSE_FLATTENING) * Math.tan(φ2), cosU2 = 1 / Math.sqrt((1 + tanU2 * tanU2)), sinU2 = tanU2 * cosU2;
44
- const antipodal = Math.abs(L) > π / 2 || Math.abs(φ2 - φ1) > π / 2;
45
- let λ = L;
46
- let sinλ = null;
47
- let cosλ = null; // λ = difference in longitude on an auxiliary sphere
48
- let σ = antipodal ? π : 0;
49
- let sinσ = 0;
50
- let cosσ = antipodal ? -1 : 1;
51
- let sinSqσ = null; // σ = angular distance P₁ P₂ on the sphere
52
- let cos2σₘ = 1; // σₘ = angular distance on the sphere from the equator to the midpoint of the line
53
- let cosSqα = 1; // α = azimuth of the geodesic at the equator
54
- let λʹ = null;
55
- let iterations = 0;
56
- do {
57
- sinλ = Math.sin(λ);
58
- cosλ = Math.cos(λ);
59
- sinSqσ = (cosU2 * sinλ) ** 2 + (cosU1 * sinU2 - sinU1 * cosU2 * cosλ) ** 2;
60
- if (Math.abs(sinSqσ) < 1e-24)
61
- break; // co-incident/antipodal points (σ < ≈0.006mm)
62
- sinσ = Math.sqrt(sinSqσ);
63
- cosσ = sinU1 * sinU2 + cosU1 * cosU2 * cosλ;
64
- σ = Math.atan2(sinσ, cosσ);
65
- const sinα = cosU1 * cosU2 * sinλ / sinσ;
66
- cosSqα = 1 - sinα * sinα;
67
- cos2σₘ = (cosSqα != 0) ? (cosσ - 2 * sinU1 * sinU2 / cosSqα) : 0; // on equatorial line cos²α = 0 (§6)
68
- const C = EARTH_INVERSE_FLATTENING / 16 * cosSqα * (4 + EARTH_INVERSE_FLATTENING * (4 - 3 * cosSqα));
69
- λʹ = λ;
70
- λ = L + (1 - C) * EARTH_INVERSE_FLATTENING * sinα * (σ + C * sinσ * (cos2σₘ + C * cosσ * (-1 + 2 * cos2σₘ * cos2σₘ)));
71
- // TODO: add tests
72
- // const iterationCheck = antipodal ? Math.abs(λ) - π : Math.abs(λ);
73
- // if (iterationCheck > π) throw new EvalError('λ > π');
74
- } while (Math.abs(λ - λʹ) > 1e-12 && ++iterations < 1000); // TV: 'iterate until negligible change in λ' (≈0.006mm)
75
- // TODO: add tests
76
- // if (iterations >= 1000) throw new EvalError('Vincenty formula failed to converge');
77
- const uSq = cosSqα * EARTH_RADIUS_FACTOR;
78
- const A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
79
- const B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
80
- const Δσ = B * sinσ * (cos2σₘ + B / 4 * (cosσ * (-1 + 2 * cos2σₘ * cos2σₘ) - B / 6 * cos2σₘ * (-3 + 4 * sinσ * sinσ) * (-3 + 4 * cos2σₘ * cos2σₘ)));
81
- return EARTH_RADIUS_MINOR * A * (σ - Δσ);
82
- },
83
- };
84
- function getClosestPointOnLineByPoint(point, line) {
85
- const [[px, py], [ax, ay], [bx, by]] = [point, ...line];
86
- const [abx, aby] = [bx - ax, by - ay];
87
- const [apx, apy] = [px - ax, py - ay];
88
- const t = constrain((apx * abx + apy * aby) / (abx * abx + aby * aby), 0, 1);
89
- return t === 0 || t === 1 ? line[t] : [ax + abx * t, ay + aby * t];
90
- }
91
- function getDistanceOfPointToPoint(a, b, calculation) {
92
- const calc = typeof calculation === 'function' ? calculation : PointToPoint[calculation];
93
- if (typeof calc === 'function') {
94
- return calc(a, b);
95
- }
96
- throw new Error(`Not a PointToPoint calculation function ${calculation}`);
97
- }
98
- function getDistanceOfPointToLine(point, line, calculation) {
99
- return getDistanceOfPointToPoint(point, getClosestPointOnLineByPoint(point, line), calculation);
100
- }
101
- function getDistanceOfLineToLine(a, b, calculation) {
102
- return isLinesCrossing(a, b)
103
- ? 0
104
- : Math.min(...a.map((a) => getDistanceOfPointToLine(a, b, calculation)), ...b.map((b) => getDistanceOfPointToLine(b, a, calculation)));
105
- }
106
- function isLinesCrossing(a, b) {
107
- const [[a1x, a1y], [a2x, a2y]] = a;
108
- const [[b1x, b1y], [b2x, b2y]] = b;
109
- const [s1x, s1y, s2x, s2y] = [a2x - a1x, a2y - a1y, b2x - b1x, b2y - b1y];
110
- const s = (-s1y * (a1x - b1x) + s1x * (a1y - b1y)) / (-s2x * s1y + s1x * s2y);
111
- const t = (s2x * (a1y - b1y) - s2y * (a1x - b1x)) / (-s2x * s1y + s1x * s2y);
112
- return s >= 0 && s <= 1 && t >= 0 && t <= 1;
113
- }
114
- function isPointOnLine(point, line, threshold = 1e-14) {
115
- return getDistanceOfPointToLine(point, line, 'cartesian') < threshold;
116
- }
117
- function isPointInRing(p, ring) {
118
- const { length } = ring;
119
- const odd = ring
120
- .reduce((odd, a, i) => {
121
- const b = ring[(length + i - 1) % length];
122
- return (a[1] < p[1] && b[1] >= p[1] || b[1] < p[1] && a[1] >= p[1]) && (a[0] <= p[0] || b[0] <= p[0])
123
- ? odd ^ Number(a[0] + (p[1] - a[1]) / (b[1] - a[1]) * (b[0] - a[0]) < p[0])
124
- : odd;
125
- }, 0);
126
- return odd !== 0 || ring.slice(1).some((a, index) => isPointOnLine(p, [ring[index], a]));
127
- }
128
-
129
- /**
130
- * Iterator class to turn any GeoJSON structure into one or more SimpleGeometry (Point | LineString | Polygon) objects
131
- *
132
- * @export
133
- * @class SimpleGeometryIterator
134
- */
135
- class SimpleGeometryIterator {
136
- /**
137
- * Creates an instance of SimpleGeometryIterator
138
- *
139
- * @param {...[GeoJSON, ...Array<GeoJSON>]} inputs
140
- * @memberof SimpleGeometryIterator
141
- */
142
- constructor(...inputs) {
143
- this.inputs = [];
144
- this.inputs = inputs;
145
- }
146
- /**
147
- * Generator yielding all SimpleGeometry objects from the provided GeoJSON structure(s)
148
- *
149
- * @return {*} {Iterator<SimpleGeometry>}
150
- * @memberof SimpleGeometryIterator
151
- */
152
- *[Symbol.iterator]() {
153
- for (const input of this.inputs) {
154
- for (const simple of this.unwrap(input)) {
155
- yield simple;
156
- }
157
- }
158
- }
159
- /**
160
- * unwrap any GeoJSON object into one or more SimpleGeometry object
161
- *
162
- * @private
163
- * @param {GeoJSON} geo
164
- * @return {*} {Iterable<SimpleGeometry>}
165
- * @memberof SimpleGeometryIterator
166
- */
167
- *unwrap(geo) {
168
- geo.type in this
169
- ? yield* this[geo.type](geo)
170
- : yield geo;
171
- }
172
- /**
173
- * Generate the geometries in a GeometryCollection
174
- *
175
- * @private
176
- * @param {GeometryCollection} { geometries }
177
- * @return {*} {Iterable<SimpleGeometry>}
178
- * @memberof SimpleGeometryIterator
179
- */
180
- *GeometryCollection({ geometries }) {
181
- for (const geometry of geometries) {
182
- yield* this.unwrap(geometry);
183
- }
184
- }
185
- /**
186
- * Generate the geometries of the Feature object(s) in a FeatureCollection
187
- *
188
- * @private
189
- * @param {FeatureCollection} { features }
190
- * @return {*} {Iterable<SimpleGeometry>}
191
- * @memberof SimpleGeometryIterator
192
- */
193
- *FeatureCollection({ features }) {
194
- for (const { geometry } of features) {
195
- yield* this.unwrap(geometry);
196
- }
197
- }
198
- /**
199
- * Generate the geometry of a Feature object
200
- *
201
- * @private
202
- * @param {Feature} { geometry }
203
- * @return {*} {Iterable<SimpleGeometry>}
204
- * @memberof SimpleGeometryIterator
205
- */
206
- *Feature({ geometry }) {
207
- yield* this.unwrap(geometry);
208
- }
209
- /**
210
- * Generate Point objects from a MultiPoint object
211
- *
212
- * @private
213
- * @param {MultiPoint} multi
214
- * @return {*} {Iterable<Point>}
215
- * @memberof SimpleGeometryIterator
216
- */
217
- *MultiPoint(multi) {
218
- for (const coordinates of multi.coordinates) {
219
- yield { type: 'Point', coordinates };
220
- }
221
- }
222
- /**
223
- * Generate LineString objects from a MultiLineString object
224
- *
225
- * @private
226
- * @param {MultiLineString} multi
227
- * @return {*} {Iterable<LineString>}
228
- * @memberof SimpleGeometryIterator
229
- */
230
- *MultiLineString(multi) {
231
- for (const coordinates of multi.coordinates) {
232
- yield { type: 'LineString', coordinates };
233
- }
234
- }
235
- /**
236
- * Generate Polygon objects from a MultiPolygon object
237
- *
238
- * @private
239
- * @param {MultiPolygon} multi
240
- * @return {*} {Iterable<Polygon>}
241
- * @memberof SimpleGeometryIterator
242
- */
243
- *MultiPolygon(multi) {
244
- for (const coordinates of multi.coordinates) {
245
- yield { type: 'Polygon', coordinates };
246
- }
247
- }
248
- }
249
-
250
- /**
251
- * Iterator class which traverses all value pairs of two or more Iterable instances
252
- *
253
- * @export
254
- * @class IterablePairIterator
255
- * @template T
256
- */
257
- class IterablePairIterator {
258
- /**
259
- * Constructs a new instance of IterablePairIterator
260
- *
261
- * @param iterators
262
- */
263
- constructor(...iterators) {
264
- this.iterators = [];
265
- this.iterators = iterators;
266
- }
267
- /**
268
- * Generator yielding all value pairs from the provided iterators
269
- *
270
- * @return {*} {Iterator<[T, T]>}
271
- * @memberof IterablePairIterator
272
- */
273
- *[Symbol.iterator]() {
274
- for (const [a, b] of this.pairs(this.iterators)) {
275
- for (const one of a) {
276
- for (const two of b) {
277
- yield [one, two];
278
- }
279
- }
280
- }
281
- }
282
- /**
283
- * Create unique Iterator<T> combinations to traverse over
284
- *
285
- * @private
286
- * @param {Array<Iterable<T>>} source
287
- * @return {*} {Array<[Iterable<T>, Iterable<T>]>}
288
- * @memberof IterablePairIterator
289
- */
290
- pairs(source) {
291
- return source.map((a, i) => source.slice(i + 1).map((b) => [a, b])).flat();
292
- }
293
- }
294
-
295
- const geometries$1 = {
296
- PointPoint(a, b) {
297
- return a.length >= 2 && b.length >= 2 && a.slice(0, 2).every((v, i) => v === b[i]);
298
- },
299
- LineStringPoint(a, b) {
300
- return a.some((a) => this.PointPoint(a, b)) || segments(a).some((line) => isPointOnLine(b, line));
301
- },
302
- LineStringLineString(a, b) {
303
- const lines = segments(b);
304
- return segments(a).some((a) => lines.some((b) => isLinesCrossing(a, b)));
305
- },
306
- PolygonPoint([exterior, ...interior], b) {
307
- return (this.LineStringPoint(exterior, b) || isPointInRing(b, exterior)) && (!interior.length || interior.every((ring) => !isPointInRing(b, ring)));
308
- },
309
- PolygonLineString(a, b) {
310
- return a.some((ring) => this.LineStringLineString(ring, b)) || b.some((point) => this.PolygonPoint(a, point));
311
- },
312
- PolygonPolygon(a, b) {
313
- return b.some((b1) => this.PolygonLineString(a, b1) || b1.some((b2) => this.PolygonPoint(a, b2)))
314
- || a.some((a1) => this.PolygonLineString(b, a1) || a1.some((a2) => this.PolygonPoint(b, a2)));
315
- },
316
- };
317
- function intersect(a, b) {
318
- for (const [itA, itB] of new IterablePairIterator(new SimpleGeometryIterator(a), new SimpleGeometryIterator(b))) {
319
- if ((itA.type + itB.type in geometries$1 && geometries$1[itA.type + itB.type](itA.coordinates, itB.coordinates)) || (itB.type + itA.type in geometries$1 && geometries$1[itB.type + itA.type](itB.coordinates, itA.coordinates))) {
320
- return true;
321
- }
322
- }
323
- return false;
324
- }
325
-
326
- const geometries = {
327
- PointPoint(a, b, calculation) {
328
- return getDistanceOfPointToPoint(a, b, calculation);
329
- },
330
- LineStringPoint(a, b, calculation) {
331
- return Math.min(...segments(a).map((line) => getDistanceOfPointToLine(b, line, calculation)));
332
- },
333
- LineStringLineString(a, b, calculation) {
334
- const sa = segments(a);
335
- const sb = segments(b);
336
- return sa.reduce((carry, a) => sb.reduce((carry, b) => carry > 0 ? Math.min(carry, getDistanceOfLineToLine(a, b, calculation)) : carry, carry), Infinity);
337
- },
338
- PolygonPoint([exterior, ...interior], b, calculation) {
339
- if (isPointInRing(b, exterior)) {
340
- const [excluded] = interior.filter((ring) => isPointInRing(b, ring));
341
- return excluded ? this.LineStringPoint(excluded, b, calculation) : 0;
342
- }
343
- return this.LineStringPoint(exterior, b, calculation);
344
- },
345
- PolygonLineString(a, b, calculation) {
346
- const [exterior, ...interior] = a;
347
- const line = segments(b);
348
- const ring = b.some((b) => isPointInRing(b, exterior))
349
- ? interior.find((a) => b.every((b) => isPointInRing(b, a)))
350
- : exterior;
351
- return ring
352
- ? Math.min(...segments(ring).map((a) => Math.min(...line.map((b) => getDistanceOfLineToLine(a, b, calculation)))))
353
- : 0;
354
- },
355
- PolygonPolygon(a, b, calculation) {
356
- return Math.min(this.PolygonLineString(a, b[0], calculation), this.PolygonLineString(b, a[0], calculation));
357
- },
358
- };
359
- function distance(a, b, calculation = 'cartesian') {
360
- return Math.min(...[...new IterablePairIterator(new SimpleGeometryIterator(a), new SimpleGeometryIterator(b))].map(([a, b]) => {
361
- return a.type + b.type in geometries
362
- ? geometries[a.type + b.type](a.coordinates, b.coordinates, calculation)
363
- : b.type + a.type in geometries
364
- ? geometries[b.type + a.type](b.coordinates, a.coordinates, calculation)
365
- : Infinity;
366
- }));
367
- }
368
-
369
- class TypeMapper {
370
- constructor(mapping = {}) {
371
- this.mapping = Object.keys(mapping)
372
- .map((key) => (value) => mapping[key](value) ? key : undefined)
373
- .concat((value) => typeof value);
374
- }
375
- map(value) {
376
- return this.mapping.reduce((carry, map) => carry || map(value), undefined);
377
- }
378
- }
379
-
380
- class ValueMapper {
381
- constructor(types = new TypeMapper(), mapping = {}) {
382
- this.types = types;
383
- this.mapping = mapping;
384
- }
385
- map(value) {
386
- const type = this.types.map(value);
387
- const map = (value) => this.map(value);
388
- return type in this.mapping
389
- ? this.mapping[type](value, map)
390
- : (value === null || value === void 0 ? void 0 : value.toString()) || 'undefined';
391
- }
392
- }
393
-
394
- const types = new TypeMapper({
395
- date: (value) => value instanceof Date,
396
- regexp: (value) => value instanceof RegExp,
397
- array: (value) => Array.isArray(value),
398
- null: (value) => value === null,
399
- });
400
- new ValueMapper(types, {
401
- string: (value) => value ? `"${value}"` : 'EmptyString',
402
- date: (value, map) => map(value.toISOString()),
403
- object: (value, map) => {
404
- const string = String(value);
405
- if (/^\[([a-z]+) \1\]$/i.test(string)) {
406
- const mapped = Object.keys(value)
407
- .map((key) => `${key}:${map(value[key])}`);
408
- return `{${mapped.join(',')}}`;
409
- }
410
- return string;
411
- },
412
- array: (value, map) => `[${value.map(map).join(',')}]`,
413
- null: () => 'NULL',
414
- undefined: () => 'Undefined',
415
- function: (value) => {
416
- const { constructor: { name: cname }, name } = value;
417
- const [, async, generator, func] = cname.match(/^(async)?(generator)?(function)$/i);
418
- const [, stype, sname] = value.toString().match(/^(?:async)?(?:[\s\*]+)?(class|function)?(?:[\s\*]+)?([a-z_]\w*)?\s*[\(\{]?/i);
419
- const parts = []
420
- .concat(stype && !(name || sname) ? 'anonymous' : [])
421
- .concat(name && !stype && sname ? 'shorthand' : [])
422
- .concat(async || [], generator || [])
423
- .concat(!(stype || sname) ? 'arrow' : [])
424
- .concat(stype || func)
425
- .map((key) => key[0].toUpperCase() + key.slice(1));
426
- return [parts.join('')].concat(name || []).join(' ');
427
- },
428
- });
429
-
430
- /**
431
- * Create a guard verifying the given value matches the specified type
432
- */
433
- function is(type) {
434
- return (value) => typeof value === type;
435
- }
436
- /**
437
- * Create a guard verifying the given value matches any of the validators
438
- */
439
- function any(...checks) {
440
- return (value) => checks.some((check) => check(value));
441
- }
442
- /**
443
- * Create a guard verifying the given value matches all of the validators
444
- */
445
- function all(...checks) {
446
- return (value) => checks.every((check) => check(value));
447
- }
448
- /**
449
- * Create a guard verifying the given value matches none of the validators
450
- */
451
- function not(...checks) {
452
- return (value) => checks.every((check) => !check(value));
453
- }
454
-
455
- /**
456
- * Guard verifying the value is a array
457
- */
458
- const isArray = (value) => Array.isArray(value);
459
- /**
460
- * Guard verifying the value is a null
461
- */
462
- const isNULL = (value) => value === null;
463
- /**
464
- * Guard verifying the value is a number
465
- */
466
- const isNumber = is('number');
467
- /**
468
- * Guard verifying the value is a object
469
- */
470
- const isObject = all(not(isArray), not(isNULL), is('object'));
471
- /**
472
- * Guard verifying the value is a string
473
- */
474
- const isString = is('string');
475
-
476
- /**
477
- * Guard verifying the value to be an array containing only elements matching the validators
478
- */
479
- function isArrayOfType(...validators) {
480
- const check = all(...validators);
481
- return all(isArray, (value) => value.every(check));
482
- }
483
- /**
484
- * Guard verifying the value to be an array with a length between the given boundaries
485
- */
486
- function isArrayOfSize(min, max = Infinity) {
487
- return all(isArray, (value) => value.length >= min && value.length <= max);
488
- }
489
-
490
- /**
491
- * Creates a guard verifying the value is an object and has the given key
492
- */
493
- function isKey(key) {
494
- return all(isObject, (value) => key in value);
495
- }
496
- /**
497
- * Creates a guard verifying the value is an object and has the given key matching the validators
498
- */
499
- function isKeyOfType(key, ...validators) {
500
- return all(isKey(key), (value) => validators.every((check) => check(value[key])));
501
- }
502
- /**
503
- * Creates a guard verifying the value is an object and doesn't have the key or has the given key matching the validators
504
- */
505
- function isOptionalKeyOfType(key, ...validators) {
506
- return any(all(isObject, not(isKey(key))), isKeyOfType(key, ...validators));
507
- }
508
- /**
509
- * Creates a guard verifying the value is an object matching at least the structure
510
- */
511
- function isStructure(struct, ...options) {
512
- const optional = options.reduce((carry, key) => carry.concat(key), []);
513
- const validators = Object.keys(struct)
514
- .map((key) => (optional.includes(key) ? isOptionalKeyOfType : isKeyOfType)(key, struct[key]));
515
- return all(isObject, ...validators);
516
- }
517
-
518
- function isTuple(...rules) {
519
- return (value) => isArray(value) && value.length === rules.length && rules.every((rule, index) => rule(value[index]));
520
- }
521
-
522
- function isNumberValue(value) {
523
- return isNumber(value) && Number.isFinite(value);
524
- }
525
- function isNumberBetween(a, b = Infinity) {
526
- const min = Math.min(a, b);
527
- const max = Math.max(a, b);
528
- return (value) => isNumberValue(value) && value >= min && value <= max;
529
- }
530
-
531
- function isAltitude(value) {
532
- return isNumberValue(value);
533
- }
534
- const isStrictAltitude = isNumberBetween(-EARTH_RADIUS, GPS_SATELLITE_ORBIT);
535
-
536
- function isLatitude(value) {
537
- return isNumberValue(value);
538
- }
539
- const isStrictLatitude = isNumberBetween(-90, 90);
540
-
541
- function isLongitude(value) {
542
- return isNumberValue(value);
543
- }
544
- const isStrictLongitude = isNumberBetween(-180, 180);
545
-
546
- const isPosition = any(isTuple(isLongitude, isLatitude), isTuple(isLongitude, isLatitude, isAltitude));
547
- const isStrictPosition = any(isTuple(isStrictLongitude, isStrictLatitude), isTuple(isStrictLongitude, isStrictLatitude, isStrictAltitude));
548
-
549
- const isBoundingBoxWithAltitude = all(isTuple(isLongitude, isLatitude, isAltitude, isLongitude, isLatitude, isAltitude), ([, s, , , n]) => s <= n);
550
- const isBoundingBoxWithoutAltitude = all(isTuple(isLongitude, isLatitude, isLongitude, isLatitude), ([, s, , n]) => s <= n);
551
- const isBoundingBox = any(isBoundingBoxWithAltitude, isBoundingBoxWithoutAltitude);
552
-
553
- function isGeoJSONObject(type) {
554
- return isStructure({
555
- type: all(isString, (value) => value === type),
556
- bbox: isBoundingBox,
557
- }, 'bbox');
558
- }
559
-
560
- function isGeometryObject(type, isCoordinates) {
561
- return all(isGeoJSONObject(type), isKeyOfType('coordinates', isCoordinates));
562
- }
563
-
564
- const isPointCoordinates = isPosition;
565
- const isPoint = isGeometryObject('Point', isPointCoordinates);
566
- const isStrictPointCoordinates = isStrictPosition;
567
- const isStrictPoint = isGeometryObject('Point', isStrictPointCoordinates);
568
-
569
- const isMultiPointCoordinates = isArrayOfType(isPointCoordinates);
570
- const isMultiPoint = isGeometryObject('MultiPoint', isMultiPointCoordinates);
571
- const isStrictMultiPointCoordinates = isArrayOfType(isStrictPointCoordinates);
572
- const isStrictMultiPoint = isGeometryObject('MultiPoint', isStrictMultiPointCoordinates);
573
-
574
- const isLineStringCoordinates = isMultiPointCoordinates;
575
- const isLineString = isGeometryObject('LineString', isLineStringCoordinates);
576
- const isStrictLineStringCoordinates = isStrictMultiPointCoordinates;
577
- const isStrictLineString = isGeometryObject('LineString', isStrictLineStringCoordinates);
578
-
579
- const isMultiLineStringCoordinates = isArrayOfType(isLineStringCoordinates);
580
- const isMultiLineString = isGeometryObject('MultiLineString', isMultiLineStringCoordinates);
581
- const isStrictMultiLineStringCoordinates = isArrayOfType(isStrictLineStringCoordinates);
582
- const isStrictMultiLineString = isGeometryObject('MultiLineString', isStrictMultiLineStringCoordinates);
583
-
584
- isArrayOfType(isPosition);
585
-
586
- const isLinearRing = all(isArrayOfType(isPosition), isArrayOfSize(4), (value) => value[value.length - 1].every((v, i) => v === value[0][i]));
587
- const isStrictLinearRing = all(isArrayOfType(isStrictPosition), isArrayOfSize(4), (value) => value[value.length - 1].every((v, i) => v === value[0][i]));
588
-
589
- const isExteriorRing = all(isLinearRing);
590
-
591
- const isInteriorRing = all(isLinearRing);
592
-
593
- const isPolygonCoordinates = all(isArrayOfType(isLinearRing));
594
- const isPolygon = isGeometryObject('Polygon', isPolygonCoordinates);
595
- const isStrictPolygonCoordinates = all(isArrayOfType(isStrictLinearRing), (value) => isExteriorRing(value[0]), (value) => value.slice(1).every(isInteriorRing));
596
- const isStrictPolygon = isGeometryObject('Polygon', isStrictPolygonCoordinates);
597
-
598
- const isMultiPolygonCoordinates = isArrayOfType(isPolygonCoordinates);
599
- const isMultiPolygon = isGeometryObject('MultiPolygon', isMultiPolygonCoordinates);
600
- const isStrictMultiPolygonCoordinates = isArrayOfType(isStrictPolygonCoordinates);
601
- const isStrictMultiPolygon = isGeometryObject('MultiPolygon', isStrictMultiPolygonCoordinates);
602
-
603
- const isGeometry = any(isPoint, isMultiPoint, isLineString, isMultiLineString, isPolygon, isMultiPolygon);
604
- const isStrictGeometry = any(isStrictPoint, isStrictMultiPoint, isStrictLineString, isStrictMultiLineString, isStrictPolygon, isStrictMultiPolygon);
605
-
606
- const isGeometryCollectionObject = all(isGeoJSONObject('GeometryCollection'), isKeyOfType('geometries', isArrayOfType(any(isGeometry, isGeometryCollection))));
607
- const isStrictGeometryCollectionObject = all(isGeoJSONObject('GeometryCollection'), isKeyOfType('geometries', isArrayOfType(any(isStrictGeometry, isStrictGeometryCollection))));
608
- function isGeometryCollection(value) {
609
- return isGeometryCollectionObject(value);
610
- }
611
- function isStrictGeometryCollection(value) {
612
- return isStrictGeometryCollectionObject(value);
613
- }
614
-
615
- const isFeature = all(isGeoJSONObject('Feature'), isStructure({
616
- geometry: any(isGeometry, isGeometryCollection),
617
- properties: any(isNULL, isObject)
618
- }));
619
- const isStrictFeature = all(isGeoJSONObject('Feature'), isStructure({
620
- geometry: any(isStrictGeometry, isStrictGeometryCollection),
621
- properties: any(isNULL, isObject)
622
- }));
623
-
624
- const isFeatureCollection = all(isGeoJSONObject('FeatureCollection'), isKeyOfType('features', isArrayOfType(isFeature)));
625
- const isStrictFeatureCollection = all(isGeoJSONObject('FeatureCollection'), isKeyOfType('features', isArrayOfType(isStrictFeature)));
626
-
627
- const isGeoJSON = any(isGeometry, isGeometryCollection, isFeature, isFeatureCollection);
628
- const isStrictGeoJSON = any(isStrictGeometry, isStrictGeometryCollection, isStrictFeature, isStrictFeatureCollection);
629
-
630
- exports.SimpleGeometryIterator = SimpleGeometryIterator;
631
- exports.distance = distance;
632
- exports.intersect = intersect;
633
- exports.isFeature = isFeature;
634
- exports.isFeatureCollection = isFeatureCollection;
635
- exports.isGeoJSON = isGeoJSON;
636
- exports.isGeometry = isGeometry;
637
- exports.isGeometryCollection = isGeometryCollection;
638
- exports.isLineString = isLineString;
639
- exports.isMultiLineString = isMultiLineString;
640
- exports.isMultiPoint = isMultiPoint;
641
- exports.isMultiPolygon = isMultiPolygon;
642
- exports.isPoint = isPoint;
643
- exports.isPolygon = isPolygon;
644
- exports.isPosition = isPosition;
645
- exports.isStrictFeature = isStrictFeature;
646
- exports.isStrictFeatureCollection = isStrictFeatureCollection;
647
- exports.isStrictGeoJSON = isStrictGeoJSON;
648
- exports.isStrictGeometry = isStrictGeometry;
649
- exports.isStrictGeometryCollection = isStrictGeometryCollection;
650
- exports.isStrictLineString = isStrictLineString;
651
- exports.isStrictMultiLineString = isStrictMultiLineString;
652
- exports.isStrictMultiPoint = isStrictMultiPoint;
653
- exports.isStrictMultiPolygon = isStrictMultiPolygon;
654
- exports.isStrictPoint = isStrictPoint;
655
- exports.isStrictPolygon = isStrictPolygon;
656
- exports.isStrictPosition = isStrictPosition;
657
-
658
- return exports;
659
-
660
- })({});
@@ -1 +0,0 @@
1
- var GeoJSON=function(t){"use strict";function n(t){return t.slice(1).map(((n,e)=>[t[e],n]))}const e=6371008.7714,i=6356752.314245,o=Math.PI/180,r=Math.PI;function s(t){return t*t}function c(t){return t*o}const a=s(6378137),u=s(i),l=(a-u)/u,y=1/298.257223563,g={cartesian:([t,n],[i,o])=>e*c(Math.sqrt(s(i-t)+s(o-n))),haversine([t,n],[i,o]){const r=s(Math.sin(c(o-n)/2))+Math.cos(c(n))*Math.cos(c(o))*s(Math.sin(c(i-t)/2));return e*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*2},vincenty(...t){const[[n,e],[o,s]]=t.map((t=>t.map(c))),a=o-n,u=.9966471893352525*Math.tan(e),g=1/Math.sqrt(1+u*u),h=u*g,f=.9966471893352525*Math.tan(s),p=1/Math.sqrt(1+f*f),m=f*p,P=Math.abs(a)>r/2||Math.abs(s-e)>r/2;let S=a,M=null,d=null,L=P?r:0,b=0,w=P?-1:1,v=null,C=1,F=1,G=null,j=0;do{if(M=Math.sin(S),d=Math.cos(S),v=(p*M)**2+(g*m-h*p*d)**2,Math.abs(v)<1e-24)break;b=Math.sqrt(v),w=h*m+g*p*d,L=Math.atan2(b,w);const t=g*p*M/b;F=1-t*t,C=0!=F?w-2*h*m/F:0;const n=.00020955066654671753*F*(4+y*(4-3*F));G=S,S=a+(1-n)*y*t*(L+n*b*(C+n*w*(2*C*C-1)))}while(Math.abs(S-G)>1e-12&&++j<1e3);const $=F*l,N=$/1024*(256+$*($*(74-47*$)-128));return i*(1+$/16384*(4096+$*($*(320-175*$)-768)))*(L-N*b*(C+N/4*(w*(2*C*C-1)-N/6*C*(4*b*b-3)*(4*C*C-3))))}};function h(t,n){const[[e,i],[o,r],[s,c]]=[t,...n],[a,u]=[s-o,c-r],[l,y]=[e-o,i-r],g=(h=(l*a+y*u)/(a*a+u*u),f=0,p=1,Math.max(Math.min(h,p),f));var h,f,p;return 0===g||1===g?n[g]:[o+a*g,r+u*g]}function f(t,n,e){const i="function"==typeof e?e:g[e];if("function"==typeof i)return i(t,n);throw new Error(`Not a PointToPoint calculation function ${e}`)}function p(t,n,e){return f(t,h(t,n),e)}function m(t,n,e){return P(t,n)?0:Math.min(...t.map((t=>p(t,n,e))),...n.map((n=>p(n,t,e))))}function P(t,n){const[[e,i],[o,r]]=t,[[s,c],[a,u]]=n,[l,y,g,h]=[o-e,r-i,a-s,u-c],f=(-y*(e-s)+l*(i-c))/(-g*y+l*h),p=(g*(i-c)-h*(e-s))/(-g*y+l*h);return f>=0&&f<=1&&p>=0&&p<=1}function S(t,n,e=1e-14){return p(t,n,"cartesian")<e}function M(t,n){const{length:e}=n;return 0!==n.reduce(((i,o,r)=>{const s=n[(e+r-1)%e];return(o[1]<t[1]&&s[1]>=t[1]||s[1]<t[1]&&o[1]>=t[1])&&(o[0]<=t[0]||s[0]<=t[0])?i^Number(o[0]+(t[1]-o[1])/(s[1]-o[1])*(s[0]-o[0])<t[0]):i}),0)||n.slice(1).some(((e,i)=>S(t,[n[i],e])))}class d{constructor(...t){this.inputs=[],this.inputs=t}*[Symbol.iterator](){for(const t of this.inputs)for(const n of this.unwrap(t))yield n}*unwrap(t){t.type in this?yield*this[t.type](t):yield t}*GeometryCollection({geometries:t}){for(const n of t)yield*this.unwrap(n)}*FeatureCollection({features:t}){for(const{geometry:n}of t)yield*this.unwrap(n)}*Feature({geometry:t}){yield*this.unwrap(t)}*MultiPoint(t){for(const n of t.coordinates)yield{type:"Point",coordinates:n}}*MultiLineString(t){for(const n of t.coordinates)yield{type:"LineString",coordinates:n}}*MultiPolygon(t){for(const n of t.coordinates)yield{type:"Polygon",coordinates:n}}}class L{constructor(...t){this.iterators=[],this.iterators=t}*[Symbol.iterator](){for(const[t,n]of this.pairs(this.iterators))for(const e of t)for(const t of n)yield[e,t]}pairs(t){return t.map(((n,e)=>t.slice(e+1).map((t=>[n,t])))).flat()}}const b={PointPoint:(t,n)=>t.length>=2&&n.length>=2&&t.slice(0,2).every(((t,e)=>t===n[e])),LineStringPoint(t,e){return t.some((t=>this.PointPoint(t,e)))||n(t).some((t=>S(e,t)))},LineStringLineString(t,e){const i=n(e);return n(t).some((t=>i.some((n=>P(t,n)))))},PolygonPoint([t,...n],e){return(this.LineStringPoint(t,e)||M(e,t))&&(!n.length||n.every((t=>!M(e,t))))},PolygonLineString(t,n){return t.some((t=>this.LineStringLineString(t,n)))||n.some((n=>this.PolygonPoint(t,n)))},PolygonPolygon(t,n){return n.some((n=>this.PolygonLineString(t,n)||n.some((n=>this.PolygonPoint(t,n)))))||t.some((t=>this.PolygonLineString(n,t)||t.some((t=>this.PolygonPoint(n,t)))))}};const w={PointPoint:(t,n,e)=>f(t,n,e),LineStringPoint:(t,e,i)=>Math.min(...n(t).map((t=>p(e,t,i)))),LineStringLineString(t,e,i){const o=n(t),r=n(e);return o.reduce(((t,n)=>r.reduce(((t,e)=>t>0?Math.min(t,m(n,e,i)):t),t)),1/0)},PolygonPoint([t,...n],e,i){if(M(e,t)){const[t]=n.filter((t=>M(e,t)));return t?this.LineStringPoint(t,e,i):0}return this.LineStringPoint(t,e,i)},PolygonLineString(t,e,i){const[o,...r]=t,s=n(e),c=e.some((t=>M(t,o)))?r.find((t=>e.every((n=>M(n,t))))):o;return c?Math.min(...n(c).map((t=>Math.min(...s.map((n=>m(t,n,i))))))):0},PolygonPolygon(t,n,e){return Math.min(this.PolygonLineString(t,n[0],e),this.PolygonLineString(n,t[0],e))}};class v{constructor(t={}){this.mapping=Object.keys(t).map((n=>e=>t[n](e)?n:void 0)).concat((t=>typeof t))}map(t){return this.mapping.reduce(((n,e)=>n||e(t)),void 0)}}const C=new v({date:t=>t instanceof Date,regexp:t=>t instanceof RegExp,array:t=>Array.isArray(t),null:t=>null===t});function F(t){return n=>typeof n===t}function G(...t){return n=>t.some((t=>t(n)))}function j(...t){return n=>t.every((t=>t(n)))}function $(...t){return n=>t.every((t=>!t(n)))}new class{constructor(t=new v,n={}){this.types=t,this.mapping=n}map(t){const n=this.types.map(t);return n in this.mapping?this.mapping[n](t,(t=>this.map(t))):(null==t?void 0:t.toString())||"undefined"}}(C,{string:t=>t?`"${t}"`:"EmptyString",date:(t,n)=>n(t.toISOString()),object:(t,n)=>{const e=String(t);if(/^\[([a-z]+) \1\]$/i.test(e)){return`{${Object.keys(t).map((e=>`${e}:${n(t[e])}`)).join(",")}}`}return e},array:(t,n)=>`[${t.map(n).join(",")}]`,null:()=>"NULL",undefined:()=>"Undefined",function:t=>{const{constructor:{name:n},name:e}=t,[,i,o,r]=n.match(/^(async)?(generator)?(function)$/i),[,s,c]=t.toString().match(/^(?:async)?(?:[\s\*]+)?(class|function)?(?:[\s\*]+)?([a-z_]\w*)?\s*[\(\{]?/i);return[[].concat(!s||e||c?[]:"anonymous").concat(e&&!s&&c?"shorthand":[]).concat(i||[],o||[]).concat(s||c?[]:"arrow").concat(s||r).map((t=>t[0].toUpperCase()+t.slice(1))).join("")].concat(e||[]).join(" ")}});const N=t=>Array.isArray(t),O=t=>null===t,q=F("number"),x=j($(N),$(O),F("object")),k=F("string");function A(...t){const n=j(...t);return j(N,(t=>t.every(n)))}function I(t,n=1/0){return j(N,(e=>e.length>=t&&e.length<=n))}function E(t){return j(x,(n=>t in n))}function J(t,...n){return j(E(t),(e=>n.every((n=>n(e[t])))))}function U(t,...n){return G(j(x,$(E(t))),J(t,...n))}function z(t,...n){const e=n.reduce(((t,n)=>t.concat(n)),[]),i=Object.keys(t).map((n=>(e.includes(n)?U:J)(n,t[n])));return j(x,...i)}function D(...t){return n=>N(n)&&n.length===t.length&&t.every(((t,e)=>t(n[e])))}function R(t){return q(t)&&Number.isFinite(t)}function T(t,n=1/0){const e=Math.min(t,n),i=Math.max(t,n);return t=>R(t)&&t>=e&&t<=i}function _(t){return R(t)}const B=T(-6371008.7714,2018e4);function H(t){return R(t)}const K=T(-90,90);function Q(t){return R(t)}const V=T(-180,180),W=G(D(Q,H),D(Q,H,_)),X=G(D(V,K),D(V,K,B)),Y=G(j(D(Q,H,_,Q,H,_),(([,t,,,n])=>t<=n)),j(D(Q,H,Q,H),(([,t,,n])=>t<=n)));function Z(t){return z({type:j(k,(n=>n===t)),bbox:Y},"bbox")}function tt(t,n){return j(Z(t),J("coordinates",n))}const nt=W,et=tt("Point",nt),it=X,ot=tt("Point",it),rt=A(nt),st=tt("MultiPoint",rt),ct=A(it),at=tt("MultiPoint",ct),ut=rt,lt=tt("LineString",ut),yt=ct,gt=tt("LineString",yt),ht=tt("MultiLineString",A(ut)),ft=tt("MultiLineString",A(yt));A(W);const pt=j(A(W),I(4),(t=>t[t.length-1].every(((n,e)=>n===t[0][e])))),mt=j(A(X),I(4),(t=>t[t.length-1].every(((n,e)=>n===t[0][e])))),Pt=j(pt),St=j(pt),Mt=j(A(pt)),dt=tt("Polygon",Mt),Lt=j(A(mt),(t=>Pt(t[0])),(t=>t.slice(1).every(St))),bt=tt("Polygon",Lt),wt=tt("MultiPolygon",A(Mt)),vt=tt("MultiPolygon",A(Lt)),Ct=G(et,st,lt,ht,dt,wt),Ft=G(ot,at,gt,ft,bt,vt),Gt=j(Z("GeometryCollection"),J("geometries",A(G(Ct,$t)))),jt=j(Z("GeometryCollection"),J("geometries",A(G(Ft,Nt))));function $t(t){return Gt(t)}function Nt(t){return jt(t)}const Ot=j(Z("Feature"),z({geometry:G(Ct,$t),properties:G(O,x)})),qt=j(Z("Feature"),z({geometry:G(Ft,Nt),properties:G(O,x)})),xt=j(Z("FeatureCollection"),J("features",A(Ot))),kt=j(Z("FeatureCollection"),J("features",A(qt))),At=G(Ct,$t,Ot,xt),It=G(Ft,Nt,qt,kt);return t.SimpleGeometryIterator=d,t.distance=function(t,n,e="cartesian"){return Math.min(...[...new L(new d(t),new d(n))].map((([t,n])=>t.type+n.type in w?w[t.type+n.type](t.coordinates,n.coordinates,e):n.type+t.type in w?w[n.type+t.type](n.coordinates,t.coordinates,e):1/0)))},t.intersect=function(t,n){for(const[e,i]of new L(new d(t),new d(n)))if(e.type+i.type in b&&b[e.type+i.type](e.coordinates,i.coordinates)||i.type+e.type in b&&b[i.type+e.type](i.coordinates,e.coordinates))return!0;return!1},t.isFeature=Ot,t.isFeatureCollection=xt,t.isGeoJSON=At,t.isGeometry=Ct,t.isGeometryCollection=$t,t.isLineString=lt,t.isMultiLineString=ht,t.isMultiPoint=st,t.isMultiPolygon=wt,t.isPoint=et,t.isPolygon=dt,t.isPosition=W,t.isStrictFeature=qt,t.isStrictFeatureCollection=kt,t.isStrictGeoJSON=It,t.isStrictGeometry=Ft,t.isStrictGeometryCollection=Nt,t.isStrictLineString=gt,t.isStrictMultiLineString=ft,t.isStrictMultiPoint=at,t.isStrictMultiPolygon=vt,t.isStrictPoint=ot,t.isStrictPolygon=bt,t.isStrictPosition=X,t}({});