@ogc-maps/storybook-components 0.13.0 → 0.14.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.
Files changed (40) hide show
  1. package/dist/components/CollectionBrowser/CollectionBrowser.d.ts +3 -1
  2. package/dist/components/CollectionBrowser/CollectionBrowser.d.ts.map +1 -1
  3. package/dist/components/ImageryEditor/ImageryEditor.d.ts +13 -0
  4. package/dist/components/ImageryEditor/ImageryEditor.d.ts.map +1 -0
  5. package/dist/components/ImageryEditor/ImageryList.d.ts +8 -0
  6. package/dist/components/ImageryEditor/ImageryList.d.ts.map +1 -0
  7. package/dist/components/ImageryEditor/index.d.ts +5 -0
  8. package/dist/components/ImageryEditor/index.d.ts.map +1 -0
  9. package/dist/components/ImageryPanel/ImageryPanel.d.ts +10 -0
  10. package/dist/components/ImageryPanel/ImageryPanel.d.ts.map +1 -0
  11. package/dist/components/ImageryPanel/index.d.ts +3 -0
  12. package/dist/components/ImageryPanel/index.d.ts.map +1 -0
  13. package/dist/components/SourceEditor/SourceEditor.d.ts +2 -2
  14. package/dist/components/SourceEditor/SourceEditor.d.ts.map +1 -1
  15. package/dist/components/SourceEditor/SourceList.d.ts.map +1 -1
  16. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts.map +1 -1
  17. package/dist/components/index.d.ts +4 -0
  18. package/dist/components/index.d.ts.map +1 -1
  19. package/dist/{geo-BxXVSJvJ.js → geo-PA_KiJwy.js} +489 -453
  20. package/dist/hooks/index.d.ts +2 -2
  21. package/dist/hooks/index.d.ts.map +1 -1
  22. package/dist/hooks/index.js +57 -50
  23. package/dist/hooks/useOgcCollections.d.ts +3 -2
  24. package/dist/hooks/useOgcCollections.d.ts.map +1 -1
  25. package/dist/hooks/useOgcFeatures.d.ts +2 -2
  26. package/dist/hooks/useOgcFeatures.d.ts.map +1 -1
  27. package/dist/{index-CtbLVsqD.js → index-Cz_PEKV1.js} +434 -410
  28. package/dist/main.js +1927 -1428
  29. package/dist/schemas/config.d.ts +293 -0
  30. package/dist/schemas/config.d.ts.map +1 -1
  31. package/dist/schemas/index.d.ts +1 -1
  32. package/dist/schemas/index.d.ts.map +1 -1
  33. package/dist/schemas/index.js +18 -16
  34. package/dist/style.css +1 -1
  35. package/dist/types/index.d.ts +4 -2
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/types/index.js +17 -15
  38. package/dist/utils/ogcApi.d.ts +42 -13
  39. package/dist/utils/ogcApi.d.ts.map +1 -1
  40. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { useState as d, useEffect as N, useCallback as v, useMemo as j } from "react";
2
- var S = 63710088e-1, ne = {
1
+ import { useState as y, useEffect as N, useCallback as v, useMemo as T } from "react";
2
+ var S = 63710088e-1, re = {
3
3
  centimeters: S * 100,
4
4
  centimetres: S * 100,
5
5
  degrees: 360 / (2 * Math.PI),
@@ -16,11 +16,11 @@ var S = 63710088e-1, ne = {
16
16
  radians: 1,
17
17
  yards: S * 1.0936
18
18
  };
19
- function T(e, t, n = {}) {
19
+ function U(e, t, n = {}) {
20
20
  const r = { type: "Feature" };
21
21
  return (n.id === 0 || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = t || {}, r.geometry = e, r;
22
22
  }
23
- function re(e, t, n = {}) {
23
+ function se(e, t, n = {}) {
24
24
  for (const s of e) {
25
25
  if (s.length < 4)
26
26
  throw new Error(
@@ -32,7 +32,7 @@ function re(e, t, n = {}) {
32
32
  if (s[s.length - 1][i] !== s[0][i])
33
33
  throw new Error("First and last Position are not equivalent.");
34
34
  }
35
- return T({
35
+ return U({
36
36
  type: "Polygon",
37
37
  coordinates: e
38
38
  }, t, n);
@@ -40,21 +40,21 @@ function re(e, t, n = {}) {
40
40
  function Q(e, t, n = {}) {
41
41
  if (e.length < 2)
42
42
  throw new Error("coordinates must be an array of two or more positions");
43
- return T({
43
+ return U({
44
44
  type: "LineString",
45
45
  coordinates: e
46
46
  }, t, n);
47
47
  }
48
- function se(e, t = "kilometers") {
49
- const n = ne[t];
48
+ function ie(e, t = "kilometers") {
49
+ const n = re[t];
50
50
  if (!n)
51
51
  throw new Error(t + " units is invalid");
52
52
  return e * n;
53
53
  }
54
- function R(e) {
54
+ function j(e) {
55
55
  return e % 360 * Math.PI / 180;
56
56
  }
57
- function I(e) {
57
+ function J(e) {
58
58
  if (!e)
59
59
  throw new Error("coord is required");
60
60
  if (!Array.isArray(e)) {
@@ -67,29 +67,29 @@ function I(e) {
67
67
  return [...e];
68
68
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
69
69
  }
70
- function ie(e, t, n = {}) {
71
- var r = I(e), s = I(t), i = R(s[1] - r[1]), l = R(s[0] - r[0]), o = R(r[1]), a = R(s[1]), c = Math.pow(Math.sin(i / 2), 2) + Math.pow(Math.sin(l / 2), 2) * Math.cos(o) * Math.cos(a);
72
- return se(
73
- 2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)),
70
+ function oe(e, t, n = {}) {
71
+ var r = J(e), s = J(t), i = j(s[1] - r[1]), c = j(s[0] - r[0]), o = j(r[1]), a = j(s[1]), l = Math.pow(Math.sin(i / 2), 2) + Math.pow(Math.sin(c / 2), 2) * Math.cos(o) * Math.cos(a);
72
+ return ie(
73
+ 2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)),
74
74
  n.units
75
75
  );
76
76
  }
77
77
  function B(e, t, n) {
78
78
  if (e !== null)
79
- for (var r, s, i, l, o, a, c, g = 0, f = 0, u, m = e.type, h = m === "FeatureCollection", p = m === "Feature", b = h ? e.features.length : 1, y = 0; y < b; y++) {
80
- c = h ? (
79
+ for (var r, s, i, c, o, a, l, f = 0, u = 0, g, m = e.type, d = m === "FeatureCollection", b = m === "Feature", p = d ? e.features.length : 1, h = 0; h < p; h++) {
80
+ l = d ? (
81
81
  // @ts-expect-error: Known type conflict
82
- e.features[y].geometry
83
- ) : p ? (
82
+ e.features[h].geometry
83
+ ) : b ? (
84
84
  // @ts-expect-error: Known type conflict
85
85
  e.geometry
86
- ) : e, u = c ? c.type === "GeometryCollection" : !1, o = u ? c.geometries.length : 1;
87
- for (var k = 0; k < o; k++) {
88
- var w = 0, M = 0;
89
- if (l = u ? c.geometries[k] : c, l !== null) {
90
- a = l.coordinates;
91
- var P = l.type;
92
- switch (g = 0, P) {
86
+ ) : e, g = l ? l.type === "GeometryCollection" : !1, o = g ? l.geometries.length : 1;
87
+ for (var P = 0; P < o; P++) {
88
+ var w = 0, $ = 0;
89
+ if (c = g ? l.geometries[P] : l, c !== null) {
90
+ a = c.coordinates;
91
+ var C = c.type;
92
+ switch (f = 0, C) {
93
93
  case null:
94
94
  break;
95
95
  case "Point":
@@ -97,14 +97,14 @@ function B(e, t, n) {
97
97
  // @ts-expect-error: Known type conflict
98
98
  t(
99
99
  a,
100
- f,
101
- y,
100
+ u,
101
+ h,
102
102
  w,
103
- M
103
+ $
104
104
  ) === !1
105
105
  )
106
106
  return !1;
107
- f++, w++;
107
+ u++, w++;
108
108
  break;
109
109
  case "LineString":
110
110
  case "MultiPoint":
@@ -113,65 +113,65 @@ function B(e, t, n) {
113
113
  // @ts-expect-error: Known type conflict
114
114
  t(
115
115
  a[r],
116
- f,
117
- y,
116
+ u,
117
+ h,
118
118
  w,
119
- M
119
+ $
120
120
  ) === !1
121
121
  )
122
122
  return !1;
123
- f++, P === "MultiPoint" && w++;
123
+ u++, C === "MultiPoint" && w++;
124
124
  }
125
- P === "LineString" && w++;
125
+ C === "LineString" && w++;
126
126
  break;
127
127
  case "Polygon":
128
128
  case "MultiLineString":
129
129
  for (r = 0; r < a.length; r++) {
130
- for (s = 0; s < a[r].length - g; s++) {
130
+ for (s = 0; s < a[r].length - f; s++) {
131
131
  if (
132
132
  // @ts-expect-error: Known type conflict
133
133
  t(
134
134
  a[r][s],
135
- f,
136
- y,
135
+ u,
136
+ h,
137
137
  w,
138
- M
138
+ $
139
139
  ) === !1
140
140
  )
141
141
  return !1;
142
- f++;
142
+ u++;
143
143
  }
144
- P === "MultiLineString" && w++, P === "Polygon" && M++;
144
+ C === "MultiLineString" && w++, C === "Polygon" && $++;
145
145
  }
146
- P === "Polygon" && w++;
146
+ C === "Polygon" && w++;
147
147
  break;
148
148
  case "MultiPolygon":
149
149
  for (r = 0; r < a.length; r++) {
150
- for (M = 0, s = 0; s < a[r].length; s++) {
151
- for (i = 0; i < a[r][s].length - g; i++) {
150
+ for ($ = 0, s = 0; s < a[r].length; s++) {
151
+ for (i = 0; i < a[r][s].length - f; i++) {
152
152
  if (
153
153
  // @ts-expect-error: Known type conflict
154
154
  t(
155
155
  a[r][s][i],
156
- f,
157
- y,
156
+ u,
157
+ h,
158
158
  w,
159
- M
159
+ $
160
160
  ) === !1
161
161
  )
162
162
  return !1;
163
- f++;
163
+ u++;
164
164
  }
165
- M++;
165
+ $++;
166
166
  }
167
167
  w++;
168
168
  }
169
169
  break;
170
170
  case "GeometryCollection":
171
- for (r = 0; r < l.geometries.length; r++)
171
+ for (r = 0; r < c.geometries.length; r++)
172
172
  if (
173
173
  // @ts-expect-error: Known type conflict
174
- B(l.geometries[r], t) === !1
174
+ B(c.geometries[r], t) === !1
175
175
  )
176
176
  return !1;
177
177
  break;
@@ -182,44 +182,44 @@ function B(e, t, n) {
182
182
  }
183
183
  }
184
184
  }
185
- function K(e, t) {
186
- var n, r, s, i, l, o, a, c, g, f, u = 0, m = e.type === "FeatureCollection", h = e.type === "Feature", p = m ? e.features.length : 1;
187
- for (n = 0; n < p; n++) {
185
+ function X(e, t) {
186
+ var n, r, s, i, c, o, a, l, f, u, g = 0, m = e.type === "FeatureCollection", d = e.type === "Feature", b = m ? e.features.length : 1;
187
+ for (n = 0; n < b; n++) {
188
188
  for (o = m ? (
189
189
  // @ts-expect-error: Known type conflict
190
190
  e.features[n].geometry
191
- ) : h ? (
191
+ ) : d ? (
192
192
  // @ts-expect-error: Known type conflict
193
193
  e.geometry
194
- ) : e, c = m ? (
194
+ ) : e, l = m ? (
195
195
  // @ts-expect-error: Known type conflict
196
196
  e.features[n].properties
197
- ) : h ? (
197
+ ) : d ? (
198
198
  // @ts-expect-error: Known type conflict
199
199
  e.properties
200
- ) : {}, g = m ? (
200
+ ) : {}, f = m ? (
201
201
  // @ts-expect-error: Known type conflict
202
202
  e.features[n].bbox
203
- ) : h ? (
203
+ ) : d ? (
204
204
  // @ts-expect-error: Known type conflict
205
205
  e.bbox
206
- ) : void 0, f = m ? (
206
+ ) : void 0, u = m ? (
207
207
  // @ts-expect-error: Known type conflict
208
208
  e.features[n].id
209
- ) : h ? (
209
+ ) : d ? (
210
210
  // @ts-expect-error: Known type conflict
211
211
  e.id
212
- ) : void 0, a = o ? o.type === "GeometryCollection" : !1, l = a ? o.geometries.length : 1, s = 0; s < l; s++) {
212
+ ) : void 0, a = o ? o.type === "GeometryCollection" : !1, c = a ? o.geometries.length : 1, s = 0; s < c; s++) {
213
213
  if (i = a ? o.geometries[s] : o, i === null) {
214
214
  if (
215
215
  // @ts-expect-error: Known type conflict
216
216
  t(
217
217
  // @ts-expect-error: Known type conflict
218
218
  null,
219
- u,
220
- c,
221
219
  g,
222
- f
220
+ l,
221
+ f,
222
+ u
223
223
  ) === !1
224
224
  )
225
225
  return !1;
@@ -236,10 +236,10 @@ function K(e, t) {
236
236
  // @ts-expect-error: Known type conflict
237
237
  t(
238
238
  i,
239
- u,
240
- c,
241
239
  g,
242
- f
240
+ l,
241
+ f,
242
+ u
243
243
  ) === !1
244
244
  )
245
245
  return !1;
@@ -251,10 +251,10 @@ function K(e, t) {
251
251
  // @ts-expect-error: Known type conflict
252
252
  t(
253
253
  i.geometries[r],
254
- u,
255
- c,
256
254
  g,
257
- f
255
+ l,
256
+ f,
257
+ u
258
258
  ) === !1
259
259
  )
260
260
  return !1;
@@ -264,28 +264,28 @@ function K(e, t) {
264
264
  throw new Error("Unknown Geometry Type");
265
265
  }
266
266
  }
267
- u++;
267
+ g++;
268
268
  }
269
269
  }
270
- function oe(e, t, n) {
270
+ function ae(e, t, n) {
271
271
  var r = n;
272
- return K(
272
+ return X(
273
273
  e,
274
- function(s, i, l, o, a) {
274
+ function(s, i, c, o, a) {
275
275
  r = t(
276
276
  // @ts-expect-error: Known type conflict
277
277
  r,
278
278
  s,
279
279
  i,
280
- l,
280
+ c,
281
281
  o,
282
282
  a
283
283
  );
284
284
  }
285
285
  ), r;
286
286
  }
287
- function ae(e, t) {
288
- K(e, function(n, r, s, i, l) {
287
+ function ce(e, t) {
288
+ X(e, function(n, r, s, i, c) {
289
289
  var o = n === null ? null : n.type;
290
290
  switch (o) {
291
291
  case null:
@@ -295,7 +295,7 @@ function ae(e, t) {
295
295
  return (
296
296
  // @ts-expect-error: Known type conflict
297
297
  t(
298
- T(n, s, { bbox: i, id: l }),
298
+ U(n, s, { bbox: i, id: c }),
299
299
  r,
300
300
  0
301
301
  ) === !1 ? !1 : void 0
@@ -314,60 +314,60 @@ function ae(e, t) {
314
314
  break;
315
315
  }
316
316
  for (
317
- var c = 0;
317
+ var l = 0;
318
318
  // @ts-expect-error: Known type conflict
319
- c < n.coordinates.length;
320
- c++
319
+ l < n.coordinates.length;
320
+ l++
321
321
  ) {
322
- var g = n.coordinates[c], f = {
322
+ var f = n.coordinates[l], u = {
323
323
  type: a,
324
- coordinates: g
324
+ coordinates: f
325
325
  };
326
326
  if (
327
327
  // @ts-expect-error: Known type conflict
328
- t(T(f, s), r, c) === !1
328
+ t(U(u, s), r, l) === !1
329
329
  )
330
330
  return !1;
331
331
  }
332
332
  });
333
333
  }
334
334
  function le(e, t) {
335
- ae(e, function(n, r, s) {
335
+ ce(e, function(n, r, s) {
336
336
  var i = 0;
337
337
  if (n.geometry) {
338
- var l = n.geometry.type;
339
- if (!(l === "Point" || l === "MultiPoint")) {
340
- var o, a = 0, c = 0, g = 0;
338
+ var c = n.geometry.type;
339
+ if (!(c === "Point" || c === "MultiPoint")) {
340
+ var o, a = 0, l = 0, f = 0;
341
341
  if (
342
342
  // @ts-expect-error: Known type conflict
343
343
  B(
344
344
  n,
345
- function(f, u, m, h, p) {
345
+ function(u, g, m, d, b) {
346
346
  if (
347
347
  // @ts-expect-error: Known type conflict
348
- o === void 0 || r > a || h > c || p > g
348
+ o === void 0 || r > a || d > l || b > f
349
349
  ) {
350
- o = f, a = r, c = h, g = p, i = 0;
350
+ o = u, a = r, l = d, f = b, i = 0;
351
351
  return;
352
352
  }
353
- var b = Q(
353
+ var p = Q(
354
354
  // @ts-expect-error: Known type conflict
355
- [o, f],
355
+ [o, u],
356
356
  n.properties
357
357
  );
358
358
  if (
359
359
  // @ts-expect-error: Known type conflict
360
360
  t(
361
361
  // @ts-expect-error: Known type conflict
362
- b,
362
+ p,
363
363
  r,
364
364
  s,
365
- p,
365
+ b,
366
366
  i
367
367
  ) === !1
368
368
  )
369
369
  return !1;
370
- i++, o = f;
370
+ i++, o = u;
371
371
  }
372
372
  ) === !1
373
373
  )
@@ -376,49 +376,49 @@ function le(e, t) {
376
376
  }
377
377
  });
378
378
  }
379
- function ce(e, t, n) {
379
+ function ue(e, t, n) {
380
380
  var r = n, s = !1;
381
381
  return le(
382
382
  e,
383
- function(i, l, o, a, c) {
383
+ function(i, c, o, a, l) {
384
384
  s === !1 && n === void 0 ? r = i : r = t(
385
385
  r,
386
386
  // @ts-expect-error: Known type conflict
387
387
  i,
388
- l,
388
+ c,
389
389
  o,
390
390
  a,
391
- c
391
+ l
392
392
  ), s = !0;
393
393
  }
394
394
  ), r;
395
395
  }
396
- function ue(e, t = {}) {
397
- return ce(
396
+ function fe(e, t = {}) {
397
+ return ue(
398
398
  e,
399
399
  (n, r) => {
400
400
  const s = r.geometry.coordinates;
401
- return n + ie(s[0], s[1], t);
401
+ return n + oe(s[0], s[1], t);
402
402
  },
403
403
  0
404
404
  );
405
405
  }
406
- var fe = ue;
407
- function ge(e) {
408
- return oe(
406
+ var ge = fe;
407
+ function me(e) {
408
+ return ae(
409
409
  e,
410
- (t, n) => t + he(n),
410
+ (t, n) => t + de(n),
411
411
  0
412
412
  );
413
413
  }
414
- function he(e) {
414
+ function de(e) {
415
415
  let t = 0, n;
416
416
  switch (e.type) {
417
417
  case "Polygon":
418
- return J(e.coordinates);
418
+ return z(e.coordinates);
419
419
  case "MultiPolygon":
420
420
  for (n = 0; n < e.coordinates.length; n++)
421
- t += J(e.coordinates[n]);
421
+ t += z(e.coordinates[n]);
422
422
  return t;
423
423
  case "Point":
424
424
  case "MultiPoint":
@@ -428,7 +428,7 @@ function he(e) {
428
428
  }
429
429
  return 0;
430
430
  }
431
- function J(e) {
431
+ function z(e) {
432
432
  let t = 0;
433
433
  if (e && e.length > 0) {
434
434
  t += Math.abs(W(e[0]));
@@ -437,22 +437,22 @@ function J(e) {
437
437
  }
438
438
  return t;
439
439
  }
440
- var me = S * S / 2, U = Math.PI / 180;
440
+ var he = S * S / 2, x = Math.PI / 180;
441
441
  function W(e) {
442
442
  const t = e.length - 1;
443
443
  if (t <= 2) return 0;
444
444
  let n = 0, r = 0;
445
445
  for (; r < t; ) {
446
- const s = e[r], i = e[r + 1 === t ? 0 : r + 1], l = e[r + 2 >= t ? (r + 2) % t : r + 2], o = s[0] * U, a = i[1] * U, c = l[0] * U;
447
- n += (c - o) * Math.sin(a), r++;
446
+ const s = e[r], i = e[r + 1 === t ? 0 : r + 1], c = e[r + 2 >= t ? (r + 2) % t : r + 2], o = s[0] * x, a = i[1] * x, l = c[0] * x;
447
+ n += (l - o) * Math.sin(a), r++;
448
448
  }
449
- return n * me;
449
+ return n * he;
450
450
  }
451
- var de = ge;
452
- const Ie = {
451
+ var ye = me;
452
+ const ze = {
453
453
  distance: ["km", "mi", "m", "ft"],
454
454
  area: ["km2", "mi2", "ha", "acres"]
455
- }, ye = {
455
+ }, pe = {
456
456
  km: "km",
457
457
  mi: "mi",
458
458
  m: "m",
@@ -461,41 +461,41 @@ const Ie = {
461
461
  mi2: "mi²",
462
462
  ha: "ha",
463
463
  acres: "ac"
464
- }, pe = {
464
+ }, be = {
465
465
  km: 1,
466
466
  mi: 0.621371,
467
467
  m: 1e3,
468
468
  ft: 3280.84
469
- }, be = {
469
+ }, Se = {
470
470
  km2: 1e-6,
471
471
  mi2: 3861e-10,
472
472
  ha: 1e-4,
473
473
  acres: 247105e-9
474
474
  };
475
- function Se(e, t = "km") {
475
+ function we(e, t = "km") {
476
476
  if (e.length < 2) return 0;
477
477
  const n = Q(e);
478
- return fe(n, { units: "kilometers" }) * pe[t];
478
+ return ge(n, { units: "kilometers" }) * be[t];
479
479
  }
480
- function we(e, t = "km2") {
480
+ function $e(e, t = "km2") {
481
481
  if (e.length < 3) return 0;
482
- const n = [...e, e[0]], r = re([n]);
483
- return de(r) * be[t];
482
+ const n = [...e, e[0]], r = se([n]);
483
+ return ye(r) * Se[t];
484
484
  }
485
485
  function Me(e, t, n) {
486
- return e === "distance" && t.length >= 2 ? { value: Se(t, n), unit: n } : e === "area" && t.length >= 3 ? { value: we(t, n), unit: n } : null;
486
+ return e === "distance" && t.length >= 2 ? { value: we(t, n), unit: n } : e === "area" && t.length >= 3 ? { value: $e(t, n), unit: n } : null;
487
487
  }
488
488
  function ve(e) {
489
489
  return e === "distance" ? "km" : "km2";
490
490
  }
491
- function $e(e, t) {
491
+ function Pe(e, t) {
492
492
  return t.length < 2 ? null : {
493
493
  type: "Feature",
494
494
  geometry: e === "area" && t.length >= 3 ? { type: "Polygon", coordinates: [[...t, t[0]]] } : { type: "LineString", coordinates: t },
495
495
  properties: {}
496
496
  };
497
497
  }
498
- function Pe(e) {
498
+ function Ce(e) {
499
499
  return e.length === 0 ? null : {
500
500
  type: "FeatureCollection",
501
501
  features: e.map((t) => ({
@@ -505,190 +505,219 @@ function Pe(e) {
505
505
  }))
506
506
  };
507
507
  }
508
- function Je(e) {
509
- const { value: t, unit: n } = e, r = ye[n];
508
+ function We(e) {
509
+ const { value: t, unit: n } = e, r = pe[n];
510
510
  return t < 0.01 ? `< 0.01 ${r}` : t < 100 ? `${t.toFixed(2)} ${r}` : t < 1e4 ? `${t.toFixed(1)} ${r}` : `${t.toLocaleString(void 0, { maximumFractionDigits: 0 })} ${r}`;
511
511
  }
512
- function $(e) {
512
+ function Ve(e) {
513
+ return (Number(e.scale) || 1) >= 2 ? 512 : 256;
514
+ }
515
+ function M(e) {
513
516
  return e.endsWith("/") ? e.slice(0, -1) : e;
514
517
  }
515
- async function C(e) {
516
- const t = await fetch(e);
517
- if (!t.ok)
518
- throw new Error(`OGC API request failed: ${t.status} ${t.statusText} (${e})`);
519
- return t.json();
520
- }
521
- async function Ce(e) {
522
- const t = `${$(e)}/collections?f=json`;
523
- return (await C(t)).collections;
524
- }
525
- async function L(e, t, n = {}) {
526
- var l;
527
- const r = $(e), s = new URLSearchParams({ f: "geojson" });
528
- if (n.limit != null && s.set("limit", String(n.limit)), n.offset != null && s.set("offset", String(n.offset)), n.bbox && s.set("bbox", n.bbox.join(",")), (l = n.properties) != null && l.length && s.set("properties", n.properties.join(",")), n.datetime && s.set("datetime", n.datetime), n.cql2Filter)
529
- s.set("filter-lang", "cql2-json"), s.set("filter", JSON.stringify(n.cql2Filter));
518
+ function L(e, t) {
519
+ if (!t || t.type !== "query_param") return e;
520
+ const n = e.includes("?") ? "&" : "?";
521
+ return `${e}${n}${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`;
522
+ }
523
+ function ke(e) {
524
+ return !e || e.type !== "header" ? {} : { [e.name]: e.value };
525
+ }
526
+ async function k(e, t) {
527
+ const n = await fetch(L(e, t), { headers: ke(t) });
528
+ if (!n.ok)
529
+ throw new Error(`OGC API request failed: ${n.status} ${n.statusText} (${e})`);
530
+ return n.json();
531
+ }
532
+ async function Le(e, t) {
533
+ const n = `${M(e)}/collections?f=json`;
534
+ return (await k(n, t)).collections;
535
+ }
536
+ async function E(e, t, n = {}, r) {
537
+ var o;
538
+ const s = M(e), i = new URLSearchParams({ f: "geojson" });
539
+ if (n.limit != null && i.set("limit", String(n.limit)), n.offset != null && i.set("offset", String(n.offset)), n.bbox && i.set("bbox", n.bbox.join(",")), (o = n.properties) != null && o.length && i.set("properties", n.properties.join(",")), n.datetime && i.set("datetime", n.datetime), n.cql2Filter)
540
+ i.set("filter-lang", "cql2-json"), i.set("filter", JSON.stringify(n.cql2Filter));
530
541
  else if (n.filter)
531
- for (const [o, a] of Object.entries(n.filter))
532
- s.set(o, String(a));
533
- const i = `${r}/collections/${encodeURIComponent(t)}/items?${s}`;
534
- return C(i);
542
+ for (const [a, l] of Object.entries(n.filter))
543
+ i.set(a, String(l));
544
+ const c = `${s}/collections/${encodeURIComponent(t)}/items?${i}`;
545
+ return k(c, r);
535
546
  }
536
- async function We(e, t, n) {
537
- const s = `${$(e)}/collections/${encodeURIComponent(t)}/items/${encodeURIComponent(String(n))}?f=geojson`;
547
+ async function Ke(e, t, n, r) {
548
+ const i = `${M(e)}/collections/${encodeURIComponent(t)}/items/${encodeURIComponent(String(n))}?f=geojson`;
538
549
  try {
539
- return await C(s);
550
+ return await k(i, r);
540
551
  } catch {
541
552
  return null;
542
553
  }
543
554
  }
544
- async function ke(e, t) {
545
- const r = `${$(e)}/collections/${encodeURIComponent(t)}/queryables?f=schemajson`;
546
- return C(r);
555
+ async function Ee(e, t, n) {
556
+ const s = `${M(e)}/collections/${encodeURIComponent(t)}/queryables?f=schemajson`;
557
+ return k(s, n);
547
558
  }
548
- async function Le(e, t) {
549
- const r = `${$(e)}/collections/${encodeURIComponent(t)}?f=json`;
550
- return C(r);
559
+ async function Oe(e, t, n) {
560
+ const s = `${M(e)}/collections/${encodeURIComponent(t)}?f=json`;
561
+ return k(s, n);
551
562
  }
552
- async function ze(e) {
553
- const t = `${$(e)}/conformance?f=json`;
554
- return C(t);
563
+ async function Qe(e, t) {
564
+ const n = `${M(e)}/conformance?f=json`;
565
+ return k(n, t);
555
566
  }
556
- async function Ve(e, t, n = "WebMercatorQuad") {
557
- const r = Ee(e, t, n);
558
- return C(r);
567
+ async function Be(e, t, n = "WebMercatorQuad", r) {
568
+ const s = Fe(e, t, n, r);
569
+ return k(s, r);
559
570
  }
560
- async function Qe(e, t, n = {}) {
561
- return (await L(e, t, {
571
+ async function Xe(e, t, n = {}, r) {
572
+ return (await E(e, t, {
562
573
  ...n,
563
574
  limit: 0
564
- })).numberMatched ?? null;
565
- }
566
- function Ee(e, t, n = "WebMercatorQuad") {
567
- return `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/tilejson.json`;
568
- }
569
- function Be(e, t, n = "WebMercatorQuad") {
570
- return `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/{z}/{x}/{y}`;
571
- }
572
- function Ke(e, t, n, r = "WebMercatorQuad") {
573
- const i = `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
574
- if (!n || Object.keys(n).length === 0) return i;
575
- const l = new URLSearchParams();
576
- for (const [o, a] of Object.entries(n))
577
- l.set(o, String(a));
578
- return `${i}?${l}`;
579
- }
580
- async function Xe(e, t, n, r) {
581
- const s = r != null && r.query ? { op: "like", args: [{ property: n }, `%${r.query}%`] } : void 0, i = /* @__PURE__ */ new Set(), l = (o) => {
582
- var a;
583
- for (const c of o) {
584
- const g = (a = c.properties) == null ? void 0 : a[n];
585
- g != null && typeof g == "string" && i.add(g);
575
+ }, r)).numberMatched ?? null;
576
+ }
577
+ function Fe(e, t, n = "WebMercatorQuad", r) {
578
+ const i = `${M(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/tilejson.json`;
579
+ return L(i, r);
580
+ }
581
+ function Ye(e, t, n = "WebMercatorQuad", r) {
582
+ const i = `${M(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/{z}/{x}/{y}`;
583
+ return L(i, r);
584
+ }
585
+ function He(e, t, n, r = "WebMercatorQuad", s) {
586
+ let c = `${M(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
587
+ if (n && Object.keys(n).length > 0) {
588
+ const o = new URLSearchParams();
589
+ for (const [a, l] of Object.entries(n))
590
+ o.set(a, String(l));
591
+ c = `${c}?${o}`;
592
+ }
593
+ return L(c, s);
594
+ }
595
+ async function Ze(e, t, n, r, s) {
596
+ const i = r != null && r.query ? { op: "like", args: [{ property: n }, `%${r.query}%`] } : void 0, c = /* @__PURE__ */ new Set(), o = (a) => {
597
+ var l;
598
+ for (const f of a) {
599
+ const u = (l = f.properties) == null ? void 0 : l[n];
600
+ u != null && typeof u == "string" && c.add(u);
586
601
  }
587
602
  };
588
603
  if (r != null && r.fetchAll) {
589
- const o = r.maxFeatures ?? 1e4, a = r.limit ?? 500;
590
- let c = 0, g = 0;
591
- for (; g < o; ) {
592
- const f = Math.min(a, o - g), u = await L(e, t, {
604
+ const a = r.maxFeatures ?? 1e4, l = r.limit ?? 500;
605
+ let f = 0, u = 0;
606
+ for (; u < a; ) {
607
+ const g = Math.min(l, a - u), m = await E(e, t, {
593
608
  properties: [n],
594
- limit: f,
595
- offset: c,
596
- cql2Filter: s
597
- });
598
- if (l(u.features), g += u.features.length, c += u.features.length, u.features.length < f || u.numberMatched != null && c >= u.numberMatched) break;
609
+ limit: g,
610
+ offset: f,
611
+ cql2Filter: i
612
+ }, s);
613
+ if (o(m.features), u += m.features.length, f += m.features.length, m.features.length < g || m.numberMatched != null && f >= m.numberMatched) break;
599
614
  }
600
615
  } else {
601
- const o = await L(e, t, {
616
+ const a = await E(e, t, {
602
617
  properties: [n],
603
618
  limit: (r == null ? void 0 : r.limit) ?? 50,
604
- cql2Filter: s
619
+ cql2Filter: i
620
+ }, s);
621
+ o(a.features);
622
+ }
623
+ return Array.from(c).sort();
624
+ }
625
+ function et(e, t, n, r = "WebMercatorQuad", s) {
626
+ let c = `${M(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
627
+ if (n) {
628
+ const o = new URLSearchParams({
629
+ "filter-lang": "cql2-json",
630
+ filter: JSON.stringify(n)
605
631
  });
606
- l(o.features);
632
+ c = `${c}?${o}`;
607
633
  }
608
- return Array.from(i).sort();
609
- }
610
- function Ye(e, t, n, r = "WebMercatorQuad") {
611
- const i = `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
612
- if (!n) return i;
613
- const l = new URLSearchParams({
614
- "filter-lang": "cql2-json",
615
- filter: JSON.stringify(n)
616
- });
617
- return `${i}?${l}`;
634
+ return L(c, s);
618
635
  }
619
- function He(e, t) {
636
+ function tt(e, t) {
620
637
  return t ? `${e}--${JSON.stringify(t)}` : e;
621
638
  }
622
- function Ze(e) {
639
+ function nt(e) {
623
640
  return e.length === 1 ? ["==", ["geometry-type"], e[0]] : ["in", ["geometry-type"], ["literal", e]];
624
641
  }
625
- function et(e) {
626
- const [t, n] = d([]), [r, s] = d(!1), [i, l] = d(null);
642
+ function rt(e, t, n = "WebMercatorQuad", r, s) {
643
+ if (r)
644
+ return (s == null ? void 0 : s.type) === "query_param" && new RegExp(`[?&]${s.name}=`).test(r) ? r : L(r, s);
645
+ const c = `${M(e)}/collections/${encodeURIComponent(t)}/map/tiles/${encodeURIComponent(n)}/{z}/{x}/{y}.png`;
646
+ return L(c, s);
647
+ }
648
+ async function st(e, t) {
649
+ return k(e, t);
650
+ }
651
+ function it(e) {
652
+ return /\{z\}.*\{x\}.*\{y\}/i.test(e) ? "xyz" : /tilejson\.json|tiles\.json/i.test(e) ? "tilejson" : "ogc-api";
653
+ }
654
+ function ot(e, t) {
655
+ const [n, r] = y([]), [s, i] = y(!1), [c, o] = y(null), a = t ? `${t.type}:${t.name}:${t.value}` : "";
627
656
  return N(() => {
628
657
  if (!e) return;
629
- let o = !1;
630
- return s(!0), l(null), Ce(e).then((a) => {
631
- o || n(a);
632
- }).catch((a) => {
633
- o || l(a instanceof Error ? a : new Error(String(a)));
658
+ let l = !1;
659
+ return i(!0), o(null), Le(e, t).then((f) => {
660
+ l || r(f);
661
+ }).catch((f) => {
662
+ l || o(f instanceof Error ? f : new Error(String(f)));
634
663
  }).finally(() => {
635
- o || s(!1);
664
+ l || i(!1);
636
665
  }), () => {
637
- o = !0;
666
+ l = !0;
638
667
  };
639
- }, [e]), { collections: t, loading: r, error: i };
668
+ }, [e, a]), { collections: n, loading: s, error: c };
640
669
  }
641
- function tt(e, t) {
642
- const [n, r] = d(null), [s, i] = d(!1), [l, o] = d(null);
670
+ function at(e, t) {
671
+ const [n, r] = y(null), [s, i] = y(!1), [c, o] = y(null);
643
672
  return N(() => {
644
673
  if (!e || !t) return;
645
674
  let a = !1;
646
- return i(!0), o(null), ke(e, t).then((c) => {
647
- a || r(c);
648
- }).catch((c) => {
649
- a || o(c instanceof Error ? c : new Error(String(c)));
675
+ return i(!0), o(null), Ee(e, t).then((l) => {
676
+ a || r(l);
677
+ }).catch((l) => {
678
+ a || o(l instanceof Error ? l : new Error(String(l)));
650
679
  }).finally(() => {
651
680
  a || i(!1);
652
681
  }), () => {
653
682
  a = !0;
654
683
  };
655
- }, [e, t]), { queryables: n, loading: s, error: l };
684
+ }, [e, t]), { queryables: n, loading: s, error: c };
656
685
  }
657
- function nt(e, t, n = {}) {
658
- const [r, s] = d([]), [i, l] = d(!1), [o, a] = d(null), [c, g] = d(!1), f = JSON.stringify(n);
686
+ function ct(e, t, n = {}, r) {
687
+ const [s, i] = y([]), [c, o] = y(!1), [a, l] = y(null), [f, u] = y(!1), g = JSON.stringify(n), m = r ? `${r.type}:${r.name}:${r.value}` : "";
659
688
  return N(() => {
660
689
  if (!e || !t) return;
661
- let u = !1;
662
- l(!0), a(null);
663
- const m = JSON.parse(f);
664
- return L(e, t, m).then((h) => {
665
- if (!u) {
666
- s(h.features);
667
- const p = m.limit ?? 10, b = m.offset ?? 0;
668
- h.numberMatched != null ? g(b + h.features.length < h.numberMatched) : g(h.features.length >= p);
690
+ let d = !1;
691
+ o(!0), l(null);
692
+ const b = JSON.parse(g);
693
+ return E(e, t, b, r).then((p) => {
694
+ if (!d) {
695
+ i(p.features);
696
+ const h = b.limit ?? 10, P = b.offset ?? 0;
697
+ p.numberMatched != null ? u(P + p.features.length < p.numberMatched) : u(p.features.length >= h);
669
698
  }
670
- }).catch((h) => {
671
- u || (a(h instanceof Error ? h : new Error(String(h))), s([]), g(!1));
699
+ }).catch((p) => {
700
+ d || (l(p instanceof Error ? p : new Error(String(p))), i([]), u(!1));
672
701
  }).finally(() => {
673
- u || l(!1);
702
+ d || o(!1);
674
703
  }), () => {
675
- u = !0;
704
+ d = !0;
676
705
  };
677
- }, [e, t, f]), { features: r, loading: i, error: o, hasMore: c };
706
+ }, [e, t, g, m]), { features: s, loading: c, error: a, hasMore: f };
678
707
  }
679
- function _(e) {
708
+ function D(e) {
680
709
  return `${e[0]} ${e[1]}`;
681
710
  }
682
711
  function A(e) {
683
- return e.map(_).join(", ");
712
+ return e.map(D).join(", ");
684
713
  }
685
- function X(e) {
714
+ function Y(e) {
686
715
  if (!e || !e.type) return "";
687
716
  switch (e.type) {
688
717
  case "Point":
689
- return `POINT (${_(e.coordinates)})`;
718
+ return `POINT (${D(e.coordinates)})`;
690
719
  case "MultiPoint":
691
- return `MULTIPOINT (${e.coordinates.map((t) => `(${_(t)})`).join(", ")})`;
720
+ return `MULTIPOINT (${e.coordinates.map((t) => `(${D(t)})`).join(", ")})`;
692
721
  case "LineString":
693
722
  return `LINESTRING (${A(e.coordinates)})`;
694
723
  case "MultiLineString":
@@ -698,63 +727,63 @@ function X(e) {
698
727
  case "MultiPolygon":
699
728
  return `MULTIPOLYGON (${e.coordinates.map((t) => `(${t.map((n) => `(${A(n)})`).join(", ")})`).join(", ")})`;
700
729
  case "GeometryCollection":
701
- return `GEOMETRYCOLLECTION (${e.geometries.map(X).join(", ")})`;
730
+ return `GEOMETRYCOLLECTION (${e.geometries.map(Y).join(", ")})`;
702
731
  default:
703
732
  return "";
704
733
  }
705
734
  }
706
- function Y(e, t) {
735
+ function H(e, t) {
707
736
  const n = URL.createObjectURL(e), r = document.createElement("a");
708
737
  r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
709
738
  }
710
- function x(e, t) {
739
+ function _(e, t) {
711
740
  return e.includes('"') || e.includes(t) || e.includes(`
712
741
  `) ? `"${e.replace(/"/g, '""')}"` : e;
713
742
  }
714
- function Oe(e, t) {
743
+ function Re(e, t) {
715
744
  const n = (e.properties ?? {})[t];
716
745
  return n == null ? "" : typeof n == "object" ? JSON.stringify(n) : String(n);
717
746
  }
718
- function Fe(e, t = {}) {
747
+ function je(e, t = {}) {
719
748
  const { fields: n, includeGeometry: r = !0, delimiter: s = "," } = t;
720
749
  if (e.length === 0) return "";
721
- const i = n ?? [...new Set(e.flatMap((a) => Object.keys(a.properties ?? {})))], l = r ? [...i, "geometry"] : i, o = e.map((a) => {
722
- const c = i.map(
723
- (g) => x(Oe(a, g), s)
750
+ const i = n ?? [...new Set(e.flatMap((a) => Object.keys(a.properties ?? {})))], c = r ? [...i, "geometry"] : i, o = e.map((a) => {
751
+ const l = i.map(
752
+ (f) => _(Re(a, f), s)
724
753
  );
725
- return r && c.push(x(X(a.geometry), s)), c.join(s);
754
+ return r && l.push(_(Y(a.geometry), s)), l.join(s);
726
755
  });
727
- return [l.map((a) => x(a, s)).join(s), ...o].join(`
756
+ return [c.map((a) => _(a, s)).join(s), ...o].join(`
728
757
  `);
729
758
  }
730
- function Re(e, t) {
759
+ function Ae(e, t) {
731
760
  const n = new Blob([e], { type: "text/csv;charset=utf-8;" });
732
- Y(n, t);
761
+ H(n, t);
733
762
  }
734
- function rt({
763
+ function lt({
735
764
  baseUrl: e,
736
765
  limit: t = 1e3,
737
766
  csvOptions: n
738
767
  }) {
739
- const [r, s] = d(!1), [i, l] = d(null);
768
+ const [r, s] = y(!1), [i, c] = y(null);
740
769
  return { exportCsv: v(
741
- async (a, c = `${a}.csv`, g) => {
742
- s(!0), l(null);
743
- const f = [], u = Math.min(t, 1e3);
770
+ async (a, l = `${a}.csv`, f) => {
771
+ s(!0), c(null);
772
+ const u = [], g = Math.min(t, 1e3);
744
773
  let m = 0;
745
774
  try {
746
- for (; f.length < t; ) {
747
- const p = t - f.length, b = Math.min(u, p), y = await L(e, a, {
748
- limit: b,
775
+ for (; u.length < t; ) {
776
+ const b = t - u.length, p = Math.min(g, b), h = await E(e, a, {
777
+ limit: p,
749
778
  offset: m,
750
- cql2Filter: g
779
+ cql2Filter: f
751
780
  });
752
- if (f.push(...y.features), m += y.features.length, y.features.length < b || y.numberMatched != null && m >= y.numberMatched) break;
781
+ if (u.push(...h.features), m += h.features.length, h.features.length < p || h.numberMatched != null && m >= h.numberMatched) break;
753
782
  }
754
- const h = Fe(f, n);
755
- Re(h, c);
756
- } catch (h) {
757
- l(h instanceof Error ? h : new Error(String(h)));
783
+ const d = je(u, n);
784
+ Ae(d, l);
785
+ } catch (d) {
786
+ c(d instanceof Error ? d : new Error(String(d)));
758
787
  } finally {
759
788
  s(!1);
760
789
  }
@@ -762,46 +791,46 @@ function rt({
762
791
  [e, t, n]
763
792
  ), loading: r, error: i };
764
793
  }
765
- function st({
794
+ function ut({
766
795
  baseUrl: e = "",
767
796
  limit: t = 1e5,
768
797
  converters: n
769
798
  }) {
770
- const [r, s] = d(!1), [i, l] = d(null), [o, a] = d(null);
799
+ const [r, s] = y(!1), [i, c] = y(null), [o, a] = y(null);
771
800
  return { runExport: v(
772
- async (g, f, u, m, h) => {
773
- const p = h ?? e, b = n[f];
774
- if (!b) {
775
- a(new Error(`Unknown export format: ${f}`));
801
+ async (f, u, g, m, d) => {
802
+ const b = d ?? e, p = n[u];
803
+ if (!p) {
804
+ a(new Error(`Unknown export format: ${u}`));
776
805
  return;
777
806
  }
778
- s(!0), l("Fetching features..."), a(null);
779
- const y = [], k = Math.min(t, 1e3);
807
+ s(!0), c("Fetching features..."), a(null);
808
+ const h = [], P = Math.min(t, 1e3);
780
809
  let w = 0;
781
810
  try {
782
- for (; y.length < t; ) {
783
- const P = t - y.length, q = Math.min(k, P), O = await L(p, g, {
784
- limit: q,
811
+ for (; h.length < t; ) {
812
+ const C = t - h.length, I = Math.min(P, C), F = await E(b, f, {
813
+ limit: I,
785
814
  offset: w,
786
815
  cql2Filter: m
787
816
  });
788
- y.push(...O.features), w += O.features.length;
789
- const F = O.numberMatched;
790
- if (F != null ? l(`Fetching features... (${y.length} of ${F})`) : l(`Fetching features... (${y.length})`), O.features.length < q || F != null && w >= F) break;
817
+ h.push(...F.features), w += F.features.length;
818
+ const R = F.numberMatched;
819
+ if (R != null ? c(`Fetching features... (${h.length} of ${R})`) : c(`Fetching features... (${h.length})`), F.features.length < I || R != null && w >= R) break;
791
820
  }
792
- l("Converting...");
793
- const M = await b(y, g);
794
- Y(M.blob, u);
795
- } catch (M) {
796
- a(M instanceof Error ? M : new Error(String(M)));
821
+ c("Converting...");
822
+ const $ = await p(h, f);
823
+ H($.blob, g);
824
+ } catch ($) {
825
+ a($ instanceof Error ? $ : new Error(String($)));
797
826
  } finally {
798
- s(!1), l(null);
827
+ s(!1), c(null);
799
828
  }
800
829
  },
801
830
  [e, t, n]
802
831
  ), loading: r, progress: i, error: o };
803
832
  }
804
- const it = [
833
+ const ft = [
805
834
  { id: "csv", label: "CSV", extension: ".csv", description: "Comma-separated values" },
806
835
  { id: "geojson", label: "GeoJSON", extension: ".geojson", description: "GeoJSON format" },
807
836
  { id: "kml", label: "KML", extension: ".kml", description: "Google Earth" },
@@ -809,87 +838,87 @@ const it = [
809
838
  { id: "flatgeobuf", label: "FlatGeobuf", extension: ".fgb", description: "FlatGeobuf" },
810
839
  { id: "geopackage", label: "GeoPackage", extension: ".gpkg", description: "OGC GeoPackage" }
811
840
  ];
812
- function ot(e, t) {
813
- const [n, r] = d(null), [s, i] = d(!1), [l, o] = d(null);
841
+ function gt(e, t) {
842
+ const [n, r] = y(null), [s, i] = y(!1), [c, o] = y(null);
814
843
  return N(() => {
815
844
  if (!e || !t) return;
816
845
  let a = !1;
817
- return i(!0), o(null), Le(e, t).then((c) => {
818
- a || r(c);
819
- }).catch((c) => {
820
- a || o(c instanceof Error ? c : new Error(String(c)));
846
+ return i(!0), o(null), Oe(e, t).then((l) => {
847
+ a || r(l);
848
+ }).catch((l) => {
849
+ a || o(l instanceof Error ? l : new Error(String(l)));
821
850
  }).finally(() => {
822
851
  a || i(!1);
823
852
  }), () => {
824
853
  a = !0;
825
854
  };
826
- }, [e, t]), { collection: n, loading: s, error: l };
855
+ }, [e, t]), { collection: n, loading: s, error: c };
827
856
  }
828
- function at() {
829
- const [e, t] = d(null), [n, r] = d([]), [s, i] = d("km"), l = j(
857
+ function mt() {
858
+ const [e, t] = y(null), [n, r] = y([]), [s, i] = y("km"), c = T(
830
859
  () => e ? Me(e, n, s) : null,
831
860
  [e, n, s]
832
- ), o = j(
833
- () => e ? $e(e, n) : null,
861
+ ), o = T(
862
+ () => e ? Pe(e, n) : null,
834
863
  [e, n]
835
- ), a = j(
836
- () => e ? Pe(n) : null,
864
+ ), a = T(
865
+ () => e ? Ce(n) : null,
837
866
  [e, n]
838
- ), c = v((u) => {
839
- t(u), r([]), u && i(ve(u));
840
- }, []), g = v((u) => {
841
- r((m) => [...m, u]);
842
- }, []), f = v(() => {
867
+ ), l = v((g) => {
868
+ t(g), r([]), g && i(ve(g));
869
+ }, []), f = v((g) => {
870
+ r((m) => [...m, g]);
871
+ }, []), u = v(() => {
843
872
  r([]);
844
873
  }, []);
845
- return { mode: e, points: n, unit: s, measurement: l, geometryData: o, pointsData: a, setMode: c, setUnit: i, addPoint: g, clear: f };
874
+ return { mode: e, points: n, unit: s, measurement: c, geometryData: o, pointsData: a, setMode: l, setUnit: i, addPoint: f, clear: u };
846
875
  }
847
- function D(e) {
876
+ function q(e) {
848
877
  return e.id != null ? `${e.layerId}:${e.id}` : `${e.layerId}:${JSON.stringify(e.properties)}`;
849
878
  }
850
- const z = 1e3;
851
- function lt() {
852
- const [e, t] = d(null), [n, r] = d(null), [s, i] = d([]), l = j(() => s.length === 0 ? null : {
879
+ const V = 1e3;
880
+ function dt() {
881
+ const [e, t] = y(null), [n, r] = y(null), [s, i] = y([]), c = T(() => s.length === 0 ? null : {
853
882
  type: "FeatureCollection",
854
- features: s.map((u) => ({
883
+ features: s.map((g) => ({
855
884
  type: "Feature",
856
- properties: u.properties,
857
- geometry: u.geometry
885
+ properties: g.properties,
886
+ geometry: g.geometry
858
887
  }))
859
- }, [s]), o = v((u) => {
860
- t(u);
861
- }, []), a = v((u) => {
862
- r(u), i([]);
863
- }, []), c = v((u) => {
888
+ }, [s]), o = v((g) => {
889
+ t(g);
890
+ }, []), a = v((g) => {
891
+ r(g), i([]);
892
+ }, []), l = v((g) => {
864
893
  i((m) => {
865
- const h = new Set(m.map(D)), p = u.filter((y) => !h.has(D(y))), b = [...m, ...p];
866
- return b.length > z ? b.slice(0, z) : b;
894
+ const d = new Set(m.map(q)), b = g.filter((h) => !d.has(q(h))), p = [...m, ...b];
895
+ return p.length > V ? p.slice(0, V) : p;
867
896
  });
868
- }, []), g = v((u) => {
869
- i((m) => m.filter((h) => D(h) !== u));
870
- }, []), f = v(() => {
897
+ }, []), f = v((g) => {
898
+ i((m) => m.filter((d) => q(d) !== g));
899
+ }, []), u = v(() => {
871
900
  i([]);
872
901
  }, []);
873
902
  return {
874
903
  mode: e,
875
904
  activeLayerId: n,
876
905
  features: s,
877
- highlightData: l,
906
+ highlightData: c,
878
907
  setMode: o,
879
908
  setActiveLayerId: a,
880
- addFeatures: c,
881
- removeFeature: g,
882
- clearFeatures: f
909
+ addFeatures: l,
910
+ removeFeature: f,
911
+ clearFeatures: u
883
912
  };
884
913
  }
885
- function ct(e) {
914
+ function ht(e) {
886
915
  if (!e) return;
887
916
  const t = [], n = {};
888
917
  for (const [r, s] of Object.entries(e))
889
918
  s.visible !== !1 && (t.push(r), s.label && (n[r] = s.label));
890
919
  return { fields: t, labels: n };
891
920
  }
892
- async function ut(e) {
921
+ async function yt(e) {
893
922
  try {
894
923
  const t = await fetch(e);
895
924
  if (!t.ok) return null;
@@ -899,7 +928,7 @@ async function ut(e) {
899
928
  return null;
900
929
  }
901
930
  }
902
- async function Ae(e) {
931
+ async function Ge(e) {
903
932
  try {
904
933
  const t = await fetch(`${e}.json`);
905
934
  if (!t.ok) return [];
@@ -909,18 +938,18 @@ async function Ae(e) {
909
938
  return [];
910
939
  }
911
940
  }
912
- async function ft(e, t) {
941
+ async function pt(e, t) {
913
942
  const n = await fetch(e);
914
943
  if (!n.ok) throw new Error(`Failed to fetch style: ${n.status}`);
915
944
  const r = await n.json();
916
945
  if (!t.length) return r;
917
- const s = Array.isArray(r.sprite) ? r.sprite : r.sprite ? [{ id: "default", url: r.sprite }] : [], i = new Set(t.map((o) => o.id)), l = [
946
+ const s = Array.isArray(r.sprite) ? r.sprite : r.sprite ? [{ id: "default", url: r.sprite }] : [], i = new Set(t.map((o) => o.id)), c = [
918
947
  ...s.filter((o) => !i.has(o.id)),
919
948
  ...t.map((o) => ({ id: o.id, url: o.url }))
920
949
  ];
921
- return { ...r, sprite: l };
950
+ return { ...r, sprite: c };
922
951
  }
923
- async function Ge(e) {
952
+ async function Te(e) {
924
953
  try {
925
954
  const t = await fetch(e);
926
955
  if (!t.ok) return [];
@@ -930,204 +959,211 @@ async function Ge(e) {
930
959
  return [];
931
960
  }
932
961
  }
933
- async function V(e) {
934
- const t = await Ae(e.url);
962
+ async function K(e) {
963
+ const t = await Ge(e.url);
935
964
  return e.id === "default" ? t : t.map((n) => `${e.id}:${n}`);
936
965
  }
937
- async function gt(e, t = []) {
966
+ async function bt(e, t = []) {
938
967
  const n = [];
939
968
  e && n.push(
940
- Ge(e).then(
941
- (s) => Promise.all(s.map(V)).then((i) => i.flat())
969
+ Te(e).then(
970
+ (s) => Promise.all(s.map(K)).then((i) => i.flat())
942
971
  )
943
972
  );
944
973
  for (const s of t)
945
- n.push(V(s));
974
+ n.push(K(s));
946
975
  const r = await Promise.all(n);
947
976
  return [...new Set(r.flat())].sort();
948
977
  }
949
- function E(e, t) {
978
+ function O(e, t) {
950
979
  return { op: "=", args: [{ property: e }, t] };
951
980
  }
952
- function ht(e, t) {
981
+ function St(e, t) {
953
982
  return { op: "<>", args: [{ property: e }, t] };
954
983
  }
955
- function je(e, t) {
984
+ function Ue(e, t) {
956
985
  return { op: ">", args: [{ property: e }, t] };
957
986
  }
958
- function H(e, t) {
987
+ function Z(e, t) {
959
988
  return { op: ">=", args: [{ property: e }, t] };
960
989
  }
961
- function Te(e, t) {
990
+ function Ne(e, t) {
962
991
  return { op: "<", args: [{ property: e }, t] };
963
992
  }
964
- function Z(e, t) {
993
+ function ee(e, t) {
965
994
  return { op: "<=", args: [{ property: e }, t] };
966
995
  }
967
- function Ne(e, t, n) {
968
- return { op: "and", args: [H(e, t), Z(e, n)] };
996
+ function xe(e, t, n) {
997
+ return { op: "and", args: [Z(e, t), ee(e, n)] };
969
998
  }
970
- function mt(e, t) {
999
+ function wt(e, t) {
971
1000
  return { op: "like", args: [{ property: e }, t] };
972
1001
  }
973
- function dt(e, t) {
1002
+ function $t(e, t) {
974
1003
  return { op: "in", args: [{ property: e }, t] };
975
1004
  }
976
- function yt(e) {
1005
+ function Mt(e) {
977
1006
  return { op: "isNull", args: [{ property: e }] };
978
1007
  }
979
- function ee(...e) {
1008
+ function te(...e) {
980
1009
  const t = e.filter((n) => n != null);
981
1010
  return t.length === 0 ? null : t.length === 1 ? t[0] : { op: "and", args: t };
982
1011
  }
983
- function pt(...e) {
1012
+ function vt(...e) {
984
1013
  const t = e.filter((n) => n != null);
985
1014
  return t.length === 0 ? null : t.length === 1 ? t[0] : { op: "or", args: t };
986
1015
  }
987
- function bt(e) {
1016
+ function Pt(e) {
988
1017
  return { op: "not", args: [e] };
989
1018
  }
990
- function Ue(e, t) {
1019
+ function _e(e, t) {
991
1020
  return { op: "t_after", args: [{ property: e }, t] };
992
1021
  }
993
- function xe(e, t) {
1022
+ function qe(e, t) {
994
1023
  return { op: "t_before", args: [{ property: e }, t] };
995
1024
  }
996
1025
  function De(e, t, n) {
997
1026
  const r = "date" in t ? t.date : t.timestamp, s = "date" in n ? n.date : n.timestamp;
998
1027
  return { op: "t_during", args: [{ property: e }, { interval: [r, s] }] };
999
1028
  }
1000
- function St(e, t) {
1029
+ function Ct(e, t) {
1001
1030
  return { op: "s_intersects", args: [{ property: e }, t] };
1002
1031
  }
1003
- function wt(e, t) {
1032
+ function kt(e, t) {
1004
1033
  return { op: "s_within", args: [{ property: e }, t] };
1005
1034
  }
1006
- function Mt(e, t, n, r = "meters") {
1035
+ function Lt(e, t, n, r = "meters") {
1007
1036
  return { op: "s_dwithin", args: [{ property: e }, t, n, r] };
1008
1037
  }
1009
- function vt(e) {
1010
- const t = Object.entries(e).filter(([, n]) => n !== void 0 && n !== "").map(([n, r]) => E(n, r));
1011
- return ee(...t);
1038
+ function Et(e) {
1039
+ const t = Object.entries(e).filter(([, n]) => n !== void 0 && n !== "").map(([n, r]) => O(n, r));
1040
+ return te(...t);
1012
1041
  }
1013
- function $t(e, t) {
1042
+ function Ot(e, t) {
1014
1043
  const n = new Map(t.map((s) => [s.property, s])), r = Object.entries(e).map(([s, i]) => {
1015
1044
  if (i === void 0) return null;
1016
- const l = n.get(s);
1045
+ const c = n.get(s);
1017
1046
  if (typeof i == "string")
1018
- return i === "" ? null : (l == null ? void 0 : l.type) === "datetime" ? E(s, { timestamp: i }) : E(s, i);
1047
+ return i === "" ? null : (c == null ? void 0 : c.type) === "datetime" ? O(s, { timestamp: i }) : O(s, i);
1019
1048
  if (typeof i == "number")
1020
- return E(s, i);
1049
+ return O(s, i);
1021
1050
  if (typeof i == "object") {
1022
1051
  if ("start" in i || "end" in i) {
1023
1052
  const { start: o, end: a } = i;
1024
- return o && a ? De(s, { timestamp: o }, { timestamp: a }) : o ? Ue(s, { timestamp: o }) : a ? xe(s, { timestamp: a }) : null;
1053
+ return o && a ? De(s, { timestamp: o }, { timestamp: a }) : o ? _e(s, { timestamp: o }) : a ? qe(s, { timestamp: a }) : null;
1025
1054
  }
1026
1055
  if ("value" in i && "operator" in i) {
1027
1056
  const { value: o, operator: a } = i;
1028
1057
  if (o == null || String(o) === "") return null;
1029
1058
  switch (a) {
1030
1059
  case "gt":
1031
- return je(s, o);
1060
+ return Ue(s, o);
1032
1061
  case "lt":
1033
- return Te(s, o);
1062
+ return Ne(s, o);
1034
1063
  case "gte":
1035
- return H(s, o);
1036
- case "lte":
1037
1064
  return Z(s, o);
1065
+ case "lte":
1066
+ return ee(s, o);
1038
1067
  default:
1039
- return E(s, o);
1068
+ return O(s, o);
1040
1069
  }
1041
1070
  }
1042
1071
  if ("min" in i && "max" in i) {
1043
1072
  const { min: o, max: a } = i;
1044
- return o === void 0 || a === void 0 ? null : Ne(s, o, a);
1073
+ return o === void 0 || a === void 0 ? null : xe(s, o, a);
1045
1074
  }
1046
1075
  }
1047
1076
  return null;
1048
1077
  });
1049
- return ee(...r);
1078
+ return te(...r);
1050
1079
  }
1051
- function Pt(e) {
1080
+ function Ft(e) {
1052
1081
  return JSON.stringify(e);
1053
1082
  }
1054
- function te(e) {
1083
+ function ne(e) {
1055
1084
  const t = e.type, n = e.coordinates;
1056
- return t === "Point" ? [n] : t === "MultiPoint" || t === "LineString" ? n : t === "MultiLineString" || t === "Polygon" ? n.flat() : t === "MultiPolygon" ? n.flat(2) : t === "GeometryCollection" ? (e.geometries ?? []).flatMap(te) : [];
1085
+ return t === "Point" ? [n] : t === "MultiPoint" || t === "LineString" ? n : t === "MultiLineString" || t === "Polygon" ? n.flat() : t === "MultiPolygon" ? n.flat(2) : t === "GeometryCollection" ? (e.geometries ?? []).flatMap(ne) : [];
1057
1086
  }
1058
1087
  const G = 0.01;
1059
- function Ct(e) {
1060
- const t = te(e);
1088
+ function Rt(e) {
1089
+ const t = ne(e);
1061
1090
  if (t.length === 0) return null;
1062
1091
  let n = 1 / 0, r = 1 / 0, s = -1 / 0, i = -1 / 0;
1063
- for (const [l, o] of t)
1064
- l < n && (n = l), l > s && (s = l), o < r && (r = o), o > i && (i = o);
1092
+ for (const [c, o] of t)
1093
+ c < n && (n = c), c > s && (s = c), o < r && (r = o), o > i && (i = o);
1065
1094
  return n === s && r === i && (n -= G, r -= G, s += G, i += G), [n, r, s, i];
1066
1095
  }
1067
1096
  export {
1068
- ye as $,
1069
- yt as A,
1070
- mt as B,
1071
- Te as C,
1072
- it as D,
1097
+ gt as $,
1098
+ tt as A,
1099
+ Ye as B,
1100
+ Ue as C,
1101
+ ft as D,
1073
1102
  Z as E,
1074
- ht as F,
1075
- bt as G,
1076
- pt as H,
1077
- ct as I,
1078
- ft as J,
1079
- Mt as K,
1080
- St as L,
1081
- wt as M,
1082
- Pt as N,
1083
- Ue as O,
1084
- xe as P,
1085
- De as Q,
1086
- rt as R,
1087
- st as S,
1088
- at as T,
1089
- ot as U,
1090
- et as V,
1091
- nt as W,
1092
- tt as X,
1103
+ $t as F,
1104
+ Mt as G,
1105
+ wt as H,
1106
+ Ne as I,
1107
+ ee as J,
1108
+ St as K,
1109
+ Pt as L,
1110
+ vt as M,
1111
+ ht as N,
1112
+ pt as O,
1113
+ Lt as P,
1114
+ Ct as Q,
1115
+ kt as R,
1116
+ Ft as S,
1117
+ M as T,
1118
+ _e as U,
1119
+ qe as V,
1120
+ De as W,
1121
+ Ve as X,
1093
1122
  lt as Y,
1094
- Ie as Z,
1095
- Je as _,
1096
- ee as a,
1097
- $e as a0,
1098
- Pe as a1,
1099
- we as a2,
1100
- Se as a3,
1101
- Me as a4,
1102
- ve as a5,
1103
- Re as a6,
1104
- Ae as a7,
1105
- ut as a8,
1106
- gt as a9,
1107
- D as aa,
1108
- Ct as b,
1109
- Ne as c,
1110
- Ze as d,
1111
- Y as e,
1112
- E as f,
1113
- Fe as g,
1114
- Le as h,
1115
- Ce as i,
1116
- ze as j,
1117
- Xe as k,
1118
- We as l,
1123
+ ut as Z,
1124
+ mt as _,
1125
+ te as a,
1126
+ ot as a0,
1127
+ ct as a1,
1128
+ at as a2,
1129
+ dt as a3,
1130
+ ze as a4,
1131
+ We as a5,
1132
+ pe as a6,
1133
+ Pe as a7,
1134
+ Ce as a8,
1135
+ $e as a9,
1136
+ we as aa,
1137
+ Me as ab,
1138
+ ve as ac,
1139
+ Ae as ad,
1140
+ Ge as ae,
1141
+ yt as af,
1142
+ bt as ag,
1143
+ q as ah,
1144
+ L as b,
1145
+ ke as c,
1146
+ Rt as d,
1147
+ xe as e,
1148
+ nt as f,
1149
+ it as g,
1150
+ H as h,
1151
+ O as i,
1152
+ je as j,
1153
+ Oe as k,
1154
+ Le as l,
1119
1155
  Qe as m,
1120
- L as n,
1121
- ke as o,
1122
- Ve as p,
1123
- vt as q,
1124
- $t as r,
1125
- Ye as s,
1126
- Ke as t,
1127
- Ee as u,
1128
- He as v,
1129
- Be as w,
1130
- je as x,
1131
- H as y,
1132
- dt as z
1156
+ Ze as n,
1157
+ Ke as o,
1158
+ Xe as p,
1159
+ E as q,
1160
+ st as r,
1161
+ Ee as s,
1162
+ Be as t,
1163
+ Et as u,
1164
+ Ot as v,
1165
+ et as w,
1166
+ He as x,
1167
+ rt as y,
1168
+ Fe as z
1133
1169
  };