bimatter-viewer-react 0.5.11 → 0.5.13

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