bimatter-viewer-react 0.5.13 → 0.6.1

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 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";
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 te, LineBasicMaterial as ne, LineDashedMaterial as O, LineSegments as k, LinearFilter as A, MathUtils as re, Matrix4 as j, Mesh as M, MeshBasicMaterial as N, MeshLambertMaterial as P, 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";
10
10
  //#region src/viewer/store/ViewerStoreContext.ts
11
- var we = t(null);
11
+ var Te = t(null);
12
12
  //#endregion
13
13
  //#region src/viewer/store/useViewerStore.ts
14
- function B(e) {
15
- return he(Te(), e);
14
+ function z(e) {
15
+ return ge(Ee(), e);
16
16
  }
17
- function Te() {
18
- let e = a(we);
17
+ function Ee() {
18
+ let e = a(Te);
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 Ee = "rgb(17, 148, 189)", De = "rgb(104, 198, 227)", Oe = {
24
+ var De = "rgb(17, 148, 189)", Oe = "rgb(104, 198, 227)", ke = {
25
25
  bottom: !0,
26
26
  left: !0,
27
27
  right: !0,
28
28
  top: !0,
29
29
  visible: !0
30
30
  };
31
- function ke() {
32
- return ge((e) => ({
31
+ function Ae() {
32
+ return _e((e) => ({
33
33
  api: null,
34
34
  defaultHotkeysEnabled: !0,
35
- gridAxesVisibility: Oe,
35
+ gridAxesVisibility: ke,
36
36
  modelNames: {},
37
37
  modelProps: {},
38
38
  modelStructure: {},
39
- preselectionColor: De,
39
+ preselectionColor: Oe,
40
40
  selected: {},
41
- selectionColor: Ee,
41
+ selectionColor: De,
42
42
  selectionInteractionDisabled: !1,
43
43
  showNavCube: !0,
44
44
  showStats: !1,
@@ -119,66 +119,66 @@ function ke() {
119
119
  }
120
120
  }));
121
121
  }
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;
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;
126
126
  }
127
- function Me(e) {
127
+ function Ne(e) {
128
128
  return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
129
129
  }
130
- function Ne(e, t, n) {
130
+ function Pe(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 Pe(e) {
134
+ function Fe(e) {
135
135
  return e.mesh.geometry.attributes.colorIndex;
136
136
  }
137
- function Fe(e) {
137
+ function Ie(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 Ie(e, t) {
144
- let n = Pe(e);
145
- return n || t === 0 ? n : Fe(e);
143
+ function Le(e, t) {
144
+ let n = Fe(e);
145
+ return n || t === 0 ? n : Ie(e);
146
146
  }
147
- function Le(e) {
148
- Pe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
147
+ function Re(e) {
148
+ Fe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
149
149
  }
150
- function Re(e, t, n) {
150
+ function ze(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 ze(e, t) {
155
- let n = Ie(e.record, t);
154
+ function Be(e, t) {
155
+ let n = Le(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 Be(e, t, n, r, i) {
162
+ function Ve(e, t, n, r, i) {
163
163
  e && e.forEach((e) => {
164
164
  if (e.record.modelID !== t) return;
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);
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);
167
167
  });
168
168
  }
169
- function Ve(e, t, n) {
169
+ function He(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 He(e) {
175
+ function Ue(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 Ue(e, t) {
181
+ function We(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 Ue(e, t) {
189
189
  t.has(e) || r(e);
190
190
  }), n;
191
191
  }
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());
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());
194
194
  o(() => {
195
195
  d.current = t;
196
196
  }, [t]), o(() => () => r.dispose(), [r]), o(() => {
197
- Ne(r, 1, new x(n));
197
+ Pe(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
- Be(r.elementIndex.get(e), t, e, m(t, e), p.current);
202
+ Ve(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 = Me(t), i = a.current.get(n);
205
+ let t = new x(e), n = Ne(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, Ne(r, o, t), o;
209
+ return a.current.set(n, o), s.current += 1, Pe(r, o, t), o;
210
210
  }, [r]);
211
211
  o(() => {
212
- let e = He(t);
213
- Ue(f.current, e).forEach((e, t) => {
212
+ let e = Ue(t);
213
+ We(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 We(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(Ve(i, t, a)), r), o.forEach(([e, n]) => {
224
+ }), r !== void 0 && _(t, Array.from(He(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 We(e) {
249
249
  t.forEach((t) => r(Number(e), t));
250
250
  }), n.forEach((e, n) => {
251
251
  e.forEach((e) => {
252
- Be(t.elementIndex.get(e), n, e, m(n, e), p.current);
252
+ Ve(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), Le(e);
257
+ p.current.delete(e), Re(e);
258
258
  }), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(), C();
259
259
  }, [C, e]);
260
260
  return {
@@ -280,23 +280,25 @@ function We(e) {
280
280
  }
281
281
  //#endregion
282
282
  //#region src/viewer/SelectableMesh.tsx
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
- u.current = s;
287
- let d = c(() => {
288
- let n = new re({
283
+ M.prototype.raycast = Se;
284
+ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: s = !1 }) {
285
+ let u = l(null), d = z((e) => e.preselectionColor), f = l(d);
286
+ f.current = d;
287
+ let p = c(() => {
288
+ let r = {
289
289
  color: new x(t.r, t.g, t.b),
290
290
  transparent: !!(t.opacity && t.opacity != 1),
291
- opacity: t.opacity ?? 1,
291
+ opacity: t.opacity ?? 1
292
+ }, i = s ? {
293
+ ...r,
292
294
  side: w
293
- }), r = n;
294
- return r.defaultAttributeValues = {
295
- ...r.defaultAttributeValues,
295
+ } : r, a = n === "performance" ? new N(i) : new P(i), o = a;
296
+ return o.defaultAttributeValues = {
297
+ ...o.defaultAttributeValues,
296
298
  colorIndex: [0]
297
- }, n.onBeforeCompile = (r) => {
298
- let i = new x(u.current);
299
- r.uniforms.baseColor = { value: new x(t.r, t.g, t.b) }, r.uniforms.preSelectionColor = { value: i }, r.uniforms.preSelectionId = { value: -1 }, r.uniforms.elementColorPalette = { value: e }, r.vertexShader = r.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n flat varying float vColorIndex;\n flat varying float vPreselectId;\n "), r.vertexShader = r.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vColorIndex = colorIndex;\n vPreselectId = float(ids);\n "), r.fragmentShader = r.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 baseColor;\n uniform vec3 preSelectionColor;\n uniform sampler2D elementColorPalette;\n flat varying float vPreselectId;\n flat varying float vColorIndex;\n uniform float preSelectionId;\n "), r.fragmentShader = r.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );", `
299
+ }, a.onBeforeCompile = (n) => {
300
+ let r = new x(f.current);
301
+ n.uniforms.baseColor = { value: new x(t.r, t.g, t.b) }, n.uniforms.preSelectionColor = { value: r }, n.uniforms.preSelectionId = { value: -1 }, n.uniforms.elementColorPalette = { value: e }, n.vertexShader = n.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n flat varying float vColorIndex;\n flat varying float vPreselectId;\n "), n.vertexShader = n.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vColorIndex = colorIndex;\n vPreselectId = float(ids);\n "), n.fragmentShader = n.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 baseColor;\n uniform vec3 preSelectionColor;\n uniform sampler2D elementColorPalette;\n flat varying float vPreselectId;\n flat varying float vColorIndex;\n uniform float preSelectionId;\n "), n.fragmentShader = n.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );", `
300
302
  vec4 diffuseColor;
301
303
  if(preSelectionId == vPreselectId && abs(vColorIndex - 1.0) > 0.5){
302
304
  diffuseColor = vec4(preSelectionColor, 1.0);
@@ -311,60 +313,65 @@ var Ge = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
311
313
  else{
312
314
  diffuseColor = vec4(baseColor, opacity);
313
315
  }
314
- `), n.userData.shader = r;
315
- }, n;
316
- }, [e, t]);
316
+ `), a.userData.shader = n;
317
+ }, a;
318
+ }, [
319
+ e,
320
+ t,
321
+ n,
322
+ s
323
+ ]);
317
324
  return o(() => {
318
- let e = d.userData.shader?.uniforms.preSelectionColor;
319
- e && (e.value instanceof x ? e.value.set(s) : e.value = new x(s));
320
- }, [d, s]), o(() => {
321
- if (!a.current) return;
322
- let e = a.current.geometry, t = new ye(e, { indirect: !0 });
325
+ let e = p.userData.shader?.uniforms.preSelectionColor;
326
+ e && (e.value instanceof x ? e.value.set(d) : e.value = new x(d));
327
+ }, [p, d]), o(() => {
328
+ if (!u.current) return;
329
+ let e = u.current.geometry, t = new be(e, { indirect: !0 });
323
330
  return Object.assign(e, { boundsTree: t }), () => {
324
- d.dispose(), Object.assign(e, { boundsTree: null });
331
+ p.dispose(), Object.assign(e, { boundsTree: null });
325
332
  };
326
- }, [d]), /* @__PURE__ */ z("mesh", {
327
- matrix: i,
333
+ }, [p]), /* @__PURE__ */ R("mesh", {
334
+ matrix: a,
328
335
  matrixAutoUpdate: !1,
329
- name: r ? "space" : void 0,
330
- ref: a,
331
- userData: { isIfcSpace: r },
336
+ name: i ? "space" : void 0,
337
+ ref: u,
338
+ userData: { isIfcSpace: i },
332
339
  onPointerLeave: (e) => {
333
340
  let t = e.object;
334
341
  t.preselected &&= !1;
335
342
  },
336
- children: [/* @__PURE__ */ z("bufferGeometry", { children: [
337
- /* @__PURE__ */ R("bufferAttribute", {
343
+ children: [/* @__PURE__ */ R("bufferGeometry", { children: [
344
+ /* @__PURE__ */ L("bufferAttribute", {
338
345
  attach: "attributes-position",
339
- args: [n.pos, 3]
346
+ args: [r.pos, 3]
340
347
  }),
341
- n.norm && /* @__PURE__ */ R("bufferAttribute", {
348
+ r.norm && /* @__PURE__ */ L("bufferAttribute", {
342
349
  attach: "attributes-normal",
343
- args: [n.norm, 3]
350
+ args: [r.norm, 3]
344
351
  }),
345
- /* @__PURE__ */ R("bufferAttribute", {
352
+ /* @__PURE__ */ L("bufferAttribute", {
346
353
  attach: "attributes-ids",
347
- args: [n.ids, 1]
354
+ args: [r.ids, 1]
348
355
  }),
349
- /* @__PURE__ */ R("bufferAttribute", {
356
+ /* @__PURE__ */ L("bufferAttribute", {
350
357
  attach: "index",
351
- args: [n.ind, 1]
358
+ args: [r.ind, 1]
352
359
  })
353
- ] }), /* @__PURE__ */ R("primitive", { object: d })]
360
+ ] }), /* @__PURE__ */ L("primitive", { object: p })]
354
361
  });
355
- }), Ke = 10, qe = "#1d2733", Je = 2, Ye = .05, Xe = "\0", Ze = /* @__PURE__ */ new Map();
356
- function Qe() {
362
+ }), qe = 10, Je = "#1d2733", Ye = 2, Xe = .05, Ze = "\0", Qe = /* @__PURE__ */ new Map();
363
+ function $e() {
357
364
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
358
365
  }
359
- function $e(e, t, n, r) {
360
- let i = Qe(), a = document.createElement("canvas"), o = a.getContext("2d");
366
+ function et(e, t, n, r) {
367
+ let i = $e(), a = document.createElement("canvas"), o = a.getContext("2d");
361
368
  if (!o) throw Error("Could not create grid label canvas context");
362
369
  let s = `400 ${r}px system-ui, "Segoe UI", sans-serif`, c = Math.ceil(r * .5), l = Math.ceil(r * .35);
363
370
  o.font = s;
364
371
  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
372
  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
373
  let h = new b(a);
367
- return h.colorSpace = le, h.generateMipmaps = !1, h.magFilter = j, h.minFilter = j, h.needsUpdate = !0, {
374
+ return h.colorSpace = ue, h.generateMipmaps = !1, h.magFilter = A, h.minFilter = A, h.needsUpdate = !0, {
368
375
  disposeTimer: null,
369
376
  height: m,
370
377
  key: e,
@@ -373,49 +380,49 @@ function $e(e, t, n, r) {
373
380
  width: p
374
381
  };
375
382
  }
376
- function et(e, t, n) {
383
+ function tt(e, t, n) {
377
384
  let r = [
378
385
  e,
379
386
  t,
380
387
  n
381
- ].join(Xe), i = Ze.get(r);
382
- return i || (i = $e(r, e, t, n), Ze.set(r, i)), i;
388
+ ].join(Ze), i = Qe.get(r);
389
+ return i || (i = et(r, e, t, n), Qe.set(r, i)), i;
383
390
  }
384
- function tt(e, t, n) {
385
- let r = c(() => et(e, t, n), [
391
+ function nt(e, t, n) {
392
+ let r = c(() => tt(e, t, n), [
386
393
  t,
387
394
  n,
388
395
  e
389
396
  ]);
390
397
  return o(() => (r.disposeTimer &&= (clearTimeout(r.disposeTimer), null), r.refs++, () => {
391
398
  r.refs = Math.max(0, r.refs - 1), r.refs <= 0 && (r.disposeTimer = setTimeout(() => {
392
- r.refs > 0 || (r.texture.dispose(), Ze.delete(r.key), r.disposeTimer = null);
399
+ r.refs > 0 || (r.texture.dispose(), Qe.delete(r.key), r.disposeTimer = null);
393
400
  }, 1e3));
394
401
  }), [r]), r;
395
402
  }
396
- function nt(e, t, n, r) {
403
+ function rt(e, t, n, r) {
397
404
  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
405
  e.scale.set(o, a, 1);
399
406
  }
400
- function rt(e, t) {
407
+ function it(e, t) {
401
408
  let n = e[t];
402
409
  return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
403
410
  }
404
- function V(e, t) {
405
- return rt(e, t) ?? 0;
411
+ function B(e, t) {
412
+ return it(e, t) ?? 0;
406
413
  }
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);
414
+ function at(e) {
415
+ let t = it(e, "x"), n = it(e, "y"), r = it(e, "z");
416
+ return t === null || n === null || r === null ? null : new I(t, n, r);
410
417
  }
411
- function at(e, t) {
418
+ function ot(e, t) {
412
419
  return [
413
- V(e, "x"),
414
- t !== void 0 && Number.isFinite(t) ? t : V(e, "y"),
415
- V(e, "z")
420
+ B(e, "x"),
421
+ t !== void 0 && Number.isFinite(t) ? t : B(e, "y"),
422
+ B(e, "z")
416
423
  ];
417
424
  }
418
- function ot(e) {
425
+ function st(e) {
419
426
  let { h: t, l: n } = e.getHSL({
420
427
  h: 0,
421
428
  s: 0,
@@ -423,14 +430,14 @@ function ot(e) {
423
430
  });
424
431
  return t < .55 && n >= .5 || t >= .55 && n >= .75 ? "#000000" : "#ffffff";
425
432
  }
426
- function st(e) {
433
+ function ct(e) {
427
434
  let t = p((e) => e.scene.background);
428
- return c(() => e || (t instanceof x ? ot(t) : qe), [t, e]);
435
+ return c(() => e || (t instanceof x ? st(t) : Je), [t, e]);
429
436
  }
430
- function ct({ axis: e, grid: t, endSide: n, startSide: r }) {
437
+ function lt({ axis: e, grid: t, endSide: n, startSide: r }) {
431
438
  return Object.entries(e).flatMap(([e, i]) => {
432
439
  if (i.length < 2) return [];
433
- let a = it(i[0]), o = it(i[1]);
440
+ let a = at(i[0]), o = at(i[1]);
434
441
  return !a || !o ? [] : (a.y = 0, o.y = 0, [{
435
442
  endSide: n,
436
443
  loc: t.loc,
@@ -440,18 +447,18 @@ function ct({ axis: e, grid: t, endSide: n, startSide: r }) {
440
447
  }]);
441
448
  });
442
449
  }
443
- function lt({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
450
+ function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
444
451
  let o = {
445
452
  bottom: n,
446
453
  left: r,
447
454
  right: i,
448
455
  top: a
449
- }, s = Object.values(t).flatMap((e) => [...ct({
456
+ }, s = Object.values(t).flatMap((e) => [...lt({
450
457
  axis: e.points.u,
451
458
  endSide: "right",
452
459
  grid: e,
453
460
  startSide: "left"
454
- }), ...ct({
461
+ }), ...lt({
455
462
  axis: e.points.v,
456
463
  endSide: "bottom",
457
464
  grid: e,
@@ -464,8 +471,8 @@ function lt({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
464
471
  e.startSide,
465
472
  e.endSide,
466
473
  e.name,
467
- V(e.loc, "x"),
468
- V(e.loc, "z"),
474
+ B(e.loc, "x"),
475
+ B(e.loc, "z"),
469
476
  e.points[0].x,
470
477
  e.points[0].z,
471
478
  e.points[1].x,
@@ -474,57 +481,57 @@ function lt({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
474
481
  c.has(t) || c.set(t, e);
475
482
  }), Array.from(c.values());
476
483
  }
477
- function ut(e, t) {
478
- return new L(...at(e.loc, t));
484
+ function dt(e, t) {
485
+ return new I(...ot(e.loc, t));
479
486
  }
480
- function dt({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
487
+ function ft({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
481
488
  let s = {
482
489
  bottom: r,
483
490
  left: i,
484
491
  right: a,
485
492
  top: o
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];
493
+ }, 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];
487
494
  return p(d) ? d : p(f) ? f : null;
488
495
  }
489
- function ft({ endpoint: e, labelOffset: t, line: n }) {
496
+ function pt({ endpoint: e, labelOffset: t, line: n }) {
490
497
  let r = e === "start" ? n.points[0].clone() : n.points[1].clone(), i = n.points[1].clone().sub(n.points[0]);
491
498
  return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
492
499
  }
493
- function pt(e, t) {
494
- let n = new L(), r = 0;
500
+ function mt(e, t) {
501
+ let n = new I(), r = 0;
495
502
  return e.forEach((e) => {
496
- let i = ut(e, t);
503
+ let i = dt(e, t);
497
504
  e.points.forEach((e) => {
498
505
  n.add(e).add(i), r++;
499
506
  });
500
507
  }), r && n.divideScalar(r), n;
501
508
  }
502
- function mt(e, t, n) {
509
+ function ht(e, t, n) {
503
510
  let r = 0;
504
511
  return e.forEach((e) => {
505
- let i = ut(e, n);
512
+ let i = dt(e, n);
506
513
  e.points.forEach((e) => {
507
514
  r = Math.max(r, e.clone().add(i).distanceTo(t));
508
515
  });
509
516
  }), r;
510
517
  }
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);
518
+ function gt({ color: e, fontSize: t, position: n, text: r }) {
519
+ let { camera: i, size: a } = p(), s = l(null), c = nt(r, e, t);
513
520
  return o(() => {
514
521
  let e = s.current;
515
- e && nt(e, c, i, a.height);
522
+ e && rt(e, c, i, a.height);
516
523
  }, [
517
524
  i,
518
525
  a.height,
519
526
  c
520
527
  ]), f(({ camera: e, size: t }) => {
521
528
  let n = s.current;
522
- n && nt(n, c, e, t.height);
523
- }), /* @__PURE__ */ R("sprite", {
529
+ n && rt(n, c, e, t.height);
530
+ }), /* @__PURE__ */ L("sprite", {
524
531
  ref: s,
525
532
  position: n,
526
533
  renderOrder: 2,
527
- children: /* @__PURE__ */ R("spriteMaterial", {
534
+ children: /* @__PURE__ */ L("spriteMaterial", {
528
535
  alphaTest: .1,
529
536
  depthTest: !0,
530
537
  depthWrite: !1,
@@ -535,8 +542,8 @@ function ht({ color: e, fontSize: t, position: n, text: r }) {
535
542
  })
536
543
  });
537
544
  }
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({
545
+ function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: s, showLeft: l, showRight: u, showTop: d }) {
546
+ let f = c(() => new y().setFromPoints(a.points), [a.points]), p = ft({
540
547
  cameraPosition: e,
541
548
  floorY: n,
542
549
  line: a,
@@ -544,19 +551,19 @@ function gt({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
544
551
  showLeft: l,
545
552
  showRight: u,
546
553
  showTop: d
547
- }), m = p ? ft({
554
+ }), m = p ? pt({
548
555
  endpoint: p,
549
556
  labelOffset: i,
550
557
  line: a
551
558
  }) : null;
552
- return o(() => () => f.dispose(), [f]), /* @__PURE__ */ z("lineSegments", {
559
+ return o(() => () => f.dispose(), [f]), /* @__PURE__ */ R("lineSegments", {
553
560
  geometry: f,
554
- position: at(a.loc, n),
555
- children: [/* @__PURE__ */ R("lineBasicMaterial", {
561
+ position: ot(a.loc, n),
562
+ children: [/* @__PURE__ */ L("lineBasicMaterial", {
556
563
  color: t,
557
564
  depthWrite: !1,
558
565
  linewidth: 2
559
- }), m && /* @__PURE__ */ R(ht, {
566
+ }), m && /* @__PURE__ */ L(gt, {
560
567
  color: t,
561
568
  fontSize: r,
562
569
  position: m,
@@ -564,8 +571,8 @@ function gt({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
564
571
  })]
565
572
  });
566
573
  }
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({
574
+ 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 }) {
575
+ let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new I()), y = ct(e), b = c(() => r ? ut({
569
576
  flattenToFloor: t !== void 0,
570
577
  grids: r,
571
578
  showBottom: a,
@@ -579,7 +586,7 @@ function _t({ color: e, floorY: t, fontSize: n = Ke, grids: r, labelOffset: i =
579
586
  o,
580
587
  s,
581
588
  d
582
- ]), x = c(() => pt(b, t), [t, b]), S = c(() => Math.max(i, mt(b, x, t) * .015), [
589
+ ]), x = c(() => mt(b, t), [t, b]), S = c(() => Math.max(i, ht(b, x, t) * .015), [
583
590
  x,
584
591
  t,
585
592
  i,
@@ -589,11 +596,11 @@ function _t({ color: e, floorY: t, fontSize: n = Ke, grids: r, labelOffset: i =
589
596
  let e = g.current;
590
597
  if (!e) return;
591
598
  let t = h.position.clone();
592
- e.worldToLocal(t), !(t.distanceToSquared(_) < Ye) && v(t);
593
- }), !m || !b.length ? null : /* @__PURE__ */ R("group", {
599
+ e.worldToLocal(t), !(t.distanceToSquared(_) < Xe) && v(t);
600
+ }), !m || !b.length ? null : /* @__PURE__ */ L("group", {
594
601
  ref: g,
595
602
  userData: { modelGrids: !0 },
596
- children: b.map((e) => /* @__PURE__ */ R(gt, {
603
+ children: b.map((e) => /* @__PURE__ */ L(_t, {
597
604
  cameraPosition: _,
598
605
  color: y,
599
606
  floorY: t,
@@ -608,9 +615,9 @@ function _t({ color: e, floorY: t, fontSize: n = Ke, grids: r, labelOffset: i =
608
615
  e.startSide,
609
616
  e.endSide,
610
617
  e.name,
611
- V(e.loc, "x"),
612
- t ?? V(e.loc, "y"),
613
- V(e.loc, "z"),
618
+ B(e.loc, "x"),
619
+ t ?? B(e.loc, "y"),
620
+ B(e.loc, "z"),
614
621
  e.points[0].x,
615
622
  e.points[0].y,
616
623
  e.points[0].z,
@@ -622,33 +629,33 @@ function _t({ color: e, floorY: t, fontSize: n = Ke, grids: r, labelOffset: i =
622
629
  }
623
630
  //#endregion
624
631
  //#region src/viewer/Model.tsx
625
- var vt = new M();
626
- function yt(e) {
632
+ var yt = new j();
633
+ function bt(e) {
627
634
  if (!e) return null;
628
635
  try {
629
636
  let t = JSON.parse(e);
630
- return !Array.isArray(t) || t.length !== 16 ? null : new M().fromArray(t);
637
+ return !Array.isArray(t) || t.length !== 16 ? null : new j().fromArray(t);
631
638
  } catch (e) {
632
639
  return console.warn("Model matrix parsing error", e), null;
633
640
  }
634
641
  }
635
- function bt(e) {
636
- return yt(xt(e));
637
- }
638
642
  function xt(e) {
643
+ return bt(St(e));
644
+ }
645
+ function St(e) {
639
646
  return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
640
647
  }
641
- function St({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
642
- let i = B((e) => e.gridAxesVisibility), a = c(() => {
648
+ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, materialMode: i }) {
649
+ let a = z((e) => e.gridAxesVisibility), o = c(() => {
643
650
  if (!r) return {
644
651
  data: [],
645
652
  coordinationMatrix: null,
646
653
  floorY: 0
647
654
  };
648
- let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? bt(r) : null, i = Infinity, a = new L();
655
+ let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? xt(r) : null, i = Infinity, a = new I();
649
656
  return {
650
657
  data: Object.values(r.data).map((e) => {
651
- let t = (yt(e.matrix) ?? new M()).clone().invert(), r = e.mat, o = e.pos;
658
+ let t = (bt(e.matrix) ?? new j()).clone().invert(), r = e.mat, o = e.pos;
652
659
  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
660
  return {
654
661
  data: e,
@@ -666,44 +673,48 @@ function St({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
666
673
  r,
667
674
  n
668
675
  ]);
669
- return r ? /* @__PURE__ */ z("group", {
670
- matrix: a.coordinationMatrix ?? vt,
676
+ if (!r) return /* @__PURE__ */ L(Ce, {});
677
+ let s = i ?? r.renderSettings?.materialMode ?? "quality", l = r.renderSettings?.useDoubleSideMaterial === !0;
678
+ return /* @__PURE__ */ R("group", {
679
+ matrix: o.coordinationMatrix ?? yt,
671
680
  matrixAutoUpdate: !1,
672
681
  userData: { modelID: n },
673
- children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ R(Ge, {
682
+ children: [o.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ L(Ke, {
674
683
  colorPaletteTexture: e,
675
684
  material: i,
685
+ materialMode: s,
676
686
  data: t,
677
687
  isIfcSpace: n,
678
- meshMatrix: a
679
- }, r)), /* @__PURE__ */ R(_t, {
680
- floorY: a.floorY,
688
+ meshMatrix: a,
689
+ useDoubleSideMaterial: l
690
+ }, r)), /* @__PURE__ */ L(vt, {
691
+ floorY: o.floorY,
681
692
  grids: r.grids,
682
- showBottom: i.bottom,
683
- showLeft: i.left,
684
- showRight: i.right,
685
- showTop: i.top,
686
- visible: i.visible
693
+ showBottom: a.bottom,
694
+ showLeft: a.left,
695
+ showRight: a.right,
696
+ showTop: a.top,
697
+ visible: a.visible
687
698
  })]
688
- }) : /* @__PURE__ */ R(Se, {});
699
+ });
689
700
  }
690
- var Ct = r(St);
701
+ var wt = r(Ct);
691
702
  //#endregion
692
703
  //#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
693
- function wt() {
704
+ function Tt() {
694
705
  return {
695
706
  elementIndex: /* @__PURE__ */ new Map(),
696
- ifcSpacesVisible: !0,
707
+ ifcSpacesVisible: !1,
697
708
  indexedModel: null,
698
709
  isolatedIdsByModel: null,
699
710
  isolatedIds: null,
700
711
  records: /* @__PURE__ */ new Set()
701
712
  };
702
713
  }
703
- function Tt(e) {
714
+ function Et(e) {
704
715
  return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
705
716
  }
706
- function Et(e, t, n, r) {
717
+ function Dt(e, t, n, r) {
707
718
  let i = n.get(e);
708
719
  if (i) return i;
709
720
  i = {
@@ -713,20 +724,20 @@ function Et(e, t, n, r) {
713
724
  let a = r.get(e);
714
725
  return a || (a = [], r.set(e, a)), a.push(i), i;
715
726
  }
716
- function Dt(e, t, n, r, i, a) {
717
- n && Et(e, r, i, a).vertexRanges.push({
727
+ function Ot(e, t, n, r, i, a) {
728
+ n && Dt(e, r, i, a).vertexRanges.push({
718
729
  count: n,
719
730
  start: t
720
731
  });
721
732
  }
722
- function Ot(e, t, n, r, i, a) {
723
- n && (Et(e, r, i, a), r.triangleRanges.push({
733
+ function kt(e, t, n, r, i, a) {
734
+ n && (Dt(e, r, i, a), r.triangleRanges.push({
724
735
  count: n,
725
736
  id: e,
726
737
  start: t
727
738
  }));
728
739
  }
729
- function kt(e) {
740
+ function At(e) {
730
741
  let t = e;
731
742
  for (; t;) {
732
743
  let e = t.userData.modelID;
@@ -735,40 +746,40 @@ function kt(e) {
735
746
  }
736
747
  return 0;
737
748
  }
738
- function At(e) {
749
+ function jt(e) {
739
750
  return e.name === "space" || e.userData.isIfcSpace === !0;
740
751
  }
741
- function jt(e) {
742
- let t = l(wt()), n = i(() => {
752
+ function Mt(e) {
753
+ let t = l(Tt()), n = i(() => {
743
754
  let n = e.current, r = t.current;
744
755
  if (!n || r.indexedModel === n && r.records.size) return r;
745
756
  let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
746
757
  return n.traverse((e) => {
747
- if (!(e instanceof N)) return;
748
- let t = e, n = t.geometry, r = n.index, o = n.attributes.ids;
749
- if (!r || !o) return;
750
- let s = kt(t), c = Tt(r.array), l = {
758
+ if (!(e instanceof M)) return;
759
+ let t = e, n = t.geometry, o = n.index, s = n.attributes.ids;
760
+ if (!o || !s) return;
761
+ let c = At(t), l = jt(t), u = Et(o.array), d = {
751
762
  hiddenIds: /* @__PURE__ */ new Set(),
752
763
  initialVisible: t.visible,
753
- isIfcSpace: At(t),
764
+ isIfcSpace: l,
754
765
  mesh: t,
755
- modelID: s,
766
+ modelID: c,
756
767
  originalBoundsTree: n.boundsTree ?? null,
757
- originalIndex: c,
768
+ originalIndex: u,
758
769
  visibleStateKey: "",
759
770
  triangleRanges: []
760
- }, u = /* @__PURE__ */ new Map(), d = null, f = 0, p = c.length / 3;
761
- for (let e = 0; e < p; e++) {
762
- let t = o.getX(c[e * 3]);
763
- d === null ? (d = t, f = e) : t !== d && (Ot(d, f, e - f, l, u, i), d = t, f = e);
771
+ }, f = /* @__PURE__ */ new Map(), p = null, m = 0, h = u.length / 3;
772
+ for (let e = 0; e < h; e++) {
773
+ let t = s.getX(u[e * 3]);
774
+ p === null ? (p = t, m = e) : t !== p && (kt(p, m, e - m, d, f, i), p = t, m = e);
764
775
  }
765
- d !== null && Ot(d, f, p - f, l, u, i);
766
- let m = null, h = 0;
767
- for (let e = 0; e < o.count; e++) {
768
- let t = o.getX(e);
769
- m === null ? (m = t, h = e) : t !== m && (Dt(m, h, e - h, l, u, i), m = t, h = e);
776
+ p !== null && kt(p, m, h - m, d, f, i);
777
+ let g = null, _ = 0;
778
+ for (let e = 0; e < s.count; e++) {
779
+ let t = s.getX(e);
780
+ g === null ? (g = t, _ = e) : t !== g && (Ot(g, _, e - _, d, f, i), g = t, _ = e);
770
781
  }
771
- m !== null && Dt(m, h, o.count - h, l, u, i), a.add(l);
782
+ g !== null && Ot(g, _, s.count - _, d, f, i), a.add(d), l && !r.ifcSpacesVisible && (t.visible = !1);
772
783
  }), t.current = {
773
784
  elementIndex: i,
774
785
  ifcSpacesVisible: r.ifcSpacesVisible,
@@ -778,7 +789,7 @@ function jt(e) {
778
789
  records: a
779
790
  }, t.current;
780
791
  }, [e]), r = i(() => {
781
- t.current = wt();
792
+ t.current = Tt();
782
793
  }, []);
783
794
  return c(() => ({
784
795
  buildIndex: n,
@@ -787,95 +798,95 @@ function jt(e) {
787
798
  }
788
799
  //#endregion
789
800
  //#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
790
- function Mt(e, t) {
801
+ function Nt(e, t) {
791
802
  return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
792
803
  }
793
- function Nt(e) {
804
+ function Pt(e) {
794
805
  let t = e.geometry;
795
- Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new ye(e.geometry, { indirect: !0 }) });
806
+ Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new be(e.geometry, { indirect: !0 }) });
796
807
  }
797
- function Pt(e, t, n = !0) {
798
- e.mesh.geometry.setIndex(new v(t, 1)), n && Nt(e.mesh);
808
+ function Ft(e, t, n = !0) {
809
+ e.mesh.geometry.setIndex(new v(t, 1)), n && Pt(e.mesh);
799
810
  }
800
- function Ft(e, t) {
811
+ function It(e, t) {
801
812
  return e.initialVisible && (!e.isIfcSpace || t);
802
813
  }
803
- function It(e, t) {
814
+ function Lt(e, t) {
804
815
  let n = e.mesh.geometry, r = n.index?.array;
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);
816
+ 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);
806
817
  }
807
- function Lt(e) {
818
+ function Rt(e) {
808
819
  return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
809
820
  }
810
- function Rt(e, t, n, r) {
811
- return `h:${Lt(e)}|i:${Lt(n)}|s:${r ? Number(t) : ""}`;
821
+ function zt(e, t, n, r) {
822
+ return `h:${Rt(e)}|i:${Rt(n)}|s:${r ? Number(t) : ""}`;
812
823
  }
813
- function zt(e, t, n) {
824
+ function Bt(e, t, n) {
814
825
  return !t.has(e) && (!n || n.has(e));
815
826
  }
816
- function Bt(e, t) {
827
+ function Vt(e, t) {
817
828
  Object.entries(e).forEach(([e, n]) => {
818
829
  n.forEach((n) => t(Number(e), n));
819
830
  });
820
831
  }
821
- function Vt(e, t, n) {
832
+ function Ht(e, t, n) {
822
833
  e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
823
834
  }
824
- function H(e, t, n) {
835
+ function V(e, t, n) {
825
836
  e && console.log(`${t}:`, Date.now() - n, "ms");
826
837
  }
827
- function U(e, t, n, r) {
828
- let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Rt(i, t, n, e.isIfcSpace);
838
+ function H(e, t, n, r) {
839
+ let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = zt(i, t, n, e.isIfcSpace);
829
840
  if (e.visibleStateKey === s) return;
830
841
  if (!i.size && !n) {
831
- It(e, t), e.visibleStateKey = s;
842
+ Lt(e, t), e.visibleStateKey = s;
832
843
  return;
833
844
  }
834
845
  let c = 0, l = 0;
835
846
  if (o.forEach(({ count: e, id: t }) => {
836
- zt(t, i, n) ? c += e * 3 : l += e * 3;
847
+ Bt(t, i, n) ? c += e * 3 : l += e * 3;
837
848
  }), !c) {
838
- It(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
849
+ Lt(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
839
850
  return;
840
851
  }
841
852
  if (!l) {
842
- It(e, t), e.visibleStateKey = s;
853
+ Lt(e, t), e.visibleStateKey = s;
843
854
  return;
844
855
  }
845
- e.mesh.visible = Ft(e, t);
846
- let u = Mt(a, c), d = 0;
856
+ e.mesh.visible = It(e, t);
857
+ let u = Nt(a, c), d = 0;
847
858
  for (let e = 0; e < o.length; e++) {
848
859
  let { count: t, id: r, start: s } = o[e];
849
- if (!zt(r, i, n)) continue;
860
+ if (!Bt(r, i, n)) continue;
850
861
  let c = s * 3, l = c + t * 3;
851
862
  u.set(a.subarray(c, l), d), d += t * 3;
852
863
  }
853
- r || (e.originalBoundsTree = null), Pt(e, u), e.visibleStateKey = s;
864
+ r || (e.originalBoundsTree = null), Ft(e, u), e.visibleStateKey = s;
854
865
  }
855
- function W(e, t) {
866
+ function U(e, t) {
856
867
  return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
857
868
  }
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) => {
869
+ function Ut(e) {
870
+ 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) => {
860
871
  let t = Date.now(), n = o(), i = /* @__PURE__ */ new Set();
861
872
  e.forEach((e) => {
862
873
  let t = n.elementIndex.get(e);
863
874
  t && t.forEach(({ record: t }) => {
864
- Vt(t, e, i);
875
+ Ht(t, e, i);
865
876
  });
866
- }), i.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "hideByIds", t);
877
+ }), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "hideByIds", t);
867
878
  }, [
868
879
  o,
869
880
  a,
870
881
  r
871
882
  ]), u = i(() => {
872
883
  let e = Date.now(), i = o(), s = /* @__PURE__ */ new Set();
873
- Bt(t, (e, t) => {
884
+ Vt(t, (e, t) => {
874
885
  let n = i.elementIndex.get(t);
875
886
  n && n.forEach(({ record: n }) => {
876
- n.modelID === e && Vt(n, t, s);
887
+ n.modelID === e && Ht(n, t, s);
877
888
  });
878
- }), s.forEach((e) => U(e, i.ifcSpacesVisible, W(i, e), a)), n(), H(r, "hideSelected", e);
889
+ }), s.forEach((e) => H(e, i.ifcSpacesVisible, U(i, e), a)), n(), V(r, "hideSelected", e);
879
890
  }, [
880
891
  o,
881
892
  a,
@@ -889,24 +900,24 @@ function Ht(e) {
889
900
  t && t.forEach(({ record: t }) => {
890
901
  t.hiddenIds.delete(e) && i.add(t);
891
902
  });
892
- }), i.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "showByIds", t);
903
+ }), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "showByIds", t);
893
904
  }, [
894
905
  o,
895
906
  a,
896
907
  r
897
908
  ]), f = i((e) => {
898
909
  let t = Date.now(), n = o();
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);
910
+ n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateByIds", t);
900
911
  }, [
901
912
  o,
902
913
  a,
903
914
  r
904
915
  ]), p = i(() => {
905
916
  let e = Date.now(), n = o(), i = /* @__PURE__ */ new Map();
906
- Bt(t, (e, t) => {
917
+ Vt(t, (e, t) => {
907
918
  let n = i.get(e);
908
919
  n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
909
- }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "isolateSelected", e);
920
+ }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateSelected", e);
910
921
  }, [
911
922
  o,
912
923
  a,
@@ -914,7 +925,7 @@ function Ht(e) {
914
925
  r
915
926
  ]), m = i(() => {
916
927
  let e = Date.now(), t = o();
917
- t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => U(e, t.ifcSpacesVisible, W(t, e), a)), H(r, "resetIsolation", e);
928
+ t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => H(e, t.ifcSpacesVisible, U(t, e), a)), V(r, "resetIsolation", e);
918
929
  }, [
919
930
  o,
920
931
  a,
@@ -922,7 +933,7 @@ function Ht(e) {
922
933
  ]), h = i((e) => {
923
934
  let t = o();
924
935
  t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
925
- e.isIfcSpace && U(e, t.ifcSpacesVisible, W(t, e), a);
936
+ e.isIfcSpace && H(e, t.ifcSpacesVisible, U(t, e), a);
926
937
  }));
927
938
  }, [o, a]), g = i(() => {
928
939
  h(!c());
@@ -940,8 +951,8 @@ function Ht(e) {
940
951
  showAll: i(() => {
941
952
  let e = Date.now(), t = o();
942
953
  t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
943
- e.hiddenIds.clear(), U(e, t.ifcSpacesVisible, W(t, e), a);
944
- }), H(r, "showAll", e);
954
+ e.hiddenIds.clear(), H(e, t.ifcSpacesVisible, U(t, e), a);
955
+ }), V(r, "showAll", e);
945
956
  }, [
946
957
  o,
947
958
  a,
@@ -953,49 +964,49 @@ function Ht(e) {
953
964
  }
954
965
  //#endregion
955
966
  //#region src/viewer/utils/ClippingUtils/ClippingEdges.ts
956
- var Ut = 1024, Wt = -1e-5;
957
- function Gt(e) {
967
+ var Wt = 1024, Gt = -1e-5;
968
+ function Kt(e) {
958
969
  let t = new v(new Float32Array(e * 3), 3, !1);
959
970
  return t.setUsage(T), t;
960
971
  }
961
- function Kt(e) {
972
+ function qt(e) {
962
973
  return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
963
974
  }
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);
975
+ function Jt(e, t) {
976
+ let n = new y(), r = Math.ceil(Math.min(Math.max(Wt, qt(t) * .05), 32768));
977
+ n.setAttribute("position", Kt(r)), n.setDrawRange(0, 0);
978
+ let i = new k(n, e);
968
979
  return i.frustumCulled = !1, i.renderOrder = 1, i.visible = !1, i;
969
980
  }
970
- function Jt(e, t) {
981
+ function Yt(e, t) {
971
982
  let n = e.geometry.getAttribute("position");
972
983
  if (n.count > t) return n;
973
- let r = Gt(Math.max(n.count * 2, t + 1));
984
+ let r = Kt(Math.max(n.count * 2, t + 1));
974
985
  return r.array.set(n.array), e.geometry.setAttribute("position", r), n = r, n;
975
986
  }
976
- function Yt(e) {
987
+ function Xt(e) {
977
988
  return e.filter((e) => e.parent && e.geometry.index?.count);
978
989
  }
979
- var Xt = class {
990
+ var Zt = class {
980
991
  active;
981
992
  material;
982
993
  plane;
983
994
  context;
984
995
  lines = /* @__PURE__ */ new Map();
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();
996
+ inverseMatrix = new j();
997
+ localPlane = new ce();
998
+ tempLine = new te();
999
+ tempVector = new I();
1000
+ tempVector1 = new I();
1001
+ tempVector2 = new I();
1002
+ tempVector3 = new I();
992
1003
  constructor(e, t) {
993
1004
  this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
994
1005
  let n = e.material.clippingPlanes ?? [];
995
1006
  e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
996
1007
  });
997
1008
  let n = e.planes.filter((e) => e !== t);
998
- this.material = new k({
1009
+ this.material = new ne({
999
1010
  clippingPlanes: n,
1000
1011
  color: "black",
1001
1012
  depthTest: !0,
@@ -1006,12 +1017,12 @@ var Xt = class {
1006
1017
  return this.syncMeshes(), Array.from(this.lines.values());
1007
1018
  }
1008
1019
  syncMeshes() {
1009
- let e = new Set(Yt(this.context.getMeshes()));
1020
+ let e = new Set(Xt(this.context.getMeshes()));
1010
1021
  this.lines.forEach((t, n) => {
1011
1022
  e.has(n) || (t.removeFromParent(), t.geometry.dispose(), this.lines.delete(n));
1012
1023
  }), e.forEach((e) => {
1013
1024
  if (this.lines.has(e)) return;
1014
- let t = qt(this.material, e);
1025
+ let t = Jt(this.material, e);
1015
1026
  e.add(t), this.lines.set(e, t);
1016
1027
  }), this.setVisible(this.active);
1017
1028
  }
@@ -1037,7 +1048,7 @@ var Xt = class {
1037
1048
  }
1038
1049
  t.updateWorldMatrix(!0, !1), this.inverseMatrix.copy(t.matrixWorld).invert(), this.localPlane.copy(this.plane).applyMatrix4(this.inverseMatrix);
1039
1050
  let r = 0, i = e.geometry.getAttribute("position"), a = (t) => {
1040
- i = Jt(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1051
+ i = Yt(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1041
1052
  };
1042
1053
  n.shapecast({
1043
1054
  intersectsBounds: (e) => this.localPlane.intersectsBox(e),
@@ -1045,19 +1056,19 @@ var Xt = class {
1045
1056
  let t = 0;
1046
1057
  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
1058
  }
1048
- }), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Wt), i.needsUpdate = !0;
1059
+ }), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Gt), i.needsUpdate = !0;
1049
1060
  }));
1050
1061
  }
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) {
1062
+ }, Qt = "#0b2f5f", $t = "#0b2f5f", en = 0, tn = "#1f7ae0", nn = .22, rn = .01, an = .025, on = .015, sn = .25, cn = .15, ln = .25, W = 1;
1063
+ function un(e, t) {
1053
1064
  let n = t.getBoundingClientRect();
1054
- return new I((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1065
+ return new F((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1055
1066
  }
1056
- function un(e) {
1057
- let t = e.getSize(new L());
1058
- return Math.max(cn, t.length() * nn);
1067
+ function dn(e) {
1068
+ let t = e.getSize(new I());
1069
+ return Math.max(ln, t.length() * rn);
1059
1070
  }
1060
- var dn = class extends ie {
1071
+ var fn = class extends ae {
1061
1072
  helper = new D();
1062
1073
  borderMaterial;
1063
1074
  material;
@@ -1068,22 +1079,22 @@ var dn = class extends ie {
1068
1079
  location;
1069
1080
  normal;
1070
1081
  planeMesh;
1071
- pointer = new I();
1082
+ pointer = new F();
1072
1083
  layout;
1073
1084
  dragState = null;
1074
1085
  hovered = !1;
1075
1086
  listenersActive = !1;
1076
1087
  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 P({
1078
- color: Qt,
1088
+ super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new N({
1089
+ color: $t,
1079
1090
  depthWrite: !1,
1080
- opacity: $t,
1091
+ opacity: en,
1081
1092
  side: w,
1082
1093
  transparent: !0
1083
1094
  }), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
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,
1095
+ 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);
1096
+ this.borderMaterial = new O({
1097
+ color: Qt,
1087
1098
  dashSize: i,
1088
1099
  depthWrite: !1,
1089
1100
  gapSize: a
@@ -1114,7 +1125,7 @@ var dn = class extends ie {
1114
1125
  }
1115
1126
  updateBorderDash() {
1116
1127
  let e = Math.min(this.layout.width, this.layout.height);
1117
- this.borderMaterial.dashSize = Math.max(on, e * rn), this.borderMaterial.gapSize = Math.max(sn, e * an), this.borderMaterial.needsUpdate = !0;
1128
+ this.borderMaterial.dashSize = Math.max(sn, e * an), this.borderMaterial.gapSize = Math.max(cn, e * on), this.borderMaterial.needsUpdate = !0;
1118
1129
  }
1119
1130
  addEventListeners() {
1120
1131
  if (this.listenersActive) return;
@@ -1149,15 +1160,15 @@ var dn = class extends ie {
1149
1160
  hasModelIntersection(e) {
1150
1161
  return !!this.context.getCameraUtils().getIntersection(!0, {
1151
1162
  event: e,
1152
- filter: (e) => !(e.object instanceof N) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1163
+ filter: (e) => !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1153
1164
  object: this.context.getMeshes(),
1154
1165
  recursive: !1
1155
1166
  });
1156
1167
  }
1157
1168
  getPointerPointOnPlane(e, t) {
1158
1169
  let n = this.context.getDomElement();
1159
- this.pointer.copy(ln(e, n));
1160
- let r = this.context.getRaycaster(), i = new L();
1170
+ this.pointer.copy(un(e, n));
1171
+ let r = this.context.getRaycaster(), i = new I();
1161
1172
  return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
1162
1173
  }
1163
1174
  onPointerDown = (e) => {
@@ -1169,9 +1180,9 @@ var dn = class extends ie {
1169
1180
  let t = this.getPointerIntersection(e);
1170
1181
  if (!t) return;
1171
1182
  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 L();
1183
+ let n = new I();
1173
1184
  this.context.getCamera().getWorldDirection(n), n.normalize();
1174
- let r = new se().setFromNormalAndCoplanarPoint(n, t.point);
1185
+ let r = new ce().setFromNormalAndCoplanarPoint(n, t.point);
1175
1186
  this.dragState = {
1176
1187
  dragPlane: r,
1177
1188
  helperStart: this.helper.position.clone(),
@@ -1213,14 +1224,14 @@ var dn = class extends ie {
1213
1224
  this.hovered !== t && this.setHovered(t);
1214
1225
  }
1215
1226
  setHovered(e) {
1216
- this.hovered = e, this.material.color.set(e ? en : Qt), this.material.opacity = e ? tn : $t, this.material.needsUpdate = !0;
1227
+ this.hovered = e, this.material.color.set(e ? tn : $t), this.material.opacity = e ? nn : en, this.material.needsUpdate = !0;
1217
1228
  }
1218
1229
  createPlaneMesh() {
1219
- let e = new N(new y(), this.material);
1230
+ let e = new M(new y(), this.material);
1220
1231
  return e.renderOrder = 2, e;
1221
1232
  }
1222
1233
  createBorder() {
1223
- let e = new te(new y(), this.borderMaterial);
1234
+ let e = new k(new y(), this.borderMaterial);
1224
1235
  return e.renderOrder = 3, e;
1225
1236
  }
1226
1237
  replaceGeometry(e, t) {
@@ -1289,27 +1300,27 @@ var dn = class extends ie {
1289
1300
  getHelperLayout() {
1290
1301
  let e = this.getModelWorldBox();
1291
1302
  if (!e || e.isEmpty()) return {
1292
- height: G,
1293
- maxU: G / 2,
1294
- maxV: G / 2,
1295
- minU: -G / 2,
1296
- minV: -G / 2,
1297
- width: G
1303
+ height: W,
1304
+ maxU: W / 2,
1305
+ maxV: W / 2,
1306
+ minU: -W / 2,
1307
+ minV: -W / 2,
1308
+ width: W
1298
1309
  };
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;
1310
+ 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;
1300
1311
  if (r.forEach((e) => {
1301
1312
  this.plane.projectPoint(e, i), a.copy(i).sub(n);
1302
1313
  let r = a.dot(t.u), u = a.dot(t.v);
1303
1314
  o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
1304
1315
  }), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
1305
- height: G,
1306
- maxU: G / 2,
1307
- maxV: G / 2,
1308
- minU: -G / 2,
1309
- minV: -G / 2,
1310
- width: G
1316
+ height: W,
1317
+ maxU: W / 2,
1318
+ maxV: W / 2,
1319
+ minU: -W / 2,
1320
+ minV: -W / 2,
1321
+ width: W
1311
1322
  };
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;
1323
+ 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;
1313
1324
  return {
1314
1325
  height: g,
1315
1326
  maxU: _ + h / 2,
@@ -1320,14 +1331,14 @@ var dn = class extends ie {
1320
1331
  };
1321
1332
  }
1322
1333
  getPlaneBasis() {
1323
- let e = (Math.abs(this.normal.y) < .9 ? new L(0, 1, 0) : new L(1, 0, 0)).cross(this.normal).normalize();
1334
+ let e = (Math.abs(this.normal.y) < .9 ? new I(0, 1, 0) : new I(1, 0, 0)).cross(this.normal).normalize();
1324
1335
  return {
1325
1336
  u: e,
1326
1337
  v: this.normal.clone().cross(e).normalize()
1327
1338
  };
1328
1339
  }
1329
1340
  applyPlaneOrientation() {
1330
- let e = this.getPlaneBasis(), t = new M().makeBasis(e.u, e.v, this.normal);
1341
+ let e = this.getPlaneBasis(), t = new j().makeBasis(e.u, e.v, this.normal);
1331
1342
  this.helper.quaternion.setFromRotationMatrix(t);
1332
1343
  }
1333
1344
  getModelWorldBox() {
@@ -1340,20 +1351,20 @@ var dn = class extends ie {
1340
1351
  }
1341
1352
  getBoxCorners(e) {
1342
1353
  return [
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)
1354
+ new I(e.min.x, e.min.y, e.min.z),
1355
+ new I(e.min.x, e.min.y, e.max.z),
1356
+ new I(e.min.x, e.max.y, e.min.z),
1357
+ new I(e.min.x, e.max.y, e.max.z),
1358
+ new I(e.max.x, e.min.y, e.min.z),
1359
+ new I(e.max.x, e.min.y, e.max.z),
1360
+ new I(e.max.x, e.max.y, e.min.z),
1361
+ new I(e.max.x, e.max.y, e.max.z)
1351
1362
  ];
1352
1363
  }
1353
1364
  };
1354
1365
  //#endregion
1355
1366
  //#region src/viewer/utils/ClippingUtils/ClippingUtils.ts
1356
- function fn(e, t) {
1367
+ function pn(e, t) {
1357
1368
  if (Array.isArray(e)) {
1358
1369
  e.forEach((e) => {
1359
1370
  e.clippingPlanes = t, e.needsUpdate = !0;
@@ -1362,13 +1373,13 @@ function fn(e, t) {
1362
1373
  }
1363
1374
  e.clippingPlanes = t, e.needsUpdate = !0;
1364
1375
  }
1365
- function pn(e) {
1376
+ function mn(e) {
1366
1377
  let t = [];
1367
1378
  return e?.traverse((e) => {
1368
- e instanceof N && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1379
+ e instanceof M && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1369
1380
  }), t;
1370
1381
  }
1371
- function mn(e) {
1382
+ function hn(e) {
1372
1383
  let t = e;
1373
1384
  for (; t;) {
1374
1385
  let e = t.userData.modelID;
@@ -1377,10 +1388,10 @@ function mn(e) {
1377
1388
  }
1378
1389
  return 0;
1379
1390
  }
1380
- function hn(e, t) {
1391
+ function gn(e, t) {
1381
1392
  return t.clone().transformDirection(e.matrixWorld).normalize();
1382
1393
  }
1383
- var gn = class {
1394
+ var _n = class {
1384
1395
  planes = [];
1385
1396
  edges = [];
1386
1397
  helpers = [];
@@ -1429,7 +1440,7 @@ var gn = class {
1429
1440
  return this.context.controlRef;
1430
1441
  }
1431
1442
  getMeshes() {
1432
- return pn(this.context.modelRef.current);
1443
+ return mn(this.context.modelRef.current);
1433
1444
  }
1434
1445
  getHelperHoverIsMoving() {
1435
1446
  return this.helperHoverMoveState !== "end" && this.helperHoverMoveState !== "start";
@@ -1463,9 +1474,9 @@ var gn = class {
1463
1474
  }), e.isEmpty() ? null : e;
1464
1475
  }
1465
1476
  getSelectedWorldBox() {
1466
- let e = this.context.viewerStore.getState().selected, t = new g(), n = new L();
1477
+ let e = this.context.viewerStore.getState().selected, t = new g(), n = new I();
1467
1478
  return this.getMeshes().forEach((r) => {
1468
- let i = e[mn(r)];
1479
+ let i = e[hn(r)];
1469
1480
  if (!i?.size) return;
1470
1481
  let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
1471
1482
  if (!a || !o) return;
@@ -1484,7 +1495,7 @@ var gn = class {
1484
1495
  updateMaterials() {
1485
1496
  let e = this.active ? this.planes : [];
1486
1497
  this.getMeshes().forEach((t) => {
1487
- fn(t.material, e);
1498
+ pn(t.material, e);
1488
1499
  }), this.context.camera.updateMatrixWorld();
1489
1500
  }
1490
1501
  setActive(e) {
@@ -1503,42 +1514,42 @@ var gn = class {
1503
1514
  recursive: !1
1504
1515
  });
1505
1516
  if (!n?.face) return null;
1506
- let r = n.point.clone(), i = hn(n.object, n.face.normal);
1517
+ let r = n.point.clone(), i = gn(n.object, n.face.normal);
1507
1518
  r.add(i.clone().multiplyScalar(.001));
1508
- let a = new se().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1519
+ let a = new ce().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1509
1520
  return this.addPlane(a, r, i), a.clone();
1510
1521
  }
1511
1522
  createClippingRectangle(e = !1) {
1512
1523
  let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
1513
1524
  if (!t) return [];
1514
- let n = un(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new L()), o = [
1525
+ let n = dn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new I()), o = [
1515
1526
  {
1516
- normal: new L(1, 0, 0),
1517
- point: new L(r.x, a.y, a.z)
1527
+ normal: new I(1, 0, 0),
1528
+ point: new I(r.x, a.y, a.z)
1518
1529
  },
1519
1530
  {
1520
- normal: new L(-1, 0, 0),
1521
- point: new L(i.x, a.y, a.z)
1531
+ normal: new I(-1, 0, 0),
1532
+ point: new I(i.x, a.y, a.z)
1522
1533
  },
1523
1534
  {
1524
- normal: new L(0, 1, 0),
1525
- point: new L(a.x, r.y, a.z)
1535
+ normal: new I(0, 1, 0),
1536
+ point: new I(a.x, r.y, a.z)
1526
1537
  },
1527
1538
  {
1528
- normal: new L(0, -1, 0),
1529
- point: new L(a.x, i.y, a.z)
1539
+ normal: new I(0, -1, 0),
1540
+ point: new I(a.x, i.y, a.z)
1530
1541
  },
1531
1542
  {
1532
- normal: new L(0, 0, 1),
1533
- point: new L(a.x, a.y, r.z)
1543
+ normal: new I(0, 0, 1),
1544
+ point: new I(a.x, a.y, r.z)
1534
1545
  },
1535
1546
  {
1536
- normal: new L(0, 0, -1),
1537
- point: new L(a.x, a.y, i.z)
1547
+ normal: new I(0, 0, -1),
1548
+ point: new I(a.x, a.y, i.z)
1538
1549
  }
1539
1550
  ].map(({ normal: e, point: t }) => ({
1540
1551
  normal: e,
1541
- plane: new se().setFromNormalAndCoplanarPoint(e, t),
1552
+ plane: new ce().setFromNormalAndCoplanarPoint(e, t),
1542
1553
  point: t
1543
1554
  }));
1544
1555
  return o.forEach(({ normal: e, plane: t, point: n }) => {
@@ -1546,8 +1557,8 @@ var gn = class {
1546
1557
  }), this.updateHelpers(), o.map(({ plane: e }) => e.clone());
1547
1558
  }
1548
1559
  addPlane(e, t, n) {
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);
1560
+ if (this.active || this.setActive(!0), this.planes.push(e), new fn(this, e, t, n), this.updateHelpers(), this.updateMaterials(), this.edgesActive) {
1561
+ let t = new Zt(this, e);
1551
1562
  t.create(), t.update();
1552
1563
  }
1553
1564
  }
@@ -1559,7 +1570,7 @@ var gn = class {
1559
1570
  }
1560
1571
  setEdgesActive(e) {
1561
1572
  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 Xt(this, e);
1573
+ let t = new Zt(this, e);
1563
1574
  t.create(), t.update();
1564
1575
  })), this.edges.forEach((t) => t.setVisible(this.active && e)));
1565
1576
  }
@@ -1586,8 +1597,8 @@ var gn = class {
1586
1597
  this.deleteAllPlanes();
1587
1598
  }
1588
1599
  };
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({
1600
+ function vn(e, t, n) {
1601
+ 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({
1591
1602
  camera: r,
1592
1603
  cameraUtils: n,
1593
1604
  controlRef: t,
@@ -1657,28 +1668,28 @@ function _n(e, t, n) {
1657
1668
  }
1658
1669
  //#endregion
1659
1670
  //#region src/viewer/utils/DimentionsUtils/DimentionLine.ts
1660
- var vn = 12, yn = 6, bn = 4;
1661
- function xn() {
1671
+ var yn = 12, bn = 6, xn = 4;
1672
+ function Sn() {
1662
1673
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
1663
1674
  }
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);
1675
+ function Cn(e, t) {
1676
+ 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);
1666
1677
  }
1667
- function Cn(e) {
1668
- let t = xn(), n = document.createElement("canvas"), r = n.getContext("2d");
1678
+ function wn(e) {
1679
+ let t = Sn(), n = document.createElement("canvas"), r = n.getContext("2d");
1669
1680
  if (!r) throw Error("Could not create dimension label canvas context");
1670
- let i = `600 ${vn}px system-ui, "Segoe UI", sans-serif`;
1681
+ let i = `600 ${yn}px system-ui, "Segoe UI", sans-serif`;
1671
1682
  r.font = i;
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));
1683
+ 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));
1673
1684
  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
1685
  let u = new b(n);
1675
- return u.colorSpace = le, u.generateMipmaps = !1, u.magFilter = j, u.minFilter = j, u.needsUpdate = !0, {
1686
+ return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
1676
1687
  height: l,
1677
1688
  texture: u,
1678
1689
  width: c
1679
1690
  };
1680
1691
  }
1681
- var wn = class e {
1692
+ var Tn = class e {
1682
1693
  static scale = 1;
1683
1694
  static scaleFactor = .015;
1684
1695
  static units = "m";
@@ -1750,11 +1761,11 @@ var wn = class e {
1750
1761
  this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
1751
1762
  }
1752
1763
  addEndpointMesh(e, t) {
1753
- let n = new N(this.endpointGeometry, this.endpointMaterial);
1764
+ let n = new M(this.endpointGeometry, this.endpointMaterial);
1754
1765
  n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
1755
1766
  }
1756
1767
  createLabelSprite() {
1757
- let e = new fe(new pe({
1768
+ let e = new pe(new me({
1758
1769
  depthTest: !1,
1759
1770
  depthWrite: !1,
1760
1771
  transparent: !0
@@ -1762,7 +1773,7 @@ var wn = class e {
1762
1773
  return e.renderOrder = 5, e;
1763
1774
  }
1764
1775
  createBoundingBoxMesh() {
1765
- let e = new N(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1776
+ let e = new M(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1766
1777
  return e.renderOrder = 3, e;
1767
1778
  }
1768
1779
  getTextContent() {
@@ -1773,7 +1784,7 @@ var wn = class e {
1773
1784
  let e = this.getTextContent();
1774
1785
  if (this.labelText === e) return;
1775
1786
  this.labelText = e, this.labelTexture?.dispose();
1776
- let t = Cn(e);
1787
+ let t = wn(e);
1777
1788
  this.labelHeight = t.height, this.labelTexture = t.texture, this.labelWidth = t.width, this.labelSprite.material.map = t.texture, this.labelSprite.material.needsUpdate = !0;
1778
1789
  }
1779
1790
  updatePositions() {
@@ -1784,37 +1795,37 @@ var wn = class e {
1784
1795
  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
1796
  }
1786
1797
  rescaleMesh(t, n, r) {
1787
- let i = Sn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1798
+ let i = Cn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1788
1799
  t.scale.setScalar(i);
1789
1800
  }
1790
1801
  rescaleBoundingMesh(e, t) {
1791
1802
  if (!this.boundingMesh) return;
1792
- let n = Sn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1803
+ let n = Cn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1793
1804
  this.boundingMesh.scale.set(n, n, 1);
1794
1805
  }
1795
1806
  rescaleLabel(e, t) {
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);
1807
+ let n = Cn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
1797
1808
  this.labelSprite.scale.set(i, r, 1);
1798
1809
  }
1799
- }, Tn = "#111827", En = 1, Dn = "x";
1800
- function On(e) {
1810
+ }, En = "#111827", Dn = 1, On = "x";
1811
+ function kn(e) {
1801
1812
  let t = [];
1802
1813
  return e?.traverse((e) => {
1803
- e instanceof N && e.geometry.attributes.position && t.push(e);
1814
+ e instanceof M && e.geometry.attributes.position && t.push(e);
1804
1815
  }), t;
1805
1816
  }
1806
- function kn(e, t, n) {
1817
+ function An(e, t, n) {
1807
1818
  let r = e.clone();
1808
1819
  return r[n] = t[n], r;
1809
1820
  }
1810
- function An(e, t) {
1821
+ function jn(e, t) {
1811
1822
  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
1823
  return a === n ? "x" : a === r ? "y" : "z";
1813
1824
  }
1814
- var jn = class e {
1825
+ var Mn = class e {
1815
1826
  active = !1;
1816
1827
  axis = null;
1817
- boundingMaterial = new P({
1828
+ boundingMaterial = new N({
1818
1829
  color: 0,
1819
1830
  depthTest: !1,
1820
1831
  depthWrite: !1,
@@ -1825,14 +1836,14 @@ var jn = class e {
1825
1836
  currentDimension = null;
1826
1837
  dimensions = [];
1827
1838
  endpointGeometry = e.createEndpointGeometry();
1828
- endpointMaterial = new P({
1829
- color: Tn,
1839
+ endpointMaterial = new N({
1840
+ color: En,
1830
1841
  depthTest: !1,
1831
1842
  depthWrite: !1
1832
1843
  });
1833
- endpointScale = new L(1, 1, 1);
1834
- lineMaterial = new A({
1835
- color: Tn,
1844
+ endpointScale = new I(1, 1, 1);
1845
+ lineMaterial = new O({
1846
+ color: En,
1836
1847
  dashSize: .2,
1837
1848
  depthTest: !1,
1838
1849
  depthWrite: !1,
@@ -1840,14 +1851,14 @@ var jn = class e {
1840
1851
  });
1841
1852
  measureInProcess = !1;
1842
1853
  moveState = "end";
1843
- previewMarker = new N(e.createPreviewGeometry(), new P({
1854
+ previewMarker = new M(e.createPreviewGeometry(), new N({
1844
1855
  color: 0,
1845
1856
  depthTest: !1,
1846
1857
  depthWrite: !1
1847
1858
  }));
1848
1859
  root = new D();
1849
- snapDistance = En;
1850
- startPoint = new L();
1860
+ snapDistance = Dn;
1861
+ startPoint = new I();
1851
1862
  unit = "m";
1852
1863
  constructor(e) {
1853
1864
  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 +1891,13 @@ var jn = class e {
1880
1891
  });
1881
1892
  }
1882
1893
  setEndpointScaleFactor(e) {
1883
- !Number.isFinite(e) || e <= 0 || (wn.scaleFactor = e);
1894
+ !Number.isFinite(e) || e <= 0 || (Tn.scaleFactor = e);
1884
1895
  }
1885
1896
  setSnapDistance(e) {
1886
1897
  !Number.isFinite(e) || e < 0 || (this.snapDistance = e);
1887
1898
  }
1888
1899
  setUnit(e) {
1889
- this.unit = e, wn.units = e, wn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1900
+ this.unit = e, Tn.units = e, Tn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1890
1901
  e.endPoint = e.end;
1891
1902
  }), this.currentDimension && (this.currentDimension.endPoint = this.currentDimension.end);
1892
1903
  }
@@ -1912,7 +1923,7 @@ var jn = class e {
1912
1923
  changeAxes() {
1913
1924
  if (!this.measureInProcess || !this.currentDimension) return;
1914
1925
  let e = this.currentDimension.end, t = this.getNextAxis();
1915
- this.axis = t, this.currentDimension.endPoint = kn(this.startPoint, e, t);
1926
+ this.axis = t, this.currentDimension.endPoint = An(this.startPoint, e, t);
1916
1927
  }
1917
1928
  updateFrame() {
1918
1929
  if (!this.active) return;
@@ -1956,7 +1967,7 @@ var jn = class e {
1956
1967
  this.currentDimension && (this.currentDimension.createBoundingBox(), this.dimensions.push(this.currentDimension), this.currentDimension = null, this.measureInProcess = !1, this.axis = null);
1957
1968
  }
1958
1969
  createDimension(e, t) {
1959
- return new wn({
1970
+ return new Tn({
1960
1971
  boundingMaterial: this.boundingMaterial,
1961
1972
  endpointGeometry: this.endpointGeometry,
1962
1973
  endpointMaterial: this.endpointMaterial,
@@ -1968,7 +1979,7 @@ var jn = class e {
1968
1979
  });
1969
1980
  }
1970
1981
  getModelHit(e) {
1971
- let t = On(this.context.modelRef.current);
1982
+ let t = kn(this.context.modelRef.current);
1972
1983
  return t.length ? this.context.cameraUtils.getIntersection(!0, {
1973
1984
  event: e,
1974
1985
  filter: (e) => !!e.face,
@@ -1980,7 +1991,7 @@ var jn = class e {
1980
1991
  return this.dimensions.map((e) => e.boundingBox).filter((e) => !!e);
1981
1992
  }
1982
1993
  getClosestVertex(e) {
1983
- if (!(e.object instanceof N) || !e.face) return e.point.clone();
1994
+ if (!(e.object instanceof M) || !e.face) return e.point.clone();
1984
1995
  let t = e.object.geometry.attributes.position;
1985
1996
  if (!t) return e.point.clone();
1986
1997
  let n = [
@@ -1988,29 +1999,29 @@ var jn = class e {
1988
1999
  e.face.b,
1989
2000
  e.face.c
1990
2001
  ].map((n) => {
1991
- let r = new L(t.getX(n), t.getY(n), t.getZ(n));
2002
+ let r = new I(t.getX(n), t.getY(n), t.getZ(n));
1992
2003
  return e.object.localToWorld(r);
1993
2004
  }).filter((t) => t.distanceTo(e.point) <= this.snapDistance);
1994
2005
  return n.length ? n.reduce((t, n) => n.distanceTo(e.point) < t.distanceTo(e.point) ? n : t) : e.point.clone();
1995
2006
  }
1996
2007
  getPreviewEndPoint(e, t) {
1997
2008
  if (!t) return this.axis = null, e.clone();
1998
- let n = this.axis ?? An(this.startPoint, e);
1999
- return this.axis = n, kn(this.startPoint, e, n);
2009
+ let n = this.axis ?? jn(this.startPoint, e);
2010
+ return this.axis = n, An(this.startPoint, e, n);
2000
2011
  }
2001
2012
  getNextAxis() {
2002
2013
  switch (this.axis) {
2003
2014
  case "x": return "y";
2004
2015
  case "y": return "z";
2005
2016
  case "z": return "x";
2006
- default: return Dn;
2017
+ default: return On;
2007
2018
  }
2008
2019
  }
2009
2020
  getIsMoving() {
2010
2021
  return this.moveState !== "end" && this.moveState !== "start";
2011
2022
  }
2012
2023
  rescalePreviewMarker() {
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;
2024
+ 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;
2014
2025
  this.previewMarker.scale.setScalar(r);
2015
2026
  }
2016
2027
  setSelectionInteractionDisabled(e) {
@@ -2047,11 +2058,11 @@ var jn = class e {
2047
2058
  return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
2048
2059
  }
2049
2060
  static createPreviewGeometry() {
2050
- return new de(.5, 16, 12);
2061
+ return new fe(.5, 16, 12);
2051
2062
  }
2052
2063
  };
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({
2064
+ function Nn(e, t, n) {
2065
+ 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({
2055
2066
  camera: r,
2056
2067
  cameraUtils: n,
2057
2068
  controlRef: t,
@@ -2113,15 +2124,15 @@ function Mn(e, t, n) {
2113
2124
  }
2114
2125
  //#endregion
2115
2126
  //#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
2116
- function Nn(e) {
2127
+ function Pn(e) {
2117
2128
  return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
2118
2129
  }
2119
- function Pn() {
2120
- let e = B((e) => e.api), t = B((e) => e.defaultHotkeysEnabled);
2130
+ function Fn() {
2131
+ let e = z((e) => e.api), t = z((e) => e.defaultHotkeysEnabled);
2121
2132
  o(() => {
2122
2133
  if (!t) return;
2123
2134
  let n = (t) => {
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());
2135
+ 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());
2125
2136
  };
2126
2137
  return window.addEventListener("keydown", n), () => {
2127
2138
  window.removeEventListener("keydown", n);
@@ -2130,15 +2141,15 @@ function Pn() {
2130
2141
  }
2131
2142
  //#endregion
2132
2143
  //#region src/viewer/Camera/useCameraUtils.ts
2133
- var Fn = 1e-6;
2134
- function In(e, t) {
2144
+ var In = 1e-6;
2145
+ function Ln(e, t) {
2135
2146
  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 I((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
2147
+ 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);
2137
2148
  }
2138
- function Ln(e, t) {
2139
- return t.every((t) => t.distanceToPoint(e) >= -Fn);
2149
+ function Rn(e, t) {
2150
+ return t.every((t) => t.distanceToPoint(e) >= -In);
2140
2151
  }
2141
- function Rn(e) {
2152
+ function zn(e) {
2142
2153
  let t = e;
2143
2154
  for (; t;) {
2144
2155
  if (!t.visible) return !1;
@@ -2146,8 +2157,8 @@ function Rn(e) {
2146
2157
  }
2147
2158
  return !0;
2148
2159
  }
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) => {
2160
+ function Bn(e) {
2161
+ 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) => {
2151
2162
  a.current = e;
2152
2163
  }, []), f = i(() => {
2153
2164
  let e = a.current;
@@ -2155,7 +2166,7 @@ function zn(e) {
2155
2166
  }, []);
2156
2167
  o(() => {
2157
2168
  let e = n.domElement, t = (t) => {
2158
- let n = In(t, e);
2169
+ let n = Ln(t, e);
2159
2170
  n && (s.current = n);
2160
2171
  }, r = () => {
2161
2172
  s.current = null;
@@ -2165,11 +2176,11 @@ function zn(e) {
2165
2176
  };
2166
2177
  }, [n]);
2167
2178
  let m = i((i = !1, { event: a, filter: o, object: c = e.current, recursive: l = !0, respectClipping: d = !0 } = {}) => {
2168
- let p = a ? In(a, n.domElement) : s.current;
2179
+ let p = a ? Ln(a, n.domElement) : s.current;
2169
2180
  if (!p || !c) return i ? null : [];
2170
2181
  let m = d ? f() : [], h = Array.isArray(c) ? c : [c];
2171
2182
  t.updateMatrixWorld(), e.current?.updateMatrixWorld(!0), u.current.copy(p), r.setFromCamera(u.current, t);
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);
2183
+ 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);
2173
2184
  return i ? g[0] ?? null : g;
2174
2185
  }, [
2175
2186
  t,
@@ -2190,8 +2201,8 @@ function zn(e) {
2190
2201
  }
2191
2202
  //#endregion
2192
2203
  //#region src/viewer/Selector/SelectionBox.ts
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) {
2204
+ 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();
2205
+ function Xn(e) {
2195
2206
  let t = e;
2196
2207
  for (; t;) {
2197
2208
  let e = t.modelID ?? t.userData.modelID;
@@ -2200,7 +2211,7 @@ function Yn(e) {
2200
2211
  }
2201
2212
  return 0;
2202
2213
  }
2203
- function Xn(e) {
2214
+ function Zn(e) {
2204
2215
  let t = e;
2205
2216
  for (; t;) {
2206
2217
  if (!t.visible) return !1;
@@ -2208,16 +2219,16 @@ function Xn(e) {
2208
2219
  }
2209
2220
  return !0;
2210
2221
  }
2211
- function Zn(e, t, n) {
2212
- return n.length ? (Hn.copy(t).applyMatrix4(e.matrixWorld), Ln(Hn, n)) : !0;
2222
+ function Qn(e, t, n) {
2223
+ return n.length ? (Un.copy(t).applyMatrix4(e.matrixWorld), Rn(Un, n)) : !0;
2213
2224
  }
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);
2225
+ function $n(e, t, n, r, i) {
2226
+ return i.length ? (Wn.copy(t).applyMatrix4(e.matrixWorld), Gn.copy(n).applyMatrix4(e.matrixWorld), Kn.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2227
+ let t = e.distanceToPoint(Wn), n = e.distanceToPoint(Gn), r = e.distanceToPoint(Kn);
2217
2228
  return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
2218
2229
  })) : !0;
2219
2230
  }
2220
- function $n(e) {
2231
+ function er(e) {
2221
2232
  let t = e.getBoundingClientRect();
2222
2233
  return {
2223
2234
  height: t.height,
@@ -2226,7 +2237,7 @@ function $n(e) {
2226
2237
  width: t.width
2227
2238
  };
2228
2239
  }
2229
- function er(e) {
2240
+ function tr(e) {
2230
2241
  return {
2231
2242
  boundsCheckMs: 0,
2232
2243
  candidateIds: 0,
@@ -2252,7 +2263,7 @@ function er(e) {
2252
2263
  triangleProjectionMs: 0
2253
2264
  };
2254
2265
  }
2255
- function tr(e, t) {
2266
+ function nr(e, t) {
2256
2267
  return {
2257
2268
  minX: Math.min(e.x, t.x),
2258
2269
  minY: Math.min(e.y, t.y),
@@ -2260,43 +2271,43 @@ function tr(e, t) {
2260
2271
  maxY: Math.max(e.y, t.y)
2261
2272
  };
2262
2273
  }
2263
- function nr(e, t) {
2274
+ function rr(e, t) {
2264
2275
  return t.x >= e.x ? "contains" : "intersects";
2265
2276
  }
2266
- function rr(e, t) {
2267
- return ir(e.x, e.y, t);
2277
+ function ir(e, t) {
2278
+ return ar(e.x, e.y, t);
2268
2279
  }
2269
- function ir(e, t, n) {
2280
+ function ar(e, t, n) {
2270
2281
  return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
2271
2282
  }
2272
- function ar(e, t, n, r, i, a) {
2283
+ function or(e, t, n, r, i, a) {
2273
2284
  return (a - t) * (n - e) > (r - t) * (i - e);
2274
2285
  }
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);
2286
+ function sr(e, t, n, r, i, a, o, s) {
2287
+ 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);
2277
2288
  }
2278
- function sr(e, t, n, r, i) {
2289
+ function cr(e, t, n, r, i) {
2279
2290
  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
2291
  return s >= 0 && c >= 0 && s + c <= 2 * a * o;
2281
2292
  }
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);
2293
+ function lr(e, t, n, r) {
2294
+ 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);
2284
2295
  }
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);
2296
+ function ur(e, t, n) {
2297
+ 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);
2287
2298
  }
2288
- function ur(e, t, n, r, i = new I()) {
2289
- let a = Bn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2299
+ function dr(e, t, n, r, i = new F()) {
2300
+ let a = Vn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2290
2301
  return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
2291
2302
  }
2292
- function dr(e, t, n, r, i) {
2303
+ function fr(e, t, n, r, i) {
2293
2304
  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++) 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;
2305
+ 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);
2306
+ return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? xe : l === 8 ? ve : ye;
2296
2307
  }
2297
- function fr(e, t, n, r) {
2308
+ function pr(e, t, n, r) {
2298
2309
  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++) 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);
2310
+ 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);
2300
2311
  return {
2301
2312
  minX: i,
2302
2313
  minY: o,
@@ -2304,41 +2315,41 @@ function fr(e, t, n, r) {
2304
2315
  maxY: s
2305
2316
  };
2306
2317
  }
2307
- function pr(e, t) {
2318
+ function mr(e, t) {
2308
2319
  return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
2309
2320
  }
2310
- function mr(e, t, n, r) {
2321
+ function hr(e, t, n, r) {
2311
2322
  e.geometry.boundingBox || e.geometry.computeBoundingBox();
2312
2323
  let i = e.geometry.boundingBox;
2313
- return i ? pr(fr(e, i, n, r), t) : !0;
2324
+ return i ? mr(pr(e, i, n, r), t) : !0;
2314
2325
  }
2315
- function hr(e, t, n) {
2326
+ function gr(e, t, n) {
2316
2327
  let r = e.get(t);
2317
2328
  r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
2318
2329
  }
2319
- function gr(e) {
2330
+ function _r(e) {
2320
2331
  let t = 0;
2321
2332
  return e.forEach((e) => {
2322
2333
  t += e.size;
2323
2334
  }), t;
2324
2335
  }
2325
- function _r(e, t, n, r = []) {
2336
+ function vr(e, t, n, r = []) {
2326
2337
  let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
2327
2338
  if (!a || !o || !s) return;
2328
2339
  let c = t * 3;
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)));
2340
+ 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)));
2330
2341
  }
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();
2342
+ function yr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2343
+ let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new I();
2333
2344
  e.traverse((e) => {
2334
2345
  let s = e;
2335
- if (!s.isMesh || !Xn(s)) return;
2346
+ if (!s.isMesh || !Zn(s)) return;
2336
2347
  let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
2337
2348
  if (!(!u || !d)) {
2338
2349
  o && (o.containedVerticesVisited += u.count);
2339
2350
  for (let e = 0; e < u.count; e++) {
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;
2351
+ let f = Xn(s), p = u.getX(e);
2352
+ if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Qn(s, l, a))) continue;
2342
2353
  o && (o.containedCandidateVertices += 1);
2343
2354
  let m = `${f}:${p}`, h = c.get(m);
2344
2355
  h || (h = {
@@ -2346,23 +2357,23 @@ function vr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
2346
2357
  inside: 0,
2347
2358
  modelID: f,
2348
2359
  total: 0
2349
- }, c.set(m, h)), h.total += 1, rr(ur(s, l, t, n), r) && (h.inside += 1);
2360
+ }, c.set(m, h)), h.total += 1, ir(dr(s, l, t, n), r) && (h.inside += 1);
2350
2361
  }
2351
2362
  }
2352
2363
  });
2353
2364
  let u = /* @__PURE__ */ new Map();
2354
2365
  return c.forEach((e) => {
2355
- e.total > 0 && e.total === e.inside && hr(u, e.modelID, e.id);
2366
+ e.total > 0 && e.total === e.inside && gr(u, e.modelID, e.id);
2356
2367
  }), o && (o.containedIdsMs += performance.now() - s), u;
2357
2368
  }
2358
- function yr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2369
+ function br({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2359
2370
  let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2360
2371
  if (!e) return c;
2361
- let u = $n(r), d = performance.now();
2372
+ let u = er(r), d = performance.now();
2362
2373
  e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
2363
2374
  let r = e;
2364
2375
  if (!r.isMesh) return;
2365
- if (o && (o.meshCount += 1), !Xn(r)) {
2376
+ if (o && (o.meshCount += 1), !Zn(r)) {
2366
2377
  o && (o.skippedMeshCount += 1);
2367
2378
  return;
2368
2379
  }
@@ -2371,7 +2382,7 @@ function yr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2371
2382
  o && (o.skippedMeshCount += 1);
2372
2383
  return;
2373
2384
  }
2374
- let d = performance.now(), f = mr(r, i, t, u);
2385
+ let d = performance.now(), f = hr(r, i, t, u);
2375
2386
  if (o && (o.boundsCheckMs += performance.now() - d), !f) {
2376
2387
  o && (o.skippedMeshCount += 1);
2377
2388
  return;
@@ -2379,26 +2390,26 @@ function yr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2379
2390
  let p = performance.now();
2380
2391
  s.shapecast({
2381
2392
  intersectsBounds: (e) => {
2382
- let n = performance.now(), a = dr(r, e, i, t, u);
2393
+ let n = performance.now(), a = fr(r, e, i, t, u);
2383
2394
  return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
2384
2395
  },
2385
2396
  intersectsRange: (e, t, i) => {
2386
2397
  let u = performance.now();
2387
2398
  if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
2388
- for (let i = e; i < e + t; i++) _r(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2399
+ for (let i = e; i < e + t; i++) vr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2389
2400
  return o && (o.intersectsRangeMs += performance.now() - u), !1;
2390
2401
  },
2391
2402
  intersectsTriangle: (e, s, d) => {
2392
2403
  let f = performance.now();
2393
2404
  if (o && (o.intersectsTriangleCalls += 1), !d) {
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;
2405
+ 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);
2406
+ if (o && (o.triangleProjectionMs += performance.now() - n), !lr(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2396
2407
  }
2397
- return a === "contains" ? _r(r, s, l, n) : _r(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2408
+ return a === "contains" ? vr(r, s, l, n) : vr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2398
2409
  }
2399
2410
  }), o && (o.shapecastMs += performance.now() - p);
2400
2411
  });
2401
- let f = a === "contains" ? vr({
2412
+ let f = a === "contains" ? yr({
2402
2413
  model: e,
2403
2414
  camera: t,
2404
2415
  clippingPlanes: n,
@@ -2407,19 +2418,19 @@ function yr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2407
2418
  candidateIdsByModel: l,
2408
2419
  profile: o
2409
2420
  }) : c;
2410
- return o && (o.candidateIds = gr(l), o.selectedIds = gr(f), o.totalMs = performance.now() - s), f;
2421
+ return o && (o.candidateIds = _r(l), o.selectedIds = _r(f), o.totalMs = performance.now() - s), f;
2411
2422
  }
2412
- function br(e) {
2413
- let t = er(e.mode);
2423
+ function xr(e) {
2424
+ let t = tr(e.mode);
2414
2425
  return {
2415
- ids: yr({
2426
+ ids: br({
2416
2427
  ...e,
2417
2428
  profile: t
2418
2429
  }),
2419
2430
  profile: t
2420
2431
  };
2421
2432
  }
2422
- function xr(e) {
2433
+ function Sr(e) {
2423
2434
  return e === "contains" ? {
2424
2435
  border: "rgb(37, 99, 235)",
2425
2436
  background: "rgba(37, 99, 235, 0.16)"
@@ -2428,32 +2439,32 @@ function xr(e) {
2428
2439
  background: "rgba(22, 163, 74, 0.16)"
2429
2440
  };
2430
2441
  }
2431
- function Sr(e, t, n) {
2432
- let r = xr(nr(t, n));
2442
+ function Cr(e, t, n) {
2443
+ let r = Sr(rr(t, n));
2433
2444
  if (!e.current) {
2434
2445
  let t = document.createElement("div");
2435
2446
  t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
2436
2447
  }
2437
- let i = tr(t, n);
2448
+ let i = nr(t, n);
2438
2449
  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
2450
  }
2440
- function Cr(e) {
2451
+ function wr(e) {
2441
2452
  e.current?.remove(), e.current = null;
2442
2453
  }
2443
2454
  //#endregion
2444
2455
  //#region src/viewer/Selector/useSelector.tsx
2445
- var wr = 40;
2446
- function Tr(e) {
2456
+ var Tr = 40;
2457
+ function Er(e) {
2447
2458
  if (!Array.isArray(e)) return e.userData.shader;
2448
2459
  }
2449
- function Er(e, t) {
2450
- let n = Tr(e)?.uniforms.preSelectionId;
2460
+ function Dr(e, t) {
2461
+ let n = Er(e)?.uniforms.preSelectionId;
2451
2462
  n && (n.value = t);
2452
2463
  }
2453
- function Dr(e) {
2464
+ function Or(e) {
2454
2465
  return Number(e.current?.modelID ?? 0);
2455
2466
  }
2456
- function Or(e) {
2467
+ function kr(e) {
2457
2468
  let t = e;
2458
2469
  for (; t;) {
2459
2470
  let e = t.modelID ?? t.userData.modelID;
@@ -2462,7 +2473,7 @@ function Or(e) {
2462
2473
  }
2463
2474
  return 0;
2464
2475
  }
2465
- function kr(e) {
2476
+ function Ar(e) {
2466
2477
  let t = e;
2467
2478
  for (; t;) {
2468
2479
  if (!t.visible) return !1;
@@ -2470,13 +2481,13 @@ function kr(e) {
2470
2481
  }
2471
2482
  return !0;
2472
2483
  }
2473
- function Ar(e) {
2474
- if (!kr(e.object) || !(e.object instanceof N) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2484
+ function jr(e) {
2485
+ if (!Ar(e.object) || !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2475
2486
  let t = e.object.geometry;
2476
2487
  return !!(t.index && t.attributes.ids);
2477
2488
  }
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) => {
2489
+ function Mr(e, t, n, r) {
2490
+ let i = l("end"), a = z((e) => e.selected), s = z((e) => e.setSelected), c = z((e) => e.addSelected), u = z((e) => e.removeSelected), d = z((e) => e.showStats), f = Ee(), 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
2491
  if (r) {
2481
2492
  r(e);
2482
2493
  return;
@@ -2485,12 +2496,12 @@ function jr(e, t, n, r) {
2485
2496
  n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
2486
2497
  }, E = () => {
2487
2498
  e.current?.traverse((e) => {
2488
- if (!(e instanceof N)) return;
2499
+ if (!(e instanceof M)) return;
2489
2500
  let t = e;
2490
- t.preselected = !1, Er(t.material, -1);
2501
+ t.preselected = !1, Dr(t.material, -1);
2491
2502
  });
2492
2503
  }, D = () => {
2493
- m.current = null, g.current = !1, Cr(h), t.current && (t.current.enabled = !0);
2504
+ m.current = null, g.current = !1, wr(h), t.current && (t.current.enabled = !0);
2494
2505
  }, ee = (t) => {
2495
2506
  if (w()) {
2496
2507
  E();
@@ -2504,47 +2515,47 @@ function jr(e, t, n, r) {
2504
2515
  E();
2505
2516
  return;
2506
2517
  }
2507
- let n = ae(t, e.current)[0], r;
2518
+ let n = oe(t, e.current)[0], r;
2508
2519
  n && (r = n.object), E(), !(!n || !r) && e.current?.traverse((e) => {
2509
- if (!(e instanceof N)) return;
2520
+ if (!(e instanceof M)) return;
2510
2521
  let t = e;
2511
2522
  if (t !== r) return;
2512
2523
  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);
2524
+ t.preselected = !0, Dr(t.material, o);
2514
2525
  });
2515
2526
  };
2516
- function O() {
2527
+ function te() {
2517
2528
  return performance.now();
2518
2529
  }
2519
- let k = (e) => {
2530
+ let ne = (e) => {
2520
2531
  if (w()) {
2521
2532
  C.current = null, S.current !== null && (window.clearTimeout(S.current), S.current = null), E();
2522
2533
  return;
2523
2534
  }
2524
2535
  if (C.current = e, S.current !== null) return;
2525
- let t = O() - x.current, n = Math.max(0, wr - t);
2536
+ let t = te() - x.current, n = Math.max(0, Tr - t);
2526
2537
  S.current = window.setTimeout(() => {
2527
2538
  S.current = null;
2528
2539
  let e = C.current;
2529
2540
  C.current = null, e && (x.current = performance.now(), ee(e));
2530
2541
  }, n);
2531
- }, A = l(null);
2542
+ }, O = l(null);
2532
2543
  o(() => {
2533
2544
  let e = y.current;
2534
2545
  if (e) {
2535
- d && A.current !== null && console.log(`selection ${e.action}:`, Date.now() - A.current, "ms"), y.current = null, A.current = null;
2546
+ d && O.current !== null && console.log(`selection ${e.action}:`, Date.now() - O.current, "ms"), y.current = null, O.current = null;
2536
2547
  return;
2537
2548
  }
2538
- d && A.current !== null && (console.log("selection spend:", Date.now() - A.current, "ms"), A.current = null);
2549
+ d && O.current !== null && (console.log("selection spend:", Date.now() - O.current, "ms"), O.current = null);
2539
2550
  }, [a, d]);
2540
- let { camera: te, gl: j } = p();
2541
- function ne() {
2551
+ let { camera: k, gl: A } = p();
2552
+ function re() {
2542
2553
  return Date.now();
2543
2554
  }
2544
- let M = (e) => {
2545
- let t = j.domElement.getBoundingClientRect();
2555
+ let j = (e) => {
2556
+ let t = A.domElement.getBoundingClientRect();
2546
2557
  return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
2547
- }, P = (t) => {
2558
+ }, N = (t) => {
2548
2559
  if (w()) {
2549
2560
  b.current = !1, _.current = !1, E();
2550
2561
  return;
@@ -2554,15 +2565,15 @@ function jr(e, t, n, r) {
2554
2565
  _.current = !1;
2555
2566
  return;
2556
2567
  }
2557
- if (!M(t)) return;
2558
- if (A.current = ne(), i.current !== "end" && i.current !== "start" && i.current > 15) {
2568
+ if (!j(t)) return;
2569
+ if (O.current = re(), i.current !== "end" && i.current !== "start" && i.current > 15) {
2559
2570
  i.current = "end";
2560
2571
  return;
2561
2572
  }
2562
- let n = t.shiftKey, r = t.ctrlKey, o = ae(t, e.current), l, d = Dr(e), f = null;
2573
+ let n = t.shiftKey, r = t.ctrlKey, o = oe(t, e.current), l, d = Or(e), f = null;
2563
2574
  if (o.length) {
2564
2575
  let e = o[0], t = e.object;
2565
- d = Or(t), f = e.point;
2576
+ d = kr(t), f = e.point;
2566
2577
  let n = e.faceIndex * 3, r = t.geometry.index.getX(n);
2567
2578
  l = t.geometry.attributes.ids.getX(r);
2568
2579
  }
@@ -2574,33 +2585,33 @@ function jr(e, t, n, r) {
2574
2585
  return;
2575
2586
  }
2576
2587
  s(d, l === void 0 ? [] : [l], !0), f && T(f);
2577
- }, re = (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) => {
2588
+ }, P = (e) => {
2589
+ w() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (m.current = new F(e.clientX, e.clientY), v.current = e.ctrlKey ? "remove" : "add", g.current = !1, t.current && (t.current.enabled = !1));
2590
+ }, ie = (e) => {
2580
2591
  if (w()) {
2581
2592
  D();
2582
2593
  return;
2583
2594
  }
2584
2595
  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));
2587
- }, ie = (r) => {
2596
+ let t = new F(e.clientX, e.clientY), n = Math.abs(t.x - m.current.x), r = Math.abs(t.y - m.current.y);
2597
+ n < 6 && r < 6 || (g.current ||= !0, e.preventDefault(), Cr(h, m.current, t));
2598
+ }, ae = (r) => {
2588
2599
  if (w()) {
2589
2600
  D();
2590
2601
  return;
2591
2602
  }
2592
2603
  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(() => {
2604
+ O.current = re();
2605
+ let i = g.current, a = new F(r.clientX, r.clientY), o = nr(m.current, a), s = rr(m.current, a);
2606
+ if (m.current = null, g.current = !1, wr(h), t.current && setTimeout(() => {
2596
2607
  t.current && (t.current.enabled = !0);
2597
2608
  }, 100), !i) return;
2598
2609
  _.current = !0, r.preventDefault();
2599
- let { ids: l, profile: d } = br({
2610
+ let { ids: l, profile: d } = xr({
2600
2611
  model: e.current,
2601
- camera: te,
2612
+ camera: k,
2602
2613
  clippingPlanes: n.getActiveClippingPlanes(),
2603
- domElement: j.domElement,
2614
+ domElement: A.domElement,
2604
2615
  rect: o,
2605
2616
  mode: s
2606
2617
  }), f = Array.from(l.values()).reduce((e, t) => e + t.size, 0), p = {
@@ -2612,16 +2623,16 @@ function jr(e, t, n, r) {
2612
2623
  let n = Array.from(e);
2613
2624
  v.current === "remove" ? u(t, n) : c(t, n);
2614
2625
  }));
2615
- }, ae = (e, t) => t ? n.getIntersection(!1, {
2626
+ }, oe = (e, t) => t ? n.getIntersection(!1, {
2616
2627
  event: e,
2617
- filter: Ar,
2628
+ filter: jr,
2618
2629
  object: t,
2619
2630
  recursive: !0
2620
2631
  }) : [];
2621
2632
  o(() => {
2622
2633
  let e = t.current;
2623
2634
  if (!e) return;
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);
2635
+ A.domElement.addEventListener("pointerdown", P), A.domElement.addEventListener("pointermove", ie), window.addEventListener("pointerup", ae), window.addEventListener("pointerup", N), A.domElement.addEventListener("contextmenu", o), A.domElement.addEventListener("pointerup", a), A.domElement.addEventListener("pointermove", ne), A.domElement.addEventListener("pointerleave", E), A.domElement.addEventListener("pointerdown", r), e.addEventListener("update", n);
2625
2636
  function n() {
2626
2637
  typeof i.current == "number" ? i.current += 1 : i.current === "start" && (i.current = 1);
2627
2638
  }
@@ -2637,49 +2648,49 @@ function jr(e, t, n, r) {
2637
2648
  e.ctrlKey && e.preventDefault();
2638
2649
  }
2639
2650
  return () => {
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);
2651
+ wr(h), S.current !== null && (window.clearTimeout(S.current), S.current = null), C.current = null, E(), e.removeEventListener("update", n), A.domElement.removeEventListener("pointerdown", P), A.domElement.removeEventListener("pointermove", ie), window.removeEventListener("pointerup", ae), window.removeEventListener("pointerup", N), A.domElement.removeEventListener("contextmenu", o), A.domElement.removeEventListener("pointerup", a), A.domElement.removeEventListener("pointerdown", r), A.domElement.removeEventListener("pointermove", ne), A.domElement.removeEventListener("pointerleave", E);
2641
2652
  };
2642
2653
  });
2643
2654
  }
2644
2655
  //#endregion
2645
2656
  //#region src/viewer/Camera/useCameraFit.tsx
2646
- var Mr = new L(1, 1, 1).normalize(), Nr = 1.18;
2647
- function Pr() {
2657
+ var Nr = new I(1, 1, 1).normalize(), Pr = 1.18;
2658
+ function Fr() {
2648
2659
  let { camera: e } = p();
2649
2660
  return i((t, n, r) => {
2650
- if (!t.current || !(e instanceof oe)) return;
2661
+ if (!t.current || !(e instanceof se)) return;
2651
2662
  let i = new g().setFromObject(t.current);
2652
2663
  if (i.isEmpty()) return;
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();
2664
+ let a = i.getCenter(new I()), o = i.getBoundingSphere(new de()), s = re.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;
2665
+ e.position.copy(a).addScaledVector(Nr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
2655
2666
  let d = n.current;
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));
2667
+ 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));
2657
2668
  }, [e]);
2658
2669
  }
2659
2670
  //#endregion
2660
2671
  //#region src/viewer/store/ViewerStoreProvider.tsx
2661
- function Fr({ children: e, store: t }) {
2662
- let [n] = u(() => t ?? ke());
2663
- return /* @__PURE__ */ R(we.Provider, {
2672
+ function Ir({ children: e, store: t }) {
2673
+ let [n] = u(() => t ?? Ae());
2674
+ return /* @__PURE__ */ L(Te.Provider, {
2664
2675
  value: n,
2665
2676
  children: e
2666
2677
  });
2667
2678
  }
2668
2679
  //#endregion
2669
2680
  //#region src/viewer/utils/ExportUtils/ExportUtils.ts
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) {
2681
+ var Lr = new TextEncoder(), Rr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", zr = "Unknown", Br = ["elementID", "ifcguid"], Vr = 0, Hr = 33;
2682
+ function Ur(e) {
2672
2683
  return !!e && typeof e == "object" && !Array.isArray(e);
2673
2684
  }
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;
2676
- }
2677
2685
  function Wr(e, t) {
2678
- let n = Ur(e, t);
2686
+ 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;
2687
+ }
2688
+ function Gr(e, t) {
2689
+ let n = Wr(e, t);
2679
2690
  if (n !== null) return n;
2680
2691
  if (Array.isArray(e)) {
2681
2692
  if (!e.length) return t;
2682
- let n = e.map((e) => Ur(e, t));
2693
+ let n = e.map((e) => Wr(e, t));
2683
2694
  if (n.every((e) => e !== null)) {
2684
2695
  let e = n.join(", ");
2685
2696
  return e.trim() ? e : t;
@@ -2692,21 +2703,21 @@ function Wr(e, t) {
2692
2703
  return t;
2693
2704
  }
2694
2705
  }
2695
- function q(e) {
2706
+ function K(e) {
2696
2707
  return typeof e == "string" && e.trim() ? e : null;
2697
2708
  }
2698
- function Gr(e) {
2699
- let t = Hr(e.props) ? e.props : {};
2700
- return q(e.type ?? e.Type ?? t.type ?? t.Type) ?? Rr;
2701
- }
2702
2709
  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) ?? "";
2710
+ let t = Ur(e.props) ? e.props : {};
2711
+ return K(e.type ?? e.Type ?? t.type ?? t.Type) ?? zr;
2712
+ }
2713
+ function qr(e) {
2714
+ let t = Ur(e.props) ? e.props : {};
2715
+ return K(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
2705
2716
  }
2706
- function qr(e, t) {
2707
- return q(e.Name) ?? q(e.name) ?? q(e.DisplayName) ?? q(e.displayName) ?? `Property ${t + 1}`;
2717
+ function Jr(e, t) {
2718
+ return K(e.Name) ?? K(e.name) ?? K(e.DisplayName) ?? K(e.displayName) ?? `Property ${t + 1}`;
2708
2719
  }
2709
- function Jr(e) {
2720
+ function Yr(e) {
2710
2721
  for (let t of [
2711
2722
  "NominalValue",
2712
2723
  "nominalValue",
@@ -2729,18 +2740,18 @@ function Jr(e) {
2729
2740
  "description"
2730
2741
  ].includes(e)));
2731
2742
  }
2732
- function Yr(e, t) {
2733
- return q(e.name) ?? q(e.Name) ?? `Set ${t + 1}`;
2743
+ function Xr(e, t) {
2744
+ return K(e.name) ?? K(e.Name) ?? `Set ${t + 1}`;
2734
2745
  }
2735
- function Xr(e) {
2746
+ function Zr(e) {
2736
2747
  let t = e.props;
2737
- return Array.isArray(t) ? t.map((e, t) => Hr(e) ? {
2738
- label: qr(e, t),
2739
- value: Jr(e)
2748
+ return Array.isArray(t) ? t.map((e, t) => Ur(e) ? {
2749
+ label: Jr(e, t),
2750
+ value: Yr(e)
2740
2751
  } : {
2741
2752
  label: `Property ${t + 1}`,
2742
2753
  value: e
2743
- }) : Hr(t) ? Object.entries(t).map(([e, t]) => ({
2754
+ }) : Ur(t) ? Object.entries(t).map(([e, t]) => ({
2744
2755
  label: e,
2745
2756
  value: t
2746
2757
  })) : Object.entries(e).filter(([e]) => ![
@@ -2754,14 +2765,14 @@ function Xr(e) {
2754
2765
  value: t
2755
2766
  }));
2756
2767
  }
2757
- function Zr(e, t) {
2768
+ function Qr(e, t) {
2758
2769
  e.columnSet.has(t) || (e.columnSet.add(t), e.columns.push(t));
2759
2770
  }
2760
- function Qr(e, t, n, r, i) {
2771
+ function $r(e, t, n, r, i) {
2761
2772
  let a = n.trim();
2762
- a && (Zr(e, a), t[a] = Wr(r, i));
2773
+ a && (Qr(e, a), t[a] = Gr(r, i));
2763
2774
  }
2764
- function $r(e, t, n) {
2775
+ function ei(e, t, n) {
2765
2776
  let r = {};
2766
2777
  return Object.entries(t).forEach(([t, i]) => {
2767
2778
  [
@@ -2769,33 +2780,33 @@ function $r(e, t, n) {
2769
2780
  "guid",
2770
2781
  "props",
2771
2782
  "sets"
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);
2783
+ ].includes(t) || $r(e, r, t, i, n);
2784
+ }), Ur(t.props) && Object.entries(t.props).forEach(([t, i]) => {
2785
+ $r(e, r, t, i, n);
2775
2786
  }), Array.isArray(t.sets) && t.sets.forEach((t, i) => {
2776
- let a = Yr(t, i);
2777
- Xr(t).forEach((t) => {
2778
- Qr(e, r, `${a}.${t.label}`, t.value, n);
2787
+ let a = Xr(t, i);
2788
+ Zr(t).forEach((t) => {
2789
+ $r(e, r, `${a}.${t.label}`, t.value, n);
2779
2790
  });
2780
2791
  }), r;
2781
2792
  }
2782
- function ei(e, t, n) {
2793
+ function ti(e, t, n) {
2783
2794
  Object.entries(t).forEach(([t, r]) => {
2784
2795
  let i = Number(t);
2785
2796
  if (!Number.isFinite(i)) return;
2786
- let a = Gr(r), o = e.get(a);
2797
+ let a = Kr(r), o = e.get(a);
2787
2798
  o || (o = {
2788
2799
  columns: [],
2789
2800
  columnSet: /* @__PURE__ */ new Set(),
2790
2801
  rows: []
2791
2802
  }, e.set(a, o)), o.rows.push({
2792
2803
  elementID: i,
2793
- ifcguid: Kr(r),
2794
- values: $r(o, r, n)
2804
+ ifcguid: qr(r),
2805
+ values: ei(o, r, n)
2795
2806
  });
2796
2807
  });
2797
2808
  }
2798
- function ti(e) {
2809
+ function ni(e) {
2799
2810
  return e.replace(/[<>&'"]/g, (e) => {
2800
2811
  switch (e) {
2801
2812
  case "<": return "&lt;";
@@ -2807,7 +2818,7 @@ function ti(e) {
2807
2818
  }
2808
2819
  });
2809
2820
  }
2810
- function ni(e) {
2821
+ function ri(e) {
2811
2822
  let t = e, n = "";
2812
2823
  for (; t > 0;) {
2813
2824
  let e = (t - 1) % 26;
@@ -2815,45 +2826,45 @@ function ni(e) {
2815
2826
  }
2816
2827
  return n;
2817
2828
  }
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>`;
2829
+ function ii(e, t, n) {
2830
+ return `<c r="${`${ri(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${ni(e)}</t></is></c>`;
2820
2831
  }
2821
- function ii(e) {
2822
- return `${Lr}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
2832
+ function ai(e) {
2833
+ return `${Rr}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
2823
2834
  let n = t + 1;
2824
- return `<row r="${n}">${e.map((e, t) => ri(e, n, t + 1)).join("")}</row>`;
2835
+ return `<row r="${n}">${e.map((e, t) => ii(e, n, t + 1)).join("")}</row>`;
2825
2836
  }).join("")}</sheetData></worksheet>`;
2826
2837
  }
2827
- function ai(e) {
2828
- return e.replace(/[\\/?*[\]:]/g, " ").trim() || Rr;
2838
+ function oi(e) {
2839
+ return e.replace(/[\\/?*[\]:]/g, " ").trim() || zr;
2829
2840
  }
2830
- function oi(e, t) {
2831
- let n = ai(e).slice(0, 31), r = n, i = 2;
2841
+ function si(e, t) {
2842
+ let n = oi(e).slice(0, 31), r = n, i = 2;
2832
2843
  for (; t.has(r.toLowerCase());) {
2833
2844
  let e = ` (${i})`;
2834
2845
  r = `${n.slice(0, 31 - e.length)}${e}`, i += 1;
2835
2846
  }
2836
2847
  return t.add(r.toLowerCase()), r;
2837
2848
  }
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) => {
2849
+ function ci(e) {
2850
+ 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) => {
2840
2851
  let n = t + 1;
2841
- return `<sheet name="${ti(e)}" sheetId="${n}" r:id="rId${n}"/>`;
2852
+ return `<sheet name="${ni(e)}" sheetId="${n}" r:id="rId${n}"/>`;
2842
2853
  }).join("")}</sheets></workbook>`;
2843
2854
  }
2844
- function ci(e) {
2845
- return `${Lr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
2855
+ function li(e) {
2856
+ return `${Rr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
2846
2857
  let n = t + 1;
2847
2858
  return `<Relationship Id="rId${n}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${n}.xml"/>`;
2848
2859
  }).join("")}</Relationships>`;
2849
2860
  }
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>`;
2861
+ function ui() {
2862
+ 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>`;
2852
2863
  }
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>`;
2864
+ function di(e) {
2865
+ 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>`;
2855
2866
  }
2856
- function di() {
2867
+ function fi() {
2857
2868
  let e = new Uint32Array(256);
2858
2869
  for (let t = 0; t < 256; t++) {
2859
2870
  let n = t;
@@ -2862,121 +2873,121 @@ function di() {
2862
2873
  }
2863
2874
  return e;
2864
2875
  }
2865
- var fi = di();
2866
- function pi(e) {
2876
+ var pi = fi();
2877
+ function mi(e) {
2867
2878
  let t = 4294967295;
2868
- for (let n of e) t = fi[(t ^ n) & 255] ^ t >>> 8;
2879
+ for (let n of e) t = pi[(t ^ n) & 255] ^ t >>> 8;
2869
2880
  return (t ^ 4294967295) >>> 0;
2870
2881
  }
2871
- function mi(e) {
2882
+ function hi(e) {
2872
2883
  let t = new Uint8Array(30 + e.nameBytes.length), n = new DataView(t.buffer);
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;
2884
+ 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;
2874
2885
  }
2875
- function hi(e) {
2886
+ function gi(e) {
2876
2887
  let t = new Uint8Array(46 + e.nameBytes.length), n = new DataView(t.buffer);
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;
2888
+ 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;
2878
2889
  }
2879
- function gi(e, t, n) {
2890
+ function _i(e, t, n) {
2880
2891
  let r = new Uint8Array(22), i = new DataView(r.buffer);
2881
2892
  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;
2882
2893
  }
2883
- function _i(e, t) {
2894
+ function vi(e, t) {
2884
2895
  let n = new Uint8Array(t), r = 0;
2885
2896
  return e.forEach((e) => {
2886
2897
  n.set(e, r), r += e.length;
2887
2898
  }), n;
2888
2899
  }
2889
- function vi(e) {
2900
+ function yi(e) {
2890
2901
  let t = 0, n = e.map((e) => {
2891
2902
  let n = {
2892
2903
  ...e,
2893
- crc: pi(e.data),
2894
- nameBytes: Ir.encode(e.path),
2904
+ crc: mi(e.data),
2905
+ nameBytes: Lr.encode(e.path),
2895
2906
  offset: t
2896
2907
  };
2897
2908
  return t += 30 + n.nameBytes.length + n.data.length, n;
2898
2909
  }), r = [];
2899
2910
  n.forEach((e) => {
2900
- r.push(mi(e), e.data);
2911
+ r.push(hi(e), e.data);
2901
2912
  });
2902
2913
  let i = t, a = 0;
2903
2914
  return n.forEach((e) => {
2904
- let t = hi(e);
2915
+ let t = gi(e);
2905
2916
  a += t.length, r.push(t);
2906
- }), r.push(gi(n.length, a, i)), _i(r, r.reduce((e, t) => e + t.length, 0));
2917
+ }), r.push(_i(n.length, a, i)), vi(r, r.reduce((e, t) => e + t.length, 0));
2907
2918
  }
2908
- function yi(e, t) {
2919
+ function bi(e, t) {
2909
2920
  let n = /* @__PURE__ */ new Map();
2910
- e && ei(n, e.props, t);
2921
+ e && ti(n, e.props, t);
2911
2922
  let r = /* @__PURE__ */ new Set(), i = Array.from(n.entries()).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
2912
- let i = [...zr, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
2923
+ let i = [...Br, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
2913
2924
  String(e.elementID),
2914
2925
  e.ifcguid || t,
2915
2926
  ...n.columns.map((n) => e.values[n] ?? t)
2916
2927
  ]);
2917
2928
  return {
2918
- name: oi(e, r),
2929
+ name: si(e, r),
2919
2930
  rows: [i, ...a]
2920
2931
  };
2921
2932
  });
2922
2933
  return i.length || i.push({
2923
- name: oi(Rr, r),
2924
- rows: [zr]
2934
+ name: si(zr, r),
2935
+ rows: [Br]
2925
2936
  }), i;
2926
2937
  }
2927
- function bi(e, t = {}) {
2928
- let n = yi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
2938
+ function xi(e, t = {}) {
2939
+ let n = bi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
2929
2940
  {
2930
2941
  path: "[Content_Types].xml",
2931
- data: Ir.encode(ui(r))
2942
+ data: Lr.encode(di(r))
2932
2943
  },
2933
2944
  {
2934
2945
  path: "_rels/.rels",
2935
- data: Ir.encode(li())
2946
+ data: Lr.encode(ui())
2936
2947
  },
2937
2948
  {
2938
2949
  path: "xl/workbook.xml",
2939
- data: Ir.encode(si(r))
2950
+ data: Lr.encode(ci(r))
2940
2951
  },
2941
2952
  {
2942
2953
  path: "xl/_rels/workbook.xml.rels",
2943
- data: Ir.encode(ci(r))
2954
+ data: Lr.encode(li(r))
2944
2955
  },
2945
2956
  ...n.map((e, t) => ({
2946
2957
  path: `xl/worksheets/sheet${t + 1}.xml`,
2947
- data: Ir.encode(ii(e.rows))
2958
+ data: Lr.encode(ai(e.rows))
2948
2959
  }))
2949
2960
  ];
2950
- return new Blob([vi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
2961
+ return new Blob([yi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
2951
2962
  }
2952
- function xi(e) {
2963
+ function Si(e) {
2953
2964
  return e.split(/[?#]/)[0].split(/[\\/]/).pop()?.replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "").trim() || "model";
2954
2965
  }
2955
- function Si(e, t) {
2956
- let n = t.fileName?.trim() || `${xi(t.modelName ?? e?.name ?? "model")}_properties`;
2966
+ function Ci(e, t) {
2967
+ let n = t.fileName?.trim() || `${Si(t.modelName ?? e?.name ?? "model")}_properties`;
2957
2968
  return n.toLowerCase().endsWith(".xlsx") ? n : `${n}.xlsx`;
2958
2969
  }
2959
- function Ci(e, t = {}) {
2970
+ function wi(e, t = {}) {
2960
2971
  return {
2961
- blob: bi(e, t),
2962
- name: Si(e, t)
2972
+ blob: xi(e, t),
2973
+ name: Ci(e, t)
2963
2974
  };
2964
2975
  }
2965
2976
  //#endregion
2966
2977
  //#region src/viewer/api/ViewerPropertiesApi.ts
2967
- function J(e) {
2978
+ function q(e) {
2968
2979
  return !!e && typeof e == "object" && !Array.isArray(e);
2969
2980
  }
2970
- function wi(e, t) {
2981
+ function Ti(e, t) {
2971
2982
  return Object.prototype.hasOwnProperty.call(e, t);
2972
2983
  }
2973
- function Ti(e) {
2974
- return J(e);
2975
- }
2976
2984
  function Ei(e) {
2977
- return Array.isArray(e) ? e.filter(Ti) : J(e) ? Object.values(e).filter(Ti) : [];
2985
+ return q(e);
2978
2986
  }
2979
2987
  function Di(e) {
2988
+ return Array.isArray(e) ? e.filter(Ei) : q(e) ? Object.values(e).filter(Ei) : [];
2989
+ }
2990
+ function Oi(e) {
2980
2991
  if (typeof e == "number" && Number.isFinite(e)) return e;
2981
2992
  if (typeof e == "string") {
2982
2993
  let t = Number(e);
@@ -2984,10 +2995,10 @@ function Di(e) {
2984
2995
  }
2985
2996
  return null;
2986
2997
  }
2987
- function Oi(e) {
2988
- return Di(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
2989
- }
2990
2998
  function ki(e) {
2999
+ return Oi(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
3000
+ }
3001
+ function Ai(e) {
2991
3002
  let t = [
2992
3003
  e.children,
2993
3004
  e.items,
@@ -2995,40 +3006,40 @@ function ki(e) {
2995
3006
  e.childs
2996
3007
  ];
2997
3008
  for (let e of t) {
2998
- let t = Ei(e);
3009
+ let t = Di(e);
2999
3010
  if (t.length) return t;
3000
3011
  }
3001
3012
  return [];
3002
3013
  }
3003
- function Ai(e) {
3004
- let t = J(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
3014
+ function ji(e) {
3015
+ let t = q(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
3005
3016
  return typeof n == "string" ? n : "";
3006
3017
  }
3007
- function ji(e) {
3018
+ function Mi(e) {
3008
3019
  return e.replace(/[^a-z0-9]/gi, "").toUpperCase();
3009
3020
  }
3010
- function Mi(e) {
3011
- return ji(Ai(e)) === "IFCBUILDINGSTOREY";
3021
+ function Ni(e) {
3022
+ return Mi(ji(e)) === "IFCBUILDINGSTOREY";
3012
3023
  }
3013
- var Ni = new Set([
3024
+ var Pi = new Set([
3014
3025
  "children",
3015
3026
  "childs",
3016
3027
  "elements",
3017
3028
  "items"
3018
3029
  ]);
3019
- function Pi(e) {
3030
+ function Fi(e) {
3020
3031
  let t = {};
3021
3032
  return Object.entries(e).forEach(([e, n]) => {
3022
- Ni.has(e) || (t[e] = n);
3033
+ Pi.has(e) || (t[e] = n);
3023
3034
  }), t;
3024
3035
  }
3025
- function Fi(e, t) {
3036
+ function Ii(e, t) {
3026
3037
  return Array.isArray(t) ? {
3027
- children: Ei(t),
3038
+ children: Di(t),
3028
3039
  name: `Model ${e}`,
3029
3040
  type: "Model"
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),
3041
+ } : 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 : {
3042
+ children: Di(t),
3032
3043
  name: `Model ${e}`,
3033
3044
  type: "Model"
3034
3045
  } : {
@@ -3037,46 +3048,46 @@ function Fi(e, t) {
3037
3048
  type: "Model"
3038
3049
  };
3039
3050
  }
3040
- function Ii(e) {
3051
+ function Li(e) {
3041
3052
  let t = [];
3042
- return ki(e).forEach((e) => {
3043
- let n = Oi(e);
3044
- n !== null && t.push(n), t.push(...Ii(e));
3053
+ return Ai(e).forEach((e) => {
3054
+ let n = ki(e);
3055
+ n !== null && t.push(n), t.push(...Li(e));
3045
3056
  }), t;
3046
3057
  }
3047
- function Li(e, t, n, r) {
3048
- let i = Oi(t), a = i === null ? void 0 : n[e]?.[i], o = {
3049
- ...Pi(t),
3058
+ function Ri(e, t, n, r) {
3059
+ let i = ki(t), a = i === null ? void 0 : n[e]?.[i], o = {
3060
+ ...Fi(t),
3050
3061
  ...a ?? {},
3051
3062
  modelID: e
3052
3063
  };
3053
- return r && (o.elements = Ii(t)), o;
3064
+ return r && (o.elements = Li(t)), o;
3054
3065
  }
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));
3066
+ function zi(e, t, n, r, i) {
3067
+ Ni(t) && n.push(Ri(e, t, r, i)), Ai(t).forEach((t) => zi(e, t, n, r, i));
3057
3068
  }
3058
- function zi(e, t, n = !1) {
3069
+ function Bi(e, t, n = !1) {
3059
3070
  let r = {};
3060
3071
  return Object.entries(e).forEach(([e, i]) => {
3061
3072
  let a = Number(e), o = [];
3062
- Ri(a, Fi(a, i), o, t, n), r[a] = o;
3073
+ zi(a, Ii(a, i), o, t, n), r[a] = o;
3063
3074
  }), r;
3064
3075
  }
3065
- function Bi(e, t, n, r = !1) {
3076
+ function Vi(e, t, n, r = !1) {
3066
3077
  let i = [], a = e[n];
3067
3078
  if (!a) throw Error(`Model with modelID ${n} not found`);
3068
- return Ri(Number(n), Fi(Number(n), a), i, t, r), i;
3079
+ return zi(Number(n), Ii(Number(n), a), i, t, r), i;
3069
3080
  }
3070
- function Vi(e, t, n) {
3081
+ function Hi(e, t, n) {
3071
3082
  return e[t]?.[n];
3072
3083
  }
3073
- function Hi(e) {
3074
- return typeof e == "string" ? e : J(e) && typeof e.value == "string" ? e.value : "";
3084
+ function Ui(e) {
3085
+ return typeof e == "string" ? e : q(e) && typeof e.value == "string" ? e.value : "";
3075
3086
  }
3076
- function Ui(e, t) {
3077
- return Hi(e.Name) || Hi(e.name) || Hi(e.DisplayName) || Hi(e.displayName) || `Property ${t + 1}`;
3087
+ function Wi(e, t) {
3088
+ return Ui(e.Name) || Ui(e.name) || Ui(e.DisplayName) || Ui(e.displayName) || `Property ${t + 1}`;
3078
3089
  }
3079
- function Wi(e) {
3090
+ function Gi(e) {
3080
3091
  for (let t of [
3081
3092
  "NominalValue",
3082
3093
  "nominalValue",
@@ -3099,44 +3110,44 @@ function Wi(e) {
3099
3110
  "description"
3100
3111
  ].includes(e)));
3101
3112
  }
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;
3113
+ function Ki(e) {
3114
+ return Ui(e.name) || Ui(e.Name);
3107
3115
  }
3108
3116
  function qi(e, t) {
3117
+ return Ti(e, t) ? e[t] : void 0;
3118
+ }
3119
+ function Ji(e, t) {
3109
3120
  let n = e.props;
3110
- if (J(n)) {
3111
- let e = Ki(n, t);
3121
+ if (q(n)) {
3122
+ let e = qi(n, t);
3112
3123
  if (e !== void 0) return e;
3113
3124
  }
3114
3125
  if (Array.isArray(n)) for (let e = 0; e < n.length; e += 1) {
3115
3126
  let r = n[e];
3116
- if (!J(r)) continue;
3127
+ if (!q(r)) continue;
3117
3128
  let i = r;
3118
- if (Ui(i, e) === t) return Wi(i);
3129
+ if (Wi(i, e) === t) return Gi(i);
3119
3130
  }
3120
- return Ki(e, t);
3131
+ return qi(e, t);
3121
3132
  }
3122
- function Ji(e, t, n) {
3133
+ function Yi(e, t, n) {
3123
3134
  if (!e) return;
3124
3135
  if (n !== void 0) {
3125
- let r = e.sets?.find((e) => Gi(e) === n);
3126
- return r ? qi(r, t) : void 0;
3136
+ let r = e.sets?.find((e) => Ki(e) === n);
3137
+ return r ? Ji(r, t) : void 0;
3127
3138
  }
3128
- if (J(e.props)) {
3129
- let n = Ki(e.props, t);
3139
+ if (q(e.props)) {
3140
+ let n = qi(e.props, t);
3130
3141
  if (n !== void 0) return n;
3131
3142
  }
3132
- let r = Ki(e, t);
3143
+ let r = qi(e, t);
3133
3144
  if (r !== void 0) return r;
3134
3145
  for (let n of e.sets ?? []) {
3135
- let e = qi(n, t);
3146
+ let e = Ji(n, t);
3136
3147
  if (e !== void 0) return e;
3137
3148
  }
3138
3149
  }
3139
- function Yi(e, t, n, r) {
3150
+ function Xi(e, t, n, r) {
3140
3151
  let i = t[e];
3141
3152
  return i ? {
3142
3153
  data: {},
@@ -3145,44 +3156,44 @@ function Yi(e, t, n, r) {
3145
3156
  structure: n[e] ?? {}
3146
3157
  } : null;
3147
3158
  }
3148
- function Xi(e) {
3159
+ function Zi(e) {
3149
3160
  return {
3150
3161
  exportAllExcel: (t) => {
3151
3162
  let n = e.getState();
3152
3163
  return Object.keys(n.modelProps).flatMap((e) => {
3153
- let r = Yi(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3154
- return r ? [Ci(r, t)] : [];
3164
+ let r = Xi(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3165
+ return r ? [wi(r, t)] : [];
3155
3166
  });
3156
3167
  },
3157
3168
  exportExcel: (t, n) => {
3158
- let r = e.getState(), i = Yi(t, r.modelProps, r.modelStructure, r.modelNames);
3159
- return i ? Ci(i, n) : null;
3169
+ let r = e.getState(), i = Xi(t, r.modelProps, r.modelStructure, r.modelNames);
3170
+ return i ? wi(i, n) : null;
3160
3171
  },
3161
3172
  getAllLevels: (t = !1) => {
3162
3173
  let n = e.getState();
3163
- return zi(n.modelStructure, n.modelProps, t);
3174
+ return Bi(n.modelStructure, n.modelProps, t);
3164
3175
  },
3165
3176
  getAllModelLevels: (t, n = !1) => {
3166
3177
  let r = e.getState();
3167
- return Bi(r.modelStructure, r.modelProps, t, n);
3178
+ return Vi(r.modelStructure, r.modelProps, t, n);
3168
3179
  },
3169
3180
  getModelProps: () => e.getState().modelProps,
3170
3181
  getModelStructure: () => e.getState().modelStructure,
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)
3182
+ getParamsByElement: (t, n) => Hi(e.getState().modelProps, t, n),
3183
+ getParamValueByName: Yi,
3184
+ getParamValueByElement: (t, n, r, i) => Yi(Hi(e.getState().modelProps, t, n), r, i)
3174
3185
  };
3175
3186
  }
3176
3187
  //#endregion
3177
3188
  //#region src/viewer/Loaders/BmtConverter.ts
3178
- var Zi = "BMT", Qi = 1, Y = {
3189
+ var Qi = "BMT", $i = 1, J = {
3179
3190
  PROP: 1,
3180
3191
  MESH: 2,
3181
3192
  STRUCTURE: 3,
3182
3193
  GRIDS: 4,
3183
3194
  MATRIX: 5,
3184
3195
  MESHSPACE: 6
3185
- }, $i = "application/json", ea = "application/octet-stream", ta = class {
3196
+ }, ea = "application/json", ta = "application/octet-stream", na = class {
3186
3197
  chunks = [];
3187
3198
  length = 0;
3188
3199
  writeUint8(e) {
@@ -3202,7 +3213,7 @@ var Zi = "BMT", Qi = 1, Y = {
3202
3213
  e.set(n, t), t += n.byteLength;
3203
3214
  }), e;
3204
3215
  }
3205
- }, na = class {
3216
+ }, ra = class {
3206
3217
  textEncoder = new TextEncoder();
3207
3218
  ifcLoader = null;
3208
3219
  async ConvertIfcFileToBmt(e, t = {}) {
@@ -3265,7 +3276,7 @@ var Zi = "BMT", Qi = 1, Y = {
3265
3276
  }
3266
3277
  async getIfcLoader(e) {
3267
3278
  if (!this.ifcLoader) {
3268
- let { IFCLoader: e } = await import("./IFCLoader-RIJas-B5.js");
3279
+ let { IFCLoader: e } = await import("./IFCLoader-Cjkb3xMA.js");
3269
3280
  this.ifcLoader = new e();
3270
3281
  }
3271
3282
  return this.configureIfcLoader(this.ifcLoader, e), this.ifcLoader;
@@ -3304,7 +3315,7 @@ var Zi = "BMT", Qi = 1, Y = {
3304
3315
  progress: this.clampProgress(e.progress) * a
3305
3316
  });
3306
3317
  }), s = [{
3307
- blob: new Blob([o], { type: ea }),
3318
+ blob: new Blob([o], { type: ta }),
3308
3319
  bytes: o,
3309
3320
  name: i,
3310
3321
  type: "bmt"
@@ -3324,7 +3335,7 @@ var Zi = "BMT", Qi = 1, Y = {
3324
3335
  phase: "metadata",
3325
3336
  progress: .95
3326
3337
  }), s.push({
3327
- blob: new Blob([n], { type: $i }),
3338
+ blob: new Blob([n], { type: ea }),
3328
3339
  bytes: n,
3329
3340
  name: `${t}_props.json`,
3330
3341
  type: "json"
@@ -3337,7 +3348,7 @@ var Zi = "BMT", Qi = 1, Y = {
3337
3348
  return s;
3338
3349
  }
3339
3350
  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) => {
3351
+ let r = new na(), 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
3352
  n?.({
3342
3353
  ...e,
3343
3354
  progress: this.clampProgress(e.progress)
@@ -3354,19 +3365,19 @@ var Zi = "BMT", Qi = 1, Y = {
3354
3365
  progress: f
3355
3366
  });
3356
3367
  };
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({
3368
+ return r.writeBytes(this.textEncoder.encode(Qi)), r.writeUint8($i), t && (this.writeProps(r, e.props, (e) => m(s, e)), h(s, "properties", "Properties written")), e.grids !== void 0 && (p({
3358
3369
  message: "Writing grids",
3359
3370
  phase: "metadata",
3360
3371
  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({
3372
+ }), this.writeJsonChunk(r, J.GRIDS, e.grids), h(c, "metadata", "Grids written")), this.writeMeshes(r, e, (e) => m(d, e)), h(d, "geometry", "Geometry written"), t && (p({
3362
3373
  message: "Writing structure",
3363
3374
  phase: "metadata",
3364
3375
  progress: f
3365
- }), this.writeJsonChunk(r, Y.STRUCTURE, e.structure), h(l, "metadata", "Structure written")), o && e.coordinationMatrix && (p({
3376
+ }), this.writeJsonChunk(r, J.STRUCTURE, e.structure), h(l, "metadata", "Structure written")), o && e.coordinationMatrix && (p({
3366
3377
  message: "Writing coordination matrix",
3367
3378
  phase: "metadata",
3368
3379
  progress: f
3369
- }), this.writeTextChunk(r, Y.MATRIX, e.coordinationMatrix), h(u, "metadata", "Coordination matrix written")), p({
3380
+ }), this.writeTextChunk(r, J.MATRIX, e.coordinationMatrix), h(u, "metadata", "Coordination matrix written")), p({
3370
3381
  message: "BMT bytes ready",
3371
3382
  phase: "writing",
3372
3383
  progress: 1
@@ -3385,7 +3396,7 @@ var Zi = "BMT", Qi = 1, Y = {
3385
3396
  ...o,
3386
3397
  id: s
3387
3398
  } : o;
3388
- this.writeJsonChunk(e, Y.PROP, c);
3399
+ this.writeJsonChunk(e, J.PROP, c);
3389
3400
  let l = a + 1;
3390
3401
  this.shouldEmitItemProgress(l, i) && n?.({
3391
3402
  loaded: l,
@@ -3405,7 +3416,7 @@ var Zi = "BMT", Qi = 1, Y = {
3405
3416
  progress: a > 0 ? 0 : 1,
3406
3417
  total: a
3407
3418
  }), 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));
3419
+ t.matrix && t.matrix !== r && (this.writeTextChunk(e, J.MATRIX, t.matrix), r = t.matrix), this.writeChunk(e, t.isIfcSpace ? J.MESHSPACE : J.MESH, this.createMeshPayload(t));
3409
3420
  let o = i + 1;
3410
3421
  this.shouldEmitItemProgress(o, a) && n?.({
3411
3422
  loaded: o,
@@ -3417,7 +3428,7 @@ var Zi = "BMT", Qi = 1, Y = {
3417
3428
  });
3418
3429
  }
3419
3430
  createMeshPayload(e) {
3420
- let t = new ta(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3431
+ let t = new na(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3421
3432
  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();
3422
3433
  }
3423
3434
  writeJsonChunk(e, t, n) {
@@ -3570,7 +3581,7 @@ var Zi = "BMT", Qi = 1, Y = {
3570
3581
  let t = /* @__PURE__ */ new Map();
3571
3582
  return (Array.isArray(e) ? e : [e]).forEach((e) => {
3572
3583
  e.traverse((e) => {
3573
- if (!(e instanceof N) || !this.isIfcSpaceObject(e)) return;
3584
+ if (!(e instanceof M) || !this.isIfcSpaceObject(e)) return;
3574
3585
  let n = this.getObjectModelID(e);
3575
3586
  if (n === null) return;
3576
3587
  let r = e.geometry.getAttribute("ids");
@@ -3584,7 +3595,7 @@ var Zi = "BMT", Qi = 1, Y = {
3584
3595
  addVisibleIdsFromObject3D(e, t) {
3585
3596
  (Array.isArray(e) ? e : [e]).forEach((e) => {
3586
3597
  e.traverse((e) => {
3587
- if (!(e instanceof N) || !this.isObjectVisible(e)) return;
3598
+ if (!(e instanceof M) || !this.isObjectVisible(e)) return;
3588
3599
  let n = this.getObjectModelID(e);
3589
3600
  if (n === null) return;
3590
3601
  let r = e.geometry.getAttribute("ids");
@@ -3636,7 +3647,7 @@ var Zi = "BMT", Qi = 1, Y = {
3636
3647
  return this.deflateBytes(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3637
3648
  }
3638
3649
  deflateBytes(e) {
3639
- return Ce.deflate(e);
3650
+ return we.deflate(e);
3640
3651
  }
3641
3652
  encodeText(e) {
3642
3653
  return this.textEncoder.encode(e);
@@ -3653,43 +3664,43 @@ var Zi = "BMT", Qi = 1, Y = {
3653
3664
  isRecord(e) {
3654
3665
  return typeof e == "object" && !!e;
3655
3666
  }
3656
- }, ra = new na();
3657
- async function ia(e, t) {
3658
- return ra.ConvertIfcFileToBmt(e, t);
3667
+ }, ia = new ra();
3668
+ async function aa(e, t) {
3669
+ return ia.ConvertIfcFileToBmt(e, t);
3659
3670
  }
3660
- function aa(e, t) {
3661
- return ra.ConvertToBmt(e, t);
3671
+ function oa(e, t) {
3672
+ return ia.ConvertToBmt(e, t);
3662
3673
  }
3663
3674
  //#endregion
3664
3675
  //#region src/viewer/Selector/FilteredElementsCollector.ts
3665
- function X(e) {
3676
+ function Y(e) {
3666
3677
  return !!e && typeof e == "object" && !Array.isArray(e);
3667
3678
  }
3668
- function oa(e) {
3679
+ function sa(e) {
3669
3680
  let t = Number(e);
3670
3681
  return Number.isFinite(t) ? t : null;
3671
3682
  }
3672
- function sa(e) {
3673
- return X(e) && X(e.data) && X(e.props) && "structure" in e;
3674
- }
3675
3683
  function ca(e) {
3676
- return X(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
3684
+ return Y(e) && Y(e.data) && Y(e.props) && "structure" in e;
3677
3685
  }
3678
3686
  function la(e) {
3679
- if (!X(e)) return !1;
3680
- let t = Object.entries(e);
3681
- return t.length ? t.every(([e, t]) => oa(e) !== null && ca(t)) : !0;
3687
+ return Y(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
3682
3688
  }
3683
3689
  function ua(e) {
3684
- return typeof e == "string" ? e : null;
3690
+ if (!Y(e)) return !1;
3691
+ let t = Object.entries(e);
3692
+ return t.length ? t.every(([e, t]) => sa(e) !== null && la(t)) : !0;
3685
3693
  }
3686
3694
  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);
3695
+ return typeof e == "string" ? e : null;
3696
+ }
3697
+ function fa(e) {
3698
+ let t = Y(e.props.props) ? e.props.props : {};
3699
+ return da(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
3689
3700
  }
3690
- function fa(e, t, n) {
3701
+ function pa(e, t, n) {
3691
3702
  Object.entries(n).forEach(([n, r]) => {
3692
- let i = oa(n);
3703
+ let i = sa(n);
3693
3704
  i !== null && e.push({
3694
3705
  elementID: i,
3695
3706
  modelID: t,
@@ -3697,29 +3708,29 @@ function fa(e, t, n) {
3697
3708
  });
3698
3709
  });
3699
3710
  }
3700
- function pa(e) {
3701
- if (!e || !X(e)) return [];
3702
- if (sa(e)) {
3711
+ function ma(e) {
3712
+ if (!e || !Y(e)) return [];
3713
+ if (ca(e)) {
3703
3714
  let t = [];
3704
- return fa(t, 0, e.props), t;
3715
+ return pa(t, 0, e.props), t;
3705
3716
  }
3706
- if (la(e)) {
3717
+ if (ua(e)) {
3707
3718
  let t = [];
3708
- return fa(t, 0, e), t;
3719
+ return pa(t, 0, e), t;
3709
3720
  }
3710
3721
  let t = [];
3711
3722
  return Object.entries(e).forEach(([e, n]) => {
3712
- let r = oa(e);
3723
+ let r = sa(e);
3713
3724
  if (r !== null) {
3714
- if (sa(n)) {
3715
- fa(t, r, n.props);
3725
+ if (ca(n)) {
3726
+ pa(t, r, n.props);
3716
3727
  return;
3717
3728
  }
3718
- la(n) && fa(t, r, n);
3729
+ ua(n) && pa(t, r, n);
3719
3730
  }
3720
3731
  }), t;
3721
3732
  }
3722
- function ma(e) {
3733
+ function ha(e) {
3723
3734
  let t = {};
3724
3735
  return e.forEach(({ elementID: e, modelID: n, props: r }) => {
3725
3736
  t[n] ??= [], t[n].push({
@@ -3728,26 +3739,26 @@ function ma(e) {
3728
3739
  });
3729
3740
  }), t;
3730
3741
  }
3731
- function ha(e) {
3742
+ function ga(e) {
3732
3743
  let t = {};
3733
3744
  return e.forEach(({ elementID: e, modelID: n }) => {
3734
3745
  t[n] ??= [], t[n].push(e);
3735
3746
  }), t;
3736
3747
  }
3737
- var ga = class {
3748
+ var _a = class {
3738
3749
  elements;
3739
3750
  filters = [];
3740
3751
  selectedModelIDs = null;
3741
3752
  constructor(e) {
3742
- this.elements = pa(e);
3753
+ this.elements = ma(e);
3743
3754
  }
3744
3755
  from(e) {
3745
- return this.elements = pa(e), this.filters = [], this.selectedModelIDs = null, this;
3756
+ return this.elements = ma(e), this.filters = [], this.selectedModelIDs = null, this;
3746
3757
  }
3747
3758
  ofType(e) {
3748
3759
  let t = new Set((Array.isArray(e) ? e : [e]).map((e) => e.toLowerCase()));
3749
3760
  return this.filters.push((e) => {
3750
- let n = da(e);
3761
+ let n = fa(e);
3751
3762
  return !!(n && t.has(n.toLowerCase()));
3752
3763
  }), this;
3753
3764
  }
@@ -3776,11 +3787,11 @@ var ga = class {
3776
3787
  return this.hasSingleSelectedModel() ? e.map(({ elementID: e, props: t }) => ({
3777
3788
  elementID: e,
3778
3789
  props: t
3779
- })) : ma(e);
3790
+ })) : ha(e);
3780
3791
  }
3781
3792
  toElementsIds() {
3782
3793
  let e = this.getFilteredElements();
3783
- return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : ha(e);
3794
+ return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : ga(e);
3784
3795
  }
3785
3796
  toElementIds() {
3786
3797
  return this.toElementsIds();
@@ -3788,20 +3799,20 @@ var ga = class {
3788
3799
  };
3789
3800
  //#endregion
3790
3801
  //#region src/viewer/api/ViewerApi.ts
3791
- function _a(e) {
3802
+ function va(e) {
3792
3803
  let t = {};
3793
3804
  return Object.entries(e).forEach(([e, n]) => {
3794
3805
  t[Number(e)] = Array.from(n);
3795
3806
  }), t;
3796
3807
  }
3797
- function va(e) {
3808
+ function ya(e) {
3798
3809
  let t = {};
3799
3810
  return Object.entries(e).forEach(([e, n]) => {
3800
3811
  t[Number(e)] = new Set(n);
3801
3812
  }), t;
3802
3813
  }
3803
- function ya(e, t) {
3804
- let n = new na();
3814
+ function ba(e, t) {
3815
+ let n = new ra();
3805
3816
  return {
3806
3817
  camera: {
3807
3818
  fitCamera: () => {
@@ -3912,7 +3923,7 @@ function ya(e, t) {
3912
3923
  },
3913
3924
  geometryUtils: {
3914
3925
  getAllIds: () => t()?.geometryUtils.getAllIds() ?? [],
3915
- getIfcSpacesVisibility: () => t()?.geometryUtils.getIfcSpacesVisibility() ?? !0,
3926
+ getIfcSpacesVisibility: () => t()?.geometryUtils.getIfcSpacesVisibility() ?? !1,
3916
3927
  hideByIds: (e) => {
3917
3928
  t()?.geometryUtils.hideByIds(e);
3918
3929
  },
@@ -3941,16 +3952,16 @@ function ya(e, t) {
3941
3952
  t()?.geometryUtils.toggleIIfcSpacesVisibility();
3942
3953
  }
3943
3954
  },
3944
- properties: Xi(e),
3955
+ properties: Zi(e),
3945
3956
  selector: {
3946
3957
  addSelected: (n, r, i = !0, a = !1) => {
3947
3958
  let o = i || a;
3948
- e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(_a(e.getState().selected), a);
3959
+ e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(va(e.getState().selected), a);
3949
3960
  },
3950
- collector: () => new ga(e.getState().modelProps),
3961
+ collector: () => new _a(e.getState().modelProps),
3951
3962
  getPreselectionColor: () => e.getState().preselectionColor,
3952
3963
  getSelectionColor: () => e.getState().selectionColor,
3953
- getSelected: () => _a(e.getState().selected),
3964
+ getSelected: () => va(e.getState().selected),
3954
3965
  removeSelected: (t, n) => {
3955
3966
  e.getState().removeSelected(t, n);
3956
3967
  },
@@ -3965,7 +3976,7 @@ function ya(e, t) {
3965
3976
  },
3966
3977
  setSelected: (n, r, i = !1, a = !0, o = !1) => {
3967
3978
  let s = a || o;
3968
- e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(_a(e.getState().selected), o);
3979
+ e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(va(e.getState().selected), o);
3969
3980
  }
3970
3981
  },
3971
3982
  utils: {
@@ -4010,7 +4021,7 @@ function ya(e, t) {
4010
4021
  }
4011
4022
  //#endregion
4012
4023
  //#region src/viewer/Loaders/BmtLoader.ts
4013
- var ba = class {
4024
+ var xa = class {
4014
4025
  view;
4015
4026
  offset = 0;
4016
4027
  constructor(e) {
@@ -4030,11 +4041,11 @@ var ba = class {
4030
4041
  eof() {
4031
4042
  return this.offset >= this.view.byteLength;
4032
4043
  }
4033
- }, xa = class {
4044
+ }, Sa = class {
4034
4045
  decodeBuffer(e) {
4035
- return this.textDecoder.decode(Ce.inflate(e));
4046
+ return this.textDecoder.decode(we.inflate(e));
4036
4047
  }
4037
- decoder = Ce;
4048
+ decoder = we;
4038
4049
  textDecoder = new TextDecoder("utf-8");
4039
4050
  ChunkType = {
4040
4051
  PROP: 1,
@@ -4103,7 +4114,7 @@ var ba = class {
4103
4114
  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;
4104
4115
  }
4105
4116
  parseBinaryFile(e, t = {}) {
4106
- let n = new ba(e);
4117
+ let n = new xa(e);
4107
4118
  if (new TextDecoder().decode(n.readBytes(3)) !== "BMT") throw Error("Invalid file");
4108
4119
  let r = n.readUint8();
4109
4120
  console.log(`model version: ${r}`);
@@ -4171,24 +4182,24 @@ var ba = class {
4171
4182
  };
4172
4183
  //#endregion
4173
4184
  //#region src/viewer/workers/BMTWorker.ts?worker
4174
- function Sa(e) {
4185
+ function Ca(e) {
4175
4186
  return new Worker("" + new URL("assets/BMTWorker-yhSXOg2i.js", import.meta.url).href, { name: e?.name });
4176
4187
  }
4177
4188
  //#endregion
4178
4189
  //#region src/viewer/workers/BMTWorkerClient.ts
4179
- function Ca() {
4190
+ function wa() {
4180
4191
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4181
4192
  }
4182
- function wa(e) {
4193
+ function Ta(e) {
4183
4194
  return Array.isArray(e) ? e : [e];
4184
4195
  }
4185
- function Ta(e) {
4196
+ function Ea(e) {
4186
4197
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.bmt";
4187
4198
  }
4188
- function Ea(e) {
4199
+ function Da(e) {
4189
4200
  return typeof e == "string" ? {
4190
4201
  kind: "url",
4191
- name: Ta(e),
4202
+ name: Ea(e),
4192
4203
  url: new URL(e, globalThis.location.href).href
4193
4204
  } : e instanceof File ? {
4194
4205
  file: e,
@@ -4199,18 +4210,18 @@ function Ea(e) {
4199
4210
  kind: "buffer"
4200
4211
  };
4201
4212
  }
4202
- function Da(e) {
4213
+ function Oa(e) {
4203
4214
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4204
4215
  }
4205
- function Oa() {
4206
- return new Sa();
4216
+ function ka() {
4217
+ return new Ca();
4207
4218
  }
4208
- function ka(e) {
4219
+ function Aa(e) {
4209
4220
  return { streamGeometryChunks: e.streamGeometryChunks ?? !!e.onChunk };
4210
4221
  }
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),
4222
+ function ja(e, t = {}) {
4223
+ let n = t.worker ?? ka(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Ta(e).map(Da), o = wa(), s = {}, c = {
4224
+ options: Aa(t),
4214
4225
  sources: a,
4215
4226
  taskId: o,
4216
4227
  type: "load-bmt-model"
@@ -4248,39 +4259,39 @@ function Aa(e, t = {}) {
4248
4259
  let a = Error(r.error.message);
4249
4260
  r.error.stack && (a.stack = r.error.stack), l(a);
4250
4261
  };
4251
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Da(a));
4262
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Oa(a));
4252
4263
  });
4253
4264
  }
4254
- function ja() {
4255
- return Oa();
4265
+ function Ma() {
4266
+ return ka();
4256
4267
  }
4257
4268
  //#endregion
4258
4269
  //#region src/viewer/workers/BmtConverterWorker.ts?worker
4259
- function Ma(e) {
4260
- return new Worker("" + new URL("assets/BmtConverterWorker-S83_KT6j.js", import.meta.url).href, { name: e?.name });
4270
+ function Na(e) {
4271
+ return new Worker("" + new URL("assets/BmtConverterWorker-BHhPlty_.js", import.meta.url).href, { name: e?.name });
4261
4272
  }
4262
4273
  //#endregion
4263
4274
  //#region src/viewer/workers/BmtConverterWorkerClient.ts
4264
- function Na() {
4275
+ function Pa() {
4265
4276
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4266
4277
  }
4267
- function Pa(e) {
4278
+ function Fa(e) {
4268
4279
  return Array.isArray(e) ? e : [e];
4269
4280
  }
4270
- function Fa(e) {
4281
+ function Ia(e) {
4271
4282
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4272
4283
  }
4273
- function Ia() {
4284
+ function La() {
4274
4285
  return globalThis.document?.baseURI ?? globalThis.location.href;
4275
4286
  }
4276
- function La(e) {
4287
+ function Ra(e) {
4277
4288
  let t = e ?? "ifc-parser.wasm";
4278
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, Ia()).href;
4289
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, La()).href;
4279
4290
  }
4280
- function Ra(e) {
4291
+ function za(e) {
4281
4292
  return typeof e == "string" ? {
4282
4293
  kind: "url",
4283
- name: Fa(e),
4294
+ name: Ia(e),
4284
4295
  url: new URL(e, globalThis.location.href).href
4285
4296
  } : e instanceof File ? {
4286
4297
  file: e,
@@ -4291,13 +4302,13 @@ function Ra(e) {
4291
4302
  kind: "buffer"
4292
4303
  };
4293
4304
  }
4294
- function za(e) {
4305
+ function Ba(e) {
4295
4306
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4296
4307
  }
4297
- function Ba() {
4298
- return new Ma();
4308
+ function Va() {
4309
+ return new Na();
4299
4310
  }
4300
- function Va(e) {
4311
+ function Ha(e) {
4301
4312
  return {
4302
4313
  chunk: e.chunk,
4303
4314
  coordinationMatrix: e.coordinationMatrix,
@@ -4309,23 +4320,23 @@ function Va(e) {
4309
4320
  useIfcSpace: e.useIfcSpace,
4310
4321
  useMinVersion: e.useMinVersion,
4311
4322
  visibleIdsByModel: e.visibleIdsByModel,
4312
- wasmPath: La(e.wasmPath)
4323
+ wasmPath: Ra(e.wasmPath)
4313
4324
  };
4314
4325
  }
4315
- function Ha(e) {
4326
+ function Ua(e) {
4316
4327
  let t = new Uint8Array(e.bytes.byteLength);
4317
4328
  return t.set(e.bytes), {
4318
4329
  ...e,
4319
4330
  blob: new Blob([t.buffer], { type: e.mimeType })
4320
4331
  };
4321
4332
  }
4322
- function Ua(e) {
4333
+ function Wa(e) {
4323
4334
  return {
4324
- files: e.result.files.map(Ha),
4335
+ files: e.result.files.map(Ua),
4325
4336
  models: e.result.models
4326
4337
  };
4327
4338
  }
4328
- function Wa(e) {
4339
+ function Ga(e) {
4329
4340
  if (e.error instanceof Error) return e.error;
4330
4341
  let t = [
4331
4342
  e.message || "Unknown worker error",
@@ -4335,12 +4346,12 @@ function Wa(e) {
4335
4346
  ].filter(Boolean);
4336
4347
  return /* @__PURE__ */ Error(`BMT converter worker failed: ${t.join(", ")}`);
4337
4348
  }
4338
- function Ga(e) {
4349
+ function Ka(e) {
4339
4350
  return /* @__PURE__ */ Error(`BMT converter worker response could not be cloned: ${String(e.data ?? "unknown message error")}`);
4340
4351
  }
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),
4352
+ function qa(e, t = {}) {
4353
+ let n = t.worker ?? Va(), r = t.terminateOnComplete ?? !t.worker, i = Fa(e).map(za), a = Pa(), o = {
4354
+ options: Ha(t),
4344
4355
  sources: i,
4345
4356
  taskId: a,
4346
4357
  type: "convert-ifc-to-bmt"
@@ -4349,9 +4360,9 @@ function Ka(e, t = {}) {
4349
4360
  let c = () => {
4350
4361
  n.removeEventListener("message", d), n.removeEventListener("error", l), n.removeEventListener("messageerror", u), r && n.terminate();
4351
4362
  }, l = (e) => {
4352
- c(), s(Wa(e));
4353
- }, u = (e) => {
4354
4363
  c(), s(Ga(e));
4364
+ }, u = (e) => {
4365
+ c(), s(Ka(e));
4355
4366
  }, d = (n) => {
4356
4367
  let r = n.data;
4357
4368
  if (r.taskId !== a) return;
@@ -4360,35 +4371,35 @@ function Ka(e, t = {}) {
4360
4371
  return;
4361
4372
  }
4362
4373
  if (c(), r.type === "complete") {
4363
- e(Ua(r));
4374
+ e(Wa(r));
4364
4375
  return;
4365
4376
  }
4366
4377
  let i = Error(r.error.message);
4367
4378
  r.error.stack && (i.stack = r.error.stack), s(i);
4368
4379
  };
4369
- n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, za(i));
4380
+ n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, Ba(i));
4370
4381
  });
4371
4382
  }
4372
- function qa() {
4373
- return Ba();
4383
+ function Ja() {
4384
+ return Va();
4374
4385
  }
4375
4386
  //#endregion
4376
4387
  //#region src/viewer/workers/IFCWorker.ts?worker
4377
- function Ja(e) {
4378
- return new Worker("" + new URL("assets/IFCWorker-GKoow6yV.js", import.meta.url).href, { name: e?.name });
4388
+ function Ya(e) {
4389
+ return new Worker("" + new URL("assets/IFCWorker-DipGoUKy.js", import.meta.url).href, { name: e?.name });
4379
4390
  }
4380
4391
  //#endregion
4381
4392
  //#region src/viewer/workers/IFCWorkerClient.ts
4382
- function Ya() {
4393
+ function Xa() {
4383
4394
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4384
4395
  }
4385
- function Xa(e) {
4396
+ function Za(e) {
4386
4397
  return Array.isArray(e) ? e : [e];
4387
4398
  }
4388
- function Za(e) {
4399
+ function Qa(e) {
4389
4400
  return typeof e == "string" ? {
4390
4401
  kind: "url",
4391
- name: Qa(e),
4402
+ name: $a(e),
4392
4403
  url: new URL(e, globalThis.location.href).href
4393
4404
  } : e instanceof File ? {
4394
4405
  file: e,
@@ -4399,23 +4410,23 @@ function Za(e) {
4399
4410
  kind: "buffer"
4400
4411
  };
4401
4412
  }
4402
- function Qa(e) {
4413
+ function $a(e) {
4403
4414
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4404
4415
  }
4405
- function $a() {
4416
+ function eo() {
4406
4417
  return globalThis.document?.baseURI ?? globalThis.location.href;
4407
4418
  }
4408
- function eo(e) {
4419
+ function to(e) {
4409
4420
  let t = e ?? "ifc-parser.wasm";
4410
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, $a()).href;
4421
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, eo()).href;
4411
4422
  }
4412
- function to(e) {
4423
+ function no(e) {
4413
4424
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4414
4425
  }
4415
- function no() {
4416
- return new Ja();
4426
+ function ro() {
4427
+ return new Ya();
4417
4428
  }
4418
- function ro(e) {
4429
+ function io(e) {
4419
4430
  return {
4420
4431
  chunk: e.chunk,
4421
4432
  coordinationMatrix: e.coordinationMatrix,
@@ -4424,12 +4435,12 @@ function ro(e) {
4424
4435
  useIfcColors: e.useIfcColors,
4425
4436
  useIfcElementAssembly: e.useIfcElementAssembly,
4426
4437
  useIfcSpace: e.useIfcSpace,
4427
- wasmPath: eo(e.wasmPath)
4438
+ wasmPath: to(e.wasmPath)
4428
4439
  };
4429
4440
  }
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),
4441
+ function ao(e, t = {}) {
4442
+ let n = t.worker ?? ro(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Za(e).map(Qa), o = Xa(), s = {}, c = {
4443
+ options: io(t),
4433
4444
  sources: a,
4434
4445
  taskId: o,
4435
4446
  type: "load-ifc-model"
@@ -4467,36 +4478,36 @@ function io(e, t = {}) {
4467
4478
  let a = Error(r.error.message);
4468
4479
  r.error.stack && (a.stack = r.error.stack), l(a);
4469
4480
  };
4470
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, to(a));
4481
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, no(a));
4471
4482
  });
4472
4483
  }
4473
- function ao() {
4474
- return no();
4484
+ function oo() {
4485
+ return ro();
4475
4486
  }
4476
4487
  //#endregion
4477
4488
  //#region src/viewer/api/loader.ts
4478
- function oo(e) {
4479
- return typeof e == "string" ? e : e.name;
4480
- }
4481
4489
  function so(e) {
4482
- return (oo(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4490
+ return typeof e == "string" ? e : e.name;
4483
4491
  }
4484
4492
  function co(e) {
4485
- let t = oo(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4486
- return n === -1 ? "" : t.slice(n + 1);
4493
+ return (so(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4487
4494
  }
4488
4495
  function lo(e) {
4489
- return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4496
+ let t = so(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4497
+ return n === -1 ? "" : t.slice(n + 1);
4490
4498
  }
4491
4499
  function uo(e) {
4492
- return /_props\.json$/i.test(oo(e).split(/[?#]/)[0]);
4500
+ return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4493
4501
  }
4494
4502
  function fo(e) {
4503
+ return /_props\.json$/i.test(so(e).split(/[?#]/)[0]);
4504
+ }
4505
+ function po(e) {
4495
4506
  return e.coordinationMatrix ? e.coordinationMatrix : Object.values(e.data)[0]?.matrix || void 0;
4496
4507
  }
4497
- var po = new class {
4508
+ var mo = new class {
4498
4509
  coordinationMatrix;
4499
- useIfcSpace = !1;
4510
+ useIfcSpace = !0;
4500
4511
  bmtLoader = null;
4501
4512
  ifcLoader = null;
4502
4513
  loadedModelCount = 0;
@@ -4505,11 +4516,11 @@ var po = new class {
4505
4516
  this.getBmtLoader();
4506
4517
  }
4507
4518
  getBmtLoader() {
4508
- return this.bmtLoader ||= new xa(), this.bmtLoader;
4519
+ return this.bmtLoader ||= new Sa(), this.bmtLoader;
4509
4520
  }
4510
4521
  async getIfcLoader(e = {}) {
4511
4522
  if (!this.ifcLoader) {
4512
- let { IFCLoader: e } = await import("./IFCLoader-RIJas-B5.js");
4523
+ let { IFCLoader: e } = await import("./IFCLoader-Cjkb3xMA.js");
4513
4524
  this.ifcLoader = new e();
4514
4525
  }
4515
4526
  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;
@@ -4533,7 +4544,7 @@ var po = new class {
4533
4544
  async loadBmtModel(e, t) {
4534
4545
  let n = this.getBmtLoader();
4535
4546
  if (typeof e == "string") return n.loadModel(e);
4536
- let r = n.parseBinaryFile(await e.arrayBuffer()), i = lo(e), a = i ? t.get(i) : void 0;
4547
+ let r = n.parseBinaryFile(await e.arrayBuffer()), i = uo(e), a = i ? t.get(i) : void 0;
4537
4548
  return this.applyBmtMetadata(r, a);
4538
4549
  }
4539
4550
  createWorkerProgressHandler(e, t, n, r) {
@@ -4556,7 +4567,7 @@ var po = new class {
4556
4567
  };
4557
4568
  }
4558
4569
  async loadIfcModelInWorker(e, t, n, r, i) {
4559
- return (await io(e, {
4570
+ return (await ao(e, {
4560
4571
  chunk: t.chunk,
4561
4572
  collectChunks: t.collectWorkerChunks,
4562
4573
  coordinationMatrix: this.coordinationMatrix,
@@ -4569,14 +4580,14 @@ var po = new class {
4569
4580
  }))[0];
4570
4581
  }
4571
4582
  async loadBmtModelInWorker(e, t, n, r, i, a) {
4572
- let o = (await Aa(e, {
4583
+ let o = (await ja(e, {
4573
4584
  collectChunks: n.collectWorkerChunks,
4574
4585
  onChunk: this.createWorkerChunkHandler(n, r),
4575
4586
  onProgress: this.createWorkerProgressHandler(n, r, i, a),
4576
4587
  streamGeometryChunks: n.streamGeometryChunks ?? !!n.onChunk
4577
4588
  }))[0];
4578
4589
  if (e instanceof File) {
4579
- let n = lo(e), r = n ? t.get(n) : void 0;
4590
+ let n = uo(e), r = n ? t.get(n) : void 0;
4580
4591
  return this.applyBmtMetadata(o, r);
4581
4592
  }
4582
4593
  return o;
@@ -4584,26 +4595,33 @@ var po = new class {
4584
4595
  resetCoordinationMatrixState() {
4585
4596
  this.coordinationMatrix = void 0, this.ifcLoader?.resetCoordinationMatrix();
4586
4597
  }
4598
+ applyRenderSettings(e, t) {
4599
+ return e.renderSettings = {
4600
+ ...e.renderSettings,
4601
+ materialMode: t.materialMode ?? e.renderSettings?.materialMode,
4602
+ useDoubleSideMaterial: t.useDoubleSideMaterial ?? !1
4603
+ }, e;
4604
+ }
4587
4605
  resetCoordinationMatrix() {
4588
4606
  this.loadedModelCount = 0, this.resetCoordinationMatrixState();
4589
4607
  }
4590
4608
  async loadModel(e, t = {}) {
4591
4609
  this.initLoaders();
4592
- let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !uo(e)).length, o = 0;
4610
+ let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !fo(e)).length, o = 0;
4593
4611
  this.loadedModelCount === 0 && this.resetCoordinationMatrixState();
4594
4612
  for (let e = 0; e < n.length; e++) {
4595
- let s = n[e], c = co(s), l;
4596
- if (c === "json" && uo(s)) continue;
4613
+ let s = n[e], c = lo(s), l;
4614
+ if (c === "json" && fo(s)) continue;
4597
4615
  let u = this.nextModelID, d = o;
4598
4616
  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];
4599
4617
  else if (c === "bmt") l = t.useWorker ? await this.loadBmtModelInWorker(s, r, t, u, d, a) : await this.loadBmtModel(s, r);
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;
4618
+ else throw Error(`Unsupported model format: ${so(s)}`);
4619
+ let f = po(l);
4620
+ !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), this.applyRenderSettings(l, t), l.name ??= co(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4603
4621
  }
4604
4622
  return i;
4605
4623
  }
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 = [
4624
+ }(), 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 = [
4607
4625
  {
4608
4626
  direction: [
4609
4627
  0,
@@ -4619,7 +4637,7 @@ var po = new class {
4619
4637
  scale: [
4620
4638
  Q,
4621
4639
  Q,
4622
- ho
4640
+ X
4623
4641
  ],
4624
4642
  title: "Front",
4625
4643
  type: "face"
@@ -4644,7 +4662,7 @@ var po = new class {
4644
4662
  scale: [
4645
4663
  Q,
4646
4664
  Q,
4647
- ho
4665
+ X
4648
4666
  ],
4649
4667
  title: "Back",
4650
4668
  type: "face"
@@ -4667,7 +4685,7 @@ var po = new class {
4667
4685
  0
4668
4686
  ],
4669
4687
  scale: [
4670
- ho,
4688
+ X,
4671
4689
  Q,
4672
4690
  Q
4673
4691
  ],
@@ -4692,7 +4710,7 @@ var po = new class {
4692
4710
  0
4693
4711
  ],
4694
4712
  scale: [
4695
- ho,
4713
+ X,
4696
4714
  Q,
4697
4715
  Q
4698
4716
  ],
@@ -4718,7 +4736,7 @@ var po = new class {
4718
4736
  ],
4719
4737
  scale: [
4720
4738
  Q,
4721
- ho,
4739
+ X,
4722
4740
  Q
4723
4741
  ],
4724
4742
  title: "Top",
@@ -4743,7 +4761,7 @@ var po = new class {
4743
4761
  ],
4744
4762
  scale: [
4745
4763
  Q,
4746
- ho,
4764
+ X,
4747
4765
  Q
4748
4766
  ],
4749
4767
  title: "Bottom",
@@ -4865,17 +4883,17 @@ function Mo(e, t) {
4865
4883
  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);
4866
4884
  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);
4867
4885
  let u = new b(n);
4868
- return u.colorSpace = le, u.generateMipmaps = !1, u.magFilter = j, u.minFilter = j, u.needsUpdate = !0, {
4886
+ return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
4869
4887
  aspect: c / l,
4870
4888
  texture: u
4871
4889
  };
4872
4890
  }
4873
4891
  function No({ color: e, label: t, position: n, rotation: r }) {
4874
4892
  let { aspect: i, texture: a } = c(() => Mo(t, e), [e, t]);
4875
- return o(() => () => a.dispose(), [a]), /* @__PURE__ */ z("mesh", {
4893
+ return o(() => () => a.dispose(), [a]), /* @__PURE__ */ R("mesh", {
4876
4894
  position: n,
4877
4895
  rotation: r,
4878
- children: [/* @__PURE__ */ R("planeGeometry", { args: [wo * i, wo] }), /* @__PURE__ */ R("meshBasicMaterial", {
4896
+ children: [/* @__PURE__ */ L("planeGeometry", { args: [wo * i, wo] }), /* @__PURE__ */ L("meshBasicMaterial", {
4879
4897
  alphaTest: .1,
4880
4898
  depthWrite: !1,
4881
4899
  map: a,
@@ -4885,17 +4903,17 @@ function No({ color: e, label: t, position: n, rotation: r }) {
4885
4903
  });
4886
4904
  }
4887
4905
  function Po(e) {
4888
- return Math.abs(e.y) > .9 ? new L(0, 0, e.y > 0 ? -1 : 1) : new L(0, 1, 0);
4906
+ return Math.abs(e.y) > .9 ? new I(0, 0, e.y > 0 ? -1 : 1) : new I(0, 1, 0);
4889
4907
  }
4890
4908
  function Fo(e, t) {
4891
4909
  let n = e.current;
4892
4910
  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), $);
4893
4911
  }
4894
4912
  function Io(e) {
4895
- return e.current?.getTarget(new L()) ?? new L();
4913
+ return e.current?.getTarget(new I()) ?? new I();
4896
4914
  }
4897
4915
  function Lo({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
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);
4916
+ 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);
4899
4917
  t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
4900
4918
  endPosition: d,
4901
4919
  endTarget: s,
@@ -4908,7 +4926,7 @@ function Lo({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef
4908
4926
  }
4909
4927
  function Ro({ action: e, onPick: t }) {
4910
4928
  let [n, r] = u(!1);
4911
- return /* @__PURE__ */ z("group", {
4929
+ return /* @__PURE__ */ R("group", {
4912
4930
  position: e.position,
4913
4931
  onClick: ko,
4914
4932
  onPointerDown: (n) => {
@@ -4920,18 +4938,18 @@ function Ro({ action: e, onPick: t }) {
4920
4938
  onPointerLeave: (e) => {
4921
4939
  ko(e), r(!1);
4922
4940
  },
4923
- children: [/* @__PURE__ */ z("mesh", {
4941
+ children: [/* @__PURE__ */ R("mesh", {
4924
4942
  scale: e.scale,
4925
- children: [/* @__PURE__ */ R("boxGeometry", { args: [
4943
+ children: [/* @__PURE__ */ L("boxGeometry", { args: [
4926
4944
  1,
4927
4945
  1,
4928
4946
  1
4929
- ] }), /* @__PURE__ */ R("meshBasicMaterial", {
4947
+ ] }), /* @__PURE__ */ L("meshBasicMaterial", {
4930
4948
  color: Ao(n),
4931
4949
  opacity: jo(n),
4932
4950
  transparent: !0
4933
4951
  })]
4934
- }), e.label && /* @__PURE__ */ R(No, {
4952
+ }), e.label && /* @__PURE__ */ L(No, {
4935
4953
  color: n ? "#ffffff" : "#50606f",
4936
4954
  label: e.label,
4937
4955
  position: [
@@ -4958,14 +4976,14 @@ function zo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4958
4976
  if (!o) return;
4959
4977
  let s = performance.now() - o.startTime, c = Math.min(s / So, 1), l = 1 - (1 - c) ** 3, u = n.current;
4960
4978
  if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
4961
- let e = new L().lerpVectors(o.startTarget, o.endTarget, l);
4979
+ let e = new I().lerpVectors(o.startTarget, o.endTarget, l);
4962
4980
  u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
4963
4981
  } else r.lookAt(o.endTarget);
4964
4982
  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);
4965
- }), e ? /* @__PURE__ */ R("group", {
4983
+ }), e ? /* @__PURE__ */ L("group", {
4966
4984
  ref: i,
4967
4985
  scale: bo,
4968
- children: o.map((e) => /* @__PURE__ */ R(Ro, {
4986
+ children: o.map((e) => /* @__PURE__ */ L(Ro, {
4969
4987
  action: e,
4970
4988
  onPick: (e) => {
4971
4989
  let i = t.current;
@@ -5013,27 +5031,37 @@ var Bo = class {
5013
5031
  }, Wo = {
5014
5032
  alpha: !0,
5015
5033
  antialias: !0
5016
- }, Go = .1, Ko = .02, qo = 1e3, Jo = 50, Yo = .08, Xo = new g(), Zo = new ue(), Qo = new L();
5017
- function $o() {
5034
+ }, Go = {
5035
+ alpha: !0,
5036
+ antialias: !1,
5037
+ powerPreference: "high-performance"
5038
+ }, Ko = {
5039
+ antialias: !1,
5040
+ powerPreference: "high-performance"
5041
+ }, qo = .1, Jo = .02, Yo = 1e3, Xo = 50, Zo = .08, Qo = new g(), $o = new de(), es = new I();
5042
+ function ts(e, t) {
5043
+ return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
5044
+ }
5045
+ function ns() {
5018
5046
  let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
5019
5047
  return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
5020
5048
  }
5021
- function es(e) {
5022
- let t = ts(e);
5023
- return t ? Math.max(t.radius * Ko, Go) : Go;
5049
+ function rs(e) {
5050
+ let t = is(e);
5051
+ return t ? Math.max(t.radius * Jo, qo) : qo;
5024
5052
  }
5025
- function ts(e) {
5026
- if (!e || (Xo.setFromObject(e), Xo.isEmpty())) return null;
5027
- let t = Xo.getBoundingSphere(Zo);
5053
+ function is(e) {
5054
+ if (!e || (Qo.setFromObject(e), Qo.isEmpty())) return null;
5055
+ let t = Qo.getBoundingSphere($o);
5028
5056
  return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
5029
5057
  }
5030
- function ns(e, t) {
5031
- let n = ts(t);
5058
+ function as(e, t) {
5059
+ let n = is(t);
5032
5060
  if (!n) return;
5033
- let r = Math.max(qo, n.radius * Jo, e.near + 1);
5061
+ let r = Math.max(Yo, n.radius * Xo, e.near + 1);
5034
5062
  Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
5035
5063
  }
5036
- function rs(e, t, n, r, i) {
5064
+ function os(e, t, n, r, i) {
5037
5065
  let a = n.elementIndex.get(i);
5038
5066
  a && a.forEach((n) => {
5039
5067
  let { record: i, vertexRanges: a } = n;
@@ -5045,56 +5073,56 @@ function rs(e, t, n, r, i) {
5045
5073
  }));
5046
5074
  });
5047
5075
  }
5048
- function is(e, t) {
5049
- let n = new g(), r = new L();
5076
+ function ss(e, t) {
5077
+ let n = new g(), r = new I();
5050
5078
  return Object.entries(e).forEach(([e, i]) => {
5051
5079
  let a = Number(e);
5052
5080
  i.forEach((e) => {
5053
- rs(n, r, t, a, e);
5081
+ os(n, r, t, a, e);
5054
5082
  });
5055
5083
  }), n.isEmpty() ? null : n;
5056
5084
  }
5057
- function as(e) {
5058
- let t = e.getSize(Qo), n = Math.max(t.x, t.y, t.z);
5059
- return Number.isFinite(n) && n > 0 ? n * Yo : Go;
5085
+ function cs(e) {
5086
+ let t = e.getSize(es), n = Math.max(t.x, t.y, t.z);
5087
+ return Number.isFinite(n) && n > 0 ? n * Zo : qo;
5060
5088
  }
5061
- function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelRef: a, modelsData: s, onReady: u, publicApi: d, setSceneApi: f }) {
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(() => {
5063
- let e = Object.keys(s).sort((e, t) => Number(e) - Number(t));
5089
+ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materialMode: a, modelRef: s, modelsData: u, onReady: d, publicApi: f, setSceneApi: g }) {
5090
+ let _ = p((e) => e.camera), v = p((e) => e.gl), y = Mt(s), b = Ut(y), { colorPaletteTexture: x, colorUtils: S } = Ge(y), C = Bn(s), w = vn(s, n, C), T = Nn(s, n, C), E = c(() => new ra(), []), D = b.buildIndex, ee = y.resetIndex, te = S.applyStoredColors, ne = Fr(), O = l(null), k = l(!1), A = z((e) => e.showStats), re = c(() => {
5091
+ let e = Object.keys(u).sort((e, t) => Number(e) - Number(t));
5064
5092
  for (let t of e) {
5065
- let e = xt(s[Number(t)]);
5093
+ let e = St(u[Number(t)]);
5066
5094
  if (e) return e;
5067
5095
  }
5068
5096
  return null;
5069
- }, [s]), ne = c(() => yt(j ?? void 0), [j]), M = c(() => Object.entries(s).map(([e, t]) => [Number(e), t]), [s]), N = i(() => {
5070
- n.current && (n.current.minDistance = es(a.current));
5071
- }, [n, a]), P = i((e) => {
5097
+ }, [u]), j = c(() => bt(re ?? void 0), [re]), M = c(() => Object.entries(u).map(([e, t]) => [Number(e), t]), [u]), N = i(() => {
5098
+ n.current && (n.current.minDistance = rs(s.current));
5099
+ }, [n, s]), P = i((e) => {
5072
5100
  let t = n.current;
5073
5101
  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);
5102
+ }, [n]), ie = i((e) => {
5103
+ O.current = e.clone(), P(e);
5104
+ }, [P]), ae = i(() => {
5105
+ O.current = null, ne(s, n, r);
5078
5106
  }, [
5079
5107
  n,
5080
- O,
5108
+ ne,
5081
5109
  r,
5082
- a
5083
- ]), ie = i((e, t = !1) => {
5110
+ s
5111
+ ]), ce = i((e, t = !1) => {
5084
5112
  let r = n.current;
5085
5113
  if (!r) return;
5086
- let i = is(e, v.buildIndex());
5114
+ let i = ss(e, y.buildIndex());
5087
5115
  if (!i) return;
5088
- let a = i.getCenter(new L());
5089
- if (k.current = a.clone(), r.cancel(), t) {
5090
- let e = as(i);
5116
+ let a = i.getCenter(new I());
5117
+ if (O.current = a.clone(), r.cancel(), t) {
5118
+ let e = cs(i);
5091
5119
  r.fitToBox(i, !0, {
5092
5120
  paddingBottom: e,
5093
5121
  paddingLeft: e,
5094
5122
  paddingRight: e,
5095
5123
  paddingTop: e
5096
5124
  }).then(() => {
5097
- let e = k.current;
5125
+ let e = O.current;
5098
5126
  e && r.setOrbitPoint(e.x, e.y, e.z);
5099
5127
  });
5100
5128
  return;
@@ -5103,141 +5131,141 @@ function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
5103
5131
  }, [
5104
5132
  P,
5105
5133
  n,
5106
- v
5107
- ]), se = c(() => {
5134
+ y
5135
+ ]), le = c(() => {
5108
5136
  let e = (e) => ({
5109
5137
  ...e,
5110
- activeViewRoot: a.current
5138
+ activeViewRoot: s.current
5111
5139
  });
5112
5140
  return {
5113
- convertIfcFileToBmt: (e, t) => T.ConvertIfcFileToBmt(e, t),
5114
- convertToBmt: (t) => T.ConvertToBmt(s, e(t))
5141
+ convertIfcFileToBmt: (e, t) => E.ConvertIfcFileToBmt(e, t),
5142
+ convertToBmt: (t) => E.ConvertToBmt(u, e(t))
5115
5143
  };
5116
5144
  }, [
5117
- T,
5118
- a,
5119
- s
5145
+ E,
5146
+ s,
5147
+ u
5120
5148
  ]);
5121
- return jr(a, n, S, re), Pn(), o(() => {
5122
- let e = _.domElement, t = (e) => {
5123
- let t = k.current;
5149
+ return Mr(s, n, C, ie), Fn(), o(() => {
5150
+ let e = v.domElement, t = (e) => {
5151
+ let t = O.current;
5124
5152
  t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || P(t));
5125
5153
  };
5126
5154
  return e.addEventListener("pointerdown", t, !0), () => {
5127
5155
  e.removeEventListener("pointerdown", t, !0);
5128
5156
  };
5129
- }, [P, _]), o(() => (S.setClippingSource(C), () => {
5130
- S.setClippingSource(null);
5131
- }), [S, C]), o(() => (t.current = g, () => {
5132
- t.current === g && (t.current = null);
5133
- }), [g, t]), o(() => {
5134
- if (!a.current) return;
5157
+ }, [P, v]), o(() => (C.setClippingSource(w), () => {
5158
+ C.setClippingSource(null);
5159
+ }), [C, w]), o(() => (t.current = _, () => {
5160
+ t.current === _ && (t.current = null);
5161
+ }), [_, t]), o(() => {
5162
+ if (!s.current) return;
5135
5163
  let t = requestAnimationFrame(() => {
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();
5164
+ s.current?.updateMatrixWorld(!0), (_ instanceof se || _ instanceof oe) && as(_, s.current), N(), ee(), D(), te(), w.syncWithModel(), T.syncWithModel(), e && ae();
5137
5165
  });
5138
5166
  return () => cancelAnimationFrame(t);
5139
5167
  }, [
5140
- ee,
5168
+ te,
5141
5169
  e,
5142
- E,
5143
- g,
5144
- C,
5145
- n,
5170
+ D,
5171
+ _,
5146
5172
  w,
5147
- F,
5173
+ n,
5174
+ T,
5175
+ ae,
5148
5176
  r,
5149
- a,
5150
5177
  s,
5151
- D,
5178
+ u,
5179
+ ee,
5152
5180
  N
5153
5181
  ]), o(() => {
5154
5182
  let e = () => {
5155
- !C.getActive() || !C.getEdgesActive() || C.updateEdges();
5183
+ !w.getActive() || !w.getEdgesActive() || w.updateEdges();
5156
5184
  }, t = (t) => {
5157
5185
  t(), e();
5158
5186
  };
5159
- return f({
5187
+ return g({
5160
5188
  camera: {
5161
- fitCamera: F,
5162
- getIntersection: S.getIntersection
5189
+ fitCamera: ae,
5190
+ getIntersection: C.getIntersection
5163
5191
  },
5164
5192
  clipping: {
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
5193
+ createClippingRectangle: w.createClippingRectangle,
5194
+ createPlane: w.createPlane,
5195
+ deleteAllPlanes: w.deleteAllPlanes,
5196
+ getActive: w.getActive,
5197
+ getEdgesActive: w.getEdgesActive,
5198
+ getHelpersActive: w.getHelpersActive,
5199
+ getPlanes: w.getPlanes,
5200
+ setActive: w.setActive,
5201
+ setEdgesActive: w.setEdgesActive,
5202
+ setHelpersActive: w.setHelpersActive,
5203
+ toggle: w.toggle,
5204
+ updateEdges: w.updateEdges,
5205
+ updateMaterials: w.updateMaterials
5178
5206
  },
5179
5207
  colors: {
5180
- clearAllColors: x.clearAllColors,
5181
- clearColor: x.clearColor,
5182
- clearModelColors: x.clearModelColors,
5183
- rebuildByColors: x.rebuildByColors,
5184
- rebuildModelByColors: x.rebuildModelByColors,
5185
- setColor: x.setColor
5208
+ clearAllColors: S.clearAllColors,
5209
+ clearColor: S.clearColor,
5210
+ clearModelColors: S.clearModelColors,
5211
+ rebuildByColors: S.rebuildByColors,
5212
+ rebuildModelByColors: S.rebuildModelByColors,
5213
+ setColor: S.setColor
5186
5214
  },
5187
- converter: se,
5215
+ converter: le,
5188
5216
  dimensions: {
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
5217
+ cancelDrawing: T.cancelDrawing,
5218
+ changeAxes: T.changeAxes,
5219
+ delete: T.delete,
5220
+ deleteAll: T.deleteAll,
5221
+ getActive: T.getActive,
5222
+ getDimensions: T.getDimensions,
5223
+ getSnapDistance: T.getSnapDistance,
5224
+ getUnit: T.getUnit,
5225
+ setActive: T.setActive,
5226
+ setColor: T.setColor,
5227
+ setEndpointScaleFactor: T.setEndpointScaleFactor,
5228
+ setSnapDistance: T.setSnapDistance,
5229
+ setUnit: T.setUnit,
5230
+ setWidth: T.setWidth,
5231
+ toggle: T.toggle
5204
5232
  },
5205
5233
  geometryUtils: {
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)
5234
+ getAllIds: b.getAllIds,
5235
+ getIfcSpacesVisibility: b.getIfcSpacesVisibility,
5236
+ hideByIds: (e) => t(() => b.hideByIds(e)),
5237
+ hideSelected: () => t(b.hideSelected),
5238
+ isolateByIds: (e) => t(() => b.isolateByIds(e)),
5239
+ isolateSelected: () => t(b.isolateSelected),
5240
+ resetIsolation: () => t(b.resetIsolation),
5241
+ setIfcSpacesVisibility: (e) => t(() => b.setIfcSpacesVisibility(e)),
5242
+ showAll: () => t(b.showAll),
5243
+ showByIds: (e) => t(() => b.showByIds(e)),
5244
+ toggleIIfcSpacesVisibility: () => t(b.toggleIIfcSpacesVisibility)
5217
5245
  },
5218
- selector: { setTargetToSelection: ie }
5219
- }), A.current || (A.current = !0, u?.(d)), () => f(null);
5246
+ selector: { setTargetToSelection: ce }
5247
+ }), k.current || (k.current = !0, d?.(f)), () => g(null);
5220
5248
  }, [
5249
+ w,
5221
5250
  C,
5222
5251
  S,
5223
- x,
5224
5252
  n,
5225
- se,
5226
- w,
5227
- F,
5228
- y,
5253
+ le,
5254
+ T,
5255
+ ae,
5256
+ b,
5229
5257
  r,
5230
- a,
5231
- u,
5258
+ s,
5232
5259
  d,
5233
5260
  f,
5234
- ie
5235
- ]), /* @__PURE__ */ z(Se, { children: [
5236
- /* @__PURE__ */ R("ambientLight", {
5261
+ g,
5262
+ ce
5263
+ ]), /* @__PURE__ */ R(Ce, { children: [
5264
+ /* @__PURE__ */ L("ambientLight", {
5237
5265
  intensity: 1.2,
5238
5266
  color: "#ffffff"
5239
5267
  }),
5240
- /* @__PURE__ */ R("directionalLight", {
5268
+ /* @__PURE__ */ L("directionalLight", {
5241
5269
  ref: r,
5242
5270
  position: [
5243
5271
  10,
@@ -5247,59 +5275,60 @@ function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
5247
5275
  color: "#ffffff",
5248
5276
  intensity: 2
5249
5277
  }),
5250
- te && /* @__PURE__ */ R(h, {}),
5251
- /* @__PURE__ */ R("group", {
5252
- ref: a,
5253
- children: M.map(([e, t]) => /* @__PURE__ */ R(Ct, {
5254
- colorPaletteTexture: b,
5255
- coordinationMatrix: ne,
5278
+ A && /* @__PURE__ */ L(h, {}),
5279
+ /* @__PURE__ */ L("group", {
5280
+ ref: s,
5281
+ children: M.map(([e, t]) => /* @__PURE__ */ L(wt, {
5282
+ colorPaletteTexture: x,
5283
+ coordinationMatrix: j,
5256
5284
  data: t,
5285
+ materialMode: a,
5257
5286
  modelID: e
5258
5287
  }, e))
5259
5288
  }),
5260
- /* @__PURE__ */ R(m, {
5289
+ /* @__PURE__ */ L(m, {
5261
5290
  dollyToCursor: !0,
5262
5291
  draggingSmoothTime: .04,
5263
5292
  infinityDolly: !0,
5264
- minDistance: Go,
5293
+ minDistance: qo,
5265
5294
  ref: n,
5266
5295
  smoothTime: .12
5267
5296
  })
5268
5297
  ] });
5269
5298
  }
5270
- function ss({ autoFitCamera: e = !0, camera: t = {
5299
+ function us({ autoFitCamera: e = !0, camera: t = {
5271
5300
  position: [
5272
5301
  10,
5273
5302
  10,
5274
5303
  10
5275
5304
  ],
5276
5305
  fov: 50
5277
- }, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, onReady: s, publicApi: c, setSceneApi: f, showNavCube: p, showStats: m }) {
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;
5306
+ }, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, materialMode: s, onReady: c, performanceMode: f = !1, publicApi: p, setSceneApi: m, showNavCube: h, showStats: g }) {
5307
+ let _ = l(null), v = l(null), y = l(null), b = l(null), [x, S] = u(), C = Ee(), w = z((e) => e.setModelNames), T = z((e) => e.setModelProps), E = z((e) => e.setModelStructure), D = z((e) => e.setShowNavCube), ee = z((e) => e.setShowStats), te = z((e) => e.setUserDevice), ne = z((e) => e.showNavCube), O = a ?? x, k = f ? ts(n, 1) : n, A = s ?? (f ? "performance" : void 0);
5279
5308
  return o(() => {
5280
- D($o());
5281
- }, [D]), o(() => {
5282
- E(!!m);
5283
- }, [E, m]), o(() => {
5284
- p !== void 0 && T(p);
5285
- }, [T, p]), o(() => {
5309
+ te(ns());
5310
+ }, [te]), o(() => {
5311
+ ee(!!g);
5312
+ }, [ee, g]), o(() => {
5313
+ h !== void 0 && D(h);
5314
+ }, [D, h]), o(() => {
5286
5315
  let e = {}, t = {}, n = {};
5287
5316
  O && Object.entries(O).forEach(([r, i]) => {
5288
5317
  let a = Number(r);
5289
5318
  i.name !== void 0 && (e[a] = i.name), i.props !== void 0 && (t[a] = i.props), i.structure !== void 0 && (n[a] = i.structure);
5290
- }), S(e), C(t), w(n);
5319
+ }), w(e), T(t), E(n);
5291
5320
  }, [
5292
5321
  O,
5293
- S,
5294
- C,
5295
- w
5322
+ w,
5323
+ T,
5324
+ E
5296
5325
  ]), o(() => {
5297
5326
  if (a) return;
5298
5327
  let e = i ?? r;
5299
5328
  if (!e?.length) return;
5300
5329
  let t = !0;
5301
- return po.loadModel(e).then((e) => {
5302
- t && b(e);
5330
+ return mo.loadModel(e).then((e) => {
5331
+ t && S(e);
5303
5332
  }), () => {
5304
5333
  t = !1;
5305
5334
  };
@@ -5307,69 +5336,71 @@ function ss({ autoFitCamera: e = !0, camera: t = {
5307
5336
  a,
5308
5337
  i,
5309
5338
  r
5310
- ]), O ? /* @__PURE__ */ z("div", {
5339
+ ]), O ? /* @__PURE__ */ R("div", {
5311
5340
  style: Ho,
5312
- children: [/* @__PURE__ */ R(d, {
5341
+ children: [/* @__PURE__ */ L(d, {
5313
5342
  camera: t,
5314
- dpr: n,
5315
- children: /* @__PURE__ */ R(Fr, {
5316
- store: x,
5317
- children: /* @__PURE__ */ R(os, {
5343
+ dpr: k,
5344
+ gl: f ? Ko : void 0,
5345
+ children: /* @__PURE__ */ L(Ir, {
5346
+ store: C,
5347
+ children: /* @__PURE__ */ L(ls, {
5318
5348
  autoFitCamera: e,
5319
- cameraRef: h,
5320
- controlRef: g,
5321
- lightRef: v,
5322
- modelRef: _,
5349
+ cameraRef: _,
5350
+ controlRef: v,
5351
+ lightRef: b,
5352
+ materialMode: A,
5353
+ modelRef: y,
5323
5354
  modelsData: O,
5324
- onReady: s,
5325
- publicApi: c,
5326
- setSceneApi: f
5355
+ onReady: c,
5356
+ publicApi: p,
5357
+ setSceneApi: m
5327
5358
  })
5328
5359
  })
5329
- }), ee && /* @__PURE__ */ R("div", {
5360
+ }), ne && /* @__PURE__ */ L("div", {
5330
5361
  style: Vo,
5331
- children: /* @__PURE__ */ R(d, {
5362
+ children: /* @__PURE__ */ L(d, {
5332
5363
  camera: Uo,
5333
- dpr: n,
5334
- gl: Wo,
5364
+ dpr: k,
5365
+ gl: f ? Go : Wo,
5335
5366
  orthographic: !0,
5336
- children: /* @__PURE__ */ R(zo, {
5367
+ children: /* @__PURE__ */ L(zo, {
5337
5368
  active: !0,
5338
- cameraRef: h,
5339
- controlRef: g,
5340
- modelRef: _
5369
+ cameraRef: _,
5370
+ controlRef: v,
5371
+ modelRef: y
5341
5372
  })
5342
5373
  })
5343
5374
  })]
5344
- }) : /* @__PURE__ */ R(Se, {});
5375
+ }) : /* @__PURE__ */ L(Ce, {});
5345
5376
  }
5346
- var cs = n(function(e, t) {
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) => {
5377
+ var ds = n(function(e, t) {
5378
+ let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Bo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
5348
5379
  d.set(e);
5349
- }, [d]), g = c(() => ya(n, d.get), [d, n]);
5380
+ }, [d]), g = c(() => ba(n, d.get), [d, n]);
5350
5381
  return s(t, () => g, [g]), o(() => (n.getState().setApi(g), () => {
5351
5382
  n.getState().api === g && n.getState().setApi(null);
5352
5383
  }), [g, n]), o(() => {
5353
- r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(va(f)));
5384
+ r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(ya(f)));
5354
5385
  }, [
5355
5386
  m,
5356
5387
  f,
5357
5388
  n
5358
5389
  ]), o(() => {
5359
- m !== void 0 && (a.current = !0, n.getState().setSelection(va(m)), a.current = !1);
5390
+ m !== void 0 && (a.current = !0, n.getState().setSelection(ya(m)), a.current = !1);
5360
5391
  }, [m, n]), o(() => {
5361
5392
  if (p) return n.subscribe((e, t) => {
5362
- e.selected !== t.selected && (a.current || p(_a(e.selected)));
5393
+ e.selected !== t.selected && (a.current || p(va(e.selected)));
5363
5394
  });
5364
- }, [p, n]), /* @__PURE__ */ R(Fr, {
5395
+ }, [p, n]), /* @__PURE__ */ L(Ir, {
5365
5396
  store: n,
5366
- children: /* @__PURE__ */ R(ss, {
5397
+ children: /* @__PURE__ */ L(us, {
5367
5398
  ...e,
5368
5399
  publicApi: g,
5369
5400
  setSceneApi: h
5370
5401
  })
5371
5402
  });
5372
5403
  });
5373
- cs.displayName = "Viewer";
5404
+ ds.displayName = "Viewer";
5374
5405
  //#endregion
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 };
5406
+ 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, ds 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 };