@nika-js/onlymap 0.9.0 → 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 (93) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +50 -3
  3. package/dist/{LercDecode.es-BMcxSLhD.js → LercDecode.es-IEPCRZOv.js} +1 -1
  4. package/dist/{basemap-m98j2wxG.js → basemap-9lXclX9H.js} +3882 -3980
  5. package/dist/cartograph/elements/om-frame.d.ts +67 -1
  6. package/dist/cartograph/georef.d.ts +18 -4
  7. package/dist/cartograph/schema.d.ts +11 -0
  8. package/dist/cartograph.js +1480 -1311
  9. package/dist/cartograph.standalone.js +1808 -1615
  10. package/dist/{cityjson-D_V5GY8b.js → cityjson-k-z1r6c0.js} +1 -1
  11. package/dist/{crs-DsDQ4Q4i.js → crs-BzE_KP4M.js} +25 -2
  12. package/dist/{crs-Ciu7Xs7a.js → crs-ChglCB3O.js} +39 -16
  13. package/dist/dem-decode.d.ts +58 -0
  14. package/dist/elements/om-map.d.ts +12 -0
  15. package/dist/{geoparquet-XOwOmChh.js → geoparquet-DFDZDBun.js} +10 -10
  16. package/dist/globe-view-D9wjfL0T.js +104 -0
  17. package/dist/hillshade-C2BQr6pd.js +298 -0
  18. package/dist/hillshade-apron-Bem3DWyJ.js +40 -0
  19. package/dist/hillshade-apron.d.ts +54 -0
  20. package/dist/hillshade-shader-DI2uLSNU.js +165 -0
  21. package/dist/hillshade-shader.d.ts +168 -0
  22. package/dist/hillshade.d.ts +163 -0
  23. package/dist/html-data.d.ts +1 -1
  24. package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
  25. package/dist/{index-DzOvV-O7.js → index-4Tvlt0iO.js} +57 -57
  26. package/dist/{index-HZWdgtm4.js → index-Bn66l3KG.js} +1 -1
  27. package/dist/index-BuXrMq5D.js +322 -0
  28. package/dist/index-CNRbZHkK.js +459 -0
  29. package/dist/{index-DDNElBTs.js → index-CkovmN47.js} +1 -1
  30. package/dist/index-CmuOizAF.js +641 -0
  31. package/dist/index-CvT5QHBS.js +65 -0
  32. package/dist/{index-BMbpftvm.js → index-DnVHKI61.js} +1 -1
  33. package/dist/{index-BSAY6CWm.js → index-JjyDEqAS.js} +18911 -17456
  34. package/dist/index.d.ts +4 -0
  35. package/dist/layer-registry.d.ts +27 -0
  36. package/dist/lerc-C1mQ_Kqq.js +22 -0
  37. package/dist/onlymap.standalone.js +49075 -45717
  38. package/dist/onlymapjs.js +73 -70
  39. package/dist/parse-manifest.d.ts +6 -0
  40. package/dist/plane-camera.d.ts +59 -0
  41. package/dist/plane-layers.d.ts +56 -0
  42. package/dist/plane-tiles.d.ts +99 -0
  43. package/dist/plane-tileset.d.ts +31 -0
  44. package/dist/plane-warp.d.ts +91 -0
  45. package/dist/post-process-effect-DfslKPM6.js +197 -0
  46. package/dist/programmatic.d.ts +16 -1
  47. package/dist/projection.d.ts +118 -0
  48. package/dist/{raster-Dg5p_99H.js → raster-D2NzdjZE.js} +609 -499
  49. package/dist/raster-hillshade.d.ts +119 -0
  50. package/dist/{raster-pipeline-DhjkqDYd.js → raster-pipeline-qnD1icOv.js} +511 -484
  51. package/dist/raster-pipeline.d.ts +10 -0
  52. package/dist/raster.d.ts +5 -0
  53. package/dist/runtime-core.d.ts +140 -1
  54. package/dist/serialize/clip.d.ts +50 -0
  55. package/dist/serialize/declutter.d.ts +44 -0
  56. package/dist/serialize/emit.d.ts +60 -0
  57. package/dist/serialize/index.d.ts +64 -0
  58. package/dist/serialize/strategy.d.ts +30 -0
  59. package/dist/serialize/style.d.ts +77 -0
  60. package/dist/snapshot.d.ts +46 -0
  61. package/dist/surface-anchor.d.ts +6 -0
  62. package/dist/terrain-heightfield.d.ts +0 -16
  63. package/dist/terrain-sample.d.ts +0 -13
  64. package/dist/text-on-path-Dm7vtNqt.js +146 -0
  65. package/dist/text-on-path.d.ts +157 -0
  66. package/dist/transform/buffer.d.ts +63 -0
  67. package/dist/transform/contour.d.ts +37 -0
  68. package/dist/transform/dot-density.d.ts +19 -0
  69. package/dist/transform/field.d.ts +80 -0
  70. package/dist/transform/geometry.d.ts +20 -0
  71. package/dist/transform/index.d.ts +29 -0
  72. package/dist/transform/simplify.d.ts +10 -0
  73. package/dist/transform/smooth.d.ts +12 -0
  74. package/dist/transform-stage.d.ts +92 -0
  75. package/dist/version.d.ts +1 -1
  76. package/dist/volumetrics.d.ts +7 -0
  77. package/dist/{zarr-D3CzK1Zm.js → zarr-D5e5agMG.js} +2 -2
  78. package/docs/cartograph.md +12 -4
  79. package/docs/cartography.md +328 -0
  80. package/docs/design/arrows.md +182 -0
  81. package/docs/design/carto-substrate.md +1055 -0
  82. package/docs/design/extensions.md +250 -0
  83. package/docs/design/hillshade.md +290 -0
  84. package/docs/effects.md +11 -0
  85. package/docs/hillshade.md +203 -0
  86. package/llms.txt +4 -2
  87. package/onlymapjs.attributes.json +45 -2
  88. package/onlymapjs.html-data.json +213 -25
  89. package/package.json +13 -9
  90. package/skills/onlymapjs/SKILL.md +7 -2
  91. package/skills/onlymapjs/references/syntax.md +31 -3
  92. package/dist/index-CfPbQUqO.js +0 -511
  93. package/dist/lerc-qK-nhCaB.js +0 -30
@@ -1,4 +1,4 @@
1
- import { p as kt, g as Bt, b as Ht } from "./crs-Ciu7Xs7a.js";
1
+ import { projectedToLonLat as kt, gridConvergence as Bt, bundledCrsCodes as Ht } from "./crs-ChglCB3O.js";
2
2
  const _t = "0.0.68", Rt = `https://unpkg.com/web-ifc@${_t}/`;
3
3
  let Tt = Rt;
4
4
  function Pe(t) {
@@ -25,10 +25,10 @@ function ce(t) {
25
25
  const e = t.slice(Rt.length).split(/[?#]/)[0];
26
26
  return se[e] ?? null;
27
27
  }
28
- const ae = async (t) => [...new Uint8Array(await crypto.subtle.digest("SHA-256", t))].map((e) => e.toString(16).padStart(2, "0")).join("");
28
+ const re = async (t) => [...new Uint8Array(await crypto.subtle.digest("SHA-256", t))].map((e) => e.toString(16).padStart(2, "0")).join("");
29
29
  async function Ct(t, e, o) {
30
30
  if (typeof crypto > "u" || !crypto.subtle) return t;
31
- const n = await t.arrayBuffer(), s = await ae(n);
31
+ const n = await t.arrayBuffer(), s = await re(n);
32
32
  if (s !== e)
33
33
  throw new Error(
34
34
  `[onlymap] integrity check failed for ${o}: expected sha256 ${e}, got ${s}. Refusing to execute or cache these bytes. If you intend to run a different web-ifc build, self-host it and point the loader at it with configureIfc({ wasmPath }) — integrity is only enforced for the default CDN.`
@@ -37,7 +37,7 @@ async function Ct(t, e, o) {
37
37
  }
38
38
  const Ft = "onlymapjs-web-ifc", $t = `${Ft}-${_t}`;
39
39
  let Ot = !1;
40
- async function re() {
40
+ async function ae() {
41
41
  if (!Ot) {
42
42
  Ot = !0;
43
43
  try {
@@ -53,7 +53,7 @@ async function Lt(t, e = fetch) {
53
53
  const f = await e(t);
54
54
  return o && f.ok ? Ct(f, o, t) : f;
55
55
  }
56
- await re();
56
+ await ae();
57
57
  const n = await caches.open($t), s = await n.match(t);
58
58
  if (s) {
59
59
  if (!o) return s;
@@ -67,9 +67,9 @@ async function Lt(t, e = fetch) {
67
67
  throw f;
68
68
  }
69
69
  }
70
- const r = await e(t);
71
- if (!r.ok) return r;
72
- const c = o ? await Ct(r, o, t) : r;
70
+ const a = await e(t);
71
+ if (!a.ok) return a;
72
+ const c = o ? await Ct(a, o, t) : a;
73
73
  try {
74
74
  await n.put(t, c.clone());
75
75
  } catch {
@@ -92,15 +92,15 @@ async function le() {
92
92
  }
93
93
  const s = new n.IfcAPI();
94
94
  s.SetWasmPath(Tt, !0);
95
- const r = typeof caches < "u" ? globalThis.fetch : null;
96
- r && (globalThis.fetch = ((c, f) => {
95
+ const a = typeof caches < "u" ? globalThis.fetch : null;
96
+ a && (globalThis.fetch = ((c, f) => {
97
97
  const d = typeof c == "string" ? c : c instanceof URL ? c.href : c.url;
98
- return ie.test(d) ? Lt(d, r) : r(c, f);
98
+ return ie.test(d) ? Lt(d, a) : a(c, f);
99
99
  }));
100
100
  try {
101
101
  await s.Init();
102
102
  } finally {
103
- r && (globalThis.fetch = r);
103
+ a && (globalThis.fetch = a);
104
104
  }
105
105
  return s;
106
106
  })().catch((t) => {
@@ -111,7 +111,7 @@ const B = (t) => t && typeof t == "object" && "value" in t ? String(t.value ?? "
111
111
  function Pt(t) {
112
112
  const e = t && typeof t == "object" && "value" in t ? t.value : t;
113
113
  if (!Array.isArray(e) || e.length < 2) return null;
114
- const o = e.map((m) => Number(m && typeof m == "object" && "value" in m ? m.value : m) || 0), n = o.some((m) => m < 0), [s = 0, r = 0, c = 0, f = 0] = o.map(Math.abs), d = s + r / 60 + c / 3600 + f / 36e8;
114
+ const o = e.map((m) => Number(m && typeof m == "object" && "value" in m ? m.value : m) || 0), n = o.some((m) => m < 0), [s = 0, a = 0, c = 0, f = 0] = o.map(Math.abs), d = s + a / 60 + c / 3600 + f / 36e8;
115
115
  return n ? -d : d;
116
116
  }
117
117
  function ft(t) {
@@ -121,10 +121,10 @@ function ft(t) {
121
121
  return Number.isFinite(o) ? o : null;
122
122
  }
123
123
  function fe(t, e, o) {
124
- const n = Math.hypot(t.xAxisAbscissa, t.xAxisOrdinate), s = n ? t.xAxisAbscissa / n : 1, r = n ? t.xAxisOrdinate / n : 0;
124
+ const n = Math.hypot(t.xAxisAbscissa, t.xAxisOrdinate), s = n ? t.xAxisAbscissa / n : 1, a = n ? t.xAxisOrdinate / n : 0;
125
125
  return [
126
- t.eastings + t.scale * (e * s - o * r),
127
- t.northings + t.scale * (e * r + o * s)
126
+ t.eastings + t.scale * (e * s - o * a),
127
+ t.northings + t.scale * (e * a + o * s)
128
128
  ];
129
129
  }
130
130
  function ue(t) {
@@ -176,8 +176,8 @@ function ge(t, e, o) {
176
176
  }
177
177
  async function me(t, e, o) {
178
178
  if (t.code == null) return null;
179
- const [n, s] = fe(t, e, o), r = jt(`EPSG:${t.code}`);
180
- return r ? Dt(n, s, r.zone, r.south) : kt(t.code, n, s);
179
+ const [n, s] = fe(t, e, o), a = jt(`EPSG:${t.code}`);
180
+ return a ? Dt(n, s, a.zone, a.south) : kt(t.code, n, s);
181
181
  }
182
182
  async function ye(t, e, o) {
183
183
  let n = o, s = !1;
@@ -192,12 +192,12 @@ async function ye(t, e, o) {
192
192
  }
193
193
  } catch {
194
194
  }
195
- let r = 0, c = 1, f = "assumed", d = s ? "ifc-site" : "fallback", m = null, y = !1;
195
+ let a = 0, c = 1, f = "assumed", d = s ? "ifc-site" : "fallback", m = null, y = !1;
196
196
  try {
197
197
  const l = t.GetLineIDsWithType(e, Yt);
198
198
  for (let i = 0; i < l.size(); i++) {
199
199
  const h = t.GetLine(e, l.get(i), !0), g = ft(h.XAxisAbscissa), w = ft(h.XAxisOrdinate);
200
- g != null && w != null && (g || w) && (r = -(Math.atan2(w, g) * 180) / Math.PI, f = "map-conversion");
200
+ g != null && w != null && (g || w) && (a = -(Math.atan2(w, g) * 180) / Math.PI, f = "map-conversion");
201
201
  const I = `${B(h.TargetCRS?.Name)} ${B(h.TargetCRS?.Description)}`, R = ft(h.Eastings), L = ft(h.Northings);
202
202
  if (R == null || L == null) break;
203
203
  const O = B(h.TargetCRS?.MapUnit?.Name).toUpperCase();
@@ -205,12 +205,12 @@ async function ye(t, e, o) {
205
205
  `[onlymap] IfcMapConversion's TargetCRS declares a map unit that is not IfcSIUnit.METRE (read as "${O || "unknown"}") — eastings/northings/OrthogonalHeight are being treated as metres regardless, which is wrong for a non-metric unit (e.g. US survey feet) and will misplace the model.`
206
206
  );
207
207
  const k = de[B(h.TargetCRS?.MapUnit?.Prefix).toUpperCase()] ?? 1, T = R * k, U = L * k, $ = jt(I), D = /EPSG:?\s*(\d{4,6})/i.exec(I);
208
- let a = $ ? Dt(T, U, $.zone, $.south) : null, u = null;
209
- if (a && $)
210
- u = ge(a[0], a[1], $.zone);
211
- else if (!a && D) {
208
+ let r = $ ? Dt(T, U, $.zone, $.south) : null, u = null;
209
+ if (r && $)
210
+ u = ge(r[0], r[1], $.zone);
211
+ else if (!r && D) {
212
212
  const A = Number(D[1]);
213
- a = await kt(A, T, U), a && (u = await Bt(A, T, U));
213
+ r = await kt(A, T, U), r && (u = await Bt(A, T, U));
214
214
  }
215
215
  const p = ft(h.OrthogonalHeight);
216
216
  y = p != null, m = ue({
@@ -220,7 +220,7 @@ async function ye(t, e, o) {
220
220
  orthogonalHeight: (p ?? 0) * k,
221
221
  xAxisAbscissa: g ?? 1,
222
222
  xAxisOrdinate: w ?? 0
223
- }), a ? (n = a, s = !0, d = "map-conversion", u != null && (r += u)) : console.warn(
223
+ }), r ? (n = r, s = !0, d = "map-conversion", u != null && (a += u)) : console.warn(
224
224
  `[onlymap] IFC declares an IfcMapConversion into "${I.trim()}", which is neither a WGS84 UTM zone nor one of the bundled coordinate systems (EPSG ${Ht().join(", ")}) — its eastings/northings cannot be un-projected, so the position falls back to IfcSite. Set the layer's site-origin to place it.`
225
225
  );
226
226
  break;
@@ -237,31 +237,31 @@ async function ye(t, e, o) {
237
237
  if (!Array.isArray(I) || I.length < 2) continue;
238
238
  const R = ft(I[0]), L = ft(I[1]);
239
239
  if (!(R == null || L == null || !R && !L)) {
240
- r = Math.atan2(L, R) * 180 / Math.PI - 90, f = "true-north";
240
+ a = Math.atan2(L, R) * 180 / Math.PI - 90, f = "true-north";
241
241
  break;
242
242
  }
243
243
  }
244
244
  } catch {
245
245
  }
246
- return r = (r % 360 + 360) % 360, r > 180 && (r -= 360), r = Math.round(r * 1e4) / 1e4, { lonLat: n, georeferenced: s, heading: r, scale: c, headingSource: f, originSource: d, affine: m, hasOrthogonalHeight: y };
246
+ return a = (a % 360 + 360) % 360, a > 180 && (a -= 360), a = Math.round(a * 1e4) / 1e4, { lonLat: n, georeferenced: s, heading: a, scale: c, headingSource: f, originSource: d, affine: m, hasOrthogonalHeight: y };
247
247
  }
248
248
  function be(t, e) {
249
- const o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), y = (a) => {
250
- if (m.has(a)) return m.get(a);
249
+ const o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), y = (r) => {
250
+ if (m.has(r)) return m.get(r);
251
251
  let u = null;
252
252
  try {
253
- u = t.GetLine(e, a, !1);
253
+ u = t.GetLine(e, r, !1);
254
254
  } catch {
255
255
  u = null;
256
256
  }
257
- return m.set(a, u), u;
258
- }, l = (a) => Number(a?.value ?? a?.expressID ?? -1), i = (a) => {
259
- const u = l(a);
257
+ return m.set(r, u), u;
258
+ }, l = (r) => Number(r?.value ?? r?.expressID ?? -1), i = (r) => {
259
+ const u = l(r);
260
260
  return u < 0 ? "" : B(y(u)?.Name);
261
- }, h = (a, u) => {
261
+ }, h = (r, u) => {
262
262
  let p;
263
263
  try {
264
- p = t.GetLineIDsWithType(e, a);
264
+ p = t.GetLineIDsWithType(e, r);
265
265
  } catch {
266
266
  return;
267
267
  }
@@ -272,27 +272,27 @@ function be(t, e) {
272
272
  } catch {
273
273
  }
274
274
  }, g = /* @__PURE__ */ new Map();
275
- h(Zt, (a) => {
276
- const u = l(a.RelatingObject);
277
- for (const p of a.RelatedObjects ?? []) g.set(l(p), u);
275
+ h(Zt, (r) => {
276
+ const u = l(r.RelatingObject);
277
+ for (const p of r.RelatedObjects ?? []) g.set(l(p), u);
278
278
  });
279
- const w = /* @__PURE__ */ new Map(), I = (a) => {
280
- const u = w.get(a);
279
+ const w = /* @__PURE__ */ new Map(), I = (r) => {
280
+ const u = w.get(r);
281
281
  if (u !== void 0) return u;
282
- let p = B(y(a)?.Name);
282
+ let p = B(y(r)?.Name);
283
283
  if (!p)
284
284
  try {
285
- p = t.GetNameFromTypeCode(t.GetLineType(e, a));
285
+ p = t.GetNameFromTypeCode(t.GetLineType(e, r));
286
286
  } catch {
287
287
  p = "";
288
288
  }
289
- return w.set(a, p), p;
290
- }, R = /* @__PURE__ */ new Map(), L = (a) => {
291
- if (a < 0) return "";
292
- const u = R.get(a);
289
+ return w.set(r, p), p;
290
+ }, R = /* @__PURE__ */ new Map(), L = (r) => {
291
+ if (r < 0) return "";
292
+ const u = R.get(r);
293
293
  if (u !== void 0) return u;
294
294
  const p = [], A = /* @__PURE__ */ new Set();
295
- for (let C = a; C >= 0 && !A.has(C); C = g.get(C) ?? -1) {
295
+ for (let C = r; C >= 0 && !A.has(C); C = g.get(C) ?? -1) {
296
296
  A.add(C);
297
297
  let M = -1;
298
298
  try {
@@ -304,16 +304,16 @@ function be(t, e) {
304
304
  E && p.unshift(E);
305
305
  }
306
306
  const S = p.join(Et);
307
- return R.set(a, S), S;
307
+ return R.set(r, S), S;
308
308
  };
309
- h(Wt, (a) => {
310
- const u = l(a.RelatingStructure), p = i(a.RelatingStructure), A = L(u);
311
- for (const S of a.RelatedElements ?? []) {
309
+ h(Wt, (r) => {
310
+ const u = l(r.RelatingStructure), p = i(r.RelatingStructure), A = L(u);
311
+ for (const S of r.RelatedElements ?? []) {
312
312
  const C = l(S);
313
313
  o.set(C, p), n.set(C, A);
314
314
  }
315
- }), h(Qt, (a) => {
316
- const u = l(a.RelatingType);
315
+ }), h(Qt, (r) => {
316
+ const u = l(r.RelatingType);
317
317
  if (u < 0) return;
318
318
  let p = "";
319
319
  try {
@@ -322,19 +322,19 @@ function be(t, e) {
322
322
  }
323
323
  const A = [p, I(u)].filter(Boolean).join(Et);
324
324
  if (A)
325
- for (const S of a.RelatedObjects ?? []) s.set(l(S), A);
326
- }), h(ee, (a) => {
327
- const u = l(a.RelatingGroup);
325
+ for (const S of r.RelatedObjects ?? []) s.set(l(S), A);
326
+ }), h(ee, (r) => {
327
+ const u = l(r.RelatingGroup);
328
328
  if (u < 0) return;
329
329
  const p = L(u) || I(u);
330
330
  if (p)
331
- for (const A of a.RelatedObjects ?? []) r.set(l(A), p);
331
+ for (const A of r.RelatedObjects ?? []) a.set(l(A), p);
332
332
  });
333
- const O = /* @__PURE__ */ new Map(), k = (a) => {
334
- const u = O.get(a);
333
+ const O = /* @__PURE__ */ new Map(), k = (r) => {
334
+ const u = O.get(r);
335
335
  if (u !== void 0) return u;
336
336
  const p = [], A = /* @__PURE__ */ new Set();
337
- for (let C = a; C >= 0 && !A.has(C); ) {
337
+ for (let C = r; C >= 0 && !A.has(C); ) {
338
338
  A.add(C);
339
339
  const M = y(C);
340
340
  if (!M) break;
@@ -342,15 +342,15 @@ function be(t, e) {
342
342
  Q && p.unshift(Q), C = l(M.ReferencedSource);
343
343
  }
344
344
  const S = p.join(Et);
345
- return O.set(a, S), S;
345
+ return O.set(r, S), S;
346
346
  };
347
- h(te, (a) => {
348
- const u = k(l(a.RelatingClassification));
347
+ h(te, (r) => {
348
+ const u = k(l(r.RelatingClassification));
349
349
  if (u)
350
- for (const p of a.RelatedObjects ?? []) c.set(l(p), u);
350
+ for (const p of r.RelatedObjects ?? []) c.set(l(p), u);
351
351
  });
352
- const T = /* @__PURE__ */ new Map(), U = (a) => {
353
- const u = l(a);
352
+ const T = /* @__PURE__ */ new Map(), U = (r) => {
353
+ const u = l(r);
354
354
  if (u < 0) return "";
355
355
  const p = T.get(u);
356
356
  if (p !== void 0) return p;
@@ -365,12 +365,12 @@ function be(t, e) {
365
365
  }
366
366
  return T.set(u, S), S;
367
367
  };
368
- h(Xt, (a) => {
369
- const u = U(a.RelatingMaterial);
370
- for (const p of a.RelatedObjects ?? []) f.set(l(p), u);
368
+ h(Xt, (r) => {
369
+ const u = U(r.RelatingMaterial);
370
+ for (const p of r.RelatedObjects ?? []) f.set(l(p), u);
371
371
  });
372
- const $ = /* @__PURE__ */ new Map(), D = (a) => {
373
- const u = l(a);
372
+ const $ = /* @__PURE__ */ new Map(), D = (r) => {
373
+ const u = l(r);
374
374
  if (u < 0) return 0;
375
375
  const p = $.get(u);
376
376
  if (p !== void 0) return p;
@@ -385,11 +385,11 @@ function be(t, e) {
385
385
  }
386
386
  return $.set(u, S), S;
387
387
  };
388
- return h(qt, (a) => {
389
- const u = D(a.RelatingPropertyDefinition);
388
+ return h(qt, (r) => {
389
+ const u = D(r.RelatingPropertyDefinition);
390
390
  if (u)
391
- for (const p of a.RelatedObjects ?? []) d.set(l(p), u);
392
- }), { container: o, spatialPath: n, typePath: s, systemPath: r, classificationPath: c, material: f, volume: d };
391
+ for (const p of r.RelatedObjects ?? []) d.set(l(p), u);
392
+ }), { container: o, spatialPath: n, typePath: s, systemPath: a, classificationPath: c, material: f, volume: d };
393
393
  }
394
394
  const vt = 30, we = 5e3, Ie = 15e4;
395
395
  function Me(t, e) {
@@ -400,19 +400,19 @@ function Ae(t, e) {
400
400
  for (const c of t.values()) {
401
401
  const { positions: f, indices: d, featureIds: m } = c;
402
402
  for (let y = 0; y < d.length; y += 3) {
403
- const l = d[y], i = d[y + 1], h = d[y + 2], g = f[l * 3], w = f[l * 3 + 1], I = f[l * 3 + 2], R = f[i * 3], L = f[i * 3 + 1], O = f[i * 3 + 2], k = f[h * 3], T = f[h * 3 + 1], U = f[h * 3 + 2], $ = R - g, D = L - w, a = O - I, u = k - g, p = T - w, A = U - I, S = D * A - a * p, C = a * u - $ * A, M = $ * p - D * u, E = Math.hypot(S, C, M);
403
+ const l = d[y], i = d[y + 1], h = d[y + 2], g = f[l * 3], w = f[l * 3 + 1], I = f[l * 3 + 2], R = f[i * 3], L = f[i * 3 + 1], O = f[i * 3 + 2], k = f[h * 3], T = f[h * 3 + 1], U = f[h * 3 + 2], $ = R - g, D = L - w, r = O - I, u = k - g, p = T - w, A = U - I, S = D * A - r * p, C = r * u - $ * A, M = $ * p - D * u, E = Math.hypot(S, C, M);
404
404
  if (!E) continue;
405
405
  const V = [S / E, C / E, M / E], Q = m[l];
406
406
  let tt = o.get(Q);
407
407
  tt || o.set(Q, tt = /* @__PURE__ */ new Map());
408
408
  const K = n(g, w, I), ot = n(R, L, O), st = n(k, T, U), Y = [[K, ot], [ot, st], [st, K]];
409
- for (const [H, rt] of Y) {
410
- const lt = H < rt ? `${H}|${rt}` : `${rt}|${H}`, et = tt.get(lt);
409
+ for (const [H, at] of Y) {
410
+ const lt = H < at ? `${H}|${at}` : `${at}|${H}`, et = tt.get(lt);
411
411
  et ? et.push(V) : tt.set(lt, [V]);
412
412
  }
413
413
  }
414
414
  }
415
- const s = Math.cos(e * Math.PI / 180), r = [];
415
+ const s = Math.cos(e * Math.PI / 180), a = [];
416
416
  for (const [c, f] of o) {
417
417
  const d = [];
418
418
  for (const [l, i] of f)
@@ -445,10 +445,10 @@ function Ae(t, e) {
445
445
  if (!w) break;
446
446
  h ? i.unshift(w) : i.push(w);
447
447
  }
448
- r.push([c, i.map((h) => h.split(",").map(Number))]);
448
+ a.push([c, i.map((h) => h.split(",").map(Number))]);
449
449
  }
450
450
  }
451
- return r;
451
+ return a;
452
452
  }
453
453
  class Vt {
454
454
  parts = [];
@@ -462,7 +462,7 @@ class Vt {
462
462
  return this.bufferViews.push({ buffer: 0, byteOffset: this.offset, byteLength: e.byteLength, ...o ? { target: o } : {} }), this.parts.push(e), this.offset += e.byteLength, s;
463
463
  }
464
464
  floats(e, o) {
465
- const n = Float32Array.from(e), r = {
465
+ const n = Float32Array.from(e), a = {
466
466
  bufferView: this.view(new Uint8Array(n.buffer), 34962),
467
467
  componentType: 5126,
468
468
  count: n.length / o,
@@ -473,9 +473,9 @@ class Vt {
473
473
  for (let d = 0; d < n.length; d += 3)
474
474
  for (let m = 0; m < 3; m++)
475
475
  n[d + m] < c[m] && (c[m] = n[d + m]), n[d + m] > f[m] && (f[m] = n[d + m]);
476
- r.min = c, r.max = f;
476
+ a.min = c, a.max = f;
477
477
  }
478
- return this.accessors.push(r), this.accessors.length - 1;
478
+ return this.accessors.push(a), this.accessors.length - 1;
479
479
  }
480
480
  indices(e) {
481
481
  const o = Uint32Array.from(e), n = this.view(new Uint8Array(o.buffer), 34963);
@@ -485,7 +485,7 @@ class Vt {
485
485
  return this.view(e);
486
486
  }
487
487
  binary() {
488
- const e = this.parts.reduce((s, r) => s + r.byteLength, 0), o = new Uint8Array(e);
488
+ const e = this.parts.reduce((s, a) => s + a.byteLength, 0), o = new Uint8Array(e);
489
489
  let n = 0;
490
490
  for (const s of this.parts)
491
491
  o.set(s, n), n += s.byteLength;
@@ -494,13 +494,13 @@ class Vt {
494
494
  }
495
495
  function xe(t) {
496
496
  const e = new TextEncoder(), o = t.map((c) => e.encode(c ?? "")), n = new Uint8Array(o.reduce((c, f) => c + f.length, 0)), s = new Uint32Array(t.length + 1);
497
- let r = 0;
497
+ let a = 0;
498
498
  return o.forEach((c, f) => {
499
- s[f] = r, n.set(c, r), r += c.length;
500
- }), s[t.length] = r, { blob: n, offsets: new Uint8Array(s.buffer) };
499
+ s[f] = a, n.set(c, a), a += c.length;
500
+ }), s[t.length] = a, { blob: n, offsets: new Uint8Array(s.buffer) };
501
501
  }
502
502
  function Gt(t, e, o) {
503
- const n = new Vt(), s = [], r = [];
503
+ const n = new Vt(), s = [], a = [];
504
504
  for (const i of e.values()) {
505
505
  const h = n.floats(i.positions, 3), g = n.floats(i.normals, 3), w = n.floats(i.featureIds, 1), I = n.indices(i.indices), [R, L, O, k] = i.colour;
506
506
  s.push({
@@ -508,7 +508,7 @@ function Gt(t, e, o) {
508
508
  doubleSided: !0,
509
509
  ...k < 1 ? { alphaMode: "BLEND" } : {},
510
510
  pbrMetallicRoughness: { baseColorFactor: [R, L, O, k], metallicFactor: 0, roughnessFactor: 0.85 }
511
- }), r.push({
511
+ }), a.push({
512
512
  name: i.label,
513
513
  primitives: [
514
514
  {
@@ -533,7 +533,7 @@ function Gt(t, e, o) {
533
533
  return Number.isFinite(R) ? R : 0;
534
534
  }));
535
535
  f[i] = { values: n.raw(new Uint8Array(g.buffer)) }, c[i] = { name: i, type: "SCALAR", componentType: "FLOAT32" };
536
- }), zt(n, r, s, {
536
+ }), zt(n, a, s, {
537
537
  extensionsUsed: ["EXT_mesh_features", "EXT_structural_metadata"],
538
538
  extensions: {
539
539
  EXT_structural_metadata: {
@@ -544,7 +544,7 @@ function Gt(t, e, o) {
544
544
  });
545
545
  }
546
546
  function zt(t, e, o, n = {}) {
547
- const s = t.binary(), r = {
547
+ const s = t.binary(), a = {
548
548
  asset: { version: "2.0", generator: "onlymapjs web-ifc loader" },
549
549
  ...n,
550
550
  scene: 0,
@@ -555,7 +555,7 @@ function zt(t, e, o, n = {}) {
555
555
  accessors: t.accessors,
556
556
  bufferViews: t.bufferViews,
557
557
  buffers: [{ byteLength: s.byteLength }]
558
- }, c = new TextEncoder().encode(JSON.stringify(r)), f = (w, I, R) => {
558
+ }, c = new TextEncoder().encode(JSON.stringify(a)), f = (w, I, R) => {
559
559
  const L = (4 - I.byteLength % 4) % 4, O = new Uint8Array(8), k = new DataView(O.buffer);
560
560
  return k.setUint32(0, I.byteLength + L, !0), k.setUint32(4, w, !0), [O, I, new Uint8Array(L).fill(R)];
561
561
  }, d = f(1313821514, c, 32), m = f(5130562, s, 0), y = new Uint8Array(12), l = new DataView(y.buffer);
@@ -571,23 +571,23 @@ function zt(t, e, o, n = {}) {
571
571
  async function Ee(t) {
572
572
  const e = /* @__PURE__ */ new Map();
573
573
  for (const s of t.values()) {
574
- const r = s.colour.join(",");
575
- let c = e.get(r);
576
- c || e.set(r, c = { vertexCount: 0, indexCount: 0, colour: s.colour }), c.vertexCount += s.positions.length / 3, c.indexCount += s.indices.length;
574
+ const a = s.colour.join(",");
575
+ let c = e.get(a);
576
+ c || e.set(a, c = { vertexCount: 0, indexCount: 0, colour: s.colour }), c.vertexCount += s.positions.length / 3, c.indexCount += s.indices.length;
577
577
  }
578
578
  const o = /* @__PURE__ */ new Map();
579
- for (const [s, r] of e)
579
+ for (const [s, a] of e)
580
580
  o.set(s, {
581
- positions: new Float32Array(r.vertexCount * 3),
582
- indices: new Uint32Array(r.indexCount),
583
- colour: r.colour,
581
+ positions: new Float32Array(a.vertexCount * 3),
582
+ indices: new Uint32Array(a.indexCount),
583
+ colour: a.colour,
584
584
  vertexOffset: 0,
585
585
  indexOffset: 0
586
586
  });
587
587
  let n = 0;
588
588
  for (const s of t.values()) {
589
589
  n++, n % 50 === 0 && await new Promise((d) => setTimeout(d));
590
- const r = s.colour.join(","), c = o.get(r), f = c.vertexOffset;
590
+ const a = s.colour.join(","), c = o.get(a), f = c.vertexOffset;
591
591
  c.positions.set(s.positions, f * 3);
592
592
  for (let d = 0; d < s.indices.length; d++) c.indices[c.indexOffset + d] = s.indices[d] + f;
593
593
  c.vertexOffset += s.positions.length / 3, c.indexOffset += s.indices.length;
@@ -598,7 +598,7 @@ const Se = vt * 3, Ce = 8, Re = 900, Te = 0.93;
598
598
  async function ve(t, e) {
599
599
  const { MeshoptSimplifier: o } = await import("./meshopt_simplifier-Co6uRDDA.js");
600
600
  await o.ready;
601
- const n = await Ee(t), s = [...n.values()].reduce((l, i) => l + i.indices.length / 3, 0), r = new Vt(), c = [], f = [];
601
+ const n = await Ee(t), s = [...n.values()].reduce((l, i) => l + i.indices.length / 3, 0), a = new Vt(), c = [], f = [];
602
602
  let d = 0;
603
603
  const m = n.size;
604
604
  for (const l of n.values()) {
@@ -612,10 +612,10 @@ async function ve(t, e) {
612
612
  }
613
613
  const U = Uint32Array.from(L, (M) => k.get(M)), $ = new Float32Array(T.length);
614
614
  for (let M = 0; M < U.length; M += 3) {
615
- const [E, V, Q] = [U[M], U[M + 1], U[M + 2]], tt = (et) => [T[et * 3], T[et * 3 + 1], T[et * 3 + 2]], [K, ot, st] = [tt(E), tt(V), tt(Q)], Y = [ot[0] - K[0], ot[1] - K[1], ot[2] - K[2]], H = [st[0] - K[0], st[1] - K[1], st[2] - K[2]], rt = [Y[1] * H[2] - Y[2] * H[1], Y[2] * H[0] - Y[0] * H[2], Y[0] * H[1] - Y[1] * H[0]], lt = Math.hypot(...rt) || 1;
616
- for (const et of [E, V, Q]) for (let b = 0; b < 3; b++) $[et * 3 + b] = rt[b] / lt;
615
+ const [E, V, Q] = [U[M], U[M + 1], U[M + 2]], tt = (et) => [T[et * 3], T[et * 3 + 1], T[et * 3 + 2]], [K, ot, st] = [tt(E), tt(V), tt(Q)], Y = [ot[0] - K[0], ot[1] - K[1], ot[2] - K[2]], H = [st[0] - K[0], st[1] - K[1], st[2] - K[2]], at = [Y[1] * H[2] - Y[2] * H[1], Y[2] * H[0] - Y[0] * H[2], Y[0] * H[1] - Y[1] * H[0]], lt = Math.hypot(...at) || 1;
616
+ for (const et of [E, V, Q]) for (let b = 0; b < 3; b++) $[et * 3 + b] = at[b] / lt;
617
617
  }
618
- const D = r.floats(Array.from(T), 3), a = r.floats(Array.from($), 3), u = r.indices(Array.from(U)), [p, A, S, C] = l.colour;
618
+ const D = a.floats(Array.from(T), 3), r = a.floats(Array.from($), 3), u = a.indices(Array.from(U)), [p, A, S, C] = l.colour;
619
619
  c.push({
620
620
  name: `lod-${c.length}`,
621
621
  doubleSided: !0,
@@ -623,24 +623,24 @@ async function ve(t, e) {
623
623
  pbrMetallicRoughness: { baseColorFactor: [p, A, S, C], metallicFactor: 0, roughnessFactor: 0.85 }
624
624
  }), f.push({
625
625
  name: `lod-${f.length}`,
626
- primitives: [{ attributes: { POSITION: D, NORMAL: a }, indices: u, material: c.length - 1, mode: 4 }]
626
+ primitives: [{ attributes: { POSITION: D, NORMAL: r }, indices: u, material: c.length - 1, mode: 4 }]
627
627
  });
628
628
  }
629
629
  const y = Ce * Se * Te / Re;
630
- return { glb: zt(r, f, c), geometricError: y };
630
+ return { glb: zt(a, f, c), geometricError: y };
631
631
  }
632
632
  function Oe(t, e) {
633
- const o = t * Math.PI / 180, n = e * Math.PI / 180, [s, r, c, f] = [Math.sin(o), Math.cos(o), Math.sin(n), Math.cos(n)], d = At / Math.sqrt(1 - Z * c * c);
633
+ const o = t * Math.PI / 180, n = e * Math.PI / 180, [s, a, c, f] = [Math.sin(o), Math.cos(o), Math.sin(n), Math.cos(n)], d = At / Math.sqrt(1 - Z * c * c);
634
634
  return {
635
- east: [-s, r, 0],
636
- north: [-c * r, -c * s, f],
637
- up: [f * r, f * s, c],
638
- origin: [d * f * r, d * f * s, d * (1 - Z) * c]
635
+ east: [-s, a, 0],
636
+ north: [-c * a, -c * s, f],
637
+ up: [f * a, f * s, c],
638
+ origin: [d * f * a, d * f * s, d * (1 - Z) * c]
639
639
  };
640
640
  }
641
641
  async function Ne(t, e = {}) {
642
642
  const { onProgress: o = () => {
643
- }, fallbackLonLat: n = [-122.41, 37.8], edges: s = !0, creaseDegrees: r = 25 } = e, c = t instanceof Blob ? await t.arrayBuffer() : t, f = c instanceof Uint8Array ? c : new Uint8Array(c), d = {};
643
+ }, fallbackLonLat: n = [-122.41, 37.8], edges: s = !0, creaseDegrees: a = 25 } = e, c = t instanceof Blob ? await t.arrayBuffer() : t, f = c instanceof Uint8Array ? c : new Uint8Array(c), d = {};
644
644
  let m = performance.now();
645
645
  const y = (h) => {
646
646
  d[h] = Math.round(performance.now() - m), m = performance.now();
@@ -671,17 +671,17 @@ async function Ne(t, e = {}) {
671
671
  }
672
672
  D.push({ expressID: x.expressID, placed: _ });
673
673
  }
674
- const a = [], u = /* @__PURE__ */ new Map(), p = [1 / 0, 1 / 0, 1 / 0], A = [-1 / 0, -1 / 0, -1 / 0], S = [];
674
+ const r = [], u = /* @__PURE__ */ new Map(), p = [1 / 0, 1 / 0, 1 / 0], A = [-1 / 0, -1 / 0, -1 / 0], S = [];
675
675
  let C = 0;
676
676
  const M = D.length > we;
677
677
  for (let b = 0; b < D.length; b++) {
678
- const x = D[b], _ = a.length;
678
+ const x = D[b], _ = r.length;
679
679
  let G = "IfcProduct", W = "";
680
680
  try {
681
681
  G = l.GetNameFromTypeCode(l.GetLineType(i, x.expressID)) || G, W = B(l.GetLine(i, x.expressID, !1).Name);
682
682
  } catch {
683
683
  }
684
- a.push({
684
+ r.push({
685
685
  ifcClass: G,
686
686
  name: W,
687
687
  material: h.material.get(x.expressID) ?? "",
@@ -701,18 +701,18 @@ async function Ne(t, e = {}) {
701
701
  for (let z = 0; z < ct.length; z += 6) {
702
702
  const [ht, dt, pt] = [ct[z], ct[z + 1], ct[z + 2]], yt = v[0] * ht + v[4] * dt + v[8] * pt + v[12], bt = v[1] * ht + v[5] * dt + v[9] * pt + v[13], wt = v[2] * ht + v[6] * dt + v[10] * pt + v[14], [gt, P, N] = [ct[z + 3], ct[z + 4], ct[z + 5]];
703
703
  j.positions.push(yt, bt, wt), j.normals.push(v[0] * gt + v[4] * P + v[8] * N, v[1] * gt + v[5] * P + v[9] * N, v[2] * gt + v[6] * P + v[10] * N), j.featureIds.push(_);
704
- const at = [yt, -wt, bt], It = S[_];
704
+ const rt = [yt, -wt, bt], It = S[_];
705
705
  for (let F = 0; F < 3; F++)
706
- at[F] < p[F] && (p[F] = at[F]), at[F] > A[F] && (A[F] = at[F]), at[F] < It[F] && (It[F] = at[F]), at[F] > It[F + 3] && (It[F + 3] = at[F]);
706
+ rt[F] < p[F] && (p[F] = rt[F]), rt[F] > A[F] && (A[F] = rt[F]), rt[F] < It[F] && (It[F] = rt[F]), rt[F] > It[F + 3] && (It[F + 3] = rt[F]);
707
707
  }
708
708
  for (let z = 0; z < mt.length; z++) j.indices.push(xt + mt[z]);
709
709
  C += ct.length / 6, q.delete();
710
710
  }
711
711
  (b + 1) % 250 === 0 && (o(`Reading geometry… ${b + 1}/${D.length} elements`), await new Promise((X) => setTimeout(X)));
712
712
  }
713
- if (y("meshes"), !a.length) throw new Error("no geometry found in this IFC");
713
+ if (y("meshes"), !r.length) throw new Error("no geometry found in this IFC");
714
714
  if (!C)
715
- throw new Error(`parsed ${a.length} elements but web-ifc returned no vertices for any of them`);
715
+ throw new Error(`parsed ${r.length} elements but web-ifc returned no vertices for any of them`);
716
716
  const E = e.origin ?? [(p[0] + A[0]) / 2, (p[1] + A[1]) / 2, p[2]];
717
717
  for (const b of u.values()) {
718
718
  const x = b.positions;
@@ -751,9 +751,9 @@ async function Ne(t, e = {}) {
751
751
  const W = [], it = [...G.values()];
752
752
  for (let J = 0; J < it.length; J++) {
753
753
  o(`Building spatial tiles… ${J + 1}/${it.length}`), await new Promise((P) => setTimeout(P));
754
- const X = it[J], q = [...new Set([...X.values()].flatMap((P) => P.featureIds))].sort((P, N) => P - N), ct = new Map(q.map((P, N) => [P, N])), mt = q.map((P) => a[P]), v = q.map((P) => S[P]), ut = /* @__PURE__ */ new Map();
754
+ const X = it[J], q = [...new Set([...X.values()].flatMap((P) => P.featureIds))].sort((P, N) => P - N), ct = new Map(q.map((P, N) => [P, N])), mt = q.map((P) => r[P]), v = q.map((P) => S[P]), ut = /* @__PURE__ */ new Map();
755
755
  for (const [P, N] of X)
756
- ut.set(P, { ...N, featureIds: N.featureIds.map((at) => ct.get(at)) });
756
+ ut.set(P, { ...N, featureIds: N.featureIds.map((rt) => ct.get(rt)) });
757
757
  const nt = [1 / 0, 1 / 0, 1 / 0], j = [-1 / 0, -1 / 0, -1 / 0];
758
758
  for (const P of v)
759
759
  for (let N = 0; N < 3; N++)
@@ -774,7 +774,7 @@ async function Ne(t, e = {}) {
774
774
  }
775
775
  };
776
776
  } else {
777
- const b = Gt(a, u, S);
777
+ const b = Gt(r, u, S);
778
778
  y("glb");
779
779
  const x = ot(b, "model.glb");
780
780
  H = {
@@ -791,12 +791,12 @@ async function Ne(t, e = {}) {
791
791
  }
792
792
  };
793
793
  }
794
- const rt = `${URL.createObjectURL(new Blob([JSON.stringify(H)], { type: "application/json" }))}#tileset.json`;
794
+ const at = `${URL.createObjectURL(new Blob([JSON.stringify(H)], { type: "application/json" }))}#tileset.json`;
795
795
  let lt = null, et = 0;
796
796
  if (s) {
797
797
  o("Tracing outlines…"), await new Promise((x) => setTimeout(x));
798
- const b = Ae(u, r).map(([x, _]) => {
799
- const G = a[x];
798
+ const b = Ae(u, a).map(([x, _]) => {
799
+ const G = r[x];
800
800
  return {
801
801
  // Local east/north/up METRES from the model's own anchor, NOT
802
802
  // lon/lat. Geographic coordinates would nail the outlines to
@@ -829,10 +829,10 @@ async function Ne(t, e = {}) {
829
829
  et = b.length, lt = URL.createObjectURL(new Blob([JSON.stringify(b)], { type: "application/json" })), y("edges");
830
830
  }
831
831
  return {
832
- tilesetUrl: rt,
832
+ tilesetUrl: at,
833
833
  edgesUrl: lt,
834
834
  loadOptions: { "3d-tiles": { isTileset: !0 }, gltf: { loadBuffers: !0 } },
835
- features: a,
835
+ features: r,
836
836
  lonLat: T,
837
837
  georeferenced: w,
838
838
  origin: E,
@@ -845,11 +845,11 @@ async function Ne(t, e = {}) {
845
845
  // point that becomes the tile origin — never mutated, only `lo`/`hi`
846
846
  // are.
847
847
  orthogonalHeight: k ? he(O.orthogonalHeight, E[2]) : void 0,
848
- stats: { elements: a.length, primitives: u.size, polylines: et, bytes: K },
848
+ stats: { elements: r.length, primitives: u.size, polylines: et, bytes: K },
849
849
  timings: d,
850
850
  bounds: { lo: p, hi: A, centre: E },
851
851
  revoke() {
852
- for (const b of [...tt, rt, lt])
852
+ for (const b of [...tt, at, lt])
853
853
  b && URL.revokeObjectURL(b.split("#")[0]);
854
854
  }
855
855
  };