@nika-js/onlymap 0.9.1 → 0.10.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 (79) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +26 -2
  3. package/dist/{basemap-DL0mk9Bf.js → basemap-9lXclX9H.js} +3882 -3980
  4. package/dist/cartograph/elements/om-frame.d.ts +67 -1
  5. package/dist/cartograph/georef.d.ts +18 -4
  6. package/dist/cartograph/schema.d.ts +11 -0
  7. package/dist/cartograph.js +1480 -1311
  8. package/dist/cartograph.standalone.js +1808 -1615
  9. package/dist/{cityjson-D_V5GY8b.js → cityjson-k-z1r6c0.js} +1 -1
  10. package/dist/{crs-DsDQ4Q4i.js → crs-BzE_KP4M.js} +25 -2
  11. package/dist/{crs-Ciu7Xs7a.js → crs-ChglCB3O.js} +39 -16
  12. package/dist/elements/om-map.d.ts +10 -0
  13. package/dist/{geoparquet-DJxZA0if.js → geoparquet-DFDZDBun.js} +10 -10
  14. package/dist/globe-view-D9wjfL0T.js +104 -0
  15. package/dist/hillshade-C2BQr6pd.js +298 -0
  16. package/dist/{hillshade-shader-n_zManfZ.js → hillshade-shader-DI2uLSNU.js} +15 -10
  17. package/dist/hillshade-shader.d.ts +18 -2
  18. package/dist/hillshade.d.ts +30 -0
  19. package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
  20. package/dist/{index-CvuDsvnk.js → index-4Tvlt0iO.js} +47 -47
  21. package/dist/{index-BjcPjICh.js → index-Bn66l3KG.js} +59 -59
  22. package/dist/index-BuXrMq5D.js +322 -0
  23. package/dist/index-CNRbZHkK.js +459 -0
  24. package/dist/{index-DdTZSuAb.js → index-CkovmN47.js} +106 -106
  25. package/dist/index-CmuOizAF.js +641 -0
  26. package/dist/index-CvT5QHBS.js +65 -0
  27. package/dist/{index-vLXZuog4.js → index-DnVHKI61.js} +1 -1
  28. package/dist/{index-oY3XHIux.js → index-JjyDEqAS.js} +18178 -16943
  29. package/dist/index.d.ts +4 -0
  30. package/dist/layer-registry.d.ts +27 -0
  31. package/dist/{lerc-Bph62dCb.js → lerc-C1mQ_Kqq.js} +1 -1
  32. package/dist/onlymap.standalone.js +48211 -45574
  33. package/dist/onlymapjs.js +77 -74
  34. package/dist/parse-manifest.d.ts +6 -0
  35. package/dist/plane-camera.d.ts +59 -0
  36. package/dist/plane-layers.d.ts +56 -0
  37. package/dist/plane-tiles.d.ts +99 -0
  38. package/dist/plane-tileset.d.ts +31 -0
  39. package/dist/plane-warp.d.ts +91 -0
  40. package/dist/post-process-effect-DfslKPM6.js +197 -0
  41. package/dist/programmatic.d.ts +16 -1
  42. package/dist/projection.d.ts +118 -0
  43. package/dist/{raster-D-eTzCE3.js → raster-D2NzdjZE.js} +4 -4
  44. package/dist/{raster-pipeline-BlOnMPJe.js → raster-pipeline-qnD1icOv.js} +4 -3
  45. package/dist/runtime-core.d.ts +140 -1
  46. package/dist/serialize/clip.d.ts +50 -0
  47. package/dist/serialize/declutter.d.ts +44 -0
  48. package/dist/serialize/emit.d.ts +60 -0
  49. package/dist/serialize/index.d.ts +64 -0
  50. package/dist/serialize/strategy.d.ts +30 -0
  51. package/dist/serialize/style.d.ts +77 -0
  52. package/dist/snapshot.d.ts +46 -0
  53. package/dist/surface-anchor.d.ts +6 -0
  54. package/dist/text-on-path-Dm7vtNqt.js +146 -0
  55. package/dist/text-on-path.d.ts +157 -0
  56. package/dist/transform/buffer.d.ts +63 -0
  57. package/dist/transform/contour.d.ts +37 -0
  58. package/dist/transform/dot-density.d.ts +19 -0
  59. package/dist/transform/field.d.ts +80 -0
  60. package/dist/transform/geometry.d.ts +20 -0
  61. package/dist/transform/index.d.ts +29 -0
  62. package/dist/transform/simplify.d.ts +10 -0
  63. package/dist/transform/smooth.d.ts +12 -0
  64. package/dist/transform-stage.d.ts +92 -0
  65. package/dist/version.d.ts +1 -1
  66. package/dist/{zarr-BGDoEtFb.js → zarr-D5e5agMG.js} +2 -2
  67. package/docs/cartograph.md +12 -4
  68. package/docs/cartography.md +328 -0
  69. package/docs/design/arrows.md +182 -0
  70. package/docs/design/carto-substrate.md +1055 -0
  71. package/docs/design/extensions.md +250 -0
  72. package/llms.txt +2 -1
  73. package/onlymapjs.attributes.json +18 -0
  74. package/onlymapjs.html-data.json +169 -19
  75. package/package.json +1 -1
  76. package/skills/onlymapjs/SKILL.md +6 -2
  77. package/skills/onlymapjs/references/syntax.md +22 -2
  78. package/dist/hillshade-DR3TxO1a.js +0 -186
  79. package/dist/index-DO_w0tqR.js +0 -514
@@ -0,0 +1,641 @@
1
+ import { aB as tt, aC as et, aD as j, at as nt, au as ot, aE as B, aF as rt, aG as U, aq as st, ar as _, aH as C, aI as it } from "./index-JjyDEqAS.js";
2
+ const J = Math.PI / 180, T = tt * J;
3
+ function Q(t, r) {
4
+ const n = Math.max(Math.cos(r * J), 1e-6);
5
+ return {
6
+ toMetres(o) {
7
+ return [(o[0] - t) * T * n, (o[1] - r) * T];
8
+ },
9
+ toLngLat(o, a) {
10
+ return [t + o / (T * n), r + a / T];
11
+ }
12
+ };
13
+ }
14
+ function O(t) {
15
+ return Array.isArray(t) && typeof t[0] == "number" && typeof t[1] == "number";
16
+ }
17
+ function D(t) {
18
+ return Array.isArray(t) && O(t[0]);
19
+ }
20
+ function K(t) {
21
+ let r = 1 / 0, n = 1 / 0, o = -1 / 0, a = -1 / 0, s = !1;
22
+ const e = (f) => {
23
+ if (Array.isArray(f)) {
24
+ if (O(f)) {
25
+ s = !0, f[0] < r && (r = f[0]), f[0] > o && (o = f[0]), f[1] < n && (n = f[1]), f[1] > a && (a = f[1]);
26
+ return;
27
+ }
28
+ for (const c of f) e(c);
29
+ }
30
+ };
31
+ return e(t), s ? [(r + o) / 2, (n + a) / 2] : null;
32
+ }
33
+ function z(t, r) {
34
+ return !Array.isArray(t) || O(t) ? t : D(t) ? r(t) : t.map((n) => z(n, r));
35
+ }
36
+ function V(t) {
37
+ if (t.length < 3) return !1;
38
+ const r = t[0], n = t[t.length - 1];
39
+ return r[0] === n[0] && r[1] === n[1];
40
+ }
41
+ function at(t, r, n, o, a, s) {
42
+ let e = n, f = o, c = a - n, i = s - o;
43
+ if (c !== 0 || i !== 0) {
44
+ const u = ((t - n) * c + (r - o) * i) / (c * c + i * i);
45
+ u > 1 ? (e = a, f = s) : u > 0 && (e += c * u, f += i * u);
46
+ }
47
+ return c = t - e, i = r - f, c * c + i * i;
48
+ }
49
+ function ct(t, r, n, o) {
50
+ if (t.length <= 2 || !(r > 0)) return t;
51
+ const a = Q(n, o), s = new Float64Array(t.length), e = new Float64Array(t.length);
52
+ for (let l = 0; l < t.length; l++) {
53
+ const [y, h] = a.toMetres(t[l]);
54
+ s[l] = y, e[l] = h;
55
+ }
56
+ const f = new Uint8Array(t.length);
57
+ f[0] = 1, f[t.length - 1] = 1;
58
+ const c = r * r, i = [0, t.length - 1];
59
+ for (; i.length > 0; ) {
60
+ const l = i.pop(), y = i.pop();
61
+ let h = 0, m = -1;
62
+ for (let d = y + 1; d < l; d++) {
63
+ const p = at(s[d], e[d], s[y], e[y], s[l], e[l]);
64
+ p > h && (h = p, m = d);
65
+ }
66
+ m >= 0 && h > c && (f[m] = 1, i.push(y, m, m, l));
67
+ }
68
+ const u = [];
69
+ for (let l = 0; l < t.length; l++) f[l] && u.push(t[l]);
70
+ return V(t) && u.length < 4 ? t : u;
71
+ }
72
+ function ut(t, r) {
73
+ const n = K(t);
74
+ return n ? z(t, (o) => ct(o, r, n[0], n[1])) : t;
75
+ }
76
+ const G = 0.25;
77
+ function ft(t, r) {
78
+ let n = t;
79
+ const o = V(t);
80
+ for (let a = 0; a < r; a++) {
81
+ const s = o ? n.slice(0, -1) : n;
82
+ if (s.length < 3) return n;
83
+ const e = [];
84
+ o || e.push(s[0]);
85
+ const f = o ? s.length : s.length - 1;
86
+ for (let c = 0; c < f; c++) {
87
+ const i = s[c], u = s[(c + 1) % s.length];
88
+ e.push(
89
+ [i[0] + (u[0] - i[0]) * G, i[1] + (u[1] - i[1]) * G],
90
+ [i[0] + (u[0] - i[0]) * (1 - G), i[1] + (u[1] - i[1]) * (1 - G)]
91
+ );
92
+ }
93
+ o ? e.push(e[0].slice()) : e.push(s[s.length - 1]), n = e;
94
+ }
95
+ return n;
96
+ }
97
+ function lt(t, r) {
98
+ return r > 0 ? z(t, (n) => ft(n, r)) : t;
99
+ }
100
+ function ht(t) {
101
+ let r = t >>> 0;
102
+ return () => {
103
+ r = r + 1831565813 >>> 0;
104
+ let n = Math.imul(r ^ r >>> 15, 1 | r);
105
+ return n = n + Math.imul(n ^ n >>> 7, 61 | n) ^ n, ((n ^ n >>> 14) >>> 0) / 4294967296;
106
+ };
107
+ }
108
+ function mt(t) {
109
+ const r = [], n = (o) => {
110
+ if (Array.isArray(o) && !D(o)) {
111
+ if (D(o[0])) {
112
+ r.push(o);
113
+ return;
114
+ }
115
+ for (const a of o) n(a);
116
+ }
117
+ };
118
+ return n(t), r;
119
+ }
120
+ function dt(t, r, n) {
121
+ if (!j(t[0], r, n)) return !1;
122
+ for (let o = 1; o < t.length; o++) if (j(t[o], r, n)) return !1;
123
+ return !0;
124
+ }
125
+ function pt(t, r, n) {
126
+ const o = t, a = o.geometry?.coordinates;
127
+ if (a == null) return [];
128
+ const s = o.properties?.[n.field], e = typeof s == "number" ? s : Number(s);
129
+ if (!Number.isFinite(e) || e <= 0 || !(n.per > 0)) return [];
130
+ const f = mt(a);
131
+ if (f.length === 0) return [];
132
+ const c = Math.min(Math.round(e / n.per), n.maxPerFeature);
133
+ if (c <= 0) return [];
134
+ const i = f.map((h) => Math.abs(et(h[0]))), u = i.reduce((h, m) => h + m, 0);
135
+ if (!(u > 0)) return [];
136
+ const l = ht((n.seed ^ r * 2654435761) >>> 0), y = [];
137
+ for (let h = 0; h < f.length; h++) {
138
+ const m = h === f.length - 1 ? c - y.length : Math.round(c * i[h] / u);
139
+ if (m <= 0) continue;
140
+ const d = f[h];
141
+ let p = 1 / 0, M = 1 / 0, F = -1 / 0, w = -1 / 0;
142
+ for (const g of d[0])
143
+ g[0] < p && (p = g[0]), g[0] > F && (F = g[0]), g[1] < M && (M = g[1]), g[1] > w && (w = g[1]);
144
+ const N = m * 200 + 1e3;
145
+ let k = 0;
146
+ for (let g = 0; g < N && k < m; g++) {
147
+ const b = p + (F - p) * l(), A = M + (w - M) * l();
148
+ dt(d, b, A) && (k++, y.push({
149
+ type: "Feature",
150
+ geometry: { type: "Point", coordinates: [b, A] },
151
+ properties: { ...o.properties }
152
+ }));
153
+ }
154
+ }
155
+ return y;
156
+ }
157
+ function yt(t, r) {
158
+ const n = [];
159
+ for (let o = 0; o < t.length; o++) n.push(...pt(t[o], o, r));
160
+ return n;
161
+ }
162
+ const $ = 1e20;
163
+ function gt(t, r) {
164
+ const n = new Uint8Array(r.width * r.height);
165
+ if (t.length === 0) return n;
166
+ const o = new Array(r.height), a = [], s = [], e = [], f = [];
167
+ for (const i of t)
168
+ for (let u = 0, l = i.length - 1; u < i.length; l = u++) {
169
+ const y = i[l][1], h = i[u][1];
170
+ if (y === h) continue;
171
+ const m = a.length;
172
+ a.push(i[l][0]), s.push(y), e.push(i[u][0]), f.push(h);
173
+ const d = Math.max(0, Math.ceil((Math.min(y, h) - r.originY) / r.cell)), p = Math.min(r.height - 1, Math.floor((Math.max(y, h) - r.originY) / r.cell));
174
+ for (let M = d; M <= p; M++) (o[M] ??= []).push(m);
175
+ }
176
+ const c = [];
177
+ for (let i = 0; i < r.height; i++) {
178
+ const u = o[i];
179
+ if (!u || u.length < 2) continue;
180
+ const l = r.originY + i * r.cell;
181
+ c.length = 0;
182
+ for (const h of u)
183
+ s[h] > l != f[h] > l && c.push(a[h] + (l - s[h]) * (e[h] - a[h]) / (f[h] - s[h]));
184
+ if (c.length < 2) continue;
185
+ c.sort((h, m) => h - m);
186
+ const y = i * r.width;
187
+ for (let h = 0; h + 1 < c.length; h += 2) {
188
+ const m = Math.max(0, Math.ceil((c[h] - r.originX) / r.cell)), d = Math.min(r.width - 1, Math.floor((c[h + 1] - r.originX) / r.cell));
189
+ for (let p = m; p <= d; p++) n[y + p] = 1;
190
+ }
191
+ }
192
+ return n;
193
+ }
194
+ function L(t, r, n, o, a) {
195
+ let s = 0;
196
+ o[0] = 0, a[0] = -$, a[1] = $;
197
+ for (let e = 1; e < r; e++) {
198
+ let f = (t[e] + e * e - (t[o[s]] + o[s] * o[s])) / (2 * e - 2 * o[s]);
199
+ for (; f <= a[s]; )
200
+ s--, f = (t[e] + e * e - (t[o[s]] + o[s] * o[s])) / (2 * e - 2 * o[s]);
201
+ s++, o[s] = e, a[s] = f, a[s + 1] = $;
202
+ }
203
+ s = 0;
204
+ for (let e = 0; e < r; e++) {
205
+ for (; a[s + 1] < e; ) s++;
206
+ const f = e - o[s];
207
+ n[e] = f * f + t[o[s]];
208
+ }
209
+ }
210
+ function W(t, r, n) {
211
+ const o = new Float64Array(r * n);
212
+ for (let i = 0; i < o.length; i++) o[i] = t[i] ? 0 : $;
213
+ const a = Math.max(r, n), s = new Float64Array(a), e = new Float64Array(a), f = new Int32Array(a), c = new Float64Array(a + 1);
214
+ for (let i = 0; i < r; i++) {
215
+ for (let u = 0; u < n; u++) s[u] = o[u * r + i];
216
+ L(s, n, e, f, c);
217
+ for (let u = 0; u < n; u++) o[u * r + i] = e[u];
218
+ }
219
+ for (let i = 0; i < n; i++) {
220
+ const u = i * r;
221
+ for (let l = 0; l < r; l++) s[l] = o[u + l];
222
+ L(s, r, e, f, c);
223
+ for (let l = 0; l < r; l++) o[u + l] = Math.sqrt(e[l]);
224
+ }
225
+ return o;
226
+ }
227
+ function bt(t, r) {
228
+ const n = gt(t, r), { width: o, height: a } = r, s = new Uint8Array(n.length);
229
+ for (let i = 0; i < n.length; i++) s[i] = n[i] ? 0 : 1;
230
+ const e = W(n, o, a), f = W(s, o, a), c = new Float64Array(n.length);
231
+ for (let i = 0; i < c.length; i++) {
232
+ const u = e[i] - f[i], l = Math.sign(u) * Math.max(0, Math.abs(u) - 0.5);
233
+ c[i] = l * r.cell;
234
+ }
235
+ return c;
236
+ }
237
+ function Y(t, r, n) {
238
+ const o = r - t;
239
+ return o === 0 ? 0.5 : (n - t) / o;
240
+ }
241
+ function Z(t, r, n, o) {
242
+ const { width: a, height: s, cell: e, originX: f, originY: c } = r, i = [], u = (m, d) => t[d * a + m], l = (m, d) => o === void 0 || o[d * a + m] === 1 && o[d * a + m + 1] === 1 && o[(d + 1) * a + m] === 1 && o[(d + 1) * a + m + 1] === 1, y = (m) => f + m * e, h = (m) => c + m * e;
243
+ for (let m = 0; m + 1 < s; m++)
244
+ for (let d = 0; d + 1 < a; d++) {
245
+ if (!l(d, m)) continue;
246
+ const p = u(d, m), M = u(d + 1, m), F = u(d + 1, m + 1), w = u(d, m + 1), N = (p < n ? 8 : 0) | (M < n ? 4 : 0) | (F < n ? 2 : 0) | (w < n ? 1 : 0);
247
+ if (N === 0 || N === 15) continue;
248
+ const k = [y(d) + Y(p, M, n) * e, h(m)], g = [y(d + 1), h(m) + Y(M, F, n) * e], b = [y(d) + Y(w, F, n) * e, h(m + 1)], A = [y(d), h(m) + Y(p, w, n) * e], x = (P, R) => {
249
+ i.push([P[0], P[1], R[0], R[1]]);
250
+ };
251
+ switch (N) {
252
+ case 1:
253
+ x(A, b);
254
+ break;
255
+ case 2:
256
+ x(b, g);
257
+ break;
258
+ case 3:
259
+ x(A, g);
260
+ break;
261
+ case 4:
262
+ x(k, g);
263
+ break;
264
+ case 6:
265
+ x(k, b);
266
+ break;
267
+ case 7:
268
+ x(A, k);
269
+ break;
270
+ case 8:
271
+ x(k, A);
272
+ break;
273
+ case 9:
274
+ x(k, b);
275
+ break;
276
+ case 11:
277
+ x(k, g);
278
+ break;
279
+ case 12:
280
+ x(A, g);
281
+ break;
282
+ case 13:
283
+ x(b, g);
284
+ break;
285
+ case 14:
286
+ x(A, b);
287
+ break;
288
+ // The two ambiguous cases. The cell's mean decides which way the
289
+ // contour turns; guessing produces a contour that crosses itself,
290
+ // which on a vignette looks like a printing fault.
291
+ case 5:
292
+ (p + M + F + w) / 4 < n ? (x(A, k), x(b, g)) : (x(A, b), x(k, g));
293
+ break;
294
+ case 10:
295
+ (p + M + F + w) / 4 < n ? (x(k, g), x(b, A)) : (x(k, A), x(b, g));
296
+ break;
297
+ }
298
+ }
299
+ return Mt(i, e);
300
+ }
301
+ function Mt(t, r) {
302
+ if (t.length === 0) return [];
303
+ const n = r * 1e-6, o = (c, i) => `${Math.round(c / n)},${Math.round(i / n)}`, a = /* @__PURE__ */ new Map(), s = (c, i) => {
304
+ const u = a.get(c);
305
+ u ? u.push(i) : a.set(c, [i]);
306
+ };
307
+ for (let c = 0; c < t.length; c++)
308
+ s(o(t[c][0], t[c][1]), c), s(o(t[c][2], t[c][3]), c);
309
+ const e = new Uint8Array(t.length), f = [];
310
+ for (let c = 0; c < t.length; c++) {
311
+ if (e[c]) continue;
312
+ e[c] = 1;
313
+ const [i, u, l, y] = t[c], h = [[i, u], [l, y]], m = (d, p, M) => {
314
+ let F = d, w = p;
315
+ for (let N = 0; N < t.length; N++) {
316
+ const g = a.get(o(F, w))?.find((x) => !e[x]);
317
+ if (g === void 0) return;
318
+ e[g] = 1;
319
+ const b = t[g], A = o(b[0], b[1]) === o(F, w);
320
+ F = A ? b[2] : b[0], w = A ? b[3] : b[1], M([F, w]);
321
+ }
322
+ };
323
+ m(l, y, (d) => h.push(d)), m(i, u, (d) => h.unshift(d)), h.length >= 4 && f.push(h);
324
+ }
325
+ return f;
326
+ }
327
+ function xt(t, r, n) {
328
+ let o = 1 / 0, a = 1 / 0, s = -1 / 0, e = -1 / 0;
329
+ for (const i of t)
330
+ for (const [u, l] of i)
331
+ u < o && (o = u), u > s && (s = u), l < a && (a = l), l > e && (e = l);
332
+ if (!Number.isFinite(o) || !(r > 0)) return null;
333
+ const f = o - n, c = a - n;
334
+ return {
335
+ originX: f,
336
+ originY: c,
337
+ cell: r,
338
+ width: Math.max(2, Math.ceil((s - o + 2 * n) / r) + 1),
339
+ height: Math.max(2, Math.ceil((e - a + 2 * n) / r) + 1)
340
+ };
341
+ }
342
+ const kt = 4e6, wt = /* @__PURE__ */ new Set(["Polygon", "MultiPolygon"]);
343
+ function At(t) {
344
+ return typeof t == "string" && wt.has(t);
345
+ }
346
+ function Ft(t) {
347
+ const r = [], n = (o) => {
348
+ if (Array.isArray(o)) {
349
+ if (D(o)) {
350
+ const a = o, s = a[0], e = a[a.length - 1], f = a.length > 2 && s[0] === e[0] && s[1] === e[1];
351
+ r.push(f ? a : [...a, [s[0], s[1]]]);
352
+ return;
353
+ }
354
+ for (const a of o) n(a);
355
+ }
356
+ };
357
+ return n(t), r;
358
+ }
359
+ function St(t, r) {
360
+ const n = Ft(t);
361
+ if (n.length === 0) return [];
362
+ const o = K(t);
363
+ if (!o) return [];
364
+ const a = Q(o[0], o[1]), s = n.map((m) => m.map((d) => a.toMetres(d))), e = Math.abs(r.distanceMetres);
365
+ if (!(e > 0)) return [];
366
+ const f = Math.max(1, Math.round(r.repeat)), c = e * f, i = e / Math.max(1, r.cellsPerBand), u = xt(s, i, c + i * 4);
367
+ if (!u) return [];
368
+ if (u.width * u.height > r.maxCells) return [];
369
+ const l = bt(s, u), y = r.distanceMetres < 0 ? -1 : 1, h = [];
370
+ for (let m = 1; m <= f; m++) {
371
+ const d = y * e * m, p = Z(l, u, d);
372
+ p.length !== 0 && h.push({
373
+ rings: p.map((M) => M.map(([F, w]) => a.toLngLat(F, w))),
374
+ band: m
375
+ });
376
+ }
377
+ return h;
378
+ }
379
+ function Nt(t, r, n) {
380
+ const o = [];
381
+ for (const a of t) {
382
+ const s = a, e = s.geometry?.coordinates;
383
+ if (e != null) {
384
+ if (!At(s.geometry?.type)) {
385
+ n?.(String(s.geometry?.type ?? "unknown"));
386
+ continue;
387
+ }
388
+ for (const { rings: f, band: c } of St(e, r)) {
389
+ const i = Math.max(1, Math.round(r.repeat));
390
+ o.push({
391
+ band: c,
392
+ feature: {
393
+ type: "Feature",
394
+ geometry: { type: "MultiPolygon", coordinates: f.map((u) => [u]) },
395
+ properties: {
396
+ ...s.properties,
397
+ _band: c,
398
+ // Linear from just under 1 to just over 0 — never exactly 0, which
399
+ // would emit an invisible band an author cannot see to remove.
400
+ _bandOpacity: r.fade ? Math.max(0.05, 1 - (c - 1) / i) : 1
401
+ }
402
+ }
403
+ });
404
+ }
405
+ }
406
+ }
407
+ return o.sort((a, s) => s.band - a.band), o.map((a) => a.feature);
408
+ }
409
+ const I = 256;
410
+ function It(t) {
411
+ return Math.atan(Math.sinh(Math.PI * (1 - 2 * t))) * 180 / Math.PI;
412
+ }
413
+ async function Pt(t) {
414
+ const [r, n, o, a] = t.bounds, s = Math.max(0, Math.round(t.zoom)), e = B(r, a, s), f = B(o, n, s), c = Math.min(e.x, f.x), i = Math.max(e.x, f.x), u = Math.min(e.y, f.y), l = Math.max(e.y, f.y), y = (i - c + 1) * (l - u + 1);
415
+ if (y <= 0 || y > t.maxTiles) return null;
416
+ const h = (i - c + 1) * I, m = (l - u + 1) * I, d = new Float32Array(h * m), p = new Uint8Array(h * m), M = await Promise.all(
417
+ Array.from({ length: y }, (k, g) => {
418
+ const b = c + g % (i - c + 1), A = u + Math.floor(g / (i - c + 1)), x = t.template.replace("{z}", String(s)).replace("{x}", String(b)).replace("{y}", String(A));
419
+ return nt(x).then((P) => ({ tx: b, ty: A, pixels: P }));
420
+ })
421
+ );
422
+ if (M.every((k) => k.pixels == null)) return null;
423
+ for (const { tx: k, ty: g, pixels: b } of M) {
424
+ if (!b) continue;
425
+ const A = (k - c) * I, x = (g - u) * I, P = Math.min(I, b.height), R = Math.min(I, b.width);
426
+ for (let E = 0; E < P; E++)
427
+ for (let v = 0; v < R; v++) {
428
+ const X = (E * b.width + v) * 4, q = (x + E) * h + A + v;
429
+ d[q] = ot(t.decoder, b.data[X], b.data[X + 1], b.data[X + 2]), p[q] = 1;
430
+ }
431
+ }
432
+ const F = { width: h, height: m, cell: 1, originX: 0, originY: 0 }, w = 2 ** s;
433
+ return { heights: d, covered: p, grid: F, toLngLat: (k, g) => [
434
+ (c * I + k) / (w * I) * 360 - 180,
435
+ It((u * I + g) / (w * I))
436
+ ] };
437
+ }
438
+ async function Rt(t) {
439
+ const r = await Pt(t);
440
+ if (!r) return [];
441
+ const { heights: n, covered: o, grid: a, toLngLat: s } = r;
442
+ let e = 1 / 0, f = -1 / 0;
443
+ for (let p = 0; p < n.length; p++)
444
+ o[p] && (n[p] < e && (e = n[p]), n[p] > f && (f = n[p]));
445
+ const c = t.intervalMetres;
446
+ if (!(c > 0) || !Number.isFinite(e) || f <= e) return [];
447
+ const [i, u, l, y] = t.bounds, h = ([p, M]) => p >= i && p <= l && M >= u && M <= y, m = [], d = Math.ceil(e / c) * c;
448
+ for (let p = d, M = 0; p <= f && M < 400; p += c, M++)
449
+ for (const F of Z(n, a, p, o)) {
450
+ const w = F.map(([N, k]) => s(N, k));
451
+ w.some(h) && m.push({
452
+ type: "Feature",
453
+ geometry: { type: "LineString", coordinates: w },
454
+ properties: {
455
+ elevation: p,
456
+ // The cartographer's index contour — every fifth line drawn heavier.
457
+ index: Math.round(p / c) % 5 === 0
458
+ }
459
+ });
460
+ }
461
+ return m;
462
+ }
463
+ const Et = /* @__PURE__ */ new Set(["LineString", "MultiLineString", "Polygon", "MultiPolygon"]);
464
+ function H(t, r, n) {
465
+ return t.map((o) => {
466
+ const s = o.geometry;
467
+ if (!s || s.coordinates == null) return o;
468
+ if (!Et.has(String(s.type)))
469
+ return String(s.type) !== "Point" && n?.(String(s.type ?? "unknown")), o;
470
+ const e = r(s.coordinates);
471
+ return e === s.coordinates ? o : { ...o, geometry: { ...s, coordinates: e } };
472
+ });
473
+ }
474
+ function vt(t) {
475
+ if (!t) return null;
476
+ const r = t.trim().replace(/^\[|\]$/g, "").split(/[\s,]+/).map(Number);
477
+ if (r.length !== 4 || !r.every((e) => Number.isFinite(e))) return null;
478
+ const [n, o, a, s] = r;
479
+ return a <= n || s <= o ? null : [n, o, a, s];
480
+ }
481
+ function S(t, r, n) {
482
+ console.error(`[onlymapjs] ${t} ${r} ${n}`);
483
+ }
484
+ async function Gt(t, r, n, o, a) {
485
+ if (r !== "geojson" && !rt(n))
486
+ return S(a, "<om-transform> needs GeoJSON geometry; this layer's rows are flat.", "Load the source as GeoJSON, or remove the transform."), t;
487
+ let s = t;
488
+ for (const e of n)
489
+ switch (e.type) {
490
+ case "simplify": {
491
+ const f = U(e.params.tolerance);
492
+ if (!f) {
493
+ S(a, '<om-transform type="simplify"> needs a tolerance with a unit.', 'Write tolerance="0.15mm" (paper) or tolerance="50m" (ground).');
494
+ break;
495
+ }
496
+ const c = C(f, o);
497
+ if (c == null) {
498
+ S(a, '<om-transform type="simplify"> has a tolerance in millimetres but this map declares no reference scale.', 'Add reference-scale="1:50000" to <om-map>, or author the tolerance in ground units (tolerance="50m").');
499
+ break;
500
+ }
501
+ {
502
+ const i = /* @__PURE__ */ new Set();
503
+ s = H(s, (u) => ut(u, c), (u) => i.add(u)), i.size > 0 && S(
504
+ a,
505
+ `<om-transform type="simplify"> left ${[...i].join("/")} geometry untouched — there is no path to thin.`,
506
+ "Simplify lines and polygons. A scatter of points has no redundant vertices, and thinning it would delete data."
507
+ );
508
+ }
509
+ break;
510
+ }
511
+ case "smooth": {
512
+ const f = e.params.iterations === void 0 ? 1 : Number(e.params.iterations);
513
+ if (!Number.isFinite(f) || f < 0 || f > 6) {
514
+ S(a, `<om-transform type="smooth"> iterations="${e.params.iterations}" is out of range.`, "Use 0-6; each iteration doubles the vertex count, and past 3 the shape stops being the shape.");
515
+ break;
516
+ }
517
+ {
518
+ const c = /* @__PURE__ */ new Set();
519
+ s = H(s, (i) => lt(i, Math.round(f)), (i) => c.add(i)), c.size > 0 && S(
520
+ a,
521
+ `<om-transform type="smooth"> left ${[...c].join("/")} geometry untouched — there is no path to round.`,
522
+ "Smooth lines and polygons. Rounding a scatter of points would replace every one of them with a location that is not in the data."
523
+ );
524
+ }
525
+ break;
526
+ }
527
+ case "dot-density": {
528
+ const f = e.params.field, c = Number(e.params.per);
529
+ if (!f || !Number.isFinite(c) || c <= 0) {
530
+ S(a, '<om-transform type="dot-density"> needs field= and a positive per=.', 'Write field="population" per="1000" — one dot per thousand people.');
531
+ break;
532
+ }
533
+ const i = e.params.seed === void 0 ? 24301 : Number(e.params.seed), u = e.params.max === void 0 ? 2e4 : Number(e.params.max);
534
+ s = yt(s, {
535
+ field: f,
536
+ per: c,
537
+ seed: Number.isFinite(i) ? i : 24301,
538
+ maxPerFeature: Number.isFinite(u) && u > 0 ? u : 2e4
539
+ });
540
+ break;
541
+ }
542
+ case "buffer": {
543
+ const f = U(e.params.distance);
544
+ if (!f) {
545
+ S(a, '<om-transform type="buffer"> needs a distance with a unit.', 'Write distance="1.2mm" (paper) or distance="500m" (ground).');
546
+ break;
547
+ }
548
+ const c = C(f, o);
549
+ if (c == null) {
550
+ S(a, '<om-transform type="buffer"> has a distance in millimetres but this map declares no reference scale.', 'Add reference-scale="1:50000" to <om-map>, or author the distance in ground units (distance="500m").');
551
+ break;
552
+ }
553
+ const i = e.params.repeat === void 0 ? 1 : Number(e.params.repeat);
554
+ if (!Number.isFinite(i) || i < 1 || i > 12) {
555
+ S(a, `<om-transform type="buffer"> repeat="${e.params.repeat}" is out of range.`, "Use 1-12. Each band is another threshold of one distance field, but twelve rings of ornament is a pattern, not a vignette.");
556
+ break;
557
+ }
558
+ const u = e.params.quality === void 0 ? 8 : Number(e.params.quality), l = /* @__PURE__ */ new Set(), y = Nt(s, {
559
+ distanceMetres: c,
560
+ repeat: Math.round(i),
561
+ fade: e.params.fade !== void 0 && e.params.fade !== "false",
562
+ cellsPerBand: Number.isFinite(u) && u >= 2 ? Math.min(32, u) : 8,
563
+ maxCells: kt
564
+ }, (h) => l.add(h));
565
+ if (l.size > 0 && S(
566
+ a,
567
+ `<om-transform type="buffer"> skipped ${[...l].join("/")} geometry — a buffer needs a surface, and a line's coordinates would be filled as though its ends joined.`,
568
+ 'Buffer polygons. For a corridor along a line, widen the line itself (line-width-units="meters"), or build the corridor in your own pipeline and load it as data.'
569
+ ), y.length === 0) {
570
+ S(
571
+ a,
572
+ `<om-transform type="buffer"> produced nothing — the distance is probably too small for the feature's extent.`,
573
+ "A band needs a grid a few cells wider than the feature; try a larger distance, or a lower quality= if the grid hit its ceiling."
574
+ );
575
+ break;
576
+ }
577
+ s = y;
578
+ break;
579
+ }
580
+ case "contour": {
581
+ const f = e.params.src, c = vt(e.params.bounds), i = U(e.params.interval);
582
+ if (!f || !c || !i) {
583
+ S(
584
+ a,
585
+ '<om-transform type="contour"> needs src=, bounds= and interval=.',
586
+ 'Write src="terrarium" bounds="[west,south,east,north]" interval="100m" — the extent is declared because a transform runs once at ingest, not per frame.'
587
+ );
588
+ break;
589
+ }
590
+ if (i.unit !== "m") {
591
+ S(a, '<om-transform type="contour"> interval must be a ground height, not paper millimetres.', 'Write interval="100m" — a contour interval is an elevation, and elevations are not on the page.');
592
+ break;
593
+ }
594
+ const u = st(f), l = u?.elevationData ?? f;
595
+ if (!l.includes("{z}")) {
596
+ S(a, `<om-transform type="contour"> src="${f}" is neither a terrain preset nor a {z}/{x}/{y} template.`, 'Use src="terrarium", or a raw tile URL plus decoder=.');
597
+ break;
598
+ }
599
+ const y = e.params.decoder ?? (typeof u?.decoder == "string" ? u.decoder : void 0), h = y && y in _ ? _[y] : u?.decoder ?? _.terrarium, m = e.params.zoom === void 0 ? 10 : Number(e.params.zoom), d = await Rt({
600
+ template: l,
601
+ decoder: h,
602
+ zoom: Number.isFinite(m) ? m : 10,
603
+ bounds: c,
604
+ intervalMetres: i.value,
605
+ maxTiles: 64
606
+ });
607
+ if (d.length === 0) {
608
+ S(a, '<om-transform type="contour"> produced no lines.', "Check the bounds cover land, the interval is not larger than the relief, and the tile source is reachable.");
609
+ break;
610
+ }
611
+ s = d;
612
+ break;
613
+ }
614
+ default:
615
+ S(a, `<om-transform type="${e.type}"> is not a transform type.`, `Use one of: ${it.join(", ")}.`);
616
+ }
617
+ return s;
618
+ }
619
+ export {
620
+ it as TRANSFORM_TYPES,
621
+ Pt as assembleHeightGrid,
622
+ St as bufferGeometry,
623
+ Nt as bufferRows,
624
+ ft as chaikinRing,
625
+ Rt as contourFromDem,
626
+ K as coordinateCentre,
627
+ W as distanceTransform,
628
+ xt as gridFor,
629
+ z as mapRings,
630
+ Z as marchingSquares,
631
+ Q as metricFrame,
632
+ vt as parseBounds,
633
+ gt as rasterizeRings,
634
+ Gt as runTransforms,
635
+ pt as scatterFeature,
636
+ yt as scatterRows,
637
+ bt as signedDistanceField,
638
+ ut as simplifyGeometry,
639
+ ct as simplifyRing,
640
+ lt as smoothGeometry
641
+ };
@@ -0,0 +1,65 @@
1
+ import { A as t, a as o, b as i, C as l, c as p, d as n, D as _, e as c, f as g, F as h, L as m, g as L, h as y, i as f, j as w, M as S, k as V, O as b, l as C, m as E, P as I, T as P, n as T, o as M, U as d, V as A, p as O, q as u, W as N, r as k, s as x, t as D, u as G, G as R, v as j, w as W, x as q, y as v, z, B as F, E as U, H as Y, I as B, J as H, K as J, N as K, Q, R as X, S as Z, X as $, Y as aa, Z as sa, _ as ea, $ as ra, a0 as ta, a1 as oa, a2 as ia } from "./index-JjyDEqAS.js";
2
+ import { P as s } from "./post-process-effect-DfslKPM6.js";
3
+ import { G as pa, a as na } from "./globe-view-D9wjfL0T.js";
4
+ export {
5
+ t as AmbientLight,
6
+ o as Attribute,
7
+ i as AttributeManager,
8
+ l as COORDINATE_SYSTEM,
9
+ p as CompositeLayer,
10
+ n as Controller,
11
+ _ as Deck,
12
+ c as DeckRenderer,
13
+ g as DirectionalLight,
14
+ h as FlyToInterpolator,
15
+ m as Layer,
16
+ L as LayerExtension,
17
+ y as LayerManager,
18
+ f as LightingEffect,
19
+ w as LinearInterpolator,
20
+ S as MapController,
21
+ V as MapView,
22
+ b as OrthographicController,
23
+ C as OrthographicView,
24
+ E as OrthographicViewport,
25
+ I as PointLight,
26
+ s as PostProcessEffect,
27
+ P as TRANSITION_EVENTS,
28
+ T as Tesselator,
29
+ M as TransitionInterpolator,
30
+ d as UNIT,
31
+ A as VERSION,
32
+ O as View,
33
+ u as Viewport,
34
+ N as WebMercatorViewport,
35
+ k as Widget,
36
+ x as _CameraLight,
37
+ D as _Component,
38
+ G as _ComponentState,
39
+ pa as _GlobeController,
40
+ na as _GlobeView,
41
+ R as _GlobeViewport,
42
+ j as _LayersPass,
43
+ W as _PickLayersPass,
44
+ q as _applyStyles,
45
+ v as _compareProps,
46
+ z as _count,
47
+ F as _deepEqual,
48
+ U as _fillArray,
49
+ Y as _flatten,
50
+ B as _memoize,
51
+ H as _mergeShaders,
52
+ J as _removeStyles,
53
+ K as assert,
54
+ Q as color,
55
+ X as createIterable,
56
+ Z as fp64LowPart,
57
+ $ as getShaderAssembler,
58
+ aa as gouraudMaterial,
59
+ sa as log,
60
+ ea as phongMaterial,
61
+ ra as picking,
62
+ ta as project,
63
+ oa as project32,
64
+ ia as shadow
65
+ };