bimatter-viewer-react 0.5.12 → 0.5.13

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.
package/lib/index.js CHANGED
@@ -1,44 +1,44 @@
1
1
  import e, { createContext as t, forwardRef as n, memo as r, useCallback as i, useContext as a, useEffect as o, useImperativeHandle as s, useMemo as c, useRef as l, useState as u } from "react";
2
2
  import { Canvas as d, useFrame as f, useThree as p } from "@react-three/fiber";
3
3
  import { CameraControls as m, Stats as h } from "@react-three/drei";
4
- import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as O, Line3 as k, LineBasicMaterial as A, LineDashedMaterial as ee, LineSegments as j, LinearFilter as M, MathUtils as te, Matrix4 as N, Mesh as P, MeshBasicMaterial as ne, MeshLambertMaterial as re, NearestFilter as ie, Object3D as ae, OrthographicCamera as oe, PerspectiveCamera as se, Plane as ce, RGBAFormat as le, SRGBColorSpace as ue, Sphere as de, SphereGeometry as fe, Sprite as pe, SpriteMaterial as me, UnsignedByteType as he, Vector2 as F, Vector3 as I } from "three";
5
- import { useStore as ge } from "zustand";
6
- import { createStore as _e } from "zustand/vanilla";
7
- import { CONTAINED as ve, INTERSECTED as ye, MeshBVH as be, NOT_INTERSECTED as xe, acceleratedRaycast as Se } from "three-mesh-bvh";
8
- import { Fragment as Ce, jsx as L, jsxs as R } from "react/jsx-runtime";
9
- import we from "pako";
4
+ import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as ee, Line3 as O, LineBasicMaterial as k, LineDashedMaterial as A, LineSegments as te, LinearFilter as j, MathUtils as ne, Matrix4 as M, Mesh as N, MeshBasicMaterial as P, MeshLambertMaterial as re, NearestFilter as F, Object3D as ie, OrthographicCamera as ae, PerspectiveCamera as oe, Plane as se, RGBAFormat as ce, SRGBColorSpace as le, Sphere as ue, SphereGeometry as de, Sprite as fe, SpriteMaterial as pe, UnsignedByteType as me, Vector2 as I, Vector3 as L } from "three";
5
+ import { useStore as he } from "zustand";
6
+ import { createStore as ge } from "zustand/vanilla";
7
+ import { CONTAINED as _e, INTERSECTED as ve, MeshBVH as ye, NOT_INTERSECTED as be, acceleratedRaycast as xe } from "three-mesh-bvh";
8
+ import { Fragment as Se, jsx as R, jsxs as z } from "react/jsx-runtime";
9
+ import Ce from "pako";
10
10
  //#region src/viewer/store/ViewerStoreContext.ts
11
- var Te = t(null);
11
+ var we = t(null);
12
12
  //#endregion
13
13
  //#region src/viewer/store/useViewerStore.ts
14
- function z(e) {
15
- return ge(Ee(), e);
14
+ function B(e) {
15
+ return he(Te(), e);
16
16
  }
17
- function Ee() {
18
- let e = a(Te);
17
+ function Te() {
18
+ let e = a(we);
19
19
  if (!e) throw Error("useViewerStore must be used inside ViewerStoreProvider");
20
20
  return e;
21
21
  }
22
22
  //#endregion
23
23
  //#region src/viewer/store/ViewerStore.ts
24
- var De = "rgb(17, 148, 189)", Oe = "rgb(104, 198, 227)", ke = {
24
+ var Ee = "rgb(17, 148, 189)", De = "rgb(104, 198, 227)", Oe = {
25
25
  bottom: !0,
26
26
  left: !0,
27
27
  right: !0,
28
28
  top: !0,
29
29
  visible: !0
30
30
  };
31
- function Ae() {
32
- return _e((e) => ({
31
+ function ke() {
32
+ return ge((e) => ({
33
33
  api: null,
34
34
  defaultHotkeysEnabled: !0,
35
- gridAxesVisibility: ke,
35
+ gridAxesVisibility: Oe,
36
36
  modelNames: {},
37
37
  modelProps: {},
38
38
  modelStructure: {},
39
- preselectionColor: Oe,
39
+ preselectionColor: De,
40
40
  selected: {},
41
- selectionColor: De,
41
+ selectionColor: Ee,
42
42
  selectionInteractionDisabled: !1,
43
43
  showNavCube: !0,
44
44
  showStats: !1,
@@ -119,66 +119,66 @@ function Ae() {
119
119
  }
120
120
  }));
121
121
  }
122
- var je = 2;
123
- function Me() {
124
- let e = new C(new Uint8Array(256 * 4), 256, 1, le, he);
125
- return e.magFilter = ie, e.minFilter = ie, e.generateMipmaps = !1, e.needsUpdate = !0, Pe(e, 1, new x(De)), e;
122
+ var Ae = 2;
123
+ function je() {
124
+ let e = new C(new Uint8Array(256 * 4), 256, 1, ce, me);
125
+ return e.magFilter = F, e.minFilter = F, e.generateMipmaps = !1, e.needsUpdate = !0, Ne(e, 1, new x(Ee)), e;
126
126
  }
127
- function Ne(e) {
127
+ function Me(e) {
128
128
  return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
129
129
  }
130
- function Pe(e, t, n) {
130
+ function Ne(e, t, n) {
131
131
  let r = e.image.data, i = t * 4;
132
132
  r[i] = Math.round(n.r * 255), r[i + 1] = Math.round(n.g * 255), r[i + 2] = Math.round(n.b * 255), r[i + 3] = 255, e.needsUpdate = !0;
133
133
  }
134
- function Fe(e) {
134
+ function Pe(e) {
135
135
  return e.mesh.geometry.attributes.colorIndex;
136
136
  }
137
- function Ie(e) {
137
+ function Fe(e) {
138
138
  let t = e.mesh.geometry.attributes.ids;
139
139
  if (!t) return null;
140
140
  let n = new v(new Uint8Array(t.count), 1);
141
141
  return e.mesh.geometry.setAttribute("colorIndex", n), n;
142
142
  }
143
- function Le(e, t) {
144
- let n = Fe(e);
145
- return n || t === 0 ? n : Ie(e);
143
+ function Ie(e, t) {
144
+ let n = Pe(e);
145
+ return n || t === 0 ? n : Fe(e);
146
146
  }
147
- function Re(e) {
148
- Fe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
147
+ function Le(e) {
148
+ Pe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
149
149
  }
150
- function ze(e, t, n) {
150
+ function Re(e, t, n) {
151
151
  let r = e.get(t);
152
152
  return !r && n && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r;
153
153
  }
154
- function Be(e, t) {
155
- let n = Le(e.record, t);
154
+ function ze(e, t) {
155
+ let n = Ie(e.record, t);
156
156
  if (!n) return !1;
157
157
  let r = n.array;
158
158
  return e.vertexRanges.forEach(({ count: e, start: n }) => {
159
159
  r.fill(t, n, n + e);
160
160
  }), n.needsUpdate = !0, !0;
161
161
  }
162
- function Ve(e, t, n, r, i) {
162
+ function Be(e, t, n, r, i) {
163
163
  e && e.forEach((e) => {
164
164
  if (e.record.modelID !== t) return;
165
- let a = Be(e, r), o = ze(i, e.record, r !== 0 && a);
166
- r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), Re(e.record))) : a && o?.add(n);
165
+ let a = ze(e, r), o = Re(i, e.record, r !== 0 && a);
166
+ r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), Le(e.record))) : a && o?.add(n);
167
167
  });
168
168
  }
169
- function He(e, t, n) {
169
+ function Ve(e, t, n) {
170
170
  let r = /* @__PURE__ */ new Set();
171
171
  return e.elementIndex.forEach((e, i) => {
172
172
  n.has(i) || e.some((e) => e.record.modelID === t) && r.add(i);
173
173
  }), r;
174
174
  }
175
- function Ue(e) {
175
+ function He(e) {
176
176
  let t = /* @__PURE__ */ new Set();
177
177
  return Object.entries(e).forEach(([e, n]) => {
178
178
  n.forEach((n) => t.add(`${e}:${n}`));
179
179
  }), t;
180
180
  }
181
- function We(e, t) {
181
+ function Ue(e, t) {
182
182
  let n = /* @__PURE__ */ new Map(), r = (e) => {
183
183
  let [t, r] = e.split(":").map(Number), i = n.get(t);
184
184
  i || (i = /* @__PURE__ */ new Set(), n.set(t, i)), i.add(r);
@@ -189,28 +189,28 @@ function We(e, t) {
189
189
  t.has(e) || r(e);
190
190
  }), n;
191
191
  }
192
- function Ge(e) {
193
- let t = z((e) => e.selected), n = z((e) => e.selectionColor), r = c(() => Me(), []), a = l(/* @__PURE__ */ new Map()), s = l(je), u = l(/* @__PURE__ */ new Map()), d = l(t), f = l(/* @__PURE__ */ new Set()), p = l(/* @__PURE__ */ new WeakMap());
192
+ function We(e) {
193
+ let t = B((e) => e.selected), n = B((e) => e.selectionColor), r = c(() => je(), []), a = l(/* @__PURE__ */ new Map()), s = l(Ae), u = l(/* @__PURE__ */ new Map()), d = l(t), f = l(/* @__PURE__ */ new Set()), p = l(/* @__PURE__ */ new WeakMap());
194
194
  o(() => {
195
195
  d.current = t;
196
196
  }, [t]), o(() => () => r.dispose(), [r]), o(() => {
197
- Pe(r, 1, new x(n));
197
+ Ne(r, 1, new x(n));
198
198
  }, [r, n]);
199
199
  let m = i((e, t) => d.current[e]?.has(t) ? 1 : u.current.get(e)?.get(t) ?? 0, []), h = i((t, n) => {
200
200
  let r = e.buildIndex();
201
201
  n.forEach((e) => {
202
- Ve(r.elementIndex.get(e), t, e, m(t, e), p.current);
202
+ Be(r.elementIndex.get(e), t, e, m(t, e), p.current);
203
203
  });
204
204
  }, [e, m]), g = i((e) => {
205
- let t = new x(e), n = Ne(t), i = a.current.get(n);
205
+ let t = new x(e), n = Me(t), i = a.current.get(n);
206
206
  if (i !== void 0) return i;
207
207
  let o = s.current;
208
208
  if (o >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
209
- return a.current.set(n, o), s.current += 1, Pe(r, o, t), o;
209
+ return a.current.set(n, o), s.current += 1, Ne(r, o, t), o;
210
210
  }, [r]);
211
211
  o(() => {
212
- let e = Ue(t);
213
- We(f.current, e).forEach((e, t) => {
212
+ let e = He(t);
213
+ Ue(f.current, e).forEach((e, t) => {
214
214
  h(t, Array.from(e));
215
215
  }), f.current = e;
216
216
  }, [h, t]);
@@ -221,7 +221,7 @@ function Ge(e) {
221
221
  let i = e.buildIndex(), a = /* @__PURE__ */ new Set(), o = Object.entries(n);
222
222
  o.forEach(([, e]) => {
223
223
  e.forEach((e) => a.add(e));
224
- }), r !== void 0 && _(t, Array.from(He(i, t, a)), r), o.forEach(([e, n]) => {
224
+ }), r !== void 0 && _(t, Array.from(Ve(i, t, a)), r), o.forEach(([e, n]) => {
225
225
  _(t, n, e);
226
226
  });
227
227
  }, [e, _]), y = i((e, t) => {
@@ -249,12 +249,12 @@ function Ge(e) {
249
249
  t.forEach((t) => r(Number(e), t));
250
250
  }), n.forEach((e, n) => {
251
251
  e.forEach((e) => {
252
- Ve(t.elementIndex.get(e), n, e, m(n, e), p.current);
252
+ Be(t.elementIndex.get(e), n, e, m(n, e), p.current);
253
253
  });
254
254
  });
255
255
  }, [e, m]), w = i(() => {
256
256
  e.buildIndex().records.forEach((e) => {
257
- p.current.delete(e), Re(e);
257
+ p.current.delete(e), Le(e);
258
258
  }), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(), C();
259
259
  }, [C, e]);
260
260
  return {
@@ -280,9 +280,9 @@ function Ge(e) {
280
280
  }
281
281
  //#endregion
282
282
  //#region src/viewer/SelectableMesh.tsx
283
- P.prototype.raycast = Se;
284
- var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSpace: r = !1, meshMatrix: i }) {
285
- let a = l(null), s = z((e) => e.preselectionColor), u = l(s);
283
+ N.prototype.raycast = xe;
284
+ var Ge = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSpace: r = !1, meshMatrix: i }) {
285
+ let a = l(null), s = B((e) => e.preselectionColor), u = l(s);
286
286
  u.current = s;
287
287
  let d = c(() => {
288
288
  let n = new re({
@@ -319,11 +319,11 @@ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
319
319
  e && (e.value instanceof x ? e.value.set(s) : e.value = new x(s));
320
320
  }, [d, s]), o(() => {
321
321
  if (!a.current) return;
322
- let e = a.current.geometry, t = new be(e, { indirect: !0 });
322
+ let e = a.current.geometry, t = new ye(e, { indirect: !0 });
323
323
  return Object.assign(e, { boundsTree: t }), () => {
324
324
  d.dispose(), Object.assign(e, { boundsTree: null });
325
325
  };
326
- }, [d]), /* @__PURE__ */ R("mesh", {
326
+ }, [d]), /* @__PURE__ */ z("mesh", {
327
327
  matrix: i,
328
328
  matrixAutoUpdate: !1,
329
329
  name: r ? "space" : void 0,
@@ -333,38 +333,38 @@ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
333
333
  let t = e.object;
334
334
  t.preselected &&= !1;
335
335
  },
336
- children: [/* @__PURE__ */ R("bufferGeometry", { children: [
337
- /* @__PURE__ */ L("bufferAttribute", {
336
+ children: [/* @__PURE__ */ z("bufferGeometry", { children: [
337
+ /* @__PURE__ */ R("bufferAttribute", {
338
338
  attach: "attributes-position",
339
339
  args: [n.pos, 3]
340
340
  }),
341
- n.norm && /* @__PURE__ */ L("bufferAttribute", {
341
+ n.norm && /* @__PURE__ */ R("bufferAttribute", {
342
342
  attach: "attributes-normal",
343
343
  args: [n.norm, 3]
344
344
  }),
345
- /* @__PURE__ */ L("bufferAttribute", {
345
+ /* @__PURE__ */ R("bufferAttribute", {
346
346
  attach: "attributes-ids",
347
347
  args: [n.ids, 1]
348
348
  }),
349
- /* @__PURE__ */ L("bufferAttribute", {
349
+ /* @__PURE__ */ R("bufferAttribute", {
350
350
  attach: "index",
351
351
  args: [n.ind, 1]
352
352
  })
353
- ] }), /* @__PURE__ */ L("primitive", { object: d })]
353
+ ] }), /* @__PURE__ */ R("primitive", { object: d })]
354
354
  });
355
- }), qe = 10, Je = "#1d2733", Ye = 2, Xe = .05, Ze = "\0", Qe = /* @__PURE__ */ new Map();
356
- function $e() {
355
+ }), Ke = 10, qe = "#1d2733", Je = 2, Ye = .05, Xe = "\0", Ze = /* @__PURE__ */ new Map();
356
+ function Qe() {
357
357
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
358
358
  }
359
- function et(e, t, n, r) {
360
- let i = $e(), a = document.createElement("canvas"), o = a.getContext("2d");
359
+ function $e(e, t, n, r) {
360
+ let i = Qe(), a = document.createElement("canvas"), o = a.getContext("2d");
361
361
  if (!o) throw Error("Could not create grid label canvas context");
362
362
  let s = `400 ${r}px system-ui, "Segoe UI", sans-serif`, c = Math.ceil(r * .5), l = Math.ceil(r * .35);
363
363
  o.font = s;
364
364
  let u = o.measureText(t), d = u.actualBoundingBoxAscent || r * .8, f = u.actualBoundingBoxDescent || r * .2, p = Math.max(1, Math.ceil(u.width + c * 2)), m = Math.max(1, Math.ceil(d + f + l * 2));
365
365
  a.width = Math.ceil(p * i), a.height = Math.ceil(m * i), o.scale(i, i), o.clearRect(0, 0, p, m), o.font = s, o.fillStyle = n, o.textAlign = "left", o.textBaseline = "alphabetic", o.fillText(t, c, l + d);
366
366
  let h = new b(a);
367
- return h.colorSpace = ue, h.generateMipmaps = !1, h.magFilter = M, h.minFilter = M, h.needsUpdate = !0, {
367
+ return h.colorSpace = le, h.generateMipmaps = !1, h.magFilter = j, h.minFilter = j, h.needsUpdate = !0, {
368
368
  disposeTimer: null,
369
369
  height: m,
370
370
  key: e,
@@ -373,49 +373,49 @@ function et(e, t, n, r) {
373
373
  width: p
374
374
  };
375
375
  }
376
- function tt(e, t, n) {
376
+ function et(e, t, n) {
377
377
  let r = [
378
378
  e,
379
379
  t,
380
380
  n
381
- ].join(Ze), i = Qe.get(r);
382
- return i || (i = et(r, e, t, n), Qe.set(r, i)), i;
381
+ ].join(Xe), i = Ze.get(r);
382
+ return i || (i = $e(r, e, t, n), Ze.set(r, i)), i;
383
383
  }
384
- function nt(e, t, n) {
385
- let r = c(() => tt(e, t, n), [
384
+ function tt(e, t, n) {
385
+ let r = c(() => et(e, t, n), [
386
386
  t,
387
387
  n,
388
388
  e
389
389
  ]);
390
390
  return o(() => (r.disposeTimer &&= (clearTimeout(r.disposeTimer), null), r.refs++, () => {
391
391
  r.refs = Math.max(0, r.refs - 1), r.refs <= 0 && (r.disposeTimer = setTimeout(() => {
392
- r.refs > 0 || (r.texture.dispose(), Qe.delete(r.key), r.disposeTimer = null);
392
+ r.refs > 0 || (r.texture.dispose(), Ze.delete(r.key), r.disposeTimer = null);
393
393
  }, 1e3));
394
394
  }), [r]), r;
395
395
  }
396
- function rt(e, t, n, r) {
396
+ function nt(e, t, n, r) {
397
397
  let i = Math.abs(n.projectionMatrix.elements[5]) || 1, a = t.height * 2 / (Math.max(1, r) * i), o = a * (t.width / t.height);
398
398
  e.scale.set(o, a, 1);
399
399
  }
400
- function it(e, t) {
400
+ function rt(e, t) {
401
401
  let n = e[t];
402
402
  return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
403
403
  }
404
- function B(e, t) {
405
- return it(e, t) ?? 0;
404
+ function V(e, t) {
405
+ return rt(e, t) ?? 0;
406
406
  }
407
- function at(e) {
408
- let t = it(e, "x"), n = it(e, "y"), r = it(e, "z");
409
- return t === null || n === null || r === null ? null : new I(t, n, r);
407
+ function it(e) {
408
+ let t = rt(e, "x"), n = rt(e, "y"), r = rt(e, "z");
409
+ return t === null || n === null || r === null ? null : new L(t, n, r);
410
410
  }
411
- function ot(e, t) {
411
+ function at(e, t) {
412
412
  return [
413
- B(e, "x"),
414
- t !== void 0 && Number.isFinite(t) ? t : B(e, "y"),
415
- B(e, "z")
413
+ V(e, "x"),
414
+ t !== void 0 && Number.isFinite(t) ? t : V(e, "y"),
415
+ V(e, "z")
416
416
  ];
417
417
  }
418
- function st(e) {
418
+ function ot(e) {
419
419
  let { h: t, l: n } = e.getHSL({
420
420
  h: 0,
421
421
  s: 0,
@@ -423,14 +423,14 @@ function st(e) {
423
423
  });
424
424
  return t < .55 && n >= .5 || t >= .55 && n >= .75 ? "#000000" : "#ffffff";
425
425
  }
426
- function ct(e) {
426
+ function st(e) {
427
427
  let t = p((e) => e.scene.background);
428
- return c(() => e || (t instanceof x ? st(t) : Je), [t, e]);
428
+ return c(() => e || (t instanceof x ? ot(t) : qe), [t, e]);
429
429
  }
430
- function lt({ axis: e, grid: t, endSide: n, startSide: r }) {
430
+ function ct({ axis: e, grid: t, endSide: n, startSide: r }) {
431
431
  return Object.entries(e).flatMap(([e, i]) => {
432
432
  if (i.length < 2) return [];
433
- let a = at(i[0]), o = at(i[1]);
433
+ let a = it(i[0]), o = it(i[1]);
434
434
  return !a || !o ? [] : (a.y = 0, o.y = 0, [{
435
435
  endSide: n,
436
436
  loc: t.loc,
@@ -440,18 +440,18 @@ function lt({ axis: e, grid: t, endSide: n, startSide: r }) {
440
440
  }]);
441
441
  });
442
442
  }
443
- function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
443
+ function lt({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
444
444
  let o = {
445
445
  bottom: n,
446
446
  left: r,
447
447
  right: i,
448
448
  top: a
449
- }, s = Object.values(t).flatMap((e) => [...lt({
449
+ }, s = Object.values(t).flatMap((e) => [...ct({
450
450
  axis: e.points.u,
451
451
  endSide: "right",
452
452
  grid: e,
453
453
  startSide: "left"
454
- }), ...lt({
454
+ }), ...ct({
455
455
  axis: e.points.v,
456
456
  endSide: "bottom",
457
457
  grid: e,
@@ -464,8 +464,8 @@ function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
464
464
  e.startSide,
465
465
  e.endSide,
466
466
  e.name,
467
- B(e.loc, "x"),
468
- B(e.loc, "z"),
467
+ V(e.loc, "x"),
468
+ V(e.loc, "z"),
469
469
  e.points[0].x,
470
470
  e.points[0].z,
471
471
  e.points[1].x,
@@ -474,57 +474,57 @@ function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
474
474
  c.has(t) || c.set(t, e);
475
475
  }), Array.from(c.values());
476
476
  }
477
- function dt(e, t) {
478
- return new I(...ot(e.loc, t));
477
+ function ut(e, t) {
478
+ return new L(...at(e.loc, t));
479
479
  }
480
- function ft({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
480
+ function dt({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
481
481
  let s = {
482
482
  bottom: r,
483
483
  left: i,
484
484
  right: a,
485
485
  top: o
486
- }, c = dt(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
486
+ }, c = ut(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
487
487
  return p(d) ? d : p(f) ? f : null;
488
488
  }
489
- function pt({ endpoint: e, labelOffset: t, line: n }) {
489
+ function ft({ endpoint: e, labelOffset: t, line: n }) {
490
490
  let r = e === "start" ? n.points[0].clone() : n.points[1].clone(), i = n.points[1].clone().sub(n.points[0]);
491
491
  return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
492
492
  }
493
- function mt(e, t) {
494
- let n = new I(), r = 0;
493
+ function pt(e, t) {
494
+ let n = new L(), r = 0;
495
495
  return e.forEach((e) => {
496
- let i = dt(e, t);
496
+ let i = ut(e, t);
497
497
  e.points.forEach((e) => {
498
498
  n.add(e).add(i), r++;
499
499
  });
500
500
  }), r && n.divideScalar(r), n;
501
501
  }
502
- function ht(e, t, n) {
502
+ function mt(e, t, n) {
503
503
  let r = 0;
504
504
  return e.forEach((e) => {
505
- let i = dt(e, n);
505
+ let i = ut(e, n);
506
506
  e.points.forEach((e) => {
507
507
  r = Math.max(r, e.clone().add(i).distanceTo(t));
508
508
  });
509
509
  }), r;
510
510
  }
511
- function gt({ color: e, fontSize: t, position: n, text: r }) {
512
- let { camera: i, size: a } = p(), s = l(null), c = nt(r, e, t);
511
+ function ht({ color: e, fontSize: t, position: n, text: r }) {
512
+ let { camera: i, size: a } = p(), s = l(null), c = tt(r, e, t);
513
513
  return o(() => {
514
514
  let e = s.current;
515
- e && rt(e, c, i, a.height);
515
+ e && nt(e, c, i, a.height);
516
516
  }, [
517
517
  i,
518
518
  a.height,
519
519
  c
520
520
  ]), f(({ camera: e, size: t }) => {
521
521
  let n = s.current;
522
- n && rt(n, c, e, t.height);
523
- }), /* @__PURE__ */ L("sprite", {
522
+ n && nt(n, c, e, t.height);
523
+ }), /* @__PURE__ */ R("sprite", {
524
524
  ref: s,
525
525
  position: n,
526
526
  renderOrder: 2,
527
- children: /* @__PURE__ */ L("spriteMaterial", {
527
+ children: /* @__PURE__ */ R("spriteMaterial", {
528
528
  alphaTest: .1,
529
529
  depthTest: !0,
530
530
  depthWrite: !1,
@@ -535,8 +535,8 @@ function gt({ color: e, fontSize: t, position: n, text: r }) {
535
535
  })
536
536
  });
537
537
  }
538
- function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: s, showLeft: l, showRight: u, showTop: d }) {
539
- let f = c(() => new y().setFromPoints(a.points), [a.points]), p = ft({
538
+ function gt({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: s, showLeft: l, showRight: u, showTop: d }) {
539
+ let f = c(() => new y().setFromPoints(a.points), [a.points]), p = dt({
540
540
  cameraPosition: e,
541
541
  floorY: n,
542
542
  line: a,
@@ -544,19 +544,19 @@ function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
544
544
  showLeft: l,
545
545
  showRight: u,
546
546
  showTop: d
547
- }), m = p ? pt({
547
+ }), m = p ? ft({
548
548
  endpoint: p,
549
549
  labelOffset: i,
550
550
  line: a
551
551
  }) : null;
552
- return o(() => () => f.dispose(), [f]), /* @__PURE__ */ R("lineSegments", {
552
+ return o(() => () => f.dispose(), [f]), /* @__PURE__ */ z("lineSegments", {
553
553
  geometry: f,
554
- position: ot(a.loc, n),
555
- children: [/* @__PURE__ */ L("lineBasicMaterial", {
554
+ position: at(a.loc, n),
555
+ children: [/* @__PURE__ */ R("lineBasicMaterial", {
556
556
  color: t,
557
557
  depthWrite: !1,
558
558
  linewidth: 2
559
- }), m && /* @__PURE__ */ L(gt, {
559
+ }), m && /* @__PURE__ */ R(ht, {
560
560
  color: t,
561
561
  fontSize: r,
562
562
  position: m,
@@ -564,8 +564,8 @@ function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
564
564
  })]
565
565
  });
566
566
  }
567
- function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i = Ye, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: d = !0, visible: m = !0 }) {
568
- let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new I()), y = ct(e), b = c(() => r ? ut({
567
+ function _t({ color: e, floorY: t, fontSize: n = Ke, grids: r, labelOffset: i = Je, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: d = !0, visible: m = !0 }) {
568
+ let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new L()), y = st(e), b = c(() => r ? lt({
569
569
  flattenToFloor: t !== void 0,
570
570
  grids: r,
571
571
  showBottom: a,
@@ -579,7 +579,7 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
579
579
  o,
580
580
  s,
581
581
  d
582
- ]), x = c(() => mt(b, t), [t, b]), S = c(() => Math.max(i, ht(b, x, t) * .015), [
582
+ ]), x = c(() => pt(b, t), [t, b]), S = c(() => Math.max(i, mt(b, x, t) * .015), [
583
583
  x,
584
584
  t,
585
585
  i,
@@ -589,11 +589,11 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
589
589
  let e = g.current;
590
590
  if (!e) return;
591
591
  let t = h.position.clone();
592
- e.worldToLocal(t), !(t.distanceToSquared(_) < Xe) && v(t);
593
- }), !m || !b.length ? null : /* @__PURE__ */ L("group", {
592
+ e.worldToLocal(t), !(t.distanceToSquared(_) < Ye) && v(t);
593
+ }), !m || !b.length ? null : /* @__PURE__ */ R("group", {
594
594
  ref: g,
595
595
  userData: { modelGrids: !0 },
596
- children: b.map((e) => /* @__PURE__ */ L(_t, {
596
+ children: b.map((e) => /* @__PURE__ */ R(gt, {
597
597
  cameraPosition: _,
598
598
  color: y,
599
599
  floorY: t,
@@ -608,9 +608,9 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
608
608
  e.startSide,
609
609
  e.endSide,
610
610
  e.name,
611
- B(e.loc, "x"),
612
- t ?? B(e.loc, "y"),
613
- B(e.loc, "z"),
611
+ V(e.loc, "x"),
612
+ t ?? V(e.loc, "y"),
613
+ V(e.loc, "z"),
614
614
  e.points[0].x,
615
615
  e.points[0].y,
616
616
  e.points[0].z,
@@ -622,33 +622,33 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
622
622
  }
623
623
  //#endregion
624
624
  //#region src/viewer/Model.tsx
625
- var yt = new N();
626
- function bt(e) {
625
+ var vt = new M();
626
+ function yt(e) {
627
627
  if (!e) return null;
628
628
  try {
629
629
  let t = JSON.parse(e);
630
- return !Array.isArray(t) || t.length !== 16 ? null : new N().fromArray(t);
630
+ return !Array.isArray(t) || t.length !== 16 ? null : new M().fromArray(t);
631
631
  } catch (e) {
632
632
  return console.warn("Model matrix parsing error", e), null;
633
633
  }
634
634
  }
635
- function xt(e) {
636
- return bt(St(e));
635
+ function bt(e) {
636
+ return yt(xt(e));
637
637
  }
638
- function St(e) {
638
+ function xt(e) {
639
639
  return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
640
640
  }
641
- function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
642
- let i = z((e) => e.gridAxesVisibility), a = c(() => {
641
+ function St({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
642
+ let i = B((e) => e.gridAxesVisibility), a = c(() => {
643
643
  if (!r) return {
644
644
  data: [],
645
645
  coordinationMatrix: null,
646
646
  floorY: 0
647
647
  };
648
- let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? xt(r) : null, i = Infinity, a = new I();
648
+ let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? bt(r) : null, i = Infinity, a = new L();
649
649
  return {
650
650
  data: Object.values(r.data).map((e) => {
651
- let t = (bt(e.matrix) ?? new N()).clone().invert(), r = e.mat, o = e.pos;
651
+ let t = (yt(e.matrix) ?? new M()).clone().invert(), r = e.mat, o = e.pos;
652
652
  for (let e = 0; e < o.length; e += 3) a.set(o[e], o[e + 1], o[e + 2]).applyMatrix4(t), Number.isFinite(a.y) && (i = Math.min(i, a.y));
653
653
  return {
654
654
  data: e,
@@ -666,17 +666,17 @@ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
666
666
  r,
667
667
  n
668
668
  ]);
669
- return r ? /* @__PURE__ */ R("group", {
670
- matrix: a.coordinationMatrix ?? yt,
669
+ return r ? /* @__PURE__ */ z("group", {
670
+ matrix: a.coordinationMatrix ?? vt,
671
671
  matrixAutoUpdate: !1,
672
672
  userData: { modelID: n },
673
- children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ L(Ke, {
673
+ children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ R(Ge, {
674
674
  colorPaletteTexture: e,
675
675
  material: i,
676
676
  data: t,
677
677
  isIfcSpace: n,
678
678
  meshMatrix: a
679
- }, r)), /* @__PURE__ */ L(vt, {
679
+ }, r)), /* @__PURE__ */ R(_t, {
680
680
  floorY: a.floorY,
681
681
  grids: r.grids,
682
682
  showBottom: i.bottom,
@@ -685,12 +685,12 @@ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
685
685
  showTop: i.top,
686
686
  visible: i.visible
687
687
  })]
688
- }) : /* @__PURE__ */ L(Ce, {});
688
+ }) : /* @__PURE__ */ R(Se, {});
689
689
  }
690
- var wt = r(Ct);
690
+ var Ct = r(St);
691
691
  //#endregion
692
692
  //#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
693
- function Tt() {
693
+ function wt() {
694
694
  return {
695
695
  elementIndex: /* @__PURE__ */ new Map(),
696
696
  ifcSpacesVisible: !0,
@@ -700,10 +700,10 @@ function Tt() {
700
700
  records: /* @__PURE__ */ new Set()
701
701
  };
702
702
  }
703
- function Et(e) {
703
+ function Tt(e) {
704
704
  return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
705
705
  }
706
- function Dt(e, t, n, r) {
706
+ function Et(e, t, n, r) {
707
707
  let i = n.get(e);
708
708
  if (i) return i;
709
709
  i = {
@@ -713,20 +713,20 @@ function Dt(e, t, n, r) {
713
713
  let a = r.get(e);
714
714
  return a || (a = [], r.set(e, a)), a.push(i), i;
715
715
  }
716
- function Ot(e, t, n, r, i, a) {
717
- n && Dt(e, r, i, a).vertexRanges.push({
716
+ function Dt(e, t, n, r, i, a) {
717
+ n && Et(e, r, i, a).vertexRanges.push({
718
718
  count: n,
719
719
  start: t
720
720
  });
721
721
  }
722
- function kt(e, t, n, r, i, a) {
723
- n && (Dt(e, r, i, a), r.triangleRanges.push({
722
+ function Ot(e, t, n, r, i, a) {
723
+ n && (Et(e, r, i, a), r.triangleRanges.push({
724
724
  count: n,
725
725
  id: e,
726
726
  start: t
727
727
  }));
728
728
  }
729
- function At(e) {
729
+ function kt(e) {
730
730
  let t = e;
731
731
  for (; t;) {
732
732
  let e = t.userData.modelID;
@@ -735,22 +735,22 @@ function At(e) {
735
735
  }
736
736
  return 0;
737
737
  }
738
- function jt(e) {
738
+ function At(e) {
739
739
  return e.name === "space" || e.userData.isIfcSpace === !0;
740
740
  }
741
- function Mt(e) {
742
- let t = l(Tt()), n = i(() => {
741
+ function jt(e) {
742
+ let t = l(wt()), n = i(() => {
743
743
  let n = e.current, r = t.current;
744
744
  if (!n || r.indexedModel === n && r.records.size) return r;
745
745
  let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
746
746
  return n.traverse((e) => {
747
- if (!(e instanceof P)) return;
747
+ if (!(e instanceof N)) return;
748
748
  let t = e, n = t.geometry, r = n.index, o = n.attributes.ids;
749
749
  if (!r || !o) return;
750
- let s = At(t), c = Et(r.array), l = {
750
+ let s = kt(t), c = Tt(r.array), l = {
751
751
  hiddenIds: /* @__PURE__ */ new Set(),
752
752
  initialVisible: t.visible,
753
- isIfcSpace: jt(t),
753
+ isIfcSpace: At(t),
754
754
  mesh: t,
755
755
  modelID: s,
756
756
  originalBoundsTree: n.boundsTree ?? null,
@@ -760,15 +760,15 @@ function Mt(e) {
760
760
  }, u = /* @__PURE__ */ new Map(), d = null, f = 0, p = c.length / 3;
761
761
  for (let e = 0; e < p; e++) {
762
762
  let t = o.getX(c[e * 3]);
763
- d === null ? (d = t, f = e) : t !== d && (kt(d, f, e - f, l, u, i), d = t, f = e);
763
+ d === null ? (d = t, f = e) : t !== d && (Ot(d, f, e - f, l, u, i), d = t, f = e);
764
764
  }
765
- d !== null && kt(d, f, p - f, l, u, i);
765
+ d !== null && Ot(d, f, p - f, l, u, i);
766
766
  let m = null, h = 0;
767
767
  for (let e = 0; e < o.count; e++) {
768
768
  let t = o.getX(e);
769
- m === null ? (m = t, h = e) : t !== m && (Ot(m, h, e - h, l, u, i), m = t, h = e);
769
+ m === null ? (m = t, h = e) : t !== m && (Dt(m, h, e - h, l, u, i), m = t, h = e);
770
770
  }
771
- m !== null && Ot(m, h, o.count - h, l, u, i), a.add(l);
771
+ m !== null && Dt(m, h, o.count - h, l, u, i), a.add(l);
772
772
  }), t.current = {
773
773
  elementIndex: i,
774
774
  ifcSpacesVisible: r.ifcSpacesVisible,
@@ -778,7 +778,7 @@ function Mt(e) {
778
778
  records: a
779
779
  }, t.current;
780
780
  }, [e]), r = i(() => {
781
- t.current = Tt();
781
+ t.current = wt();
782
782
  }, []);
783
783
  return c(() => ({
784
784
  buildIndex: n,
@@ -787,95 +787,95 @@ function Mt(e) {
787
787
  }
788
788
  //#endregion
789
789
  //#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
790
- function Nt(e, t) {
790
+ function Mt(e, t) {
791
791
  return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
792
792
  }
793
- function Pt(e) {
793
+ function Nt(e) {
794
794
  let t = e.geometry;
795
- Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new be(e.geometry, { indirect: !0 }) });
795
+ Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new ye(e.geometry, { indirect: !0 }) });
796
796
  }
797
- function Ft(e, t, n = !0) {
798
- e.mesh.geometry.setIndex(new v(t, 1)), n && Pt(e.mesh);
797
+ function Pt(e, t, n = !0) {
798
+ e.mesh.geometry.setIndex(new v(t, 1)), n && Nt(e.mesh);
799
799
  }
800
- function It(e, t) {
800
+ function Ft(e, t) {
801
801
  return e.initialVisible && (!e.isIfcSpace || t);
802
802
  }
803
- function Lt(e, t) {
803
+ function It(e, t) {
804
804
  let n = e.mesh.geometry, r = n.index?.array;
805
- e.mesh.visible = It(e, t), r !== e.originalIndex && Ft(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (Pt(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
805
+ e.mesh.visible = Ft(e, t), r !== e.originalIndex && Pt(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (Nt(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
806
806
  }
807
- function Rt(e) {
807
+ function Lt(e) {
808
808
  return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
809
809
  }
810
- function zt(e, t, n, r) {
811
- return `h:${Rt(e)}|i:${Rt(n)}|s:${r ? Number(t) : ""}`;
810
+ function Rt(e, t, n, r) {
811
+ return `h:${Lt(e)}|i:${Lt(n)}|s:${r ? Number(t) : ""}`;
812
812
  }
813
- function Bt(e, t, n) {
813
+ function zt(e, t, n) {
814
814
  return !t.has(e) && (!n || n.has(e));
815
815
  }
816
- function Vt(e, t) {
816
+ function Bt(e, t) {
817
817
  Object.entries(e).forEach(([e, n]) => {
818
818
  n.forEach((n) => t(Number(e), n));
819
819
  });
820
820
  }
821
- function Ht(e, t, n) {
821
+ function Vt(e, t, n) {
822
822
  e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
823
823
  }
824
- function V(e, t, n) {
824
+ function H(e, t, n) {
825
825
  e && console.log(`${t}:`, Date.now() - n, "ms");
826
826
  }
827
- function H(e, t, n, r) {
828
- let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = zt(i, t, n, e.isIfcSpace);
827
+ function U(e, t, n, r) {
828
+ let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Rt(i, t, n, e.isIfcSpace);
829
829
  if (e.visibleStateKey === s) return;
830
830
  if (!i.size && !n) {
831
- Lt(e, t), e.visibleStateKey = s;
831
+ It(e, t), e.visibleStateKey = s;
832
832
  return;
833
833
  }
834
834
  let c = 0, l = 0;
835
835
  if (o.forEach(({ count: e, id: t }) => {
836
- Bt(t, i, n) ? c += e * 3 : l += e * 3;
836
+ zt(t, i, n) ? c += e * 3 : l += e * 3;
837
837
  }), !c) {
838
- Lt(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
838
+ It(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
839
839
  return;
840
840
  }
841
841
  if (!l) {
842
- Lt(e, t), e.visibleStateKey = s;
842
+ It(e, t), e.visibleStateKey = s;
843
843
  return;
844
844
  }
845
- e.mesh.visible = It(e, t);
846
- let u = Nt(a, c), d = 0;
845
+ e.mesh.visible = Ft(e, t);
846
+ let u = Mt(a, c), d = 0;
847
847
  for (let e = 0; e < o.length; e++) {
848
848
  let { count: t, id: r, start: s } = o[e];
849
- if (!Bt(r, i, n)) continue;
849
+ if (!zt(r, i, n)) continue;
850
850
  let c = s * 3, l = c + t * 3;
851
851
  u.set(a.subarray(c, l), d), d += t * 3;
852
852
  }
853
- r || (e.originalBoundsTree = null), Ft(e, u), e.visibleStateKey = s;
853
+ r || (e.originalBoundsTree = null), Pt(e, u), e.visibleStateKey = s;
854
854
  }
855
- function U(e, t) {
855
+ function W(e, t) {
856
856
  return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
857
857
  }
858
- function Ut(e) {
859
- let t = z((e) => e.selected), n = z((e) => e.resetSelected), r = z((e) => e.showStats), a = z((e) => e.userDevice) === "pc", o = e.buildIndex, s = i(() => Array.from(o().elementIndex.keys()), [o]), c = i(() => o().ifcSpacesVisible, [o]), l = i((e) => {
858
+ function Ht(e) {
859
+ let t = B((e) => e.selected), n = B((e) => e.resetSelected), r = B((e) => e.showStats), a = B((e) => e.userDevice) === "pc", o = e.buildIndex, s = i(() => Array.from(o().elementIndex.keys()), [o]), c = i(() => o().ifcSpacesVisible, [o]), l = i((e) => {
860
860
  let t = Date.now(), n = o(), i = /* @__PURE__ */ new Set();
861
861
  e.forEach((e) => {
862
862
  let t = n.elementIndex.get(e);
863
863
  t && t.forEach(({ record: t }) => {
864
- Ht(t, e, i);
864
+ Vt(t, e, i);
865
865
  });
866
- }), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "hideByIds", t);
866
+ }), i.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "hideByIds", t);
867
867
  }, [
868
868
  o,
869
869
  a,
870
870
  r
871
871
  ]), u = i(() => {
872
872
  let e = Date.now(), i = o(), s = /* @__PURE__ */ new Set();
873
- Vt(t, (e, t) => {
873
+ Bt(t, (e, t) => {
874
874
  let n = i.elementIndex.get(t);
875
875
  n && n.forEach(({ record: n }) => {
876
- n.modelID === e && Ht(n, t, s);
876
+ n.modelID === e && Vt(n, t, s);
877
877
  });
878
- }), s.forEach((e) => H(e, i.ifcSpacesVisible, U(i, e), a)), n(), V(r, "hideSelected", e);
878
+ }), s.forEach((e) => U(e, i.ifcSpacesVisible, W(i, e), a)), n(), H(r, "hideSelected", e);
879
879
  }, [
880
880
  o,
881
881
  a,
@@ -889,24 +889,24 @@ function Ut(e) {
889
889
  t && t.forEach(({ record: t }) => {
890
890
  t.hiddenIds.delete(e) && i.add(t);
891
891
  });
892
- }), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "showByIds", t);
892
+ }), i.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "showByIds", t);
893
893
  }, [
894
894
  o,
895
895
  a,
896
896
  r
897
897
  ]), f = i((e) => {
898
898
  let t = Date.now(), n = o();
899
- n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateByIds", t);
899
+ n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "isolateByIds", t);
900
900
  }, [
901
901
  o,
902
902
  a,
903
903
  r
904
904
  ]), p = i(() => {
905
905
  let e = Date.now(), n = o(), i = /* @__PURE__ */ new Map();
906
- Vt(t, (e, t) => {
906
+ Bt(t, (e, t) => {
907
907
  let n = i.get(e);
908
908
  n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
909
- }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateSelected", e);
909
+ }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "isolateSelected", e);
910
910
  }, [
911
911
  o,
912
912
  a,
@@ -914,7 +914,7 @@ function Ut(e) {
914
914
  r
915
915
  ]), m = i(() => {
916
916
  let e = Date.now(), t = o();
917
- t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => H(e, t.ifcSpacesVisible, U(t, e), a)), V(r, "resetIsolation", e);
917
+ t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => U(e, t.ifcSpacesVisible, W(t, e), a)), H(r, "resetIsolation", e);
918
918
  }, [
919
919
  o,
920
920
  a,
@@ -922,7 +922,7 @@ function Ut(e) {
922
922
  ]), h = i((e) => {
923
923
  let t = o();
924
924
  t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
925
- e.isIfcSpace && H(e, t.ifcSpacesVisible, U(t, e), a);
925
+ e.isIfcSpace && U(e, t.ifcSpacesVisible, W(t, e), a);
926
926
  }));
927
927
  }, [o, a]), g = i(() => {
928
928
  h(!c());
@@ -940,8 +940,8 @@ function Ut(e) {
940
940
  showAll: i(() => {
941
941
  let e = Date.now(), t = o();
942
942
  t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
943
- e.hiddenIds.clear(), H(e, t.ifcSpacesVisible, U(t, e), a);
944
- }), V(r, "showAll", e);
943
+ e.hiddenIds.clear(), U(e, t.ifcSpacesVisible, W(t, e), a);
944
+ }), H(r, "showAll", e);
945
945
  }, [
946
946
  o,
947
947
  a,
@@ -953,49 +953,49 @@ function Ut(e) {
953
953
  }
954
954
  //#endregion
955
955
  //#region src/viewer/utils/ClippingUtils/ClippingEdges.ts
956
- var Wt = 1024, Gt = -1e-5;
957
- function Kt(e) {
956
+ var Ut = 1024, Wt = -1e-5;
957
+ function Gt(e) {
958
958
  let t = new v(new Float32Array(e * 3), 3, !1);
959
959
  return t.setUsage(T), t;
960
960
  }
961
- function qt(e) {
961
+ function Kt(e) {
962
962
  return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
963
963
  }
964
- function Jt(e, t) {
965
- let n = new y(), r = Math.ceil(Math.min(Math.max(Wt, qt(t) * .05), 32768));
966
- n.setAttribute("position", Kt(r)), n.setDrawRange(0, 0);
967
- let i = new j(n, e);
964
+ function qt(e, t) {
965
+ let n = new y(), r = Math.ceil(Math.min(Math.max(Ut, Kt(t) * .05), 32768));
966
+ n.setAttribute("position", Gt(r)), n.setDrawRange(0, 0);
967
+ let i = new te(n, e);
968
968
  return i.frustumCulled = !1, i.renderOrder = 1, i.visible = !1, i;
969
969
  }
970
- function Yt(e, t) {
970
+ function Jt(e, t) {
971
971
  let n = e.geometry.getAttribute("position");
972
972
  if (n.count > t) return n;
973
- let r = Kt(Math.max(n.count * 2, t + 1));
973
+ let r = Gt(Math.max(n.count * 2, t + 1));
974
974
  return r.array.set(n.array), e.geometry.setAttribute("position", r), n = r, n;
975
975
  }
976
- function Xt(e) {
976
+ function Yt(e) {
977
977
  return e.filter((e) => e.parent && e.geometry.index?.count);
978
978
  }
979
- var Zt = class {
979
+ var Xt = class {
980
980
  active;
981
981
  material;
982
982
  plane;
983
983
  context;
984
984
  lines = /* @__PURE__ */ new Map();
985
- inverseMatrix = new N();
986
- localPlane = new ce();
987
- tempLine = new k();
988
- tempVector = new I();
989
- tempVector1 = new I();
990
- tempVector2 = new I();
991
- tempVector3 = new I();
985
+ inverseMatrix = new M();
986
+ localPlane = new se();
987
+ tempLine = new O();
988
+ tempVector = new L();
989
+ tempVector1 = new L();
990
+ tempVector2 = new L();
991
+ tempVector3 = new L();
992
992
  constructor(e, t) {
993
993
  this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
994
994
  let n = e.material.clippingPlanes ?? [];
995
995
  e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
996
996
  });
997
997
  let n = e.planes.filter((e) => e !== t);
998
- this.material = new A({
998
+ this.material = new k({
999
999
  clippingPlanes: n,
1000
1000
  color: "black",
1001
1001
  depthTest: !0,
@@ -1006,12 +1006,12 @@ var Zt = class {
1006
1006
  return this.syncMeshes(), Array.from(this.lines.values());
1007
1007
  }
1008
1008
  syncMeshes() {
1009
- let e = new Set(Xt(this.context.getMeshes()));
1009
+ let e = new Set(Yt(this.context.getMeshes()));
1010
1010
  this.lines.forEach((t, n) => {
1011
1011
  e.has(n) || (t.removeFromParent(), t.geometry.dispose(), this.lines.delete(n));
1012
1012
  }), e.forEach((e) => {
1013
1013
  if (this.lines.has(e)) return;
1014
- let t = Jt(this.material, e);
1014
+ let t = qt(this.material, e);
1015
1015
  e.add(t), this.lines.set(e, t);
1016
1016
  }), this.setVisible(this.active);
1017
1017
  }
@@ -1037,7 +1037,7 @@ var Zt = class {
1037
1037
  }
1038
1038
  t.updateWorldMatrix(!0, !1), this.inverseMatrix.copy(t.matrixWorld).invert(), this.localPlane.copy(this.plane).applyMatrix4(this.inverseMatrix);
1039
1039
  let r = 0, i = e.geometry.getAttribute("position"), a = (t) => {
1040
- i = Yt(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1040
+ i = Jt(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1041
1041
  };
1042
1042
  n.shapecast({
1043
1043
  intersectsBounds: (e) => this.localPlane.intersectsBox(e),
@@ -1045,19 +1045,19 @@ var Zt = class {
1045
1045
  let t = 0;
1046
1046
  this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), this.tempLine.start.copy(e.b), this.tempLine.end.copy(e.c), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), this.tempLine.start.copy(e.c), this.tempLine.end.copy(e.a), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), t === 3 && (this.tempVector1.fromBufferAttribute(i, r - 3), this.tempVector2.fromBufferAttribute(i, r - 2), this.tempVector3.fromBufferAttribute(i, r - 1), this.tempVector3.equals(this.tempVector1) || this.tempVector3.equals(this.tempVector2) ? (t--, r--) : this.tempVector1.equals(this.tempVector2) && (i.setXYZ(r - 2, this.tempVector3.x, this.tempVector3.y, this.tempVector3.z), t--, r--)), t !== 2 && (r -= t);
1047
1047
  }
1048
- }), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Gt), i.needsUpdate = !0;
1048
+ }), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Wt), i.needsUpdate = !0;
1049
1049
  }));
1050
1050
  }
1051
- }, Qt = "#0b2f5f", $t = "#0b2f5f", en = 0, tn = "#1f7ae0", nn = .22, rn = .01, an = .025, on = .015, sn = .25, cn = .15, ln = .25, W = 1;
1052
- function un(e, t) {
1051
+ }, Zt = "#0b2f5f", Qt = "#0b2f5f", $t = 0, en = "#1f7ae0", tn = .22, nn = .01, rn = .025, an = .015, on = .25, sn = .15, cn = .25, G = 1;
1052
+ function ln(e, t) {
1053
1053
  let n = t.getBoundingClientRect();
1054
- return new F((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1054
+ return new I((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1055
1055
  }
1056
- function dn(e) {
1057
- let t = e.getSize(new I());
1058
- return Math.max(ln, t.length() * rn);
1056
+ function un(e) {
1057
+ let t = e.getSize(new L());
1058
+ return Math.max(cn, t.length() * nn);
1059
1059
  }
1060
- var fn = class extends ae {
1060
+ var dn = class extends ie {
1061
1061
  helper = new D();
1062
1062
  borderMaterial;
1063
1063
  material;
@@ -1068,22 +1068,22 @@ var fn = class extends ae {
1068
1068
  location;
1069
1069
  normal;
1070
1070
  planeMesh;
1071
- pointer = new F();
1071
+ pointer = new I();
1072
1072
  layout;
1073
1073
  dragState = null;
1074
1074
  hovered = !1;
1075
1075
  listenersActive = !1;
1076
1076
  constructor(e, t, n, r) {
1077
- super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new ne({
1078
- color: $t,
1077
+ super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new P({
1078
+ color: Qt,
1079
1079
  depthWrite: !1,
1080
- opacity: en,
1080
+ opacity: $t,
1081
1081
  side: w,
1082
1082
  transparent: !0
1083
1083
  }), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
1084
- let i = Math.max(sn, Math.min(this.layout.width, this.layout.height) * an), a = Math.max(cn, Math.min(this.layout.width, this.layout.height) * on);
1085
- this.borderMaterial = new ee({
1086
- color: Qt,
1084
+ let i = Math.max(on, Math.min(this.layout.width, this.layout.height) * rn), a = Math.max(sn, Math.min(this.layout.width, this.layout.height) * an);
1085
+ this.borderMaterial = new A({
1086
+ color: Zt,
1087
1087
  dashSize: i,
1088
1088
  depthWrite: !1,
1089
1089
  gapSize: a
@@ -1114,7 +1114,7 @@ var fn = class extends ae {
1114
1114
  }
1115
1115
  updateBorderDash() {
1116
1116
  let e = Math.min(this.layout.width, this.layout.height);
1117
- this.borderMaterial.dashSize = Math.max(sn, e * an), this.borderMaterial.gapSize = Math.max(cn, e * on), this.borderMaterial.needsUpdate = !0;
1117
+ this.borderMaterial.dashSize = Math.max(on, e * rn), this.borderMaterial.gapSize = Math.max(sn, e * an), this.borderMaterial.needsUpdate = !0;
1118
1118
  }
1119
1119
  addEventListeners() {
1120
1120
  if (this.listenersActive) return;
@@ -1149,15 +1149,15 @@ var fn = class extends ae {
1149
1149
  hasModelIntersection(e) {
1150
1150
  return !!this.context.getCameraUtils().getIntersection(!0, {
1151
1151
  event: e,
1152
- filter: (e) => !(e.object instanceof P) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1152
+ filter: (e) => !(e.object instanceof N) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1153
1153
  object: this.context.getMeshes(),
1154
1154
  recursive: !1
1155
1155
  });
1156
1156
  }
1157
1157
  getPointerPointOnPlane(e, t) {
1158
1158
  let n = this.context.getDomElement();
1159
- this.pointer.copy(un(e, n));
1160
- let r = this.context.getRaycaster(), i = new I();
1159
+ this.pointer.copy(ln(e, n));
1160
+ let r = this.context.getRaycaster(), i = new L();
1161
1161
  return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
1162
1162
  }
1163
1163
  onPointerDown = (e) => {
@@ -1169,9 +1169,9 @@ var fn = class extends ae {
1169
1169
  let t = this.getPointerIntersection(e);
1170
1170
  if (!t) return;
1171
1171
  e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), this.context.clearHelpersHover(this), this.setHovered(!0), this.context.setHelperDragActive(!0), this.context.setSelectionInteractionDisabled(!0);
1172
- let n = new I();
1172
+ let n = new L();
1173
1173
  this.context.getCamera().getWorldDirection(n), n.normalize();
1174
- let r = new ce().setFromNormalAndCoplanarPoint(n, t.point);
1174
+ let r = new se().setFromNormalAndCoplanarPoint(n, t.point);
1175
1175
  this.dragState = {
1176
1176
  dragPlane: r,
1177
1177
  helperStart: this.helper.position.clone(),
@@ -1213,14 +1213,14 @@ var fn = class extends ae {
1213
1213
  this.hovered !== t && this.setHovered(t);
1214
1214
  }
1215
1215
  setHovered(e) {
1216
- this.hovered = e, this.material.color.set(e ? tn : $t), this.material.opacity = e ? nn : en, this.material.needsUpdate = !0;
1216
+ this.hovered = e, this.material.color.set(e ? en : Qt), this.material.opacity = e ? tn : $t, this.material.needsUpdate = !0;
1217
1217
  }
1218
1218
  createPlaneMesh() {
1219
- let e = new P(new y(), this.material);
1219
+ let e = new N(new y(), this.material);
1220
1220
  return e.renderOrder = 2, e;
1221
1221
  }
1222
1222
  createBorder() {
1223
- let e = new j(new y(), this.borderMaterial);
1223
+ let e = new te(new y(), this.borderMaterial);
1224
1224
  return e.renderOrder = 3, e;
1225
1225
  }
1226
1226
  replaceGeometry(e, t) {
@@ -1289,27 +1289,27 @@ var fn = class extends ae {
1289
1289
  getHelperLayout() {
1290
1290
  let e = this.getModelWorldBox();
1291
1291
  if (!e || e.isEmpty()) return {
1292
- height: W,
1293
- maxU: W / 2,
1294
- maxV: W / 2,
1295
- minU: -W / 2,
1296
- minV: -W / 2,
1297
- width: W
1292
+ height: G,
1293
+ maxU: G / 2,
1294
+ maxV: G / 2,
1295
+ minU: -G / 2,
1296
+ minV: -G / 2,
1297
+ width: G
1298
1298
  };
1299
- let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new I(), a = new I(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
1299
+ let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new L(), a = new L(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
1300
1300
  if (r.forEach((e) => {
1301
1301
  this.plane.projectPoint(e, i), a.copy(i).sub(n);
1302
1302
  let r = a.dot(t.u), u = a.dot(t.v);
1303
1303
  o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
1304
1304
  }), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
1305
- height: W,
1306
- maxU: W / 2,
1307
- maxV: W / 2,
1308
- minU: -W / 2,
1309
- minV: -W / 2,
1310
- width: W
1305
+ height: G,
1306
+ maxU: G / 2,
1307
+ maxV: G / 2,
1308
+ minU: -G / 2,
1309
+ minV: -G / 2,
1310
+ width: G
1311
1311
  };
1312
- let u = dn(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(W, f - d), g = Math.max(W, m - p), _ = (d + f) / 2, v = (p + m) / 2;
1312
+ let u = un(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(G, f - d), g = Math.max(G, m - p), _ = (d + f) / 2, v = (p + m) / 2;
1313
1313
  return {
1314
1314
  height: g,
1315
1315
  maxU: _ + h / 2,
@@ -1320,14 +1320,14 @@ var fn = class extends ae {
1320
1320
  };
1321
1321
  }
1322
1322
  getPlaneBasis() {
1323
- let e = (Math.abs(this.normal.y) < .9 ? new I(0, 1, 0) : new I(1, 0, 0)).cross(this.normal).normalize();
1323
+ let e = (Math.abs(this.normal.y) < .9 ? new L(0, 1, 0) : new L(1, 0, 0)).cross(this.normal).normalize();
1324
1324
  return {
1325
1325
  u: e,
1326
1326
  v: this.normal.clone().cross(e).normalize()
1327
1327
  };
1328
1328
  }
1329
1329
  applyPlaneOrientation() {
1330
- let e = this.getPlaneBasis(), t = new N().makeBasis(e.u, e.v, this.normal);
1330
+ let e = this.getPlaneBasis(), t = new M().makeBasis(e.u, e.v, this.normal);
1331
1331
  this.helper.quaternion.setFromRotationMatrix(t);
1332
1332
  }
1333
1333
  getModelWorldBox() {
@@ -1340,20 +1340,20 @@ var fn = class extends ae {
1340
1340
  }
1341
1341
  getBoxCorners(e) {
1342
1342
  return [
1343
- new I(e.min.x, e.min.y, e.min.z),
1344
- new I(e.min.x, e.min.y, e.max.z),
1345
- new I(e.min.x, e.max.y, e.min.z),
1346
- new I(e.min.x, e.max.y, e.max.z),
1347
- new I(e.max.x, e.min.y, e.min.z),
1348
- new I(e.max.x, e.min.y, e.max.z),
1349
- new I(e.max.x, e.max.y, e.min.z),
1350
- new I(e.max.x, e.max.y, e.max.z)
1343
+ new L(e.min.x, e.min.y, e.min.z),
1344
+ new L(e.min.x, e.min.y, e.max.z),
1345
+ new L(e.min.x, e.max.y, e.min.z),
1346
+ new L(e.min.x, e.max.y, e.max.z),
1347
+ new L(e.max.x, e.min.y, e.min.z),
1348
+ new L(e.max.x, e.min.y, e.max.z),
1349
+ new L(e.max.x, e.max.y, e.min.z),
1350
+ new L(e.max.x, e.max.y, e.max.z)
1351
1351
  ];
1352
1352
  }
1353
1353
  };
1354
1354
  //#endregion
1355
1355
  //#region src/viewer/utils/ClippingUtils/ClippingUtils.ts
1356
- function pn(e, t) {
1356
+ function fn(e, t) {
1357
1357
  if (Array.isArray(e)) {
1358
1358
  e.forEach((e) => {
1359
1359
  e.clippingPlanes = t, e.needsUpdate = !0;
@@ -1362,13 +1362,13 @@ function pn(e, t) {
1362
1362
  }
1363
1363
  e.clippingPlanes = t, e.needsUpdate = !0;
1364
1364
  }
1365
- function mn(e) {
1365
+ function pn(e) {
1366
1366
  let t = [];
1367
1367
  return e?.traverse((e) => {
1368
- e instanceof P && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1368
+ e instanceof N && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1369
1369
  }), t;
1370
1370
  }
1371
- function hn(e) {
1371
+ function mn(e) {
1372
1372
  let t = e;
1373
1373
  for (; t;) {
1374
1374
  let e = t.userData.modelID;
@@ -1377,10 +1377,10 @@ function hn(e) {
1377
1377
  }
1378
1378
  return 0;
1379
1379
  }
1380
- function gn(e, t) {
1380
+ function hn(e, t) {
1381
1381
  return t.clone().transformDirection(e.matrixWorld).normalize();
1382
1382
  }
1383
- var _n = class {
1383
+ var gn = class {
1384
1384
  planes = [];
1385
1385
  edges = [];
1386
1386
  helpers = [];
@@ -1429,7 +1429,7 @@ var _n = class {
1429
1429
  return this.context.controlRef;
1430
1430
  }
1431
1431
  getMeshes() {
1432
- return mn(this.context.modelRef.current);
1432
+ return pn(this.context.modelRef.current);
1433
1433
  }
1434
1434
  getHelperHoverIsMoving() {
1435
1435
  return this.helperHoverMoveState !== "end" && this.helperHoverMoveState !== "start";
@@ -1463,9 +1463,9 @@ var _n = class {
1463
1463
  }), e.isEmpty() ? null : e;
1464
1464
  }
1465
1465
  getSelectedWorldBox() {
1466
- let e = this.context.viewerStore.getState().selected, t = new g(), n = new I();
1466
+ let e = this.context.viewerStore.getState().selected, t = new g(), n = new L();
1467
1467
  return this.getMeshes().forEach((r) => {
1468
- let i = e[hn(r)];
1468
+ let i = e[mn(r)];
1469
1469
  if (!i?.size) return;
1470
1470
  let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
1471
1471
  if (!a || !o) return;
@@ -1484,7 +1484,7 @@ var _n = class {
1484
1484
  updateMaterials() {
1485
1485
  let e = this.active ? this.planes : [];
1486
1486
  this.getMeshes().forEach((t) => {
1487
- pn(t.material, e);
1487
+ fn(t.material, e);
1488
1488
  }), this.context.camera.updateMatrixWorld();
1489
1489
  }
1490
1490
  setActive(e) {
@@ -1503,42 +1503,42 @@ var _n = class {
1503
1503
  recursive: !1
1504
1504
  });
1505
1505
  if (!n?.face) return null;
1506
- let r = n.point.clone(), i = gn(n.object, n.face.normal);
1506
+ let r = n.point.clone(), i = hn(n.object, n.face.normal);
1507
1507
  r.add(i.clone().multiplyScalar(.001));
1508
- let a = new ce().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1508
+ let a = new se().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1509
1509
  return this.addPlane(a, r, i), a.clone();
1510
1510
  }
1511
1511
  createClippingRectangle(e = !1) {
1512
1512
  let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
1513
1513
  if (!t) return [];
1514
- let n = dn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new I()), o = [
1514
+ let n = un(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new L()), o = [
1515
1515
  {
1516
- normal: new I(1, 0, 0),
1517
- point: new I(r.x, a.y, a.z)
1516
+ normal: new L(1, 0, 0),
1517
+ point: new L(r.x, a.y, a.z)
1518
1518
  },
1519
1519
  {
1520
- normal: new I(-1, 0, 0),
1521
- point: new I(i.x, a.y, a.z)
1520
+ normal: new L(-1, 0, 0),
1521
+ point: new L(i.x, a.y, a.z)
1522
1522
  },
1523
1523
  {
1524
- normal: new I(0, 1, 0),
1525
- point: new I(a.x, r.y, a.z)
1524
+ normal: new L(0, 1, 0),
1525
+ point: new L(a.x, r.y, a.z)
1526
1526
  },
1527
1527
  {
1528
- normal: new I(0, -1, 0),
1529
- point: new I(a.x, i.y, a.z)
1528
+ normal: new L(0, -1, 0),
1529
+ point: new L(a.x, i.y, a.z)
1530
1530
  },
1531
1531
  {
1532
- normal: new I(0, 0, 1),
1533
- point: new I(a.x, a.y, r.z)
1532
+ normal: new L(0, 0, 1),
1533
+ point: new L(a.x, a.y, r.z)
1534
1534
  },
1535
1535
  {
1536
- normal: new I(0, 0, -1),
1537
- point: new I(a.x, a.y, i.z)
1536
+ normal: new L(0, 0, -1),
1537
+ point: new L(a.x, a.y, i.z)
1538
1538
  }
1539
1539
  ].map(({ normal: e, point: t }) => ({
1540
1540
  normal: e,
1541
- plane: new ce().setFromNormalAndCoplanarPoint(e, t),
1541
+ plane: new se().setFromNormalAndCoplanarPoint(e, t),
1542
1542
  point: t
1543
1543
  }));
1544
1544
  return o.forEach(({ normal: e, plane: t, point: n }) => {
@@ -1546,8 +1546,8 @@ var _n = class {
1546
1546
  }), this.updateHelpers(), o.map(({ plane: e }) => e.clone());
1547
1547
  }
1548
1548
  addPlane(e, t, n) {
1549
- if (this.active || this.setActive(!0), this.planes.push(e), new fn(this, e, t, n), this.updateHelpers(), this.updateMaterials(), this.edgesActive) {
1550
- let t = new Zt(this, e);
1549
+ if (this.active || this.setActive(!0), this.planes.push(e), new dn(this, e, t, n), this.updateHelpers(), this.updateMaterials(), this.edgesActive) {
1550
+ let t = new Xt(this, e);
1551
1551
  t.create(), t.update();
1552
1552
  }
1553
1553
  }
@@ -1559,7 +1559,7 @@ var _n = class {
1559
1559
  }
1560
1560
  setEdgesActive(e) {
1561
1561
  this.edgesActive !== e && (this.edgesActive = e, e && this.edges.length !== this.planes.length && (this.edges.forEach((e) => e.dispose()), this.edges = [], this.planes.forEach((e) => {
1562
- let t = new Zt(this, e);
1562
+ let t = new Xt(this, e);
1563
1563
  t.create(), t.update();
1564
1564
  })), this.edges.forEach((t) => t.setVisible(this.active && e)));
1565
1565
  }
@@ -1586,8 +1586,8 @@ var _n = class {
1586
1586
  this.deleteAllPlanes();
1587
1587
  }
1588
1588
  };
1589
- function vn(e, t, n) {
1590
- let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l = Ee(), u = c(() => new _n({
1589
+ function _n(e, t, n) {
1590
+ let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l = Te(), u = c(() => new gn({
1591
1591
  camera: r,
1592
1592
  cameraUtils: n,
1593
1593
  controlRef: t,
@@ -1657,28 +1657,28 @@ function vn(e, t, n) {
1657
1657
  }
1658
1658
  //#endregion
1659
1659
  //#region src/viewer/utils/DimentionsUtils/DimentionLine.ts
1660
- var yn = 12, bn = 6, xn = 4;
1661
- function Sn() {
1660
+ var vn = 12, yn = 6, bn = 4;
1661
+ function xn() {
1662
1662
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
1663
1663
  }
1664
- function Cn(e, t) {
1665
- return e instanceof oe ? (e.top - e.bottom) / e.zoom : e instanceof se ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
1664
+ function Sn(e, t) {
1665
+ return e instanceof ae ? (e.top - e.bottom) / e.zoom : e instanceof oe ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
1666
1666
  }
1667
- function wn(e) {
1668
- let t = Sn(), n = document.createElement("canvas"), r = n.getContext("2d");
1667
+ function Cn(e) {
1668
+ let t = xn(), n = document.createElement("canvas"), r = n.getContext("2d");
1669
1669
  if (!r) throw Error("Could not create dimension label canvas context");
1670
- let i = `600 ${yn}px system-ui, "Segoe UI", sans-serif`;
1670
+ let i = `600 ${vn}px system-ui, "Segoe UI", sans-serif`;
1671
1671
  r.font = i;
1672
- let a = r.measureText(e), o = a.actualBoundingBoxAscent || yn * .8, s = a.actualBoundingBoxDescent || yn * .2, c = Math.max(1, Math.ceil(a.width + bn * 2)), l = Math.max(1, Math.ceil(o + s + xn * 2));
1672
+ let a = r.measureText(e), o = a.actualBoundingBoxAscent || vn * .8, s = a.actualBoundingBoxDescent || vn * .2, c = Math.max(1, Math.ceil(a.width + yn * 2)), l = Math.max(1, Math.ceil(o + s + bn * 2));
1673
1673
  n.width = Math.ceil(c * t), n.height = Math.ceil(l * t), r.scale(t, t), r.clearRect(0, 0, c, l), r.fillStyle = "rgba(255, 255, 255, 0.86)", r.strokeStyle = "rgba(29, 39, 51, 0.22)", r.lineWidth = 1, r.beginPath(), r.roundRect(.5, .5, c - 1, l - 1, 4), r.fill(), r.stroke(), r.font = i, r.fillStyle = "#111827", r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, c / 2, l / 2);
1674
1674
  let u = new b(n);
1675
- return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
1675
+ return u.colorSpace = le, u.generateMipmaps = !1, u.magFilter = j, u.minFilter = j, u.needsUpdate = !0, {
1676
1676
  height: l,
1677
1677
  texture: u,
1678
1678
  width: c
1679
1679
  };
1680
1680
  }
1681
- var Tn = class e {
1681
+ var wn = class e {
1682
1682
  static scale = 1;
1683
1683
  static scaleFactor = .015;
1684
1684
  static units = "m";
@@ -1708,7 +1708,7 @@ var Tn = class e {
1708
1708
  this.end.x,
1709
1709
  this.end.y,
1710
1710
  this.end.z
1711
- ], 3)), this.line = new O(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
1711
+ ], 3)), this.line = new ee(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
1712
1712
  }
1713
1713
  get length() {
1714
1714
  return this.start.distanceTo(this.end);
@@ -1750,11 +1750,11 @@ var Tn = class e {
1750
1750
  this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
1751
1751
  }
1752
1752
  addEndpointMesh(e, t) {
1753
- let n = new P(this.endpointGeometry, this.endpointMaterial);
1753
+ let n = new N(this.endpointGeometry, this.endpointMaterial);
1754
1754
  n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
1755
1755
  }
1756
1756
  createLabelSprite() {
1757
- let e = new pe(new me({
1757
+ let e = new fe(new pe({
1758
1758
  depthTest: !1,
1759
1759
  depthWrite: !1,
1760
1760
  transparent: !0
@@ -1762,7 +1762,7 @@ var Tn = class e {
1762
1762
  return e.renderOrder = 5, e;
1763
1763
  }
1764
1764
  createBoundingBoxMesh() {
1765
- let e = new P(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1765
+ let e = new N(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1766
1766
  return e.renderOrder = 3, e;
1767
1767
  }
1768
1768
  getTextContent() {
@@ -1773,7 +1773,7 @@ var Tn = class e {
1773
1773
  let e = this.getTextContent();
1774
1774
  if (this.labelText === e) return;
1775
1775
  this.labelText = e, this.labelTexture?.dispose();
1776
- let t = wn(e);
1776
+ let t = Cn(e);
1777
1777
  this.labelHeight = t.height, this.labelTexture = t.texture, this.labelWidth = t.width, this.labelSprite.material.map = t.texture, this.labelSprite.material.needsUpdate = !0;
1778
1778
  }
1779
1779
  updatePositions() {
@@ -1784,37 +1784,37 @@ var Tn = class e {
1784
1784
  this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new _(1, 1, Math.max(this.length, .001)));
1785
1785
  }
1786
1786
  rescaleMesh(t, n, r) {
1787
- let i = Cn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1787
+ let i = Sn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1788
1788
  t.scale.setScalar(i);
1789
1789
  }
1790
1790
  rescaleBoundingMesh(e, t) {
1791
1791
  if (!this.boundingMesh) return;
1792
- let n = Cn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1792
+ let n = Sn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1793
1793
  this.boundingMesh.scale.set(n, n, 1);
1794
1794
  }
1795
1795
  rescaleLabel(e, t) {
1796
- let n = Cn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
1796
+ let n = Sn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
1797
1797
  this.labelSprite.scale.set(i, r, 1);
1798
1798
  }
1799
- }, En = "#111827", Dn = 1, On = "x";
1800
- function kn(e) {
1799
+ }, Tn = "#111827", En = 1, Dn = "x";
1800
+ function On(e) {
1801
1801
  let t = [];
1802
1802
  return e?.traverse((e) => {
1803
- e instanceof P && e.geometry.attributes.position && t.push(e);
1803
+ e instanceof N && e.geometry.attributes.position && t.push(e);
1804
1804
  }), t;
1805
1805
  }
1806
- function An(e, t, n) {
1806
+ function kn(e, t, n) {
1807
1807
  let r = e.clone();
1808
1808
  return r[n] = t[n], r;
1809
1809
  }
1810
- function jn(e, t) {
1810
+ function An(e, t) {
1811
1811
  let n = Math.hypot(t.y - e.y, t.z - e.z), r = Math.hypot(t.x - e.x, t.z - e.z), i = Math.hypot(t.x - e.x, t.y - e.y), a = Math.min(n, r, i);
1812
1812
  return a === n ? "x" : a === r ? "y" : "z";
1813
1813
  }
1814
- var Mn = class e {
1814
+ var jn = class e {
1815
1815
  active = !1;
1816
1816
  axis = null;
1817
- boundingMaterial = new ne({
1817
+ boundingMaterial = new P({
1818
1818
  color: 0,
1819
1819
  depthTest: !1,
1820
1820
  depthWrite: !1,
@@ -1825,14 +1825,14 @@ var Mn = class e {
1825
1825
  currentDimension = null;
1826
1826
  dimensions = [];
1827
1827
  endpointGeometry = e.createEndpointGeometry();
1828
- endpointMaterial = new ne({
1829
- color: En,
1828
+ endpointMaterial = new P({
1829
+ color: Tn,
1830
1830
  depthTest: !1,
1831
1831
  depthWrite: !1
1832
1832
  });
1833
- endpointScale = new I(1, 1, 1);
1834
- lineMaterial = new ee({
1835
- color: En,
1833
+ endpointScale = new L(1, 1, 1);
1834
+ lineMaterial = new A({
1835
+ color: Tn,
1836
1836
  dashSize: .2,
1837
1837
  depthTest: !1,
1838
1838
  depthWrite: !1,
@@ -1840,14 +1840,14 @@ var Mn = class e {
1840
1840
  });
1841
1841
  measureInProcess = !1;
1842
1842
  moveState = "end";
1843
- previewMarker = new P(e.createPreviewGeometry(), new ne({
1843
+ previewMarker = new N(e.createPreviewGeometry(), new P({
1844
1844
  color: 0,
1845
1845
  depthTest: !1,
1846
1846
  depthWrite: !1
1847
1847
  }));
1848
1848
  root = new D();
1849
- snapDistance = Dn;
1850
- startPoint = new I();
1849
+ snapDistance = En;
1850
+ startPoint = new L();
1851
1851
  unit = "m";
1852
1852
  constructor(e) {
1853
1853
  this.context = e, this.root.name = "BimatterDimensions", this.previewMarker.renderOrder = 5, this.previewMarker.visible = !1, this.root.add(this.previewMarker), this.context.scene.add(this.root);
@@ -1880,13 +1880,13 @@ var Mn = class e {
1880
1880
  });
1881
1881
  }
1882
1882
  setEndpointScaleFactor(e) {
1883
- !Number.isFinite(e) || e <= 0 || (Tn.scaleFactor = e);
1883
+ !Number.isFinite(e) || e <= 0 || (wn.scaleFactor = e);
1884
1884
  }
1885
1885
  setSnapDistance(e) {
1886
1886
  !Number.isFinite(e) || e < 0 || (this.snapDistance = e);
1887
1887
  }
1888
1888
  setUnit(e) {
1889
- this.unit = e, Tn.units = e, Tn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1889
+ this.unit = e, wn.units = e, wn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1890
1890
  e.endPoint = e.end;
1891
1891
  }), this.currentDimension && (this.currentDimension.endPoint = this.currentDimension.end);
1892
1892
  }
@@ -1912,7 +1912,7 @@ var Mn = class e {
1912
1912
  changeAxes() {
1913
1913
  if (!this.measureInProcess || !this.currentDimension) return;
1914
1914
  let e = this.currentDimension.end, t = this.getNextAxis();
1915
- this.axis = t, this.currentDimension.endPoint = An(this.startPoint, e, t);
1915
+ this.axis = t, this.currentDimension.endPoint = kn(this.startPoint, e, t);
1916
1916
  }
1917
1917
  updateFrame() {
1918
1918
  if (!this.active) return;
@@ -1956,7 +1956,7 @@ var Mn = class e {
1956
1956
  this.currentDimension && (this.currentDimension.createBoundingBox(), this.dimensions.push(this.currentDimension), this.currentDimension = null, this.measureInProcess = !1, this.axis = null);
1957
1957
  }
1958
1958
  createDimension(e, t) {
1959
- return new Tn({
1959
+ return new wn({
1960
1960
  boundingMaterial: this.boundingMaterial,
1961
1961
  endpointGeometry: this.endpointGeometry,
1962
1962
  endpointMaterial: this.endpointMaterial,
@@ -1968,7 +1968,7 @@ var Mn = class e {
1968
1968
  });
1969
1969
  }
1970
1970
  getModelHit(e) {
1971
- let t = kn(this.context.modelRef.current);
1971
+ let t = On(this.context.modelRef.current);
1972
1972
  return t.length ? this.context.cameraUtils.getIntersection(!0, {
1973
1973
  event: e,
1974
1974
  filter: (e) => !!e.face,
@@ -1980,7 +1980,7 @@ var Mn = class e {
1980
1980
  return this.dimensions.map((e) => e.boundingBox).filter((e) => !!e);
1981
1981
  }
1982
1982
  getClosestVertex(e) {
1983
- if (!(e.object instanceof P) || !e.face) return e.point.clone();
1983
+ if (!(e.object instanceof N) || !e.face) return e.point.clone();
1984
1984
  let t = e.object.geometry.attributes.position;
1985
1985
  if (!t) return e.point.clone();
1986
1986
  let n = [
@@ -1988,29 +1988,29 @@ var Mn = class e {
1988
1988
  e.face.b,
1989
1989
  e.face.c
1990
1990
  ].map((n) => {
1991
- let r = new I(t.getX(n), t.getY(n), t.getZ(n));
1991
+ let r = new L(t.getX(n), t.getY(n), t.getZ(n));
1992
1992
  return e.object.localToWorld(r);
1993
1993
  }).filter((t) => t.distanceTo(e.point) <= this.snapDistance);
1994
1994
  return n.length ? n.reduce((t, n) => n.distanceTo(e.point) < t.distanceTo(e.point) ? n : t) : e.point.clone();
1995
1995
  }
1996
1996
  getPreviewEndPoint(e, t) {
1997
1997
  if (!t) return this.axis = null, e.clone();
1998
- let n = this.axis ?? jn(this.startPoint, e);
1999
- return this.axis = n, An(this.startPoint, e, n);
1998
+ let n = this.axis ?? An(this.startPoint, e);
1999
+ return this.axis = n, kn(this.startPoint, e, n);
2000
2000
  }
2001
2001
  getNextAxis() {
2002
2002
  switch (this.axis) {
2003
2003
  case "x": return "y";
2004
2004
  case "y": return "z";
2005
2005
  case "z": return "x";
2006
- default: return On;
2006
+ default: return Dn;
2007
2007
  }
2008
2008
  }
2009
2009
  getIsMoving() {
2010
2010
  return this.moveState !== "end" && this.moveState !== "start";
2011
2011
  }
2012
2012
  rescalePreviewMarker() {
2013
- let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof se ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
2013
+ let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof oe ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
2014
2014
  this.previewMarker.scale.setScalar(r);
2015
2015
  }
2016
2016
  setSelectionInteractionDisabled(e) {
@@ -2047,11 +2047,11 @@ var Mn = class e {
2047
2047
  return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
2048
2048
  }
2049
2049
  static createPreviewGeometry() {
2050
- return new fe(.5, 16, 12);
2050
+ return new de(.5, 16, 12);
2051
2051
  }
2052
2052
  };
2053
- function Nn(e, t, n) {
2054
- let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.scene), s = p((e) => e.size), l = Ee(), u = c(() => new Mn({
2053
+ function Mn(e, t, n) {
2054
+ let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.scene), s = p((e) => e.size), l = Te(), u = c(() => new jn({
2055
2055
  camera: r,
2056
2056
  cameraUtils: n,
2057
2057
  controlRef: t,
@@ -2113,15 +2113,15 @@ function Nn(e, t, n) {
2113
2113
  }
2114
2114
  //#endregion
2115
2115
  //#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
2116
- function Pn(e) {
2116
+ function Nn(e) {
2117
2117
  return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
2118
2118
  }
2119
- function Fn() {
2120
- let e = z((e) => e.api), t = z((e) => e.defaultHotkeysEnabled);
2119
+ function Pn() {
2120
+ let e = B((e) => e.api), t = B((e) => e.defaultHotkeysEnabled);
2121
2121
  o(() => {
2122
2122
  if (!t) return;
2123
2123
  let n = (t) => {
2124
- Pn(t.target) || (t.code === "KeyI" && e?.geometryUtils.isolateSelected(), t.code === "KeyH" && e?.geometryUtils.hideSelected(), t.code === "KeyC" && e?.geometryUtils.showAll(), t.code === "KeyP" && e?.clipping.createPlane(), t.code === "KeyM" && e?.dimensions.toggle());
2124
+ Nn(t.target) || (t.code === "KeyI" && e?.geometryUtils.isolateSelected(), t.code === "KeyH" && e?.geometryUtils.hideSelected(), t.code === "KeyC" && e?.geometryUtils.showAll(), t.code === "KeyP" && e?.clipping.createPlane(), t.code === "KeyM" && e?.dimensions.toggle());
2125
2125
  };
2126
2126
  return window.addEventListener("keydown", n), () => {
2127
2127
  window.removeEventListener("keydown", n);
@@ -2130,15 +2130,15 @@ function Fn() {
2130
2130
  }
2131
2131
  //#endregion
2132
2132
  //#region src/viewer/Camera/useCameraUtils.ts
2133
- var In = 1e-6;
2134
- function Ln(e, t) {
2133
+ var Fn = 1e-6;
2134
+ function In(e, t) {
2135
2135
  let n = t.getBoundingClientRect();
2136
- return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new F((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
2136
+ return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new I((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
2137
2137
  }
2138
- function Rn(e, t) {
2139
- return t.every((t) => t.distanceToPoint(e) >= -In);
2138
+ function Ln(e, t) {
2139
+ return t.every((t) => t.distanceToPoint(e) >= -Fn);
2140
2140
  }
2141
- function zn(e) {
2141
+ function Rn(e) {
2142
2142
  let t = e;
2143
2143
  for (; t;) {
2144
2144
  if (!t.visible) return !1;
@@ -2146,8 +2146,8 @@ function zn(e) {
2146
2146
  }
2147
2147
  return !0;
2148
2148
  }
2149
- function Bn(e) {
2150
- let t = p((e) => e.camera), n = p((e) => e.gl), r = p((e) => e.raycaster), a = l(null), s = l(null), u = l(new F()), d = i((e) => {
2149
+ function zn(e) {
2150
+ let t = p((e) => e.camera), n = p((e) => e.gl), r = p((e) => e.raycaster), a = l(null), s = l(null), u = l(new I()), d = i((e) => {
2151
2151
  a.current = e;
2152
2152
  }, []), f = i(() => {
2153
2153
  let e = a.current;
@@ -2155,7 +2155,7 @@ function Bn(e) {
2155
2155
  }, []);
2156
2156
  o(() => {
2157
2157
  let e = n.domElement, t = (t) => {
2158
- let n = Ln(t, e);
2158
+ let n = In(t, e);
2159
2159
  n && (s.current = n);
2160
2160
  }, r = () => {
2161
2161
  s.current = null;
@@ -2165,11 +2165,11 @@ function Bn(e) {
2165
2165
  };
2166
2166
  }, [n]);
2167
2167
  let m = i((i = !1, { event: a, filter: o, object: c = e.current, recursive: l = !0, respectClipping: d = !0 } = {}) => {
2168
- let p = a ? Ln(a, n.domElement) : s.current;
2168
+ let p = a ? In(a, n.domElement) : s.current;
2169
2169
  if (!p || !c) return i ? null : [];
2170
2170
  let m = d ? f() : [], h = Array.isArray(c) ? c : [c];
2171
2171
  t.updateMatrixWorld(), e.current?.updateMatrixWorld(!0), u.current.copy(p), r.setFromCamera(u.current, t);
2172
- let g = r.intersectObjects(h, l).filter((e) => zn(e.object) ? m.length ? Rn(e.point, m) : !0 : !1).filter((e) => o ? o(e) : !0);
2172
+ let g = r.intersectObjects(h, l).filter((e) => Rn(e.object) ? m.length ? Ln(e.point, m) : !0 : !1).filter((e) => o ? o(e) : !0);
2173
2173
  return i ? g[0] ?? null : g;
2174
2174
  }, [
2175
2175
  t,
@@ -2190,8 +2190,8 @@ function Bn(e) {
2190
2190
  }
2191
2191
  //#endregion
2192
2192
  //#region src/viewer/Selector/SelectionBox.ts
2193
- var Vn = new I(), Hn = new I(), G = new F(), Un = new I(), Wn = new I(), Gn = new I(), Kn = new I(), qn = new I(), Jn = new I(), Yn = new I();
2194
- function Xn(e) {
2193
+ var Bn = new L(), Vn = new L(), K = new I(), Hn = new L(), Un = new L(), Wn = new L(), Gn = new L(), Kn = new L(), qn = new L(), Jn = new L();
2194
+ function Yn(e) {
2195
2195
  let t = e;
2196
2196
  for (; t;) {
2197
2197
  let e = t.modelID ?? t.userData.modelID;
@@ -2200,7 +2200,7 @@ function Xn(e) {
2200
2200
  }
2201
2201
  return 0;
2202
2202
  }
2203
- function Zn(e) {
2203
+ function Xn(e) {
2204
2204
  let t = e;
2205
2205
  for (; t;) {
2206
2206
  if (!t.visible) return !1;
@@ -2208,16 +2208,16 @@ function Zn(e) {
2208
2208
  }
2209
2209
  return !0;
2210
2210
  }
2211
- function Qn(e, t, n) {
2212
- return n.length ? (Un.copy(t).applyMatrix4(e.matrixWorld), Rn(Un, n)) : !0;
2211
+ function Zn(e, t, n) {
2212
+ return n.length ? (Hn.copy(t).applyMatrix4(e.matrixWorld), Ln(Hn, n)) : !0;
2213
2213
  }
2214
- function $n(e, t, n, r, i) {
2215
- return i.length ? (Wn.copy(t).applyMatrix4(e.matrixWorld), Gn.copy(n).applyMatrix4(e.matrixWorld), Kn.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2216
- let t = e.distanceToPoint(Wn), n = e.distanceToPoint(Gn), r = e.distanceToPoint(Kn);
2214
+ function Qn(e, t, n, r, i) {
2215
+ return i.length ? (Un.copy(t).applyMatrix4(e.matrixWorld), Wn.copy(n).applyMatrix4(e.matrixWorld), Gn.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2216
+ let t = e.distanceToPoint(Un), n = e.distanceToPoint(Wn), r = e.distanceToPoint(Gn);
2217
2217
  return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
2218
2218
  })) : !0;
2219
2219
  }
2220
- function er(e) {
2220
+ function $n(e) {
2221
2221
  let t = e.getBoundingClientRect();
2222
2222
  return {
2223
2223
  height: t.height,
@@ -2226,7 +2226,7 @@ function er(e) {
2226
2226
  width: t.width
2227
2227
  };
2228
2228
  }
2229
- function tr(e) {
2229
+ function er(e) {
2230
2230
  return {
2231
2231
  boundsCheckMs: 0,
2232
2232
  candidateIds: 0,
@@ -2252,7 +2252,7 @@ function tr(e) {
2252
2252
  triangleProjectionMs: 0
2253
2253
  };
2254
2254
  }
2255
- function nr(e, t) {
2255
+ function tr(e, t) {
2256
2256
  return {
2257
2257
  minX: Math.min(e.x, t.x),
2258
2258
  minY: Math.min(e.y, t.y),
@@ -2260,43 +2260,43 @@ function nr(e, t) {
2260
2260
  maxY: Math.max(e.y, t.y)
2261
2261
  };
2262
2262
  }
2263
- function rr(e, t) {
2263
+ function nr(e, t) {
2264
2264
  return t.x >= e.x ? "contains" : "intersects";
2265
2265
  }
2266
- function ir(e, t) {
2267
- return ar(e.x, e.y, t);
2266
+ function rr(e, t) {
2267
+ return ir(e.x, e.y, t);
2268
2268
  }
2269
- function ar(e, t, n) {
2269
+ function ir(e, t, n) {
2270
2270
  return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
2271
2271
  }
2272
- function or(e, t, n, r, i, a) {
2272
+ function ar(e, t, n, r, i, a) {
2273
2273
  return (a - t) * (n - e) > (r - t) * (i - e);
2274
2274
  }
2275
- function sr(e, t, n, r, i, a, o, s) {
2276
- return or(e, t, i, a, o, s) !== or(n, r, i, a, o, s) && or(e, t, n, r, i, a) !== or(e, t, n, r, o, s);
2275
+ function or(e, t, n, r, i, a, o, s) {
2276
+ return ar(e, t, i, a, o, s) !== ar(n, r, i, a, o, s) && ar(e, t, n, r, i, a) !== ar(e, t, n, r, o, s);
2277
2277
  }
2278
- function cr(e, t, n, r, i) {
2278
+ function sr(e, t, n, r, i) {
2279
2279
  let a = .5 * (-r.y * i.x + n.y * (-r.x + i.x) + n.x * (r.y - i.y) + r.x * i.y), o = a < 0 ? -1 : 1, s = (n.y * i.x - n.x * i.y + (i.y - n.y) * e + (n.x - i.x) * t) * o, c = (n.x * r.y - n.y * r.x + (n.y - r.y) * e + (r.x - n.x) * t) * o;
2280
2280
  return s >= 0 && c >= 0 && s + c <= 2 * a * o;
2281
2281
  }
2282
- function lr(e, t, n, r) {
2283
- return ir(e, r) || ir(t, r) || ir(n, r) || cr(r.minX, r.minY, e, t, n) || cr(r.maxX, r.minY, e, t, n) || cr(r.maxX, r.maxY, e, t, n) || cr(r.minX, r.maxY, e, t, n) ? !0 : ur(e, t, r) || ur(t, n, r) || ur(n, e, r);
2282
+ function cr(e, t, n, r) {
2283
+ return rr(e, r) || rr(t, r) || rr(n, r) || sr(r.minX, r.minY, e, t, n) || sr(r.maxX, r.minY, e, t, n) || sr(r.maxX, r.maxY, e, t, n) || sr(r.minX, r.maxY, e, t, n) ? !0 : lr(e, t, r) || lr(t, n, r) || lr(n, e, r);
2284
2284
  }
2285
- function ur(e, t, n) {
2286
- return sr(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || sr(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || sr(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || sr(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
2285
+ function lr(e, t, n) {
2286
+ return or(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || or(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || or(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || or(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
2287
2287
  }
2288
- function dr(e, t, n, r, i = new F()) {
2289
- let a = Vn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2288
+ function ur(e, t, n, r, i = new I()) {
2289
+ let a = Bn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2290
2290
  return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
2291
2291
  }
2292
- function fr(e, t, n, r, i) {
2292
+ function dr(e, t, n, r, i) {
2293
2293
  let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
2294
- for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) Hn.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), dr(e, Hn, r, i, G), a = Math.min(a, G.x), o = Math.max(o, G.x), s = Math.min(s, G.y), c = Math.max(c, G.y), ir(G, n) && (l += 1);
2295
- return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? xe : l === 8 ? ve : ye;
2294
+ for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) Vn.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), ur(e, Vn, r, i, K), a = Math.min(a, K.x), o = Math.max(o, K.x), s = Math.min(s, K.y), c = Math.max(c, K.y), rr(K, n) && (l += 1);
2295
+ return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? be : l === 8 ? _e : ve;
2296
2296
  }
2297
- function pr(e, t, n, r) {
2297
+ function fr(e, t, n, r) {
2298
2298
  let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
2299
- for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) Hn.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), dr(e, Hn, n, r, G), i = Math.min(i, G.x), a = Math.max(a, G.x), o = Math.min(o, G.y), s = Math.max(s, G.y);
2299
+ for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) Vn.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), ur(e, Vn, n, r, K), i = Math.min(i, K.x), a = Math.max(a, K.x), o = Math.min(o, K.y), s = Math.max(s, K.y);
2300
2300
  return {
2301
2301
  minX: i,
2302
2302
  minY: o,
@@ -2304,41 +2304,41 @@ function pr(e, t, n, r) {
2304
2304
  maxY: s
2305
2305
  };
2306
2306
  }
2307
- function mr(e, t) {
2307
+ function pr(e, t) {
2308
2308
  return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
2309
2309
  }
2310
- function hr(e, t, n, r) {
2310
+ function mr(e, t, n, r) {
2311
2311
  e.geometry.boundingBox || e.geometry.computeBoundingBox();
2312
2312
  let i = e.geometry.boundingBox;
2313
- return i ? mr(pr(e, i, n, r), t) : !0;
2313
+ return i ? pr(fr(e, i, n, r), t) : !0;
2314
2314
  }
2315
- function gr(e, t, n) {
2315
+ function hr(e, t, n) {
2316
2316
  let r = e.get(t);
2317
2317
  r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
2318
2318
  }
2319
- function _r(e) {
2319
+ function gr(e) {
2320
2320
  let t = 0;
2321
2321
  return e.forEach((e) => {
2322
2322
  t += e.size;
2323
2323
  }), t;
2324
2324
  }
2325
- function vr(e, t, n, r = []) {
2325
+ function _r(e, t, n, r = []) {
2326
2326
  let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
2327
2327
  if (!a || !o || !s) return;
2328
2328
  let c = t * 3;
2329
- r.length && (qn.fromBufferAttribute(s, a.getX(c)), Jn.fromBufferAttribute(s, a.getX(c + 1)), Yn.fromBufferAttribute(s, a.getX(c + 2)), !$n(e, qn, Jn, Yn, r)) || gr(n, Xn(e), o.getX(a.getX(c)));
2329
+ r.length && (Kn.fromBufferAttribute(s, a.getX(c)), qn.fromBufferAttribute(s, a.getX(c + 1)), Jn.fromBufferAttribute(s, a.getX(c + 2)), !Qn(e, Kn, qn, Jn, r)) || hr(n, Yn(e), o.getX(a.getX(c)));
2330
2330
  }
2331
- function yr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2332
- let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new I();
2331
+ function vr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2332
+ let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new L();
2333
2333
  e.traverse((e) => {
2334
2334
  let s = e;
2335
- if (!s.isMesh || !Zn(s)) return;
2335
+ if (!s.isMesh || !Xn(s)) return;
2336
2336
  let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
2337
2337
  if (!(!u || !d)) {
2338
2338
  o && (o.containedVerticesVisited += u.count);
2339
2339
  for (let e = 0; e < u.count; e++) {
2340
- let f = Xn(s), p = u.getX(e);
2341
- if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Qn(s, l, a))) continue;
2340
+ let f = Yn(s), p = u.getX(e);
2341
+ if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Zn(s, l, a))) continue;
2342
2342
  o && (o.containedCandidateVertices += 1);
2343
2343
  let m = `${f}:${p}`, h = c.get(m);
2344
2344
  h || (h = {
@@ -2346,23 +2346,23 @@ function yr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
2346
2346
  inside: 0,
2347
2347
  modelID: f,
2348
2348
  total: 0
2349
- }, c.set(m, h)), h.total += 1, ir(dr(s, l, t, n), r) && (h.inside += 1);
2349
+ }, c.set(m, h)), h.total += 1, rr(ur(s, l, t, n), r) && (h.inside += 1);
2350
2350
  }
2351
2351
  }
2352
2352
  });
2353
2353
  let u = /* @__PURE__ */ new Map();
2354
2354
  return c.forEach((e) => {
2355
- e.total > 0 && e.total === e.inside && gr(u, e.modelID, e.id);
2355
+ e.total > 0 && e.total === e.inside && hr(u, e.modelID, e.id);
2356
2356
  }), o && (o.containedIdsMs += performance.now() - s), u;
2357
2357
  }
2358
- function br({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2358
+ function yr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2359
2359
  let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2360
2360
  if (!e) return c;
2361
- let u = er(r), d = performance.now();
2361
+ let u = $n(r), d = performance.now();
2362
2362
  e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
2363
2363
  let r = e;
2364
2364
  if (!r.isMesh) return;
2365
- if (o && (o.meshCount += 1), !Zn(r)) {
2365
+ if (o && (o.meshCount += 1), !Xn(r)) {
2366
2366
  o && (o.skippedMeshCount += 1);
2367
2367
  return;
2368
2368
  }
@@ -2371,7 +2371,7 @@ function br({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2371
2371
  o && (o.skippedMeshCount += 1);
2372
2372
  return;
2373
2373
  }
2374
- let d = performance.now(), f = hr(r, i, t, u);
2374
+ let d = performance.now(), f = mr(r, i, t, u);
2375
2375
  if (o && (o.boundsCheckMs += performance.now() - d), !f) {
2376
2376
  o && (o.skippedMeshCount += 1);
2377
2377
  return;
@@ -2379,26 +2379,26 @@ function br({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2379
2379
  let p = performance.now();
2380
2380
  s.shapecast({
2381
2381
  intersectsBounds: (e) => {
2382
- let n = performance.now(), a = fr(r, e, i, t, u);
2382
+ let n = performance.now(), a = dr(r, e, i, t, u);
2383
2383
  return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
2384
2384
  },
2385
2385
  intersectsRange: (e, t, i) => {
2386
2386
  let u = performance.now();
2387
2387
  if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
2388
- for (let i = e; i < e + t; i++) vr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2388
+ for (let i = e; i < e + t; i++) _r(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2389
2389
  return o && (o.intersectsRangeMs += performance.now() - u), !1;
2390
2390
  },
2391
2391
  intersectsTriangle: (e, s, d) => {
2392
2392
  let f = performance.now();
2393
2393
  if (o && (o.intersectsTriangleCalls += 1), !d) {
2394
- let n = performance.now(), a = dr(r, e.a, t, u), s = dr(r, e.b, t, u), c = dr(r, e.c, t, u);
2395
- if (o && (o.triangleProjectionMs += performance.now() - n), !lr(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2394
+ let n = performance.now(), a = ur(r, e.a, t, u), s = ur(r, e.b, t, u), c = ur(r, e.c, t, u);
2395
+ if (o && (o.triangleProjectionMs += performance.now() - n), !cr(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2396
2396
  }
2397
- return a === "contains" ? vr(r, s, l, n) : vr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2397
+ return a === "contains" ? _r(r, s, l, n) : _r(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2398
2398
  }
2399
2399
  }), o && (o.shapecastMs += performance.now() - p);
2400
2400
  });
2401
- let f = a === "contains" ? yr({
2401
+ let f = a === "contains" ? vr({
2402
2402
  model: e,
2403
2403
  camera: t,
2404
2404
  clippingPlanes: n,
@@ -2407,19 +2407,19 @@ function br({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2407
2407
  candidateIdsByModel: l,
2408
2408
  profile: o
2409
2409
  }) : c;
2410
- return o && (o.candidateIds = _r(l), o.selectedIds = _r(f), o.totalMs = performance.now() - s), f;
2410
+ return o && (o.candidateIds = gr(l), o.selectedIds = gr(f), o.totalMs = performance.now() - s), f;
2411
2411
  }
2412
- function xr(e) {
2413
- let t = tr(e.mode);
2412
+ function br(e) {
2413
+ let t = er(e.mode);
2414
2414
  return {
2415
- ids: br({
2415
+ ids: yr({
2416
2416
  ...e,
2417
2417
  profile: t
2418
2418
  }),
2419
2419
  profile: t
2420
2420
  };
2421
2421
  }
2422
- function Sr(e) {
2422
+ function xr(e) {
2423
2423
  return e === "contains" ? {
2424
2424
  border: "rgb(37, 99, 235)",
2425
2425
  background: "rgba(37, 99, 235, 0.16)"
@@ -2428,32 +2428,32 @@ function Sr(e) {
2428
2428
  background: "rgba(22, 163, 74, 0.16)"
2429
2429
  };
2430
2430
  }
2431
- function Cr(e, t, n) {
2432
- let r = Sr(rr(t, n));
2431
+ function Sr(e, t, n) {
2432
+ let r = xr(nr(t, n));
2433
2433
  if (!e.current) {
2434
2434
  let t = document.createElement("div");
2435
2435
  t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
2436
2436
  }
2437
- let i = nr(t, n);
2437
+ let i = tr(t, n);
2438
2438
  e.current.style.border = `1px solid ${r.border}`, e.current.style.background = r.background, e.current.style.left = `${i.minX}px`, e.current.style.top = `${i.minY}px`, e.current.style.width = `${i.maxX - i.minX}px`, e.current.style.height = `${i.maxY - i.minY}px`;
2439
2439
  }
2440
- function wr(e) {
2440
+ function Cr(e) {
2441
2441
  e.current?.remove(), e.current = null;
2442
2442
  }
2443
2443
  //#endregion
2444
2444
  //#region src/viewer/Selector/useSelector.tsx
2445
- var Tr = 40;
2446
- function Er(e) {
2445
+ var wr = 40;
2446
+ function Tr(e) {
2447
2447
  if (!Array.isArray(e)) return e.userData.shader;
2448
2448
  }
2449
- function Dr(e, t) {
2450
- let n = Er(e)?.uniforms.preSelectionId;
2449
+ function Er(e, t) {
2450
+ let n = Tr(e)?.uniforms.preSelectionId;
2451
2451
  n && (n.value = t);
2452
2452
  }
2453
- function Or(e) {
2453
+ function Dr(e) {
2454
2454
  return Number(e.current?.modelID ?? 0);
2455
2455
  }
2456
- function kr(e) {
2456
+ function Or(e) {
2457
2457
  let t = e;
2458
2458
  for (; t;) {
2459
2459
  let e = t.modelID ?? t.userData.modelID;
@@ -2462,7 +2462,7 @@ function kr(e) {
2462
2462
  }
2463
2463
  return 0;
2464
2464
  }
2465
- function Ar(e) {
2465
+ function kr(e) {
2466
2466
  let t = e;
2467
2467
  for (; t;) {
2468
2468
  if (!t.visible) return !1;
@@ -2470,212 +2470,216 @@ function Ar(e) {
2470
2470
  }
2471
2471
  return !0;
2472
2472
  }
2473
- function jr(e) {
2474
- if (!Ar(e.object) || !(e.object instanceof P) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2473
+ function Ar(e) {
2474
+ if (!kr(e.object) || !(e.object instanceof N) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2475
2475
  let t = e.object.geometry;
2476
2476
  return !!(t.index && t.attributes.ids);
2477
2477
  }
2478
- function Mr(e, t, n) {
2479
- let r = l("end"), i = z((e) => e.selected), a = z((e) => e.setSelected), s = z((e) => e.addSelected), c = z((e) => e.removeSelected), u = z((e) => e.showStats), d = Ee(), f = l(null), m = l(null), h = l(!1), g = l(!1), _ = l("add"), v = l(null), y = l(!1), b = l(0), x = l(null), S = l(null), C = () => d.getState().selectionInteractionDisabled, w = (e) => {
2478
+ function jr(e, t, n, r) {
2479
+ let i = l("end"), a = B((e) => e.selected), s = B((e) => e.setSelected), c = B((e) => e.addSelected), u = B((e) => e.removeSelected), d = B((e) => e.showStats), f = Te(), m = l(null), h = l(null), g = l(!1), _ = l(!1), v = l("add"), y = l(null), b = l(!1), x = l(0), S = l(null), C = l(null), w = () => f.getState().selectionInteractionDisabled, T = (e) => {
2480
+ if (r) {
2481
+ r(e);
2482
+ return;
2483
+ }
2480
2484
  let n = t.current;
2481
2485
  n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
2482
- }, T = () => {
2486
+ }, E = () => {
2483
2487
  e.current?.traverse((e) => {
2484
- if (!(e instanceof P)) return;
2488
+ if (!(e instanceof N)) return;
2485
2489
  let t = e;
2486
- t.preselected = !1, Dr(t.material, -1);
2490
+ t.preselected = !1, Er(t.material, -1);
2487
2491
  });
2488
- }, E = () => {
2489
- f.current = null, h.current = !1, wr(m), t.current && (t.current.enabled = !0);
2490
- }, D = (t) => {
2491
- if (C()) {
2492
- T();
2492
+ }, D = () => {
2493
+ m.current = null, g.current = !1, Cr(h), t.current && (t.current.enabled = !0);
2494
+ }, ee = (t) => {
2495
+ if (w()) {
2496
+ E();
2493
2497
  return;
2494
2498
  }
2495
- if (f.current) {
2496
- T();
2499
+ if (m.current) {
2500
+ E();
2497
2501
  return;
2498
2502
  }
2499
- if (r.current !== "end" && r.current !== "start") {
2500
- T();
2503
+ if (i.current !== "end" && i.current !== "start") {
2504
+ E();
2501
2505
  return;
2502
2506
  }
2503
- let n = ae(t, e.current)[0], i;
2504
- n && (i = n.object), T(), !(!n || !i) && e.current?.traverse((e) => {
2505
- if (!(e instanceof P)) return;
2507
+ let n = ae(t, e.current)[0], r;
2508
+ n && (r = n.object), E(), !(!n || !r) && e.current?.traverse((e) => {
2509
+ if (!(e instanceof N)) return;
2506
2510
  let t = e;
2507
- if (t !== i) return;
2508
- let r = n.faceIndex * 3, a = t.geometry.index.getX(r), o = t.geometry.attributes.ids.getX(a);
2509
- t.preselected = !0, Dr(t.material, o);
2511
+ if (t !== r) return;
2512
+ let i = n.faceIndex * 3, a = t.geometry.index.getX(i), o = t.geometry.attributes.ids.getX(a);
2513
+ t.preselected = !0, Er(t.material, o);
2510
2514
  });
2511
2515
  };
2512
2516
  function O() {
2513
2517
  return performance.now();
2514
2518
  }
2515
2519
  let k = (e) => {
2516
- if (C()) {
2517
- S.current = null, x.current !== null && (window.clearTimeout(x.current), x.current = null), T();
2520
+ if (w()) {
2521
+ C.current = null, S.current !== null && (window.clearTimeout(S.current), S.current = null), E();
2518
2522
  return;
2519
2523
  }
2520
- if (S.current = e, x.current !== null) return;
2521
- let t = O() - b.current, n = Math.max(0, Tr - t);
2522
- x.current = window.setTimeout(() => {
2523
- x.current = null;
2524
- let e = S.current;
2525
- S.current = null, e && (b.current = performance.now(), D(e));
2524
+ if (C.current = e, S.current !== null) return;
2525
+ let t = O() - x.current, n = Math.max(0, wr - t);
2526
+ S.current = window.setTimeout(() => {
2527
+ S.current = null;
2528
+ let e = C.current;
2529
+ C.current = null, e && (x.current = performance.now(), ee(e));
2526
2530
  }, n);
2527
2531
  }, A = l(null);
2528
2532
  o(() => {
2529
- let e = v.current;
2533
+ let e = y.current;
2530
2534
  if (e) {
2531
- u && A.current !== null && console.log(`selection ${e.action}:`, Date.now() - A.current, "ms"), v.current = null, A.current = null;
2535
+ d && A.current !== null && console.log(`selection ${e.action}:`, Date.now() - A.current, "ms"), y.current = null, A.current = null;
2532
2536
  return;
2533
2537
  }
2534
- u && A.current !== null && (console.log("selection spend:", Date.now() - A.current, "ms"), A.current = null);
2535
- }, [i, u]);
2536
- let { camera: ee, gl: j } = p();
2537
- function M() {
2538
+ d && A.current !== null && (console.log("selection spend:", Date.now() - A.current, "ms"), A.current = null);
2539
+ }, [a, d]);
2540
+ let { camera: te, gl: j } = p();
2541
+ function ne() {
2538
2542
  return Date.now();
2539
2543
  }
2540
- let te = (e) => {
2544
+ let M = (e) => {
2541
2545
  let t = j.domElement.getBoundingClientRect();
2542
2546
  return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
2543
- }, N = (t) => {
2544
- if (C()) {
2545
- y.current = !1, g.current = !1, T();
2547
+ }, P = (t) => {
2548
+ if (w()) {
2549
+ b.current = !1, _.current = !1, E();
2546
2550
  return;
2547
2551
  }
2548
- if (!y.current) return;
2549
- if (y.current = !1, g.current) {
2550
- g.current = !1;
2552
+ if (!b.current) return;
2553
+ if (b.current = !1, _.current) {
2554
+ _.current = !1;
2551
2555
  return;
2552
2556
  }
2553
- if (!te(t)) return;
2554
- if (A.current = M(), r.current !== "end" && r.current !== "start" && r.current > 15) {
2555
- r.current = "end";
2557
+ if (!M(t)) return;
2558
+ if (A.current = ne(), i.current !== "end" && i.current !== "start" && i.current > 15) {
2559
+ i.current = "end";
2556
2560
  return;
2557
2561
  }
2558
- let n = t.shiftKey, o = t.ctrlKey, l = ae(t, e.current), u, d = Or(e), f = null;
2559
- if (l.length) {
2560
- let e = l[0], t = e.object;
2561
- d = kr(t), f = e.point;
2562
+ let n = t.shiftKey, r = t.ctrlKey, o = ae(t, e.current), l, d = Dr(e), f = null;
2563
+ if (o.length) {
2564
+ let e = o[0], t = e.object;
2565
+ d = Or(t), f = e.point;
2562
2566
  let n = e.faceIndex * 3, r = t.geometry.index.getX(n);
2563
- u = t.geometry.attributes.ids.getX(r);
2567
+ l = t.geometry.attributes.ids.getX(r);
2564
2568
  }
2565
- if (o) {
2566
- u !== void 0 && c(d, [u]);
2569
+ if (r) {
2570
+ l !== void 0 && u(d, [l]);
2567
2571
  return;
2568
2572
  } else if (n) {
2569
- u !== void 0 && (i[d]?.has(u) ?? !1 ? c(d, [u]) : (s(d, [u]), f && w(f)));
2573
+ l !== void 0 && (a[d]?.has(l) ?? !1 ? u(d, [l]) : (c(d, [l]), f && T(f)));
2570
2574
  return;
2571
2575
  }
2572
- a(d, u === void 0 ? [] : [u], !0), f && w(f);
2573
- }, ne = (e) => {
2574
- C() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (f.current = new F(e.clientX, e.clientY), _.current = e.ctrlKey ? "remove" : "add", h.current = !1, t.current && (t.current.enabled = !1));
2576
+ s(d, l === void 0 ? [] : [l], !0), f && T(f);
2575
2577
  }, re = (e) => {
2576
- if (C()) {
2577
- E();
2578
+ w() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (m.current = new I(e.clientX, e.clientY), v.current = e.ctrlKey ? "remove" : "add", g.current = !1, t.current && (t.current.enabled = !1));
2579
+ }, F = (e) => {
2580
+ if (w()) {
2581
+ D();
2578
2582
  return;
2579
2583
  }
2580
- if (!f.current) return;
2581
- let t = new F(e.clientX, e.clientY), n = Math.abs(t.x - f.current.x), r = Math.abs(t.y - f.current.y);
2582
- n < 6 && r < 6 || (h.current ||= !0, e.preventDefault(), Cr(m, f.current, t));
2584
+ if (!m.current) return;
2585
+ let t = new I(e.clientX, e.clientY), n = Math.abs(t.x - m.current.x), r = Math.abs(t.y - m.current.y);
2586
+ n < 6 && r < 6 || (g.current ||= !0, e.preventDefault(), Sr(h, m.current, t));
2583
2587
  }, ie = (r) => {
2584
- if (C()) {
2585
- E();
2588
+ if (w()) {
2589
+ D();
2586
2590
  return;
2587
2591
  }
2588
- if (!f.current) return;
2589
- A.current = M();
2590
- let i = h.current, a = new F(r.clientX, r.clientY), o = nr(f.current, a), l = rr(f.current, a);
2591
- if (f.current = null, h.current = !1, wr(m), t.current && setTimeout(() => {
2592
+ if (!m.current) return;
2593
+ A.current = ne();
2594
+ let i = g.current, a = new I(r.clientX, r.clientY), o = tr(m.current, a), s = nr(m.current, a);
2595
+ if (m.current = null, g.current = !1, Cr(h), t.current && setTimeout(() => {
2592
2596
  t.current && (t.current.enabled = !0);
2593
2597
  }, 100), !i) return;
2594
- g.current = !0, r.preventDefault();
2595
- let { ids: u, profile: d } = xr({
2598
+ _.current = !0, r.preventDefault();
2599
+ let { ids: l, profile: d } = br({
2596
2600
  model: e.current,
2597
- camera: ee,
2601
+ camera: te,
2598
2602
  clippingPlanes: n.getActiveClippingPlanes(),
2599
2603
  domElement: j.domElement,
2600
2604
  rect: o,
2601
- mode: l
2602
- }), p = Array.from(u.values()).reduce((e, t) => e + t.size, 0), y = {
2603
- action: _.current,
2605
+ mode: s
2606
+ }), f = Array.from(l.values()).reduce((e, t) => e + t.size, 0), p = {
2607
+ action: v.current,
2604
2608
  box: d,
2605
- ids: p
2609
+ ids: f
2606
2610
  };
2607
- p && (v.current = y, u.forEach((e, t) => {
2611
+ f && (y.current = p, l.forEach((e, t) => {
2608
2612
  let n = Array.from(e);
2609
- _.current === "remove" ? c(t, n) : s(t, n);
2613
+ v.current === "remove" ? u(t, n) : c(t, n);
2610
2614
  }));
2611
2615
  }, ae = (e, t) => t ? n.getIntersection(!1, {
2612
2616
  event: e,
2613
- filter: jr,
2617
+ filter: Ar,
2614
2618
  object: t,
2615
2619
  recursive: !0
2616
2620
  }) : [];
2617
2621
  o(() => {
2618
2622
  let e = t.current;
2619
2623
  if (!e) return;
2620
- j.domElement.addEventListener("pointerdown", ne), j.domElement.addEventListener("pointermove", re), window.addEventListener("pointerup", ie), window.addEventListener("pointerup", N), j.domElement.addEventListener("contextmenu", o), j.domElement.addEventListener("pointerup", a), j.domElement.addEventListener("pointermove", k), j.domElement.addEventListener("pointerleave", T), j.domElement.addEventListener("pointerdown", i), e.addEventListener("update", n);
2624
+ j.domElement.addEventListener("pointerdown", re), j.domElement.addEventListener("pointermove", F), window.addEventListener("pointerup", ie), window.addEventListener("pointerup", P), j.domElement.addEventListener("contextmenu", o), j.domElement.addEventListener("pointerup", a), j.domElement.addEventListener("pointermove", k), j.domElement.addEventListener("pointerleave", E), j.domElement.addEventListener("pointerdown", r), e.addEventListener("update", n);
2621
2625
  function n() {
2622
- typeof r.current == "number" ? r.current += 1 : r.current === "start" && (r.current = 1);
2626
+ typeof i.current == "number" ? i.current += 1 : i.current === "start" && (i.current = 1);
2623
2627
  }
2624
- function i(e) {
2625
- y.current = e.button === 0 || e.ctrlKey, r.current = "start";
2628
+ function r(e) {
2629
+ b.current = e.button === 0 || e.ctrlKey, i.current = "start";
2626
2630
  }
2627
2631
  function a() {
2628
2632
  setTimeout(() => {
2629
- r.current = "end";
2633
+ i.current = "end";
2630
2634
  }, 100);
2631
2635
  }
2632
2636
  function o(e) {
2633
2637
  e.ctrlKey && e.preventDefault();
2634
2638
  }
2635
2639
  return () => {
2636
- wr(m), x.current !== null && (window.clearTimeout(x.current), x.current = null), S.current = null, T(), e.removeEventListener("update", n), j.domElement.removeEventListener("pointerdown", ne), j.domElement.removeEventListener("pointermove", re), window.removeEventListener("pointerup", ie), window.removeEventListener("pointerup", N), j.domElement.removeEventListener("contextmenu", o), j.domElement.removeEventListener("pointerup", a), j.domElement.removeEventListener("pointerdown", i), j.domElement.removeEventListener("pointermove", k), j.domElement.removeEventListener("pointerleave", T);
2640
+ Cr(h), S.current !== null && (window.clearTimeout(S.current), S.current = null), C.current = null, E(), e.removeEventListener("update", n), j.domElement.removeEventListener("pointerdown", re), j.domElement.removeEventListener("pointermove", F), window.removeEventListener("pointerup", ie), window.removeEventListener("pointerup", P), j.domElement.removeEventListener("contextmenu", o), j.domElement.removeEventListener("pointerup", a), j.domElement.removeEventListener("pointerdown", r), j.domElement.removeEventListener("pointermove", k), j.domElement.removeEventListener("pointerleave", E);
2637
2641
  };
2638
2642
  });
2639
2643
  }
2640
2644
  //#endregion
2641
2645
  //#region src/viewer/Camera/useCameraFit.tsx
2642
- var Nr = new I(1, 1, 1).normalize(), Pr = 1.18;
2643
- function Fr() {
2646
+ var Mr = new L(1, 1, 1).normalize(), Nr = 1.18;
2647
+ function Pr() {
2644
2648
  let { camera: e } = p();
2645
2649
  return i((t, n, r) => {
2646
- if (!t.current || !(e instanceof se)) return;
2650
+ if (!t.current || !(e instanceof oe)) return;
2647
2651
  let i = new g().setFromObject(t.current);
2648
2652
  if (i.isEmpty()) return;
2649
- let a = i.getCenter(new I()), o = i.getBoundingSphere(new de()), s = te.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * Pr;
2650
- e.position.copy(a).addScaledVector(Nr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
2653
+ let a = i.getCenter(new L()), o = i.getBoundingSphere(new ue()), s = ne.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * Nr;
2654
+ e.position.copy(a).addScaledVector(Mr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
2651
2655
  let d = n.current;
2652
- d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector(Nr, u * .8), r.current.lookAt(a));
2656
+ d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector(Mr, u * .8), r.current.lookAt(a));
2653
2657
  }, [e]);
2654
2658
  }
2655
2659
  //#endregion
2656
2660
  //#region src/viewer/store/ViewerStoreProvider.tsx
2657
- function Ir({ children: e, store: t }) {
2658
- let [n] = u(() => t ?? Ae());
2659
- return /* @__PURE__ */ L(Te.Provider, {
2661
+ function Fr({ children: e, store: t }) {
2662
+ let [n] = u(() => t ?? ke());
2663
+ return /* @__PURE__ */ R(we.Provider, {
2660
2664
  value: n,
2661
2665
  children: e
2662
2666
  });
2663
2667
  }
2664
2668
  //#endregion
2665
2669
  //#region src/viewer/utils/ExportUtils/ExportUtils.ts
2666
- var Lr = new TextEncoder(), Rr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", zr = "Unknown", Br = ["elementID", "ifcguid"], Vr = 0, Hr = 33;
2667
- function Ur(e) {
2670
+ var Ir = new TextEncoder(), Lr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", Rr = "Unknown", zr = ["elementID", "ifcguid"], Br = 0, Vr = 33;
2671
+ function Hr(e) {
2668
2672
  return !!e && typeof e == "object" && !Array.isArray(e);
2669
2673
  }
2670
- function Wr(e, t) {
2671
- return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t : Ur(e) && "value" in e ? Wr(e.value, t) : null;
2674
+ function Ur(e, t) {
2675
+ return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t : Hr(e) && "value" in e ? Ur(e.value, t) : null;
2672
2676
  }
2673
- function Gr(e, t) {
2674
- let n = Wr(e, t);
2677
+ function Wr(e, t) {
2678
+ let n = Ur(e, t);
2675
2679
  if (n !== null) return n;
2676
2680
  if (Array.isArray(e)) {
2677
2681
  if (!e.length) return t;
2678
- let n = e.map((e) => Wr(e, t));
2682
+ let n = e.map((e) => Ur(e, t));
2679
2683
  if (n.every((e) => e !== null)) {
2680
2684
  let e = n.join(", ");
2681
2685
  return e.trim() ? e : t;
@@ -2688,21 +2692,21 @@ function Gr(e, t) {
2688
2692
  return t;
2689
2693
  }
2690
2694
  }
2691
- function K(e) {
2695
+ function q(e) {
2692
2696
  return typeof e == "string" && e.trim() ? e : null;
2693
2697
  }
2694
- function Kr(e) {
2695
- let t = Ur(e.props) ? e.props : {};
2696
- return K(e.type ?? e.Type ?? t.type ?? t.Type) ?? zr;
2698
+ function Gr(e) {
2699
+ let t = Hr(e.props) ? e.props : {};
2700
+ return q(e.type ?? e.Type ?? t.type ?? t.Type) ?? Rr;
2697
2701
  }
2698
- function qr(e) {
2699
- let t = Ur(e.props) ? e.props : {};
2700
- return K(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
2702
+ function Kr(e) {
2703
+ let t = Hr(e.props) ? e.props : {};
2704
+ return q(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
2701
2705
  }
2702
- function Jr(e, t) {
2703
- return K(e.Name) ?? K(e.name) ?? K(e.DisplayName) ?? K(e.displayName) ?? `Property ${t + 1}`;
2706
+ function qr(e, t) {
2707
+ return q(e.Name) ?? q(e.name) ?? q(e.DisplayName) ?? q(e.displayName) ?? `Property ${t + 1}`;
2704
2708
  }
2705
- function Yr(e) {
2709
+ function Jr(e) {
2706
2710
  for (let t of [
2707
2711
  "NominalValue",
2708
2712
  "nominalValue",
@@ -2725,18 +2729,18 @@ function Yr(e) {
2725
2729
  "description"
2726
2730
  ].includes(e)));
2727
2731
  }
2728
- function Xr(e, t) {
2729
- return K(e.name) ?? K(e.Name) ?? `Set ${t + 1}`;
2732
+ function Yr(e, t) {
2733
+ return q(e.name) ?? q(e.Name) ?? `Set ${t + 1}`;
2730
2734
  }
2731
- function Zr(e) {
2735
+ function Xr(e) {
2732
2736
  let t = e.props;
2733
- return Array.isArray(t) ? t.map((e, t) => Ur(e) ? {
2734
- label: Jr(e, t),
2735
- value: Yr(e)
2737
+ return Array.isArray(t) ? t.map((e, t) => Hr(e) ? {
2738
+ label: qr(e, t),
2739
+ value: Jr(e)
2736
2740
  } : {
2737
2741
  label: `Property ${t + 1}`,
2738
2742
  value: e
2739
- }) : Ur(t) ? Object.entries(t).map(([e, t]) => ({
2743
+ }) : Hr(t) ? Object.entries(t).map(([e, t]) => ({
2740
2744
  label: e,
2741
2745
  value: t
2742
2746
  })) : Object.entries(e).filter(([e]) => ![
@@ -2750,14 +2754,14 @@ function Zr(e) {
2750
2754
  value: t
2751
2755
  }));
2752
2756
  }
2753
- function Qr(e, t) {
2757
+ function Zr(e, t) {
2754
2758
  e.columnSet.has(t) || (e.columnSet.add(t), e.columns.push(t));
2755
2759
  }
2756
- function $r(e, t, n, r, i) {
2760
+ function Qr(e, t, n, r, i) {
2757
2761
  let a = n.trim();
2758
- a && (Qr(e, a), t[a] = Gr(r, i));
2762
+ a && (Zr(e, a), t[a] = Wr(r, i));
2759
2763
  }
2760
- function ei(e, t, n) {
2764
+ function $r(e, t, n) {
2761
2765
  let r = {};
2762
2766
  return Object.entries(t).forEach(([t, i]) => {
2763
2767
  [
@@ -2765,33 +2769,33 @@ function ei(e, t, n) {
2765
2769
  "guid",
2766
2770
  "props",
2767
2771
  "sets"
2768
- ].includes(t) || $r(e, r, t, i, n);
2769
- }), Ur(t.props) && Object.entries(t.props).forEach(([t, i]) => {
2770
- $r(e, r, t, i, n);
2772
+ ].includes(t) || Qr(e, r, t, i, n);
2773
+ }), Hr(t.props) && Object.entries(t.props).forEach(([t, i]) => {
2774
+ Qr(e, r, t, i, n);
2771
2775
  }), Array.isArray(t.sets) && t.sets.forEach((t, i) => {
2772
- let a = Xr(t, i);
2773
- Zr(t).forEach((t) => {
2774
- $r(e, r, `${a}.${t.label}`, t.value, n);
2776
+ let a = Yr(t, i);
2777
+ Xr(t).forEach((t) => {
2778
+ Qr(e, r, `${a}.${t.label}`, t.value, n);
2775
2779
  });
2776
2780
  }), r;
2777
2781
  }
2778
- function ti(e, t, n) {
2782
+ function ei(e, t, n) {
2779
2783
  Object.entries(t).forEach(([t, r]) => {
2780
2784
  let i = Number(t);
2781
2785
  if (!Number.isFinite(i)) return;
2782
- let a = Kr(r), o = e.get(a);
2786
+ let a = Gr(r), o = e.get(a);
2783
2787
  o || (o = {
2784
2788
  columns: [],
2785
2789
  columnSet: /* @__PURE__ */ new Set(),
2786
2790
  rows: []
2787
2791
  }, e.set(a, o)), o.rows.push({
2788
2792
  elementID: i,
2789
- ifcguid: qr(r),
2790
- values: ei(o, r, n)
2793
+ ifcguid: Kr(r),
2794
+ values: $r(o, r, n)
2791
2795
  });
2792
2796
  });
2793
2797
  }
2794
- function ni(e) {
2798
+ function ti(e) {
2795
2799
  return e.replace(/[<>&'"]/g, (e) => {
2796
2800
  switch (e) {
2797
2801
  case "<": return "&lt;";
@@ -2803,7 +2807,7 @@ function ni(e) {
2803
2807
  }
2804
2808
  });
2805
2809
  }
2806
- function ri(e) {
2810
+ function ni(e) {
2807
2811
  let t = e, n = "";
2808
2812
  for (; t > 0;) {
2809
2813
  let e = (t - 1) % 26;
@@ -2811,45 +2815,45 @@ function ri(e) {
2811
2815
  }
2812
2816
  return n;
2813
2817
  }
2814
- function ii(e, t, n) {
2815
- return `<c r="${`${ri(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${ni(e)}</t></is></c>`;
2818
+ function ri(e, t, n) {
2819
+ return `<c r="${`${ni(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${ti(e)}</t></is></c>`;
2816
2820
  }
2817
- function ai(e) {
2818
- return `${Rr}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
2821
+ function ii(e) {
2822
+ return `${Lr}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
2819
2823
  let n = t + 1;
2820
- return `<row r="${n}">${e.map((e, t) => ii(e, n, t + 1)).join("")}</row>`;
2824
+ return `<row r="${n}">${e.map((e, t) => ri(e, n, t + 1)).join("")}</row>`;
2821
2825
  }).join("")}</sheetData></worksheet>`;
2822
2826
  }
2823
- function oi(e) {
2824
- return e.replace(/[\\/?*[\]:]/g, " ").trim() || zr;
2827
+ function ai(e) {
2828
+ return e.replace(/[\\/?*[\]:]/g, " ").trim() || Rr;
2825
2829
  }
2826
- function si(e, t) {
2827
- let n = oi(e).slice(0, 31), r = n, i = 2;
2830
+ function oi(e, t) {
2831
+ let n = ai(e).slice(0, 31), r = n, i = 2;
2828
2832
  for (; t.has(r.toLowerCase());) {
2829
2833
  let e = ` (${i})`;
2830
2834
  r = `${n.slice(0, 31 - e.length)}${e}`, i += 1;
2831
2835
  }
2832
2836
  return t.add(r.toLowerCase()), r;
2833
2837
  }
2834
- function ci(e) {
2835
- return `${Rr}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((e, t) => {
2838
+ function si(e) {
2839
+ return `${Lr}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((e, t) => {
2836
2840
  let n = t + 1;
2837
- return `<sheet name="${ni(e)}" sheetId="${n}" r:id="rId${n}"/>`;
2841
+ return `<sheet name="${ti(e)}" sheetId="${n}" r:id="rId${n}"/>`;
2838
2842
  }).join("")}</sheets></workbook>`;
2839
2843
  }
2840
- function li(e) {
2841
- return `${Rr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
2844
+ function ci(e) {
2845
+ return `${Lr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
2842
2846
  let n = t + 1;
2843
2847
  return `<Relationship Id="rId${n}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${n}.xml"/>`;
2844
2848
  }).join("")}</Relationships>`;
2845
2849
  }
2846
- function ui() {
2847
- return `${Rr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
2850
+ function li() {
2851
+ return `${Lr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
2848
2852
  }
2849
- function di(e) {
2850
- return `${Rr}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${e.map((e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`;
2853
+ function ui(e) {
2854
+ return `${Lr}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${e.map((e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`;
2851
2855
  }
2852
- function fi() {
2856
+ function di() {
2853
2857
  let e = new Uint32Array(256);
2854
2858
  for (let t = 0; t < 256; t++) {
2855
2859
  let n = t;
@@ -2858,121 +2862,121 @@ function fi() {
2858
2862
  }
2859
2863
  return e;
2860
2864
  }
2861
- var pi = fi();
2862
- function mi(e) {
2865
+ var fi = di();
2866
+ function pi(e) {
2863
2867
  let t = 4294967295;
2864
- for (let n of e) t = pi[(t ^ n) & 255] ^ t >>> 8;
2868
+ for (let n of e) t = fi[(t ^ n) & 255] ^ t >>> 8;
2865
2869
  return (t ^ 4294967295) >>> 0;
2866
2870
  }
2867
- function hi(e) {
2871
+ function mi(e) {
2868
2872
  let t = new Uint8Array(30 + e.nameBytes.length), n = new DataView(t.buffer);
2869
- return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10, Vr, !0), n.setUint16(12, Hr, !0), n.setUint32(14, e.crc, !0), n.setUint32(18, e.data.length, !0), n.setUint32(22, e.data.length, !0), n.setUint16(26, e.nameBytes.length, !0), n.setUint16(28, 0, !0), t.set(e.nameBytes, 30), t;
2873
+ return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10, Br, !0), n.setUint16(12, Vr, !0), n.setUint32(14, e.crc, !0), n.setUint32(18, e.data.length, !0), n.setUint32(22, e.data.length, !0), n.setUint16(26, e.nameBytes.length, !0), n.setUint16(28, 0, !0), t.set(e.nameBytes, 30), t;
2870
2874
  }
2871
- function gi(e) {
2875
+ function hi(e) {
2872
2876
  let t = new Uint8Array(46 + e.nameBytes.length), n = new DataView(t.buffer);
2873
- return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12, Vr, !0), n.setUint16(14, Hr, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.data.length, !0), n.setUint32(24, e.data.length, !0), n.setUint16(28, e.nameBytes.length, !0), n.setUint16(30, 0, !0), n.setUint16(32, 0, !0), n.setUint16(34, 0, !0), n.setUint16(36, 0, !0), n.setUint32(38, 0, !0), n.setUint32(42, e.offset, !0), t.set(e.nameBytes, 46), t;
2877
+ return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12, Br, !0), n.setUint16(14, Vr, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.data.length, !0), n.setUint32(24, e.data.length, !0), n.setUint16(28, e.nameBytes.length, !0), n.setUint16(30, 0, !0), n.setUint16(32, 0, !0), n.setUint16(34, 0, !0), n.setUint16(36, 0, !0), n.setUint32(38, 0, !0), n.setUint32(42, e.offset, !0), t.set(e.nameBytes, 46), t;
2874
2878
  }
2875
- function _i(e, t, n) {
2879
+ function gi(e, t, n) {
2876
2880
  let r = new Uint8Array(22), i = new DataView(r.buffer);
2877
2881
  return i.setUint32(0, 101010256, !0), i.setUint16(4, 0, !0), i.setUint16(6, 0, !0), i.setUint16(8, e, !0), i.setUint16(10, e, !0), i.setUint32(12, t, !0), i.setUint32(16, n, !0), i.setUint16(20, 0, !0), r;
2878
2882
  }
2879
- function vi(e, t) {
2883
+ function _i(e, t) {
2880
2884
  let n = new Uint8Array(t), r = 0;
2881
2885
  return e.forEach((e) => {
2882
2886
  n.set(e, r), r += e.length;
2883
2887
  }), n;
2884
2888
  }
2885
- function yi(e) {
2889
+ function vi(e) {
2886
2890
  let t = 0, n = e.map((e) => {
2887
2891
  let n = {
2888
2892
  ...e,
2889
- crc: mi(e.data),
2890
- nameBytes: Lr.encode(e.path),
2893
+ crc: pi(e.data),
2894
+ nameBytes: Ir.encode(e.path),
2891
2895
  offset: t
2892
2896
  };
2893
2897
  return t += 30 + n.nameBytes.length + n.data.length, n;
2894
2898
  }), r = [];
2895
2899
  n.forEach((e) => {
2896
- r.push(hi(e), e.data);
2900
+ r.push(mi(e), e.data);
2897
2901
  });
2898
2902
  let i = t, a = 0;
2899
2903
  return n.forEach((e) => {
2900
- let t = gi(e);
2904
+ let t = hi(e);
2901
2905
  a += t.length, r.push(t);
2902
- }), r.push(_i(n.length, a, i)), vi(r, r.reduce((e, t) => e + t.length, 0));
2906
+ }), r.push(gi(n.length, a, i)), _i(r, r.reduce((e, t) => e + t.length, 0));
2903
2907
  }
2904
- function bi(e, t) {
2908
+ function yi(e, t) {
2905
2909
  let n = /* @__PURE__ */ new Map();
2906
- e && ti(n, e.props, t);
2910
+ e && ei(n, e.props, t);
2907
2911
  let r = /* @__PURE__ */ new Set(), i = Array.from(n.entries()).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
2908
- let i = [...Br, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
2912
+ let i = [...zr, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
2909
2913
  String(e.elementID),
2910
2914
  e.ifcguid || t,
2911
2915
  ...n.columns.map((n) => e.values[n] ?? t)
2912
2916
  ]);
2913
2917
  return {
2914
- name: si(e, r),
2918
+ name: oi(e, r),
2915
2919
  rows: [i, ...a]
2916
2920
  };
2917
2921
  });
2918
2922
  return i.length || i.push({
2919
- name: si(zr, r),
2920
- rows: [Br]
2923
+ name: oi(Rr, r),
2924
+ rows: [zr]
2921
2925
  }), i;
2922
2926
  }
2923
- function xi(e, t = {}) {
2924
- let n = bi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
2927
+ function bi(e, t = {}) {
2928
+ let n = yi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
2925
2929
  {
2926
2930
  path: "[Content_Types].xml",
2927
- data: Lr.encode(di(r))
2931
+ data: Ir.encode(ui(r))
2928
2932
  },
2929
2933
  {
2930
2934
  path: "_rels/.rels",
2931
- data: Lr.encode(ui())
2935
+ data: Ir.encode(li())
2932
2936
  },
2933
2937
  {
2934
2938
  path: "xl/workbook.xml",
2935
- data: Lr.encode(ci(r))
2939
+ data: Ir.encode(si(r))
2936
2940
  },
2937
2941
  {
2938
2942
  path: "xl/_rels/workbook.xml.rels",
2939
- data: Lr.encode(li(r))
2943
+ data: Ir.encode(ci(r))
2940
2944
  },
2941
2945
  ...n.map((e, t) => ({
2942
2946
  path: `xl/worksheets/sheet${t + 1}.xml`,
2943
- data: Lr.encode(ai(e.rows))
2947
+ data: Ir.encode(ii(e.rows))
2944
2948
  }))
2945
2949
  ];
2946
- return new Blob([yi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
2950
+ return new Blob([vi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
2947
2951
  }
2948
- function Si(e) {
2952
+ function xi(e) {
2949
2953
  return e.split(/[?#]/)[0].split(/[\\/]/).pop()?.replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "").trim() || "model";
2950
2954
  }
2951
- function Ci(e, t) {
2952
- let n = t.fileName?.trim() || `${Si(t.modelName ?? e?.name ?? "model")}_properties`;
2955
+ function Si(e, t) {
2956
+ let n = t.fileName?.trim() || `${xi(t.modelName ?? e?.name ?? "model")}_properties`;
2953
2957
  return n.toLowerCase().endsWith(".xlsx") ? n : `${n}.xlsx`;
2954
2958
  }
2955
- function wi(e, t = {}) {
2959
+ function Ci(e, t = {}) {
2956
2960
  return {
2957
- blob: xi(e, t),
2958
- name: Ci(e, t)
2961
+ blob: bi(e, t),
2962
+ name: Si(e, t)
2959
2963
  };
2960
2964
  }
2961
2965
  //#endregion
2962
2966
  //#region src/viewer/api/ViewerPropertiesApi.ts
2963
- function q(e) {
2967
+ function J(e) {
2964
2968
  return !!e && typeof e == "object" && !Array.isArray(e);
2965
2969
  }
2966
- function Ti(e, t) {
2970
+ function wi(e, t) {
2967
2971
  return Object.prototype.hasOwnProperty.call(e, t);
2968
2972
  }
2973
+ function Ti(e) {
2974
+ return J(e);
2975
+ }
2969
2976
  function Ei(e) {
2970
- return q(e);
2977
+ return Array.isArray(e) ? e.filter(Ti) : J(e) ? Object.values(e).filter(Ti) : [];
2971
2978
  }
2972
2979
  function Di(e) {
2973
- return Array.isArray(e) ? e.filter(Ei) : q(e) ? Object.values(e).filter(Ei) : [];
2974
- }
2975
- function Oi(e) {
2976
2980
  if (typeof e == "number" && Number.isFinite(e)) return e;
2977
2981
  if (typeof e == "string") {
2978
2982
  let t = Number(e);
@@ -2980,10 +2984,10 @@ function Oi(e) {
2980
2984
  }
2981
2985
  return null;
2982
2986
  }
2983
- function ki(e) {
2984
- return Oi(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
2987
+ function Oi(e) {
2988
+ return Di(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
2985
2989
  }
2986
- function Ai(e) {
2990
+ function ki(e) {
2987
2991
  let t = [
2988
2992
  e.children,
2989
2993
  e.items,
@@ -2991,40 +2995,40 @@ function Ai(e) {
2991
2995
  e.childs
2992
2996
  ];
2993
2997
  for (let e of t) {
2994
- let t = Di(e);
2998
+ let t = Ei(e);
2995
2999
  if (t.length) return t;
2996
3000
  }
2997
3001
  return [];
2998
3002
  }
2999
- function ji(e) {
3000
- let t = q(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
3003
+ function Ai(e) {
3004
+ let t = J(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
3001
3005
  return typeof n == "string" ? n : "";
3002
3006
  }
3003
- function Mi(e) {
3007
+ function ji(e) {
3004
3008
  return e.replace(/[^a-z0-9]/gi, "").toUpperCase();
3005
3009
  }
3006
- function Ni(e) {
3007
- return Mi(ji(e)) === "IFCBUILDINGSTOREY";
3010
+ function Mi(e) {
3011
+ return ji(Ai(e)) === "IFCBUILDINGSTOREY";
3008
3012
  }
3009
- var Pi = new Set([
3013
+ var Ni = new Set([
3010
3014
  "children",
3011
3015
  "childs",
3012
3016
  "elements",
3013
3017
  "items"
3014
3018
  ]);
3015
- function Fi(e) {
3019
+ function Pi(e) {
3016
3020
  let t = {};
3017
3021
  return Object.entries(e).forEach(([e, n]) => {
3018
- Pi.has(e) || (t[e] = n);
3022
+ Ni.has(e) || (t[e] = n);
3019
3023
  }), t;
3020
3024
  }
3021
- function Ii(e, t) {
3025
+ function Fi(e, t) {
3022
3026
  return Array.isArray(t) ? {
3023
- children: Di(t),
3027
+ children: Ei(t),
3024
3028
  name: `Model ${e}`,
3025
3029
  type: "Model"
3026
- } : q(t) ? ki(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
3027
- children: Di(t),
3030
+ } : J(t) ? Oi(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
3031
+ children: Ei(t),
3028
3032
  name: `Model ${e}`,
3029
3033
  type: "Model"
3030
3034
  } : {
@@ -3033,46 +3037,46 @@ function Ii(e, t) {
3033
3037
  type: "Model"
3034
3038
  };
3035
3039
  }
3036
- function Li(e) {
3040
+ function Ii(e) {
3037
3041
  let t = [];
3038
- return Ai(e).forEach((e) => {
3039
- let n = ki(e);
3040
- n !== null && t.push(n), t.push(...Li(e));
3042
+ return ki(e).forEach((e) => {
3043
+ let n = Oi(e);
3044
+ n !== null && t.push(n), t.push(...Ii(e));
3041
3045
  }), t;
3042
3046
  }
3043
- function Ri(e, t, n, r) {
3044
- let i = ki(t), a = i === null ? void 0 : n[e]?.[i], o = {
3045
- ...Fi(t),
3047
+ function Li(e, t, n, r) {
3048
+ let i = Oi(t), a = i === null ? void 0 : n[e]?.[i], o = {
3049
+ ...Pi(t),
3046
3050
  ...a ?? {},
3047
3051
  modelID: e
3048
3052
  };
3049
- return r && (o.elements = Li(t)), o;
3053
+ return r && (o.elements = Ii(t)), o;
3050
3054
  }
3051
- function zi(e, t, n, r, i) {
3052
- Ni(t) && n.push(Ri(e, t, r, i)), Ai(t).forEach((t) => zi(e, t, n, r, i));
3055
+ function Ri(e, t, n, r, i) {
3056
+ Mi(t) && n.push(Li(e, t, r, i)), ki(t).forEach((t) => Ri(e, t, n, r, i));
3053
3057
  }
3054
- function Bi(e, t, n = !1) {
3058
+ function zi(e, t, n = !1) {
3055
3059
  let r = {};
3056
3060
  return Object.entries(e).forEach(([e, i]) => {
3057
3061
  let a = Number(e), o = [];
3058
- zi(a, Ii(a, i), o, t, n), r[a] = o;
3062
+ Ri(a, Fi(a, i), o, t, n), r[a] = o;
3059
3063
  }), r;
3060
3064
  }
3061
- function Vi(e, t, n, r = !1) {
3065
+ function Bi(e, t, n, r = !1) {
3062
3066
  let i = [], a = e[n];
3063
3067
  if (!a) throw Error(`Model with modelID ${n} not found`);
3064
- return zi(Number(n), Ii(Number(n), a), i, t, r), i;
3068
+ return Ri(Number(n), Fi(Number(n), a), i, t, r), i;
3065
3069
  }
3066
- function Hi(e, t, n) {
3070
+ function Vi(e, t, n) {
3067
3071
  return e[t]?.[n];
3068
3072
  }
3069
- function Ui(e) {
3070
- return typeof e == "string" ? e : q(e) && typeof e.value == "string" ? e.value : "";
3073
+ function Hi(e) {
3074
+ return typeof e == "string" ? e : J(e) && typeof e.value == "string" ? e.value : "";
3071
3075
  }
3072
- function Wi(e, t) {
3073
- return Ui(e.Name) || Ui(e.name) || Ui(e.DisplayName) || Ui(e.displayName) || `Property ${t + 1}`;
3076
+ function Ui(e, t) {
3077
+ return Hi(e.Name) || Hi(e.name) || Hi(e.DisplayName) || Hi(e.displayName) || `Property ${t + 1}`;
3074
3078
  }
3075
- function Gi(e) {
3079
+ function Wi(e) {
3076
3080
  for (let t of [
3077
3081
  "NominalValue",
3078
3082
  "nominalValue",
@@ -3095,44 +3099,44 @@ function Gi(e) {
3095
3099
  "description"
3096
3100
  ].includes(e)));
3097
3101
  }
3098
- function Ki(e) {
3099
- return Ui(e.name) || Ui(e.Name);
3102
+ function Gi(e) {
3103
+ return Hi(e.name) || Hi(e.Name);
3104
+ }
3105
+ function Ki(e, t) {
3106
+ return wi(e, t) ? e[t] : void 0;
3100
3107
  }
3101
3108
  function qi(e, t) {
3102
- return Ti(e, t) ? e[t] : void 0;
3103
- }
3104
- function Ji(e, t) {
3105
3109
  let n = e.props;
3106
- if (q(n)) {
3107
- let e = qi(n, t);
3110
+ if (J(n)) {
3111
+ let e = Ki(n, t);
3108
3112
  if (e !== void 0) return e;
3109
3113
  }
3110
3114
  if (Array.isArray(n)) for (let e = 0; e < n.length; e += 1) {
3111
3115
  let r = n[e];
3112
- if (!q(r)) continue;
3116
+ if (!J(r)) continue;
3113
3117
  let i = r;
3114
- if (Wi(i, e) === t) return Gi(i);
3118
+ if (Ui(i, e) === t) return Wi(i);
3115
3119
  }
3116
- return qi(e, t);
3120
+ return Ki(e, t);
3117
3121
  }
3118
- function Yi(e, t, n) {
3122
+ function Ji(e, t, n) {
3119
3123
  if (!e) return;
3120
3124
  if (n !== void 0) {
3121
- let r = e.sets?.find((e) => Ki(e) === n);
3122
- return r ? Ji(r, t) : void 0;
3125
+ let r = e.sets?.find((e) => Gi(e) === n);
3126
+ return r ? qi(r, t) : void 0;
3123
3127
  }
3124
- if (q(e.props)) {
3125
- let n = qi(e.props, t);
3128
+ if (J(e.props)) {
3129
+ let n = Ki(e.props, t);
3126
3130
  if (n !== void 0) return n;
3127
3131
  }
3128
- let r = qi(e, t);
3132
+ let r = Ki(e, t);
3129
3133
  if (r !== void 0) return r;
3130
3134
  for (let n of e.sets ?? []) {
3131
- let e = Ji(n, t);
3135
+ let e = qi(n, t);
3132
3136
  if (e !== void 0) return e;
3133
3137
  }
3134
3138
  }
3135
- function Xi(e, t, n, r) {
3139
+ function Yi(e, t, n, r) {
3136
3140
  let i = t[e];
3137
3141
  return i ? {
3138
3142
  data: {},
@@ -3141,44 +3145,44 @@ function Xi(e, t, n, r) {
3141
3145
  structure: n[e] ?? {}
3142
3146
  } : null;
3143
3147
  }
3144
- function Zi(e) {
3148
+ function Xi(e) {
3145
3149
  return {
3146
3150
  exportAllExcel: (t) => {
3147
3151
  let n = e.getState();
3148
3152
  return Object.keys(n.modelProps).flatMap((e) => {
3149
- let r = Xi(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3150
- return r ? [wi(r, t)] : [];
3153
+ let r = Yi(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3154
+ return r ? [Ci(r, t)] : [];
3151
3155
  });
3152
3156
  },
3153
3157
  exportExcel: (t, n) => {
3154
- let r = e.getState(), i = Xi(t, r.modelProps, r.modelStructure, r.modelNames);
3155
- return i ? wi(i, n) : null;
3158
+ let r = e.getState(), i = Yi(t, r.modelProps, r.modelStructure, r.modelNames);
3159
+ return i ? Ci(i, n) : null;
3156
3160
  },
3157
3161
  getAllLevels: (t = !1) => {
3158
3162
  let n = e.getState();
3159
- return Bi(n.modelStructure, n.modelProps, t);
3163
+ return zi(n.modelStructure, n.modelProps, t);
3160
3164
  },
3161
3165
  getAllModelLevels: (t, n = !1) => {
3162
3166
  let r = e.getState();
3163
- return Vi(r.modelStructure, r.modelProps, t, n);
3167
+ return Bi(r.modelStructure, r.modelProps, t, n);
3164
3168
  },
3165
3169
  getModelProps: () => e.getState().modelProps,
3166
3170
  getModelStructure: () => e.getState().modelStructure,
3167
- getParamsByElement: (t, n) => Hi(e.getState().modelProps, t, n),
3168
- getParamValueByName: Yi,
3169
- getParamValueByElement: (t, n, r, i) => Yi(Hi(e.getState().modelProps, t, n), r, i)
3171
+ getParamsByElement: (t, n) => Vi(e.getState().modelProps, t, n),
3172
+ getParamValueByName: Ji,
3173
+ getParamValueByElement: (t, n, r, i) => Ji(Vi(e.getState().modelProps, t, n), r, i)
3170
3174
  };
3171
3175
  }
3172
3176
  //#endregion
3173
3177
  //#region src/viewer/Loaders/BmtConverter.ts
3174
- var Qi = "BMT", $i = 1, J = {
3178
+ var Zi = "BMT", Qi = 1, Y = {
3175
3179
  PROP: 1,
3176
3180
  MESH: 2,
3177
3181
  STRUCTURE: 3,
3178
3182
  GRIDS: 4,
3179
3183
  MATRIX: 5,
3180
3184
  MESHSPACE: 6
3181
- }, ea = "application/json", ta = "application/octet-stream", na = class {
3185
+ }, $i = "application/json", ea = "application/octet-stream", ta = class {
3182
3186
  chunks = [];
3183
3187
  length = 0;
3184
3188
  writeUint8(e) {
@@ -3198,7 +3202,7 @@ var Qi = "BMT", $i = 1, J = {
3198
3202
  e.set(n, t), t += n.byteLength;
3199
3203
  }), e;
3200
3204
  }
3201
- }, ra = class {
3205
+ }, na = class {
3202
3206
  textEncoder = new TextEncoder();
3203
3207
  ifcLoader = null;
3204
3208
  async ConvertIfcFileToBmt(e, t = {}) {
@@ -3217,10 +3221,40 @@ var Qi = "BMT", $i = 1, J = {
3217
3221
  return this.ConvertIfcFileToBmt(e, t);
3218
3222
  }
3219
3223
  ConvertToBmt(e, t = {}) {
3220
- let n = this.normalizeModels(e), r = this.getVisibleIdsByModel(t), i = this.getIfcSpaceIdsByModel(t.activeViewRoot), a = [], o = {};
3221
- return n.forEach(([e, n], s) => {
3222
- let c = this.createSerializableModel(e, n, t, r, i), l = this.getModelFileBaseName(e, s, t);
3223
- o[e] = c, a.push(...this.createModelFiles(c, l, !!t.useMinVersion));
3224
+ let n = this.normalizeModels(e), r = this.getVisibleIdsByModel(t), i = this.getIfcSpaceIdsByModel(t.activeViewRoot), a = [], o = {}, s = Math.max(n.length, 1);
3225
+ return n.forEach(([e, n], c) => {
3226
+ let l = (n) => {
3227
+ t.onProgress?.({
3228
+ ...n,
3229
+ modelID: e,
3230
+ modelIndex: c,
3231
+ progress: this.clampProgress((c + this.clampProgress(n.progress)) / s)
3232
+ });
3233
+ };
3234
+ l({
3235
+ message: "Preparing model for BMT export",
3236
+ phase: "preparing",
3237
+ progress: 0
3238
+ }), l({
3239
+ message: "Filtering visible elements",
3240
+ phase: "filtering",
3241
+ progress: .05
3242
+ });
3243
+ let u = this.createSerializableModel(e, n, t, r, i), d = this.getModelFileBaseName(e, c, t);
3244
+ o[e] = u, l({
3245
+ message: "Writing BMT output",
3246
+ phase: "writing",
3247
+ progress: .15
3248
+ }), a.push(...this.createModelFiles(u, d, !!t.useMinVersion, (e) => {
3249
+ l({
3250
+ ...e,
3251
+ progress: .15 + this.clampProgress(e.progress) * .84
3252
+ });
3253
+ })), l({
3254
+ message: "BMT model export complete",
3255
+ phase: "complete",
3256
+ progress: 1
3257
+ });
3224
3258
  }), {
3225
3259
  files: a,
3226
3260
  models: o
@@ -3231,7 +3265,7 @@ var Qi = "BMT", $i = 1, J = {
3231
3265
  }
3232
3266
  async getIfcLoader(e) {
3233
3267
  if (!this.ifcLoader) {
3234
- let { IFCLoader: e } = await import("./IFCLoader-B_gBDDmN.js");
3268
+ let { IFCLoader: e } = await import("./IFCLoader-RIJas-B5.js");
3235
3269
  this.ifcLoader = new e();
3236
3270
  }
3237
3271
  return this.configureIfcLoader(this.ifcLoader, e), this.ifcLoader;
@@ -3263,48 +3297,127 @@ var Qi = "BMT", $i = 1, J = {
3263
3297
  normalizeBaseName(e) {
3264
3298
  return ((e.split(/[?#]/)[0] ?? e).split(/[\\/]/).pop() || "model").replace(/_props\.json$/i, "").replace(/\.min\.bmt$/i, "").replace(/\.(bmt|ifc)$/i, "");
3265
3299
  }
3266
- createModelFiles(e, t, n) {
3267
- let r = n ? `${t}.min.bmt` : `${t}.bmt`, i = this.createBmtBytes(e, !n), a = [{
3268
- blob: new Blob([i], { type: ta }),
3269
- bytes: i,
3270
- name: r,
3300
+ createModelFiles(e, t, n, r) {
3301
+ let i = n ? `${t}.min.bmt` : `${t}.bmt`, a = n ? .65 : 1, o = this.createBmtBytes(e, !n, (e) => {
3302
+ r?.({
3303
+ ...e,
3304
+ progress: this.clampProgress(e.progress) * a
3305
+ });
3306
+ }), s = [{
3307
+ blob: new Blob([o], { type: ea }),
3308
+ bytes: o,
3309
+ name: i,
3271
3310
  type: "bmt"
3272
3311
  }];
3273
3312
  if (n) {
3313
+ r?.({
3314
+ message: "Writing properties metadata",
3315
+ phase: "metadata",
3316
+ progress: a
3317
+ });
3274
3318
  let n = this.encodePrettyJson({
3275
3319
  props: e.props,
3276
3320
  structure: e.structure
3277
3321
  });
3278
- a.push({
3279
- blob: new Blob([n], { type: ea }),
3322
+ r?.({
3323
+ message: "Properties metadata encoded",
3324
+ phase: "metadata",
3325
+ progress: .95
3326
+ }), s.push({
3327
+ blob: new Blob([n], { type: $i }),
3280
3328
  bytes: n,
3281
3329
  name: `${t}_props.json`,
3282
3330
  type: "json"
3331
+ }), r?.({
3332
+ message: "Properties metadata file ready",
3333
+ phase: "metadata",
3334
+ progress: 1
3283
3335
  });
3284
3336
  }
3285
- return a;
3286
- }
3287
- createBmtBytes(e, t) {
3288
- let n = new na();
3289
- return n.writeBytes(this.textEncoder.encode(Qi)), n.writeUint8($i), t && this.writeProps(n, e.props), e.grids !== void 0 && this.writeJsonChunk(n, J.GRIDS, e.grids), this.writeMeshes(n, e), t && this.writeJsonChunk(n, J.STRUCTURE, e.structure), e.coordinationMatrix && !this.hasMeshMatrices(e) && this.writeTextChunk(n, J.MATRIX, e.coordinationMatrix), n.toUint8Array();
3337
+ return s;
3290
3338
  }
3291
- writeProps(e, t) {
3292
- Object.entries(t).forEach(([t, n]) => {
3293
- let r = Number(t), i = n.id === void 0 && Number.isFinite(r) ? {
3294
- ...n,
3295
- id: r
3296
- } : n;
3297
- this.writeJsonChunk(e, J.PROP, i);
3339
+ createBmtBytes(e, t, n) {
3340
+ let r = new ta(), i = e.grids !== void 0, a = t, o = !!e.coordinationMatrix && !this.hasMeshMatrices(e), s = t ? .45 : 0, c = i ? .05 : 0, l = a ? .12 : 0, u = o ? .03 : 0, d = Math.max(.1, 1 - s - c - l - u), f = 0, p = (e) => {
3341
+ n?.({
3342
+ ...e,
3343
+ progress: this.clampProgress(e.progress)
3344
+ });
3345
+ }, m = (e, t) => {
3346
+ p({
3347
+ ...t,
3348
+ progress: f + this.clampProgress(t.progress) * e
3349
+ });
3350
+ }, h = (e, t, n) => {
3351
+ f += e, p({
3352
+ message: n,
3353
+ phase: t,
3354
+ progress: f
3355
+ });
3356
+ };
3357
+ return r.writeBytes(this.textEncoder.encode(Zi)), r.writeUint8(Qi), t && (this.writeProps(r, e.props, (e) => m(s, e)), h(s, "properties", "Properties written")), e.grids !== void 0 && (p({
3358
+ message: "Writing grids",
3359
+ phase: "metadata",
3360
+ progress: f
3361
+ }), this.writeJsonChunk(r, Y.GRIDS, e.grids), h(c, "metadata", "Grids written")), this.writeMeshes(r, e, (e) => m(d, e)), h(d, "geometry", "Geometry written"), t && (p({
3362
+ message: "Writing structure",
3363
+ phase: "metadata",
3364
+ progress: f
3365
+ }), this.writeJsonChunk(r, Y.STRUCTURE, e.structure), h(l, "metadata", "Structure written")), o && e.coordinationMatrix && (p({
3366
+ message: "Writing coordination matrix",
3367
+ phase: "metadata",
3368
+ progress: f
3369
+ }), this.writeTextChunk(r, Y.MATRIX, e.coordinationMatrix), h(u, "metadata", "Coordination matrix written")), p({
3370
+ message: "BMT bytes ready",
3371
+ phase: "writing",
3372
+ progress: 1
3373
+ }), r.toUint8Array();
3374
+ }
3375
+ writeProps(e, t, n) {
3376
+ let r = Object.keys(t), i = r.length;
3377
+ n?.({
3378
+ loaded: 0,
3379
+ message: "Writing properties",
3380
+ phase: "properties",
3381
+ progress: i > 0 ? 0 : 1,
3382
+ total: i
3383
+ }), r.forEach((r, a) => {
3384
+ let o = t[Number(r)], s = Number(r), c = o.id === void 0 && Number.isFinite(s) ? {
3385
+ ...o,
3386
+ id: s
3387
+ } : o;
3388
+ this.writeJsonChunk(e, Y.PROP, c);
3389
+ let l = a + 1;
3390
+ this.shouldEmitItemProgress(l, i) && n?.({
3391
+ loaded: l,
3392
+ message: "Writing properties",
3393
+ phase: "properties",
3394
+ progress: i > 0 ? l / i : 1,
3395
+ total: i
3396
+ });
3298
3397
  });
3299
3398
  }
3300
- writeMeshes(e, t) {
3301
- let n;
3302
- Object.values(t.data).forEach((t) => {
3303
- t.matrix && t.matrix !== n && (this.writeTextChunk(e, J.MATRIX, t.matrix), n = t.matrix), this.writeChunk(e, t.isIfcSpace ? J.MESHSPACE : J.MESH, this.createMeshPayload(t));
3399
+ writeMeshes(e, t, n) {
3400
+ let r, i = Object.values(t.data), a = i.length;
3401
+ n?.({
3402
+ loaded: 0,
3403
+ message: "Writing geometry",
3404
+ phase: "geometry",
3405
+ progress: a > 0 ? 0 : 1,
3406
+ total: a
3407
+ }), i.forEach((t, i) => {
3408
+ t.matrix && t.matrix !== r && (this.writeTextChunk(e, Y.MATRIX, t.matrix), r = t.matrix), this.writeChunk(e, t.isIfcSpace ? Y.MESHSPACE : Y.MESH, this.createMeshPayload(t));
3409
+ let o = i + 1;
3410
+ this.shouldEmitItemProgress(o, a) && n?.({
3411
+ loaded: o,
3412
+ message: "Writing geometry",
3413
+ phase: "geometry",
3414
+ progress: a > 0 ? o / a : 1,
3415
+ total: a
3416
+ });
3304
3417
  });
3305
3418
  }
3306
3419
  createMeshPayload(e) {
3307
- let t = new na(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3420
+ let t = new ta(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3308
3421
  return t.writeUint32(n.byteLength), t.writeBytes(n), t.writeUint32(r.byteLength), t.writeBytes(r), t.writeUint32(i.byteLength), t.writeUint32(this.getIndexType(e.ind)), t.writeBytes(i), t.writeUint8(this.colorToByte(e.mat.r)), t.writeUint8(this.colorToByte(e.mat.g)), t.writeUint8(this.colorToByte(e.mat.b)), t.writeUint8(this.colorToByte(e.mat.opacity ?? 1)), t.writeUint32(e.mat.name), t.toUint8Array();
3309
3422
  }
3310
3423
  writeJsonChunk(e, t, n) {
@@ -3457,7 +3570,7 @@ var Qi = "BMT", $i = 1, J = {
3457
3570
  let t = /* @__PURE__ */ new Map();
3458
3571
  return (Array.isArray(e) ? e : [e]).forEach((e) => {
3459
3572
  e.traverse((e) => {
3460
- if (!(e instanceof P) || !this.isIfcSpaceObject(e)) return;
3573
+ if (!(e instanceof N) || !this.isIfcSpaceObject(e)) return;
3461
3574
  let n = this.getObjectModelID(e);
3462
3575
  if (n === null) return;
3463
3576
  let r = e.geometry.getAttribute("ids");
@@ -3471,7 +3584,7 @@ var Qi = "BMT", $i = 1, J = {
3471
3584
  addVisibleIdsFromObject3D(e, t) {
3472
3585
  (Array.isArray(e) ? e : [e]).forEach((e) => {
3473
3586
  e.traverse((e) => {
3474
- if (!(e instanceof P) || !this.isObjectVisible(e)) return;
3587
+ if (!(e instanceof N) || !this.isObjectVisible(e)) return;
3475
3588
  let n = this.getObjectModelID(e);
3476
3589
  if (n === null) return;
3477
3590
  let r = e.geometry.getAttribute("ids");
@@ -3523,7 +3636,7 @@ var Qi = "BMT", $i = 1, J = {
3523
3636
  return this.deflateBytes(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3524
3637
  }
3525
3638
  deflateBytes(e) {
3526
- return we.deflate(e);
3639
+ return Ce.deflate(e);
3527
3640
  }
3528
3641
  encodeText(e) {
3529
3642
  return this.textEncoder.encode(e);
@@ -3531,46 +3644,52 @@ var Qi = "BMT", $i = 1, J = {
3531
3644
  encodePrettyJson(e) {
3532
3645
  return this.encodeText(`${JSON.stringify(e, null, 2)}\n`);
3533
3646
  }
3647
+ shouldEmitItemProgress(e, t) {
3648
+ return t <= 0 || e === 0 || e >= t ? !0 : e % Math.max(1, Math.floor(t / 100)) === 0;
3649
+ }
3650
+ clampProgress(e) {
3651
+ return Number.isFinite(e) ? Math.max(0, Math.min(1, e)) : 0;
3652
+ }
3534
3653
  isRecord(e) {
3535
3654
  return typeof e == "object" && !!e;
3536
3655
  }
3537
- }, ia = new ra();
3538
- async function aa(e, t) {
3539
- return ia.ConvertIfcFileToBmt(e, t);
3656
+ }, ra = new na();
3657
+ async function ia(e, t) {
3658
+ return ra.ConvertIfcFileToBmt(e, t);
3540
3659
  }
3541
- function oa(e, t) {
3542
- return ia.ConvertToBmt(e, t);
3660
+ function aa(e, t) {
3661
+ return ra.ConvertToBmt(e, t);
3543
3662
  }
3544
3663
  //#endregion
3545
3664
  //#region src/viewer/Selector/FilteredElementsCollector.ts
3546
- function Y(e) {
3665
+ function X(e) {
3547
3666
  return !!e && typeof e == "object" && !Array.isArray(e);
3548
3667
  }
3549
- function sa(e) {
3668
+ function oa(e) {
3550
3669
  let t = Number(e);
3551
3670
  return Number.isFinite(t) ? t : null;
3552
3671
  }
3672
+ function sa(e) {
3673
+ return X(e) && X(e.data) && X(e.props) && "structure" in e;
3674
+ }
3553
3675
  function ca(e) {
3554
- return Y(e) && Y(e.data) && Y(e.props) && "structure" in e;
3676
+ return X(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
3555
3677
  }
3556
3678
  function la(e) {
3557
- return Y(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
3558
- }
3559
- function ua(e) {
3560
- if (!Y(e)) return !1;
3679
+ if (!X(e)) return !1;
3561
3680
  let t = Object.entries(e);
3562
- return t.length ? t.every(([e, t]) => sa(e) !== null && la(t)) : !0;
3681
+ return t.length ? t.every(([e, t]) => oa(e) !== null && ca(t)) : !0;
3563
3682
  }
3564
- function da(e) {
3683
+ function ua(e) {
3565
3684
  return typeof e == "string" ? e : null;
3566
3685
  }
3567
- function fa(e) {
3568
- let t = Y(e.props.props) ? e.props.props : {};
3569
- return da(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
3686
+ function da(e) {
3687
+ let t = X(e.props.props) ? e.props.props : {};
3688
+ return ua(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
3570
3689
  }
3571
- function pa(e, t, n) {
3690
+ function fa(e, t, n) {
3572
3691
  Object.entries(n).forEach(([n, r]) => {
3573
- let i = sa(n);
3692
+ let i = oa(n);
3574
3693
  i !== null && e.push({
3575
3694
  elementID: i,
3576
3695
  modelID: t,
@@ -3578,29 +3697,29 @@ function pa(e, t, n) {
3578
3697
  });
3579
3698
  });
3580
3699
  }
3581
- function ma(e) {
3582
- if (!e || !Y(e)) return [];
3583
- if (ca(e)) {
3700
+ function pa(e) {
3701
+ if (!e || !X(e)) return [];
3702
+ if (sa(e)) {
3584
3703
  let t = [];
3585
- return pa(t, 0, e.props), t;
3704
+ return fa(t, 0, e.props), t;
3586
3705
  }
3587
- if (ua(e)) {
3706
+ if (la(e)) {
3588
3707
  let t = [];
3589
- return pa(t, 0, e), t;
3708
+ return fa(t, 0, e), t;
3590
3709
  }
3591
3710
  let t = [];
3592
3711
  return Object.entries(e).forEach(([e, n]) => {
3593
- let r = sa(e);
3712
+ let r = oa(e);
3594
3713
  if (r !== null) {
3595
- if (ca(n)) {
3596
- pa(t, r, n.props);
3714
+ if (sa(n)) {
3715
+ fa(t, r, n.props);
3597
3716
  return;
3598
3717
  }
3599
- ua(n) && pa(t, r, n);
3718
+ la(n) && fa(t, r, n);
3600
3719
  }
3601
3720
  }), t;
3602
3721
  }
3603
- function ha(e) {
3722
+ function ma(e) {
3604
3723
  let t = {};
3605
3724
  return e.forEach(({ elementID: e, modelID: n, props: r }) => {
3606
3725
  t[n] ??= [], t[n].push({
@@ -3609,26 +3728,26 @@ function ha(e) {
3609
3728
  });
3610
3729
  }), t;
3611
3730
  }
3612
- function ga(e) {
3731
+ function ha(e) {
3613
3732
  let t = {};
3614
3733
  return e.forEach(({ elementID: e, modelID: n }) => {
3615
3734
  t[n] ??= [], t[n].push(e);
3616
3735
  }), t;
3617
3736
  }
3618
- var _a = class {
3737
+ var ga = class {
3619
3738
  elements;
3620
3739
  filters = [];
3621
3740
  selectedModelIDs = null;
3622
3741
  constructor(e) {
3623
- this.elements = ma(e);
3742
+ this.elements = pa(e);
3624
3743
  }
3625
3744
  from(e) {
3626
- return this.elements = ma(e), this.filters = [], this.selectedModelIDs = null, this;
3745
+ return this.elements = pa(e), this.filters = [], this.selectedModelIDs = null, this;
3627
3746
  }
3628
3747
  ofType(e) {
3629
3748
  let t = new Set((Array.isArray(e) ? e : [e]).map((e) => e.toLowerCase()));
3630
3749
  return this.filters.push((e) => {
3631
- let n = fa(e);
3750
+ let n = da(e);
3632
3751
  return !!(n && t.has(n.toLowerCase()));
3633
3752
  }), this;
3634
3753
  }
@@ -3657,11 +3776,11 @@ var _a = class {
3657
3776
  return this.hasSingleSelectedModel() ? e.map(({ elementID: e, props: t }) => ({
3658
3777
  elementID: e,
3659
3778
  props: t
3660
- })) : ha(e);
3779
+ })) : ma(e);
3661
3780
  }
3662
3781
  toElementsIds() {
3663
3782
  let e = this.getFilteredElements();
3664
- return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : ga(e);
3783
+ return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : ha(e);
3665
3784
  }
3666
3785
  toElementIds() {
3667
3786
  return this.toElementsIds();
@@ -3669,20 +3788,20 @@ var _a = class {
3669
3788
  };
3670
3789
  //#endregion
3671
3790
  //#region src/viewer/api/ViewerApi.ts
3672
- function va(e) {
3791
+ function _a(e) {
3673
3792
  let t = {};
3674
3793
  return Object.entries(e).forEach(([e, n]) => {
3675
3794
  t[Number(e)] = Array.from(n);
3676
3795
  }), t;
3677
3796
  }
3678
- function ya(e) {
3797
+ function va(e) {
3679
3798
  let t = {};
3680
3799
  return Object.entries(e).forEach(([e, n]) => {
3681
3800
  t[Number(e)] = new Set(n);
3682
3801
  }), t;
3683
3802
  }
3684
- function ba(e, t) {
3685
- let n = new ra();
3803
+ function ya(e, t) {
3804
+ let n = new na();
3686
3805
  return {
3687
3806
  camera: {
3688
3807
  fitCamera: () => {
@@ -3822,16 +3941,16 @@ function ba(e, t) {
3822
3941
  t()?.geometryUtils.toggleIIfcSpacesVisibility();
3823
3942
  }
3824
3943
  },
3825
- properties: Zi(e),
3944
+ properties: Xi(e),
3826
3945
  selector: {
3827
3946
  addSelected: (n, r, i = !0, a = !1) => {
3828
3947
  let o = i || a;
3829
- e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(va(e.getState().selected), a);
3948
+ e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(_a(e.getState().selected), a);
3830
3949
  },
3831
- collector: () => new _a(e.getState().modelProps),
3950
+ collector: () => new ga(e.getState().modelProps),
3832
3951
  getPreselectionColor: () => e.getState().preselectionColor,
3833
3952
  getSelectionColor: () => e.getState().selectionColor,
3834
- getSelected: () => va(e.getState().selected),
3953
+ getSelected: () => _a(e.getState().selected),
3835
3954
  removeSelected: (t, n) => {
3836
3955
  e.getState().removeSelected(t, n);
3837
3956
  },
@@ -3846,7 +3965,7 @@ function ba(e, t) {
3846
3965
  },
3847
3966
  setSelected: (n, r, i = !1, a = !0, o = !1) => {
3848
3967
  let s = a || o;
3849
- e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(va(e.getState().selected), o);
3968
+ e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(_a(e.getState().selected), o);
3850
3969
  }
3851
3970
  },
3852
3971
  utils: {
@@ -3891,7 +4010,7 @@ function ba(e, t) {
3891
4010
  }
3892
4011
  //#endregion
3893
4012
  //#region src/viewer/Loaders/BmtLoader.ts
3894
- var xa = class {
4013
+ var ba = class {
3895
4014
  view;
3896
4015
  offset = 0;
3897
4016
  constructor(e) {
@@ -3911,11 +4030,11 @@ var xa = class {
3911
4030
  eof() {
3912
4031
  return this.offset >= this.view.byteLength;
3913
4032
  }
3914
- }, Sa = class {
4033
+ }, xa = class {
3915
4034
  decodeBuffer(e) {
3916
- return this.textDecoder.decode(we.inflate(e));
4035
+ return this.textDecoder.decode(Ce.inflate(e));
3917
4036
  }
3918
- decoder = we;
4037
+ decoder = Ce;
3919
4038
  textDecoder = new TextDecoder("utf-8");
3920
4039
  ChunkType = {
3921
4040
  PROP: 1,
@@ -3984,7 +4103,7 @@ var xa = class {
3984
4103
  return a?.props && (i.props = a.props), a?.grids && (i.grids = a.grids), a?.coordinationMatrix && (i.coordinationMatrix = a.coordinationMatrix), a?.structure !== void 0 && (i.structure = a.structure), i;
3985
4104
  }
3986
4105
  parseBinaryFile(e, t = {}) {
3987
- let n = new xa(e);
4106
+ let n = new ba(e);
3988
4107
  if (new TextDecoder().decode(n.readBytes(3)) !== "BMT") throw Error("Invalid file");
3989
4108
  let r = n.readUint8();
3990
4109
  console.log(`model version: ${r}`);
@@ -4052,24 +4171,24 @@ var xa = class {
4052
4171
  };
4053
4172
  //#endregion
4054
4173
  //#region src/viewer/workers/BMTWorker.ts?worker
4055
- function Ca(e) {
4174
+ function Sa(e) {
4056
4175
  return new Worker("" + new URL("assets/BMTWorker-yhSXOg2i.js", import.meta.url).href, { name: e?.name });
4057
4176
  }
4058
4177
  //#endregion
4059
4178
  //#region src/viewer/workers/BMTWorkerClient.ts
4060
- function wa() {
4179
+ function Ca() {
4061
4180
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4062
4181
  }
4063
- function Ta(e) {
4182
+ function wa(e) {
4064
4183
  return Array.isArray(e) ? e : [e];
4065
4184
  }
4066
- function Ea(e) {
4185
+ function Ta(e) {
4067
4186
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.bmt";
4068
4187
  }
4069
- function Da(e) {
4188
+ function Ea(e) {
4070
4189
  return typeof e == "string" ? {
4071
4190
  kind: "url",
4072
- name: Ea(e),
4191
+ name: Ta(e),
4073
4192
  url: new URL(e, globalThis.location.href).href
4074
4193
  } : e instanceof File ? {
4075
4194
  file: e,
@@ -4080,18 +4199,18 @@ function Da(e) {
4080
4199
  kind: "buffer"
4081
4200
  };
4082
4201
  }
4083
- function Oa(e) {
4202
+ function Da(e) {
4084
4203
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4085
4204
  }
4086
- function ka() {
4087
- return new Ca();
4205
+ function Oa() {
4206
+ return new Sa();
4088
4207
  }
4089
- function Aa(e) {
4208
+ function ka(e) {
4090
4209
  return { streamGeometryChunks: e.streamGeometryChunks ?? !!e.onChunk };
4091
4210
  }
4092
- function ja(e, t = {}) {
4093
- let n = t.worker ?? ka(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Ta(e).map(Da), o = wa(), s = {}, c = {
4094
- options: Aa(t),
4211
+ function Aa(e, t = {}) {
4212
+ let n = t.worker ?? Oa(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = wa(e).map(Ea), o = Ca(), s = {}, c = {
4213
+ options: ka(t),
4095
4214
  sources: a,
4096
4215
  taskId: o,
4097
4216
  type: "load-bmt-model"
@@ -4129,39 +4248,39 @@ function ja(e, t = {}) {
4129
4248
  let a = Error(r.error.message);
4130
4249
  r.error.stack && (a.stack = r.error.stack), l(a);
4131
4250
  };
4132
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Oa(a));
4251
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Da(a));
4133
4252
  });
4134
4253
  }
4135
- function Ma() {
4136
- return ka();
4254
+ function ja() {
4255
+ return Oa();
4137
4256
  }
4138
4257
  //#endregion
4139
4258
  //#region src/viewer/workers/BmtConverterWorker.ts?worker
4140
- function Na(e) {
4141
- return new Worker("" + new URL("assets/BmtConverterWorker-D4BQ-hoH.js", import.meta.url).href, { name: e?.name });
4259
+ function Ma(e) {
4260
+ return new Worker("" + new URL("assets/BmtConverterWorker-S83_KT6j.js", import.meta.url).href, { name: e?.name });
4142
4261
  }
4143
4262
  //#endregion
4144
4263
  //#region src/viewer/workers/BmtConverterWorkerClient.ts
4145
- function Pa() {
4264
+ function Na() {
4146
4265
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4147
4266
  }
4148
- function Fa(e) {
4267
+ function Pa(e) {
4149
4268
  return Array.isArray(e) ? e : [e];
4150
4269
  }
4151
- function Ia(e) {
4270
+ function Fa(e) {
4152
4271
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4153
4272
  }
4154
- function La() {
4273
+ function Ia() {
4155
4274
  return globalThis.document?.baseURI ?? globalThis.location.href;
4156
4275
  }
4157
- function Ra(e) {
4276
+ function La(e) {
4158
4277
  let t = e ?? "ifc-parser.wasm";
4159
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, La()).href;
4278
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, Ia()).href;
4160
4279
  }
4161
- function za(e) {
4280
+ function Ra(e) {
4162
4281
  return typeof e == "string" ? {
4163
4282
  kind: "url",
4164
- name: Ia(e),
4283
+ name: Fa(e),
4165
4284
  url: new URL(e, globalThis.location.href).href
4166
4285
  } : e instanceof File ? {
4167
4286
  file: e,
@@ -4172,13 +4291,13 @@ function za(e) {
4172
4291
  kind: "buffer"
4173
4292
  };
4174
4293
  }
4175
- function Ba(e) {
4294
+ function za(e) {
4176
4295
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4177
4296
  }
4178
- function Va() {
4179
- return new Na();
4297
+ function Ba() {
4298
+ return new Ma();
4180
4299
  }
4181
- function Ha(e) {
4300
+ function Va(e) {
4182
4301
  return {
4183
4302
  chunk: e.chunk,
4184
4303
  coordinationMatrix: e.coordinationMatrix,
@@ -4190,23 +4309,23 @@ function Ha(e) {
4190
4309
  useIfcSpace: e.useIfcSpace,
4191
4310
  useMinVersion: e.useMinVersion,
4192
4311
  visibleIdsByModel: e.visibleIdsByModel,
4193
- wasmPath: Ra(e.wasmPath)
4312
+ wasmPath: La(e.wasmPath)
4194
4313
  };
4195
4314
  }
4196
- function Ua(e) {
4315
+ function Ha(e) {
4197
4316
  let t = new Uint8Array(e.bytes.byteLength);
4198
4317
  return t.set(e.bytes), {
4199
4318
  ...e,
4200
4319
  blob: new Blob([t.buffer], { type: e.mimeType })
4201
4320
  };
4202
4321
  }
4203
- function Wa(e) {
4322
+ function Ua(e) {
4204
4323
  return {
4205
- files: e.result.files.map(Ua),
4324
+ files: e.result.files.map(Ha),
4206
4325
  models: e.result.models
4207
4326
  };
4208
4327
  }
4209
- function Ga(e) {
4328
+ function Wa(e) {
4210
4329
  if (e.error instanceof Error) return e.error;
4211
4330
  let t = [
4212
4331
  e.message || "Unknown worker error",
@@ -4216,12 +4335,12 @@ function Ga(e) {
4216
4335
  ].filter(Boolean);
4217
4336
  return /* @__PURE__ */ Error(`BMT converter worker failed: ${t.join(", ")}`);
4218
4337
  }
4219
- function Ka(e) {
4338
+ function Ga(e) {
4220
4339
  return /* @__PURE__ */ Error(`BMT converter worker response could not be cloned: ${String(e.data ?? "unknown message error")}`);
4221
4340
  }
4222
- function qa(e, t = {}) {
4223
- let n = t.worker ?? Va(), r = t.terminateOnComplete ?? !t.worker, i = Fa(e).map(za), a = Pa(), o = {
4224
- options: Ha(t),
4341
+ function Ka(e, t = {}) {
4342
+ let n = t.worker ?? Ba(), r = t.terminateOnComplete ?? !t.worker, i = Pa(e).map(Ra), a = Na(), o = {
4343
+ options: Va(t),
4225
4344
  sources: i,
4226
4345
  taskId: a,
4227
4346
  type: "convert-ifc-to-bmt"
@@ -4230,9 +4349,9 @@ function qa(e, t = {}) {
4230
4349
  let c = () => {
4231
4350
  n.removeEventListener("message", d), n.removeEventListener("error", l), n.removeEventListener("messageerror", u), r && n.terminate();
4232
4351
  }, l = (e) => {
4233
- c(), s(Ga(e));
4352
+ c(), s(Wa(e));
4234
4353
  }, u = (e) => {
4235
- c(), s(Ka(e));
4354
+ c(), s(Ga(e));
4236
4355
  }, d = (n) => {
4237
4356
  let r = n.data;
4238
4357
  if (r.taskId !== a) return;
@@ -4241,35 +4360,35 @@ function qa(e, t = {}) {
4241
4360
  return;
4242
4361
  }
4243
4362
  if (c(), r.type === "complete") {
4244
- e(Wa(r));
4363
+ e(Ua(r));
4245
4364
  return;
4246
4365
  }
4247
4366
  let i = Error(r.error.message);
4248
4367
  r.error.stack && (i.stack = r.error.stack), s(i);
4249
4368
  };
4250
- n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, Ba(i));
4369
+ n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, za(i));
4251
4370
  });
4252
4371
  }
4253
- function Ja() {
4254
- return Va();
4372
+ function qa() {
4373
+ return Ba();
4255
4374
  }
4256
4375
  //#endregion
4257
4376
  //#region src/viewer/workers/IFCWorker.ts?worker
4258
- function Ya(e) {
4259
- return new Worker("" + new URL("assets/IFCWorker-Dgk5iwps.js", import.meta.url).href, { name: e?.name });
4377
+ function Ja(e) {
4378
+ return new Worker("" + new URL("assets/IFCWorker-GKoow6yV.js", import.meta.url).href, { name: e?.name });
4260
4379
  }
4261
4380
  //#endregion
4262
4381
  //#region src/viewer/workers/IFCWorkerClient.ts
4263
- function Xa() {
4382
+ function Ya() {
4264
4383
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4265
4384
  }
4266
- function Za(e) {
4385
+ function Xa(e) {
4267
4386
  return Array.isArray(e) ? e : [e];
4268
4387
  }
4269
- function Qa(e) {
4388
+ function Za(e) {
4270
4389
  return typeof e == "string" ? {
4271
4390
  kind: "url",
4272
- name: $a(e),
4391
+ name: Qa(e),
4273
4392
  url: new URL(e, globalThis.location.href).href
4274
4393
  } : e instanceof File ? {
4275
4394
  file: e,
@@ -4280,23 +4399,23 @@ function Qa(e) {
4280
4399
  kind: "buffer"
4281
4400
  };
4282
4401
  }
4283
- function $a(e) {
4402
+ function Qa(e) {
4284
4403
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4285
4404
  }
4286
- function eo() {
4405
+ function $a() {
4287
4406
  return globalThis.document?.baseURI ?? globalThis.location.href;
4288
4407
  }
4289
- function to(e) {
4408
+ function eo(e) {
4290
4409
  let t = e ?? "ifc-parser.wasm";
4291
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, eo()).href;
4410
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, $a()).href;
4292
4411
  }
4293
- function no(e) {
4412
+ function to(e) {
4294
4413
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4295
4414
  }
4296
- function ro() {
4297
- return new Ya();
4415
+ function no() {
4416
+ return new Ja();
4298
4417
  }
4299
- function io(e) {
4418
+ function ro(e) {
4300
4419
  return {
4301
4420
  chunk: e.chunk,
4302
4421
  coordinationMatrix: e.coordinationMatrix,
@@ -4305,12 +4424,12 @@ function io(e) {
4305
4424
  useIfcColors: e.useIfcColors,
4306
4425
  useIfcElementAssembly: e.useIfcElementAssembly,
4307
4426
  useIfcSpace: e.useIfcSpace,
4308
- wasmPath: to(e.wasmPath)
4427
+ wasmPath: eo(e.wasmPath)
4309
4428
  };
4310
4429
  }
4311
- function ao(e, t = {}) {
4312
- let n = t.worker ?? ro(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Za(e).map(Qa), o = Xa(), s = {}, c = {
4313
- options: io(t),
4430
+ function io(e, t = {}) {
4431
+ let n = t.worker ?? no(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Xa(e).map(Za), o = Ya(), s = {}, c = {
4432
+ options: ro(t),
4314
4433
  sources: a,
4315
4434
  taskId: o,
4316
4435
  type: "load-ifc-model"
@@ -4348,34 +4467,34 @@ function ao(e, t = {}) {
4348
4467
  let a = Error(r.error.message);
4349
4468
  r.error.stack && (a.stack = r.error.stack), l(a);
4350
4469
  };
4351
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, no(a));
4470
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, to(a));
4352
4471
  });
4353
4472
  }
4354
- function oo() {
4355
- return ro();
4473
+ function ao() {
4474
+ return no();
4356
4475
  }
4357
4476
  //#endregion
4358
4477
  //#region src/viewer/api/loader.ts
4359
- function so(e) {
4478
+ function oo(e) {
4360
4479
  return typeof e == "string" ? e : e.name;
4361
4480
  }
4481
+ function so(e) {
4482
+ return (oo(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4483
+ }
4362
4484
  function co(e) {
4363
- return (so(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4485
+ let t = oo(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4486
+ return n === -1 ? "" : t.slice(n + 1);
4364
4487
  }
4365
4488
  function lo(e) {
4366
- let t = so(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4367
- return n === -1 ? "" : t.slice(n + 1);
4489
+ return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4368
4490
  }
4369
4491
  function uo(e) {
4370
- return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4492
+ return /_props\.json$/i.test(oo(e).split(/[?#]/)[0]);
4371
4493
  }
4372
4494
  function fo(e) {
4373
- return /_props\.json$/i.test(so(e).split(/[?#]/)[0]);
4374
- }
4375
- function po(e) {
4376
4495
  return e.coordinationMatrix ? e.coordinationMatrix : Object.values(e.data)[0]?.matrix || void 0;
4377
4496
  }
4378
- var mo = new class {
4497
+ var po = new class {
4379
4498
  coordinationMatrix;
4380
4499
  useIfcSpace = !1;
4381
4500
  bmtLoader = null;
@@ -4386,11 +4505,11 @@ var mo = new class {
4386
4505
  this.getBmtLoader();
4387
4506
  }
4388
4507
  getBmtLoader() {
4389
- return this.bmtLoader ||= new Sa(), this.bmtLoader;
4508
+ return this.bmtLoader ||= new xa(), this.bmtLoader;
4390
4509
  }
4391
4510
  async getIfcLoader(e = {}) {
4392
4511
  if (!this.ifcLoader) {
4393
- let { IFCLoader: e } = await import("./IFCLoader-B_gBDDmN.js");
4512
+ let { IFCLoader: e } = await import("./IFCLoader-RIJas-B5.js");
4394
4513
  this.ifcLoader = new e();
4395
4514
  }
4396
4515
  return this.ifcLoader.useIfcSpace = e.useIfcSpace ?? this.useIfcSpace, e.chunk !== void 0 && (this.ifcLoader.chunk = e.chunk), e.maxMeshBytes !== void 0 && (this.ifcLoader.maxMeshBytes = e.maxMeshBytes), e.wasmPath !== void 0 && (this.ifcLoader.wasmPath = e.wasmPath), this.ifcLoader;
@@ -4414,7 +4533,7 @@ var mo = new class {
4414
4533
  async loadBmtModel(e, t) {
4415
4534
  let n = this.getBmtLoader();
4416
4535
  if (typeof e == "string") return n.loadModel(e);
4417
- let r = n.parseBinaryFile(await e.arrayBuffer()), i = uo(e), a = i ? t.get(i) : void 0;
4536
+ let r = n.parseBinaryFile(await e.arrayBuffer()), i = lo(e), a = i ? t.get(i) : void 0;
4418
4537
  return this.applyBmtMetadata(r, a);
4419
4538
  }
4420
4539
  createWorkerProgressHandler(e, t, n, r) {
@@ -4437,7 +4556,7 @@ var mo = new class {
4437
4556
  };
4438
4557
  }
4439
4558
  async loadIfcModelInWorker(e, t, n, r, i) {
4440
- return (await ao(e, {
4559
+ return (await io(e, {
4441
4560
  chunk: t.chunk,
4442
4561
  collectChunks: t.collectWorkerChunks,
4443
4562
  coordinationMatrix: this.coordinationMatrix,
@@ -4450,14 +4569,14 @@ var mo = new class {
4450
4569
  }))[0];
4451
4570
  }
4452
4571
  async loadBmtModelInWorker(e, t, n, r, i, a) {
4453
- let o = (await ja(e, {
4572
+ let o = (await Aa(e, {
4454
4573
  collectChunks: n.collectWorkerChunks,
4455
4574
  onChunk: this.createWorkerChunkHandler(n, r),
4456
4575
  onProgress: this.createWorkerProgressHandler(n, r, i, a),
4457
4576
  streamGeometryChunks: n.streamGeometryChunks ?? !!n.onChunk
4458
4577
  }))[0];
4459
4578
  if (e instanceof File) {
4460
- let n = uo(e), r = n ? t.get(n) : void 0;
4579
+ let n = lo(e), r = n ? t.get(n) : void 0;
4461
4580
  return this.applyBmtMetadata(o, r);
4462
4581
  }
4463
4582
  return o;
@@ -4470,21 +4589,21 @@ var mo = new class {
4470
4589
  }
4471
4590
  async loadModel(e, t = {}) {
4472
4591
  this.initLoaders();
4473
- let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !fo(e)).length, o = 0;
4592
+ let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !uo(e)).length, o = 0;
4474
4593
  this.loadedModelCount === 0 && this.resetCoordinationMatrixState();
4475
4594
  for (let e = 0; e < n.length; e++) {
4476
- let s = n[e], c = lo(s), l;
4477
- if (c === "json" && fo(s)) continue;
4595
+ let s = n[e], c = co(s), l;
4596
+ if (c === "json" && uo(s)) continue;
4478
4597
  let u = this.nextModelID, d = o;
4479
4598
  if (o++, c === "ifc") l = t.useWorker ? await this.loadIfcModelInWorker(s, t, u, d, a) : (await (await this.getIfcLoader(t)).loadModel(s, this.coordinationMatrix))[0];
4480
4599
  else if (c === "bmt") l = t.useWorker ? await this.loadBmtModelInWorker(s, r, t, u, d, a) : await this.loadBmtModel(s, r);
4481
- else throw Error(`Unsupported model format: ${so(s)}`);
4482
- let f = po(l);
4483
- !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??= co(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4600
+ else throw Error(`Unsupported model format: ${oo(s)}`);
4601
+ let f = fo(l);
4602
+ !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??= so(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4484
4603
  }
4485
4604
  return i;
4486
4605
  }
4487
- }(), ho = .5, X = .04, Z = .16, go = Z, Q = ho * 2 - Z * 2, _o = ho - X / 2, vo = ho - Z / 2, yo = ho - go / 2, bo = .63, xo = "#dfe6ec", So = 260, Co = 52, wo = .17, To = new g(), $ = new de(), Eo = [
4606
+ }(), mo = .5, ho = .04, Z = .16, go = Z, Q = mo * 2 - Z * 2, _o = mo - ho / 2, vo = mo - Z / 2, yo = mo - go / 2, bo = .63, xo = "#dfe6ec", So = 260, Co = 52, wo = .17, To = new g(), $ = new ue(), Eo = [
4488
4607
  {
4489
4608
  direction: [
4490
4609
  0,
@@ -4500,7 +4619,7 @@ var mo = new class {
4500
4619
  scale: [
4501
4620
  Q,
4502
4621
  Q,
4503
- X
4622
+ ho
4504
4623
  ],
4505
4624
  title: "Front",
4506
4625
  type: "face"
@@ -4525,7 +4644,7 @@ var mo = new class {
4525
4644
  scale: [
4526
4645
  Q,
4527
4646
  Q,
4528
- X
4647
+ ho
4529
4648
  ],
4530
4649
  title: "Back",
4531
4650
  type: "face"
@@ -4548,7 +4667,7 @@ var mo = new class {
4548
4667
  0
4549
4668
  ],
4550
4669
  scale: [
4551
- X,
4670
+ ho,
4552
4671
  Q,
4553
4672
  Q
4554
4673
  ],
@@ -4573,7 +4692,7 @@ var mo = new class {
4573
4692
  0
4574
4693
  ],
4575
4694
  scale: [
4576
- X,
4695
+ ho,
4577
4696
  Q,
4578
4697
  Q
4579
4698
  ],
@@ -4599,7 +4718,7 @@ var mo = new class {
4599
4718
  ],
4600
4719
  scale: [
4601
4720
  Q,
4602
- X,
4721
+ ho,
4603
4722
  Q
4604
4723
  ],
4605
4724
  title: "Top",
@@ -4624,7 +4743,7 @@ var mo = new class {
4624
4743
  ],
4625
4744
  scale: [
4626
4745
  Q,
4627
- X,
4746
+ ho,
4628
4747
  Q
4629
4748
  ],
4630
4749
  title: "Bottom",
@@ -4746,17 +4865,17 @@ function Mo(e, t) {
4746
4865
  let a = r.measureText(e), o = a.actualBoundingBoxAscent || Co * .8, s = a.actualBoundingBoxDescent || Co * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
4747
4866
  n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
4748
4867
  let u = new b(n);
4749
- return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
4868
+ return u.colorSpace = le, u.generateMipmaps = !1, u.magFilter = j, u.minFilter = j, u.needsUpdate = !0, {
4750
4869
  aspect: c / l,
4751
4870
  texture: u
4752
4871
  };
4753
4872
  }
4754
4873
  function No({ color: e, label: t, position: n, rotation: r }) {
4755
4874
  let { aspect: i, texture: a } = c(() => Mo(t, e), [e, t]);
4756
- return o(() => () => a.dispose(), [a]), /* @__PURE__ */ R("mesh", {
4875
+ return o(() => () => a.dispose(), [a]), /* @__PURE__ */ z("mesh", {
4757
4876
  position: n,
4758
4877
  rotation: r,
4759
- children: [/* @__PURE__ */ L("planeGeometry", { args: [wo * i, wo] }), /* @__PURE__ */ L("meshBasicMaterial", {
4878
+ children: [/* @__PURE__ */ R("planeGeometry", { args: [wo * i, wo] }), /* @__PURE__ */ R("meshBasicMaterial", {
4760
4879
  alphaTest: .1,
4761
4880
  depthWrite: !1,
4762
4881
  map: a,
@@ -4766,17 +4885,17 @@ function No({ color: e, label: t, position: n, rotation: r }) {
4766
4885
  });
4767
4886
  }
4768
4887
  function Po(e) {
4769
- return Math.abs(e.y) > .9 ? new I(0, 0, e.y > 0 ? -1 : 1) : new I(0, 1, 0);
4888
+ return Math.abs(e.y) > .9 ? new L(0, 0, e.y > 0 ? -1 : 1) : new L(0, 1, 0);
4770
4889
  }
4771
4890
  function Fo(e, t) {
4772
4891
  let n = e.current;
4773
4892
  return !n || (n.updateWorldMatrix(!0, !0), To.setFromObject(n), To.isEmpty()) ? ($.center.copy(t), $.radius = 10, $) : (To.getBoundingSphere($), (!Number.isFinite($.radius) || $.radius <= 0) && ($.radius = 10), $);
4774
4893
  }
4775
4894
  function Io(e) {
4776
- return e.current?.getTarget(new I()) ?? new I();
4895
+ return e.current?.getTarget(new L()) ?? new L();
4777
4896
  }
4778
4897
  function Lo({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
4779
- let a = Io(t), o = Fo(r, a), s = o.center.clone(), c = new I(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
4898
+ let a = Io(t), o = Fo(r, a), s = o.center.clone(), c = new L(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
4780
4899
  t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
4781
4900
  endPosition: d,
4782
4901
  endTarget: s,
@@ -4789,7 +4908,7 @@ function Lo({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef
4789
4908
  }
4790
4909
  function Ro({ action: e, onPick: t }) {
4791
4910
  let [n, r] = u(!1);
4792
- return /* @__PURE__ */ R("group", {
4911
+ return /* @__PURE__ */ z("group", {
4793
4912
  position: e.position,
4794
4913
  onClick: ko,
4795
4914
  onPointerDown: (n) => {
@@ -4801,18 +4920,18 @@ function Ro({ action: e, onPick: t }) {
4801
4920
  onPointerLeave: (e) => {
4802
4921
  ko(e), r(!1);
4803
4922
  },
4804
- children: [/* @__PURE__ */ R("mesh", {
4923
+ children: [/* @__PURE__ */ z("mesh", {
4805
4924
  scale: e.scale,
4806
- children: [/* @__PURE__ */ L("boxGeometry", { args: [
4925
+ children: [/* @__PURE__ */ R("boxGeometry", { args: [
4807
4926
  1,
4808
4927
  1,
4809
4928
  1
4810
- ] }), /* @__PURE__ */ L("meshBasicMaterial", {
4929
+ ] }), /* @__PURE__ */ R("meshBasicMaterial", {
4811
4930
  color: Ao(n),
4812
4931
  opacity: jo(n),
4813
4932
  transparent: !0
4814
4933
  })]
4815
- }), e.label && /* @__PURE__ */ L(No, {
4934
+ }), e.label && /* @__PURE__ */ R(No, {
4816
4935
  color: n ? "#ffffff" : "#50606f",
4817
4936
  label: e.label,
4818
4937
  position: [
@@ -4839,14 +4958,14 @@ function zo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4839
4958
  if (!o) return;
4840
4959
  let s = performance.now() - o.startTime, c = Math.min(s / So, 1), l = 1 - (1 - c) ** 3, u = n.current;
4841
4960
  if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
4842
- let e = new I().lerpVectors(o.startTarget, o.endTarget, l);
4961
+ let e = new L().lerpVectors(o.startTarget, o.endTarget, l);
4843
4962
  u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
4844
4963
  } else r.lookAt(o.endTarget);
4845
4964
  c >= 1 && (r.up.copy(o.endUp), u?.setLookAt(o.endPosition.x, o.endPosition.y, o.endPosition.z, o.endTarget.x, o.endTarget.y, o.endTarget.z, !1), a.current = null);
4846
- }), e ? /* @__PURE__ */ L("group", {
4965
+ }), e ? /* @__PURE__ */ R("group", {
4847
4966
  ref: i,
4848
4967
  scale: bo,
4849
- children: o.map((e) => /* @__PURE__ */ L(Ro, {
4968
+ children: o.map((e) => /* @__PURE__ */ R(Ro, {
4850
4969
  action: e,
4851
4970
  onPick: (e) => {
4852
4971
  let i = t.current;
@@ -4894,7 +5013,7 @@ var Bo = class {
4894
5013
  }, Wo = {
4895
5014
  alpha: !0,
4896
5015
  antialias: !0
4897
- }, Go = .1, Ko = .02, qo = 1e3, Jo = 50, Yo = .08, Xo = new g(), Zo = new de(), Qo = new I();
5016
+ }, Go = .1, Ko = .02, qo = 1e3, Jo = 50, Yo = .08, Xo = new g(), Zo = new ue(), Qo = new L();
4898
5017
  function $o() {
4899
5018
  let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
4900
5019
  return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
@@ -4927,7 +5046,7 @@ function rs(e, t, n, r, i) {
4927
5046
  });
4928
5047
  }
4929
5048
  function is(e, t) {
4930
- let n = new g(), r = new I();
5049
+ let n = new g(), r = new L();
4931
5050
  return Object.entries(e).forEach(([e, i]) => {
4932
5051
  let a = Number(e);
4933
5052
  i.forEach((e) => {
@@ -4940,158 +5059,185 @@ function as(e) {
4940
5059
  return Number.isFinite(n) && n > 0 ? n * Yo : Go;
4941
5060
  }
4942
5061
  function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelRef: a, modelsData: s, onReady: u, publicApi: d, setSceneApi: f }) {
4943
- let g = p((e) => e.camera), _ = Mt(a), v = Ut(_), { colorPaletteTexture: y, colorUtils: b } = Ge(_), x = Bn(a), S = vn(a, n, x), C = Nn(a, n, x), w = c(() => new ra(), []), T = v.buildIndex, E = _.resetIndex, D = b.applyStoredColors, O = Fr(), k = l(!1), A = z((e) => e.showStats), ee = c(() => {
5062
+ let g = p((e) => e.camera), _ = p((e) => e.gl), v = jt(a), y = Ht(v), { colorPaletteTexture: b, colorUtils: x } = We(v), S = zn(a), C = _n(a, n, S), w = Mn(a, n, S), T = c(() => new na(), []), E = y.buildIndex, D = v.resetIndex, ee = x.applyStoredColors, O = Pr(), k = l(null), A = l(!1), te = B((e) => e.showStats), j = c(() => {
4944
5063
  let e = Object.keys(s).sort((e, t) => Number(e) - Number(t));
4945
5064
  for (let t of e) {
4946
- let e = St(s[Number(t)]);
5065
+ let e = xt(s[Number(t)]);
4947
5066
  if (e) return e;
4948
5067
  }
4949
5068
  return null;
4950
- }, [s]), j = c(() => bt(ee ?? void 0), [ee]), M = c(() => Object.entries(s).map(([e, t]) => [Number(e), t]), [s]), te = i(() => {
5069
+ }, [s]), ne = c(() => yt(j ?? void 0), [j]), M = c(() => Object.entries(s).map(([e, t]) => [Number(e), t]), [s]), N = i(() => {
4951
5070
  n.current && (n.current.minDistance = es(a.current));
4952
- }, [n, a]), N = i((e, t = !1) => {
5071
+ }, [n, a]), P = i((e) => {
5072
+ let t = n.current;
5073
+ t && (t.cancel(), t.setOrbitPoint(e.x, e.y, e.z));
5074
+ }, [n]), re = i((e) => {
5075
+ k.current = e.clone(), P(e);
5076
+ }, [P]), F = i(() => {
5077
+ k.current = null, O(a, n, r);
5078
+ }, [
5079
+ n,
5080
+ O,
5081
+ r,
5082
+ a
5083
+ ]), ie = i((e, t = !1) => {
4953
5084
  let r = n.current;
4954
5085
  if (!r) return;
4955
- let i = is(e, _.buildIndex());
5086
+ let i = is(e, v.buildIndex());
4956
5087
  if (!i) return;
4957
- let a = i.getCenter(new I());
4958
- if (r.cancel(), t) {
5088
+ let a = i.getCenter(new L());
5089
+ if (k.current = a.clone(), r.cancel(), t) {
4959
5090
  let e = as(i);
4960
5091
  r.fitToBox(i, !0, {
4961
5092
  paddingBottom: e,
4962
5093
  paddingLeft: e,
4963
5094
  paddingRight: e,
4964
5095
  paddingTop: e
5096
+ }).then(() => {
5097
+ let e = k.current;
5098
+ e && r.setOrbitPoint(e.x, e.y, e.z);
4965
5099
  });
4966
5100
  return;
4967
5101
  }
4968
- r.setOrbitPoint(a.x, a.y, a.z);
4969
- }, [n, _]), P = c(() => {
5102
+ P(a);
5103
+ }, [
5104
+ P,
5105
+ n,
5106
+ v
5107
+ ]), se = c(() => {
4970
5108
  let e = (e) => ({
4971
5109
  ...e,
4972
5110
  activeViewRoot: a.current
4973
5111
  });
4974
5112
  return {
4975
- convertIfcFileToBmt: (e, t) => w.ConvertIfcFileToBmt(e, t),
4976
- convertToBmt: (t) => w.ConvertToBmt(s, e(t))
5113
+ convertIfcFileToBmt: (e, t) => T.ConvertIfcFileToBmt(e, t),
5114
+ convertToBmt: (t) => T.ConvertToBmt(s, e(t))
4977
5115
  };
4978
5116
  }, [
4979
- w,
5117
+ T,
4980
5118
  a,
4981
5119
  s
4982
5120
  ]);
4983
- return Mr(a, n, x), Fn(), o(() => (x.setClippingSource(S), () => {
4984
- x.setClippingSource(null);
4985
- }), [x, S]), o(() => (t.current = g, () => {
5121
+ return jr(a, n, S, re), Pn(), o(() => {
5122
+ let e = _.domElement, t = (e) => {
5123
+ let t = k.current;
5124
+ t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || P(t));
5125
+ };
5126
+ return e.addEventListener("pointerdown", t, !0), () => {
5127
+ e.removeEventListener("pointerdown", t, !0);
5128
+ };
5129
+ }, [P, _]), o(() => (S.setClippingSource(C), () => {
5130
+ S.setClippingSource(null);
5131
+ }), [S, C]), o(() => (t.current = g, () => {
4986
5132
  t.current === g && (t.current = null);
4987
5133
  }), [g, t]), o(() => {
4988
5134
  if (!a.current) return;
4989
5135
  let t = requestAnimationFrame(() => {
4990
- a.current?.updateMatrixWorld(!0), (g instanceof se || g instanceof oe) && ns(g, a.current), te(), E(), T(), D(), S.syncWithModel(), C.syncWithModel(), e && O(a, n, r);
5136
+ a.current?.updateMatrixWorld(!0), (g instanceof oe || g instanceof ae) && ns(g, a.current), N(), D(), E(), ee(), C.syncWithModel(), w.syncWithModel(), e && F();
4991
5137
  });
4992
5138
  return () => cancelAnimationFrame(t);
4993
5139
  }, [
4994
- D,
5140
+ ee,
4995
5141
  e,
4996
- T,
5142
+ E,
4997
5143
  g,
4998
- S,
4999
- n,
5000
5144
  C,
5001
- O,
5145
+ n,
5146
+ w,
5147
+ F,
5002
5148
  r,
5003
5149
  a,
5004
5150
  s,
5005
- E,
5006
- te
5151
+ D,
5152
+ N
5007
5153
  ]), o(() => {
5008
5154
  let e = () => {
5009
- !S.getActive() || !S.getEdgesActive() || S.updateEdges();
5155
+ !C.getActive() || !C.getEdgesActive() || C.updateEdges();
5010
5156
  }, t = (t) => {
5011
5157
  t(), e();
5012
5158
  };
5013
5159
  return f({
5014
5160
  camera: {
5015
- fitCamera: () => O(a, n, r),
5016
- getIntersection: x.getIntersection
5161
+ fitCamera: F,
5162
+ getIntersection: S.getIntersection
5017
5163
  },
5018
5164
  clipping: {
5019
- createClippingRectangle: S.createClippingRectangle,
5020
- createPlane: S.createPlane,
5021
- deleteAllPlanes: S.deleteAllPlanes,
5022
- getActive: S.getActive,
5023
- getEdgesActive: S.getEdgesActive,
5024
- getHelpersActive: S.getHelpersActive,
5025
- getPlanes: S.getPlanes,
5026
- setActive: S.setActive,
5027
- setEdgesActive: S.setEdgesActive,
5028
- setHelpersActive: S.setHelpersActive,
5029
- toggle: S.toggle,
5030
- updateEdges: S.updateEdges,
5031
- updateMaterials: S.updateMaterials
5165
+ createClippingRectangle: C.createClippingRectangle,
5166
+ createPlane: C.createPlane,
5167
+ deleteAllPlanes: C.deleteAllPlanes,
5168
+ getActive: C.getActive,
5169
+ getEdgesActive: C.getEdgesActive,
5170
+ getHelpersActive: C.getHelpersActive,
5171
+ getPlanes: C.getPlanes,
5172
+ setActive: C.setActive,
5173
+ setEdgesActive: C.setEdgesActive,
5174
+ setHelpersActive: C.setHelpersActive,
5175
+ toggle: C.toggle,
5176
+ updateEdges: C.updateEdges,
5177
+ updateMaterials: C.updateMaterials
5032
5178
  },
5033
5179
  colors: {
5034
- clearAllColors: b.clearAllColors,
5035
- clearColor: b.clearColor,
5036
- clearModelColors: b.clearModelColors,
5037
- rebuildByColors: b.rebuildByColors,
5038
- rebuildModelByColors: b.rebuildModelByColors,
5039
- setColor: b.setColor
5180
+ clearAllColors: x.clearAllColors,
5181
+ clearColor: x.clearColor,
5182
+ clearModelColors: x.clearModelColors,
5183
+ rebuildByColors: x.rebuildByColors,
5184
+ rebuildModelByColors: x.rebuildModelByColors,
5185
+ setColor: x.setColor
5040
5186
  },
5041
- converter: P,
5187
+ converter: se,
5042
5188
  dimensions: {
5043
- cancelDrawing: C.cancelDrawing,
5044
- changeAxes: C.changeAxes,
5045
- delete: C.delete,
5046
- deleteAll: C.deleteAll,
5047
- getActive: C.getActive,
5048
- getDimensions: C.getDimensions,
5049
- getSnapDistance: C.getSnapDistance,
5050
- getUnit: C.getUnit,
5051
- setActive: C.setActive,
5052
- setColor: C.setColor,
5053
- setEndpointScaleFactor: C.setEndpointScaleFactor,
5054
- setSnapDistance: C.setSnapDistance,
5055
- setUnit: C.setUnit,
5056
- setWidth: C.setWidth,
5057
- toggle: C.toggle
5189
+ cancelDrawing: w.cancelDrawing,
5190
+ changeAxes: w.changeAxes,
5191
+ delete: w.delete,
5192
+ deleteAll: w.deleteAll,
5193
+ getActive: w.getActive,
5194
+ getDimensions: w.getDimensions,
5195
+ getSnapDistance: w.getSnapDistance,
5196
+ getUnit: w.getUnit,
5197
+ setActive: w.setActive,
5198
+ setColor: w.setColor,
5199
+ setEndpointScaleFactor: w.setEndpointScaleFactor,
5200
+ setSnapDistance: w.setSnapDistance,
5201
+ setUnit: w.setUnit,
5202
+ setWidth: w.setWidth,
5203
+ toggle: w.toggle
5058
5204
  },
5059
5205
  geometryUtils: {
5060
- getAllIds: v.getAllIds,
5061
- getIfcSpacesVisibility: v.getIfcSpacesVisibility,
5062
- hideByIds: (e) => t(() => v.hideByIds(e)),
5063
- hideSelected: () => t(v.hideSelected),
5064
- isolateByIds: (e) => t(() => v.isolateByIds(e)),
5065
- isolateSelected: () => t(v.isolateSelected),
5066
- resetIsolation: () => t(v.resetIsolation),
5067
- setIfcSpacesVisibility: (e) => t(() => v.setIfcSpacesVisibility(e)),
5068
- showAll: () => t(v.showAll),
5069
- showByIds: (e) => t(() => v.showByIds(e)),
5070
- toggleIIfcSpacesVisibility: () => t(v.toggleIIfcSpacesVisibility)
5206
+ getAllIds: y.getAllIds,
5207
+ getIfcSpacesVisibility: y.getIfcSpacesVisibility,
5208
+ hideByIds: (e) => t(() => y.hideByIds(e)),
5209
+ hideSelected: () => t(y.hideSelected),
5210
+ isolateByIds: (e) => t(() => y.isolateByIds(e)),
5211
+ isolateSelected: () => t(y.isolateSelected),
5212
+ resetIsolation: () => t(y.resetIsolation),
5213
+ setIfcSpacesVisibility: (e) => t(() => y.setIfcSpacesVisibility(e)),
5214
+ showAll: () => t(y.showAll),
5215
+ showByIds: (e) => t(() => y.showByIds(e)),
5216
+ toggleIIfcSpacesVisibility: () => t(y.toggleIIfcSpacesVisibility)
5071
5217
  },
5072
- selector: { setTargetToSelection: N }
5073
- }), k.current || (k.current = !0, u?.(d)), () => f(null);
5218
+ selector: { setTargetToSelection: ie }
5219
+ }), A.current || (A.current = !0, u?.(d)), () => f(null);
5074
5220
  }, [
5221
+ C,
5075
5222
  S,
5076
5223
  x,
5077
- b,
5078
5224
  n,
5079
- P,
5080
- C,
5081
- O,
5082
- v,
5225
+ se,
5226
+ w,
5227
+ F,
5228
+ y,
5083
5229
  r,
5084
5230
  a,
5085
5231
  u,
5086
5232
  d,
5087
5233
  f,
5088
- N
5089
- ]), /* @__PURE__ */ R(Ce, { children: [
5090
- /* @__PURE__ */ L("ambientLight", {
5234
+ ie
5235
+ ]), /* @__PURE__ */ z(Se, { children: [
5236
+ /* @__PURE__ */ R("ambientLight", {
5091
5237
  intensity: 1.2,
5092
5238
  color: "#ffffff"
5093
5239
  }),
5094
- /* @__PURE__ */ L("directionalLight", {
5240
+ /* @__PURE__ */ R("directionalLight", {
5095
5241
  ref: r,
5096
5242
  position: [
5097
5243
  10,
@@ -5101,17 +5247,17 @@ function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
5101
5247
  color: "#ffffff",
5102
5248
  intensity: 2
5103
5249
  }),
5104
- A && /* @__PURE__ */ L(h, {}),
5105
- /* @__PURE__ */ L("group", {
5250
+ te && /* @__PURE__ */ R(h, {}),
5251
+ /* @__PURE__ */ R("group", {
5106
5252
  ref: a,
5107
- children: M.map(([e, t]) => /* @__PURE__ */ L(wt, {
5108
- colorPaletteTexture: y,
5109
- coordinationMatrix: j,
5253
+ children: M.map(([e, t]) => /* @__PURE__ */ R(Ct, {
5254
+ colorPaletteTexture: b,
5255
+ coordinationMatrix: ne,
5110
5256
  data: t,
5111
5257
  modelID: e
5112
5258
  }, e))
5113
5259
  }),
5114
- /* @__PURE__ */ L(m, {
5260
+ /* @__PURE__ */ R(m, {
5115
5261
  dollyToCursor: !0,
5116
5262
  draggingSmoothTime: .04,
5117
5263
  infinityDolly: !0,
@@ -5129,7 +5275,7 @@ function ss({ autoFitCamera: e = !0, camera: t = {
5129
5275
  ],
5130
5276
  fov: 50
5131
5277
  }, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, onReady: s, publicApi: c, setSceneApi: f, showNavCube: p, showStats: m }) {
5132
- let h = l(null), g = l(null), _ = l(null), v = l(null), [y, b] = u(), x = Ee(), S = z((e) => e.setModelNames), C = z((e) => e.setModelProps), w = z((e) => e.setModelStructure), T = z((e) => e.setShowNavCube), E = z((e) => e.setShowStats), D = z((e) => e.setUserDevice), O = z((e) => e.showNavCube), k = a ?? y;
5278
+ let h = l(null), g = l(null), _ = l(null), v = l(null), [y, b] = u(), x = Te(), S = B((e) => e.setModelNames), C = B((e) => e.setModelProps), w = B((e) => e.setModelStructure), T = B((e) => e.setShowNavCube), E = B((e) => e.setShowStats), D = B((e) => e.setUserDevice), ee = B((e) => e.showNavCube), O = a ?? y;
5133
5279
  return o(() => {
5134
5280
  D($o());
5135
5281
  }, [D]), o(() => {
@@ -5138,12 +5284,12 @@ function ss({ autoFitCamera: e = !0, camera: t = {
5138
5284
  p !== void 0 && T(p);
5139
5285
  }, [T, p]), o(() => {
5140
5286
  let e = {}, t = {}, n = {};
5141
- k && Object.entries(k).forEach(([r, i]) => {
5287
+ O && Object.entries(O).forEach(([r, i]) => {
5142
5288
  let a = Number(r);
5143
5289
  i.name !== void 0 && (e[a] = i.name), i.props !== void 0 && (t[a] = i.props), i.structure !== void 0 && (n[a] = i.structure);
5144
5290
  }), S(e), C(t), w(n);
5145
5291
  }, [
5146
- k,
5292
+ O,
5147
5293
  S,
5148
5294
  C,
5149
5295
  w
@@ -5152,7 +5298,7 @@ function ss({ autoFitCamera: e = !0, camera: t = {
5152
5298
  let e = i ?? r;
5153
5299
  if (!e?.length) return;
5154
5300
  let t = !0;
5155
- return mo.loadModel(e).then((e) => {
5301
+ return po.loadModel(e).then((e) => {
5156
5302
  t && b(e);
5157
5303
  }), () => {
5158
5304
  t = !1;
@@ -5161,33 +5307,33 @@ function ss({ autoFitCamera: e = !0, camera: t = {
5161
5307
  a,
5162
5308
  i,
5163
5309
  r
5164
- ]), k ? /* @__PURE__ */ R("div", {
5310
+ ]), O ? /* @__PURE__ */ z("div", {
5165
5311
  style: Ho,
5166
- children: [/* @__PURE__ */ L(d, {
5312
+ children: [/* @__PURE__ */ R(d, {
5167
5313
  camera: t,
5168
5314
  dpr: n,
5169
- children: /* @__PURE__ */ L(Ir, {
5315
+ children: /* @__PURE__ */ R(Fr, {
5170
5316
  store: x,
5171
- children: /* @__PURE__ */ L(os, {
5317
+ children: /* @__PURE__ */ R(os, {
5172
5318
  autoFitCamera: e,
5173
5319
  cameraRef: h,
5174
5320
  controlRef: g,
5175
5321
  lightRef: v,
5176
5322
  modelRef: _,
5177
- modelsData: k,
5323
+ modelsData: O,
5178
5324
  onReady: s,
5179
5325
  publicApi: c,
5180
5326
  setSceneApi: f
5181
5327
  })
5182
5328
  })
5183
- }), O && /* @__PURE__ */ L("div", {
5329
+ }), ee && /* @__PURE__ */ R("div", {
5184
5330
  style: Vo,
5185
- children: /* @__PURE__ */ L(d, {
5331
+ children: /* @__PURE__ */ R(d, {
5186
5332
  camera: Uo,
5187
5333
  dpr: n,
5188
5334
  gl: Wo,
5189
5335
  orthographic: !0,
5190
- children: /* @__PURE__ */ L(zo, {
5336
+ children: /* @__PURE__ */ R(zo, {
5191
5337
  active: !0,
5192
5338
  cameraRef: h,
5193
5339
  controlRef: g,
@@ -5195,29 +5341,29 @@ function ss({ autoFitCamera: e = !0, camera: t = {
5195
5341
  })
5196
5342
  })
5197
5343
  })]
5198
- }) : /* @__PURE__ */ L(Ce, {});
5344
+ }) : /* @__PURE__ */ R(Se, {});
5199
5345
  }
5200
5346
  var cs = n(function(e, t) {
5201
- let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Bo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
5347
+ let [n] = u(ke), r = l(!1), a = l(!1), d = c(() => new Bo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
5202
5348
  d.set(e);
5203
- }, [d]), g = c(() => ba(n, d.get), [d, n]);
5349
+ }, [d]), g = c(() => ya(n, d.get), [d, n]);
5204
5350
  return s(t, () => g, [g]), o(() => (n.getState().setApi(g), () => {
5205
5351
  n.getState().api === g && n.getState().setApi(null);
5206
5352
  }), [g, n]), o(() => {
5207
- r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(ya(f)));
5353
+ r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(va(f)));
5208
5354
  }, [
5209
5355
  m,
5210
5356
  f,
5211
5357
  n
5212
5358
  ]), o(() => {
5213
- m !== void 0 && (a.current = !0, n.getState().setSelection(ya(m)), a.current = !1);
5359
+ m !== void 0 && (a.current = !0, n.getState().setSelection(va(m)), a.current = !1);
5214
5360
  }, [m, n]), o(() => {
5215
5361
  if (p) return n.subscribe((e, t) => {
5216
- e.selected !== t.selected && (a.current || p(va(e.selected)));
5362
+ e.selected !== t.selected && (a.current || p(_a(e.selected)));
5217
5363
  });
5218
- }, [p, n]), /* @__PURE__ */ L(Ir, {
5364
+ }, [p, n]), /* @__PURE__ */ R(Fr, {
5219
5365
  store: n,
5220
- children: /* @__PURE__ */ L(ss, {
5366
+ children: /* @__PURE__ */ R(ss, {
5221
5367
  ...e,
5222
5368
  publicApi: g,
5223
5369
  setSceneApi: h
@@ -5226,4 +5372,4 @@ var cs = n(function(e, t) {
5226
5372
  });
5227
5373
  cs.displayName = "Viewer";
5228
5374
  //#endregion
5229
- export { Sa as BMTLoader, ra as BmtConverter, aa as ConvertIfcFileToBmt, oa as ConvertToBmt, Tn as DimensionLine, Mn as DimensionsUtils, _a as FilteredElementsCollector, vt as ModelGrids, zo as NavigationCube, cs as Viewer, Ir as ViewerStoreProvider, ia as bmtConverter, qa as convertIfcFilesToBmtInWorker, Ja as createBmtConverterWorker, Ma as createBmtWorker, oo as createIfcWorker, Ae as createViewerStore, wi as exportExcel, xi as exportModelPropertiesToExcel, ja as loadBmtModelsInWorker, ao as loadIfcModelsInWorker, mo as loader, Nn as useDimensionsUtils, z as useViewerStore, Ee as useViewerStoreApi };
5375
+ export { xa as BMTLoader, na as BmtConverter, ia as ConvertIfcFileToBmt, aa as ConvertToBmt, wn as DimensionLine, jn as DimensionsUtils, ga as FilteredElementsCollector, _t as ModelGrids, zo as NavigationCube, cs as Viewer, Fr as ViewerStoreProvider, ra as bmtConverter, Ka as convertIfcFilesToBmtInWorker, qa as createBmtConverterWorker, ja as createBmtWorker, ao as createIfcWorker, ke as createViewerStore, Ci as exportExcel, bi as exportModelPropertiesToExcel, Aa as loadBmtModelsInWorker, io as loadIfcModelsInWorker, po as loader, Mn as useDimensionsUtils, B as useViewerStore, Te as useViewerStoreApi };