u-space 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { Raycaster as Be, Vector2 as S, EventDispatcher as Le, Box2 as tt, Matrix4 as Ie, Vector3 as w, Box3 as q, Scene as Re, Color as B, AmbientLight as st, DirectionalLight as ue, PointLight as me, SpotLight as ge, HemisphereLight as fe, DirectionalLightHelper as nt, PointLightHelper as it, SpotLightHelper as rt, HemisphereLightHelper as ot, RenderPipeline as at, PerspectiveCamera as J, Sphere as ze, Spherical as C, Quaternion as ct, Vector4 as ht, MathUtils as lt, PMREMGenerator as dt, OrthographicCamera as V, TimestampQuery as pt, Cache as ut, Timer as mt, WebGPURenderer as gt, PCFShadowMap as ft, AgXToneMapping as yt, Fog as wt, FogExp2 as bt, MeshStandardNodeMaterial as R, Loader as vt, LoaderUtils as L, FileLoader as Ne, TextureLoader as je, Group as I, SRGBColorSpace as De, RepeatWrapping as ye, BufferGeometry as K, BufferAttribute as we, Mesh as G, FrontSide as xt, BackSide as St, DoubleSide as Ct, REVISION as be, CubeTextureLoader as _t, EquirectangularReflectionMapping as Mt, Sprite as Tt, AnimationMixer as Pt, LoopRepeat as Et, LoopOnce as Ot, SphereGeometry as At, TubeGeometry as Bt, LineCurve3 as Lt, CatmullRomCurve3 as It, SpriteNodeMaterial as Rt, CanvasTexture as zt, ShapeGeometry as Nt, Shape as ke, ExtrudeGeometry as jt, PlaneGeometry as Dt, CircleGeometry as kt, ClippingGroup as Ht, Plane as Ut, PlaneHelper as Ft, LineBasicMaterial as Z, Line as ee } from "three/webgpu";
2
- import { pass as de, mrt as Gt, output as $t, add as ve, blendColor as Wt, emissive as Kt, normalView as Qt, velocity as qt, color as H, uv as xe, time as te, pow as se, sin as pe, mix as ne, mx_noise_float as Se, Fn as He, userData as A, materialColor as Ce, select as ie, materialOpacity as Xt, vec3 as Yt } from "three/tsl";
1
+ import { Raycaster as Be, Vector2 as S, EventDispatcher as Le, Box2 as tt, Matrix4 as Ie, Vector3 as w, Box3 as X, Scene as Re, Color as M, AmbientLight as st, DirectionalLight as ue, PointLight as me, SpotLight as ge, HemisphereLight as fe, DirectionalLightHelper as nt, PointLightHelper as it, SpotLightHelper as rt, HemisphereLightHelper as ot, RenderPipeline as at, PerspectiveCamera as J, Sphere as ze, Spherical as C, Quaternion as ct, Vector4 as ht, MathUtils as lt, PMREMGenerator as dt, OrthographicCamera as V, TimestampQuery as pt, Cache as ut, Timer as mt, WebGPURenderer as gt, PCFShadowMap as ft, AgXToneMapping as yt, Fog as wt, FogExp2 as vt, MeshStandardNodeMaterial as R, Loader as bt, LoaderUtils as L, FileLoader as Ne, TextureLoader as je, Group as I, SRGBColorSpace as De, RepeatWrapping as ye, BufferGeometry as K, BufferAttribute as we, Mesh as D, FrontSide as xt, BackSide as St, DoubleSide as Ct, REVISION as ve, CubeTextureLoader as Mt, EquirectangularReflectionMapping as _t, Sprite as Tt, AnimationMixer as Et, LoopRepeat as Pt, LoopOnce as Ot, SphereGeometry as At, TubeGeometry as Bt, LineCurve3 as Lt, CatmullRomCurve3 as It, SpriteNodeMaterial as Rt, CanvasTexture as zt, ShapeGeometry as Nt, Shape as ke, ExtrudeGeometry as jt, PlaneGeometry as Dt, CircleGeometry as kt, ClippingGroup as Ut, Plane as Ht, PlaneHelper as Ft, LineBasicMaterial as Z, Line as ee } from "three/webgpu";
2
+ import { pass as de, mrt as Gt, output as $t, add as be, blendColor as Wt, emissive as Kt, normalView as Qt, velocity as Xt, color as H, uv as xe, time as te, pow as se, sin as pe, mix as ne, mx_noise_float as Se, Fn as Ue, userData as B, materialColor as Ce, select as ie, materialOpacity as qt, vec3 as Yt } from "three/tsl";
3
3
  import { bloom as Jt } from "three/addons/tsl/display/BloomNode.js";
4
4
  import { ssgi as Vt } from "three/addons/tsl/display/SSGINode.js";
5
5
  import { traa as Zt } from "three/addons/tsl/display/TRAANode.js";
6
- import Ue from "camera-controls";
6
+ import He from "camera-controls";
7
7
  import { RoomEnvironment as es } from "three/addons/environments/RoomEnvironment.js";
8
8
  import { ViewHelper as ts } from "three/addons/helpers/ViewHelper.js";
9
9
  import { CSS2DRenderer as ss, CSS2DObject as ns } from "three/addons/renderers/CSS2DRenderer.js";
@@ -16,10 +16,9 @@ import { OBJLoader as cs } from "three/addons/loaders/OBJLoader.js";
16
16
  import { STLLoader as hs } from "three/addons/loaders/STLLoader.js";
17
17
  import { DRACOLoader as ls } from "three/addons/loaders/DRACOLoader.js";
18
18
  import { KTX2Loader as ds } from "three/addons/loaders/KTX2Loader.js";
19
- import { MeshoptDecoder as _e } from "three/addons/libs/meshopt_decoder.module.js";
19
+ import { MeshoptDecoder as Me } from "three/addons/libs/meshopt_decoder.module.js";
20
20
  import { HDRLoader as ps } from "three/addons/loaders/HDRLoader.js";
21
21
  import { clone as us } from "three/addons/utils/SkeletonUtils.js";
22
- import { Color as U } from "three";
23
22
  import { Easing as m, Tween as ms } from "three/addons/libs/tween.module.js";
24
23
  class gs {
25
24
  /** The type of event (e.g., 'click', 'pointerdown'). */
@@ -206,7 +205,7 @@ class fs {
206
205
  this.domElement.removeEventListener("click", this._onClick), this.domElement.removeEventListener("dblclick", this._onDblClick), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.clickTimer && (clearTimeout(this.clickTimer), this.clickTimer = null), this.hoveredObject = null, this._excludeSet.clear();
207
206
  }
208
207
  }
209
- class bn extends Le {
208
+ class vn extends Le {
210
209
  scene;
211
210
  camera;
212
211
  domElement;
@@ -327,15 +326,15 @@ class bn extends Le {
327
326
  new S(Math.max(n.x, i.x), Math.max(n.y, i.y))
328
327
  ), o = this.targetObjects || this.scene.children, a = [], c = new Ie();
329
328
  c.multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
330
- const h = (d) => {
329
+ const l = (d) => {
331
330
  if (!d.visible) return;
332
331
  const p = new w();
333
332
  if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new S(p.x, p.y)) && a.push(d), this._deep)
334
333
  for (const u of d.children)
335
- h(u);
334
+ l(u);
336
335
  };
337
336
  for (const d of o)
338
- h(d);
337
+ l(d);
339
338
  return a;
340
339
  }
341
340
  dispose() {
@@ -484,7 +483,7 @@ class ys {
484
483
  * Get the bounding box of an object by id, or all objects if no id provided.
485
484
  */
486
485
  getBoundingBox(e) {
487
- const t = new q();
486
+ const t = new X();
488
487
  if (e) {
489
488
  const s = this.idMap.get(e);
490
489
  s && t.setFromObject(s);
@@ -519,7 +518,7 @@ class ys {
519
518
  e.visible = !0;
520
519
  }
521
520
  }
522
- class vn {
521
+ class bn {
523
522
  scenes = /* @__PURE__ */ new Map();
524
523
  _activeSceneKey = null;
525
524
  /**
@@ -533,7 +532,7 @@ class vn {
533
532
  */
534
533
  create(e, t = {}) {
535
534
  const s = new Re();
536
- return t.background !== void 0 && (s.background = new B(t.background)), this.scenes.set(e, s), s;
535
+ return t.background !== void 0 && (s.background = new M(t.background)), this.scenes.set(e, s), s;
537
536
  }
538
537
  /**
539
538
  * Get a scene by key.
@@ -572,7 +571,7 @@ class vn {
572
571
  const t = this.scenes.get(e);
573
572
  if (!t) return null;
574
573
  let s = null;
575
- return t.background instanceof B && (s = `#${t.background.getHexString()}`), {
574
+ return t.background instanceof M && (s = `#${t.background.getHexString()}`), {
576
575
  name: t.name || e,
577
576
  background: s,
578
577
  environmentRotation: {
@@ -621,10 +620,10 @@ class xn {
621
620
  penumbra: o = 0.1,
622
621
  decay: a = 2,
623
622
  position: c = { x: 0, y: 10, z: 0 },
624
- target: h,
623
+ target: l,
625
624
  castShadow: d = !1
626
625
  } = t, p = new ge(s, n, i, r, o, a);
627
- return p.position.set(c.x, c.y, c.z), h && p.target.position.set(h.x, h.y, h.z), p.castShadow = d, p.name = e, this._register(e, p), p;
626
+ return p.position.set(c.x, c.y, c.z), l && p.target.position.set(l.x, l.y, l.z), p.castShadow = d, p.name = e, this._register(e, p), p;
628
627
  }
629
628
  addHemisphere(e, t = {}) {
630
629
  const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new fe(s, n, i);
@@ -794,7 +793,7 @@ class ws extends at {
794
793
  #p() {
795
794
  if (this.#s || this.#i || this.#a) {
796
795
  const t = { output: $t };
797
- this.#s && (t.emissive = Kt), this.#i && (t.normal = Qt), this.#a && (t.velocity = qt), this.scenePass.setMRT(Gt(t));
796
+ this.#s && (t.emissive = Kt), this.#i && (t.normal = Qt), this.#a && (t.velocity = Xt), this.scenePass.setMRT(Gt(t));
798
797
  }
799
798
  }
800
799
  #u() {
@@ -809,7 +808,7 @@ class ws extends at {
809
808
  console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
810
809
  else {
811
810
  const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i = Vt(t, s, n, this.camera);
812
- i.sliceCount.value = this.#e.sliceCount, i.stepCount.value = this.#e.stepCount, i.aoIntensity.value = this.#e.aoIntensity, i.giIntensity.value = this.#e.giIntensity, i.radius.value = this.#e.radius, i.thickness.value = this.#e.thickness, this.#h = i, e = ve(e, i), this.#t.push(i);
811
+ i.sliceCount.value = this.#e.sliceCount, i.stepCount.value = this.#e.stepCount, i.aoIntensity.value = this.#e.aoIntensity, i.giIntensity.value = this.#e.giIntensity, i.radius.value = this.#e.radius, i.thickness.value = this.#e.thickness, this.#h = i, e = be(e, i), this.#t.push(i);
813
812
  }
814
813
  if (this.#s) {
815
814
  const t = this.scenePass.getTextureNode("emissive");
@@ -818,7 +817,7 @@ class ws extends at {
818
817
  this.#o.strength,
819
818
  this.#o.radius,
820
819
  this.#o.threshold
821
- ), e = ve(e, this.#c), this.#t.push(this.#c);
820
+ ), e = be(e, this.#c), this.#t.push(this.#c);
822
821
  }
823
822
  return e;
824
823
  }
@@ -841,19 +840,19 @@ class ws extends at {
841
840
  this.#u(), this.scenePass.dispose(), super.dispose();
842
841
  }
843
842
  }
844
- const bs = {
843
+ const vs = {
845
844
  Vector2: S,
846
845
  Vector3: w,
847
846
  Vector4: ht,
848
847
  Quaternion: ct,
849
848
  Matrix4: Ie,
850
849
  Spherical: C,
851
- Box3: q,
850
+ Box3: X,
852
851
  Sphere: ze,
853
852
  Raycaster: Be
854
853
  };
855
- Ue.install({ THREE: bs });
856
- class vs extends Ue {
854
+ He.install({ THREE: vs });
855
+ class bs extends He {
857
856
  constructor(...e) {
858
857
  super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
859
858
  }
@@ -869,7 +868,7 @@ class vs extends Ue {
869
868
  this.absoluteRotations();
870
869
  const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, o = [];
871
870
  if (s !== "current") {
872
- const a = Me[s.toUpperCase()] ?? Me.FRONTTOP, c = a.theta, h = a.phi;
871
+ const a = _e[s.toUpperCase()] ?? _e.FRONTTOP, c = a.theta, l = a.phi;
873
872
  o.push(
874
873
  this.fitToBox(e, n, {
875
874
  paddingLeft: i,
@@ -878,7 +877,7 @@ class vs extends Ue {
878
877
  paddingBottom: i,
879
878
  cover: r
880
879
  })
881
- ), o.push(this.rotateTo(c, h, n));
880
+ ), o.push(this.rotateTo(c, l, n));
882
881
  } else {
883
882
  const a = new ze();
884
883
  e.getBoundingSphere(a), a.radius += i, o.push(this.fitToSphere(a, n));
@@ -886,7 +885,7 @@ class vs extends Ue {
886
885
  return await Promise.all(o), !0;
887
886
  }
888
887
  async flyToObject(e, t = {}) {
889
- const s = new q().setFromObject(e);
888
+ const s = new X().setFromObject(e);
890
889
  return this.flyToBox(s, t);
891
890
  }
892
891
  /**
@@ -937,7 +936,7 @@ class vs extends Ue {
937
936
  ]);
938
937
  }
939
938
  }
940
- const Me = {
939
+ const _e = {
941
940
  LEFT: new C(0, Math.PI / 2, -Math.PI / 2),
942
941
  RIGHT: new C(0, Math.PI / 2, Math.PI / 2),
943
942
  FRONT: new C(0, Math.PI / 2, 0),
@@ -953,8 +952,8 @@ const Me = {
953
952
  LEFTBACKTOP: new C(0, Math.PI / 4, -Math.PI / 4 * 3),
954
953
  RIGHTBACKTOP: new C(0, Math.PI / 4, Math.PI / 4 * 3)
955
954
  };
956
- function xs(l, e) {
957
- const t = l - e;
955
+ function xs(h, e) {
956
+ const t = h - e;
958
957
  return lt.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
959
958
  }
960
959
  class Ss {
@@ -994,7 +993,7 @@ class Cs extends ts {
994
993
  return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
995
994
  }
996
995
  }
997
- const Ge = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", _s = Ge + "z-index:0;", Ms = Ge + "z-index:1;";
996
+ const Ge = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", Ms = Ge + "z-index:0;", _s = Ge + "z-index:1;";
998
997
  class Ts {
999
998
  el;
1000
999
  css2dRenderer = null;
@@ -1004,11 +1003,11 @@ class Ts {
1004
1003
  }
1005
1004
  initCSS2DRenderer() {
1006
1005
  const e = new ss();
1007
- return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Ms, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
1006
+ return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = _s, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
1008
1007
  }
1009
1008
  initCSS3DRenderer() {
1010
1009
  const e = new is();
1011
- return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = _s, this.el.appendChild(e.domElement), this.css3dRenderer = e, e;
1010
+ return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Ms, this.el.appendChild(e.domElement), this.css3dRenderer = e, e;
1012
1011
  }
1013
1012
  createCSS2DObject(e) {
1014
1013
  return this.css2dRenderer || this.initCSS2DRenderer(), new ns(e);
@@ -1029,7 +1028,7 @@ class Ts {
1029
1028
  this.css2dRenderer && (this.el.removeChild(this.css2dRenderer.domElement), this.css2dRenderer = null), this.css3dRenderer && (this.el.removeChild(this.css3dRenderer.domElement), this.css3dRenderer = null);
1030
1029
  }
1031
1030
  }
1032
- class Ps {
1031
+ class Es {
1033
1032
  el;
1034
1033
  renderer;
1035
1034
  container;
@@ -1089,7 +1088,7 @@ class Sn extends Le {
1089
1088
  frameCount = 1;
1090
1089
  frameloop = "demand";
1091
1090
  constructor({ el: e, rendererOptions: t }) {
1092
- super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Ps(this.el, this.renderer), this.controls = new vs(this.camera, this.renderer.domElement), this.renderPipeline = new ws(this.renderer, this.scene, this.camera), this.timer = new mt(), this.roomEnvironment = new Ss(this.renderer), this.interactionManager = new fs(this.renderer.domElement, this.scene, this.camera), this.objectManager = new ys(), this.viewerHelper = new Cs(this), this.cssRenderer = new Ts(this.el), window.addEventListener("resize", this.onWindowResize);
1091
+ super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Es(this.el, this.renderer), this.controls = new bs(this.camera, this.renderer.domElement), this.renderPipeline = new ws(this.renderer, this.scene, this.camera), this.timer = new mt(), this.roomEnvironment = new Ss(this.renderer), this.interactionManager = new fs(this.renderer.domElement, this.scene, this.camera), this.objectManager = new ys(), this.viewerHelper = new Cs(this), this.cssRenderer = new Ts(this.el), window.addEventListener("resize", this.onWindowResize);
1093
1092
  }
1094
1093
  onWindowResize = () => {
1095
1094
  const e = this.el.clientWidth, t = this.el.clientHeight;
@@ -1131,7 +1130,7 @@ class Sn extends Le {
1131
1130
  }
1132
1131
  createScene() {
1133
1132
  const e = new Re();
1134
- return e.background = new B(0), e;
1133
+ return e.background = new M(0), e;
1135
1134
  }
1136
1135
  createPerspectiveCamera() {
1137
1136
  const e = new J(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
@@ -1167,7 +1166,7 @@ class Sn extends Le {
1167
1166
  * Set the scene background color, texture, or null.
1168
1167
  */
1169
1168
  setBackground(e) {
1170
- e === null ? this.scene.background = null : e instanceof B || typeof e == "number" || typeof e == "string" ? this.scene.background = new B(e) : this.scene.background = e, this.render();
1169
+ e === null ? this.scene.background = null : e instanceof M || typeof e == "number" || typeof e == "string" ? this.scene.background = new M(e) : this.scene.background = e, this.render();
1171
1170
  }
1172
1171
  /**
1173
1172
  * Set the scene environment map for reflections / IBL.
@@ -1199,7 +1198,7 @@ class Sn extends Le {
1199
1198
  */
1200
1199
  enableFogExp2(e = {}) {
1201
1200
  const { color: t = 13421772, density: s = 0.01 } = e;
1202
- this.scene.fog = new bt(t, s), this.render();
1201
+ this.scene.fog = new vt(t, s), this.render();
1203
1202
  }
1204
1203
  /**
1205
1204
  * Disable fog.
@@ -1211,7 +1210,7 @@ class Sn extends Le {
1211
1210
  this.el.removeChild(this.renderer.domElement), window.removeEventListener("resize", this.onWindowResize), this.info.dispose(), this.interactionManager.dispose(), this.roomEnvironment.dispose(), this.cssRenderer.dispose(), this.renderPipeline.dispose(), this.renderer.dispose();
1212
1211
  }
1213
1212
  }
1214
- class Es extends Fe {
1213
+ class Ps extends Fe {
1215
1214
  constructor(e) {
1216
1215
  super(e);
1217
1216
  }
@@ -1223,11 +1222,11 @@ class Es extends Fe {
1223
1222
  return super.parse(e, t, s, n);
1224
1223
  }
1225
1224
  }
1226
- function Os(l) {
1227
- return new TextDecoder().decode(new Uint8Array(l));
1225
+ function Os(h) {
1226
+ return new TextDecoder().decode(new Uint8Array(h));
1228
1227
  }
1229
- function As(l) {
1230
- const e = new DataView(l);
1228
+ function As(h) {
1229
+ const e = new DataView(h);
1231
1230
  for (let t = 0; t < e.byteLength; t++) {
1232
1231
  const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
1233
1232
  e.setUint8(t, n);
@@ -1235,46 +1234,46 @@ function As(l) {
1235
1234
  return e.buffer;
1236
1235
  }
1237
1236
  const Bs = 8, Ls = 130, Te = 66, Is = "SBK-----", Rs = "SBM-----", $e = new TextDecoder(), zs = new TextEncoder();
1238
- function Ns(l) {
1237
+ function Ns(h) {
1239
1238
  let e = Bs;
1240
- const t = new Uint8Array(l, 0, e);
1239
+ const t = new Uint8Array(h, 0, e);
1241
1240
  if ($e.decode(t) !== Is)
1242
- return l;
1241
+ return h;
1243
1242
  e += Ls;
1244
- const n = new Uint8Array(l, 0, e);
1243
+ const n = new Uint8Array(h, 0, e);
1245
1244
  if (n[40] === 1) {
1246
1245
  const r = zs.encode(Rs), o = new Uint8Array([n[41]]), a = js(n), c = Ds(a);
1247
- let h = Te % c.length;
1248
- const d = e + Te, p = new Uint8Array(l, d), u = new Uint8Array(p.length);
1249
- for (let b = 0; b < p.length; b++)
1250
- u[b] = p[b] ^ c[h], h = (h + 1) % c.length;
1246
+ let l = Te % c.length;
1247
+ const d = e + Te, p = new Uint8Array(h, d), u = new Uint8Array(p.length);
1248
+ for (let v = 0; v < p.length; v++)
1249
+ u[v] = p[v] ^ c[l], l = (l + 1) % c.length;
1251
1250
  const g = new Uint8Array(r.length + o.length + u.length);
1252
1251
  return g.set(r), g.set(o, r.length), g.set(u, r.length + o.length), g.buffer;
1253
1252
  }
1254
1253
  }
1255
- function js(l) {
1254
+ function js(h) {
1256
1255
  const e = new Uint8Array(128);
1257
- return e.set(l.slice(42, 74), 0), e.set(l.slice(74, 138), 32), e.set(l.slice(8, 40), 96), e;
1256
+ return e.set(h.slice(42, 74), 0), e.set(h.slice(74, 138), 32), e.set(h.slice(8, 40), 96), e;
1258
1257
  }
1259
- function Ds(l) {
1258
+ function Ds(h) {
1260
1259
  const e = new Uint8Array(64);
1261
- return e.set(l.slice(0, 8), 0), e.set(l.slice(24, 32), 8), e.set(l.slice(40, 56), 16), e.set(l.slice(64, 88), 32), e.set(l.slice(96, 104), 56), e;
1260
+ return e.set(h.slice(0, 8), 0), e.set(h.slice(24, 32), 8), e.set(h.slice(40, 56), 16), e.set(h.slice(64, 88), 32), e.set(h.slice(96, 104), 56), e;
1262
1261
  }
1263
- const ks = (l, e, t) => {
1264
- const s = l.buffer.slice(t, t + e);
1262
+ const ks = (h, e, t) => {
1263
+ const s = h.buffer.slice(t, t + e);
1265
1264
  let n = $e.decode(s);
1266
1265
  return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
1267
- }, Hs = (l, e, t) => {
1266
+ }, Us = (h, e, t) => {
1268
1267
  const [s, n, i, r, o] = e, a = t || r < 1;
1269
1268
  return new R({
1270
- name: l,
1271
- color: new B(s, n, i),
1269
+ name: h,
1270
+ color: new M(s, n, i),
1272
1271
  opacity: r,
1273
1272
  transparent: a,
1274
1273
  alphaTest: 0.01,
1275
1274
  side: o
1276
1275
  });
1277
- }, Us = (l) => l?.toLowerCase().endsWith(".png") ?? !1;
1276
+ }, Hs = (h) => h?.toLowerCase().endsWith(".png") ?? !1;
1278
1277
  class Fs {
1279
1278
  data;
1280
1279
  options;
@@ -1303,7 +1302,7 @@ class Fs {
1303
1302
  t += 2, t += 4, t += 4, t += 4, t += 4;
1304
1303
  const c = e.getFloat32(t, this.littleEndian);
1305
1304
  t += 4;
1306
- const h = e.getFloat32(t, this.littleEndian);
1305
+ const l = e.getFloat32(t, this.littleEndian);
1307
1306
  t += 4;
1308
1307
  const d = e.getFloat32(t, this.littleEndian);
1309
1308
  t += 4;
@@ -1313,10 +1312,10 @@ class Fs {
1313
1312
  t += 1, u === 0 ? u = xt : u === 1 ? u = St : u === 2 && (u = Ct);
1314
1313
  const g = e.getUint16(t, this.littleEndian);
1315
1314
  t += 2;
1316
- const b = g > 0 ? ks(e, g, t) : "";
1315
+ const v = g > 0 ? ks(e, g, t) : "";
1317
1316
  if (t += g, !this.materials.has(a)) {
1318
- const x = Hs(a, [c, h, d, p, u], Us(b));
1319
- this.materials.set(a, x), b && this.options.path && this.textureLoader.load(L.resolveURL(b, this.options.path), (y) => {
1317
+ const x = Us(a, [c, l, d, p, u], Hs(v));
1318
+ this.materials.set(a, x), v && this.options.path && this.textureLoader.load(L.resolveURL(v, this.options.path), (y) => {
1320
1319
  y.colorSpace = De, y.wrapS = ye, y.wrapT = ye, y.flipY = !1, y.anisotropy = 16, x.map = y;
1321
1320
  });
1322
1321
  }
@@ -1326,45 +1325,45 @@ class Fs {
1326
1325
  t += 2;
1327
1326
  const c = e.getUint16(t, this.littleEndian).toString();
1328
1327
  t += 2;
1329
- const h = [], d = [], p = [], u = [], g = e.getUint16(t, this.littleEndian);
1328
+ const l = [], d = [], p = [], u = [], g = e.getUint16(t, this.littleEndian);
1330
1329
  if (t += 2, g > 0)
1331
1330
  for (let f = 0; f < g; f++) {
1332
- const v = new w();
1333
- v.setX(e.getFloat32(t, this.littleEndian)), t += 4, v.setY(e.getFloat32(t, this.littleEndian)), t += 4, v.setZ(e.getFloat32(t, this.littleEndian)), t += 4, h.push(v);
1331
+ const b = new w();
1332
+ b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, b.setZ(e.getFloat32(t, this.littleEndian)), t += 4, l.push(b);
1334
1333
  }
1335
- const b = e.getUint16(t, this.littleEndian);
1336
- if (t += 2, b > 0)
1337
- for (let f = 0; f < b; f++)
1334
+ const v = e.getUint16(t, this.littleEndian);
1335
+ if (t += 2, v > 0)
1336
+ for (let f = 0; f < v; f++)
1338
1337
  t += 4, t += 4, t += 4;
1339
1338
  const _ = e.getUint16(t, this.littleEndian);
1340
1339
  if (t += 2, _ > 0)
1341
1340
  for (let f = 0; f < _; f++) {
1342
- const v = new S();
1343
- v.setX(e.getFloat32(t, this.littleEndian)), t += 4, v.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(v);
1341
+ const b = new S();
1342
+ b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(b);
1344
1343
  }
1345
1344
  const x = e.getUint16(t, this.littleEndian);
1346
1345
  if (t += 2, x > 0)
1347
1346
  for (let f = 0; f < x; f++) {
1348
- const v = e.getUint16(t, this.littleEndian);
1347
+ const b = e.getUint16(t, this.littleEndian);
1349
1348
  t += 2;
1350
1349
  const z = e.getUint16(t, this.littleEndian);
1351
1350
  t += 2;
1352
1351
  const N = e.getUint16(t, this.littleEndian);
1353
1352
  t += 2;
1354
- const P = [v, z, N];
1353
+ const P = [b, z, N];
1355
1354
  p.push(P), d.length > 0 && u.push([d[P[0]], d[P[1]], d[P[2]]]);
1356
1355
  }
1357
- const y = [], M = [];
1356
+ const y = [], T = [];
1358
1357
  for (let f = 0; f < p.length; f++) {
1359
- const v = p[f], z = h[v[0]], N = h[v[1]], P = h[v[2]];
1358
+ const b = p[f], z = l[b[0]], N = l[b[1]], P = l[b[2]];
1360
1359
  y.push(...z.toArray(), ...N.toArray(), ...P.toArray());
1361
- let X = new S(), W = new S(), D = new S();
1362
- const k = u[f];
1363
- k !== void 0 && (X = k[0], W = k[1], D = k[2]), M.push(...X.toArray(), ...W.toArray(), ...D.toArray());
1360
+ let q = new S(), $ = new S(), k = new S();
1361
+ const U = u[f];
1362
+ U !== void 0 && (q = U[0], $ = U[1], k = U[2]), T.push(...q.toArray(), ...$.toArray(), ...k.toArray());
1364
1363
  }
1365
- const E = new Float32Array(y), O = new Float32Array(M), T = new K();
1366
- if (E.length > 0 && T.setAttribute("position", new we(E, 3)), O.length > 0 && T.setAttribute("uv", new we(O, 2)), T.computeVertexNormals(), this.materials.has(c)) {
1367
- const f = new G(T, this.materials.get(c));
1364
+ const O = new Float32Array(y), A = new Float32Array(T), E = new K();
1365
+ if (O.length > 0 && E.setAttribute("position", new we(O, 3)), A.length > 0 && E.setAttribute("uv", new we(A, 2)), E.computeVertexNormals(), this.materials.has(c)) {
1366
+ const f = new D(E, this.materials.get(c));
1368
1367
  f.name = a, f.castShadow = !0, f.receiveShadow = !0, n.add(f);
1369
1368
  }
1370
1369
  }
@@ -1375,7 +1374,7 @@ class Fs {
1375
1374
  console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
1376
1375
  }
1377
1376
  }
1378
- class Gs extends vt {
1377
+ class Gs extends bt {
1379
1378
  load(e, t, s, n) {
1380
1379
  let i;
1381
1380
  if (this.resourcePath !== "")
@@ -1437,17 +1436,59 @@ class Gs extends vt {
1437
1436
  });
1438
1437
  }
1439
1438
  }
1439
+ const $s = [
1440
+ "map",
1441
+ "alphaMap",
1442
+ "aoMap",
1443
+ "bumpMap",
1444
+ "clearcoatMap",
1445
+ "clearcoatNormalMap",
1446
+ "clearcoatRoughnessMap",
1447
+ "displacementMap",
1448
+ "emissiveMap",
1449
+ "envMap",
1450
+ "gradientMap",
1451
+ "iridescenceMap",
1452
+ "iridescenceThicknessMap",
1453
+ "lightMap",
1454
+ "matcap",
1455
+ "metalnessMap",
1456
+ "normalMap",
1457
+ "roughnessMap",
1458
+ "sheenColorMap",
1459
+ "sheenRoughnessMap",
1460
+ "specularColorMap",
1461
+ "specularIntensityMap",
1462
+ "specularMap",
1463
+ "thicknessMap",
1464
+ "transmissionMap"
1465
+ ];
1466
+ function W(h) {
1467
+ return h.traverse((e) => {
1468
+ if (!(e instanceof D)) return;
1469
+ const t = Array.isArray(e.material) ? e.material : [e.material];
1470
+ for (const s of t) {
1471
+ if (!s) continue;
1472
+ let n = !1;
1473
+ for (const i of $s) {
1474
+ const r = s[i];
1475
+ r?.isTexture && r.image == null && (r.dispose(), s[i] = null, n = !0);
1476
+ }
1477
+ n && (s.needsUpdate = !0);
1478
+ }
1479
+ }), h;
1480
+ }
1440
1481
  class j {
1441
1482
  static CACHE_NAME = "u-space-model-loader-cache";
1442
1483
  static fileLoader = new Ne().setResponseType("arraybuffer");
1443
1484
  static dracoLoader = new ls().setDecoderPath(
1444
- `https://cdn.jsdelivr.net/npm/three@0.${be}.0/examples/jsm/libs/draco/`
1485
+ `https://cdn.jsdelivr.net/npm/three@0.${ve}.0/examples/jsm/libs/draco/`
1445
1486
  );
1446
1487
  static ktx2Loader = new ds().setTranscoderPath(
1447
- `https://cdn.jsdelivr.net/npm/three@0.${be}.0/examples/jsm/libs/basis/`
1488
+ `https://cdn.jsdelivr.net/npm/three@0.${ve}.0/examples/jsm/libs/basis/`
1448
1489
  );
1449
- static gltfLoader = new Fe().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(_e);
1450
- static sbmxLoader = new Es().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(_e);
1490
+ static gltfLoader = new Fe().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(Me);
1491
+ static sbmxLoader = new Ps().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(Me);
1451
1492
  static sbmLoader = new Gs();
1452
1493
  static fbxLoader = new as();
1453
1494
  static objLoader = new cs();
@@ -1480,20 +1521,22 @@ class j {
1480
1521
  case "gltf":
1481
1522
  case "glb":
1482
1523
  const i = await this.gltfLoader.parseAsync(n, L.extractUrlBase(e));
1483
- return i.scene.animations = i.animations, i.scene;
1524
+ return i.scene.animations = i.animations, W(i.scene);
1484
1525
  case "sbmx":
1485
1526
  const r = await this.sbmxLoader.parseAsync(n, L.extractUrlBase(e));
1486
- return r.scene.animations = r.animations, r.scene;
1527
+ return r.scene.animations = r.animations, W(r.scene);
1487
1528
  case "sbm":
1488
- return await this.sbmLoader.parseAsync(n, L.extractUrlBase(e));
1529
+ const o = await this.sbmLoader.parseAsync(n, L.extractUrlBase(e));
1530
+ return W(o);
1489
1531
  case "fbx":
1490
- return this.fbxLoader.parse(n, L.extractUrlBase(e));
1532
+ const a = this.fbxLoader.parse(n, L.extractUrlBase(e));
1533
+ return W(a);
1491
1534
  case "obj":
1492
- const c = new TextDecoder().decode(n);
1493
- return this.objLoader.parse(c);
1535
+ const c = new TextDecoder().decode(n), l = this.objLoader.parse(c);
1536
+ return W(l);
1494
1537
  case "stl":
1495
1538
  const d = this.stlLoader.parse(n);
1496
- return new G(d, new R());
1539
+ return new D(d, new R());
1497
1540
  default:
1498
1541
  throw new Error(`Unsupported model format: ${s}`);
1499
1542
  }
@@ -1513,7 +1556,7 @@ class j {
1513
1556
  class Cn {
1514
1557
  static textureLoader = new je();
1515
1558
  static hdrLoader = new ps();
1516
- static cubeTextureLoader = new _t();
1559
+ static cubeTextureLoader = new Mt();
1517
1560
  static setLoadingManager(e) {
1518
1561
  this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
1519
1562
  }
@@ -1522,13 +1565,13 @@ class Cn {
1522
1565
  }
1523
1566
  static async loadAsyncHDR(e) {
1524
1567
  const t = await this.hdrLoader.loadAsync(e);
1525
- return t.mapping = Mt, t;
1568
+ return t.mapping = _t, t;
1526
1569
  }
1527
1570
  static async loadAsyncCubeTexture(e, t) {
1528
1571
  return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
1529
1572
  }
1530
1573
  }
1531
- class $ extends G {
1574
+ class G extends D {
1532
1575
  isBaseMesh = !0;
1533
1576
  type = "BaseMesh";
1534
1577
  ignoreInvisibleWhenRaycast = !0;
@@ -1550,7 +1593,7 @@ class We extends I {
1550
1593
  return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
1551
1594
  }
1552
1595
  }
1553
- class $s extends Tt {
1596
+ class Ws extends Tt {
1554
1597
  isBaseSprite = !0;
1555
1598
  type = "BaseSprite";
1556
1599
  ignoreInvisibleWhenRaycast = !0;
@@ -1577,7 +1620,7 @@ class re extends We {
1577
1620
  let i;
1578
1621
  s ? re.memoryCache.has(t) ? i = re.memoryCache.get(t) : (i = j.loadAsync(t, { persistent: n }), re.memoryCache.set(t, i)) : i = j.loadAsync(t, { persistent: n });
1579
1622
  const r = await i, o = us(r);
1580
- return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new Pt(o)), o;
1623
+ return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new Et(o)), o;
1581
1624
  } catch (i) {
1582
1625
  return console.error(`[Model] Failed to load model from ${t}:`, i), null;
1583
1626
  }
@@ -1589,7 +1632,7 @@ class re extends We {
1589
1632
  if (e === void 0 ? o = this.animations[0] : typeof e == "number" ? o = this.animations[e] : o = this.animations.find((c) => c.name === e), !o)
1590
1633
  return console.warn(`[Model] Animation not found: ${e}`), null;
1591
1634
  let a = this.actions.get(o.name);
1592
- return a || (a = this.mixer.clipAction(o), this.actions.set(o.name, a)), a.setLoop(s ? Et : Ot, n), a.clampWhenFinished = r, a.timeScale = i, a.reset().play(), a;
1635
+ return a || (a = this.mixer.clipAction(o), this.actions.set(o.name, a)), a.setLoop(s ? Pt : Ot, n), a.clampWhenFinished = r, a.timeScale = i, a.reset().play(), a;
1593
1636
  }
1594
1637
  playAllAnimations(e = {}) {
1595
1638
  return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
@@ -1610,7 +1653,7 @@ class re extends We {
1610
1653
  * Get the axis-aligned bounding box of this model.
1611
1654
  */
1612
1655
  getBoundingBox() {
1613
- return new q().setFromObject(this);
1656
+ return new X().setFromObject(this);
1614
1657
  }
1615
1658
  /**
1616
1659
  * Get the center point of this model's bounding box.
@@ -1624,7 +1667,7 @@ class re extends We {
1624
1667
  */
1625
1668
  setMaterial(e) {
1626
1669
  this.traverse((t) => {
1627
- t instanceof G && (t.material = e);
1670
+ t instanceof D && (t.material = e);
1628
1671
  });
1629
1672
  }
1630
1673
  static clearMemoryCache() {
@@ -1634,7 +1677,7 @@ class re extends We {
1634
1677
  typeof caches < "u" && await caches.delete("u-space-loader-cache");
1635
1678
  }
1636
1679
  }
1637
- class Ws extends $ {
1680
+ class Ks extends G {
1638
1681
  isSphereMesh = !0;
1639
1682
  type = "SphereMesh";
1640
1683
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
@@ -1649,7 +1692,7 @@ class Ws extends $ {
1649
1692
  ), this.material = new R(t);
1650
1693
  }
1651
1694
  }
1652
- class Pe extends $ {
1695
+ class Ee extends G {
1653
1696
  isTubeMesh = !0;
1654
1697
  type = "TubeMesh";
1655
1698
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
@@ -1662,7 +1705,7 @@ class Pe extends $ {
1662
1705
  ), this.material = new R(t);
1663
1706
  }
1664
1707
  }
1665
- class _n extends We {
1708
+ class Mn extends We {
1666
1709
  isTopology = !0;
1667
1710
  type = "Topology";
1668
1711
  // Visuals
@@ -1743,9 +1786,9 @@ class _n extends We {
1743
1786
  if (a === null || a === t || c === 1 / 0)
1744
1787
  break;
1745
1788
  i.delete(a);
1746
- const h = this.adjacencyMap?.get(a);
1747
- if (h)
1748
- for (const [d, p] of h) {
1789
+ const l = this.adjacencyMap?.get(a);
1790
+ if (l)
1791
+ for (const [d, p] of l) {
1749
1792
  if (!i.has(d)) continue;
1750
1793
  const u = s.get(a) + p;
1751
1794
  u < s.get(d) && (s.set(d, u), n.set(d, a));
@@ -1766,7 +1809,7 @@ class _n extends We {
1766
1809
  */
1767
1810
  renderGraph() {
1768
1811
  this.clearGraph(), this.graphGroup = new I();
1769
- const e = new Ws({
1812
+ const e = new Ks({
1770
1813
  geometryParameters: {
1771
1814
  radius: this.parameters.nodeRadius,
1772
1815
  widthSegments: 16,
@@ -1788,9 +1831,9 @@ class _n extends We {
1788
1831
  t.add(o);
1789
1832
  const a = this.nodes.get(n), c = this.nodes.get(r);
1790
1833
  if (a && c) {
1791
- const h = new Lt(a, c), d = new Pe({
1834
+ const l = new Lt(a, c), d = new Ee({
1792
1835
  geometryParameters: {
1793
- path: h,
1836
+ path: l,
1794
1837
  tubularSegments: 1,
1795
1838
  radius: this.parameters.edgeRadius,
1796
1839
  radialSegments: 8,
@@ -1807,7 +1850,7 @@ class _n extends We {
1807
1850
  }
1808
1851
  clearGraph() {
1809
1852
  this.graphGroup && (this.remove(this.graphGroup), this.graphGroup.traverse((e) => {
1810
- e instanceof G && (e.geometry.dispose(), e.material.dispose());
1853
+ e instanceof D && (e.geometry.dispose(), e.material.dispose());
1811
1854
  }), this.graphGroup = null);
1812
1855
  }
1813
1856
  /**
@@ -1815,7 +1858,7 @@ class _n extends We {
1815
1858
  */
1816
1859
  renderPath(e, t = this.parameters.pathColor) {
1817
1860
  if (e.length < 2) return;
1818
- const s = new It(e, !1, "catmullrom", 0), n = new Pe({
1861
+ const s = new It(e, !1, "catmullrom", 0), n = new Ee({
1819
1862
  geometryParameters: {
1820
1863
  path: s,
1821
1864
  tubularSegments: e.length * 10,
@@ -1865,7 +1908,7 @@ class _n extends We {
1865
1908
  return this.adjacencyMap.get(e);
1866
1909
  }
1867
1910
  }
1868
- class Mn extends $s {
1911
+ class _n extends Ws {
1869
1912
  isPoi = !0;
1870
1913
  type = "Poi";
1871
1914
  parameters = {
@@ -1900,33 +1943,33 @@ class Mn extends $s {
1900
1943
  n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
1901
1944
  let i = null;
1902
1945
  this.parameters.img && (i = await this._loadImage(this.parameters.img));
1903
- const { text: r, fontSize: o, color: a, iconSize: c, padding: h, backgroundColor: d, borderRadius: p, textPosition: u, scaleFactor: g } = this.parameters, b = n.measureText(r), _ = r ? b.width : 0, x = r ? o : 0;
1904
- let y = 0, M = 0, E = 0, O = 0, T = 0, f = 0;
1905
- const v = !!i, z = !!r;
1906
- if (v && z)
1946
+ const { text: r, fontSize: o, color: a, iconSize: c, padding: l, backgroundColor: d, borderRadius: p, textPosition: u, scaleFactor: g } = this.parameters, v = n.measureText(r), _ = r ? v.width : 0, x = r ? o : 0;
1947
+ let y = 0, T = 0, O = 0, A = 0, E = 0, f = 0;
1948
+ const b = !!i, z = !!r;
1949
+ if (b && z)
1907
1950
  switch (u) {
1908
1951
  case "top":
1909
- y = Math.max(c, _), M = c + h + x, T = (y - _) / 2, f = x / 2, E = (y - c) / 2, O = x + h;
1952
+ y = Math.max(c, _), T = c + l + x, E = (y - _) / 2, f = x / 2, O = (y - c) / 2, A = x + l;
1910
1953
  break;
1911
1954
  case "bottom":
1912
- y = Math.max(c, _), M = c + h + x, E = (y - c) / 2, O = 0, T = (y - _) / 2, f = c + h + x / 2;
1955
+ y = Math.max(c, _), T = c + l + x, O = (y - c) / 2, A = 0, E = (y - _) / 2, f = c + l + x / 2;
1913
1956
  break;
1914
1957
  case "left":
1915
- y = c + h + _, M = Math.max(c, x), T = 0, f = M / 2, E = _ + h, O = (M - c) / 2;
1958
+ y = c + l + _, T = Math.max(c, x), E = 0, f = T / 2, O = _ + l, A = (T - c) / 2;
1916
1959
  break;
1917
1960
  default:
1918
- y = c + h + _, M = Math.max(c, x), E = 0, O = (M - c) / 2, T = c + h, f = M / 2;
1961
+ y = c + l + _, T = Math.max(c, x), O = 0, A = (T - c) / 2, E = c + l, f = T / 2;
1919
1962
  break;
1920
1963
  }
1921
- else v ? (y = c, M = c, E = 0, O = 0) : z && (y = _, M = x, T = 0, f = x / 2);
1922
- const N = y + h * 2, P = M + h * 2;
1923
- if (s.width = N, s.height = P, n.font = `${o}px ${this.parameters.fontFamily}`, d && (n.fillStyle = d, this._drawRoundedRect(n, 0, 0, N, P, p), n.fill()), v && n.drawImage(i, E + h, O + h, c, c), z) {
1964
+ else b ? (y = c, T = c, O = 0, A = 0) : z && (y = _, T = x, E = 0, f = x / 2);
1965
+ const N = y + l * 2, P = T + l * 2;
1966
+ if (s.width = N, s.height = P, n.font = `${o}px ${this.parameters.fontFamily}`, d && (n.fillStyle = d, this._drawRoundedRect(n, 0, 0, N, P, p), n.fill()), b && n.drawImage(i, O + l, A + l, c, c), z) {
1924
1967
  n.fillStyle = a;
1925
- const D = n.measureText(r), k = D.actualBoundingBoxAscent + D.actualBoundingBoxDescent, et = D.actualBoundingBoxAscent - k / 2;
1926
- n.textBaseline = "alphabetic", n.fillText(r, T + h, f + h + et);
1968
+ const k = n.measureText(r), U = k.actualBoundingBoxAscent + k.actualBoundingBoxDescent, et = k.actualBoundingBoxAscent - U / 2;
1969
+ n.textBaseline = "alphabetic", n.fillText(r, E + l, f + l + et);
1927
1970
  }
1928
- const X = this.material.map, W = new zt(s);
1929
- W.colorSpace = De, this.material.map = W, X?.dispose(), this.scale.set(N * g, P * g, 1);
1971
+ const q = this.material.map, $ = new zt(s);
1972
+ $.colorSpace = De, this.material.map = $, q?.dispose(), this.scale.set(N * g, P * g, 1);
1930
1973
  }
1931
1974
  _loadImage(e) {
1932
1975
  return new Promise((t, s) => {
@@ -1944,7 +1987,7 @@ class Mn extends $s {
1944
1987
  this.material.map?.dispose(), this.material.dispose();
1945
1988
  }
1946
1989
  }
1947
- class Ke extends $ {
1990
+ class Ke extends G {
1948
1991
  isShapeMesh = !0;
1949
1992
  type = "ShapeMesh";
1950
1993
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
@@ -1960,7 +2003,7 @@ class Ke extends $ {
1960
2003
  });
1961
2004
  }
1962
2005
  }
1963
- class Qe extends $ {
2006
+ class Qe extends G {
1964
2007
  isExtrudeMesh = !0;
1965
2008
  type = "ExtrudeMesh";
1966
2009
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
@@ -1976,7 +2019,7 @@ class Qe extends $ {
1976
2019
  });
1977
2020
  }
1978
2021
  }
1979
- class Tn extends $ {
2022
+ class Tn extends G {
1980
2023
  isPlaneMesh = !0;
1981
2024
  type = "PlaneMesh";
1982
2025
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
@@ -1988,7 +2031,7 @@ class Tn extends $ {
1988
2031
  ), this.material = new R(t);
1989
2032
  }
1990
2033
  }
1991
- class Pn extends $ {
2034
+ class En extends G {
1992
2035
  isCircleMesh = !0;
1993
2036
  type = "CircleMesh";
1994
2037
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
@@ -2006,17 +2049,17 @@ class Pn extends $ {
2006
2049
  class F {
2007
2050
  static traverseMeshes(e, t) {
2008
2051
  e.traverse((s) => {
2009
- s instanceof G && t(s);
2052
+ s instanceof D && t(s);
2010
2053
  });
2011
2054
  }
2012
2055
  }
2013
- class En {
2056
+ class Pn {
2014
2057
  static flow(e = {}) {
2015
- const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, o = H(new U(t)), a = H(new U(s)), c = xe().x.mul(i).sub(te.mul(n)), h = se(pe(c).add(1).mul(0.5), r);
2016
- return ne(o, a, h);
2058
+ const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, o = H(new M(t)), a = H(new M(s)), c = xe().x.mul(i).sub(te.mul(n)), l = se(pe(c).add(1).mul(0.5), r);
2059
+ return ne(o, a, l);
2017
2060
  }
2018
2061
  static breathe(e = {}) {
2019
- const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new U(t)), o = H(new U(s)), a = pe(te.mul(n)).add(1).mul(0.5), c = se(a, i);
2062
+ const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new M(t)), o = H(new M(s)), a = pe(te.mul(n)).add(1).mul(0.5), c = se(a, i);
2020
2063
  return ne(r, o, c);
2021
2064
  }
2022
2065
  static fluid(e = {}) {
@@ -2027,21 +2070,21 @@ class En {
2027
2070
  scale: i = 1,
2028
2071
  intensity: r = 1,
2029
2072
  distortion: o = 0.5
2030
- } = e, a = H(new U(t)), c = H(new U(s)), h = xe().mul(i), d = te.mul(n), p = Se(h.add(d), 1, 0), u = h.add(p.mul(o)), g = Se(u, 1, 0).add(1).mul(0.5), b = se(g, r);
2031
- return ne(a, c, b);
2073
+ } = e, a = H(new M(t)), c = H(new M(s)), l = xe().mul(i), d = te.mul(n), p = Se(l.add(d), 1, 0), u = l.add(p.mul(o)), g = Se(u, 1, 0).add(1).mul(0.5), v = se(g, r);
2074
+ return ne(a, c, v);
2032
2075
  }
2033
2076
  }
2034
- function On(l) {
2077
+ function On(h) {
2035
2078
  }
2036
- const he = "uSpaceHighlight", Q = `${he}/enabled`, qe = `${he}/opacity`, Xe = `${he}/color`, Ye = `${he}/overwrite`, le = "uSpaceBreathe", ae = `${le}/enabled`, Je = `${le}/color`, Ve = `${le}/speed`, Ze = `${le}/intensity`, ce = /* @__PURE__ */ new WeakMap(), Ks = He(() => {
2037
- const l = A(Q, "uint"), e = A(Xe, "uint"), t = A(Ye, "uint"), s = Ae(e), n = Ce.mul(s), i = ie(t.greaterThan(0), s, n), r = ie(l.greaterThan(0), i, Ce), o = A(ae, "uint"), a = A(Je, "uint"), c = A(Ve, "float"), h = A(Ze, "float"), d = Ae(a), p = pe(te.mul(c)).add(1).mul(0.5), u = se(p, h), g = ne(r, d, u);
2079
+ const he = "uSpaceHighlight", Q = `${he}/enabled`, Xe = `${he}/opacity`, qe = `${he}/color`, Ye = `${he}/overwrite`, le = "uSpaceBreathe", ae = `${le}/enabled`, Je = `${le}/color`, Ve = `${le}/speed`, Ze = `${le}/intensity`, ce = /* @__PURE__ */ new WeakMap(), Qs = Ue(() => {
2080
+ const h = B(Q, "uint"), e = B(qe, "uint"), t = B(Ye, "uint"), s = Ae(e), n = Ce.mul(s), i = ie(t.greaterThan(0), s, n), r = ie(h.greaterThan(0), i, Ce), o = B(ae, "uint"), a = B(Je, "uint"), c = B(Ve, "float"), l = B(Ze, "float"), d = Ae(a), p = pe(te.mul(c)).add(1).mul(0.5), u = se(p, l), g = ne(r, d, u);
2038
2081
  return ie(o.greaterThan(0), g, r);
2039
- })(), Qs = He(() => {
2040
- const l = A(Q, "uint"), e = A(qe, "float");
2041
- return ie(l.greaterThan(0), e, Xt);
2082
+ })(), Xs = Ue(() => {
2083
+ const h = B(Q, "uint"), e = B(Xe, "float");
2084
+ return ie(h.greaterThan(0), e, qt);
2042
2085
  })();
2043
- function Ee(l) {
2044
- const e = l.material;
2086
+ function Pe(h) {
2087
+ const e = h.material;
2045
2088
  if (!e || Array.isArray(e)) return;
2046
2089
  let t = ce.get(e);
2047
2090
  t || (t = {
@@ -2050,23 +2093,23 @@ function Ee(l) {
2050
2093
  transparent: e.transparent,
2051
2094
  depthWrite: e.depthWrite,
2052
2095
  activeMeshes: /* @__PURE__ */ new Set()
2053
- }, ce.set(e, t)), t.activeMeshes.add(l), e.transparent = !0, e.colorNode = Ks, e.opacityNode = Qs, e.needsUpdate = !0;
2096
+ }, ce.set(e, t)), t.activeMeshes.add(h), e.transparent = !0, e.colorNode = Qs, e.opacityNode = Xs, e.needsUpdate = !0;
2054
2097
  }
2055
- function Oe(l) {
2056
- const e = l.userData[Q], t = l.userData[ae];
2098
+ function Oe(h) {
2099
+ const e = h.userData[Q], t = h.userData[ae];
2057
2100
  if (e || t) return;
2058
- const s = l.material;
2101
+ const s = h.material;
2059
2102
  if (!s || Array.isArray(s)) return;
2060
2103
  const n = ce.get(s);
2061
- n && (n.activeMeshes.delete(l), !(n.activeMeshes.size > 0) && (s.colorNode = n.colorNode, s.opacityNode = n.opacityNode, s.transparent = n.transparent, s.depthWrite = n.depthWrite, s.needsUpdate = !0, ce.delete(s)));
2104
+ n && (n.activeMeshes.delete(h), !(n.activeMeshes.size > 0) && (s.colorNode = n.colorNode, s.opacityNode = n.opacityNode, s.transparent = n.transparent, s.depthWrite = n.depthWrite, s.needsUpdate = !0, ce.delete(s)));
2062
2105
  }
2063
2106
  class oe {
2064
2107
  static highlightColor(e, t = {}) {
2065
- const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite: o } = t, a = new B(i).getHex();
2108
+ const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite: o } = t, a = new M(i).getHex();
2066
2109
  for (const c of s)
2067
- F.traverseMeshes(c, (h) => {
2068
- if (h.userData[Q] = 1, h.userData[qe] = n, h.userData[Xe] = a, h.userData[Ye] = r ? 1 : 0, Ee(h), o !== void 0) {
2069
- const d = h.material;
2110
+ F.traverseMeshes(c, (l) => {
2111
+ if (l.userData[Q] = 1, l.userData[Xe] = n, l.userData[qe] = a, l.userData[Ye] = r ? 1 : 0, Pe(l), o !== void 0) {
2112
+ const d = l.material;
2070
2113
  d && !Array.isArray(d) && (d.depthWrite = o);
2071
2114
  }
2072
2115
  });
@@ -2087,10 +2130,10 @@ class oe {
2087
2130
  },
2088
2131
  t
2089
2132
  );
2090
- n.color = new B(n.color).getHex();
2133
+ n.color = new M(n.color).getHex();
2091
2134
  for (const i of s)
2092
2135
  F.traverseMeshes(i, (r) => {
2093
- r.userData[ae] = 1, r.userData[Je] = n.color, r.userData[Ve] = n.speed, r.userData[Ze] = n.intensity, Ee(r);
2136
+ r.userData[ae] = 1, r.userData[Je] = n.color, r.userData[Ve] = n.speed, r.userData[Ze] = n.intensity, Pe(r);
2094
2137
  });
2095
2138
  }
2096
2139
  static removeBreatheColor(e) {
@@ -2143,16 +2186,16 @@ class oe {
2143
2186
  return r.length === 0 ? Promise.resolve() : new Promise((o) => {
2144
2187
  const a = performance.now();
2145
2188
  let c = 0;
2146
- const h = () => {
2189
+ const l = () => {
2147
2190
  const d = performance.now() - a, p = Math.min(d / n, 1);
2148
2191
  if (!i[0].parent) {
2149
2192
  cancelAnimationFrame(c), o();
2150
2193
  return;
2151
2194
  }
2152
- for (const { material: g, targetOpacity: b } of r)
2153
- g.opacity = t + (b - t) * p, g.needsUpdate = !0;
2195
+ for (const { material: g, targetOpacity: v } of r)
2196
+ g.opacity = t + (v - t) * p, g.needsUpdate = !0;
2154
2197
  if (p < 1)
2155
- c = requestAnimationFrame(h);
2198
+ c = requestAnimationFrame(l);
2156
2199
  else {
2157
2200
  if (s >= 1)
2158
2201
  for (const { material: g } of r)
@@ -2160,12 +2203,12 @@ class oe {
2160
2203
  o();
2161
2204
  }
2162
2205
  };
2163
- c = requestAnimationFrame(h);
2206
+ c = requestAnimationFrame(l);
2164
2207
  });
2165
2208
  }
2166
2209
  }
2167
- const Ae = (l) => {
2168
- const e = l.shiftRight(16).bitAnd(255).toFloat().div(255), t = l.shiftRight(8).bitAnd(255).toFloat().div(255), s = l.bitAnd(255).toFloat().div(255);
2210
+ const Ae = (h) => {
2211
+ const e = h.shiftRight(16).bitAnd(255).toFloat().div(255), t = h.shiftRight(8).bitAnd(255).toFloat().div(255), s = h.bitAnd(255).toFloat().div(255);
2169
2212
  return Yt(e, t, s);
2170
2213
  };
2171
2214
  class qs extends ms {
@@ -2177,7 +2220,7 @@ class qs extends ms {
2177
2220
  this.update(e) && this.viewer.render();
2178
2221
  };
2179
2222
  easingByMode(e) {
2180
- const t = Xs[e];
2223
+ const t = Ys[e];
2181
2224
  return super.easing(t);
2182
2225
  }
2183
2226
  start(e, t) {
@@ -2187,9 +2230,9 @@ class qs extends ms {
2187
2230
  return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
2188
2231
  }
2189
2232
  }
2190
- function An(l, e, t, s = {}, n, i) {
2233
+ function An(h, e, t, s = {}, n, i) {
2191
2234
  return new Promise((r, o) => {
2192
- const { duration: a = 1e3, delay: c = 0, repeat: h = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new qs(l, e).to(t, a).easingByMode(d).delay(c).onUpdate((g) => {
2235
+ const { duration: a = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new qs(h, e).to(t, a).easingByMode(d).delay(c).onUpdate((g) => {
2193
2236
  n?.(g, u);
2194
2237
  }).onComplete(() => {
2195
2238
  r();
@@ -2198,10 +2241,10 @@ function An(l, e, t, s = {}, n, i) {
2198
2241
  }).onStart(() => {
2199
2242
  i?.(u);
2200
2243
  });
2201
- typeof h == "number" ? u.repeat(h) : typeof h == "boolean" && h && u.repeat(1 / 0), p && u.repeatDelay(20), u.yoyo(p), u.start();
2244
+ typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), p && u.repeatDelay(20), u.yoyo(p), u.start();
2202
2245
  });
2203
2246
  }
2204
- const Xs = {
2247
+ const Ys = {
2205
2248
  "Linear.None": m.Linear.None,
2206
2249
  "Quadratic.In": m.Quadratic.In,
2207
2250
  "Quadratic.Out": m.Quadratic.Out,
@@ -2243,7 +2286,7 @@ class Bn {
2243
2286
  */
2244
2287
  group;
2245
2288
  constructor(e) {
2246
- this.scene = e, this.group = new Ht(), this.group.name = "__clippingToolGroup", this.scene.add(this.group);
2289
+ this.scene = e, this.group = new Ut(), this.group.name = "__clippingToolGroup", this.scene.add(this.group);
2247
2290
  }
2248
2291
  /**
2249
2292
  * Move all current scene children (except the clipping group itself) into the ClippingGroup,
@@ -2284,7 +2327,7 @@ class Bn {
2284
2327
  showHelper: i = !1,
2285
2328
  helperSize: r = 5,
2286
2329
  helperColor: o = 16711680
2287
- } = t, a = new Ut(new w(s.x, s.y, s.z), n);
2330
+ } = t, a = new Ht(new w(s.x, s.y, s.z), n);
2288
2331
  return this.planes.set(e, a), this._syncPlanes(), i && this.showHelper(e, r, o), a;
2289
2332
  }
2290
2333
  /**
@@ -2300,9 +2343,9 @@ class Bn {
2300
2343
  { suffix: "+z", normal: { x: 0, y: 0, z: -1 }, constant: o.z },
2301
2344
  { suffix: "-z", normal: { x: 0, y: 0, z: 1 }, constant: -r.z }
2302
2345
  ], c = [];
2303
- for (const h of a) {
2304
- const d = `${e}_${h.suffix}`;
2305
- this.addPlane(d, { normal: h.normal, constant: h.constant, showHelper: n, helperColor: i }), c.push(d);
2346
+ for (const l of a) {
2347
+ const d = `${e}_${l.suffix}`;
2348
+ this.addPlane(d, { normal: l.normal, constant: l.constant, showHelper: n, helperColor: i }), c.push(d);
2306
2349
  }
2307
2350
  return c;
2308
2351
  }
@@ -2310,7 +2353,7 @@ class Bn {
2310
2353
  * Add a clipping box from an object's bounding box with optional padding.
2311
2354
  */
2312
2355
  addBoxFromObject(e, t, s = 0, n = {}) {
2313
- const i = new q().setFromObject(t);
2356
+ const i = new X().setFromObject(t);
2314
2357
  return i.expandByScalar(s), this.addBox(e, i, n);
2315
2358
  }
2316
2359
  /**
@@ -2350,7 +2393,7 @@ class Bn {
2350
2393
  this.hideHelper(e);
2351
2394
  const n = this.planes.get(e);
2352
2395
  if (!n) return;
2353
- const i = new Ft(n, t, new B(s).getHex());
2396
+ const i = new Ft(n, t, new M(s).getHex());
2354
2397
  i.name = e, this.helpers.set(e, i), this.scene.add(i);
2355
2398
  }
2356
2399
  /**
@@ -2389,7 +2432,7 @@ class Ln {
2389
2432
  measureDistance(e, t, s = {}) {
2390
2433
  const { lineColor: n = 16776960 } = s, i = new w(e.x, e.y, e.z), r = new w(t.x, t.y, t.z), o = i.distanceTo(r), a = `measure_dist_${this._idCounter++}`, c = new I();
2391
2434
  c.name = a;
2392
- const h = new K().setFromPoints([i, r]), d = new Z({ color: n }), p = new ee(h, d);
2435
+ const l = new K().setFromPoints([i, r]), d = new Z({ color: n }), p = new ee(l, d);
2393
2436
  c.add(p), this.scene.add(c);
2394
2437
  const u = {
2395
2438
  id: a,
@@ -2410,7 +2453,7 @@ class Ln {
2410
2453
  throw new Error("MeasureTool.measureArea requires at least 3 points");
2411
2454
  const n = e.map((u) => new w(u.x, u.y, u.z)), i = this._calculatePolygonArea(n), r = `measure_area_${this._idCounter++}`, o = new I();
2412
2455
  o.name = r;
2413
- const a = [...n, n[0]], c = new K().setFromPoints(a), h = new Z({ color: s }), d = new ee(c, h);
2456
+ const a = [...n, n[0]], c = new K().setFromPoints(a), l = new Z({ color: s }), d = new ee(c, l);
2414
2457
  o.add(d), this.scene.add(o);
2415
2458
  const p = {
2416
2459
  id: r,
@@ -2426,9 +2469,9 @@ class Ln {
2426
2469
  * Measure the angle between three points (vertex at the middle point).
2427
2470
  */
2428
2471
  measureAngle(e, t, s, n = {}) {
2429
- const { lineColor: i = 16746496 } = n, r = new w(e.x, e.y, e.z), o = new w(t.x, t.y, t.z), a = new w(s.x, s.y, s.z), c = r.clone().sub(o).normalize(), h = a.clone().sub(o).normalize(), p = Math.acos(Math.max(-1, Math.min(1, c.dot(h)))) * 180 / Math.PI, u = `measure_angle_${this._idCounter++}`, g = new I();
2472
+ const { lineColor: i = 16746496 } = n, r = new w(e.x, e.y, e.z), o = new w(t.x, t.y, t.z), a = new w(s.x, s.y, s.z), c = r.clone().sub(o).normalize(), l = a.clone().sub(o).normalize(), p = Math.acos(Math.max(-1, Math.min(1, c.dot(l)))) * 180 / Math.PI, u = `measure_angle_${this._idCounter++}`, g = new I();
2430
2473
  g.name = u;
2431
- const b = new K().setFromPoints([r, o, a]), _ = new Z({ color: i }), x = new ee(b, _);
2474
+ const v = new K().setFromPoints([r, o, a]), _ = new Z({ color: i }), x = new ee(v, _);
2432
2475
  g.add(x), this.scene.add(g);
2433
2476
  const y = {
2434
2477
  id: u,
@@ -2523,16 +2566,16 @@ class In {
2523
2566
  pointer-events: auto;
2524
2567
  white-space: nowrap;
2525
2568
  `, t.labelStyle)
2526
- for (const [c, h] of Object.entries(t.labelStyle))
2527
- h !== void 0 && (i.style[c] = h);
2569
+ for (const [c, l] of Object.entries(t.labelStyle))
2570
+ l !== void 0 && (i.style[c] = l);
2528
2571
  let r = null;
2529
2572
  const o = t.labelOffset || { x: 0, y: 2, z: 0 };
2530
2573
  if (t.showLeaderLine !== !1) {
2531
- const { lineColor: c = 16777215 } = t, h = new K().setFromPoints([
2574
+ const { lineColor: c = 16777215 } = t, l = new K().setFromPoints([
2532
2575
  new w(0, 0, 0),
2533
2576
  new w(o.x, o.y, o.z)
2534
2577
  ]), d = new Z({ color: c });
2535
- r = new ee(h, d), s.add(r);
2578
+ r = new ee(l, d), s.add(r);
2536
2579
  }
2537
2580
  if (this._createCSSObject) {
2538
2581
  const c = this._createCSSObject(i);
@@ -2640,19 +2683,19 @@ class In {
2640
2683
  this.removeAll();
2641
2684
  }
2642
2685
  }
2643
- const Ys = "0.0.11";
2644
- window.__USPACE__ = { version: Ys };
2686
+ const Js = "0.0.13";
2687
+ window.__USPACE__ = { version: Js };
2645
2688
  export {
2646
2689
  In as AnnotationManager,
2647
2690
  We as BaseGroup,
2648
- $ as BaseMesh,
2649
- $s as BaseSprite,
2691
+ G as BaseMesh,
2692
+ Ws as BaseSprite,
2650
2693
  Nn as CSS2DObject,
2651
2694
  Dn as CSS3DObject,
2652
2695
  kn as CSS3DSprite,
2653
2696
  Ts as CSSRenderer,
2654
- vs as CameraControls,
2655
- Pn as CircleMesh,
2697
+ bs as CameraControls,
2698
+ En as CircleMesh,
2656
2699
  Bn as ClippingTool,
2657
2700
  Qe as ExtrudeMesh,
2658
2701
  gs as InteractionEvent,
@@ -2665,22 +2708,22 @@ export {
2665
2708
  ys as ObjectManager,
2666
2709
  F as ObjectUtils,
2667
2710
  Tn as PlaneMesh,
2668
- Mn as Poi,
2711
+ _n as Poi,
2669
2712
  ws as RenderPipeline,
2670
2713
  Ss as RoomEnvironment,
2671
2714
  Gs as SBMLoader,
2672
- Es as SBMXLoader,
2673
- vn as SceneManager,
2674
- bn as Selection,
2715
+ Ps as SBMXLoader,
2716
+ bn as SceneManager,
2717
+ vn as Selection,
2675
2718
  Ke as ShapeMesh,
2676
- Ws as SphereMesh,
2677
- En as TSLEffects,
2719
+ Ks as SphereMesh,
2720
+ Pn as TSLEffects,
2678
2721
  Cn as TextureLoaderManager,
2679
- _n as Topology,
2680
- Pe as TubeMesh,
2722
+ Mn as Topology,
2723
+ Ee as TubeMesh,
2681
2724
  qs as Tween,
2682
2725
  Sn as Viewer,
2683
2726
  On as reinterpretType,
2684
2727
  An as tweenAnimation,
2685
- Ys as version
2728
+ Js as version
2686
2729
  };