viral-viewer-2 7.2.2 → 7.2.4

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/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { Vector3 as E, Box3 as z, Mesh as y, BufferAttribute as L, BufferGeometry as Z, EdgesGeometry as Et, MeshBasicMaterial as G, PointLight as Nt, Object3D as $t, InstancedMesh as oe, Color as B, InstancedBufferAttribute as wt, Matrix4 as ne, LineSegments as yt, Line as mt, Points as St, Clock as ti, AnimationMixer as ii, Vector2 as N, Vector4 as si, Quaternion as ni, Spherical as jt, Sphere as Ht, Raycaster as Tt, MathUtils as ri, PerspectiveCamera as He, OrthographicCamera as Ct, Euler as ai, MeshPhongMaterial as gt, FrontSide as oi, MeshStandardMaterial as J, DoubleSide as ee, ObjectLoader as li, WebGLRenderTarget as ue, DepthTexture as At, UnsignedShortType as _t, ShaderMaterial as le, MeshNormalMaterial as ci, RGBAFormat as Wt, HalfFloatType as Ft, NearestFilter as Ot, Scene as ft, WebGLRenderer as Gt, SRGBColorSpace as hi, VSMShadowMap as di, SphereGeometry as Dt, DirectionalLight as ut, AmbientLight as ui, CameraHelper as pi, BoxGeometry as Pt, AxesHelper as mi, BoxHelper as gi, Box3Helper as fi, PlaneGeometry as ae, Plane as he, Fog as vi, PointsMaterial as bi, LOD as wi, TextureLoader as yi, CanvasTexture as Rt, SpriteMaterial as Lt, Sprite as kt, LineBasicMaterial as xi } from "three";
1
+ import { Vector3 as E, Box3 as z, Mesh as y, BufferAttribute as L, BufferGeometry as J, EdgesGeometry as Et, MeshBasicMaterial as G, PointLight as Nt, Object3D as $t, InstancedMesh as oe, Color as B, InstancedBufferAttribute as wt, Matrix4 as ne, LineSegments as yt, Line as mt, Points as St, Clock as ti, AnimationMixer as ii, Vector2 as N, Vector4 as si, Quaternion as ni, Spherical as jt, Sphere as Ht, Raycaster as Pt, MathUtils as ri, PerspectiveCamera as He, OrthographicCamera as Ct, Euler as ai, MeshPhongMaterial as gt, FrontSide as oi, MeshStandardMaterial as K, DoubleSide as ee, ObjectLoader as li, WebGLRenderTarget as ue, DepthTexture as At, UnsignedShortType as _t, ShaderMaterial as le, MeshNormalMaterial as ci, RGBAFormat as Wt, HalfFloatType as Ft, NearestFilter as Ot, Scene as ft, WebGLRenderer as Gt, SRGBColorSpace as hi, VSMShadowMap as di, SphereGeometry as Dt, DirectionalLight as ut, AmbientLight as ui, CameraHelper as pi, BoxGeometry as Tt, AxesHelper as mi, BoxHelper as gi, Box3Helper as fi, PlaneGeometry as ae, Plane as he, Fog as vi, PointsMaterial as bi, LOD as wi, TextureLoader as yi, CanvasTexture as Rt, SpriteMaterial as Lt, Sprite as kt, LineBasicMaterial as xi } from "three";
2
2
  import { SimplifyModifier as Mi } from "three/examples/jsm/modifiers/SimplifyModifier";
3
3
  import { LineSegmentsGeometry as Ut, LineSegments2 as qt, SSAARenderPass as Ei, FXAAShader as Si, TAARenderPass as Ci, SAOPass as Ai, SSAOPass as pt } from "three/examples/jsm/Addons";
4
- import { computeBoundsTree as _i, disposeBoundsTree as Vi, acceleratedRaycast as Ii } from "three-mesh-bvh";
4
+ import { computeBoundsTree as _i, disposeBoundsTree as Ii, acceleratedRaycast as Vi } from "three-mesh-bvh";
5
5
  import pe from "camera-controls";
6
- import { inflate as Ti, Inflate as Pi } from "pako";
6
+ import { inflate as Pi, Inflate as Ti } from "pako";
7
7
  import { Potree as Oi, PointSizeType as Di, PointShape as Ri, PointColorType as Li } from "potree-core-viral";
8
8
  import { GLTFLoader as ki } from "three/examples/jsm/loaders/GLTFLoader";
9
9
  import { LineMaterial as Qt } from "three/examples/jsm/lines/LineMaterial";
@@ -123,7 +123,7 @@ class D {
123
123
  }
124
124
  }
125
125
  const Qi = D.hexToRGB(x.accent);
126
- class Y extends y {
126
+ class Z extends y {
127
127
  constructor(e, t, i) {
128
128
  super(e, t), this.globalMaterialIndex = -1, this.workerPool = null, this._depthPrePassMesh = null, this._bufferElements = [], this._colors = null, this._originalColor = null, this._elementMap = /* @__PURE__ */ new Map(), this._isBatching = !1, this._batchQueue = [], this._isProcessingQueue = !1, this._edgeLines = null, this._edgeRanges = /* @__PURE__ */ new Map(), this._edgeThreshold = 60, this._edgeMaterial = null, this._selectedElements = [], this._hidingElements = [], this._isolatingElements = [], this._hiddenSet = /* @__PURE__ */ new Set(), this._isolatedSet = /* @__PURE__ */ new Set(), this._elementOpacityMap = /* @__PURE__ */ new Map(), this._isRGBAMode = !1, this._elementOriginalColors = /* @__PURE__ */ new Map(), this._temporaryColors = /* @__PURE__ */ new Map(), this._isGeneratedLights = !1, this._pointLight = null, this.workerPool = i || null;
129
129
  }
@@ -329,7 +329,7 @@ class Y extends y {
329
329
  if (this._edgeLines && (this.remove(this._edgeLines), this._edgeLines.geometry.dispose(), this._edgeLines = null), this._edgeRanges.clear(), !this._edgeMaterial)
330
330
  return;
331
331
  let e = 0;
332
- const t = new Z();
332
+ const t = new J();
333
333
  for (const o of this._bufferElements) {
334
334
  const a = o.buffer;
335
335
  if (!a || a.length < 9)
@@ -350,7 +350,7 @@ class Y extends y {
350
350
  const a = o.buffer;
351
351
  if (!a || a.length < 9)
352
352
  continue;
353
- const l = new Z();
353
+ const l = new J();
354
354
  l.setAttribute("position", new L(a, 3));
355
355
  const c = Math.floor(a.length / 3 / 3), h = new Uint32Array(c * 3);
356
356
  for (let b = 0; b < c; b++) {
@@ -1043,7 +1043,7 @@ class Y extends y {
1043
1043
  o,
1044
1044
  100
1045
1045
  // Process 100 elements at a time
1046
- ), l = new Y(
1046
+ ), l = new Z(
1047
1047
  void 0,
1048
1048
  Array.isArray(this.material) ? this.material[0] : this.material,
1049
1049
  this.workerPool
@@ -1150,7 +1150,93 @@ class te {
1150
1150
  this._workers.forEach((e) => e.dispose()), this._workers = [], this._free = [], this._busy = {}, this._queue = [];
1151
1151
  }
1152
1152
  }
1153
- const Yi = D.hexToRGB(x.accent), Fe = class Fe extends $t {
1153
+ function Yi() {
1154
+ self.onmessage = (g) => {
1155
+ const {
1156
+ bufferElements: e,
1157
+ selectedKeys: t
1158
+ } = g.data, i = new Set(t);
1159
+ let s = 0;
1160
+ for (const o of e) {
1161
+ const a = new Float32Array(o.buffer);
1162
+ if (o.instances && o.instances.length > 0)
1163
+ for (const l of o.instances) {
1164
+ const c = `${o.modelId}-${l.elementId}`;
1165
+ i.has(c) && (s += a.length);
1166
+ }
1167
+ else
1168
+ s += a.length;
1169
+ }
1170
+ if (s === 0) {
1171
+ self.postMessage({ positions: null });
1172
+ return;
1173
+ }
1174
+ const n = new Float32Array(s);
1175
+ let r = 0;
1176
+ for (const o of e) {
1177
+ const a = new Float32Array(o.buffer);
1178
+ if (o.instances && o.instances.length > 0)
1179
+ for (const l of o.instances) {
1180
+ const c = `${o.modelId}-${l.elementId}`;
1181
+ if (!i.has(c))
1182
+ continue;
1183
+ const h = l.transform;
1184
+ for (let d = 0; d < a.length; d += 3) {
1185
+ const u = a[d], p = a[d + 1], m = a[d + 2], f = 1 / (h[3] * u + h[7] * p + h[11] * m + h[15]);
1186
+ n[r] = (h[0] * u + h[4] * p + h[8] * m + h[12]) * f, n[r + 1] = (h[1] * u + h[5] * p + h[9] * m + h[13]) * f, n[r + 2] = (h[2] * u + h[6] * p + h[10] * m + h[14]) * f, r += 3;
1187
+ }
1188
+ }
1189
+ else
1190
+ n.set(a, r), r += a.length;
1191
+ }
1192
+ self.postMessage({ positions: n.buffer }, [n.buffer]);
1193
+ };
1194
+ }
1195
+ const Xi = Yi;
1196
+ class Ki {
1197
+ constructor() {
1198
+ this._resolve = null, this._requestId = 0;
1199
+ const e = new Blob([`(${Xi})()`]), t = URL.createObjectURL(e);
1200
+ this._worker = new Worker(t), this._worker.onmessage = (i) => {
1201
+ const s = this._resolve;
1202
+ if (this._resolve = null, s) {
1203
+ const n = i.data.positions ? new Float32Array(i.data.positions) : null;
1204
+ s(n);
1205
+ }
1206
+ };
1207
+ }
1208
+ /**
1209
+ * Merge selected element positions in a background thread.
1210
+ * Cancels any in-flight request automatically.
1211
+ */
1212
+ merge(e, t) {
1213
+ this._resolve && (this._resolve(null), this._resolve = null);
1214
+ const i = ++this._requestId, s = [], n = e.filter((r) => r.buffer).map((r) => {
1215
+ const o = r.buffer.slice().buffer;
1216
+ return s.push(o), {
1217
+ buffer: o,
1218
+ modelId: r.modelId,
1219
+ instances: r.instances
1220
+ };
1221
+ });
1222
+ return new Promise((r) => {
1223
+ this._resolve = (o) => {
1224
+ if (i !== this._requestId) {
1225
+ r(null);
1226
+ return;
1227
+ }
1228
+ r(o);
1229
+ }, this._worker.postMessage(
1230
+ { bufferElements: n, selectedKeys: t },
1231
+ s
1232
+ );
1233
+ });
1234
+ }
1235
+ dispose() {
1236
+ this._worker.terminate();
1237
+ }
1238
+ }
1239
+ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
1154
1240
  constructor(e) {
1155
1241
  super(), this.material = e, this.globalMaterialIndex = -1, this._depthPrePassMeshes = [], this._instancedMeshes = /* @__PURE__ */ new Map(), this._bufferElements = [], this._originalColor = null, this._elementMap = /* @__PURE__ */ new Map(), this._originalTransforms = /* @__PURE__ */ new Map(), this._elementOpacity = /* @__PURE__ */ new Map(), this._temporaryColors = /* @__PURE__ */ new Map(), this._selectedElements = [], this._hidingElements = [], this._isolatingElements = [], this._edgeLines = /* @__PURE__ */ new Map(), this._edgeRanges = /* @__PURE__ */ new Map(), this._edgeThreshold = 60, this._edgeMaterial = null, this._isGeneratedLights = !1, this._pointLight = null, this._hiddenSet = /* @__PURE__ */ new Set(), this._isolatedSet = /* @__PURE__ */ new Set(), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0);
1156
1242
  }
@@ -1210,7 +1296,7 @@ const Yi = D.hexToRGB(x.accent), Fe = class Fe extends $t {
1210
1296
  return o.fill(1), s.setAttribute("instanceOpacity", new wt(o, 1)), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0), n;
1211
1297
  }
1212
1298
  _createGeometryFromBuffer(e) {
1213
- const t = new Z();
1299
+ const t = new J();
1214
1300
  t.setAttribute("position", new L(e, 3));
1215
1301
  const i = e.length / 3, s = Math.floor(i / 3), n = new Uint32Array(s * 3);
1216
1302
  for (let o = 0; o < s; o++) {
@@ -1267,7 +1353,7 @@ const Yi = D.hexToRGB(x.accent), Fe = class Fe extends $t {
1267
1353
  }
1268
1354
  //#region Selection and Color Control
1269
1355
  select(e, t = []) {
1270
- this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Yi);
1356
+ this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Ji);
1271
1357
  }
1272
1358
  unselect() {
1273
1359
  this._selectedElements.length > 0 && (this.resetColor(this._selectedElements), this._selectedElements = []);
@@ -1932,7 +2018,7 @@ if (vInstanceOpacity < 0.5) discard;`
1932
2018
  };
1933
2019
  Fe.ZERO_MATRIX = new ne().makeScale(0, 0, 0);
1934
2020
  let ce = Fe;
1935
- const Xi = `
2021
+ const es = `
1936
2022
  // Web Worker code as string (to be created as blob URL)
1937
2023
  self.onmessage = function(e) {
1938
2024
  const {
@@ -2046,13 +2132,13 @@ self.onmessage = function(e) {
2046
2132
  }
2047
2133
  };
2048
2134
  `;
2049
- class Ki extends y {
2135
+ class ts extends y {
2050
2136
  constructor() {
2051
- super(), this.workerPool = null, this.bimModels = [], this.isReady = !1, this._batchedMeshes = [], this._instancedMeshes = [], this._isolatingElements = [], this._initializeWorkerPool(4);
2137
+ super(), this.workerPool = null, this._mergePositionsWorker = null, this.bimModels = [], this.isReady = !1, this._batchedMeshes = [], this._instancedMeshes = [], this._isolatingElements = [], this._initializeWorkerPool(4);
2052
2138
  }
2053
2139
  _initializeWorkerPool(e) {
2054
2140
  try {
2055
- const t = new Blob([Xi], {
2141
+ const t = new Blob([es], {
2056
2142
  type: "application/javascript"
2057
2143
  }), i = URL.createObjectURL(t);
2058
2144
  this.workerPool = new te(
@@ -2092,7 +2178,7 @@ class Ki extends y {
2092
2178
  * Get diagnostic info about merged model structure
2093
2179
  */
2094
2180
  getDiagnostics() {
2095
- const e = this.children.filter((s) => s instanceof Y).length, t = this.children.filter(
2181
+ const e = this.children.filter((s) => s instanceof Z).length, t = this.children.filter(
2096
2182
  (s) => s instanceof ce
2097
2183
  ).length;
2098
2184
  let i = 0;
@@ -2250,6 +2336,17 @@ class Ki extends y {
2250
2336
  n.set(l.buffer, r), r += l.buffer.length;
2251
2337
  return n;
2252
2338
  }
2339
+ /**
2340
+ * Async version — offloads vertex merging to a Web Worker so the main thread stays unblocked.
2341
+ * Automatically cancels any in-flight request when called again.
2342
+ */
2343
+ async getSelectedElementsPositionsAsync() {
2344
+ const e = this.getSelectedElements();
2345
+ if (e.length === 0)
2346
+ return null;
2347
+ const t = e.map((s) => `${s.modelId}-${s.elementId}`), i = this.getElements(e);
2348
+ return i.length === 0 ? null : (this._mergePositionsWorker || (this._mergePositionsWorker = new Ki()), this._mergePositionsWorker.merge(i, t));
2349
+ }
2253
2350
  /**
2254
2351
  * Changes the color of multiple elements in the merged mesh.
2255
2352
  * Works with RGBA color buffer (preserves existing alpha values)
@@ -2351,60 +2448,61 @@ class Ki extends y {
2351
2448
  * *then regenerate again
2352
2449
  */
2353
2450
  dispose() {
2354
- this.isReady = !1, this._batchedMeshes.forEach((e) => e.dispose()), this._batchedMeshes = [], this._instancedMeshes.forEach((e) => e.dispose()), this._instancedMeshes = [], this.children = [];
2451
+ var e;
2452
+ this.isReady = !1, this._batchedMeshes.forEach((t) => t.dispose()), this._batchedMeshes = [], this._instancedMeshes.forEach((t) => t.dispose()), this._instancedMeshes = [], (e = this._mergePositionsWorker) == null || e.dispose(), this._mergePositionsWorker = null, this.children = [];
2355
2453
  }
2356
2454
  }
2357
- class or {
2455
+ class hr {
2358
2456
  constructor() {
2359
2457
  this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Name = "", this.Instances = [];
2360
2458
  }
2361
2459
  }
2362
- class lr {
2460
+ class dr {
2363
2461
  constructor() {
2364
2462
  this.MaterialIndex = 0, this.Elements = [];
2365
2463
  }
2366
2464
  }
2367
- class cr {
2465
+ class ur {
2368
2466
  constructor() {
2369
2467
  this.Vertices = [], this.Indices = [], this.Instances = [], this.Id = "";
2370
2468
  }
2371
2469
  }
2372
- class hr {
2470
+ class pr {
2373
2471
  constructor() {
2374
2472
  this.Vertices = [], this.Indices = [], this.Transform = null;
2375
2473
  }
2376
2474
  }
2377
- class dr {
2475
+ class mr {
2378
2476
  constructor() {
2379
2477
  this.buffer = null, this.instances = [];
2380
2478
  }
2381
2479
  }
2382
- class ur {
2480
+ class gr {
2383
2481
  constructor() {
2384
2482
  this.Solids = [], this.Id = "", this.Instances = [];
2385
2483
  }
2386
2484
  }
2387
- class pr {
2485
+ class fr {
2388
2486
  constructor() {
2389
2487
  this.Materials = [], this.Elements = [], this.Camera = new Xt();
2390
2488
  }
2391
2489
  }
2392
- class mr {
2490
+ class vr {
2393
2491
  constructor() {
2394
2492
  this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Buffer = [];
2395
2493
  }
2396
2494
  }
2397
2495
  class Xt {
2398
2496
  constructor() {
2399
- this.scale = 0, this.origin = new re(), this.eyePosition = new re(), this.upDirection = new re(), this.forwardDirection = new re(), this.target = new re(), this.box = new Ji();
2497
+ this.scale = 0, this.origin = new re(), this.eyePosition = new re(), this.upDirection = new re(), this.forwardDirection = new re(), this.target = new re(), this.box = new is();
2400
2498
  }
2401
2499
  }
2402
- class Ji {
2500
+ class is {
2403
2501
  constructor() {
2404
2502
  this.min = new re(), this.max = new re();
2405
2503
  }
2406
2504
  }
2407
- class gr {
2505
+ class br {
2408
2506
  constructor() {
2409
2507
  this.Data = {}, this.CameraData = new Xt(), this.Translation = [];
2410
2508
  }
@@ -2414,7 +2512,7 @@ class re {
2414
2512
  this.X = 0, this.Y = 0, this.Z = 0;
2415
2513
  }
2416
2514
  }
2417
- const es = {
2515
+ const ss = {
2418
2516
  enabled: !0,
2419
2517
  castShadow: !0,
2420
2518
  intensity: 5,
@@ -2425,7 +2523,7 @@ const es = {
2425
2523
  indirectLightIntensity: 1.2,
2426
2524
  shadowcatcher: !0
2427
2525
  };
2428
- function ts() {
2526
+ function ns() {
2429
2527
  function g(i) {
2430
2528
  let s = 0;
2431
2529
  for (let n = 0; n < i.length; n++)
@@ -2458,22 +2556,22 @@ function ts() {
2458
2556
  w.vx = 0, w.vy = 0, i.forEach((S) => {
2459
2557
  if (b.id === S.id)
2460
2558
  return;
2461
- const A = u.get(S.id), C = w.x - A.x, M = w.y - A.y, _ = C * C + M * M, V = Math.sqrt(_) || 1, O = d * d / V;
2462
- w.vx += C / V * O, w.vy += M / V * O;
2559
+ const A = u.get(S.id), C = w.x - A.x, M = w.y - A.y, _ = C * C + M * M, I = Math.sqrt(_) || 1, O = d * d / I;
2560
+ w.vx += C / I * O, w.vy += M / I * O;
2463
2561
  });
2464
2562
  }), s.forEach((b) => {
2465
2563
  const w = String(b.source), S = String(b.target), A = u.get(w), C = u.get(S);
2466
2564
  if (!A || !C)
2467
2565
  return;
2468
- const M = A.x - C.x, _ = A.y - C.y, V = Math.sqrt(M * M + _ * _) || 1, O = V * V / d, I = M / V * O, T = _ / V * O;
2469
- A.vx -= I, A.vy -= T, C.vx += I, C.vy += T;
2566
+ const M = A.x - C.x, _ = A.y - C.y, I = Math.sqrt(M * M + _ * _) || 1, O = I * I / d, V = M / I * O, P = _ / I * O;
2567
+ A.vx -= V, A.vy -= P, C.vx += V, C.vy += P;
2470
2568
  }), i.forEach((b) => {
2471
2569
  const w = u.get(b.id), S = Math.sqrt(w.vx * w.vx + w.vy * w.vy) || 1, A = Math.min(S, p);
2472
2570
  if (w.x += w.vx / S * A, w.y += w.vy / S * A, l === "circular") {
2473
- const C = r / 2, M = o / 2, _ = Math.min(r, o) / 2, V = w.x - C, O = w.y - M;
2474
- if (Math.sqrt(V * V + O * O) > _) {
2475
- const T = Math.atan2(O, V);
2476
- w.x = C + _ * Math.cos(T), w.y = M + _ * Math.sin(T);
2571
+ const C = r / 2, M = o / 2, _ = Math.min(r, o) / 2, I = w.x - C, O = w.y - M;
2572
+ if (Math.sqrt(I * I + O * O) > _) {
2573
+ const P = Math.atan2(O, I);
2574
+ w.x = C + _ * Math.cos(P), w.y = M + _ * Math.sin(P);
2477
2575
  }
2478
2576
  } else
2479
2577
  w.x = Math.max(0, Math.min(r, w.x)), w.y = Math.max(0, Math.min(o, w.y));
@@ -2507,10 +2605,10 @@ function ts() {
2507
2605
  }
2508
2606
  };
2509
2607
  }
2510
- const is = ts;
2511
- class ss {
2608
+ const rs = ns;
2609
+ class as {
2512
2610
  constructor() {
2513
- const e = new Blob([`(${is})()`]), t = URL.createObjectURL(e);
2611
+ const e = new Blob([`(${rs})()`]), t = URL.createObjectURL(e);
2514
2612
  this.workerPool = new te(2, t);
2515
2613
  }
2516
2614
  computeLayout(e, t, i, s) {
@@ -2530,7 +2628,7 @@ class ss {
2530
2628
  this.workerPool.dispose();
2531
2629
  }
2532
2630
  }
2533
- class ns {
2631
+ class os {
2534
2632
  constructor(e, t) {
2535
2633
  this._elementMap = /* @__PURE__ */ new Map(), this._relationships = [], this._searchIndex = null, this._searchIndexBuilt = !1, this._outEdges = /* @__PURE__ */ new Map(), this._inEdges = /* @__PURE__ */ new Map(), this._edgesByType = /* @__PURE__ */ new Map(), this.INVERSE = {
2536
2634
  ON_LEVEL: "HAS_ELEMENT",
@@ -2810,7 +2908,7 @@ class ns {
2810
2908
  }), l("Building nodes", d.length, d.length);
2811
2909
  const u = d.map((f) => f.id), p = this._calculateNodeLevels(c, u);
2812
2910
  a += r, l("Calculating levels", d.length, d.length);
2813
- const m = new ss();
2911
+ const m = new as();
2814
2912
  l(
2815
2913
  "Computing layout",
2816
2914
  0,
@@ -2866,22 +2964,22 @@ class ns {
2866
2964
  b.vx = 0, b.vy = 0, e.forEach((w) => {
2867
2965
  if (v.id === w.id)
2868
2966
  return;
2869
- const S = h.get(w.id), A = b.x - S.x, C = b.y - S.y, M = A * A + C * C, _ = Math.sqrt(M) || 1, V = c * c / _;
2870
- b.vx += A / _ * V, b.vy += C / _ * V;
2967
+ const S = h.get(w.id), A = b.x - S.x, C = b.y - S.y, M = A * A + C * C, _ = Math.sqrt(M) || 1, I = c * c / _;
2968
+ b.vx += A / _ * I, b.vy += C / _ * I;
2871
2969
  });
2872
2970
  }), t.forEach((v) => {
2873
2971
  const b = String(v.source), w = String(v.target), S = h.get(b), A = h.get(w);
2874
2972
  if (!S || !A)
2875
2973
  return;
2876
- const C = S.x - A.x, M = S.y - A.y, _ = Math.sqrt(C * C + M * M) || 1, V = _ * _ / c, O = C / _ * V, I = M / _ * V;
2877
- S.vx -= O, S.vy -= I, A.vx += O, A.vy += I;
2974
+ const C = S.x - A.x, M = S.y - A.y, _ = Math.sqrt(C * C + M * M) || 1, I = _ * _ / c, O = C / _ * I, V = M / _ * I;
2975
+ S.vx -= O, S.vy -= V, A.vx += O, A.vy += V;
2878
2976
  }), e.forEach((v) => {
2879
2977
  const b = h.get(v.id), w = Math.sqrt(b.vx * b.vx + b.vy * b.vy) || 1, S = Math.min(w, u);
2880
2978
  if (b.x += b.vx / w * S, b.y += b.vy / w * S, o === "circular") {
2881
- const A = s / 2, C = n / 2, M = Math.min(s, n) / 2, _ = b.x - A, V = b.y - C;
2882
- if (Math.sqrt(_ * _ + V * V) > M) {
2883
- const I = Math.atan2(V, _);
2884
- b.x = A + M * Math.cos(I), b.y = C + M * Math.sin(I);
2979
+ const A = s / 2, C = n / 2, M = Math.min(s, n) / 2, _ = b.x - A, I = b.y - C;
2980
+ if (Math.sqrt(_ * _ + I * I) > M) {
2981
+ const V = Math.atan2(I, _);
2982
+ b.x = A + M * Math.cos(V), b.y = C + M * Math.sin(V);
2885
2983
  }
2886
2984
  } else
2887
2985
  b.x = Math.max(0, Math.min(s, b.x)), b.y = Math.max(0, Math.min(n, b.y));
@@ -2909,13 +3007,13 @@ class ns {
2909
3007
  }
2910
3008
  //#endregion
2911
3009
  }
2912
- class fr {
3010
+ class wr {
2913
3011
  constructor() {
2914
3012
  this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
2915
3013
  }
2916
3014
  }
2917
- var k = /* @__PURE__ */ ((g) => (g[g.ON_MOUSE_MOVE = 0] = "ON_MOUSE_MOVE", g[g.ON_MOUSE_DOWN_LEFT = 1] = "ON_MOUSE_DOWN_LEFT", g[g.ON_MOUSE_UP_LEFT = 2] = "ON_MOUSE_UP_LEFT", g[g.ON_MOUSE_DOWN_RIGHT = 3] = "ON_MOUSE_DOWN_RIGHT", g[g.ON_MOUSE_UP_RIGHT = 4] = "ON_MOUSE_UP_RIGHT", g[g.ON_MOUSE_DOUBLE_CLICK = 5] = "ON_MOUSE_DOUBLE_CLICK", g))(k || {}), K = /* @__PURE__ */ ((g) => (g[g.ON_WAKE = 0] = "ON_WAKE", g[g.ON_SLEEP = 1] = "ON_SLEEP", g[g.ON_UPDATE = 2] = "ON_UPDATE", g))(K || {}), me = /* @__PURE__ */ ((g) => (g[g.KEYDOWN = 0] = "KEYDOWN", g[g.KEYUP = 1] = "KEYUP", g))(me || {}), R = /* @__PURE__ */ ((g) => (g[g.LOADED_SCENE = 0] = "LOADED_SCENE", g[g.LOADED_MATERIAL_MANAGER = 1] = "LOADED_MATERIAL_MANAGER", g[g.LOADED_RENDERER = 2] = "LOADED_RENDERER", g[g.LOADED_CAMERA = 3] = "LOADED_CAMERA", g[g.LOADED_CUBE = 4] = "LOADED_CUBE", g[g.LOADED_TOOLS = 5] = "LOADED_TOOLS", g[g.LOADED_SEPERATE_MODEL = 6] = "LOADED_SEPERATE_MODEL", g[g.GENERATED_MERGE_MODEL = 7] = "GENERATED_MERGE_MODEL", g[g.LOADED_DATA = 8] = "LOADED_DATA", g[g.SELECT_ELEMENTS = 9] = "SELECT_ELEMENTS", g[g.UNSELECT_ELEMENTS = 10] = "UNSELECT_ELEMENTS", g))(R || {});
2918
- class Vt {
3015
+ var k = /* @__PURE__ */ ((g) => (g[g.ON_MOUSE_MOVE = 0] = "ON_MOUSE_MOVE", g[g.ON_MOUSE_DOWN_LEFT = 1] = "ON_MOUSE_DOWN_LEFT", g[g.ON_MOUSE_UP_LEFT = 2] = "ON_MOUSE_UP_LEFT", g[g.ON_MOUSE_DOWN_RIGHT = 3] = "ON_MOUSE_DOWN_RIGHT", g[g.ON_MOUSE_UP_RIGHT = 4] = "ON_MOUSE_UP_RIGHT", g[g.ON_MOUSE_DOUBLE_CLICK = 5] = "ON_MOUSE_DOUBLE_CLICK", g))(k || {}), X = /* @__PURE__ */ ((g) => (g[g.ON_WAKE = 0] = "ON_WAKE", g[g.ON_SLEEP = 1] = "ON_SLEEP", g[g.ON_UPDATE = 2] = "ON_UPDATE", g))(X || {}), me = /* @__PURE__ */ ((g) => (g[g.KEYDOWN = 0] = "KEYDOWN", g[g.KEYUP = 1] = "KEYUP", g))(me || {}), R = /* @__PURE__ */ ((g) => (g[g.LOADED_SCENE = 0] = "LOADED_SCENE", g[g.LOADED_MATERIAL_MANAGER = 1] = "LOADED_MATERIAL_MANAGER", g[g.LOADED_RENDERER = 2] = "LOADED_RENDERER", g[g.LOADED_CAMERA = 3] = "LOADED_CAMERA", g[g.LOADED_CUBE = 4] = "LOADED_CUBE", g[g.LOADED_TOOLS = 5] = "LOADED_TOOLS", g[g.LOADED_SEPERATE_MODEL = 6] = "LOADED_SEPERATE_MODEL", g[g.GENERATED_MERGE_MODEL = 7] = "GENERATED_MERGE_MODEL", g[g.LOADED_DATA = 8] = "LOADED_DATA", g[g.SELECT_ELEMENTS = 9] = "SELECT_ELEMENTS", g[g.UNSELECT_ELEMENTS = 10] = "UNSELECT_ELEMENTS", g))(R || {});
3016
+ class It {
2919
3017
  constructor() {
2920
3018
  this.items = {};
2921
3019
  }
@@ -2951,7 +3049,7 @@ class Vt {
2951
3049
  return Object.keys(this.items).length;
2952
3050
  }
2953
3051
  }
2954
- class vr {
3052
+ class yr {
2955
3053
  constructor(e, t) {
2956
3054
  this.delay = e, this.eventHandler = t, this.timerId = null, this.handleEvent = (i) => {
2957
3055
  this.timerId && clearTimeout(this.timerId), this.timerId = setTimeout(() => {
@@ -2960,22 +3058,22 @@ class vr {
2960
3058
  };
2961
3059
  }
2962
3060
  }
2963
- class rs {
3061
+ class ls {
2964
3062
  constructor() {
2965
3063
  this.deleted = [], this.added = [], this.modified = [], this.notChanged = [];
2966
3064
  }
2967
3065
  }
2968
- class as {
3066
+ class cs {
2969
3067
  constructor() {
2970
- this.clashes = new Vt();
3068
+ this.clashes = new It();
2971
3069
  }
2972
3070
  }
2973
- class os {
3071
+ class hs {
2974
3072
  constructor() {
2975
3073
  this.value = {}, this.elementIds = [], this.modelId = -1;
2976
3074
  }
2977
3075
  }
2978
- class ls {
3076
+ class ds {
2979
3077
  constructor(e) {
2980
3078
  this.viralViewerApi = e, this.panel = null, this.batchListContainer = null, this.isVisible = !1, this.selectedBatchMesh = null, this.inject();
2981
3079
  }
@@ -3191,7 +3289,7 @@ class ls {
3191
3289
  this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
3192
3290
  }
3193
3291
  }
3194
- class cs {
3292
+ class us {
3195
3293
  constructor(e) {
3196
3294
  this.viralViewerApi = e, this.panel = null, this.instancedListContainer = null, this.isVisible = !1, this.selectedInstancedMesh = null, this.selectedInternalMesh = null, this.inject();
3197
3295
  }
@@ -3439,8 +3537,8 @@ class cs {
3439
3537
  Base Triangles: ${Math.floor(C).toLocaleString()}<br>
3440
3538
  Total Rendered: ${(A * b.count).toLocaleString()} verts
3441
3539
  </div>
3442
- `, M.addEventListener("click", (V) => {
3443
- V.stopPropagation(), this.isolateInternalMesh(r, b, M);
3540
+ `, M.addEventListener("click", (I) => {
3541
+ I.stopPropagation(), this.isolateInternalMesh(r, b, M);
3444
3542
  }), p.appendChild(M);
3445
3543
  }), d.appendChild(u), d.appendChild(p), this.instancedListContainer.appendChild(d);
3446
3544
  });
@@ -3587,7 +3685,7 @@ class cs {
3587
3685
  this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
3588
3686
  }
3589
3687
  }
3590
- class hs {
3688
+ class ps {
3591
3689
  constructor(e) {
3592
3690
  this.viralViewerApi = e, this.panel = null, this.contentContainer = null, this.isVisible = !1, this.lastAnalysis = null, this.inject();
3593
3691
  }
@@ -3894,7 +3992,7 @@ class hs {
3894
3992
  let t = 0, i = 0, s = 0, n = "N/A";
3895
3993
  if (e instanceof y) {
3896
3994
  const c = e.geometry;
3897
- c && (c.attributes.position && (t = c.attributes.position.count), c.index ? i = c.index.count / 3 : i = t / 3), e instanceof oe ? (s = 1, n = "Instanced", i *= e.count) : e instanceof Y ? (s = 1, n = "Batched") : (s = e.visible ? 1 : 0, n = Array.isArray(e.material) ? "Multi-Material" : ((a = e.material) == null ? void 0 : a.type) || "Unknown");
3995
+ c && (c.attributes.position && (t = c.attributes.position.count), c.index ? i = c.index.count / 3 : i = t / 3), e instanceof oe ? (s = 1, n = "Instanced", i *= e.count) : e instanceof Z ? (s = 1, n = "Batched") : (s = e.visible ? 1 : 0, n = Array.isArray(e.material) ? "Multi-Material" : ((a = e.material) == null ? void 0 : a.type) || "Unknown");
3898
3996
  } else if (e instanceof yt || e instanceof mt) {
3899
3997
  s = e.visible ? 1 : 0, n = "Line";
3900
3998
  const c = e.geometry;
@@ -3948,7 +4046,7 @@ class hs {
3948
4046
  return `v${s}_i${n}_${r}`;
3949
4047
  }
3950
4048
  categorizeObject(e, t, i) {
3951
- e instanceof Y ? i.batchedMeshes.push(t) : e instanceof ce || e instanceof oe ? i.instancedMeshes.push(t) : e instanceof y ? i.regularMeshes.push(t) : e instanceof yt || e instanceof mt ? i.edgeMeshes.push(t) : this.isRenderable(e) && i.otherObjects.push(t);
4049
+ e instanceof Z ? i.batchedMeshes.push(t) : e instanceof ce || e instanceof oe ? i.instancedMeshes.push(t) : e instanceof y ? i.regularMeshes.push(t) : e instanceof yt || e instanceof mt ? i.edgeMeshes.push(t) : this.isRenderable(e) && i.otherObjects.push(t);
3952
4050
  }
3953
4051
  analyzeMergedModel(e) {
3954
4052
  const t = this.viralViewerApi.viralScene.bimWorld, i = t.getDiagnostics();
@@ -4234,7 +4332,7 @@ class hs {
4234
4332
  this.panel && (this.panel.remove(), this.panel = null);
4235
4333
  }
4236
4334
  }
4237
- class ds {
4335
+ class ms {
4238
4336
  // 5 seconds for cleanup
4239
4337
  constructor(e) {
4240
4338
  this.viralViewerApi = e, this.clock = new ti(), this.lastSpatialUpdateTime = 0, this.lastCleanupTime = 0, this.spatialUpdateInterval = 16, this.cleanupInterval = 5e3, this.isRainEnabled = !1;
@@ -4280,7 +4378,7 @@ class ds {
4280
4378
  this.isRainEnabled = e, this.isRainEnabled && this.rainAnimation();
4281
4379
  }
4282
4380
  }
4283
- class us {
4381
+ class gs {
4284
4382
  static generateRandomString(e) {
4285
4383
  const t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
4286
4384
  let i = "";
@@ -4291,16 +4389,16 @@ class us {
4291
4389
  return i;
4292
4390
  }
4293
4391
  }
4294
- const ps = 0.032;
4295
- class ms {
4392
+ const fs = 0.032;
4393
+ class vs {
4296
4394
  constructor(e, t, i, s, n = 2, r = 1, o, a) {
4297
- this.viralViewerApi = e, this.scaleRatio = n, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.name = "", this.id = us.generateRandomString(10), this.MOVEMENT_SPEED = 0.032, this.talkContent = "", o && (this.id = o), a && (this.name = a, this.nameDiv = document.createElement("div"), this.nameDiv.setAttribute(
4395
+ this.viralViewerApi = e, this.scaleRatio = n, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.name = "", this.id = gs.generateRandomString(10), this.MOVEMENT_SPEED = 0.032, this.talkContent = "", o && (this.id = o), a && (this.name = a, this.nameDiv = document.createElement("div"), this.nameDiv.setAttribute(
4298
4396
  "style",
4299
4397
  "position: absolute; top:0; left:0;transform: translateX(-50%); pointer-events: none; background-color:rgba(226, 230, 220,1); color:rgb(23, 49, 44); padding: 5px ; border-radius:5px; font-size:x-small"
4300
4398
  ), this.nameDiv.id = this.id, this.nameDiv.append(this.name), this.viralViewerApi.targetElement.appendChild(this.nameDiv)), this.chatDiv = document.createElement("div"), this.chatDiv.setAttribute(
4301
4399
  "style",
4302
4400
  "position: absolute;display:none; top:0; left:0;transform: translate(-50%, -100%); pointer-events: none; background-color:rgba(226, 230, 220,1); color:rgb(23, 49, 44); padding: 5px ; border-radius:5px; font-size:x-small"
4303
- ), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED = ps * r, this.viralViewerApi.viralLoader.threeLoader.loadGLTF(t, (l) => {
4401
+ ), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED = fs * r, this.viralViewerApi.viralLoader.threeLoader.loadGLTF(t, (l) => {
4304
4402
  this.avatar = l.scene;
4305
4403
  const c = new E(n, n, n);
4306
4404
  this.avatar.scale.copy(c), console.log(this.avatar), this.mixer = new ii(l.scene), this.viralViewerApi.viralScene.scene.add(l.scene), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(i, (h) => {
@@ -4363,12 +4461,12 @@ class ms {
4363
4461
  (e = this.avatar) == null || e.removeFromParent(), this.mixer = null, this.walkAnimation = null, this.avatar = null, (i = (t = this.nameDiv) == null ? void 0 : t.parentNode) == null || i.removeChild(this.nameDiv), (n = (s = this.chatDiv) == null ? void 0 : s.parentNode) == null || n.removeChild(this.chatDiv);
4364
4462
  }
4365
4463
  }
4366
- class gs {
4464
+ class bs {
4367
4465
  constructor(e) {
4368
4466
  this.viralViewerApi = e, this.avatars = [];
4369
4467
  }
4370
4468
  load(e, t, i, s = 2, n = 1, r, o) {
4371
- const a = new ms(
4469
+ const a = new vs(
4372
4470
  this.viralViewerApi,
4373
4471
  e,
4374
4472
  t,
@@ -4385,15 +4483,15 @@ class gs {
4385
4483
  t && t.dispose(), this.avatars = this.avatars.filter((i) => i.id !== e);
4386
4484
  }
4387
4485
  }
4388
- class fs {
4486
+ class ws {
4389
4487
  constructor() {
4390
- Z.prototype.computeBoundsTree = _i, Z.prototype.disposeBoundsTree = Vi, y.prototype.raycast = Ii;
4488
+ J.prototype.computeBoundsTree = _i, J.prototype.disposeBoundsTree = Ii, y.prototype.raycast = Vi;
4391
4489
  }
4392
4490
  applyThreeMeshBVH(e) {
4393
4491
  e.boundsTree || e.computeBoundsTree();
4394
4492
  }
4395
4493
  }
4396
- const vs = {
4494
+ const ys = {
4397
4495
  Vector2: N,
4398
4496
  Vector3: E,
4399
4497
  Vector4: si,
@@ -4402,13 +4500,13 @@ const vs = {
4402
4500
  Spherical: jt,
4403
4501
  Box3: z,
4404
4502
  Sphere: Ht,
4405
- Raycaster: Tt,
4503
+ Raycaster: Pt,
4406
4504
  MathUtils: ri
4407
4505
  };
4408
- pe.install({ THREE: vs });
4409
- class bs {
4506
+ pe.install({ THREE: ys });
4507
+ class xs {
4410
4508
  constructor(e) {
4411
- this.viralViewerApi = e, this.raycaster = new Tt(), this.camera = null, this._orthoCamera = null, this._perspectiveCamera = null, this._frustumSize = 200, this.cameraControls = null, this.onUsing = !1, this.modelId = "0", this.elementId = "243274", this.cameraWakeQueuedEvents = [], this.cameraSleepQueuedEvents = [], this.cameraUpdateQueuedEvents = [], this.targetElement = this.viralViewerApi.options.container, this.setupCamera(), this.viralViewerApi.emit(R.LOADED_CAMERA);
4509
+ this.viralViewerApi = e, this.raycaster = new Pt(), this.camera = null, this._orthoCamera = null, this._perspectiveCamera = null, this._frustumSize = 200, this.cameraControls = null, this.onUsing = !1, this.modelId = "0", this.elementId = "243274", this.cameraWakeQueuedEvents = [], this.cameraSleepQueuedEvents = [], this.cameraUpdateQueuedEvents = [], this.targetElement = this.viralViewerApi.options.container, this.setupCamera(), this.viralViewerApi.emit(R.LOADED_CAMERA);
4412
4510
  }
4413
4511
  setupCamera() {
4414
4512
  this._perspectiveCamera = new He(
@@ -4592,32 +4690,32 @@ class bs {
4592
4690
  */
4593
4691
  addEventListener(e, t, i) {
4594
4692
  switch (e) {
4595
- case K.ON_WAKE:
4693
+ case X.ON_WAKE:
4596
4694
  this.cameraWakeQueuedEvents.push([t, i]);
4597
4695
  break;
4598
- case K.ON_SLEEP:
4696
+ case X.ON_SLEEP:
4599
4697
  this.cameraSleepQueuedEvents.push([t, i]);
4600
4698
  break;
4601
- case K.ON_UPDATE:
4699
+ case X.ON_UPDATE:
4602
4700
  this.cameraUpdateQueuedEvents.push([t, i]);
4603
4701
  break;
4604
4702
  }
4605
4703
  }
4606
4704
  removeEventListener(e, t) {
4607
4705
  switch (e) {
4608
- case K.ON_WAKE:
4706
+ case X.ON_WAKE:
4609
4707
  {
4610
4708
  const i = this.cameraWakeQueuedEvents.findIndex((s) => s[0] === t);
4611
4709
  this.cameraWakeQueuedEvents.splice(i, 1);
4612
4710
  }
4613
4711
  break;
4614
- case K.ON_SLEEP:
4712
+ case X.ON_SLEEP:
4615
4713
  {
4616
4714
  const i = this.cameraSleepQueuedEvents.findIndex((s) => s[0] === t);
4617
4715
  this.cameraSleepQueuedEvents.splice(i, 1);
4618
4716
  }
4619
4717
  break;
4620
- case K.ON_UPDATE:
4718
+ case X.ON_UPDATE:
4621
4719
  {
4622
4720
  const i = this.cameraUpdateQueuedEvents.findIndex((s) => s[0] === t);
4623
4721
  this.cameraUpdateQueuedEvents.splice(i, 1);
@@ -4667,13 +4765,13 @@ class bs {
4667
4765
  }
4668
4766
  //#endregion
4669
4767
  }
4670
- class ws {
4768
+ class Ms {
4671
4769
  pakoUnzip(e) {
4672
4770
  const t = new Uint8Array(e);
4673
- return Ti(t);
4771
+ return Pi(t);
4674
4772
  }
4675
4773
  pakoStreamUnzip(e) {
4676
- const t = new Pi();
4774
+ const t = new Ti();
4677
4775
  return t.push(e, !0), t.result;
4678
4776
  }
4679
4777
  }
@@ -4682,12 +4780,12 @@ class se {
4682
4780
  this.x = 0, this.y = 0, this.z = 0, this.x = e, this.y = t, this.z = i;
4683
4781
  }
4684
4782
  }
4685
- class P {
4783
+ class T {
4686
4784
  static doesEdgeIncludePlane(e, t, i, s, n, r = 1e-7) {
4687
- const o = P.subtract(s, i), a = P.subtract(n, i), l = P.crossProduct(o, a), c = -P.dotProduct(l, i), h = P.dotProduct(l, e) + c, d = P.dotProduct(l, t) + c;
4785
+ const o = T.subtract(s, i), a = T.subtract(n, i), l = T.crossProduct(o, a), c = -T.dotProduct(l, i), h = T.dotProduct(l, e) + c, d = T.dotProduct(l, t) + c;
4688
4786
  if (Math.abs(h) > r || Math.abs(d) > r)
4689
4787
  return !1;
4690
- const u = P.isPointInTriangle(e, i, s, n, r), p = P.isPointInTriangle(t, i, s, n, r);
4788
+ const u = T.isPointInTriangle(e, i, s, n, r), p = T.isPointInTriangle(t, i, s, n, r);
4691
4789
  return !(!u || !p);
4692
4790
  }
4693
4791
  /**
@@ -4700,14 +4798,14 @@ class P {
4700
4798
  * @returns boolean - Whether the edge intersects the triangle
4701
4799
  */
4702
4800
  static doesEdgeIntersectTriangle(e, t, i, s, n, r = 5) {
4703
- const o = P.subtract(s, i), a = P.subtract(n, i), l = P.crossProduct(o, a), c = -P.dotProduct(l, i), h = P.subtract(t, e), d = P.dotProduct(l, h);
4801
+ const o = T.subtract(s, i), a = T.subtract(n, i), l = T.crossProduct(o, a), c = -T.dotProduct(l, i), h = T.subtract(t, e), d = T.dotProduct(l, h);
4704
4802
  if (Math.abs(d) < 1e-7)
4705
4803
  return !1;
4706
- const u = -(P.dotProduct(l, e) + c) / d;
4804
+ const u = -(T.dotProduct(l, e) + c) / d;
4707
4805
  if (u < -r || u > 1 + r)
4708
4806
  return !1;
4709
- const p = P.add(e, P.scale(h, u)), m = P.distance(p, e), f = P.distance(p, t);
4710
- return m < r || f < r ? !1 : P.isPointInTriangle(p, i, s, n, r);
4807
+ const p = T.add(e, T.scale(h, u)), m = T.distance(p, e), f = T.distance(p, t);
4808
+ return m < r || f < r ? !1 : T.isPointInTriangle(p, i, s, n, r);
4711
4809
  }
4712
4810
  /**
4713
4811
  * Check if a point lies inside a triangle using barycentric coordinates
@@ -4718,7 +4816,7 @@ class P {
4718
4816
  * @returns boolean - Whether the point lies inside the triangle
4719
4817
  */
4720
4818
  static isPointInTriangle(e, t, i, s, n = 1e-7) {
4721
- const r = P.subtract(i, t), o = P.subtract(s, i), a = P.subtract(t, s), l = P.subtract(e, t), c = P.subtract(e, i), h = P.subtract(e, s), d = P.crossProduct(r, l), u = P.crossProduct(o, c), p = P.crossProduct(a, h), m = P.normalize(d), f = P.normalize(u), v = P.normalize(p), b = P.dotProduct(m, f), w = P.dotProduct(f, v);
4819
+ const r = T.subtract(i, t), o = T.subtract(s, i), a = T.subtract(t, s), l = T.subtract(e, t), c = T.subtract(e, i), h = T.subtract(e, s), d = T.crossProduct(r, l), u = T.crossProduct(o, c), p = T.crossProduct(a, h), m = T.normalize(d), f = T.normalize(u), v = T.normalize(p), b = T.dotProduct(m, f), w = T.dotProduct(f, v);
4722
4820
  return b > 1 - n && w > 1 - n;
4723
4821
  }
4724
4822
  // Vector math helper functions
@@ -4751,16 +4849,16 @@ class P {
4751
4849
  return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2 + (e.z - t.z) ** 2);
4752
4850
  }
4753
4851
  static doTrianglesIntersect(e, t, i, s, n, r, o = 1e-3) {
4754
- return !!(P.doesEdgeIntersectTriangle(e, t, s, n, r, o) || P.doesEdgeIntersectTriangle(t, i, s, n, r, o) || P.doesEdgeIntersectTriangle(i, e, s, n, r, o));
4852
+ return !!(T.doesEdgeIntersectTriangle(e, t, s, n, r, o) || T.doesEdgeIntersectTriangle(t, i, s, n, r, o) || T.doesEdgeIntersectTriangle(i, e, s, n, r, o));
4755
4853
  }
4756
4854
  static objectsIntersect(e, t, i = 1e-3) {
4757
4855
  for (let s = 0; s < e.length; s += 9) {
4758
4856
  const n = new se(e[s], e[s + 1], e[s + 2]), r = new se(e[s + 3], e[s + 4], e[s + 5]), o = new se(e[s + 6], e[s + 7], e[s + 8]);
4759
4857
  for (let a = 0; a < t.length; a += 9) {
4760
4858
  const l = new se(t[a], t[a + 1], t[a + 2]), c = new se(t[a + 3], t[a + 4], t[a + 5]), h = new se(t[a + 6], t[a + 7], t[a + 8]);
4761
- if (P.doesEdgeIncludePlane(n, r, l, c, h, i) && P.doesEdgeIncludePlane(r, o, l, c, h, i))
4859
+ if (T.doesEdgeIncludePlane(n, r, l, c, h, i) && T.doesEdgeIncludePlane(r, o, l, c, h, i))
4762
4860
  return console.log("belong to face"), !1;
4763
- if (P.doTrianglesIntersect(n, r, o, l, c, h, i))
4861
+ if (T.doTrianglesIntersect(n, r, o, l, c, h, i))
4764
4862
  return !0;
4765
4863
  }
4766
4864
  }
@@ -4771,7 +4869,7 @@ class P {
4771
4869
  return i && s && n;
4772
4870
  }
4773
4871
  }
4774
- function ys() {
4872
+ function Es() {
4775
4873
  class g {
4776
4874
  constructor(t, i, s) {
4777
4875
  this.X = 0, this.Y = 0, this.Z = 0, this.X = t, this.Y = i, this.Z = s;
@@ -4793,10 +4891,10 @@ function ys() {
4793
4891
  self.postMessage(i());
4794
4892
  };
4795
4893
  }
4796
- const xs = ys;
4797
- class Ms {
4894
+ const Ss = Es;
4895
+ class Cs {
4798
4896
  constructor() {
4799
- const e = new Blob([`(${xs})()`]), t = URL.createObjectURL(e);
4897
+ const e = new Blob([`(${Ss})()`]), t = URL.createObjectURL(e);
4800
4898
  this.workerPool = new te(navigator.hardwareConcurrency || 10, t);
4801
4899
  }
4802
4900
  getBoundingBox(e, t = (i) => {
@@ -4809,7 +4907,7 @@ class Ms {
4809
4907
  );
4810
4908
  }
4811
4909
  }
4812
- function Es() {
4910
+ function As() {
4813
4911
  self.onmessage = (g) => {
4814
4912
  const e = g.data;
4815
4913
  function t(s, n, r = 0.1) {
@@ -4827,10 +4925,10 @@ function Es() {
4827
4925
  self.postMessage(i);
4828
4926
  };
4829
4927
  }
4830
- const Ss = Es;
4831
- class Cs {
4928
+ const _s = As;
4929
+ class Is {
4832
4930
  constructor() {
4833
- const e = new Blob([`(${Ss})()`]), t = URL.createObjectURL(e);
4931
+ const e = new Blob([`(${_s})()`]), t = URL.createObjectURL(e);
4834
4932
  this.workerPool = new te(4, t);
4835
4933
  }
4836
4934
  checkIntersect(e, t = (i) => {
@@ -4840,7 +4938,7 @@ class Cs {
4840
4938
  });
4841
4939
  }
4842
4940
  }
4843
- function As() {
4941
+ function Vs() {
4844
4942
  class g {
4845
4943
  constructor() {
4846
4944
  this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
@@ -4932,10 +5030,10 @@ function As() {
4932
5030
  }
4933
5031
  };
4934
5032
  }
4935
- const _s = As;
4936
- class Vs {
5033
+ const Ps = Vs;
5034
+ class Ts {
4937
5035
  constructor() {
4938
- const e = new Blob([`(${_s})()`]), t = URL.createObjectURL(e);
5036
+ const e = new Blob([`(${Ps})()`]), t = URL.createObjectURL(e);
4939
5037
  this.workerPool = new te(2, t);
4940
5038
  }
4941
5039
  buildTreeNode(e, t = (i) => {
@@ -4945,7 +5043,7 @@ class Vs {
4945
5043
  });
4946
5044
  }
4947
5045
  }
4948
- function Is() {
5046
+ function Os() {
4949
5047
  class g {
4950
5048
  constructor(u, p, m) {
4951
5049
  this.x = 0, this.y = 0, this.z = 0, this.x = u, this.y = p, this.z = m;
@@ -4980,7 +5078,7 @@ function Is() {
4980
5078
  return Math.sqrt((d.x - u.x) ** 2 + (d.y - u.y) ** 2 + (d.z - u.z) ** 2);
4981
5079
  }
4982
5080
  function a(d, u, p, m, f = 1e-7) {
4983
- const v = e(p, u), b = e(m, p), w = e(u, m), S = e(d, u), A = e(d, p), C = e(d, m), M = n(v, S), _ = n(b, A), V = n(w, C), O = r(M), I = r(_), T = r(V), j = s(O, I), H = s(I, T);
5081
+ const v = e(p, u), b = e(m, p), w = e(u, m), S = e(d, u), A = e(d, p), C = e(d, m), M = n(v, S), _ = n(b, A), I = n(w, C), O = r(M), V = r(_), P = r(I), j = s(O, V), H = s(V, P);
4984
5082
  return j > 1 - f && H > 1 - f;
4985
5083
  }
4986
5084
  function l(d, u, p, m, f, v, b = 1e-3) {
@@ -4990,8 +5088,8 @@ function Is() {
4990
5088
  const b = e(m, p), w = e(f, p), S = n(b, w), A = -s(S, p), C = s(S, d) + A, M = s(S, u) + A;
4991
5089
  if (Math.abs(C) > v || Math.abs(M) > v)
4992
5090
  return !1;
4993
- const _ = a(d, p, m, f, v), V = a(u, p, m, f, v);
4994
- return !(!_ || !V);
5091
+ const _ = a(d, p, m, f, v), I = a(u, p, m, f, v);
5092
+ return !(!_ || !I);
4995
5093
  }
4996
5094
  function h(d, u, p, m, f, v = 5) {
4997
5095
  const b = e(m, p), w = e(f, p), S = n(b, w), A = -s(S, p), C = e(u, d), M = s(S, C);
@@ -5000,8 +5098,8 @@ function Is() {
5000
5098
  const _ = -(s(S, d) + A) / M;
5001
5099
  if (_ < -v || _ > 1 + v)
5002
5100
  return !1;
5003
- const V = t(d, i(C, _)), O = o(V, d), I = o(V, u);
5004
- return O < v || I < v ? !1 : a(V, p, m, f, v);
5101
+ const I = t(d, i(C, _)), O = o(I, d), V = o(I, u);
5102
+ return O < v || V < v ? !1 : a(I, p, m, f, v);
5005
5103
  }
5006
5104
  self.onmessage = (d) => {
5007
5105
  const u = d.data, p = u.buffer1, m = u.buffer2, f = 1e-3;
@@ -5015,10 +5113,10 @@ function Is() {
5015
5113
  self.postMessage(!1);
5016
5114
  };
5017
5115
  }
5018
- const Ts = Is;
5019
- class Ps {
5116
+ const Ds = Os;
5117
+ class Rs {
5020
5118
  constructor() {
5021
- const e = new Blob([`(${Ts})()`]), t = URL.createObjectURL(e);
5119
+ const e = new Blob([`(${Ds})()`]), t = URL.createObjectURL(e);
5022
5120
  this.workerPool = new te(navigator.hardwareConcurrency || 10, t);
5023
5121
  }
5024
5122
  checkClash(e, t = (i) => {
@@ -5028,7 +5126,7 @@ class Ps {
5028
5126
  });
5029
5127
  }
5030
5128
  }
5031
- function Os() {
5129
+ function Ls() {
5032
5130
  self.addEventListener(
5033
5131
  "message",
5034
5132
  (g) => {
@@ -5062,28 +5160,28 @@ function Os() {
5062
5160
  !1
5063
5161
  );
5064
5162
  }
5065
- const Ds = Os;
5066
- class Rs {
5163
+ const ks = Ls;
5164
+ class Bs {
5067
5165
  constructor() {
5068
- const e = new Blob([`(${Ds})()`]), t = URL.createObjectURL(e);
5166
+ const e = new Blob([`(${ks})()`]), t = URL.createObjectURL(e);
5069
5167
  this.workerPool = new te(2, t);
5070
5168
  }
5071
5169
  fetch(e, t = (n) => {
5072
5170
  }, i, s) {
5073
- const n = new Ls(e, i, s);
5171
+ const n = new zs(e, i, s);
5074
5172
  this.workerPool.Enqueue(n, (r) => {
5075
5173
  t(r);
5076
5174
  });
5077
5175
  }
5078
5176
  }
5079
- class Ls {
5177
+ class zs {
5080
5178
  constructor(e, t, i) {
5081
5179
  this.url = "", this.url = e, this.byteRangeStart = t, this.byteRangeEnd = i;
5082
5180
  }
5083
5181
  }
5084
- class ks {
5182
+ class Ns {
5085
5183
  constructor(e) {
5086
- this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new Rs(), this.buildTreeNodeWorker = new Vs(), this._boundingBoxWorker = new Ms(), this._boundingBoxIntersectWorker = new Cs(), this._checkClashWorker = new Ps(), this.searchValue = "", this.firstElementId = "211850", this.secondElementId = "680539", this.groupByKeyword = "Category", this._shallowCompare = (t, i) => JSON.stringify(Object.keys(t).sort()) === JSON.stringify(Object.keys(i).sort()) && JSON.stringify(Object.values(t).sort()) === JSON.stringify(Object.values(i).sort());
5184
+ this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new Bs(), this.buildTreeNodeWorker = new Ts(), this._boundingBoxWorker = new Cs(), this._boundingBoxIntersectWorker = new Is(), this._checkClashWorker = new Rs(), this.searchValue = "", this.firstElementId = "211850", this.secondElementId = "680539", this.groupByKeyword = "Category", this._shallowCompare = (t, i) => JSON.stringify(Object.keys(t).sort()) === JSON.stringify(Object.keys(i).sort()) && JSON.stringify(Object.values(t).sort()) === JSON.stringify(Object.values(i).sort());
5087
5185
  }
5088
5186
  addTrackingData(e, t) {
5089
5187
  this.trackingData.set(e, t);
@@ -5133,7 +5231,7 @@ class ks {
5133
5231
  addData(e) {
5134
5232
  const t = performance.now(), i = Object.keys(e.Data).length;
5135
5233
  console.log(`[DataManager] Adding ${i} elements to data tree...`);
5136
- const s = new ns();
5234
+ const s = new os();
5137
5235
  s.addElements(e.Data), e.Relationships && (s.addRelationships(e.Relationships), s.buildGraphIndex()), this.dataTree.push(s), this.viralViewerApi.emit(R.LOADED_DATA, {
5138
5236
  modelId: this.dataTree.length - 1
5139
5237
  }), console.log(
@@ -5211,7 +5309,7 @@ class ks {
5211
5309
  * @returns
5212
5310
  */
5213
5311
  compareModels(e = 0, t = 1) {
5214
- const i = new rs();
5312
+ const i = new ls();
5215
5313
  if (!this.dataTree[e] || !this.dataTree[t])
5216
5314
  return i;
5217
5315
  const s = this.dataTree[e].elementData, n = this.dataTree[t].elementData, r = this._getDiffKeys(s[0], n[0]);
@@ -5307,7 +5405,7 @@ class ks {
5307
5405
  if (i.length > 0 && s.length > 0) {
5308
5406
  const n = i[0], r = s[0];
5309
5407
  console.log(
5310
- P.objectsIntersect(
5408
+ T.objectsIntersect(
5311
5409
  Array.from(n.buffer),
5312
5410
  Array.from(r.buffer)
5313
5411
  )
@@ -5320,7 +5418,7 @@ class ks {
5320
5418
  * @param secondModelIndex
5321
5419
  */
5322
5420
  async checkClashModels(e = 0, t = 0) {
5323
- const i = new as(), s = this.viralViewerApi.viralScene.bimWorld.getElementsByModel(e), n = e === t ? s : this.viralViewerApi.viralScene.bimWorld.getElementsByModel(t);
5421
+ const i = new cs(), s = this.viralViewerApi.viralScene.bimWorld.getElementsByModel(e), n = e === t ? s : this.viralViewerApi.viralScene.bimWorld.getElementsByModel(t);
5324
5422
  if (s.length === 0 || n.length === 0)
5325
5423
  return i;
5326
5424
  const r = (h) => new Promise((d) => {
@@ -5411,7 +5509,7 @@ class ks {
5411
5509
  (h) => this._shallowCompare(h.value, l)
5412
5510
  );
5413
5511
  if (c < 0) {
5414
- const h = new os();
5512
+ const h = new hs();
5415
5513
  h.value = l, h.modelId = s, h.elementIds = [], h.elementIds.push(Number(o)), t.push(h);
5416
5514
  } else
5417
5515
  t[c].elementIds.push(Number(o));
@@ -5438,7 +5536,7 @@ class ks {
5438
5536
  }
5439
5537
  //#endregion
5440
5538
  }
5441
- class Bs {
5539
+ class $s {
5442
5540
  constructor() {
5443
5541
  this.events = {
5444
5542
  [R.LOADED_SCENE]: [],
@@ -5480,7 +5578,7 @@ class Bs {
5480
5578
  i && i.forEach((s) => s(...t));
5481
5579
  }
5482
5580
  }
5483
- class zs {
5581
+ class js {
5484
5582
  constructor(e) {
5485
5583
  this.viralViewerApi = e, this.keydownQueuedEvents = [], this.keyupQueuedEvents = [], this.setupKeyPress();
5486
5584
  }
@@ -5528,7 +5626,7 @@ class zs {
5528
5626
  }
5529
5627
  //#endregion
5530
5628
  }
5531
- class Ns {
5629
+ class Hs {
5532
5630
  constructor(e) {
5533
5631
  this.viralViewerApi = e, this.position = new N(), this.rawPosition = new N(), this.mouseMoveQueuedEvents = [], this.mouseDownLeftQueuedEvents = [], this.mouseUpLeftQueuedEvents = [], this.mouseDownRightQueuedEvents = [], this.mouseUpRightQueuedEvents = [], this.mouseDoubleClickQueuedEvents = [], this.handleClick = async (t) => {
5534
5632
  var i, s, n;
@@ -5542,7 +5640,7 @@ class Ns {
5542
5640
  if (this.viralViewerApi.options.isDev && Q.information("Time to ray cast: " + (performance.now() - r)), o && o.length > 0 && !((i = this.viralViewerApi.viralSectionBox) != null && i.isVisible)) {
5543
5641
  let l = null;
5544
5642
  for (const c of o)
5545
- if (c.object instanceof Y) {
5643
+ if (c.object instanceof Z) {
5546
5644
  const h = c.object.findElementByFaceIndex(
5547
5645
  ((s = c.face) == null ? void 0 : s.a) ?? 0
5548
5646
  );
@@ -5709,7 +5807,7 @@ const je = {
5709
5807
  focus: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z"/></svg>`,
5710
5808
  properties: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>`
5711
5809
  };
5712
- class $s {
5810
+ class Ws {
5713
5811
  constructor(e) {
5714
5812
  this.viralViewerApi = e, this.elementProperties = {}, this._sleepDebounceTimer = null, this._sleepDebounceDelay = 150, this.resizeObserver = null, this.isShiftPressed = !1, this.windowHandler(), this.contextMenuEventHandler(), this.selectElementHandler2(), this.doubleClickElementHandler(), this.keyboardHandler(), this.cameraHandler(), this._visibilityManager = this.viralViewerApi.viralVisibilityManager;
5715
5813
  }
@@ -5770,13 +5868,13 @@ class $s {
5770
5868
  // ms to wait before confirming camera is steady
5771
5869
  cameraHandler() {
5772
5870
  this.viralViewerApi.viralCamera && (this.viralViewerApi.viralCamera.addEventListener(
5773
- K.ON_WAKE,
5871
+ X.ON_WAKE,
5774
5872
  "hide objects",
5775
5873
  () => {
5776
5874
  this._sleepDebounceTimer && (clearTimeout(this._sleepDebounceTimer), this._sleepDebounceTimer = null), this.viralViewerApi.viralVisibilityManager.bypassScreenSpaceEdge(), this.viralViewerApi.viralVisibilityManager.bypassSelectionOutline(), this.viralViewerApi.viralVisibilityManager.disableAmbientOcclusion(), this.viralViewerApi.viralVisibilityManager.disableSampling();
5777
5875
  }
5778
5876
  ), this.viralViewerApi.viralCamera.addEventListener(
5779
- K.ON_SLEEP,
5877
+ X.ON_SLEEP,
5780
5878
  "unhide objects",
5781
5879
  () => {
5782
5880
  this._sleepDebounceTimer && clearTimeout(this._sleepDebounceTimer), this._sleepDebounceTimer = setTimeout(() => {
@@ -5831,7 +5929,7 @@ class $s {
5831
5929
  if (c)
5832
5930
  break;
5833
5931
  const d = h;
5834
- if (d.object instanceof Y && d.face) {
5932
+ if (d.object instanceof Z && d.face) {
5835
5933
  const u = d.object.findElementByFaceIndex(
5836
5934
  d.face.a
5837
5935
  );
@@ -5903,7 +6001,7 @@ class $s {
5903
6001
  if (t && (t == null ? void 0 : t.length) > 0)
5904
6002
  for (const s of t) {
5905
6003
  const n = s;
5906
- if (n.object instanceof Y && n.face) {
6004
+ if (n.object instanceof Z && n.face) {
5907
6005
  const r = n.object.findElementByFaceIndex(
5908
6006
  n.face.a
5909
6007
  );
@@ -5955,7 +6053,7 @@ class $s {
5955
6053
  }
5956
6054
  //#endregion
5957
6055
  }
5958
- class js {
6056
+ class Fs {
5959
6057
  constructor(e, t) {
5960
6058
  this.viralViewerApi = e, this.options = t, this.viralViewerApi.on(R.LOADED_SCENE, () => this.loadedScene()), this.viralViewerApi.on(
5961
6059
  R.LOADED_MATERIAL_MANAGER,
@@ -5988,7 +6086,7 @@ class js {
5988
6086
  }
5989
6087
  async loadedModels(e) {
5990
6088
  this.options.isDev && Q.information(`model ${e.modelId} loaded!`), this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.bimWorld.children.forEach((t) => {
5991
- if (t instanceof Y) {
6089
+ if (t instanceof Z) {
5992
6090
  this.viralViewerApi.viralScene.selectables.push(t);
5993
6091
  return;
5994
6092
  }
@@ -5998,7 +6096,7 @@ class js {
5998
6096
  });
5999
6097
  }
6000
6098
  }
6001
- class Hs {
6099
+ class Gs {
6002
6100
  constructor(e) {
6003
6101
  this.viralViewerApi = e, this.potree = new Oi(), this.pointClouds = [];
6004
6102
  }
@@ -6022,7 +6120,7 @@ class Hs {
6022
6120
  });
6023
6121
  }
6024
6122
  }
6025
- class Ws {
6123
+ class Us {
6026
6124
  static getDeviceType() {
6027
6125
  const e = navigator.userAgent.toLowerCase(), t = /iphone|ipod|android.*mobile|blackberry|opera mini|windows phone/i.test(
6028
6126
  e
@@ -6030,7 +6128,7 @@ class Ws {
6030
6128
  return t ? "mobile" : i ? "tablet" : "pc";
6031
6129
  }
6032
6130
  }
6033
- class Fs {
6131
+ class qs {
6034
6132
  constructor() {
6035
6133
  this.gl = null, this.specs = null, this.initWebGL(), this.detectSpecs();
6036
6134
  }
@@ -6174,16 +6272,16 @@ class Fs {
6174
6272
  });
6175
6273
  }
6176
6274
  }
6177
- class Gs {
6275
+ class Qs {
6178
6276
  constructor() {
6179
- this.modelId = -1, this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new Vt();
6277
+ this.modelId = -1, this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new It();
6180
6278
  }
6181
6279
  //#endregion
6182
6280
  dispose() {
6183
- this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new Vt();
6281
+ this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new It();
6184
6282
  }
6185
6283
  }
6186
- class Us {
6284
+ class Zs {
6187
6285
  constructor() {
6188
6286
  this.MIN_VERTEX_INSTANCES_FOR_INSTANCING = 1e3, this.MIN_INSTANCES_FOR_INSTANCING = 3, this.MAX_DRAW_CALLS = 25, this.MIN_INSTANCED_VERTEX_RATIO = 0.6, this.HIGH_VERTEX_THRESHOLD = 500;
6189
6287
  }
@@ -6332,8 +6430,8 @@ class Us {
6332
6430
  }
6333
6431
  }
6334
6432
  }
6335
- const qs = new Us();
6336
- function Qs() {
6433
+ const Ys = new Zs();
6434
+ function Xs() {
6337
6435
  class g {
6338
6436
  constructor() {
6339
6437
  this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
@@ -6418,8 +6516,8 @@ function Qs() {
6418
6516
  }), self.postMessage(r);
6419
6517
  };
6420
6518
  }
6421
- const Zs = Qs;
6422
- function Ys() {
6519
+ const Ks = Xs;
6520
+ function Js() {
6423
6521
  class g {
6424
6522
  constructor() {
6425
6523
  this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
@@ -6509,18 +6607,18 @@ function Ys() {
6509
6607
  }), self.postMessage(r);
6510
6608
  };
6511
6609
  }
6512
- const Xs = Ys;
6513
- class Ks {
6610
+ const en = Js;
6611
+ class tn {
6514
6612
  // Or 5K objects
6515
6613
  //#endregion
6516
6614
  constructor(e) {
6517
6615
  this.viralViewerApi = e, this.lastRenderTime = 0, this.elementBuffer = /* @__PURE__ */ new Map(), this.BATCH_THRESHOLD_VERTICES = 1e5, this.BATCH_THRESHOLD_OBJECTS = 5e3;
6518
- const t = new Blob([`(${Zs})()`]), i = URL.createObjectURL(t);
6616
+ const t = new Blob([`(${Ks})()`]), i = URL.createObjectURL(t);
6519
6617
  this.workerPool = new te(
6520
6618
  navigator.hardwareConcurrency || this.viralViewerApi.options.numberOfWorker,
6521
6619
  i
6522
6620
  );
6523
- const s = new Blob([`(${Xs})()`]), n = URL.createObjectURL(s);
6621
+ const s = new Blob([`(${en})()`]), n = URL.createObjectURL(s);
6524
6622
  this.workerPool2 = new te(
6525
6623
  this.viralViewerApi.options.numberOfWorker,
6526
6624
  n
@@ -6533,7 +6631,7 @@ class Ks {
6533
6631
  */
6534
6632
  initial(e) {
6535
6633
  console.log(e);
6536
- const t = new Gs();
6634
+ const t = new Qs();
6537
6635
  t.modelId = this.viralViewerApi.viralScene.bimWorld.bimModels.length, this.viralViewerApi.viralScene.bimWorld.bimModels.push(t);
6538
6636
  const i = this.viralViewerApi.viralScene.bimWorld.bimModels.length - 1;
6539
6637
  for (let s = 0; s < e.length; s++) {
@@ -6572,7 +6670,7 @@ class Ks {
6572
6670
  */
6573
6671
  loadElement(e, t, i = () => {
6574
6672
  }, s = null) {
6575
- const { highDuplicationElements: n, lowDuplicationElements: r } = qs.analyze(t), o = r.map((p) => p.element), a = n.map((p) => p.element), l = o.length > 0, c = a.length > 0;
6673
+ const { highDuplicationElements: n, lowDuplicationElements: r } = Ys.analyze(t), o = r.map((p) => p.element), a = n.map((p) => p.element), l = o.length > 0, c = a.length > 0;
6576
6674
  if (!l && !c) {
6577
6675
  i();
6578
6676
  return;
@@ -6662,7 +6760,7 @@ class Ks {
6662
6760
  createSingleMergedMesh(e, t, i) {
6663
6761
  const s = this.createOptimizedMaterial(t);
6664
6762
  this.viralViewerApi.viralMaterialManager.mergeMaterials.push(s);
6665
- const n = new Y(
6763
+ const n = new Z(
6666
6764
  void 0,
6667
6765
  s,
6668
6766
  this.viralViewerApi.viralScene.bimWorld.workerPool
@@ -6680,12 +6778,12 @@ class Ks {
6680
6778
  * Uses onBeforeCompile to inject custom shader code for RGBA vertex colors
6681
6779
  */
6682
6780
  createOptimizedMaterial(e) {
6683
- const t = Ws.getDeviceType() === "pc", i = (r, o = 2) => {
6781
+ const t = Us.getDeviceType() === "pc", i = (r, o = 2) => {
6684
6782
  if (!r)
6685
6783
  return 16777215;
6686
6784
  const a = r.clone();
6687
6785
  return a.multiplyScalar(o), a;
6688
- }, s = e.transparent || e.opacity < 1, n = t ? new J({
6786
+ }, s = e.transparent || e.opacity < 1, n = t ? new K({
6689
6787
  vertexColors: !0,
6690
6788
  side: ee,
6691
6789
  // 🔧 FIX: Changed from DoubleSide to halve draw calls
@@ -6851,9 +6949,9 @@ class Ks {
6851
6949
  }
6852
6950
  //#endregion
6853
6951
  }
6854
- class Js {
6952
+ class sn {
6855
6953
  constructor(e) {
6856
- this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new Ks(e);
6954
+ this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new tn(e);
6857
6955
  }
6858
6956
  //#region Load worker
6859
6957
  async load(e, t, i, s = () => {
@@ -6997,7 +7095,7 @@ class Js {
6997
7095
  }), this.viralViewerApi.viralMaterialManager.mergeMaterials = [], this.viralViewerApi.viralVisibilityManager.disableGroundShadow(), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralDataManager.dataTree = [], this.viralViewerApi.viralScene.selectables = [];
6998
7096
  }
6999
7097
  }
7000
- class en {
7098
+ class nn {
7001
7099
  constructor(e) {
7002
7100
  this.viralViewerApi = e, this.objectLoader = new li(), this.gltfLoader = new ki();
7003
7101
  }
@@ -7011,12 +7109,12 @@ class en {
7011
7109
  this.gltfLoader.load(e, t, i, s);
7012
7110
  }
7013
7111
  }
7014
- class tn {
7112
+ class rn {
7015
7113
  constructor(e) {
7016
- this.viralViewerApi = e, this.revitLoader = new Js(this.viralViewerApi), this.pointCloudLoader = new Hs(this.viralViewerApi), this.threeLoader = new en(this.viralViewerApi);
7114
+ this.viralViewerApi = e, this.revitLoader = new sn(this.viralViewerApi), this.pointCloudLoader = new Gs(this.viralViewerApi), this.threeLoader = new nn(this.viralViewerApi);
7017
7115
  }
7018
7116
  }
7019
- class sn {
7117
+ class an {
7020
7118
  constructor(e) {
7021
7119
  this.viralViewerApi = e, this.hoverMaterial = new gt({
7022
7120
  color: D.hexToThreejsColor(x.secondary),
@@ -7038,7 +7136,7 @@ class sn {
7038
7136
  resolution: new N(window.innerWidth, window.innerHeight),
7039
7137
  transparent: !0,
7040
7138
  opacity: 0.8
7041
- }), this.outlineMaterial = new J({
7139
+ }), this.outlineMaterial = new K({
7042
7140
  transparent: !0,
7043
7141
  opacity: 0
7044
7142
  }), this.materials = [], this.mergeMaterials = [], this.originalColors = [], this.viralViewerApi.emit(R.LOADED_MATERIAL_MANAGER);
@@ -7067,7 +7165,7 @@ class sn {
7067
7165
  }
7068
7166
  }
7069
7167
  }
7070
- function nn() {
7168
+ function on() {
7071
7169
  const g = new ci({
7072
7170
  side: ee
7073
7171
  });
@@ -7089,7 +7187,7 @@ function nn() {
7089
7187
  );
7090
7188
  }, g;
7091
7189
  }
7092
- function rn() {
7190
+ function ln() {
7093
7191
  const g = new G({
7094
7192
  colorWrite: !1,
7095
7193
  side: ee
@@ -7112,7 +7210,7 @@ function rn() {
7112
7210
  );
7113
7211
  }, g;
7114
7212
  }
7115
- const an = {
7213
+ const cn = {
7116
7214
  edgeColor: new B(0),
7117
7215
  edgeOpacity: 0.6,
7118
7216
  // Reduced for subtlety, better perf
@@ -7130,14 +7228,14 @@ const an = {
7130
7228
  // Keep - good for creases
7131
7229
  enableObjectIdEdges: !1
7132
7230
  // Disable by default - most expensive (extra render pass)
7133
- }, on = `
7231
+ }, hn = `
7134
7232
  varying vec2 vUv;
7135
7233
 
7136
7234
  void main() {
7137
7235
  vUv = uv;
7138
7236
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7139
7237
  }
7140
- `, ln = `
7238
+ `, dn = `
7141
7239
  precision highp float;
7142
7240
 
7143
7241
  uniform sampler2D tDiffuse; // Color buffer (from main render)
@@ -7303,7 +7401,7 @@ void main() {
7303
7401
 
7304
7402
  gl_FragColor = vec4(finalColor, color.a);
7305
7403
  }
7306
- `, cn = `
7404
+ `, un = `
7307
7405
  attribute float objectIndex;
7308
7406
  varying float vObjectIndex;
7309
7407
 
@@ -7311,7 +7409,7 @@ void main() {
7311
7409
  vObjectIndex = objectIndex;
7312
7410
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7313
7411
  }
7314
- `, hn = `
7412
+ `, pn = `
7315
7413
  precision highp float;
7316
7414
  varying float vObjectIndex;
7317
7415
 
@@ -7327,9 +7425,9 @@ void main() {
7327
7425
  gl_FragColor = vec4(packIndex(vObjectIndex), 1.0);
7328
7426
  }
7329
7427
  `;
7330
- class dn extends Zt {
7428
+ class mn extends Zt {
7331
7429
  constructor(e, t, i, s) {
7332
- super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new N(window.innerWidth, window.innerHeight), this.options = { ...an, ...s };
7430
+ super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new N(window.innerWidth, window.innerHeight), this.options = { ...cn, ...s };
7333
7431
  const n = {
7334
7432
  format: Wt,
7335
7433
  type: Ft,
@@ -7350,9 +7448,9 @@ class dn extends Zt {
7350
7448
  this.resolution.x,
7351
7449
  this.resolution.y,
7352
7450
  _t
7353
- ), this.objectIdTarget = new ue(this.resolution.x, this.resolution.y, n), this.normalMaterial = nn(), this.depthMaterial = rn(), this.objectIdMaterial = new le({
7354
- vertexShader: cn,
7355
- fragmentShader: hn,
7451
+ ), this.objectIdTarget = new ue(this.resolution.x, this.resolution.y, n), this.normalMaterial = on(), this.depthMaterial = ln(), this.objectIdMaterial = new le({
7452
+ vertexShader: un,
7453
+ fragmentShader: pn,
7356
7454
  side: ee
7357
7455
  }), this.edgeMaterial = new le({
7358
7456
  uniforms: {
@@ -7375,8 +7473,8 @@ class dn extends Zt {
7375
7473
  enableNormalEdges: { value: this.options.enableNormalEdges },
7376
7474
  enableObjectIdEdges: { value: this.options.enableObjectIdEdges }
7377
7475
  },
7378
- vertexShader: on,
7379
- fragmentShader: ln
7476
+ vertexShader: hn,
7477
+ fragmentShader: dn
7380
7478
  }), this.copyMaterial = new le({
7381
7479
  uniforms: {
7382
7480
  tDiffuse: { value: null }
@@ -7453,7 +7551,7 @@ class dn extends Zt {
7453
7551
  this.normalTarget.dispose(), this.depthTarget.dispose(), this.objectIdTarget.dispose(), this.normalMaterial.dispose(), this.depthMaterial.dispose(), this.edgeMaterial.dispose(), this.objectIdMaterial.dispose(), this.copyMaterial.dispose(), this.fsQuad.dispose();
7454
7552
  }
7455
7553
  }
7456
- const un = {
7554
+ const gn = {
7457
7555
  outlineColor: new B(x.accent),
7458
7556
  outlineOpacity: 1,
7459
7557
  outlineThickness: 2,
@@ -7465,7 +7563,7 @@ void main() {
7465
7563
  vUv = uv;
7466
7564
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7467
7565
  }
7468
- `, pn = `
7566
+ `, fn = `
7469
7567
  precision highp float;
7470
7568
 
7471
7569
  uniform sampler2D tDiffuse; // Original scene
@@ -7554,9 +7652,9 @@ void main() {
7554
7652
  gl_FragColor = vec4(finalColor, sceneColor.a);
7555
7653
  }
7556
7654
  `;
7557
- class mn extends Zt {
7655
+ class vn extends Zt {
7558
7656
  constructor(e, t, i, s = {}) {
7559
- super(), this.copyMaterial = null, this.selectionMesh = null, this.hasSelection = !1, this.bypass = !1, this.camera = t, this.resolution = i, this.options = { ...un, ...s };
7657
+ super(), this.copyMaterial = null, this.selectionMesh = null, this.selectionBuffer = null, this.selectionAttribute = null, this.hasSelection = !1, this.bypass = !1, this.camera = t, this.resolution = i, this.options = { ...gn, ...s };
7560
7658
  const n = i.clone().multiplyScalar(0.5);
7561
7659
  this.maskRenderTarget = new ue(n.x, n.y, {
7562
7660
  depthBuffer: !0
@@ -7582,8 +7680,8 @@ class mn extends Zt {
7582
7680
  occludedOpacity: { value: this.options.occludedOpacity }
7583
7681
  },
7584
7682
  vertexShader: Mt,
7585
- fragmentShader: pn
7586
- }), this.selectionGeometry = new Z(), this.maskScene = new ft(), this.fsQuad = new Yt(this.outlineMaterial);
7683
+ fragmentShader: fn
7684
+ }), this.selectionGeometry = new J(), this.maskScene = new ft(), this.fsQuad = new Yt(this.outlineMaterial);
7587
7685
  }
7588
7686
  /**
7589
7687
  * Update selection geometry from buffer elements
@@ -7591,11 +7689,13 @@ class mn extends Zt {
7591
7689
  * @param positions - Merged Float32Array of all selected element positions
7592
7690
  */
7593
7691
  updateSelectionGeometry(e) {
7594
- if (this.selectionGeometry.dispose(), this.selectionGeometry = new Z(), !e || e.length === 0) {
7595
- this.hasSelection = !1, this.selectionMesh && (this.maskScene.remove(this.selectionMesh), this.selectionMesh = null);
7692
+ if (!e || e.length === 0) {
7693
+ this.hasSelection = !1, this.selectionGeometry.setDrawRange(0, 0);
7596
7694
  return;
7597
7695
  }
7598
- this.hasSelection = !0, this.selectionGeometry.setAttribute("position", new L(e, 3)), this.selectionGeometry.computeBoundingSphere(), this.selectionMesh ? this.selectionMesh.geometry = this.selectionGeometry : (this.selectionMesh = new y(this.selectionGeometry, this.maskMaterial), this.selectionMesh.frustumCulled = !1, this.maskScene.add(this.selectionMesh));
7696
+ this.hasSelection = !0;
7697
+ const t = e.length / 3;
7698
+ (!this.selectionBuffer || this.selectionBuffer.length < e.length) && (this.selectionBuffer = new Float32Array(e.length), this.selectionAttribute = new L(this.selectionBuffer, 3), this.selectionGeometry.setAttribute("position", this.selectionAttribute)), this.selectionBuffer.set(e), this.selectionAttribute && (this.selectionAttribute.needsUpdate = !0), this.selectionGeometry.setDrawRange(0, t), this.selectionMesh || (this.selectionMesh = new y(this.selectionGeometry, this.maskMaterial), this.selectionMesh.frustumCulled = !1, this.maskScene.add(this.selectionMesh));
7599
7699
  }
7600
7700
  /**
7601
7701
  * Get whether there's an active selection
@@ -7652,9 +7752,9 @@ class mn extends Zt {
7652
7752
  }
7653
7753
  }
7654
7754
  new N(1024, 1024), new B(0);
7655
- class gn {
7755
+ class bn {
7656
7756
  constructor(e, t) {
7657
- this.renderer = e, this.viralViewerApi = t, this.gammaPass = null, this.ssaoPass = null, this.saoPass = null, this.smaaPass = null, this.ssaaPass = null, this.fxaaPass = null, this.taaPass = null, this.sobelPass = null, this.whitePass = null, this.shadowRemovalPass = null, this.outlinePass = null, this.screenSpaceEdgesPass = null, this.selectionOutlinePass = null, this.perfChecker = new Fs(), this._whiteShader = {
7757
+ this.renderer = e, this.viralViewerApi = t, this.gammaPass = null, this.ssaoPass = null, this.saoPass = null, this.smaaPass = null, this.ssaaPass = null, this.fxaaPass = null, this.taaPass = null, this.sobelPass = null, this.whitePass = null, this.shadowRemovalPass = null, this.outlinePass = null, this.screenSpaceEdgesPass = null, this.selectionOutlinePass = null, this.perfChecker = new qs(), this._whiteShader = {
7658
7758
  uniforms: {
7659
7759
  tDiffuse: { value: null },
7660
7760
  shadowTexture: { value: null },
@@ -7794,7 +7894,7 @@ class gn {
7794
7894
  * - Object ID discontinuity detection (object boundaries)
7795
7895
  */
7796
7896
  initScreenSpaceEdgesPass(e, t) {
7797
- this.screenSpaceEdgesPass = new dn(
7897
+ this.screenSpaceEdgesPass = new mn(
7798
7898
  e,
7799
7899
  t,
7800
7900
  new N(window.innerWidth, window.innerHeight),
@@ -7924,7 +8024,7 @@ class gn {
7924
8024
  * Cost: 1 extra draw call + 1 fullscreen pass
7925
8025
  */
7926
8026
  initSelectionOutlinePass(e, t) {
7927
- this.selectionOutlinePass = new mn(
8027
+ this.selectionOutlinePass = new vn(
7928
8028
  e,
7929
8029
  t,
7930
8030
  new N(window.innerWidth, window.innerHeight),
@@ -7995,7 +8095,7 @@ class gn {
7995
8095
  }
7996
8096
  //#endregion
7997
8097
  }
7998
- class fn {
8098
+ class wn {
7999
8099
  constructor(e) {
8000
8100
  this.viralViewerApi = e, this.renderer = new Gt({
8001
8101
  alpha: !0,
@@ -8009,7 +8109,7 @@ class fn {
8009
8109
  console.log("Max Fragment Uniform Vectors ->", i), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(
8010
8110
  this.viralViewerApi.targetElement.offsetWidth,
8011
8111
  this.viralViewerApi.targetElement.offsetHeight
8012
- ), this.renderer.outputColorSpace = hi, this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = di, this.renderer.shadowMap.autoUpdate = !1, this.renderer.shadowMap.needsUpdate = !0, this.renderer.info.autoReset = !1, this.viralViewerApi.targetElement.appendChild(this.renderer.domElement), this.viralViewerApi.options.enablePostProcessing !== !1 && (this.postProcessingRenderer = new gn(
8112
+ ), this.renderer.outputColorSpace = hi, this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = di, this.renderer.shadowMap.autoUpdate = !1, this.renderer.shadowMap.needsUpdate = !0, this.renderer.info.autoReset = !1, this.viralViewerApi.targetElement.appendChild(this.renderer.domElement), this.viralViewerApi.options.enablePostProcessing !== !1 && (this.postProcessingRenderer = new bn(
8013
8113
  this.renderer,
8014
8114
  this.viralViewerApi
8015
8115
  )), this.jitterOffsets = this.generateJitterOffsets(), this.viralViewerApi.emit(R.LOADED_RENDERER);
@@ -8124,14 +8224,14 @@ const de = {
8124
8224
  outlineModel: "viral_outline_model",
8125
8225
  sunlight: "viral_sunlight"
8126
8226
  };
8127
- class vn {
8227
+ class yn {
8128
8228
  constructor(e) {
8129
- this.viralViewerApi = e, this.scene = new ft(), this.objects = [], this.models = [], this.bimWorld = new Ki(), this.outlineModel = new y(), this.hideables = [], this.selectables = [], this.edges = [], this.sunLight = null, this.lights = [], this.transformControls = null, this.lightHelpers = [], this.fullScreenQuadMaterial = new G({
8229
+ this.viralViewerApi = e, this.scene = new ft(), this.objects = [], this.models = [], this.bimWorld = new ts(), this.outlineModel = new y(), this.hideables = [], this.selectables = [], this.edges = [], this.sunLight = null, this.lights = [], this.transformControls = null, this.lightHelpers = [], this.fullScreenQuadMaterial = new G({
8130
8230
  map: null,
8131
8231
  // Use the render target's texture
8132
8232
  side: ee
8133
8233
  }), this.fullScreenQuad = null, this.viralViewerApi.emit(R.LOADED_SCENE), this.bimWorld.name = de.mergedModel, this.addModel(this.bimWorld), this.outlineModel.name = de.outlineModel, this.outlineModel.renderOrder = 0, this.addModel(this.outlineModel);
8134
- const t = new Dt(5, 32, 32), i = new J({
8234
+ const t = new Dt(5, 32, 32), i = new K({
8135
8235
  color: 16768256,
8136
8236
  emissive: 16755200,
8137
8237
  emissiveIntensity: 1
@@ -8201,8 +8301,8 @@ class vn {
8201
8301
  addCube() {
8202
8302
  if (this.scene) {
8203
8303
  const e = new y(
8204
- new Pt(1, 1, 1),
8205
- new J({ color: 16711680 })
8304
+ new Tt(1, 1, 1),
8305
+ new K({ color: 16711680 })
8206
8306
  );
8207
8307
  e.castShadow = !0, e.receiveShadow = !0, this.addObject(e);
8208
8308
  }
@@ -8312,7 +8412,7 @@ const zt = new Float32Array([
8312
8412
  -1,
8313
8413
  1,
8314
8414
  1
8315
- ]), bn = [
8415
+ ]), xn = [
8316
8416
  new E(1, 0, 0),
8317
8417
  // 0: +X
8318
8418
  new E(-1, 0, 0),
@@ -8417,7 +8517,7 @@ const zt = new Float32Array([
8417
8517
  }
8418
8518
  const i = this._getFaceCenter(e);
8419
8519
  this._dragAnchor.position.copy(i), this._dragAnchor.updateMatrixWorld(!0), t.attach(this._dragAnchor), t.setMode("translate");
8420
- const s = bn[e];
8520
+ const s = xn[e];
8421
8521
  t.showX = Math.abs(s.x) > 0.5, t.showY = Math.abs(s.y) > 0.5, t.showZ = Math.abs(s.z) > 0.5, this._positionFaceHighlight(e);
8422
8522
  }
8423
8523
  onDragAnchorChanged() {
@@ -8466,7 +8566,7 @@ const zt = new Float32Array([
8466
8566
  depthTest: !0,
8467
8567
  depthWrite: !0
8468
8568
  }), this._outlineGeometry = new Ui(), this._outlineGeometry.setPositions(zt), this._boxOutline = new Gi(this._outlineGeometry, this._outlineMaterial), this._boxOutline.name = "SectionBoxOutline", this._boxOutline.renderOrder = 0, this._boxOutline.frustumCulled = !1, this.viralViewerApi.viralScene.addObject(this._boxOutline);
8469
- const e = new Pt(2, 2, 2), t = new G({
8569
+ const e = new Tt(2, 2, 2), t = new G({
8470
8570
  transparent: !0,
8471
8571
  opacity: 0,
8472
8572
  side: ee,
@@ -8591,7 +8691,7 @@ const zt = new Float32Array([
8591
8691
  }
8592
8692
  };
8593
8693
  Ge.VISUAL_INSET = 2e-3;
8594
- let It = Ge;
8694
+ let Vt = Ge;
8595
8695
  var We = () => {
8596
8696
  var g = 0, e = document.createElement("div");
8597
8697
  e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e.addEventListener(
@@ -8670,14 +8770,14 @@ We.Panel = (g, e, t) => {
8670
8770
  }
8671
8771
  };
8672
8772
  };
8673
- class wn {
8773
+ class Mn {
8674
8774
  constructor(e) {
8675
8775
  this.viralViewerApi = e, this.stats = null, this.viralViewerApi.targetElement && (this.stats = We(), this.stats.showPanel(0), this.viralViewerApi.targetElement.appendChild(this.stats.dom));
8676
8776
  }
8677
8777
  }
8678
- class yn {
8778
+ class En {
8679
8779
  constructor(e) {
8680
- this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this.exceptElements = [], this.isolateModelId = "0", this.sunConfiguration = es, this._ground = null, this.opacity = 1, this._fog = new vi(13421772, 1, 1e3), this.rainGeometry = new Z(), this.rain = null, this._isGeneratedRain = !1, this.ghostMode = !0, this._batchColors = /* @__PURE__ */ new Map(), this._originalBatchMaterials = /* @__PURE__ */ new Map(), this._batchVisualizationEnabled = !1, this.showHidePercentage = 100, this.randomColor = 100;
8780
+ this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this._outlineUpdateScheduled = !1, this.exceptElements = [], this.isolateModelId = "0", this.sunConfiguration = ss, this._ground = null, this.opacity = 1, this._fog = new vi(13421772, 1, 1e3), this.rainGeometry = new J(), this.rain = null, this._isGeneratedRain = !1, this.ghostMode = !0, this._batchColors = /* @__PURE__ */ new Map(), this._originalBatchMaterials = /* @__PURE__ */ new Map(), this._batchVisualizationEnabled = !1, this.showHidePercentage = 100, this.randomColor = 100;
8681
8781
  }
8682
8782
  /**
8683
8783
  * show all elements and reset back to normal visualization
@@ -8736,7 +8836,7 @@ class yn {
8736
8836
  * Select elements (replaces current selection)
8737
8837
  */
8738
8838
  selectElements(e) {
8739
- e.length > 0 && (this.viralViewerApi.emit(R.SELECT_ELEMENTS, e), this.viralViewerApi.viralScene.bimWorld.select(e, this.exceptElements), this.updateSelectionOutline(), this.viralViewerApi.viralRenderer.render());
8839
+ e.length > 0 && (this.viralViewerApi.emit(R.SELECT_ELEMENTS, e), this.viralViewerApi.viralScene.bimWorld.select(e, this.exceptElements), this.scheduleOutlineUpdate());
8740
8840
  }
8741
8841
  /**
8742
8842
  * Add elements to current selection (multi-select with Shift)
@@ -8755,7 +8855,7 @@ class yn {
8755
8855
  ) || s.push(r);
8756
8856
  });
8757
8857
  const n = [...s, ...i];
8758
- n.length > 0 ? (this.viralViewerApi.viralScene.bimWorld.select(n, this.exceptElements), this.updateSelectionOutline(), this.viralViewerApi.viralRenderer.render()) : this.unselectElements();
8858
+ n.length > 0 ? (this.viralViewerApi.viralScene.bimWorld.select(n, this.exceptElements), this.scheduleOutlineUpdate()) : this.unselectElements();
8759
8859
  }
8760
8860
  /**
8761
8861
  * Unselect all elements
@@ -9012,7 +9112,7 @@ class yn {
9012
9112
  for (let i = 0; i < t.length; i++) {
9013
9113
  const s = t[i];
9014
9114
  if (s.buffer) {
9015
- const n = new Z();
9115
+ const n = new J();
9016
9116
  n.setAttribute("position", new L(s.buffer, 3));
9017
9117
  const r = new y(
9018
9118
  n,
@@ -9034,6 +9134,22 @@ class yn {
9034
9134
  const e = this.viralViewerApi.viralScene.bimWorld.getSelectedElementsPositions();
9035
9135
  (t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateSelectionOutline(e);
9036
9136
  }
9137
+ /**
9138
+ * Schedule outline update for the next animation frame.
9139
+ * Batches multiple rapid selection changes into a single update.
9140
+ * Uses Web Worker to avoid blocking the main thread.
9141
+ */
9142
+ scheduleOutlineUpdate() {
9143
+ this._outlineUpdateScheduled || (this._outlineUpdateScheduled = !0, requestAnimationFrame(async () => {
9144
+ var t;
9145
+ if (this._outlineUpdateScheduled = !1, !this._selectionOutlineEnabled)
9146
+ return;
9147
+ const e = await this.viralViewerApi.viralScene.bimWorld.getSelectedElementsPositionsAsync();
9148
+ (t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateSelectionOutline(
9149
+ e
9150
+ ), this.viralViewerApi.viralRenderer.render();
9151
+ }));
9152
+ }
9037
9153
  /**
9038
9154
  * Enable selection outline effect
9039
9155
  */
@@ -9068,18 +9184,18 @@ class yn {
9068
9184
  this.viralViewerApi.viralScene.lights.forEach((e) => {
9069
9185
  e.name !== de.sunlight && (e.visible = !1);
9070
9186
  }), this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach((e) => {
9071
- e instanceof J && e.transparent && (e.emissiveIntensity = 0.5);
9187
+ e instanceof K && e.transparent && (e.emissiveIntensity = 0.5);
9072
9188
  }), this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
9073
- e.material instanceof J && e.material.transparent && e.enableLights && e.enableLights();
9189
+ e.material instanceof K && e.material.transparent && e.enableLights && e.enableLights();
9074
9190
  }), this.viralViewerApi.viralRenderer.render();
9075
9191
  }
9076
9192
  disableNight() {
9077
9193
  this.viralViewerApi.viralScene.lights.forEach((e) => {
9078
9194
  e.name !== de.sunlight && (e.visible = !0);
9079
9195
  }), this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach((e) => {
9080
- e instanceof J && e.transparent && (e.emissiveIntensity = 0);
9196
+ e instanceof K && e.transparent && (e.emissiveIntensity = 0);
9081
9197
  }), this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
9082
- e.material instanceof J && e.material.transparent && e.disableLights && e.disableLights();
9198
+ e.material instanceof K && e.material.transparent && e.disableLights && e.disableLights();
9083
9199
  }), this.viralViewerApi.viralRenderer.render();
9084
9200
  }
9085
9201
  //#endregion
@@ -9227,7 +9343,7 @@ class yn {
9227
9343
  i,
9228
9344
  this._generateDistinctColor(i)
9229
9345
  );
9230
- const s = this._batchColors.get(i), n = new J({
9346
+ const s = this._batchColors.get(i), n = new K({
9231
9347
  color: s,
9232
9348
  roughness: 0.7,
9233
9349
  metalness: 0.2,
@@ -9310,7 +9426,7 @@ class yn {
9310
9426
  }
9311
9427
  //#endregion
9312
9428
  }
9313
- class xn {
9429
+ class Sn {
9314
9430
  constructor(e) {
9315
9431
  this.viralViewerApi = e, this.contextMenu = null, this.contextItems = [], this.injectContextMenu();
9316
9432
  }
@@ -9360,7 +9476,7 @@ class xn {
9360
9476
  this.contextItems.push([e, t, i, s]);
9361
9477
  }
9362
9478
  }
9363
- class Mn {
9479
+ class Cn {
9364
9480
  constructor(e) {
9365
9481
  this.viralViewerApi = e, this.modal = null, this.modalTitle = null, this.modalBody = null, this.modalBodyLeft = null, this.modalBodyRight = null, this.properties = null, this.rawModal = `<div class="modal" id="myModal">
9366
9482
  <div class="modal-content">
@@ -9556,17 +9672,17 @@ const Kt = {
9556
9672
  importLink: "https://fonts.googleapis.com/css2?family=Quicksand:wght@300&display=swap",
9557
9673
  fontFamily: "Quicksand, sans-serif"
9558
9674
  }
9559
- }, En = (g) => {
9675
+ }, An = (g) => {
9560
9676
  const e = document.createElement("style");
9561
9677
  e.innerHTML = `@import url(${Kt[g]});`, document.head.appendChild(e);
9562
- }, Sn = (g, e) => {
9678
+ }, _n = (g, e) => {
9563
9679
  const t = Kt[e];
9564
9680
  g && t && (g.style.fontFamily = t.fontFamily);
9565
9681
  };
9566
- class Cn {
9682
+ class In {
9567
9683
  constructor(e) {
9568
9684
  this.viralNavigationCube = e, this._mouseDownTime = null, this.clickThreshold = 250, this._handleClick = async (t) => {
9569
- var c, h, d, u, p, m, f, v, b, w, S, A, C, M, _, V, O, I, T, j, H;
9685
+ var c, h, d, u, p, m, f, v, b, w, S, A, C, M, _, I, O, V, P, j, H;
9570
9686
  if (!((c = this.viralNavigationCube.cubeScene) != null && c.activePlane) || (h = this.viralNavigationCube.cubeCamera) != null && h.cameraControlHasMoved)
9571
9687
  return console.log("false"), !1;
9572
9688
  let i = new E(
@@ -9593,7 +9709,7 @@ class Cn {
9593
9709
  (M = (C = this.viralNavigationCube.cubeCamera) == null ? void 0 : C.camera) == null ? void 0 : M.position
9594
9710
  );
9595
9711
  const r = new E();
9596
- (V = this.viralNavigationCube.viralViewerApi.viralCamera) == null || V.cameraControls.getTarget(r);
9712
+ (I = this.viralNavigationCube.viralViewerApi.viralCamera) == null || I.cameraControls.getTarget(r);
9597
9713
  const o = new E();
9598
9714
  (O = this.viralNavigationCube.viralViewerApi.viralCamera) == null || O.cameraControls.getPosition(
9599
9715
  o
@@ -9603,7 +9719,7 @@ class Cn {
9603
9719
  Math.round(n.y),
9604
9720
  Math.round(n.z)
9605
9721
  );
9606
- l.multiplyScalar(a), (I = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || I.updateMatrixWorld(), (T = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || T.setTarget(0, 0, 0), n.multiplyScalar(2), (j = this.viralNavigationCube.cubeCamera) == null || j.cameraControls.setPosition(
9722
+ l.multiplyScalar(a), (V = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || V.updateMatrixWorld(), (P = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || P.setTarget(0, 0, 0), n.multiplyScalar(2), (j = this.viralNavigationCube.cubeCamera) == null || j.cameraControls.setPosition(
9607
9723
  n.x,
9608
9724
  n.y,
9609
9725
  n.z,
@@ -9626,8 +9742,8 @@ class Cn {
9626
9742
  );
9627
9743
  if (((a = this.viralNavigationCube.cubeScene) == null ? void 0 : a.activePlane.children.length) > 0) {
9628
9744
  let U = 0, W = 0, F = 0;
9629
- for (let X = 0; X < ((l = this.viralNavigationCube.cubeScene) == null ? void 0 : l.activePlane.children.length); X++) {
9630
- const ie = (c = this.viralNavigationCube.cubeScene) == null ? void 0 : c.activePlane.children[X];
9745
+ for (let Y = 0; Y < ((l = this.viralNavigationCube.cubeScene) == null ? void 0 : l.activePlane.children.length); Y++) {
9746
+ const ie = (c = this.viralNavigationCube.cubeScene) == null ? void 0 : c.activePlane.children[Y];
9631
9747
  U += ie.position.x, W += ie.position.y, F += ie.position.z;
9632
9748
  }
9633
9749
  O = new E(
@@ -9636,11 +9752,11 @@ class Cn {
9636
9752
  F / ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.activePlane.children.length)
9637
9753
  );
9638
9754
  }
9639
- const I = new E();
9755
+ const V = new E();
9640
9756
  (p = this.viralNavigationCube.cubeCamera) == null || p.cameraControls.getTarget(
9641
- I
9757
+ V
9642
9758
  );
9643
- const T = O.clone().sub(I).normalize();
9759
+ const P = O.clone().sub(V).normalize();
9644
9760
  (v = this.viralNavigationCube.cubeCamera) == null || v.cameraControlOldPosition.copy(
9645
9761
  (f = (m = this.viralNavigationCube.cubeCamera) == null ? void 0 : m.camera) == null ? void 0 : f.position
9646
9762
  );
@@ -9653,18 +9769,18 @@ class Cn {
9653
9769
  H
9654
9770
  );
9655
9771
  const q = H.clone().sub(j).length(), $ = new E(
9656
- Math.round(T.x),
9657
- Math.round(T.y),
9658
- Math.round(T.z)
9772
+ Math.round(P.x),
9773
+ Math.round(P.y),
9774
+ Math.round(P.z)
9659
9775
  );
9660
9776
  $.multiplyScalar(q), (S = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || S.updateMatrixWorld(), (A = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || A.setTarget(
9661
9777
  0,
9662
9778
  0,
9663
9779
  0
9664
- ), T.multiplyScalar(2), (C = this.viralNavigationCube.cubeCamera) == null || C.cameraControls.setPosition(
9665
- T.x,
9666
- T.y,
9667
- T.z,
9780
+ ), P.multiplyScalar(2), (C = this.viralNavigationCube.cubeCamera) == null || C.cameraControls.setPosition(
9781
+ P.x,
9782
+ P.y,
9783
+ P.z,
9668
9784
  !0
9669
9785
  ), (M = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || M.setPosition(
9670
9786
  $.x,
@@ -9684,7 +9800,7 @@ class Cn {
9684
9800
  }
9685
9801
  this.viralNavigationCube.cubeScene.activePlane = null;
9686
9802
  }
9687
- const i = t.offsetX, s = t.offsetY, n = (c = this.viralNavigationCube.cubeRenderer) == null ? void 0 : c.renderer.getSize(new N()), r = new N(i / n.width * 2 - 1, -s / n.height * 2 + 1), o = new Tt();
9803
+ const i = t.offsetX, s = t.offsetY, n = (c = this.viralNavigationCube.cubeRenderer) == null ? void 0 : c.renderer.getSize(new N()), r = new N(i / n.width * 2 - 1, -s / n.height * 2 + 1), o = new Pt();
9688
9804
  o.setFromCamera(r, (h = this.viralNavigationCube.cubeCamera) == null ? void 0 : h.camera);
9689
9805
  const a = o.intersectObjects((d = this.viralNavigationCube.cubeScene) == null ? void 0 : d.objects);
9690
9806
  if (a.length > 0 && a[0].object != ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.cube)) {
@@ -9711,7 +9827,7 @@ class Cn {
9711
9827
  }
9712
9828
  //#endregion
9713
9829
  }
9714
- class An {
9830
+ class Vn {
9715
9831
  constructor(e) {
9716
9832
  this.viralNavigationCube = e, this.camera = null, this.cameraControls = null, this.cameraControlOldPosition = new E(), this.cameraControlNewPosition = new E(), this.cameraControlHasMoved = !1, this.setupCamera(), this.setupHandle();
9717
9833
  }
@@ -9749,7 +9865,7 @@ class An {
9749
9865
  window.addEventListener("mousedown", e, !1), window.addEventListener("mousemove", t, !1), window.addEventListener("touchstart", e, !1), window.addEventListener("touchmove", t, !0);
9750
9866
  }
9751
9867
  }
9752
- class _n {
9868
+ class Pn {
9753
9869
  constructor(e) {
9754
9870
  this.viralNavigationCube = e, this.renderer = new Gt({
9755
9871
  alpha: !0,
@@ -9784,7 +9900,7 @@ class _n {
9784
9900
  // }
9785
9901
  // }
9786
9902
  }
9787
- class Vn {
9903
+ class Tn {
9788
9904
  constructor(e, t = 1) {
9789
9905
  this.viralNavigationCube = e, this.scene = new ft(), this.objects = [], this.cube = null, this.activePlane = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.addCube(), this.addPlanes();
9790
9906
  }
@@ -9801,7 +9917,7 @@ class Vn {
9801
9917
  map: i.load(s.toDataURL())
9802
9918
  });
9803
9919
  const a = this.cubeScale;
9804
- this.cube = new y(new Pt(a, a, a), e), this.addObject(this.cube);
9920
+ this.cube = new y(new Tt(a, a, a), e), this.addObject(this.cube);
9805
9921
  }
9806
9922
  }
9807
9923
  addPlanes() {
@@ -9841,14 +9957,14 @@ class Vn {
9841
9957
  M.position.z = -l, M.rotation.z = Math.PI / 2, M.position.y = -(i / 2 + n / 2);
9842
9958
  const _ = new y(a, t.clone());
9843
9959
  _.position.z = -l, _.position.x = i / 2 + n / 2, _.position.y = i / 2 + n / 2;
9844
- const V = new y(a, t.clone());
9845
- V.position.z = -l, V.position.x = -(i / 2 + n / 2), V.position.y = i / 2 + n / 2;
9960
+ const I = new y(a, t.clone());
9961
+ I.position.z = -l, I.position.x = -(i / 2 + n / 2), I.position.y = i / 2 + n / 2;
9846
9962
  const O = new y(a, t.clone());
9847
9963
  O.position.z = -l, O.position.x = -(i / 2 + n / 2), O.position.y = -(i / 2 + n / 2);
9848
- const I = new y(a, t.clone());
9849
- I.position.z = -l, I.position.x = i / 2 + n / 2, I.position.y = -(i / 2 + n / 2);
9850
- const T = new y(r, t.clone());
9851
- T.rotation.y = Math.PI / 2, T.position.x = l, T.name = "RIGHT";
9964
+ const V = new y(a, t.clone());
9965
+ V.position.z = -l, V.position.x = i / 2 + n / 2, V.position.y = -(i / 2 + n / 2);
9966
+ const P = new y(r, t.clone());
9967
+ P.rotation.y = Math.PI / 2, P.position.x = l, P.name = "RIGHT";
9852
9968
  const j = new y(o, t.clone());
9853
9969
  j.rotation.y = Math.PI / 2, j.position.x = l, j.position.z = i / 2 + n / 2;
9854
9970
  const H = new y(o, t.clone());
@@ -9863,8 +9979,8 @@ class Vn {
9863
9979
  W.rotation.y = Math.PI / 2, W.position.x = l, W.position.z = -(i / 2 + n / 2), W.position.y = i / 2 + n / 2;
9864
9980
  const F = new y(a, t.clone());
9865
9981
  F.rotation.y = Math.PI / 2, F.position.x = l, F.position.z = -(i / 2 + n / 2), F.position.y = -(i / 2 + n / 2);
9866
- const X = new y(a, t.clone());
9867
- X.rotation.y = Math.PI / 2, X.position.x = l, X.position.z = i / 2 + n / 2, X.position.y = -(i / 2 + n / 2);
9982
+ const Y = new y(a, t.clone());
9983
+ Y.rotation.y = Math.PI / 2, Y.position.x = l, Y.position.z = i / 2 + n / 2, Y.position.y = -(i / 2 + n / 2);
9868
9984
  const ie = new y(r, t.clone());
9869
9985
  ie.rotation.y = Math.PI / 2, ie.position.x = -l, ie.name = "LEFT";
9870
9986
  const Ue = new y(o, t.clone());
@@ -9909,20 +10025,20 @@ class Vn {
9909
10025
  Je.rotation.x = Math.PI / 2, Je.position.y = -l, Je.position.x = -(i / 2 + n / 2);
9910
10026
  const _e = new y(o, t.clone());
9911
10027
  _e.rotation.x = Math.PI / 2, _e.position.y = -l, _e.rotation.z = Math.PI / 2, _e.position.z = i / 2 + n / 2;
9912
- const Ve = new y(o, t.clone());
9913
- Ve.rotation.x = Math.PI / 2, Ve.position.y = -l, Ve.rotation.z = Math.PI / 2, Ve.position.z = -(i / 2 + n / 2);
9914
- const Ie = new y(a, t.clone());
9915
- Ie.rotation.x = Math.PI / 2, Ie.position.y = -l, Ie.position.z = i / 2 + n / 2, Ie.position.x = -(i / 2 + n / 2);
9916
- const Te = new y(a, t.clone());
9917
- Te.rotation.x = Math.PI / 2, Te.position.y = -l, Te.position.z = i / 2 + n / 2, Te.position.x = i / 2 + n / 2;
10028
+ const Ie = new y(o, t.clone());
10029
+ Ie.rotation.x = Math.PI / 2, Ie.position.y = -l, Ie.rotation.z = Math.PI / 2, Ie.position.z = -(i / 2 + n / 2);
10030
+ const Ve = new y(a, t.clone());
10031
+ Ve.rotation.x = Math.PI / 2, Ve.position.y = -l, Ve.position.z = i / 2 + n / 2, Ve.position.x = -(i / 2 + n / 2);
9918
10032
  const Pe = new y(a, t.clone());
9919
- Pe.rotation.x = Math.PI / 2, Pe.position.y = -l, Pe.position.z = -(i / 2 + n / 2), Pe.position.x = i / 2 + n / 2;
10033
+ Pe.rotation.x = Math.PI / 2, Pe.position.y = -l, Pe.position.z = i / 2 + n / 2, Pe.position.x = i / 2 + n / 2;
10034
+ const Te = new y(a, t.clone());
10035
+ Te.rotation.x = Math.PI / 2, Te.position.y = -l, Te.position.z = -(i / 2 + n / 2), Te.position.x = i / 2 + n / 2;
9920
10036
  const Oe = new y(a, t.clone());
9921
10037
  Oe.rotation.x = Math.PI / 2, Oe.position.y = -l, Oe.position.z = -(i / 2 + n / 2), Oe.position.x = -(i / 2 + n / 2);
9922
10038
  const Jt = new G({
9923
10039
  color: 11184810
9924
10040
  }), ei = new ae(1 * e, 1 * e), bt = new y(ei, Jt);
9925
- bt.rotation.x = -Math.PI / 2, bt.position.y = -0.6 * e, this.addObject(c), this.addObject(w), this.addObject(T), this.addObject(ie), this.addObject(Qe), this.addObject(Xe), this.addObject(bt);
10041
+ bt.rotation.x = -Math.PI / 2, bt.position.y = -0.6 * e, this.addObject(c), this.addObject(w), this.addObject(P), this.addObject(ie), this.addObject(Qe), this.addObject(Xe), this.addObject(bt);
9926
10042
  const et = new y();
9927
10043
  et.name = "1131", et.add(h), et.add(j), this.addObject(et);
9928
10044
  const tt = new y();
@@ -9932,7 +10048,7 @@ class Vn {
9932
10048
  const st = new y();
9933
10049
  st.name = "1463", st.add(p), st.add(_e), this.addObject(st);
9934
10050
  const nt = new y();
9935
- nt.name = "2464", nt.add(M), nt.add(Ve), this.addObject(nt);
10051
+ nt.name = "2464", nt.add(M), nt.add(Ie), this.addObject(nt);
9936
10052
  const rt = new y();
9937
10053
  rt.name = "3221", rt.add(H), rt.add(S), this.addObject(rt);
9938
10054
  const at = new y();
@@ -9952,23 +10068,23 @@ class Vn {
9952
10068
  const Re = new y();
9953
10069
  Re.name = "corner2", Re.add(f), Re.add(U), Re.add(Ce), this.addObject(Re);
9954
10070
  const Le = new y();
9955
- Le.name = "corner3", Le.add(v), Le.add(X), Le.add(Te), this.addObject(Le);
10071
+ Le.name = "corner3", Le.add(v), Le.add(Y), Le.add(Pe), this.addObject(Le);
9956
10072
  const ke = new y();
9957
- ke.name = "corner4", ke.add(b), ke.add(we), ke.add(Ie), this.addObject(ke);
10073
+ ke.name = "corner4", ke.add(b), ke.add(we), ke.add(Ve), this.addObject(ke);
9958
10074
  const Be = new y();
9959
10075
  Be.name = "corner5", Be.add(_), Be.add(W), Be.add(Se), this.addObject(Be);
9960
10076
  const ze = new y();
9961
- ze.name = "corner6", ze.add(V), ze.add(Ee), ze.add(ve), this.addObject(ze);
10077
+ ze.name = "corner6", ze.add(I), ze.add(Ee), ze.add(ve), this.addObject(ze);
9962
10078
  const Ne = new y();
9963
10079
  Ne.name = "corner7", Ne.add(O), Ne.add(ye), Ne.add(Oe), this.addObject(Ne);
9964
10080
  const $e = new y();
9965
- $e.name = "corner8", $e.add(I), $e.add(F), $e.add(Pe), this.addObject($e);
10081
+ $e.name = "corner8", $e.add(V), $e.add(F), $e.add(Te), this.addObject($e);
9966
10082
  }
9967
10083
  }
9968
- class In {
10084
+ class On {
9969
10085
  //* view cube from third party (new approach)
9970
10086
  constructor(e, t = 1) {
9971
- this.viralViewerApi = e, this.targetElement = null, this.cubeScene = null, this.cubeRenderer = null, this.cubeCamera = null, this.cubeMouse = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.injectCubeWrapperElement(), this.targetElement = document.getElementById("orientCubeWrapper"), this.targetElement && (this.cubeScene = new Vn(this, this.cubeScale), this.cubeRenderer = new _n(this), this.cubeCamera = new An(this), this.cubeMouse = new Cn(this)), this.viralViewerApi.emit(R.LOADED_CUBE);
10087
+ this.viralViewerApi = e, this.targetElement = null, this.cubeScene = null, this.cubeRenderer = null, this.cubeCamera = null, this.cubeMouse = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.injectCubeWrapperElement(), this.targetElement = document.getElementById("orientCubeWrapper"), this.targetElement && (this.cubeScene = new Tn(this, this.cubeScale), this.cubeRenderer = new Pn(this), this.cubeCamera = new Vn(this), this.cubeMouse = new In(this)), this.viralViewerApi.emit(R.LOADED_CUBE);
9972
10088
  }
9973
10089
  injectCubeWrapperElement() {
9974
10090
  if (this.viralViewerApi.targetElement) {
@@ -9989,7 +10105,7 @@ class In {
9989
10105
  this.viralViewerApi.viralCamera.backHome();
9990
10106
  }
9991
10107
  }
9992
- class Tn {
10108
+ class Dn {
9993
10109
  constructor(e) {
9994
10110
  this.viralViewerApi = e, this.contextMenu = null, this.injectContextMenu();
9995
10111
  }
@@ -10006,7 +10122,7 @@ class Tn {
10006
10122
  this.contextMenu && this.contextMenu.style.setProperty("display", "none");
10007
10123
  }
10008
10124
  }
10009
- class Pn {
10125
+ class Rn {
10010
10126
  constructor(e) {
10011
10127
  this.viralViewerApi = e, this.spinner = null, this.logo = `<svg
10012
10128
  width="348.25488"
@@ -10090,7 +10206,7 @@ class Pn {
10090
10206
  this.spinner && this.spinner.style.setProperty("display", "none");
10091
10207
  }
10092
10208
  }
10093
- class On {
10209
+ class Ln {
10094
10210
  constructor(e) {
10095
10211
  this.viralTools = e;
10096
10212
  }
@@ -10099,7 +10215,7 @@ class On {
10099
10215
  e.activate && console.log((t = this.viralTools.viralViewerApi.viralCamera.camera) == null ? void 0 : t.position);
10100
10216
  }
10101
10217
  }
10102
- class Dn {
10218
+ class kn {
10103
10219
  constructor(e) {
10104
10220
  this.viralTools = e;
10105
10221
  }
@@ -10107,7 +10223,7 @@ class Dn {
10107
10223
  this.viralTools.viralViewerApi.targetElement && e.activate;
10108
10224
  }
10109
10225
  }
10110
- class Rn {
10226
+ class Bn {
10111
10227
  constructor(e) {
10112
10228
  this.viralTools = e;
10113
10229
  }
@@ -10124,7 +10240,7 @@ class Rn {
10124
10240
  ));
10125
10241
  }
10126
10242
  }
10127
- class Ln {
10243
+ class zn {
10128
10244
  constructor(e) {
10129
10245
  this.viralTools = e, this.isActivated = !1;
10130
10246
  }
@@ -10144,7 +10260,7 @@ class Ln {
10144
10260
  }
10145
10261
  }
10146
10262
  }
10147
- class kn {
10263
+ class Nn {
10148
10264
  constructor(e) {
10149
10265
  this.viralTools = e, this.viralToolMeasureScene = new ft(), this.isActivated = !1, this.measures = [], this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.defaultSprite = this.makeSprite(), this.measureObject = new y(), this.tempMeasure = new y(), this.tempSprite1 = null, this.tempLine = null, this.tempSprite2 = null;
10150
10266
  }
@@ -10220,7 +10336,7 @@ class kn {
10220
10336
  const i = new xi({
10221
10337
  color: D.hexToThreejsColor(x.primary),
10222
10338
  linewidth: 20
10223
- }), s = [e, t], n = new Z().setFromPoints(s);
10339
+ }), s = [e, t], n = new J().setFromPoints(s);
10224
10340
  return new mt(n, i);
10225
10341
  }
10226
10342
  makeDistanceSprite(e, t) {
@@ -10257,7 +10373,7 @@ class kn {
10257
10373
  e.code == "Escape" && (D.clearChildren(this.tempMeasure), this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.viralTools.viralViewerApi.viralRenderer.render());
10258
10374
  }
10259
10375
  }
10260
- class Bn {
10376
+ class $n {
10261
10377
  constructor(e) {
10262
10378
  this.viralTools = e;
10263
10379
  }
@@ -10292,7 +10408,7 @@ class Bn {
10292
10408
  }
10293
10409
  }
10294
10410
  }
10295
- class zn {
10411
+ class jn {
10296
10412
  constructor(e) {
10297
10413
  this.viralViewerApi = e, this.tools = [
10298
10414
  {
@@ -10396,7 +10512,7 @@ class zn {
10396
10512
  }
10397
10513
  ]
10398
10514
  }
10399
- ], this.items = [], this.viralToolAvatar = new Dn(this), this.viralToolDarkMode = new Rn(this), this.viralToolSunlight = new Bn(this), this.viralToolElevation = new Ln(this), this.viralToolMeasure = new kn(this), this.viralToolAmbientOcclusion = new On(this), this.dehydratedCachedData(), this.executeToolsByDefault(), this.injectTools(), this.viralViewerApi.emit(R.LOADED_TOOLS);
10515
+ ], this.items = [], this.viralToolAvatar = new kn(this), this.viralToolDarkMode = new Bn(this), this.viralToolSunlight = new $n(this), this.viralToolElevation = new zn(this), this.viralToolMeasure = new Nn(this), this.viralToolAmbientOcclusion = new Ln(this), this.dehydratedCachedData(), this.executeToolsByDefault(), this.injectTools(), this.viralViewerApi.emit(R.LOADED_TOOLS);
10400
10516
  }
10401
10517
  //#region Init
10402
10518
  injectTools() {
@@ -10480,7 +10596,7 @@ class zn {
10480
10596
  }
10481
10597
  //#endregion
10482
10598
  }
10483
- class Nn {
10599
+ class Hn {
10484
10600
  set(e, t) {
10485
10601
  localStorage[e] = t;
10486
10602
  }
@@ -10529,7 +10645,7 @@ class Nn {
10529
10645
  localStorage.clear();
10530
10646
  }
10531
10647
  }
10532
- class br extends Bs {
10648
+ class xr extends $s {
10533
10649
  constructor(e = {
10534
10650
  isDev: !1,
10535
10651
  cameraZUp: !1,
@@ -10541,12 +10657,12 @@ class br extends Bs {
10541
10657
  adaptiveEdges: !0,
10542
10658
  adaptiveAmbientOcclusion: !0
10543
10659
  }) {
10544
- super(), this.viralCompressProcessor = new ws(), this.localStorageService = new Nn(), this.viralStats = null, this.viralSectionBox = null, this.viralBatchDebugPanel = null, this.viralRenderDebugPanel = null, this.viralInstancedDebugPanel = null, this.options = e, this.viralLifecycleEventHandler = new js(this, this.options), this.targetElement = e.container, En("QUICK_SAND"), Sn(this.targetElement, "QUICK_SAND"), this.options.enableTools && (this.viralTools = new zn(this)), this.viralSpinner = new Pn(this), this.viralDraggableModal = new Mn(this), this.viralContextMenu = new xn(this), this.viralPivotPoint = new Tn(this), this.viralScene = new vn(this), this.viralMaterialManager = new sn(this), this.viralRenderer = new fn(this), this.viralCamera = new bs(this), this.options.enableNavigationCube && (this.viralNavigationCube = new In(
10660
+ super(), this.viralCompressProcessor = new Ms(), this.localStorageService = new Hn(), this.viralStats = null, this.viralSectionBox = null, this.viralBatchDebugPanel = null, this.viralRenderDebugPanel = null, this.viralInstancedDebugPanel = null, this.options = e, this.viralLifecycleEventHandler = new Fs(this, this.options), this.targetElement = e.container, An("QUICK_SAND"), _n(this.targetElement, "QUICK_SAND"), this.options.enableTools && (this.viralTools = new jn(this)), this.viralSpinner = new Rn(this), this.viralDraggableModal = new Cn(this), this.viralContextMenu = new Sn(this), this.viralPivotPoint = new Dn(this), this.viralScene = new yn(this), this.viralMaterialManager = new an(this), this.viralRenderer = new wn(this), this.viralCamera = new xs(this), this.options.enableNavigationCube && (this.viralNavigationCube = new On(
10545
10661
  this,
10546
10662
  this.options.navigationCubeScale || 1
10547
- )), this.viralMouse = new Ns(this), this.viralKeyboard = new zs(this), this.viralAnimation = new ds(this), this.viralVisibilityManager = new yn(this), this.viralCentralizedEventHandler = new $s(this), this.viralLoader = new tn(this), this.viralBVH = new fs(), this.viralDataManager = new ks(this), this.viralAvatarManager = new gs(this), this.options.isDev && (this.viralStats = new wn(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
10663
+ )), this.viralMouse = new Hs(this), this.viralKeyboard = new js(this), this.viralAnimation = new ms(this), this.viralVisibilityManager = new En(this), this.viralCentralizedEventHandler = new Ws(this), this.viralLoader = new rn(this), this.viralBVH = new ws(), this.viralDataManager = new Ns(this), this.viralAvatarManager = new bs(this), this.options.isDev && (this.viralStats = new Mn(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
10548
10664
  const t = window;
10549
- t.VIRAL_VIEWER = this, this.viralSectionBox = new It(this), this.viralBatchDebugPanel = new ls(this), this.viralRenderDebugPanel = new hs(this), this.viralInstancedDebugPanel = new cs(this), this.options.isDev && import("./lil-gui.esm-BtfdsiIY.mjs").then(({ GUI: i }) => {
10665
+ t.VIRAL_VIEWER = this, this.viralSectionBox = new Vt(this), this.viralBatchDebugPanel = new ds(this), this.viralRenderDebugPanel = new ps(this), this.viralInstancedDebugPanel = new us(this), this.options.isDev && import("./lil-gui.esm-BtfdsiIY.mjs").then(({ GUI: i }) => {
10550
10666
  var b, w, S, A, C;
10551
10667
  const s = new i({ title: "Controls" }), n = s.addFolder("Sun Light");
10552
10668
  n.add(this.viralScene.sunLight, "visible").onChange(() => {
@@ -10657,40 +10773,40 @@ class br extends Bs {
10657
10773
  1,
10658
10774
  64,
10659
10775
  1
10660
- ).onChange((I) => {
10661
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples = I, this.viralRenderer.render();
10776
+ ).onChange((V) => {
10777
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples = V, this.viralRenderer.render();
10662
10778
  }), _.add(
10663
10779
  (w = this.viralRenderer.postProcessingRenderer) == null ? void 0 : w.n8aoPass.configuration,
10664
10780
  "aoRadius",
10665
10781
  1,
10666
10782
  10,
10667
10783
  0.01
10668
- ).onChange((I) => {
10669
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius = I, this.viralRenderer.render();
10784
+ ).onChange((V) => {
10785
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius = V, this.viralRenderer.render();
10670
10786
  }), _.add(
10671
10787
  (S = this.viralRenderer.postProcessingRenderer) == null ? void 0 : S.n8aoPass.configuration,
10672
10788
  "denoiseRadius",
10673
10789
  0,
10674
10790
  24,
10675
10791
  0.01
10676
- ).onChange((I) => {
10677
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius = I, this.viralRenderer.render();
10792
+ ).onChange((V) => {
10793
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius = V, this.viralRenderer.render();
10678
10794
  }), _.add(
10679
10795
  (A = this.viralRenderer.postProcessingRenderer) == null ? void 0 : A.n8aoPass.configuration,
10680
10796
  "intensity",
10681
10797
  0,
10682
10798
  10,
10683
10799
  0.01
10684
- ).onChange((I) => {
10685
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity = I, this.viralRenderer.render();
10800
+ ).onChange((V) => {
10801
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity = V, this.viralRenderer.render();
10686
10802
  }), _.add(
10687
10803
  (C = this.viralRenderer.postProcessingRenderer) == null ? void 0 : C.n8aoPass.configuration,
10688
10804
  "distanceFalloff",
10689
10805
  0,
10690
10806
  10,
10691
10807
  0.01
10692
- ).onChange((I) => {
10693
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff = I, this.viralRenderer.render();
10808
+ ).onChange((V) => {
10809
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff = V, this.viralRenderer.render();
10694
10810
  }), M.add(
10695
10811
  this.viralRenderer.postProcessingRenderer,
10696
10812
  "enableSobel"
@@ -10698,11 +10814,11 @@ class br extends Bs {
10698
10814
  this.viralRenderer.postProcessingRenderer,
10699
10815
  "disableSobel"
10700
10816
  );
10701
- const V = M.addFolder("Screen-Space Edges");
10702
- V.add(this.viralRenderer.postProcessingRenderer, "enableScreenSpaceEdges").name("Enable"), V.add(this.viralRenderer.postProcessingRenderer, "disableScreenSpaceEdges").name("Disable"), V.add(
10817
+ const I = M.addFolder("Screen-Space Edges");
10818
+ I.add(this.viralRenderer.postProcessingRenderer, "enableScreenSpaceEdges").name("Enable"), I.add(this.viralRenderer.postProcessingRenderer, "disableScreenSpaceEdges").name("Disable"), I.add(
10703
10819
  this.viralRenderer.postProcessingRenderer,
10704
10820
  "setScreenSpaceEdgesPenMode"
10705
- ).name("Pen Mode"), V.add(
10821
+ ).name("Pen Mode"), I.add(
10706
10822
  this.viralRenderer.postProcessingRenderer,
10707
10823
  "setScreenSpaceEdgesShadedMode"
10708
10824
  ).name("Shaded Mode");
@@ -10725,48 +10841,48 @@ class br extends Bs {
10725
10841
  enableObjectIdEdges: !1
10726
10842
  // Disable - most expensive
10727
10843
  };
10728
- V.addColor(O, "edgeColor").name("Edge Color").onChange((I) => {
10729
- var T;
10730
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeColor(
10731
- parseInt(I.replace("#", "0x"))
10844
+ I.addColor(O, "edgeColor").name("Edge Color").onChange((V) => {
10845
+ var P;
10846
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgeColor(
10847
+ parseInt(V.replace("#", "0x"))
10732
10848
  ), this.viralRenderer.render();
10733
- }), V.add(O, "edgeOpacity", 0, 1, 0.05).name("Opacity").onChange((I) => {
10734
- var T;
10735
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeOpacity(I), this.viralRenderer.render();
10736
- }), V.add(O, "edgeThickness", 0.5, 5, 0.1).name("Thickness").onChange((I) => {
10737
- var T;
10738
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeThickness(
10739
- I
10849
+ }), I.add(O, "edgeOpacity", 0, 1, 0.05).name("Opacity").onChange((V) => {
10850
+ var P;
10851
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgeOpacity(V), this.viralRenderer.render();
10852
+ }), I.add(O, "edgeThickness", 0.5, 5, 0.1).name("Thickness").onChange((V) => {
10853
+ var P;
10854
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgeThickness(
10855
+ V
10740
10856
  ), this.viralRenderer.render();
10741
- }), V.add(O, "depthMultiplier", 0, 3, 0.1).name("Depth Sensitivity").onChange((I) => {
10742
- var T;
10743
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgesOptions({
10744
- depthMultiplier: I
10857
+ }), I.add(O, "depthMultiplier", 0, 3, 0.1).name("Depth Sensitivity").onChange((V) => {
10858
+ var P;
10859
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgesOptions({
10860
+ depthMultiplier: V
10745
10861
  }), this.viralRenderer.render();
10746
- }), V.add(O, "normalMultiplier", 0, 3, 0.1).name("Normal Sensitivity").onChange((I) => {
10747
- var T;
10748
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgesOptions({
10749
- normalMultiplier: I
10862
+ }), I.add(O, "normalMultiplier", 0, 3, 0.1).name("Normal Sensitivity").onChange((V) => {
10863
+ var P;
10864
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgesOptions({
10865
+ normalMultiplier: V
10750
10866
  }), this.viralRenderer.render();
10751
- }), V.add(O, "normalBias", 0, 1, 0.01).name("Normal Bias").onChange((I) => {
10752
- var T;
10753
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgesOptions({
10754
- normalBias: I
10867
+ }), I.add(O, "normalBias", 0, 1, 0.01).name("Normal Bias").onChange((V) => {
10868
+ var P;
10869
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgesOptions({
10870
+ normalBias: V
10755
10871
  }), this.viralRenderer.render();
10756
- }), V.add(O, "enableDepthEdges").name("Depth Edges").onChange((I) => {
10757
- var T;
10758
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeMethods({
10759
- depth: I
10872
+ }), I.add(O, "enableDepthEdges").name("Depth Edges").onChange((V) => {
10873
+ var P;
10874
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgeMethods({
10875
+ depth: V
10760
10876
  }), this.viralRenderer.render();
10761
- }), V.add(O, "enableNormalEdges").name("Normal Edges").onChange((I) => {
10762
- var T;
10763
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeMethods({
10764
- normal: I
10877
+ }), I.add(O, "enableNormalEdges").name("Normal Edges").onChange((V) => {
10878
+ var P;
10879
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgeMethods({
10880
+ normal: V
10765
10881
  }), this.viralRenderer.render();
10766
- }), V.add(O, "enableObjectIdEdges").name("Object ID Edges").onChange((I) => {
10767
- var T;
10768
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeMethods({
10769
- objectId: I
10882
+ }), I.add(O, "enableObjectIdEdges").name("Object ID Edges").onChange((V) => {
10883
+ var P;
10884
+ (P = this.viralRenderer.postProcessingRenderer) == null || P.setScreenSpaceEdgeMethods({
10885
+ objectId: V
10770
10886
  }), this.viralRenderer.render();
10771
10887
  });
10772
10888
  }
@@ -10774,37 +10890,37 @@ class br extends Bs {
10774
10890
  }
10775
10891
  }
10776
10892
  export {
10777
- dr as BufferElement,
10778
- as as CheckClashResult,
10779
- rs as CompareModelsResult,
10780
- ns as DataTree,
10781
- vr as DebouncedEventHandler,
10782
- es as DefaultLightConfiguration,
10783
- Vt as Dictionary,
10784
- cr as ElementFragment,
10785
- lr as Fragment,
10786
- os as GroupByResult,
10893
+ mr as BufferElement,
10894
+ cs as CheckClashResult,
10895
+ ls as CompareModelsResult,
10896
+ os as DataTree,
10897
+ yr as DebouncedEventHandler,
10898
+ ss as DefaultLightConfiguration,
10899
+ It as Dictionary,
10900
+ ur as ElementFragment,
10901
+ dr as Fragment,
10902
+ hs as GroupByResult,
10787
10903
  vt as HTMLUtil,
10788
10904
  Q as LogUtil,
10789
10905
  D as THREEUtil,
10790
- fr as TreeNode,
10791
- Ki as ViralBIMWorld,
10792
- ls as ViralBatchDebugPanel,
10793
- Y as ViralBatchedMesh,
10794
- K as ViralCameraEventType,
10795
- cs as ViralInstancedDebugPanel,
10906
+ wr as TreeNode,
10907
+ ts as ViralBIMWorld,
10908
+ ds as ViralBatchDebugPanel,
10909
+ Z as ViralBatchedMesh,
10910
+ X as ViralCameraEventType,
10911
+ us as ViralInstancedDebugPanel,
10796
10912
  me as ViralKeyboardEventType,
10797
10913
  k as ViralMouseEventType,
10798
10914
  re as ViralPoint,
10799
- hs as ViralRenderDebugPanel,
10800
- br as ViralViewerApi,
10801
- hr as ViralViewerRevitGeometry,
10802
- or as ViralViewerRevitNoneStructuralGeometry,
10803
- Ji as ViralutionBox,
10915
+ ps as ViralRenderDebugPanel,
10916
+ xr as ViralViewerApi,
10917
+ pr as ViralViewerRevitGeometry,
10918
+ hr as ViralViewerRevitNoneStructuralGeometry,
10919
+ is as ViralutionBox,
10804
10920
  Xt as ViralutionCamera,
10805
- ur as ViralutionElement,
10921
+ gr as ViralutionElement,
10806
10922
  R as ViralutionEvent,
10807
- mr as ViralutionSolid,
10808
- pr as ViralutionStandaloneModel,
10809
- gr as ViralutionTrackingModel
10923
+ vr as ViralutionSolid,
10924
+ fr as ViralutionStandaloneModel,
10925
+ br as ViralutionTrackingModel
10810
10926
  };