@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,459 @@
1
+ import { aA as B } from "./index-JjyDEqAS.js";
2
+ const V = /* @__PURE__ */ new Set([
3
+ "GeoJsonLayer",
4
+ "PolygonLayer",
5
+ "SolidPolygonLayer",
6
+ "PathLayer",
7
+ "LineLayer",
8
+ "ScatterplotLayer",
9
+ "PointCloudLayer",
10
+ "ArcLayer",
11
+ "TripsLayer",
12
+ "Route",
13
+ "Tracking"
14
+ ]), Z = /* @__PURE__ */ new Set(["TextLayer"]), q = /* @__PURE__ */ new Set(["TextOnPathLayer"]), J = /* @__PURE__ */ new Set([
15
+ "COGLayer",
16
+ "ZarrLayer",
17
+ "BitmapLayer",
18
+ "ImageOverlay",
19
+ "TileLayer",
20
+ "MVTLayer",
21
+ "HillshadeLayer",
22
+ "Tile3DLayer",
23
+ "BIMLayer",
24
+ "ScenegraphLayer",
25
+ "SimpleMeshLayer",
26
+ "TerrainLayer",
27
+ "HeatmapLayer",
28
+ "HexagonLayer",
29
+ "GridLayer",
30
+ "ContourLayer",
31
+ "ScreenGridLayer"
32
+ ]);
33
+ function ot(t) {
34
+ return q.has(t) ? "path-text" : Z.has(t) ? "text" : V.has(t) ? "vector" : (J.has(t), "raster");
35
+ }
36
+ function rt(t) {
37
+ return V.has(t) || Z.has(t) || q.has(t) || J.has(t);
38
+ }
39
+ function it(t) {
40
+ const e = [];
41
+ for (const o of t) {
42
+ const r = ot(o.type), n = e[e.length - 1];
43
+ n && n.strategy === "raster" && r === "raster" ? n.ids.push(o.id) : e.push({ strategy: r, ids: [o.id] });
44
+ }
45
+ return e;
46
+ }
47
+ function W(t, e) {
48
+ return e[0] >= t.left && e[0] <= t.right && e[1] >= t.top && e[1] <= t.bottom;
49
+ }
50
+ function Q(t, e) {
51
+ let o = 1 / 0, r = 1 / 0, n = -1 / 0, i = -1 / 0;
52
+ for (const [s, c] of t)
53
+ s < o && (o = s), s > n && (n = s), c < r && (r = c), c > i && (i = c);
54
+ return n < e.left || o > e.right || i < e.top || r > e.bottom;
55
+ }
56
+ function st(t, e, o) {
57
+ const r = e[0] - t[0], n = e[1] - t[1];
58
+ let i = 0, s = 1;
59
+ const c = (f, u) => {
60
+ if (f === 0) return u >= 0;
61
+ const p = u / f;
62
+ if (f < 0) {
63
+ if (p > s) return !1;
64
+ p > i && (i = p);
65
+ } else {
66
+ if (p < i) return !1;
67
+ p < s && (s = p);
68
+ }
69
+ return !0;
70
+ };
71
+ return !c(-r, t[0] - o.left) || !c(r, o.right - t[0]) || !c(-n, t[1] - o.top) || !c(n, o.bottom - t[1]) ? null : [
72
+ [t[0] + i * r, t[1] + i * n],
73
+ [t[0] + s * r, t[1] + s * n]
74
+ ];
75
+ }
76
+ function tt(t, e) {
77
+ if (t.length < 2) return W(e, t[0] ?? [NaN, NaN]) ? [[...t]] : [];
78
+ if (Q(t, e)) return [];
79
+ const o = [];
80
+ let r = null;
81
+ for (let n = 0; n + 1 < t.length; n++) {
82
+ const i = st(t[n], t[n + 1], e);
83
+ if (!i) {
84
+ r = null;
85
+ continue;
86
+ }
87
+ const [s, c] = i;
88
+ r && r[r.length - 1][0] === s[0] && r[r.length - 1][1] === s[1] ? r.push(c) : (r = [s, c], o.push(r));
89
+ }
90
+ return o;
91
+ }
92
+ function H(t, e, o) {
93
+ switch (o) {
94
+ case "left":
95
+ return t[0] >= e.left;
96
+ case "right":
97
+ return t[0] <= e.right;
98
+ case "top":
99
+ return t[1] >= e.top;
100
+ case "bottom":
101
+ return t[1] <= e.bottom;
102
+ }
103
+ }
104
+ function X(t, e, o, r) {
105
+ const n = e[0] - t[0], i = e[1] - t[1];
106
+ switch (r) {
107
+ case "left":
108
+ return [o.left, t[1] + i * (o.left - t[0]) / n];
109
+ case "right":
110
+ return [o.right, t[1] + i * (o.right - t[0]) / n];
111
+ case "top":
112
+ return [t[0] + n * (o.top - t[1]) / i, o.top];
113
+ case "bottom":
114
+ return [t[0] + n * (o.bottom - t[1]) / i, o.bottom];
115
+ }
116
+ }
117
+ function at(t, e) {
118
+ if (t.length < 3) return [];
119
+ if (Q(t, e)) return [];
120
+ let o = t;
121
+ for (const r of ["left", "right", "top", "bottom"]) {
122
+ const n = o;
123
+ if (o = [], n.length === 0) return [];
124
+ let i = n[n.length - 1];
125
+ for (let s = 0; s < n.length; s++) {
126
+ const c = n[s], f = H(c, e, r), u = H(i, e, r);
127
+ f ? (u || o.push(X(i, c, e, r)), o.push(c)) : u && o.push(X(i, c, e, r)), i = c;
128
+ }
129
+ }
130
+ return o;
131
+ }
132
+ const Y = (t) => Math.max(0, Math.min(255, Math.round(t)));
133
+ function E(t) {
134
+ if (!Array.isArray(t) || t.length < 3) return { color: "#000000", opacity: 1 };
135
+ const [e, o, r, n] = t, i = (s) => Y(s).toString(16).padStart(2, "0");
136
+ return {
137
+ color: `#${i(e)}${i(o)}${i(r)}`,
138
+ // deck's alpha DEFAULT is 255, not 0 — an absent fourth component means
139
+ // opaque. Reading it as zero would emit a whole invisible sheet.
140
+ opacity: n === void 0 ? 1 : Y(n) / 255
141
+ };
142
+ }
143
+ function D(t, e, o, r, n) {
144
+ if (typeof t == "function")
145
+ try {
146
+ return t(e, { index: o, data: r });
147
+ } catch {
148
+ return n;
149
+ }
150
+ return t === void 0 ? n : t;
151
+ }
152
+ const L = (t, e) => typeof t == "number" && Number.isFinite(t) ? t : e, ct = ["getLineColor", "getColor", "getSourceColor"], lt = ["getLineWidth", "getWidth"], ut = ["lineWidthScale", "widthScale"], ft = ["lineWidthUnits", "widthUnits"], dt = ["lineWidthMinPixels", "widthMinPixels"], ht = ["lineWidthMaxPixels", "widthMaxPixels"], pt = ["getRadius", "getPointRadius"], gt = ["radiusScale", "pointRadiusScale"], mt = ["radiusUnits", "pointRadiusUnits"], yt = ["radiusMinPixels", "pointRadiusMinPixels"], xt = ["radiusMaxPixels", "pointRadiusMaxPixels"];
153
+ function $(t, e) {
154
+ for (const o of e) if (t[o] !== void 0) return t[o];
155
+ }
156
+ function $t(t, e, o, r) {
157
+ const n = t.props, i = L(D($(n, lt), e, o, t.data, 1), 1), s = L($(n, ut), 1);
158
+ let u = ($(n, ft) === "meters" ? "meters" : "pixels") === "meters" ? i * s / Math.max(r, 1e-9) : i * s;
159
+ u = Math.max(u, L($(n, dt), 0));
160
+ const p = $(n, ht);
161
+ return typeof p == "number" && Number.isFinite(p) && (u = Math.min(u, p)), u;
162
+ }
163
+ function Pt(t, e, o, r) {
164
+ const n = t.props, i = L(D($(n, pt), e, o, t.data, 1), 1), s = L($(n, gt), 1);
165
+ let f = ($(n, mt) === "pixels" ? "pixels" : "meters") === "pixels" ? i * s : i * s / Math.max(r, 1e-9);
166
+ f = Math.max(f, L($(n, yt), 0));
167
+ const u = $(n, xt);
168
+ return typeof u == "number" && Number.isFinite(u) && (f = Math.min(f, u)), f;
169
+ }
170
+ function bt(t, e) {
171
+ const o = t.props.getDashArray ?? t.props.dashArray, r = typeof o == "function" ? void 0 : o;
172
+ if (!Array.isArray(r) || r.length < 2) return;
173
+ const [n, i] = r;
174
+ if (!Number.isFinite(n) || !Number.isFinite(i) || n <= 0 && i <= 0) return;
175
+ const s = Math.max(e, 1e-6);
176
+ return `${(n * s).toFixed(3)} ${(i * s).toFixed(3)}`;
177
+ }
178
+ function St(t, e, o, r) {
179
+ const n = t.props, i = L(n.opacity, 1), s = E(D(n.getFillColor, e, o, t.data, [0, 0, 0, 255])), c = E(D($(n, ct), e, o, t.data, [0, 0, 0, 255])), f = $t(t, e, o, r);
180
+ return {
181
+ fill: n.filled === !1 ? "none" : s.color,
182
+ fillOpacity: s.opacity * i,
183
+ // `stroked: false` is a POLYGON prop. A PathLayer has no such prop and is
184
+ // nothing but stroke, so an absent `stroked` must read as "yes", not as
185
+ // deck's polygon default.
186
+ stroke: n.stroked === !1 ? "none" : c.color,
187
+ strokeOpacity: c.opacity * i,
188
+ strokeWidth: f,
189
+ dashArray: bt(t, f),
190
+ radius: Pt(t, e, o, r)
191
+ };
192
+ }
193
+ function N(t, e) {
194
+ const o = [];
195
+ return e === "area" ? (o.push(`fill="${t.fill}"`), t.fill !== "none" && t.fillOpacity < 1 && o.push(`fill-opacity="${t.fillOpacity.toFixed(4)}"`)) : o.push('fill="none"'), t.stroke !== "none" && t.strokeWidth > 0 && (o.push(`stroke="${t.stroke}"`), o.push(`stroke-width="${t.strokeWidth.toFixed(3)}"`), t.strokeOpacity < 1 && o.push(`stroke-opacity="${t.strokeOpacity.toFixed(4)}"`), t.dashArray && o.push(`stroke-dasharray="${t.dashArray}"`), o.push('stroke-linejoin="round"', 'stroke-linecap="round"')), o.join(" ");
196
+ }
197
+ function wt(t, e, o) {
198
+ return !(t.right + o < e.left || e.right + o < t.left || t.bottom + o < e.top || e.bottom + o < t.top);
199
+ }
200
+ function At(t, e = 2) {
201
+ const o = t.map((i, s) => ({ box: i, index: s })).sort((i, s) => s.box.priority - i.box.priority || i.index - s.index), r = [], n = [];
202
+ for (const { box: i, index: s } of o) {
203
+ let c = !1;
204
+ for (const f of r)
205
+ if (wt(i, f, e)) {
206
+ c = !0;
207
+ break;
208
+ }
209
+ c || (r.push(i), n.push(s));
210
+ }
211
+ return n.sort((i, s) => i - s);
212
+ }
213
+ function Tt(t, e, o, r, n = "middle", i = "center") {
214
+ const s = t.length * r * 0.6, c = r * 1.2, f = n === "start" ? e : n === "end" ? e - s : e - s / 2, u = i === "top" ? o : i === "bottom" ? o - c : o - c / 2;
215
+ return { left: f, top: u, right: f + s, bottom: u + c };
216
+ }
217
+ const G = 32, z = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), S = (t) => z(t).replace(/"/g, "&quot;"), y = (t) => (Math.round(t * 100) / 100).toString();
218
+ function j(t, e) {
219
+ const o = [];
220
+ for (const r of t)
221
+ if (!(r.length < 2)) {
222
+ o.push(`M${y(r[0][0])} ${y(r[0][1])}`);
223
+ for (let n = 1; n < r.length; n++) o.push(`L${y(r[n][0])} ${y(r[n][1])}`);
224
+ e && o.push("Z");
225
+ }
226
+ return o.join("");
227
+ }
228
+ const et = { rings: [], kind: "line" };
229
+ function Lt(t) {
230
+ const e = t, o = e?.type ?? "", r = e?.coordinates;
231
+ switch (o) {
232
+ case "Polygon":
233
+ return { rings: r, kind: "area" };
234
+ case "MultiPolygon":
235
+ return { rings: r.flat(), kind: "area" };
236
+ case "LineString":
237
+ return { rings: [r], kind: "line" };
238
+ case "MultiLineString":
239
+ return { rings: r, kind: "line" };
240
+ case "Point":
241
+ return { rings: [[r]], kind: "point" };
242
+ case "MultiPoint":
243
+ return { rings: [r], kind: "point" };
244
+ default:
245
+ return et;
246
+ }
247
+ }
248
+ const C = (t) => Array.isArray(t) && typeof t[0] == "number" && typeof t[1] == "number", U = (t) => Array.isArray(t) && C(t[0]);
249
+ function kt(t, e, o, r) {
250
+ const n = (p) => {
251
+ const d = t[p];
252
+ if (d !== void 0) {
253
+ if (typeof d != "function") return d;
254
+ try {
255
+ return d(e, { index: o, data: r });
256
+ } catch {
257
+ return;
258
+ }
259
+ }
260
+ }, i = n("getPolygon");
261
+ if (U(i)) return { rings: [i], kind: "area" };
262
+ if (Array.isArray(i) && U(i[0])) return { rings: i, kind: "area" };
263
+ const s = n("getPath");
264
+ if (U(s)) return { rings: [s], kind: "line" };
265
+ const c = n("getSourcePosition"), f = n("getTargetPosition");
266
+ if (C(c) && C(f)) return { rings: [[c, f]], kind: "line" };
267
+ const u = n("getPosition");
268
+ return C(u) ? { rings: [[u]], kind: "point" } : et;
269
+ }
270
+ function vt(t, e) {
271
+ const o = B(t.data);
272
+ if (o.length === 0) return { markup: "", elementCount: 0 };
273
+ const r = [];
274
+ let n = 0;
275
+ for (let i = 0; i < o.length; i++) {
276
+ const s = o[i], c = s.geometry ?? s;
277
+ let { rings: f, kind: u } = Lt(c);
278
+ if (f.length === 0 && ({ rings: f, kind: u } = kt(t.props, s, i, t.data)), f.length === 0) continue;
279
+ const p = St(t, s, i, e.metresPerPixel);
280
+ if (u === "point") {
281
+ for (const l of f)
282
+ for (const a of l) {
283
+ const h = e.project([a[0], a[1]]);
284
+ if (!W(e.frame, h)) continue;
285
+ const m = Math.max(p.radius ?? 1, 0.1);
286
+ r.push(
287
+ `<circle cx="${y(h[0])}" cy="${y(h[1])}" r="${y(m)}" ${N(p, "area")}/>`
288
+ ), n++;
289
+ }
290
+ continue;
291
+ }
292
+ const d = f.map((l) => l.map((a) => e.project([a[0], a[1]])));
293
+ if (u === "area") {
294
+ const l = d.map((a) => at(a, e.frame)).filter((a) => a.length >= 3);
295
+ if (l.length === 0) continue;
296
+ r.push(
297
+ `<path d="${j(l, !0)}" fill-rule="evenodd" ${N(p, "area")}/>`
298
+ ), n++;
299
+ } else {
300
+ const l = d.flatMap((a) => tt(a, e.frame));
301
+ if (l.length === 0) continue;
302
+ r.push(`<path d="${j(l, !1)}" ${N(p, "line")}/>`), n++;
303
+ }
304
+ }
305
+ return {
306
+ markup: r.length ? `<g id="${S(t.id)}">${r.join("")}</g>` : "",
307
+ elementCount: n
308
+ };
309
+ }
310
+ function Mt(t, e, o) {
311
+ const r = B(t.data);
312
+ if (r.length === 0) return { markup: "", elementCount: 0 };
313
+ const n = t.props, i = (l, a, h, m) => {
314
+ if (typeof l != "function") return l ?? m;
315
+ try {
316
+ return l(a, { index: h, data: t.data });
317
+ } catch {
318
+ return m;
319
+ }
320
+ }, s = String(n.fontFamily ?? "sans-serif"), c = typeof n.getTextAnchor == "string" ? n.getTextAnchor : "middle", f = typeof n.getAlignmentBaseline == "string" ? n.getAlignmentBaseline : "center", u = [];
321
+ for (let l = 0; l < r.length; l++) {
322
+ const a = r[l], h = String(i(n.getText, a, l, "") ?? "");
323
+ if (!h) continue;
324
+ const m = i(n.getPosition, a, l, void 0);
325
+ if (!Array.isArray(m)) continue;
326
+ const g = e.project([m[0], m[1]]);
327
+ if (!W(e.frame, g)) continue;
328
+ const w = Number(i(n.getSize, a, l, G)), v = Number(n.sizeScale ?? 1), M = (Number.isFinite(w) && w > 0 ? w : G) * (Number.isFinite(v) && v > 0 ? v : 1), k = E(i(n.getColor, a, l, [0, 0, 0, 255])), R = Number(i(n.getCollisionPriority, a, l, 0)) || 0, A = i(n.getPixelOffset, a, l, void 0), _ = Array.isArray(A) && typeof A[0] == "number" ? A[0] : 0, F = Array.isArray(A) && typeof A[1] == "number" ? A[1] : 0;
329
+ g[0] += _, g[1] += F;
330
+ const O = String(i(n.getTextAnchor, a, l, c) ?? c), T = O === "start" || O === "end" ? O : "middle", I = String(i(n.getAlignmentBaseline, a, l, f) ?? f), x = I === "top" || I === "bottom" ? I : "center", P = o ? o(h, M, s) : void 0, b = Tt(h, g[0], g[1], M, T, x), nt = P === void 0 ? { id: `${t.id}:${l}`, priority: R, ...b } : {
331
+ id: `${t.id}:${l}`,
332
+ priority: R,
333
+ left: T === "start" ? g[0] : T === "end" ? g[0] - P : g[0] - P / 2,
334
+ top: b.top,
335
+ right: (T === "start" ? g[0] : T === "end" ? g[0] - P : g[0] - P / 2) + P,
336
+ bottom: b.bottom
337
+ };
338
+ u.push({ text: h, p: g, size: M, colour: k, anchor: T, baseline: x, box: nt });
339
+ }
340
+ const d = (n.collisionEnabled === !1 ? u.map((l, a) => a) : At(u.map((l) => l.box))).map((l) => {
341
+ const a = u[l], h = a.baseline === "top" ? "hanging" : a.baseline === "bottom" ? "alphabetic" : "central", m = a.colour.opacity < 1 ? ` fill-opacity="${a.colour.opacity.toFixed(4)}"` : "";
342
+ return `<text x="${y(a.p[0])}" y="${y(a.p[1])}" font-family="${S(s)}" font-size="${y(a.size)}" text-anchor="${a.anchor}" dominant-baseline="${h}" fill="${a.colour.color}"${m}>${z(a.text)}</text>`;
343
+ });
344
+ return {
345
+ markup: d.length ? `<g id="${S(t.id)}">${d.join("")}</g>` : "",
346
+ elementCount: d.length
347
+ };
348
+ }
349
+ function Rt(t, e) {
350
+ const o = B(t.data);
351
+ if (o.length === 0) return { markup: "", elementCount: 0 };
352
+ const r = t.props, n = (h, m, g, w) => {
353
+ if (typeof h != "function") return h ?? w;
354
+ try {
355
+ return h(m, { index: g, data: t.data });
356
+ } catch {
357
+ return w;
358
+ }
359
+ }, i = String(r.fontFamily ?? "sans-serif"), s = String(r.fontWeight ?? "normal"), c = Number(r.letterSpacing ?? 0) || 0, f = Number(r.offset ?? 0) || 0, u = String(r.placement ?? "middle"), p = u === "start" ? "0%" : u === "end" ? "100%" : "50%", d = u === "start" ? "start" : u === "end" ? "end" : "middle", l = [], a = [];
360
+ for (let h = 0; h < o.length; h++) {
361
+ const m = o[h], g = n(r.getPath, m, h, void 0), w = String(n(r.getText, m, h, "") ?? "");
362
+ if (!Array.isArray(g) || g.length < 2 || !w) continue;
363
+ const v = g.map((x) => e.project([x[0], x[1]])), M = tt(v, e.frame);
364
+ let k = null, R = 0;
365
+ for (const x of M) {
366
+ let P = 0;
367
+ for (let b = 1; b < x.length; b++) P += Math.hypot(x[b][0] - x[b - 1][0], x[b][1] - x[b - 1][1]);
368
+ P > R && (R = P, k = x);
369
+ }
370
+ if (!k || k.length < 2) continue;
371
+ const A = Number(n(r.getSize, m, h, 14)) || 14, _ = E(n(r.getColor, m, h, [30, 30, 30, 255])), F = `${t.id}-path-${h}`;
372
+ l.push(`<path id="${S(F)}" d="${j([k], !1)}" fill="none"/>`);
373
+ const O = _.opacity < 1 ? ` fill-opacity="${_.opacity.toFixed(4)}"` : "", T = c !== 0 ? ` letter-spacing="${y(c)}"` : "", I = f !== 0 ? ` dy="${y(-f)}"` : "";
374
+ a.push(
375
+ `<text font-family="${S(i)}" font-weight="${S(s)}" font-size="${y(A)}" fill="${_.color}"${O}${T}><textPath href="#${S(F)}" startOffset="${p}" text-anchor="${d}"${I}>${z(w)}</textPath></text>`
376
+ );
377
+ }
378
+ return a.length === 0 ? { markup: "", elementCount: 0 } : {
379
+ markup: `<defs>${l.join("")}</defs><g id="${S(t.id)}">${a.join("")}</g>`,
380
+ elementCount: a.length
381
+ };
382
+ }
383
+ function K(t, e, o) {
384
+ return `<image id="${S(`band:${o.join("+")}`)}" x="${y(e.left)}" y="${y(e.top)}" width="${y(e.right - e.left)}" height="${y(e.bottom - e.top)}" preserveAspectRatio="none" href="${S(t)}"/>`;
385
+ }
386
+ const _t = 600, Ot = 5e4;
387
+ function Ft(t) {
388
+ return Math.max(1, t / 96);
389
+ }
390
+ async function Ct(t, e) {
391
+ const o = [], r = { left: 0, top: 0, right: e.width, bottom: e.height }, n = e.effectDpi ?? _t, i = {
392
+ project: e.project,
393
+ frame: r,
394
+ metresPerPixel: e.metresPerPixel,
395
+ featureBudget: e.featureBudget ?? Ot
396
+ }, s = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${e.width}" height="${e.height}" viewBox="0 0 ${e.width} ${e.height}">`;
397
+ if (e.hasPostProcessPass) {
398
+ const d = await e.captureBand(null, n);
399
+ return o.push({
400
+ code: "rasterised-by-effect",
401
+ message: `The map frame was rasterised at ${n} dpi because a post-process pass${e.postProcessLabel ? ` (${e.postProcessLabel})` : ""} treats the finished frame, and there is no vector equivalent.`,
402
+ fix: "Remove the finish for fully editable linework, or raise effect-dpi if the type needs to be sharper."
403
+ }), {
404
+ svg: `${s}${K(d, r, ["frame"])}</svg>`,
405
+ notices: o,
406
+ elementCount: 1
407
+ };
408
+ }
409
+ const c = it(t.map((d) => ({ id: d.id, type: d.type }))), f = new Map(t.map((d) => [d.id, d])), u = [];
410
+ let p = 0;
411
+ for (const d of c) {
412
+ if (d.strategy === "raster") {
413
+ for (const l of d.ids) {
414
+ const a = f.get(l);
415
+ a && !rt(a.type) && o.push({
416
+ code: "unknown-layer-type",
417
+ message: `Layer "${l}" has type "${a.type}", which the serializer does not recognise — it was drawn into a raster band.`,
418
+ fix: "It renders correctly but is not editable. If it should be vector, register its type with the serializer."
419
+ });
420
+ }
421
+ u.push(K(await e.captureBand(d.ids, n), r, d.ids)), p++;
422
+ continue;
423
+ }
424
+ for (const l of d.ids) {
425
+ const a = f.get(l);
426
+ if (!a || a.props.visible === !1) continue;
427
+ const h = d.strategy === "path-text" ? Rt(a, i) : d.strategy === "text" ? Mt(a, i, e.measureText) : vt(a, i);
428
+ h.markup && u.push(h.markup), p += h.elementCount;
429
+ }
430
+ }
431
+ return p > i.featureBudget && o.push({
432
+ code: "feature-budget",
433
+ message: `The sheet emitted ${p} elements, past the ${i.featureBudget} budget — editors slow to a crawl well before this.`,
434
+ fix: 'Add <om-transform type="simplify" tolerance="0.15mm"> to the densest layer, or raise the budget deliberately.'
435
+ }), { svg: `${s}${u.join("")}</svg>`, notices: o, elementCount: p };
436
+ }
437
+ export {
438
+ _t as DEFAULT_EFFECT_DPI,
439
+ Ot as DEFAULT_FEATURE_BUDGET,
440
+ Ft as bandScaleFor,
441
+ tt as clipPolyline,
442
+ at as clipRing,
443
+ st as clipSegment,
444
+ E as deckColorToSvg,
445
+ At as declutter,
446
+ K as emitRasterBand,
447
+ Mt as emitTextLayer,
448
+ Rt as emitTextOnPathLayer,
449
+ vt as emitVectorLayer,
450
+ Tt as estimateLabelBox,
451
+ it as groupIntoRuns,
452
+ rt as isKnownType,
453
+ bt as resolveDashArray,
454
+ St as resolveFeatureStyle,
455
+ $t as resolveLineWidth,
456
+ Pt as resolveRadius,
457
+ Ct as serializeToSvg,
458
+ ot as strategyFor
459
+ };