@nebula-spatial/viewer 0.5.0 → 0.5.2

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.
@@ -1,21 +1,21 @@
1
1
  var Bt = Object.defineProperty;
2
2
  var _t = (s, e, t) => e in s ? Bt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var u = (s, e, t) => _t(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Texture as Ut, Vector3 as E, MathUtils as O, MOUSE as N, Object3D as wt, Scene as we, Group as Ct, Raycaster as St, Vector2 as oe, WebGLRenderer as jt, Color as Ht, Euler as qt, OrthographicCamera as De, PerspectiveCamera as Yt, TOUCH as Oe, Vector4 as Xt, Plane as Et, WebGLRenderTarget as Wt, Box3 as V, PMREMGenerator as Gt, EquirectangularReflectionMapping as Kt, Quaternion as Zt, BoxHelper as Jt, Box3Helper as Qt, BoxGeometry as ei, Mesh as ti, MeshBasicMaterial as ii, LineSegments as ri, EdgesGeometry as si, LineBasicMaterial as ni } from "three";
4
+ import { Texture as Ut, Vector3 as E, MathUtils as O, MOUSE as N, Object3D as Ct, Scene as we, Group as St, Raycaster as Et, Vector2 as oe, WebGLRenderer as jt, Color as Ht, Euler as qt, OrthographicCamera as Oe, PerspectiveCamera as Yt, TOUCH as ze, Vector4 as Xt, Plane as kt, WebGLRenderTarget as Wt, Box3 as F, PMREMGenerator as Gt, EquirectangularReflectionMapping as Kt, Quaternion as Zt, BoxHelper as Jt, Box3Helper as Qt, BoxGeometry as ei, Mesh as ti, MeshBasicMaterial as ii, LineSegments as ri, EdgesGeometry as si, LineBasicMaterial as ni } from "three";
5
5
  import { RoomEnvironment as ai } from "three/addons/environments/RoomEnvironment.js";
6
6
  import { MapControls as oi } from "three/addons/controls/MapControls.js";
7
7
  import { OrbitControls as li } from "three/addons/controls/OrbitControls.js";
8
8
  import { HDRLoader as di } from "three/addons/loaders/HDRLoader.js";
9
- import { createCadDocumentSession as ci, getCadDocumentRenderResource as ui, formatCadInsertId as ze } from "@nebula-spatial/cad-loader";
9
+ import { createCadDocumentSession as ci, getCadDocumentRenderResource as ui, formatCadInsertId as Ne } from "@nebula-spatial/cad-loader";
10
10
  import { CSS2DObject as hi, CSS2DRenderer as pi } from "three/addons/renderers/CSS2DRenderer.js";
11
- const fi = "0.5.0", mi = "@nebula-spatial/viewer", Ne = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
11
+ const fi = "0.5.2", mi = "@nebula-spatial/viewer", Fe = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
12
12
  function Ve() {
13
13
  const s = `%c ${mi} %c v${fi} `;
14
14
  console.log(s, "background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;", "background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;");
15
15
  }
16
16
  try {
17
17
  const s = globalThis;
18
- s[Ne] || (s[Ne] = !0, Ve());
18
+ s[Fe] || (s[Fe] = !0, Ve());
19
19
  } catch {
20
20
  Ve();
21
21
  }
@@ -58,7 +58,7 @@ function gi(s, e, t) {
58
58
  }
59
59
  de(s, t);
60
60
  }
61
- function Fe(s, e = {}) {
61
+ function $e(s, e = {}) {
62
62
  const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
63
63
  s.traverse((r) => {
64
64
  const n = r;
@@ -115,13 +115,13 @@ function $(s, e, t, i) {
115
115
  const r = Number.isFinite(s) ? s : e;
116
116
  return Q(r, t, i);
117
117
  }
118
- function kt(s) {
118
+ function Pt(s) {
119
119
  return Number.isFinite(s) ? Q(s, 0.1, 0.95) : wi;
120
120
  }
121
121
  function Ei(s, e) {
122
122
  return !Number.isFinite(s) || !Number.isFinite(e) || s <= 0 || e <= 0 ? 1 : s / e;
123
123
  }
124
- function Pt(s) {
124
+ function At(s) {
125
125
  const e = $(s, 50, Ci, Si), t = Math.tan(e * Math.PI / 360);
126
126
  return Math.max(t, 1e-4);
127
127
  }
@@ -137,7 +137,7 @@ function Pi(s) {
137
137
  cosAbs: Math.sqrt(1 - 0.2 * 0.2)
138
138
  };
139
139
  }
140
- function At(s, e, t) {
140
+ function Mt(s, e, t) {
141
141
  const i = Math.max(1e-4, 2 * s * e / ki(t)), { sinAbs: r, cosAbs: n } = Pi(t), a = s * e, o = r * r - a * a * n * n;
142
142
  if (!Number.isFinite(o) || o <= 1e-4)
143
143
  return i;
@@ -145,7 +145,7 @@ function At(s, e, t) {
145
145
  return !Number.isFinite(l) || l <= 1e-4 ? i : l;
146
146
  }
147
147
  function Ai(s) {
148
- const e = kt(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max($(s.orthoFrustumSize, Y, Y, Number.MAX_VALUE), Y), n = Pt(s.perspectiveFovDeg), a = At(e, n, i), o = $(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, $(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = Q(r / a, o, l);
148
+ const e = Pt(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max($(s.orthoFrustumSize, Y, Y, Number.MAX_VALUE), Y), n = At(s.perspectiveFovDeg), a = Mt(e, n, i), o = $(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, $(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = Q(r / a, o, l);
149
149
  return {
150
150
  orbitTarget: { x: s.orthoCenterX, y: s.orthoCenterY, z: 0 },
151
151
  orbitDistance: d,
@@ -153,15 +153,15 @@ function Ai(s) {
153
153
  orbitPitch: i
154
154
  };
155
155
  }
156
- function Ii(s) {
157
- const e = Ei(s.viewportWidthPx, s.viewportHeightPx), t = kt(s.ndcBand), i = Pt(s.perspectiveFovDeg), r = At(t, i, s.orbitPitch), n = $(s.orthoFrustumMin, 1e3, Y, Number.MAX_VALUE), a = Math.max(n, $(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max($(s.orbitDistance, n, n, Number.MAX_VALUE), Y), l = o * r, d = Number.isFinite(l) && l >= Y ? l : Q(o / Math.max(0.5, Math.min(2, e)), n, a);
156
+ function Mi(s) {
157
+ const e = Ei(s.viewportWidthPx, s.viewportHeightPx), t = Pt(s.ndcBand), i = At(s.perspectiveFovDeg), r = Mt(t, i, s.orbitPitch), n = $(s.orthoFrustumMin, 1e3, Y, Number.MAX_VALUE), a = Math.max(n, $(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max($(s.orbitDistance, n, n, Number.MAX_VALUE), Y), l = o * r, d = Number.isFinite(l) && l >= Y ? l : Q(o / Math.max(0.5, Math.min(2, e)), n, a);
158
158
  return {
159
159
  orthoCenterX: s.orbitTarget.x,
160
160
  orthoCenterY: s.orbitTarget.y,
161
161
  orthoFrustumSize: Q(d, n, a)
162
162
  };
163
163
  }
164
- function Mi(s) {
164
+ function Ii(s) {
165
165
  const e = Math.max(s.xmax - s.xmin, s.ymax - s.ymin, 1), t = Math.max(1e-4, Math.tan(s.fovDeg * Math.PI / 360)), i = Math.max(1e-4, Math.abs(Math.sin(s.orbitPitchRad))), r = Math.abs(Math.cos(s.orbitPitchRad)), n = s.ndcBand * t, a = i * i - n * n * r * r, o = Math.max(
166
166
  1e-4,
167
167
  2 * s.ndcBand * t / Math.max(0.2, i)
@@ -202,7 +202,7 @@ function Ti(s, e, t) {
202
202
  const n = 1 / t.maxScalePerFrame;
203
203
  return Math.max(n, Math.min(t.maxScalePerFrame, r));
204
204
  }
205
- const he = 500, $e = 2e5, pe = 0.95, Be = -Math.PI / 2, _e = O.degToRad(55), Di = 1e3, Oi = 2e6;
205
+ const he = 500, Be = 2e5, pe = 0.95, _e = -Math.PI / 2, Ue = O.degToRad(55), Di = 1e3, Oi = 2e6;
206
206
  function B(s, e, t = 1e-4) {
207
207
  return Math.abs(s - e) <= t;
208
208
  }
@@ -210,11 +210,11 @@ class zi {
210
210
  constructor() {
211
211
  u(this, "orbitTarget", new E(0, 0, 0));
212
212
  u(this, "orbitDistance", 14e3);
213
- u(this, "orbitYaw", Be);
214
- u(this, "orbitPitch", _e);
213
+ u(this, "orbitYaw", _e);
214
+ u(this, "orbitPitch", Ue);
215
215
  u(this, "enabled", !0);
216
216
  u(this, "orbitDistanceMin", he);
217
- u(this, "orbitDistanceMax", $e);
217
+ u(this, "orbitDistanceMax", Be);
218
218
  u(this, "viewportSnapshotBefore3D", null);
219
219
  u(this, "orbitSnapshotOn3DEntry", null);
220
220
  u(this, "dragMode", null);
@@ -257,7 +257,7 @@ class zi {
257
257
  if (!i) return;
258
258
  const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new E()), a = e.getCenter(new E());
259
259
  this.orbitTarget.set(a.x, a.y, a.z);
260
- const o = Mi({
260
+ const o = Ii({
261
261
  xmin: e.min.x,
262
262
  ymin: e.min.y,
263
263
  xmax: e.max.x,
@@ -266,7 +266,7 @@ class zi {
266
266
  orbitPitchRad: this.orbitPitch,
267
267
  ndcBand: pe
268
268
  }), l = i.camera3d.fov * Math.PI / 180, d = 2 * Math.atan(Math.tan(l / 2) * Math.max(i.camera3d.aspect, 1e-6)), c = Math.max(Math.min(l, d) / 2, 1e-6), p = Math.max(n.length() / 2, 1e-6) / Math.sin(c) * r, h = Math.max(o, p);
269
- this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max($e, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
269
+ this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max(Be, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
270
270
  }
271
271
  getVisibleDocumentRect() {
272
272
  const e = this.runtime;
@@ -420,8 +420,8 @@ class zi {
420
420
  orbitDistanceMin: this.orbitDistanceMin,
421
421
  orbitDistanceMax: this.orbitDistanceMax,
422
422
  useFixedOrientation: e,
423
- fixedOrbitYaw: Be,
424
- fixedOrbitPitch: _e,
423
+ fixedOrbitYaw: _e,
424
+ fixedOrbitPitch: Ue,
425
425
  ndcBand: pe
426
426
  });
427
427
  this.orbitTarget.set(a.orbitTarget.x, a.orbitTarget.y, a.orbitTarget.z), this.orbitDistance = this.clampDistance(a.orbitDistance), this.orbitYaw = a.orbitYaw, this.orbitPitch = a.orbitPitch;
@@ -429,7 +429,7 @@ class zi {
429
429
  sync2DFromOrbit() {
430
430
  const e = this.runtime;
431
431
  if (!e) return;
432
- const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), r = Math.max(1, e.canvasArea.clientHeight), n = i / r, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h = Ii({
432
+ const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), r = Math.max(1, e.canvasArea.clientHeight), n = i / r, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h = Mi({
433
433
  orbitTarget: { x: this.orbitTarget.x, y: this.orbitTarget.y, z: this.orbitTarget.z },
434
434
  orbitDistance: this.orbitDistance,
435
435
  orbitYaw: this.orbitYaw,
@@ -532,7 +532,7 @@ class zi {
532
532
  }
533
533
  }
534
534
  }
535
- const Ni = new E(2.4, -2.7, 1.7), Vi = new E(0, 0, 0.65), Fi = Math.PI, $i = !0, Bi = new E(1.25, -1.5, 0.85).normalize(), _i = 1.25, Ui = 0.4, ji = 12, Hi = 1e3, qi = 20, Yi = 0.1, Xi = 0.2, It = "left-rotate", Wi = {
535
+ const Ni = new E(2.4, -2.7, 1.7), Fi = new E(0, 0, 0.65), Vi = Math.PI, $i = !0, Bi = new E(1.25, -1.5, 0.85).normalize(), _i = 1.25, Ui = 0.4, ji = 12, Hi = 1e3, qi = 20, Yi = 0.1, Xi = 0.2, It = "left-rotate", Wi = {
536
536
  "left-rotate": { LEFT: N.ROTATE, MIDDLE: N.DOLLY, RIGHT: N.PAN },
537
537
  "left-pan": { LEFT: N.PAN, MIDDLE: N.DOLLY, RIGHT: N.ROTATE }
538
538
  };
@@ -553,21 +553,21 @@ function Gi({ radius: s, fovDeg: e }) {
553
553
  function Ki(s, e, t) {
554
554
  e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, s.near = t.near, s.far = t.far, s.updateProjectionMatrix();
555
555
  }
556
- function Ue(s, e, t = It) {
557
- s.enableDamping = $i, s.maxPolarAngle = Fi, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Wi[t] }, wt.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
556
+ function je(s, e, t = It) {
557
+ s.enableDamping = $i, s.maxPolarAngle = Vi, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Wi[t] }, Ct.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
558
558
  }
559
559
  function Zi(s, e, t, i) {
560
560
  if (t.isEmpty()) return null;
561
561
  const r = t.getSize(new E()), n = t.getCenter(new E()), a = Math.max(r.length() * 0.5, 0.02), o = Gi({ radius: a, fovDeg: i });
562
562
  return e.target.copy(n), s.position.copy(n).addScaledVector(Bi, o.distance), Ki(s, e, o), s.updateMatrixWorld(), e.update(), o;
563
563
  }
564
- const Ji = 1e3, Qi = 2, er = -1e4, tr = 1e4, je = 1e3, ir = 2e6, rr = 1.15, sr = 1, He = new qt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
564
+ const Ji = 1e3, Qi = 2, er = -1e4, tr = 1e4, He = 1e3, ir = 2e6, rr = 1.15, sr = 1, qe = new qt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
565
565
  class nr {
566
566
  constructor(e) {
567
567
  u(this, "canvasArea");
568
568
  u(this, "canvas");
569
569
  u(this, "scene", new we());
570
- u(this, "overlayRoot", new Ct());
570
+ u(this, "overlayRoot", new St());
571
571
  u(this, "renderer");
572
572
  u(this, "camera2d");
573
573
  u(this, "camera3d");
@@ -579,7 +579,7 @@ class nr {
579
579
  u(this, "ownedObjects", /* @__PURE__ */ new Set());
580
580
  u(this, "overlays", /* @__PURE__ */ new Map());
581
581
  u(this, "eventCleanups", []);
582
- u(this, "raycaster", new St());
582
+ u(this, "raycaster", new Et());
583
583
  u(this, "pointerNdc", new oe());
584
584
  u(this, "reuseVector", new E());
585
585
  u(this, "reuseVector2", new E());
@@ -619,7 +619,7 @@ class nr {
619
619
  const n = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = n / a;
620
620
  if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(n, a, !1), this.options.environment) {
621
621
  const l = (e == null ? void 0 : e.createEnvironment) ?? ar;
622
- this.scene.environmentIntensity = sr, this.scene.environmentRotation.copy(He), this.scene.backgroundRotation.copy(He);
622
+ this.scene.environmentIntensity = sr, this.scene.environmentRotation.copy(qe), this.scene.backgroundRotation.copy(qe);
623
623
  const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
624
624
  or(c) ? c.then(
625
625
  (p) => this.applyEnvironmentResource(p, d),
@@ -628,13 +628,13 @@ class nr {
628
628
  }
629
629
  ) : this.applyEnvironmentResource(c, d);
630
630
  }
631
- this.camera2d = new De(-o, o, 1, -1, er, tr), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Yt(40, o, je, ir), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
631
+ this.camera2d = new Oe(-o, o, 1, -1, er, tr), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Yt(40, o, He, ir), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
632
632
  LEFT: N.PAN,
633
633
  MIDDLE: N.DOLLY,
634
634
  RIGHT: N.PAN
635
635
  }, this.controls2d.touches = {
636
- ONE: Oe.PAN,
637
- TWO: Oe.DOLLY_PAN
636
+ ONE: ze.PAN,
637
+ TWO: ze.DOLLY_PAN
638
638
  }, this.controls3d = r(this.camera3d, this.renderer.domElement), this.controls3d.enablePan = !1, this.listen(this.controls2d, "change", () => this.requestRender()), this.listen(this.controls3d, "change", () => this.requestRender()), this.applyNavigationPolicy(this.navigationPolicyValue), this.initialized = !0, this.setViewMode(this.viewModeValue);
639
639
  }
640
640
  get isInitialized() {
@@ -678,7 +678,7 @@ class nr {
678
678
  this.viewerOrbit ?? (this.viewerOrbit = new zi()), this.viewerOrbit.attach(this);
679
679
  return;
680
680
  }
681
- (t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (Ue(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Ni), this.controls3d.target.copy(Vi), this.controls3d.update());
681
+ (t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (je(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Ni), this.controls3d.target.copy(Fi), this.controls3d.update());
682
682
  }
683
683
  }
684
684
  /**
@@ -687,7 +687,7 @@ class nr {
687
687
  * handed to OrbitControls.
688
688
  */
689
689
  setPreviewDragPreset(e) {
690
- this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (Ue(this.controls3d, this.camera3d, e), this.requestRender()));
690
+ this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (je(this.controls3d, this.camera3d, e), this.requestRender()));
691
691
  }
692
692
  /**
693
693
  * Drives OrbitControls once per frame. Damping mutates the camera inside
@@ -739,7 +739,7 @@ class nr {
739
739
  if (!this.mountedObjects.has(e) && e.parent !== this.scene) return !1;
740
740
  e.removeFromParent(), this.mountedObjects.delete(e);
741
741
  const i = this.ownedObjects.delete(e);
742
- return (t.dispose === !0 || t.dispose === void 0 && i) && Fe(e), this.requestRender(), !0;
742
+ return (t.dispose === !0 || t.dispose === void 0 && i) && $e(e), this.requestRender(), !0;
743
743
  }
744
744
  setObjectVisible(e, t) {
745
745
  e.visible !== t && (e.visible = t, this.requestRender());
@@ -749,7 +749,7 @@ class nr {
749
749
  }
750
750
  removeOverlay(e, t = {}) {
751
751
  const i = this.overlays.get(e);
752
- return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Fe(i.object), this.requestRender(), i.object) : null;
752
+ return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && $e(i.object), this.requestRender(), i.object) : null;
753
753
  }
754
754
  setHighlight(e, t = {}) {
755
755
  if (!e) {
@@ -786,7 +786,7 @@ class nr {
786
786
  else {
787
787
  const l = n.clone(), d = this.camera3d.fov * Math.PI / 180, c = 2 * Math.atan(Math.tan(d / 2) * Math.max(this.camera3d.aspect, 1e-6)), p = Math.max(r.length() / 2, 1e-6), h = Math.max(Math.min(d, c) / 2, 1e-6), f = p / Math.sin(h) * a, v = this.camera3d.position.clone().sub(this.controls3d.target);
788
788
  v.lengthSq() <= 1e-12 && v.set(1, -1, 1), v.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(v, f), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
789
- je,
789
+ He,
790
790
  Math.max(f * 0.01, 1e-6)
791
791
  ), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
792
792
  }
@@ -929,7 +929,7 @@ class nr {
929
929
  }
930
930
  screenToWorldOnPlane(e, t, i = 0) {
931
931
  const r = this.clientToNdc(e, t, this.pointerNdc);
932
- return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new Et(new E(0, 0, 1), -i), new E()));
932
+ return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new kt(new E(0, 0, 1), -i), new E()));
933
933
  }
934
934
  worldToClient(e, t = new oe()) {
935
935
  var a;
@@ -1022,7 +1022,7 @@ class nr {
1022
1022
  return this.previewScene || (this.previewScene = new we()), this.previewScene;
1023
1023
  }
1024
1024
  getOrCreatePreviewCamera() {
1025
- return this.previewCamera || (this.previewCamera = new De(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1025
+ return this.previewCamera || (this.previewCamera = new Oe(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1026
1026
  }
1027
1027
  getOrCreatePreviewRenderTarget(e, t) {
1028
1028
  var i;
@@ -1059,10 +1059,10 @@ class nr {
1059
1059
  return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, Qi);
1060
1060
  }
1061
1061
  resolveBox3(e) {
1062
- if (e instanceof V) return e.clone();
1063
- if (e instanceof wt) return new V().setFromObject(e);
1062
+ if (e instanceof F) return e.clone();
1063
+ if (e instanceof Ct) return new F().setFromObject(e);
1064
1064
  const { minX: t, minY: i, maxX: r, maxY: n } = e;
1065
- return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new V(new E(t, i, 0), new E(r, n, 0));
1065
+ return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new F(new E(t, i, 0), new E(r, n, 0));
1066
1066
  }
1067
1067
  isDescendantOf(e, t) {
1068
1068
  let i = e.parent;
@@ -1100,12 +1100,12 @@ function or(s) {
1100
1100
  function lr(s) {
1101
1101
  return Number.isFinite(s.minX) && Number.isFinite(s.minY) && Number.isFinite(s.maxX) && Number.isFinite(s.maxY) && s.maxX >= s.minX && s.maxY >= s.minY;
1102
1102
  }
1103
- const Ie = 1;
1104
- function dr() {
1105
- return typeof globalThis.localStorage > "u" ? cr() : {
1103
+ const Me = 1, dr = 1024, cr = 16, ur = 1e9;
1104
+ function hr() {
1105
+ return typeof globalThis.localStorage > "u" ? pr() : {
1106
1106
  read(s) {
1107
1107
  try {
1108
- const e = globalThis.localStorage.getItem(qe(s));
1108
+ const e = globalThis.localStorage.getItem(Ye(s));
1109
1109
  return e ? JSON.parse(e) : null;
1110
1110
  } catch {
1111
1111
  return null;
@@ -1113,13 +1113,13 @@ function dr() {
1113
1113
  },
1114
1114
  write(s, e) {
1115
1115
  try {
1116
- globalThis.localStorage.setItem(qe(s), JSON.stringify(e));
1116
+ globalThis.localStorage.setItem(Ye(s), JSON.stringify(e));
1117
1117
  } catch {
1118
1118
  }
1119
1119
  }
1120
1120
  };
1121
1121
  }
1122
- function cr() {
1122
+ function pr() {
1123
1123
  const s = /* @__PURE__ */ new Map();
1124
1124
  return {
1125
1125
  read(e) {
@@ -1130,15 +1130,15 @@ function cr() {
1130
1130
  }
1131
1131
  };
1132
1132
  }
1133
- function ur(s, e) {
1133
+ function fr(s, e) {
1134
1134
  if (!s || !e) return null;
1135
1135
  const t = s.read(e);
1136
- return Mt(t) ? t : null;
1136
+ return Ie(t) ? t : null;
1137
1137
  }
1138
- function Mt(s) {
1138
+ function Ie(s) {
1139
1139
  if (!s || typeof s != "object") return !1;
1140
1140
  const e = s;
1141
- if (e.schemaVersion !== Ie) return !1;
1141
+ if (e.schemaVersion !== Me) return !1;
1142
1142
  if (e.viewMode === "2d") {
1143
1143
  const t = e.orthographic;
1144
1144
  return !t || ![
@@ -1166,22 +1166,51 @@ function Mt(s) {
1166
1166
  }
1167
1167
  return !1;
1168
1168
  }
1169
- function hr(s, e, t) {
1169
+ function mr(s, e, t) {
1170
1170
  !s || !e || s.write(e, t);
1171
1171
  }
1172
- function pr(s) {
1172
+ function vr(s) {
1173
1173
  return {
1174
- schemaVersion: Ie,
1174
+ schemaVersion: Me,
1175
1175
  viewMode: s.viewMode,
1176
1176
  ...s.orthographic ? { orthographic: s.orthographic } : {},
1177
1177
  ...s.orbit ? { orbit: s.orbit } : {}
1178
1178
  };
1179
1179
  }
1180
- function qe(s) {
1181
- return `nebula-viewer:camera:v${Ie}:${s}`;
1180
+ function gr(s, e) {
1181
+ if (!Ie(s)) return null;
1182
+ const t = br(e);
1183
+ if (s.viewMode === "2d") {
1184
+ const r = s.orthographic;
1185
+ if (!r) return null;
1186
+ const n = (r.right - r.left) / r.zoom, a = (r.top - r.bottom) / r.zoom;
1187
+ return !Number.isFinite(n) || !Number.isFinite(a) || Math.max(n, a) > t || e && !yr(r.positionX, r.positionY, n, a, e) ? null : s;
1188
+ }
1189
+ const i = s.orbit;
1190
+ return !i || e && !xr(i.targetX, i.targetY, e) ? null : s;
1191
+ }
1192
+ function br(s) {
1193
+ if (s) {
1194
+ const e = Math.max(s.maxX - s.minX, s.maxY - s.minY);
1195
+ if (Number.isFinite(e) && e > 0) return e * dr;
1196
+ }
1197
+ return ur;
1198
+ }
1199
+ function yr(s, e, t, i, r) {
1200
+ const n = t / 2, a = i / 2;
1201
+ return !(s + n < r.minX || s - n > r.maxX || e + a < r.minY || e - a > r.maxY);
1202
+ }
1203
+ function xr(s, e, t) {
1204
+ const i = Math.max(t.maxX - t.minX, t.maxY - t.minY);
1205
+ if (!Number.isFinite(i) || i <= 0) return !0;
1206
+ const r = i * cr;
1207
+ return s >= t.minX - r && s <= t.maxX + r && e >= t.minY - r && e <= t.maxY + r;
1208
+ }
1209
+ function Ye(s) {
1210
+ return `nebula-viewer:camera:v${Me}:${s}`;
1182
1211
  }
1183
1212
  function Z(s) {
1184
- return new V(
1213
+ return new F(
1185
1214
  new E(s.minX, s.minY, s.minZ),
1186
1215
  new E(s.maxX, s.maxY, s.maxZ)
1187
1216
  );
@@ -1190,7 +1219,7 @@ function Rt(s) {
1190
1219
  const [e, t, i] = s;
1191
1220
  return (e & 255) << 16 | (t & 255) << 8 | i & 255;
1192
1221
  }
1193
- class fr {
1222
+ class wr {
1194
1223
  constructor() {
1195
1224
  u(this, "rows", []);
1196
1225
  u(this, "allColor", null);
@@ -1213,7 +1242,7 @@ class fr {
1213
1242
  color: i.has(n.index) ? i.get(n.index) : this.allColor,
1214
1243
  sourceColor: n.color
1215
1244
  }));
1216
- br(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1245
+ kr(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1217
1246
  }
1218
1247
  clear(e = !0) {
1219
1248
  const t = this.rows.length > 0 || this.allColor !== null;
@@ -1270,7 +1299,7 @@ class fr {
1270
1299
  t && (this.allColor = e, this.revision += 1, this.onChange());
1271
1300
  }
1272
1301
  }
1273
- class mr {
1302
+ class Cr {
1274
1303
  constructor() {
1275
1304
  u(this, "usages", []);
1276
1305
  u(this, "revision", 0);
@@ -1296,7 +1325,7 @@ class mr {
1296
1325
  canHighlight: r.canHighlight,
1297
1326
  visible: r.visible
1298
1327
  }));
1299
- yr(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1328
+ Pr(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1300
1329
  }
1301
1330
  clear(e = !0) {
1302
1331
  const t = this.usages.length > 0;
@@ -1323,7 +1352,7 @@ class mr {
1323
1352
  t.length !== 0 && (this.renderNode.setInsertVisibleBatch(t), i && (this.visibilityRevision += 1, this.revision += 1, this.onChange()));
1324
1353
  }
1325
1354
  }
1326
- class vr {
1355
+ class Sr {
1327
1356
  constructor() {
1328
1357
  u(this, "selection", null);
1329
1358
  u(this, "details", null);
@@ -1341,7 +1370,7 @@ class vr {
1341
1370
  return !this.selection && !this.details && !this.textSelection && !this.textDetails ? !1 : (this.selection = null, this.details = null, this.textSelection = null, this.textDetails = null, this.revision += 1, !0);
1342
1371
  }
1343
1372
  }
1344
- class gr {
1373
+ class Er {
1345
1374
  constructor() {
1346
1375
  u(this, "revision", 0);
1347
1376
  u(this, "filename", null);
@@ -1383,7 +1412,7 @@ class gr {
1383
1412
  this.zoomLabel = Number.isFinite(p) && (p ?? 0) > 0 ? `${Math.round(p * 100)}%` : "", this.scaleRuler = {
1384
1413
  visible: !0,
1385
1414
  worldLength: c,
1386
- lengthLabel: xr(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1415
+ lengthLabel: Ar(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1387
1416
  }, this.orbitDistanceLabel = "";
1388
1417
  } else {
1389
1418
  const c = (d = e.host.runtime.captureCameraSnapshot()) == null ? void 0 : d.orbit;
@@ -1394,26 +1423,26 @@ class gr {
1394
1423
  return this.filename !== null || this.fileCount !== 0 || this.visibleLayerCount !== 0 || this.totalLayerCount !== 0 || this.statusMessage !== "" || this.zoomLabel !== "" || this.orbitDistanceLabel !== "" || this.scaleRuler !== null || this.viewportVertexCount !== 0 || this.drawCalls !== 0 || this.fps !== 0 || this.lineRenderMode !== "" || this.entityCount !== 0 || this.lineCount !== 0 || this.fillCount !== 0 || this.dotCount !== 0 || this.textCount !== 0 || this.renderableCount !== 0 || this.submittedVertexRefs !== 0 || this.blockVariantCount !== 0 || this.blockInstanceCount !== 0 || this.splitBlockLayerGroupCount !== 0 || this.renderDebugBreakdown.length > 0 || this.splitBlockLayerDetails.length > 0 || this.phase !== null ? (this.revision += 1, this.filename = null, this.fileCount = 0, this.visibleLayerCount = 0, this.totalLayerCount = 0, this.statusMessage = "", this.zoomLabel = "", this.orbitDistanceLabel = "", this.scaleRuler = null, this.viewportVertexCount = 0, this.drawCalls = 0, this.fps = 0, this.lineRenderMode = "", this.entityCount = 0, this.lineCount = 0, this.fillCount = 0, this.dotCount = 0, this.textCount = 0, this.renderableCount = 0, this.submittedVertexRefs = 0, this.blockVariantCount = 0, this.blockInstanceCount = 0, this.splitBlockLayerGroupCount = 0, this.renderDebugBreakdown = [], this.splitBlockLayerDetails = [], this.phase = null, !0) : !1;
1395
1424
  }
1396
1425
  }
1397
- function br(s, e) {
1426
+ function kr(s, e) {
1398
1427
  return s.length === e.length && s.every((t, i) => {
1399
1428
  const r = e[i];
1400
1429
  return r !== void 0 && t.index === r.index && t.name === r.name && t.visible === r.visible && t.color === r.color && t.sourceColor[0] === r.sourceColor[0] && t.sourceColor[1] === r.sourceColor[1] && t.sourceColor[2] === r.sourceColor[2];
1401
1430
  });
1402
1431
  }
1403
- function yr(s, e) {
1432
+ function Pr(s, e) {
1404
1433
  return s.length === e.length && s.every((t, i) => {
1405
1434
  const r = e[i];
1406
1435
  return r !== void 0 && t.insertId === r.insertId && t.blockName === r.blockName && t.layerName === r.layerName && t.layerIndex === r.layerIndex && t.variantId === r.variantId && t.instanceId === r.instanceId && t.label === r.label && t.canHighlight === r.canHighlight && t.visible === r.visible;
1407
1436
  });
1408
1437
  }
1409
- function xr(s, e) {
1438
+ function Ar(s, e) {
1410
1439
  if (e === "mm") {
1411
1440
  if (s >= 1e6) return `${(s / 1e6).toFixed(2)} km`;
1412
1441
  if (s >= 1e3) return `${(s / 1e3).toFixed(2)} m`;
1413
1442
  }
1414
1443
  return `${s.toFixed(2)}${e ? ` ${e}` : ""}`;
1415
1444
  }
1416
- function Ye(s) {
1445
+ function Xe(s) {
1417
1446
  return {
1418
1447
  documentKey: s.documentKey,
1419
1448
  filename: s.filename,
@@ -1425,13 +1454,13 @@ function Ye(s) {
1425
1454
  units: s.units ?? { source: "mm" }
1426
1455
  };
1427
1456
  }
1428
- const wr = 160, Xe = 5e3;
1429
- class Cr {
1457
+ const Mr = 160, We = 5e3;
1458
+ class Ir {
1430
1459
  constructor(e) {
1431
- u(this, "layers", new fr());
1432
- u(this, "blocks", new mr());
1433
- u(this, "inspector", new vr());
1434
- u(this, "hud", new gr());
1460
+ u(this, "layers", new wr());
1461
+ u(this, "blocks", new Cr());
1462
+ u(this, "inspector", new Sr());
1463
+ u(this, "hud", new Er());
1435
1464
  u(this, "document", null);
1436
1465
  u(this, "loadTiming", null);
1437
1466
  u(this, "capabilities", {
@@ -1465,7 +1494,7 @@ class Cr {
1465
1494
  this.assertActive(), this.closeInternal();
1466
1495
  const i = ++this.openEpoch;
1467
1496
  this.cameraSettled = !1, this.initialDemandSettled = !1, this.initialCameraRestored = !1, this.cameraChangedDuringInitialLoad = !1, this.loadTiming = null;
1468
- const r = t.documentKey ?? Ar(e);
1497
+ const r = t.documentKey ?? Or(e);
1469
1498
  let n;
1470
1499
  try {
1471
1500
  n = ci(e, {
@@ -1557,7 +1586,7 @@ class Cr {
1557
1586
  name: "AbortError",
1558
1587
  code: "E_SUPERSEDED"
1559
1588
  });
1560
- return this.layers.sync(n, !1), this.blocks.sync(n, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(r), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Z(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = Ye({
1589
+ return this.layers.sync(n, !1), this.blocks.sync(n, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(r, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Z(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = Xe({
1561
1590
  documentKey: r,
1562
1591
  filename: t.filename ?? o.filename ?? null,
1563
1592
  phase: n.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : n.phase,
@@ -1636,11 +1665,11 @@ class Cr {
1636
1665
  return this.layers.getVisibilityRevision() + this.blocks.getVisibilityRevision();
1637
1666
  }
1638
1667
  setInsertSelection(e, t) {
1639
- Sr(this.inspector.selection, e) && kr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1668
+ Rr(this.inspector.selection, e) && Tr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1640
1669
  }
1641
1670
  /** @internal Used by the viewer's managed interaction pipeline. */
1642
1671
  setTextSelectionInternal(e, t) {
1643
- Er(this.inspector.textSelection, e) && Pr(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1672
+ Lr(this.inspector.textSelection, e) && Dr(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1644
1673
  }
1645
1674
  getAuthoritativeBoundsBox() {
1646
1675
  if (!this.session) return null;
@@ -1693,7 +1722,7 @@ class Cr {
1693
1722
  }
1694
1723
  select(e) {
1695
1724
  var t, i, r;
1696
- this.assertActive(), e ? !this.document || !this.session || e.selection.documentKey !== this.document.documentKey ? this.clearSelection() : e.kind === "insert" ? this.setInsertSelection(e.selection, ((t = this.session) == null ? void 0 : t.getBlockDetails(ze(e.selection.id))) ?? null) : this.setTextSelectionInternal(e.selection, ((r = (i = this.session) == null ? void 0 : i.getTextDetails) == null ? void 0 : r.call(i, e.selection.id)) ?? null) : this.clearSelection();
1725
+ this.assertActive(), e ? !this.document || !this.session || e.selection.documentKey !== this.document.documentKey ? this.clearSelection() : e.kind === "insert" ? this.setInsertSelection(e.selection, ((t = this.session) == null ? void 0 : t.getBlockDetails(Ne(e.selection.id))) ?? null) : this.setTextSelectionInternal(e.selection, ((r = (i = this.session) == null ? void 0 : i.getTextDetails) == null ? void 0 : r.call(i, e.selection.id)) ?? null) : this.clearSelection();
1697
1726
  }
1698
1727
  clearSelection() {
1699
1728
  this.assertActive(), !(!this.inspector.selection && !this.inspector.textSelection) && (this.inspector.clear(), this.emit("inspector-change", { inspector: this.inspector }));
@@ -1728,8 +1757,8 @@ class Cr {
1728
1757
  if (!e) return !1;
1729
1758
  let { minX: t, minY: i, maxX: r, maxY: n } = e;
1730
1759
  const a = r - t, o = n - i, l = Math.max(a, o);
1731
- if (a > 0 && o > 0 && l < Xe) {
1732
- const c = (t + r) / 2, p = (i + n) / 2, h = Xe / 2;
1760
+ if (a > 0 && o > 0 && l < We) {
1761
+ const c = (t + r) / 2, p = (i + n) / 2, h = We / 2;
1733
1762
  t = c - h, i = p - h, r = c + h, n = p + h;
1734
1763
  }
1735
1764
  return this.host.fitBox3(Z({
@@ -1744,14 +1773,16 @@ class Cr {
1744
1773
  refreshInspectorDetails(e) {
1745
1774
  const t = this.inspector.selection;
1746
1775
  if (!t) return;
1747
- const i = e.getBlockDetails(ze(t.id));
1776
+ const i = e.getBlockDetails(Ne(t.id));
1748
1777
  if (!i) return;
1749
1778
  const r = this.inspector.details, n = r == null ? void 0 : r.bbox;
1750
1779
  (n == null ? void 0 : n.minX) === i.bbox.minX && (n == null ? void 0 : n.minY) === i.bbox.minY && (n == null ? void 0 : n.maxX) === i.bbox.maxX && (n == null ? void 0 : n.maxY) === i.bbox.maxY || (this.inspector.setSelection(t, i), this.emit("inspector-change", { inspector: this.inspector }));
1751
1780
  }
1752
- tryRestoreCamera(e) {
1753
- const t = this.host.readCameraSnapshot(e);
1754
- return t ? this.host.applyCameraSnapshot(t, "restore") : !1;
1781
+ tryRestoreCamera(e, t) {
1782
+ const i = this.host.readCameraSnapshot(e);
1783
+ if (!i) return !1;
1784
+ const r = gr(i, t);
1785
+ return r ? this.host.applyCameraSnapshot(r, "restore") : !1;
1755
1786
  }
1756
1787
  persistCurrentCamera() {
1757
1788
  var t;
@@ -1759,7 +1790,7 @@ class Cr {
1759
1790
  const e = this.host.runtime.captureCameraSnapshot();
1760
1791
  e && this.host.persistCameraSnapshot(
1761
1792
  this.document.documentKey,
1762
- pr(e)
1793
+ vr(e)
1763
1794
  );
1764
1795
  }
1765
1796
  syncDisplayContext() {
@@ -1805,7 +1836,7 @@ class Cr {
1805
1836
  }
1806
1837
  this.viewportDemandTimer === null && (this.viewportDemandTimer = globalThis.setTimeout(() => {
1807
1838
  this.viewportDemandTimer = null, !(this.disposed || !this.session) && this.host.interaction === "active" && this.flushViewportDemand();
1808
- }, Math.max(0, this.host.viewportDemandCoalesceMs ?? wr)));
1839
+ }, Math.max(0, this.host.viewportDemandCoalesceMs ?? Mr)));
1809
1840
  }
1810
1841
  clearViewportDemandTimer() {
1811
1842
  this.viewportDemandTimer !== null && (globalThis.clearTimeout(this.viewportDemandTimer), this.viewportDemandTimer = null);
@@ -1824,7 +1855,7 @@ class Cr {
1824
1855
  });
1825
1856
  }
1826
1857
  publishDocumentPhase(e) {
1827
- this.document && (this.document = Ye({
1858
+ this.document && (this.document = Xe({
1828
1859
  documentKey: this.document.documentKey,
1829
1860
  filename: this.document.filename,
1830
1861
  phase: e,
@@ -1842,19 +1873,19 @@ class Cr {
1842
1873
  if (this.disposed) throw new Error("Viewer has been disposed.");
1843
1874
  }
1844
1875
  }
1845
- function Sr(s, e) {
1876
+ function Rr(s, e) {
1846
1877
  return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.layerIndex === e.id.layerIndex && s.id.variantId === e.id.variantId && s.id.instanceId === e.id.instanceId);
1847
1878
  }
1848
- function Er(s, e) {
1879
+ function Lr(s, e) {
1849
1880
  return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.textId === e.id.textId);
1850
1881
  }
1851
- function kr(s, e) {
1882
+ function Tr(s, e) {
1852
1883
  return s === e || !!(s && e && s.id.layerIndex === e.id.layerIndex && s.id.variantId === e.id.variantId && s.id.instanceId === e.id.instanceId && s.label === e.label && s.blockName === e.blockName && s.layerName === e.layerName && s.layerIndex === e.layerIndex && s.tx === e.tx && s.ty === e.ty && s.rotation === e.rotation && s.scaleX === e.scaleX && s.scaleY === e.scaleY && s.bbox.minX === e.bbox.minX && s.bbox.minY === e.bbox.minY && s.bbox.maxX === e.bbox.maxX && s.bbox.maxY === e.bbox.maxY);
1853
1884
  }
1854
- function Pr(s, e) {
1885
+ function Dr(s, e) {
1855
1886
  return s === e || !!(s && e && s.id.textId === e.id.textId && s.content === e.content && s.x === e.x && s.y === e.y && s.height === e.height && s.rotation === e.rotation && s.layerName === e.layerName && s.layerIndex === e.layerIndex);
1856
1887
  }
1857
- function Ar(s) {
1888
+ function Or(s) {
1858
1889
  let e = null;
1859
1890
  if (typeof s == "string" ? e = s : typeof URL < "u" && s instanceof URL ? e = s.href : typeof s == "object" && s !== null && "kind" in s && s.kind === "url" && (e = s.url), !e) return null;
1860
1891
  let t = 2166136261;
@@ -1873,8 +1904,8 @@ function J(s, e, t) {
1873
1904
  const i = s.code, r = s.name, n = s.message.toLowerCase(), a = /external block|sidecar|variant .*fetch/.test(n), o = /annotation/.test(n), l = /font|troika/.test(n), d = i === "E_SUPERSEDED" ? "E_SUPERSEDED" : r === "AbortError" || i === "E_DISPOSED" ? "E_ABORTED" : a ? "E_SIDECAR_FETCH" : o ? "E_ANNOTATION" : l ? "E_FONT" : i === "E_SOURCE" ? "E_SOURCE" : i === "E_PACK_HTTP" || i === "E_PACK_NETWORK" ? "E_FETCH" : i === "E_HEADER" || i === "E_HEADER_JSON" || i === "E_UNSUPPORTED_PACK_VERSION" ? "E_PARSE_HEADER" : i === "E_WORKER" || i === "E_MAIN_BUFFER_PROTOCOL" || i === "E_MAIN_BUFFER_MISSING" || /worker/.test(n) ? "E_WORKER" : "E_PARSE_GEOMETRY";
1874
1905
  return { code: d, stage: d === "E_FETCH" ? "source" : d === "E_PARSE_HEADER" ? "header" : d === "E_WORKER" ? "worker" : d === "E_PARSE_GEOMETRY" ? "geometry" : d === "E_SIDECAR_FETCH" ? "sidecar" : d === "E_ANNOTATION" ? "annotation" : d === "E_FONT" ? "font" : d === "E_ABORTED" || d === "E_SUPERSEDED" ? "lifecycle" : "source", fatal: e, source: t };
1875
1906
  }
1876
- const We = 1;
1877
- class Ir {
1907
+ const Ge = 1;
1908
+ class zr {
1878
1909
  constructor(e) {
1879
1910
  u(this, "startX", 0);
1880
1911
  u(this, "startY", 0);
@@ -1919,13 +1950,13 @@ class Ir {
1919
1950
  this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
1920
1951
  }
1921
1952
  isTrackingPrimaryPointer(e) {
1922
- return this.primaryPointerDown || (e & We) === We;
1953
+ return this.primaryPointerDown || (e & Ge) === Ge;
1923
1954
  }
1924
1955
  }
1925
1956
  function Ce(s, e) {
1926
1957
  return `${s}:${e}`;
1927
1958
  }
1928
- class Mr {
1959
+ class Nr {
1929
1960
  constructor() {
1930
1961
  u(this, "expandedLayers", /* @__PURE__ */ new Set());
1931
1962
  u(this, "expandedBlocks", /* @__PURE__ */ new Set());
@@ -1969,7 +2000,7 @@ class Mr {
1969
2000
  this.revealedSelectionKey = null, this.suppressedSelectionKey = null;
1970
2001
  }
1971
2002
  }
1972
- function I(s) {
2003
+ function M(s) {
1973
2004
  return s.replace(/[&<>"']/g, (e) => ({
1974
2005
  "&": "&amp;",
1975
2006
  "<": "&lt;",
@@ -1978,7 +2009,7 @@ function I(s) {
1978
2009
  "'": "&#39;"
1979
2010
  })[e] ?? e);
1980
2011
  }
1981
- const Rr = {
2012
+ const Fr = {
1982
2013
  "panel.layers": "图层",
1983
2014
  "panel.properties": "属性",
1984
2015
  "panel.layers.aria": "图层面板",
@@ -2057,7 +2088,7 @@ const Rr = {
2057
2088
  "status.parsing": "解析中…",
2058
2089
  "status.incrementalLoading": "增量渲染中…",
2059
2090
  "unit.mm": "mm"
2060
- }, Lr = {
2091
+ }, Vr = {
2061
2092
  "panel.layers": "Layers",
2062
2093
  "panel.properties": "Properties",
2063
2094
  "panel.layers.aria": "Layers panel",
@@ -2137,20 +2168,20 @@ const Rr = {
2137
2168
  "status.incrementalLoading": "Rendering incrementally…",
2138
2169
  "unit.mm": "mm"
2139
2170
  };
2140
- function Tr(s, e) {
2171
+ function $r(s, e) {
2141
2172
  return e ? s.replace(/\{([a-zA-Z0-9_]+)\}/g, (t, i) => {
2142
2173
  const r = e[i];
2143
2174
  return r === void 0 ? t : String(r);
2144
2175
  }) : s;
2145
2176
  }
2146
- function Dr(s) {
2177
+ function Br(s) {
2147
2178
  try {
2148
2179
  return new Intl.NumberFormat(s, { maximumFractionDigits: 4, useGrouping: !1 });
2149
2180
  } catch {
2150
2181
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 4, useGrouping: !1 });
2151
2182
  }
2152
2183
  }
2153
- function Or(s) {
2184
+ function _r(s) {
2154
2185
  try {
2155
2186
  return new Intl.NumberFormat(s, { maximumFractionDigits: 0 });
2156
2187
  } catch {
@@ -2159,7 +2190,7 @@ function Or(s) {
2159
2190
  }
2160
2191
  function Tt(s) {
2161
2192
  var a;
2162
- const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Lr : Rr, i = Dr(e), r = Or(e), n = {
2193
+ const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Vr : Fr, i = Br(e), r = _r(e), n = {
2163
2194
  locale: e,
2164
2195
  t(o, l) {
2165
2196
  var p;
@@ -2171,7 +2202,7 @@ function Tt(s) {
2171
2202
  d = void 0;
2172
2203
  }
2173
2204
  const c = d ?? ((p = s.messages) == null ? void 0 : p[o]) ?? t[o] ?? o;
2174
- return Tr(c, l);
2205
+ return $r(c, l);
2175
2206
  },
2176
2207
  formatNumber(o) {
2177
2208
  return o == null || !Number.isFinite(o) ? "—" : i.format(o);
@@ -2200,17 +2231,17 @@ function Tt(s) {
2200
2231
  };
2201
2232
  return n;
2202
2233
  }
2203
- const zr = {
2234
+ const Ur = {
2204
2235
  "加载中…": "status.loading",
2205
2236
  "解析中…": "status.parsing",
2206
2237
  "增量渲染中…": "status.incrementalLoading"
2207
2238
  };
2208
- function Nr(s, e) {
2209
- const t = s.trim(), i = zr[t];
2239
+ function jr(s, e) {
2240
+ const t = s.trim(), i = Ur[t];
2210
2241
  return i ? e.t(i) : t;
2211
2242
  }
2212
- const Me = Tt({});
2213
- function Vr(s) {
2243
+ const Re = Tt({});
2244
+ function Hr(s) {
2214
2245
  const e = /* @__PURE__ */ new Map();
2215
2246
  for (const i of s.usages) {
2216
2247
  const r = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), n = Ce(i.layerIndex, i.variantId);
@@ -2235,7 +2266,7 @@ function Vr(s) {
2235
2266
  t.set(i, [...r.values()]);
2236
2267
  return t;
2237
2268
  }
2238
- function Fr(s, e) {
2269
+ function qr(s, e) {
2239
2270
  return s ? e.toLowerCase().includes(s) : !0;
2240
2271
  }
2241
2272
  function ce(s, e, t) {
@@ -2244,7 +2275,7 @@ function ce(s, e, t) {
2244
2275
  function le(s, e, t) {
2245
2276
  s.classList.toggle("off", e === "none"), s.classList.toggle("mixed", e === "mixed"), s.textContent = e === "all" ? "●" : e === "none" ? "○" : "◐", s.title = e === "all" ? t.t("layer.hideBlock") : e === "none" ? t.t("layer.showBlockRestore") : t.t("layer.hideBlockKeep");
2246
2277
  }
2247
- function $r(s) {
2278
+ function Yr(s) {
2248
2279
  let e = 0;
2249
2280
  for (const t of s) t.visible && (e += 1);
2250
2281
  return e <= 0 ? "none" : e >= s.length ? "all" : "mixed";
@@ -2254,7 +2285,7 @@ function Dt(s, e, t, i) {
2254
2285
  const r = s.id;
2255
2286
  return r.layerIndex !== e || r.variantId !== t ? !1 : i === void 0 ? !0 : r.instanceId === i;
2256
2287
  }
2257
- function Ge(s) {
2288
+ function Ke(s) {
2258
2289
  const e = s.querySelector(".vui-lrow-insert.active") ?? s.querySelector(".vui-lrow-block.active");
2259
2290
  if (!e) return !1;
2260
2291
  const t = s.getBoundingClientRect(), i = e.getBoundingClientRect();
@@ -2281,7 +2312,7 @@ function Ot(s, e, t = 0) {
2281
2312
  };
2282
2313
  i(), typeof requestAnimationFrame == "function" && requestAnimationFrame(i);
2283
2314
  }
2284
- function Br(s, e) {
2315
+ function Xr(s, e) {
2285
2316
  const t = e.trim().toLowerCase();
2286
2317
  s.querySelectorAll(".vui-lrow-wrap").forEach((i) => {
2287
2318
  var o, l;
@@ -2291,7 +2322,7 @@ function Br(s, e) {
2291
2322
  i.style.display = a ? "" : "none";
2292
2323
  });
2293
2324
  }
2294
- function _r(s, e) {
2325
+ function Wr(s, e) {
2295
2326
  if (s.querySelectorAll(".vui-lrow-block.active, .vui-lrow-insert.active").forEach((o) => {
2296
2327
  o.classList.remove("active");
2297
2328
  }), !e) return;
@@ -2304,27 +2335,27 @@ function _r(s, e) {
2304
2335
  );
2305
2336
  a && a.classList.add("active");
2306
2337
  }
2307
- function Ur(s, e, t, i = Me) {
2338
+ function Gr(s, e, t, i = Re) {
2308
2339
  var l;
2309
2340
  const r = new Map(e.map((d) => [d.index, d]));
2310
2341
  s.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
2311
2342
  const c = r.get(Number(d.dataset.layerIndex));
2312
2343
  if (!c) return;
2313
2344
  const p = d.querySelector(".vui-lrow-eye");
2314
- p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), zt(d, Re(c));
2345
+ p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), zt(d, Le(c));
2315
2346
  });
2316
2347
  const n = s.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : X(t);
2317
2348
  (l = n == null ? void 0 : n.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
2318
2349
  const o = n == null ? void 0 : n.querySelector('input[type="color"]');
2319
2350
  o && o.value !== a && (o.value = a);
2320
2351
  }
2321
- function jr(s, e, t) {
2352
+ function Kr(s, e, t) {
2322
2353
  var v;
2323
- const i = t.text ?? Me;
2354
+ const i = t.text ?? Re;
2324
2355
  e.resetForScope(t.scopeKey);
2325
- const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = Vr(t.blocks);
2356
+ const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = Hr(t.blocks);
2326
2357
  if (s.list.replaceChildren(), s.count.textContent = String(n.length), n.length === 0) {
2327
- s.list.appendChild(qr(i.t("layer.empty")));
2358
+ s.list.appendChild(Jr(i.t("layer.empty")));
2328
2359
  return;
2329
2360
  }
2330
2361
  const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
@@ -2340,8 +2371,8 @@ function jr(s, e, t) {
2340
2371
  <span class="vui-lrow-eye">◎</span>
2341
2372
  <span class="vui-lrow-dot"></span>
2342
2373
  <span class="vui-lrow-toggle placeholder">▶</span>
2343
- <span class="vui-lrow-name">${I(i.t("layer.all"))}</span>
2344
- <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${I(i.t("layer.colorOverrideAll"))}">
2374
+ <span class="vui-lrow-name">${M(i.t("layer.all"))}</span>
2375
+ <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${M(i.t("layer.colorOverrideAll"))}">
2345
2376
  <input type="color" value="#${(t.layers.allColor ?? 13158600).toString(16).padStart(6, "0")}">
2346
2377
  </span>`;
2347
2378
  const h = p.querySelector('input[type="color"]');
@@ -2353,7 +2384,7 @@ function jr(s, e, t) {
2353
2384
  if (t.setAllLayerColor) t.setAllLayerColor(m);
2354
2385
  else for (const C of n) t.setLayerColor(C.index, m);
2355
2386
  const w = m === null ? "#c8c8c8" : X(m);
2356
- (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), Ke(s.list, n, m);
2387
+ (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), Ze(s.list, n, m);
2357
2388
  } finally {
2358
2389
  (x = t.endLayerColorPreview) == null || x.call(t, h);
2359
2390
  }
@@ -2363,18 +2394,18 @@ function jr(s, e, t) {
2363
2394
  var m;
2364
2395
  if (y.preventDefault(), y.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2365
2396
  else for (const b of n) t.setLayerColor(b.index, null);
2366
- (m = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || m.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), Ke(s.list, n, null);
2397
+ (m = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || m.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), Ze(s.list, n, null);
2367
2398
  }), s.list.appendChild(p);
2368
2399
  for (const y of n)
2369
- Fr(r, y.name) && s.list.appendChild(Hr(y, e, t, a.get(y.index) ?? [], i));
2370
- c && e.needsSelectionReveal(c) && (Ge(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2371
- e.needsSelectionReveal(c) && Ge(s.list) && e.markSelectionRevealed(c);
2400
+ qr(r, y.name) && s.list.appendChild(Zr(y, e, t, a.get(y.index) ?? [], i));
2401
+ c && e.needsSelectionReveal(c) && (Ke(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2402
+ e.needsSelectionReveal(c) && Ke(s.list) && e.markSelectionRevealed(c);
2372
2403
  }));
2373
2404
  }
2374
2405
  function X(s) {
2375
2406
  return `#${s.toString(16).padStart(6, "0")}`;
2376
2407
  }
2377
- function Re(s) {
2408
+ function Le(s) {
2378
2409
  return s.color !== null ? X(s.color) : X(Rt(s.sourceColor));
2379
2410
  }
2380
2411
  function zt(s, e) {
@@ -2385,15 +2416,15 @@ function zt(s, e) {
2385
2416
  const i = s.querySelector('input[type="color"]');
2386
2417
  i && i.value !== e && (i.value = e);
2387
2418
  }
2388
- function Ke(s, e, t) {
2419
+ function Ze(s, e, t) {
2389
2420
  const i = new Map(e.map((r) => [r.index, r]));
2390
2421
  s.querySelectorAll(".vui-lrow[data-layer-index]").forEach((r) => {
2391
2422
  const n = i.get(Number(r.dataset.layerIndex));
2392
- n && zt(r, t === null ? Re(n) : X(t));
2423
+ n && zt(r, t === null ? Le(n) : X(t));
2393
2424
  });
2394
2425
  }
2395
- function Hr(s, e, t, i, r) {
2396
- const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Re(s), l = document.createElement("div");
2426
+ function Zr(s, e, t, i, r) {
2427
+ const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Le(s), l = document.createElement("div");
2397
2428
  l.className = "vui-lrow-wrap";
2398
2429
  const d = document.createElement("div");
2399
2430
  d.className = `vui-lrow${s.visible ? "" : " off"}`, d.dataset.layerIndex = String(s.index);
@@ -2419,7 +2450,7 @@ function Hr(s, e, t, i, r) {
2419
2450
  else {
2420
2451
  x = document.createElement("div"), x.className = "vui-lrow-blocks open";
2421
2452
  for (const w of i)
2422
- x.appendChild(Ze(w, e, t, r));
2453
+ x.appendChild(Je(w, e, t, r));
2423
2454
  l.appendChild(x);
2424
2455
  }
2425
2456
  else {
@@ -2456,15 +2487,15 @@ function Hr(s, e, t, i, r) {
2456
2487
  const b = document.createElement("div");
2457
2488
  b.className = "vui-lrow-blocks open";
2458
2489
  for (const g of i)
2459
- b.appendChild(Ze(g, e, t, r));
2490
+ b.appendChild(Je(g, e, t, r));
2460
2491
  l.appendChild(b);
2461
2492
  }
2462
2493
  return l;
2463
2494
  }
2464
- function Ze(s, e, t, i) {
2495
+ function Je(s, e, t, i) {
2465
2496
  const r = document.createElement("div");
2466
2497
  r.className = "vui-lrow-block-wrap";
2467
- const n = e.expandedBlocks.has(s.key), a = $r(s.inserts), o = Dt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2498
+ const n = e.expandedBlocks.has(s.key), a = Yr(s.inserts), o = Dt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2468
2499
  l.className = `vui-lrow-block${o ? " active" : ""}${s.canHighlight ? "" : " disabled"}`, l.dataset.variantId = String(s.variantId), l.dataset.layerIndex = String(s.layerIndex), s.canHighlight || (l.title = i.t("layer.noHighlightBlock"));
2469
2500
  const d = document.createElement("button");
2470
2501
  d.type = "button", d.className = "vui-lrow-block-visibility", le(d, a, i), d.addEventListener("click", (v) => {
@@ -2502,7 +2533,7 @@ function Ze(s, e, t, i) {
2502
2533
  c.textContent = y ? "▼" : "▶";
2503
2534
  let m = r.querySelector(":scope > .vui-lrow-inserts");
2504
2535
  if (y)
2505
- m ? m.classList.add("open") : (m = Je(s, e, t, d, i), r.appendChild(m));
2536
+ m ? m.classList.add("open") : (m = Qe(s, e, t, d, i), r.appendChild(m));
2506
2537
  else {
2507
2538
  m == null || m.classList.remove("open");
2508
2539
  const b = r.closest(".vui-section-list") ?? r.parentElement;
@@ -2517,9 +2548,9 @@ function Ze(s, e, t, i) {
2517
2548
  if (!s.canHighlight) return;
2518
2549
  const v = s.inserts[0], y = `${s.layerIndex}:${s.variantId}:${v.instanceId}`;
2519
2550
  e.markSelectionRevealed(y), t.selectInsert(v.insertId);
2520
- }), r.appendChild(l), n && r.appendChild(Je(s, e, t, d, i)), r;
2551
+ }), r.appendChild(l), n && r.appendChild(Qe(s, e, t, d, i)), r;
2521
2552
  }
2522
- function Je(s, e, t, i, r) {
2553
+ function Qe(s, e, t, i, r) {
2523
2554
  const n = document.createElement("div");
2524
2555
  n.className = "vui-lrow-inserts open";
2525
2556
  for (const a of s.inserts) {
@@ -2547,47 +2578,47 @@ function Je(s, e, t, i, r) {
2547
2578
  }
2548
2579
  return n;
2549
2580
  }
2550
- function qr(s) {
2581
+ function Jr(s) {
2551
2582
  const e = document.createElement("div");
2552
2583
  return e.className = "vui-empty-note", e.textContent = s, e;
2553
2584
  }
2554
- function Yr(s, e) {
2585
+ function Qr(s, e) {
2555
2586
  const t = () => {
2556
2587
  e(s.value);
2557
2588
  };
2558
2589
  return s.addEventListener("input", t), () => s.removeEventListener("input", t);
2559
2590
  }
2560
- function Qe(s, e, t = Me, i = "mm") {
2591
+ function et(s, e, t = Re, i = "mm") {
2561
2592
  if (s.body.replaceChildren(), e.textSelection && e.textDetails) {
2562
- H(s, !1), Wr(s.body, e.textDetails, t, i), et(s.body);
2593
+ H(s, !1), ts(s.body, e.textDetails, t, i), tt(s.body);
2563
2594
  return;
2564
2595
  }
2565
2596
  if (!e.selection || !e.details) {
2566
- H(s, !1), s.body.appendChild(Gr(t.t("property.empty")));
2597
+ H(s, !1), s.body.appendChild(is(t.t("property.empty")));
2567
2598
  return;
2568
2599
  }
2569
- Xr(s.body, e.details, t, i), et(s.body);
2600
+ es(s.body, e.details, t, i), tt(s.body);
2570
2601
  }
2571
2602
  function H(s, e) {
2572
2603
  if (!s.previewWrap || !s.previewCanvas || (s.previewWrap.hidden = !e, e)) return;
2573
2604
  const t = s.previewCanvas.getContext("2d");
2574
2605
  t == null || t.clearRect(0, 0, s.previewCanvas.width, s.previewCanvas.height);
2575
2606
  }
2576
- function Xr(s, e, t, i) {
2607
+ function es(s, e, t, i) {
2577
2608
  Nt(s, t.t("property.insert"), e.blockName), Se(s, t.t("property.basic"), (r) => {
2578
- M(r, t.t("property.block"), e.blockName), M(r, t.t("property.layer"), e.layerName), M(r, t.t("property.instance"), `#${e.id.instanceId}`), M(r, t.t("property.currentShape"), t.t("property.normalShape"));
2609
+ I(r, t.t("property.block"), e.blockName), I(r, t.t("property.layer"), e.layerName), I(r, t.t("property.instance"), `#${e.id.instanceId}`), I(r, t.t("property.currentShape"), t.t("property.normalShape"));
2579
2610
  }), Se(s, t.t("property.transform"), (r) => {
2580
- M(r, "X", t.formatUnit(e.tx, i)), M(r, "Y", t.formatUnit(e.ty, i)), M(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), M(r, "Sx", t.formatNumber(e.scaleX)), M(r, "Sy", t.formatNumber(e.scaleY));
2611
+ I(r, "X", t.formatUnit(e.tx, i)), I(r, "Y", t.formatUnit(e.ty, i)), I(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), I(r, "Sx", t.formatNumber(e.scaleX)), I(r, "Sy", t.formatNumber(e.scaleY));
2581
2612
  });
2582
2613
  }
2583
- function Wr(s, e, t, i) {
2614
+ function ts(s, e, t, i) {
2584
2615
  Nt(s, t.t("property.text"), e.content), Se(s, t.t("property.basic"), (r) => {
2585
- M(r, t.t("property.layer"), e.layerName), M(r, t.t("property.content"), e.content), M(r, t.t("property.height"), t.formatUnit(e.height, i)), M(r, "X", t.formatUnit(e.x, i)), M(r, "Y", t.formatUnit(e.y, i)), M(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
2616
+ I(r, t.t("property.layer"), e.layerName), I(r, t.t("property.content"), e.content), I(r, t.t("property.height"), t.formatUnit(e.height, i)), I(r, "X", t.formatUnit(e.x, i)), I(r, "Y", t.formatUnit(e.y, i)), I(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
2586
2617
  });
2587
2618
  }
2588
2619
  function Nt(s, e, t) {
2589
2620
  const i = document.createElement("div");
2590
- i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${I(e)}</strong><span>·</span><span>${I(t)}</span>`, s.appendChild(i);
2621
+ i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${M(e)}</strong><span>·</span><span>${M(t)}</span>`, s.appendChild(i);
2591
2622
  }
2592
2623
  function Se(s, e, t) {
2593
2624
  const i = document.createElement("section");
@@ -2595,15 +2626,15 @@ function Se(s, e, t) {
2595
2626
  const r = document.createElement("div");
2596
2627
  r.className = "vui-pp-section-label", r.textContent = e, i.appendChild(r), t(i), s.appendChild(i);
2597
2628
  }
2598
- function M(s, e, t) {
2629
+ function I(s, e, t) {
2599
2630
  const i = document.createElement("div");
2600
- i.className = "vui-pp-row", i.innerHTML = `<span class="label">${I(e)}</span><span class="value" title="${I(t)}">${I(t)}</span>`, s.appendChild(i);
2631
+ i.className = "vui-pp-row", i.innerHTML = `<span class="label">${M(e)}</span><span class="value" title="${M(t)}">${M(t)}</span>`, s.appendChild(i);
2601
2632
  }
2602
- function Gr(s) {
2633
+ function is(s) {
2603
2634
  const e = document.createElement("div");
2604
2635
  return e.className = "vui-empty-note", e.textContent = s, e;
2605
2636
  }
2606
- function et(s) {
2637
+ function tt(s) {
2607
2638
  if (s.querySelector('input:not([type="color"])'))
2608
2639
  throw new Error("Property panel must not contain editable inputs");
2609
2640
  if (s.querySelector('[contenteditable=""], [contenteditable="true"]'))
@@ -2611,17 +2642,17 @@ function et(s) {
2611
2642
  if (s.querySelector("textarea"))
2612
2643
  throw new Error("Property panel must not contain textarea elements");
2613
2644
  }
2614
- const Kr = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), Zr = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2645
+ const rs = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), ss = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2615
2646
  globalThis.clearTimeout(s);
2616
2647
  };
2617
- class Jr {
2648
+ class ns {
2618
2649
  constructor(e) {
2619
2650
  u(this, "onFlush");
2620
2651
  u(this, "requestFrame");
2621
2652
  u(this, "cancelFrame");
2622
2653
  u(this, "pending", /* @__PURE__ */ new Map());
2623
2654
  u(this, "scheduledHandle", null);
2624
- this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? Kr, this.cancelFrame = e.cancelFrame ?? Zr;
2655
+ this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? rs, this.cancelFrame = e.cancelFrame ?? ss;
2625
2656
  }
2626
2657
  enqueue(e, t) {
2627
2658
  this.pending.set(e, t), this.scheduledHandle === null && (this.scheduledHandle = this.requestFrame(() => {
@@ -2645,7 +2676,7 @@ class Jr {
2645
2676
  this.pending.clear(), this.scheduledHandle !== null && (this.cancelFrame(this.scheduledHandle), this.scheduledHandle = null);
2646
2677
  }
2647
2678
  }
2648
- const Qr = `
2679
+ const as = `
2649
2680
  :host {
2650
2681
  display: block;
2651
2682
  width: 100%;
@@ -3515,7 +3546,7 @@ button, input { font: inherit; }
3515
3546
  .vui-infobar-content { max-width: calc(100vw - 48px); }
3516
3547
  .vui-infobar-tools .vui-info-text { max-width: min(180px, 45vw); }
3517
3548
  }
3518
- `, es = {
3549
+ `, os = {
3519
3550
  dark: `
3520
3551
  :host, .vui-root[data-theme="dark"] {
3521
3552
  --vui-bg: #0A0B0F;
@@ -3636,13 +3667,13 @@ function fe(s = "dark", e = {}) {
3636
3667
  hudBackground: "--vui-hud-bg"
3637
3668
  }, i = Object.entries(e).filter(([, r]) => typeof r == "string" && r.trim().length > 0).map(([r, n]) => `${t[r]}: ${n};`).join(`
3638
3669
  `);
3639
- return `${es[s]}${i ? `
3670
+ return `${os[s]}${i ? `
3640
3671
  :host, .vui-root[data-theme="${s}"] {
3641
3672
  ${i}
3642
3673
  }
3643
- ` : ""}${Qr}`;
3674
+ ` : ""}${as}`;
3644
3675
  }
3645
- const ts = {
3676
+ const ls = {
3646
3677
  layerPanel: !0,
3647
3678
  propertyPanel: !0,
3648
3679
  hud: !0,
@@ -3652,8 +3683,8 @@ const ts = {
3652
3683
  infobarLineMode: !0,
3653
3684
  infobarPhase: !0,
3654
3685
  infobarDebug: !0
3655
- }, tt = "property-panel:open", it = "layer-panel:open", rt = 300, st = 180, is = 2;
3656
- let rs = 0;
3686
+ }, it = "property-panel:open", rt = "layer-panel:open", st = 300, nt = 180, ds = 2;
3687
+ let cs = 0;
3657
3688
  function _(s, ...e) {
3658
3689
  const t = document.createElement("div");
3659
3690
  t.className = "vui-debug-row";
@@ -3662,7 +3693,7 @@ function _(s, ...e) {
3662
3693
  const r = document.createElement("div");
3663
3694
  return r.className = "vui-debug-value", r.append(...e), t.append(i, r), t;
3664
3695
  }
3665
- function nt(s, e, t) {
3696
+ function at(s, e, t) {
3666
3697
  const i = document.createElement("div");
3667
3698
  i.className = "vui-debug-spread";
3668
3699
  const r = document.createElement("b");
@@ -3674,11 +3705,11 @@ function nt(s, e, t) {
3674
3705
  }
3675
3706
  return i;
3676
3707
  }
3677
- function at(s) {
3708
+ function ot(s) {
3678
3709
  const e = document.createElement("div");
3679
3710
  return e.className = "vui-debug-spread-list", e.append(...s), e;
3680
3711
  }
3681
- function ss(s, e) {
3712
+ function us(s, e) {
3682
3713
  switch (s) {
3683
3714
  case "created":
3684
3715
  return e.t("status.created");
@@ -3696,7 +3727,7 @@ function ss(s, e) {
3696
3727
  return "";
3697
3728
  }
3698
3729
  }
3699
- function ot(s) {
3730
+ function lt(s) {
3700
3731
  return (typeof s.composedPath == "function" ? s.composedPath() : [s.target]).some((t) => {
3701
3732
  var a, o;
3702
3733
  if (!t || typeof t != "object") return !1;
@@ -3706,11 +3737,11 @@ function ot(s) {
3706
3737
  return n === "" || n === "true" || n === "plaintext-only";
3707
3738
  });
3708
3739
  }
3709
- class ns {
3740
+ class hs {
3710
3741
  constructor(e, t) {
3711
3742
  u(this, "parts");
3712
3743
  u(this, "text");
3713
- u(this, "layerPanelState", new Mr());
3744
+ u(this, "layerPanelState", new Nr());
3714
3745
  u(this, "shadow", null);
3715
3746
  u(this, "layerPanelRefs", null);
3716
3747
  u(this, "propertyPanelRefs", null);
@@ -3742,32 +3773,32 @@ class ns {
3742
3773
  u(this, "activeLayerColorPreview", null);
3743
3774
  u(this, "renderedLayerRows", null);
3744
3775
  u(this, "handleKeyDown", (e) => {
3745
- if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || ot(e)) return;
3776
+ if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || lt(e)) return;
3746
3777
  const t = this.getFitShortcut();
3747
3778
  t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
3748
3779
  });
3749
3780
  u(this, "handleKeyboardTargetPointerDown", (e) => {
3750
3781
  var t, i;
3751
- this.disposed || ot(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3782
+ this.disposed || lt(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3752
3783
  });
3753
3784
  u(this, "unsubscribers", []);
3754
3785
  u(this, "filterCleanup", null);
3755
3786
  u(this, "disposed", !1);
3756
3787
  u(this, "persistenceNamespace");
3757
- u(this, "insertToggleScheduler", new Jr({
3788
+ u(this, "insertToggleScheduler", new ns({
3758
3789
  onFlush: (e) => {
3759
3790
  this.host.cad.blocks.batchToggleInserts(e);
3760
3791
  }
3761
3792
  }));
3762
3793
  u(this, "refresh", () => {
3763
- this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (Qe(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
3794
+ this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (et(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
3764
3795
  });
3765
3796
  u(this, "syncHud", () => {
3766
3797
  var e;
3767
3798
  if (!(this.disposed || !this.active)) {
3768
3799
  if (this.infobarRefs && this.parts.hud) {
3769
3800
  const t = this.host.cad.hud;
3770
- this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ? ss(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3801
+ this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ? us(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3771
3802
  const i = Math.round(t.fps);
3772
3803
  this.infobarRefs.fps.textContent = i > 0 ? this.text.t("toolbar.fps", { value: i }) : this.text.t("toolbar.fpsEmpty"), this.infobarRefs.fps.classList.toggle("hi", i >= 55), this.infobarRefs.fps.classList.toggle("mid", i >= 30 && i < 55), this.infobarRefs.fps.classList.toggle("low", i < 30);
3773
3804
  const r = t.blockVariantCount > 0 || t.splitBlockLayerGroupCount > 0 || t.entityCount > 0;
@@ -3778,7 +3809,7 @@ class ns {
3778
3809
  blocks: this.text.formatInteger(t.blockVariantCount),
3779
3810
  split: this.text.formatInteger(t.splitBlockLayerGroupCount)
3780
3811
  });
3781
- const n = t.renderDebugBreakdown.map((d) => nt(
3812
+ const n = t.renderDebugBreakdown.map((d) => at(
3782
3813
  d.label,
3783
3814
  this.text.t("toolbar.debug.breakdown", {
3784
3815
  renderables: this.text.formatInteger(d.renderables),
@@ -3790,8 +3821,8 @@ class ns {
3790
3821
  calls: this.text.formatInteger(t.drawCalls)
3791
3822
  })
3792
3823
  ];
3793
- n.length > 0 && a.push(at(n));
3794
- const o = t.splitBlockLayerDetails.map((d) => nt(
3824
+ n.length > 0 && a.push(ot(n));
3825
+ const o = t.splitBlockLayerDetails.map((d) => at(
3795
3826
  `${d.blockName} #${d.variantId}`,
3796
3827
  this.text.t("toolbar.debug.spreadMeta", {
3797
3828
  layers: this.text.formatInteger(d.layerCount),
@@ -3808,7 +3839,7 @@ class ns {
3808
3839
  const l = [this.text.t("toolbar.debug.splitLayerCount", {
3809
3840
  count: this.text.formatInteger(t.splitBlockLayerGroupCount)
3810
3841
  })];
3811
- o.length > 0 && l.push(at(o)), this.infobarRefs.debugBody.replaceChildren(
3842
+ o.length > 0 && l.push(ot(o)), this.infobarRefs.debugBody.replaceChildren(
3812
3843
  _("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
3813
3844
  ...t.lineRenderMode ? [_(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
3814
3845
  _(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
@@ -3828,7 +3859,7 @@ class ns {
3828
3859
  const t = this.host.cad.hud, i = t.fileCount > 0 ? this.text.t("toolbar.layerSummary", {
3829
3860
  visible: this.text.formatInteger(t.visibleLayerCount),
3830
3861
  total: this.text.formatInteger(t.totalLayerCount)
3831
- }) : "", r = Nr(t.statusMessage, this.text);
3862
+ }) : "", r = jr(t.statusMessage, this.text);
3832
3863
  this.toolbarInfoText.textContent = i && r ? `${i} | ${r}` : i || r;
3833
3864
  }
3834
3865
  this.scalebarRefs && (this.host.viewMode === "2d" && ((e = this.host.cad.hud.scaleRuler) != null && e.visible) ? (this.scalebarRefs.scaleBar.hidden = !1, this.scalebarRefs.scaleLabel.textContent = this.text.formatScaleLabel(
@@ -3839,7 +3870,7 @@ class ns {
3839
3870
  }
3840
3871
  });
3841
3872
  var i, r, n, a;
3842
- this.host = e, this.options = t, this.parts = { ...ts, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Tt({ ...t, unitFormatter: (r = t.cad) == null ? void 0 : r.unitFormatter }), this.persistenceNamespace = ((a = (n = t.cad) == null ? void 0 : n.persistenceKey) == null ? void 0 : a.trim()) || t.root.id.trim() || `instance-${++rs}`;
3873
+ this.host = e, this.options = t, this.parts = { ...ls, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Tt({ ...t, unitFormatter: (r = t.cad) == null ? void 0 : r.unitFormatter }), this.persistenceNamespace = ((a = (n = t.cad) == null ? void 0 : n.persistenceKey) == null ? void 0 : a.trim()) || t.root.id.trim() || `instance-${++cs}`;
3843
3874
  }
3844
3875
  mount() {
3845
3876
  var o, l;
@@ -3925,7 +3956,7 @@ class ns {
3925
3956
  const i = document.createElement("div");
3926
3957
  i.className = "vui-section";
3927
3958
  const r = document.createElement("div");
3928
- r.className = "vui-section-head", r.innerHTML = `<span class="vui-section-title">${I(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
3959
+ r.className = "vui-section-head", r.innerHTML = `<span class="vui-section-title">${M(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
3929
3960
  const n = document.createElement("div");
3930
3961
  n.className = "vui-section-filter-wrap";
3931
3962
  const a = document.createElement("input");
@@ -3976,7 +4007,7 @@ class ns {
3976
4007
  if (a.className = "vui-info-text", this.toolbarInfoText = a, n.appendChild(a), this.parts.fit) {
3977
4008
  this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
3978
4009
  const m = this.getFitShortcut();
3979
- this.btnFit.innerHTML = m ? `${I(this.text.t("toolbar.fit"))} <span class="vui-kbd">${I(m.toUpperCase())}</span>` : I(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
4010
+ this.btnFit.innerHTML = m ? `${M(this.text.t("toolbar.fit"))} <span class="vui-kbd">${M(m.toUpperCase())}</span>` : M(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
3980
4011
  }
3981
4012
  if (this.parts.viewMode) {
3982
4013
  const m = document.createElement("div");
@@ -4020,7 +4051,7 @@ class ns {
4020
4051
  const t = document.createElement("div");
4021
4052
  t.className = "vui-property-panel", t.dataset.part = "property-panel";
4022
4053
  const i = document.createElement("div");
4023
- i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${I(this.text.t("panel.properties"))}</span>`;
4054
+ i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${M(this.text.t("panel.properties"))}</span>`;
4024
4055
  const r = document.createElement("div");
4025
4056
  r.className = "vui-pp-preview-wrap", r.hidden = !0;
4026
4057
  const n = document.createElement("canvas");
@@ -4033,8 +4064,8 @@ class ns {
4033
4064
  return l.type = "button", l.className = "vui-property-panel-toggle", l.addEventListener("click", () => this.setPropertyPanelOpen(e.classList.contains("closed"))), o.appendChild(l), e.append(o, t), this.propertyPanelShell = e, this.propertyPanelToggle = l, this.propertyPanelRefs = { body: a, previewWrap: r, previewCanvas: n }, e;
4034
4065
  }
4035
4066
  bindEvents() {
4036
- this.layerPanelRefs && (this.filterCleanup = Yr(this.layerPanelRefs.filterInput, (e) => {
4037
- this.layerPanelState.filterText = e, this.layerPanelRefs && Br(this.layerPanelRefs.list, e);
4067
+ this.layerPanelRefs && (this.filterCleanup = Qr(this.layerPanelRefs.filterInput, (e) => {
4068
+ this.layerPanelState.filterText = e, this.layerPanelRefs && Xr(this.layerPanelRefs.list, e);
4038
4069
  })), this.unsubscribers.push(
4039
4070
  this.host.cad.on("document-change", () => this.refresh()),
4040
4071
  this.host.cad.on("layer-change", () => this.syncLayerChange()),
@@ -4042,9 +4073,9 @@ class ns {
4042
4073
  this.host.cad.on("inspector-change", () => {
4043
4074
  if (this.layerPanelRefs && this.parts.layerPanel) {
4044
4075
  const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
4045
- i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : _r(this.layerPanelRefs.list, e);
4076
+ i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : Wr(this.layerPanelRefs.list, e);
4046
4077
  }
4047
- this.propertyPanelRefs && this.parts.propertyPanel && (Qe(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4078
+ this.propertyPanelRefs && this.parts.propertyPanel && (et(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4048
4079
  }),
4049
4080
  this.host.cad.on("hud-change", () => this.syncHud()),
4050
4081
  this.host.on("view-mode-change", () => {
@@ -4103,7 +4134,7 @@ class ns {
4103
4134
  return !!(e && e.isConnected && ((t = this.layerPanelRefs) != null && t.list.contains(e)));
4104
4135
  }
4105
4136
  renderLayerPanel() {
4106
- !this.layerPanelRefs || !this.parts.layerPanel || (jr(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4137
+ !this.layerPanelRefs || !this.parts.layerPanel || (Kr(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4107
4138
  }
4108
4139
  syncLayerChange() {
4109
4140
  if (!this.isLayerColorPreviewActive()) {
@@ -4111,7 +4142,7 @@ class ns {
4111
4142
  this.refresh();
4112
4143
  return;
4113
4144
  }
4114
- Ur(
4145
+ Gr(
4115
4146
  this.layerPanelRefs.list,
4116
4147
  this.host.cad.layers.rows,
4117
4148
  this.host.cad.layers.allColor,
@@ -4133,7 +4164,7 @@ class ns {
4133
4164
  var e;
4134
4165
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
4135
4166
  try {
4136
- return this.readState(tt) === "1";
4167
+ return this.readState(it) === "1";
4137
4168
  } catch {
4138
4169
  return !1;
4139
4170
  }
@@ -4142,7 +4173,7 @@ class ns {
4142
4173
  var e;
4143
4174
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
4144
4175
  try {
4145
- return this.readState(it) !== "0";
4176
+ return this.readState(rt) !== "0";
4146
4177
  } catch {
4147
4178
  return !0;
4148
4179
  }
@@ -4155,7 +4186,7 @@ class ns {
4155
4186
  panel: this.text.t("panel.layers")
4156
4187
  })), !!t && (this.emitUiLayoutChange(), ((n = this.options.cad) == null ? void 0 : n.persistence) !== !1)))
4157
4188
  try {
4158
- this.writeState(it, e ? "1" : "0");
4189
+ this.writeState(rt, e ? "1" : "0");
4159
4190
  } catch {
4160
4191
  }
4161
4192
  }
@@ -4171,7 +4202,7 @@ class ns {
4171
4202
  panel: this.text.t("panel.properties")
4172
4203
  })), (n = i.querySelector(".vui-property-panel")) == null || n.setAttribute("aria-hidden", String(!e)), e ? this.syncPropertyPanelPreview(!0) : (this.cancelPropertyPreviewRender(), this.propertyPanelRefs && H(this.propertyPanelRefs, !1)), !!t && (this.emitUiLayoutChange(), ((a = this.options.cad) == null ? void 0 : a.persistence) !== !1)))
4173
4204
  try {
4174
- this.writeState(tt, e ? "1" : "0");
4205
+ this.writeState(it, e ? "1" : "0");
4175
4206
  } catch {
4176
4207
  }
4177
4208
  }
@@ -4269,7 +4300,7 @@ class ns {
4269
4300
  return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
4270
4301
  }
4271
4302
  isPropertyPreviewLayoutReady(e) {
4272
- return e.clientWidth >= st && e.clientHeight >= st;
4303
+ return e.clientWidth >= nt && e.clientHeight >= nt;
4273
4304
  }
4274
4305
  waitForPropertyPreviewLayout(e) {
4275
4306
  if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
@@ -4291,24 +4322,24 @@ class ns {
4291
4322
  return;
4292
4323
  }
4293
4324
  if (b === o) {
4294
- a += 1, a >= is && h();
4325
+ a += 1, a >= ds && h();
4295
4326
  return;
4296
4327
  }
4297
4328
  o = b, a = 0;
4298
4329
  }, v = (b) => {
4299
- if (!as(b)) return;
4330
+ if (!ps(b)) return;
4300
4331
  let g = !1;
4301
4332
  const x = (C) => {
4302
4333
  C.target !== b || C.propertyName !== "width" || w();
4303
4334
  }, w = () => {
4304
4335
  g || (g = !0, b.removeEventListener("transitionend", x), requestAnimationFrame(f));
4305
4336
  };
4306
- b.addEventListener("transitionend", x), l.push(window.setTimeout(w, rt)), d.push(() => {
4337
+ b.addEventListener("transitionend", x), l.push(window.setTimeout(w, st)), d.push(() => {
4307
4338
  g || (g = !0, b.removeEventListener("transitionend", x));
4308
4339
  });
4309
4340
  }, y = () => {
4310
4341
  f(), n || (c = requestAnimationFrame(y));
4311
- }, m = window.setTimeout(h, rt);
4342
+ }, m = window.setTimeout(h, st);
4312
4343
  v(i), v(t), c = requestAnimationFrame(y), this.propertyPreviewLayoutWaitAbort = () => {
4313
4344
  n = !0, p();
4314
4345
  };
@@ -4326,7 +4357,7 @@ class ns {
4326
4357
  this.propertyPreviewRenderHandle !== null && (cancelAnimationFrame(this.propertyPreviewRenderHandle), this.propertyPreviewRenderHandle = null), (e = this.propertyPreviewLayoutWaitAbort) == null || e.call(this), this.propertyPreviewLayoutWaitAbort = null;
4327
4358
  }
4328
4359
  }
4329
- function as(s) {
4360
+ function ps(s) {
4330
4361
  const e = getComputedStyle(s), t = e.transitionDuration.split(",").map((r) => r.trim()), i = e.transitionProperty.split(",").map((r) => r.trim());
4331
4362
  for (let r = 0; r < i.length; r += 1) {
4332
4363
  const n = i[r] ?? i[0] ?? "all";
@@ -4335,8 +4366,8 @@ function as(s) {
4335
4366
  }
4336
4367
  return !1;
4337
4368
  }
4338
- const os = ["left", "right", "top", "bottom"], te = 0.5, ls = /* @__PURE__ */ new Set(["cad", "scene"]);
4339
- class ds {
4369
+ const fs = ["left", "right", "top", "bottom"], te = 0.5, ms = /* @__PURE__ */ new Set(["cad", "scene"]);
4370
+ class vs {
4340
4371
  constructor(e) {
4341
4372
  u(this, "zoneContainers", /* @__PURE__ */ new Map());
4342
4373
  u(this, "mounts", /* @__PURE__ */ new Set());
@@ -4346,7 +4377,7 @@ class ds {
4346
4377
  u(this, "flags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4347
4378
  u(this, "lastInsets", Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 }));
4348
4379
  u(this, "lastFlags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4349
- u(this, "activeGroups", ls);
4380
+ u(this, "activeGroups", ms);
4350
4381
  u(this, "warnedUnstableReference", !1);
4351
4382
  u(this, "disposed", !1);
4352
4383
  u(this, "frameHandle", null);
@@ -4437,7 +4468,7 @@ class ds {
4437
4468
  installZoneStyles(e, t) {
4438
4469
  if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
4439
4470
  const i = document.createElement("style");
4440
- i.dataset.viewerLayout = t, i.textContent = hs, e.append(i), this.installedStyles.push(i), z(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4471
+ i.dataset.viewerLayout = t, i.textContent = ys, e.append(i), this.installedStyles.push(i), z(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4441
4472
  }
4442
4473
  schedule() {
4443
4474
  if (!(this.disposed || this.frameHandle !== null)) {
@@ -4454,7 +4485,7 @@ class ds {
4454
4485
  if (this.disposed) return;
4455
4486
  const e = this.host.reference(), t = this.host.target();
4456
4487
  if (!e || typeof e.getBoundingClientRect != "function") return;
4457
- const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !us(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4488
+ const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !bs(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4458
4489
  !n && !a || (this.lastInsets = r, this.lastFlags = { ...this.flags }, n && this.assertStableReference(e, t) && this.applyInsets(t, r), this.host.onChange(r, this.lastFlags));
4459
4490
  }
4460
4491
  applyInsets(e, t) {
@@ -4473,9 +4504,9 @@ class ds {
4473
4504
  }
4474
4505
  for (const i of this.zoneContainers.values()) {
4475
4506
  const r = i.dataset.viewerZone;
4476
- if (!(!r || !os.includes(r) || !this.isZoneVisible(i)))
4507
+ if (!(!r || !fs.includes(r) || !this.isZoneVisible(i)))
4477
4508
  for (const n of Array.from(i.children)) {
4478
- if (!cs(n)) continue;
4509
+ if (!gs(n)) continue;
4479
4510
  const a = n.getBoundingClientRect();
4480
4511
  this.accumulateInset(
4481
4512
  t,
@@ -4514,7 +4545,7 @@ function me(s, e, t) {
4514
4545
  function z(s) {
4515
4546
  return !!(s && typeof s == "object" && s.nodeType === 1);
4516
4547
  }
4517
- function cs(s) {
4548
+ function gs(s) {
4518
4549
  if (!z(s) || s.hidden) return !1;
4519
4550
  const e = typeof getComputedStyle == "function" ? getComputedStyle(s) : null;
4520
4551
  return !(e && (e.display === "none" || e.visibility === "hidden"));
@@ -4524,10 +4555,10 @@ function ie(s, e) {
4524
4555
  const t = e > 0 ? Math.min(s, e) : s;
4525
4556
  return Math.max(0, Math.round(t * 2) / 2);
4526
4557
  }
4527
- function us(s, e) {
4558
+ function bs(s, e) {
4528
4559
  return Math.abs(s.top - e.top) <= te && Math.abs(s.right - e.right) <= te && Math.abs(s.bottom - e.bottom) <= te && Math.abs(s.left - e.left) <= te;
4529
4560
  }
4530
- const hs = `
4561
+ const ys = `
4531
4562
  [data-viewer-zone] { position: absolute; pointer-events: none; z-index: 1; }
4532
4563
  [data-viewer-zone] > * { pointer-events: auto; }
4533
4564
  [data-viewer-zone="left"] { left: 0; top: 0; bottom: 0; }
@@ -4536,7 +4567,7 @@ const hs = `
4536
4567
  [data-viewer-zone="bottom"] { left: 0; right: 0; bottom: 0; }
4537
4568
  [data-viewer-zone="overlay"] { inset: 0; }
4538
4569
  [data-viewer-zone][data-viewer-zone-active="false"] { display: none; }
4539
- `, ps = {
4570
+ `, xs = {
4540
4571
  play: '<path d="m8 5 11 7-11 7Z"/>',
4541
4572
  pause: '<path d="M8 5v14M16 5v14"/>',
4542
4573
  reset: '<path d="M3 10a9 9 0 1 1 2.5 8M3 4v6h6"/>',
@@ -4550,10 +4581,10 @@ const hs = `
4550
4581
  sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5"/>',
4551
4582
  moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
4552
4583
  };
4553
- function Vt(s) {
4554
- return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ps[s]}</svg>`;
4584
+ function Ft(s) {
4585
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${xs[s]}</svg>`;
4555
4586
  }
4556
- const fs = {
4587
+ const ws = {
4557
4588
  filename: !0,
4558
4589
  playback: !0,
4559
4590
  reset: !0,
@@ -4563,8 +4594,8 @@ const fs = {
4563
4594
  collision: !0,
4564
4595
  theme: !0
4565
4596
  };
4566
- function ms(s, e) {
4567
- const t = { ...fs, ...e.parts }, i = document.createElement("nav");
4597
+ function Cs(s, e) {
4598
+ const t = { ...ws, ...e.parts }, i = document.createElement("nav");
4568
4599
  i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
4569
4600
  const r = document.createElement("span");
4570
4601
  r.className = "vpu-filename", r.hidden = !0;
@@ -4574,7 +4605,7 @@ function ms(s, e) {
4574
4605
  let o = null, l = null, d = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, c = e.theme ?? "dark", p = null;
4575
4606
  const h = (m, b, g, x, w) => {
4576
4607
  const C = document.createElement("button");
4577
- return C.type = "button", C.className = "vpu-btn", C.dataset.viewerControl = b, C.dataset.viewerControlId = m, C.innerHTML = Vt(x), C.title = g, C.setAttribute("aria-label", g), C.addEventListener("click", w), a.set(m, { button: C, icon: x }), n.append(C), C;
4608
+ return C.type = "button", C.className = "vpu-btn", C.dataset.viewerControl = b, C.dataset.viewerControlId = m, C.innerHTML = Ft(x), C.title = g, C.setAttribute("aria-label", g), C.addEventListener("click", w), a.set(m, { button: C, icon: x }), n.append(C), C;
4578
4609
  }, f = (m, b) => m ? b === "filename" ? t.filename : b === "playback" ? t.playback && m.canPlay : b === "reset" ? t.reset && m.canReset : b === "fit" ? t.fit : b === "upAxis" ? t.upAxis && m.canReorientUpAxis === !0 : b === "ground" ? t.ground && m.canToggleGround === !0 : b === "collision" ? t.collision && m.canToggleCollision === !0 : t.theme : !1, v = (m) => {
4579
4610
  var g, x, w;
4580
4611
  p = m, n.replaceChildren(), a.clear(), o = null, l = null;
@@ -4624,7 +4655,7 @@ function ms(s, e) {
4624
4655
  const x = a.get("collision");
4625
4656
  x && re(x.button, m.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", m.collisionVisible);
4626
4657
  const w = a.get("upAxis");
4627
- w && re(w.button, gs(m.upAxis), vs(m.upAxis), m.upAxis === "y");
4658
+ w && re(w.button, Es(m.upAxis), Ss(m.upAxis), m.upAxis === "y");
4628
4659
  };
4629
4660
  return {
4630
4661
  element: i,
@@ -4639,15 +4670,15 @@ function ms(s, e) {
4639
4670
  };
4640
4671
  }
4641
4672
  function re(s, e, t, i) {
4642
- s.innerHTML = Vt(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4673
+ s.innerHTML = Ft(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4643
4674
  }
4644
- function vs(s) {
4675
+ function Ss(s) {
4645
4676
  return s === "y" ? "upAxisY" : "upAxisZ";
4646
4677
  }
4647
- function gs(s) {
4678
+ function Es(s) {
4648
4679
  return s === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
4649
4680
  }
4650
- class bs {
4681
+ class ks {
4651
4682
  constructor(e = "dark", t) {
4652
4683
  u(this, "root");
4653
4684
  u(this, "title");
@@ -4733,7 +4764,7 @@ class bs {
4733
4764
  this.closeReport(), this.reportLink = null, !this.root.hidden && (this.root.hidden = !0, this.title.textContent = "", this.detail.textContent = "", this.detail.hidden = !0, this.toggle.hidden = !0);
4734
4765
  }
4735
4766
  }
4736
- const ys = `
4767
+ const Ps = `
4737
4768
  .vpu-root {
4738
4769
  position: absolute;
4739
4770
  inset: 0;
@@ -4899,21 +4930,21 @@ const ys = `
4899
4930
  @media (prefers-reduced-motion: reduce) {
4900
4931
  .vpu-status-spinner { animation: none; }
4901
4932
  }
4902
- `, lt = "scene";
4903
- function xs(s, e) {
4933
+ `, dt = "scene";
4934
+ function As(s, e) {
4904
4935
  let t = null, i = null, r = null, n = null, a = null, o = null;
4905
4936
  return {
4906
4937
  id: "nebula.ui.scene",
4907
4938
  activate(l) {
4908
4939
  var c, p;
4909
- o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = ys, (c = s.shadowRoot()) == null || c.append(o), t = ms(l, {
4940
+ o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = Ps, (c = s.shadowRoot()) == null || c.append(o), t = Cs(l, {
4910
4941
  label: e.label("simulation"),
4911
4942
  parts: (p = e.scene) == null ? void 0 : p.parts,
4912
4943
  theme: s.theme()
4913
- }), i = new bs(s.theme(), () => {
4944
+ }), i = new ks(s.theme(), () => {
4914
4945
  var h;
4915
4946
  return ((h = s.getVisualDiagnostics) == null ? void 0 : h.call(s)) ?? null;
4916
- }), r = s.mountBuiltin(t.element, { zone: "overlay", group: lt }), n = s.mountBuiltin(i.element, { zone: "overlay", group: lt }), a = s.onThemeChange((h) => {
4947
+ }), r = s.mountBuiltin(t.element, { zone: "overlay", group: dt }), n = s.mountBuiltin(i.element, { zone: "overlay", group: dt }), a = s.onThemeChange((h) => {
4917
4948
  t == null || t.themeChanged(h), i == null || i.themeChanged(h);
4918
4949
  });
4919
4950
  const d = () => {
@@ -4938,7 +4969,7 @@ function xs(s, e) {
4938
4969
  }
4939
4970
  };
4940
4971
  }
4941
- class ws {
4972
+ class Ms {
4942
4973
  constructor(e, t, i, r) {
4943
4974
  u(this, "renderer", new pi());
4944
4975
  u(this, "scene", new we());
@@ -4986,14 +5017,14 @@ class ws {
4986
5017
  this.setVisible(!1), this.disposed = !0, this.scene.clear(), this.labels.length = 0;
4987
5018
  }
4988
5019
  }
4989
- function Cs(s) {
5020
+ function Is(s) {
4990
5021
  const e = s.clone().invert(), t = [new E(1, 0, 0), new E(0, 1, 0), new E(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
4991
5022
  return `<svg viewBox="0 0 100 100" role="img" aria-label="世界坐标轴">${t.flatMap((n, a) => [-1, 1].map((o) => ({ p: n.clone().multiplyScalar(o).applyQuaternion(e), i: a, sign: o }))).sort((n, a) => n.p.z - a.p.z).map(({ p: n, i: a, sign: o }) => {
4992
5023
  const l = 50 + n.x * 32, d = 50 - n.y * 32, c = i[a];
4993
5024
  return `${o > 0 ? `<path d="M50 50L${l} ${d}" stroke="${c}" stroke-width="2"/>` : ""}<circle cx="${l}" cy="${d}" r="${o > 0 ? 7.5 : 4}" fill="${c}" opacity="${o > 0 ? 1 : 0.6}" stroke="none"/>${o > 0 ? `<text x="${l}" y="${d + 3}" fill="#101b24" stroke="none" text-anchor="middle" font-size="9">${"XYZ"[a]}</text>` : ""}`;
4994
5025
  }).join("")}</svg>`;
4995
5026
  }
4996
- const Ss = {
5027
+ const Rs = {
4997
5028
  structure: '<rect x="9" y="3" width="6" height="5" rx="1"/><rect x="2" y="16" width="6" height="5" rx="1"/><rect x="16" y="16" width="6" height="5" rx="1"/><path d="M12 8v4M5 16v-4h14v4"/>',
4998
5029
  zoomIn: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6m-3-3v6"/>',
4999
5030
  zoomOut: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6"/>',
@@ -5022,7 +5053,7 @@ const Ss = {
5022
5053
  moon: '<path d="M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/>'
5023
5054
  };
5024
5055
  function R(s) {
5025
- return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ss[s]}</svg>`;
5056
+ return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Rs[s]}</svg>`;
5026
5057
  }
5027
5058
  function P(s) {
5028
5059
  return s.mode === "kinematic" || s.mode === "dynamics-paused" || s.mode === "dynamics-unavailable";
@@ -5035,22 +5066,22 @@ function ee(s, e = 1 / 0) {
5035
5066
  const t = s.controlLimits;
5036
5067
  return t && (Number.isFinite(t.lower) || Number.isFinite(t.upper)) ? { lower: Number.isFinite(t.lower) ? t.lower : -e, upper: Number.isFinite(t.upper) ? t.upper : e } : s.jointType === "continuous" ? { lower: -Math.PI, upper: Math.PI } : { lower: ((i = s.limits) == null ? void 0 : i.lower) ?? -e, upper: ((r = s.limits) == null ? void 0 : r.upper) ?? e };
5037
5068
  }
5038
- function Es(s, e, t, i) {
5069
+ function Ls(s, e, t, i) {
5039
5070
  const r = s.ownerDocument, n = r.defaultView;
5040
5071
  let a = !1, o = 0, l = null, d = null, c = "";
5041
5072
  const p = (S) => S.composedPath().some((A) => A instanceof n.HTMLElement && (A.matches("input,textarea,select") || A.isContentEditable)), h = () => {
5042
5073
  d && (d = null, s.style.cursor = c, s.removeAttribute("data-joint-adjusting"));
5043
5074
  }, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), v = (S) => {
5044
- var Le;
5075
+ var Te;
5045
5076
  if (S.code === "Escape") {
5046
5077
  h();
5047
5078
  return;
5048
5079
  }
5049
5080
  if (S.code !== "KeyR" || S.repeat || S.ctrlKey || S.altKey || S.metaKey || p(S) || !a && r.activeElement !== s || !f()) return;
5050
- const A = e.getSnapshot(), L = A.nodes.find((Te) => Te.id === A.selectedEntityId && Te.kind === "joint");
5081
+ const A = e.getSnapshot(), L = A.nodes.find((De) => De.id === A.selectedEntityId && De.kind === "joint");
5051
5082
  if (!(L != null && L.movable) || L.mimic) return;
5052
5083
  t();
5053
- const G = (Le = e.jointWorldFrame) == null ? void 0 : Le.call(e, L.name), K = i == null ? void 0 : i(), $t = G && K && l !== null ? ks(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
5084
+ const G = (Te = e.jointWorldFrame) == null ? void 0 : Te.call(e, L.name), K = i == null ? void 0 : i(), $t = G && K && l !== null ? Ts(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
5054
5085
  d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...ee(L), direction: $t }, c = s.style.cursor, s.style.cursor = "ew-resize", s.setAttribute("data-joint-adjusting", "true"), S.preventDefault();
5055
5086
  }, y = (S) => {
5056
5087
  S.code === "KeyR" && h();
@@ -5080,15 +5111,15 @@ function Es(s, e, t, i) {
5080
5111
  h(), D(), s.removeEventListener("pointerenter", b), s.removeEventListener("pointerleave", g), s.removeEventListener("pointermove", m, !0), s.removeEventListener("pointerdown", x, !0), r.removeEventListener("keydown", v), r.removeEventListener("keyup", y), r.removeEventListener("focusin", w), r.removeEventListener("visibilitychange", C), n.removeEventListener("blur", g);
5081
5112
  };
5082
5113
  }
5083
- function ks(s, e, t, i, r, n) {
5114
+ function Ts(s, e, t, i, r, n) {
5084
5115
  if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
5085
5116
  s.updateMatrixWorld(!0);
5086
5117
  const a = e.axis.clone().normalize(), o = s.getWorldDirection(new E()), l = new E(1, 0, 0).transformDirection(s.matrixWorld), d = new E(0, 1, 0).transformDirection(s.matrixWorld);
5087
5118
  let c = a.clone();
5088
5119
  if (!n) {
5089
- const f = new St();
5120
+ const f = new Et();
5090
5121
  f.setFromCamera(new oe((i - t.left) / t.width * 2 - 1, 1 - (r - t.top) / t.height * 2), s);
5091
- const v = f.ray.intersectPlane(new Et().setFromNormalAndCoplanarPoint(o, e.position), new E()), y = v ? v.sub(e.position) : new E();
5122
+ const v = f.ray.intersectPlane(new kt().setFromNormalAndCoplanarPoint(o, e.position), new E()), y = v ? v.sub(e.position) : new E();
5092
5123
  c = a.clone().cross(y), Math.abs(c.dot(l)) <= Math.max(y.length(), 1e-6) * 0.05 && (c = a.clone().cross(o.clone().negate()), Math.abs(c.dot(l)) < 0.05 && (c = a.clone().cross(d.clone().negate())));
5093
5124
  }
5094
5125
  const p = c.dot(l);
@@ -5099,7 +5130,7 @@ function ks(s, e, t, i, r, n) {
5099
5130
  function W(s, e, t) {
5100
5131
  return s.jointType === "prismatic" ? `${e.toFixed(3)} m` : t === "rad" ? `${e.toFixed(3)} rad` : `${(e * 180 / Math.PI).toFixed(1)}°`;
5101
5132
  }
5102
- function Ps(s, e) {
5133
+ function Ds(s, e) {
5103
5134
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5104
5135
  }
5105
5136
  function ue(s, e) {
@@ -5113,7 +5144,7 @@ function ue(s, e) {
5113
5144
  return s;
5114
5145
  }
5115
5146
  function Ee(s, e, t, i = !1) {
5116
- const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Ps(s, t);
5147
+ const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Ds(s, t);
5117
5148
  return `<div class="vurdf-slider-card ${e.selectedEntityId === s.id ? "is-selected" : ""}" data-joint-card="${k(s.id)}" tabindex="0" role="group" aria-label="${k(s.name)},点击选中关节">
5118
5149
  <div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${k(s.id)}">${k(s.name)}</button><output data-joint-readout="${k(s.name)}">${W(s, a, t)}</output></div>
5119
5150
  <small>${i ? "联动控制 · " : ""}${k(s.parentLink)} → ${k(s.childLink)}</small>
@@ -5121,13 +5152,13 @@ function Ee(s, e, t, i = !1) {
5121
5152
  ${s.mimic ? `<small>跟随 ${k(s.mimic.joint)} × ${s.mimic.multiplier} + ${W(s, s.mimic.offset, t)}</small>` : ""}
5122
5153
  </div>`;
5123
5154
  }
5124
- function dt(s, e, t) {
5155
+ function ct(s, e, t) {
5125
5156
  const i = e.nodes.filter((o) => o.kind === "joint"), r = s.kind === "joint" ? s : i.find((o) => o.childLink === s.name);
5126
5157
  if (!r) return "";
5127
5158
  const n = ue(r, i), a = i.filter((o) => o.mimic && ue(o, i).name === n.name);
5128
5159
  return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Ee(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => k(o.name)).join(" · ")}</p></section>` : "";
5129
5160
  }
5130
- function As(s, e, t) {
5161
+ function Os(s, e, t) {
5131
5162
  const i = s.nodes.filter((c) => c.kind === "joint"), r = /* @__PURE__ */ new Map();
5132
5163
  for (const c of i) r.set(c.parentLink, [...r.get(c.parentLink) ?? [], c]);
5133
5164
  const n = new Set(i.map((c) => c.childLink)), a = /* @__PURE__ */ new Set(), o = [], l = (c) => {
@@ -5153,10 +5184,10 @@ function As(s, e, t) {
5153
5184
  return `<section class="vurdf-joint-group"><h3>${k(c[0].parentLink)} → ${k(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Ee(h, s, t, !0)).join("")}${c.map((h) => Ee(h, s, t, p.includes(h))).join("")}</section>`;
5154
5185
  }).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
5155
5186
  }
5156
- function Is(s) {
5187
+ function zs(s) {
5157
5188
  return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${s === "deg"}">${R("angleUnit")}<span>${s === "rad" ? "rad" : "°"}</span></button>`;
5158
5189
  }
5159
- class Ms {
5190
+ class Ns {
5160
5191
  constructor(e, t, i) {
5161
5192
  u(this, "element", document.createElement("aside"));
5162
5193
  u(this, "root", document.createElement("div"));
@@ -5187,7 +5218,7 @@ class Ms {
5187
5218
  <div class="vurdf-head"><div><strong>URDF模型结构</strong><span>${e.nodes.filter((d) => d.kind === "link").length} Links · ${e.nodes.filter((d) => d.kind === "joint").length} Joints</span></div><button class="vurdf-diagram-open" data-open-diagram title="打开结构图" aria-label="打开结构图">${R("structure")}</button></div>
5188
5219
  <label class="vurdf-search">${R("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${k(this.query)}"></label>
5189
5220
  <div class="vurdf-filters">${ve("all", "全部", this.filter)}${ve("movable", "可动关节", this.filter)}${ve("errors", `错误 ${e.issues.length}`, this.filter)}</div>
5190
- <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? As(e, this.query, this.angleUnit) : Rs(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5221
+ <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? Os(e, this.query, this.angleUnit) : Fs(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5191
5222
  `, this.bind(e), this.setDiagramOpen(this.diagramOpen);
5192
5223
  const o = this.root.querySelector(".vurdf-tree");
5193
5224
  o && (o.scrollTop = r.top, o.scrollLeft = r.left, a && ((l = Array.from(o.querySelectorAll("[data-entity]")).find((d) => d.dataset.entity === a)) == null || l.focus({ preventScroll: !0 })));
@@ -5273,7 +5304,7 @@ class Ms {
5273
5304
  });
5274
5305
  }
5275
5306
  }
5276
- function Rs(s, e, t, i, r, n) {
5307
+ function Fs(s, e, t, i, r, n) {
5277
5308
  const a = new Map(s.nodes.map((p) => [p.id, p])), o = i.trim().toLowerCase(), l = o.length > 0 || t !== "all", d = (p) => {
5278
5309
  const h = !o || p.name.toLowerCase().includes(o), f = t === "all" || t === "movable" && p.kind === "joint" && p.movable || t === "errors" && e.has(p.id);
5279
5310
  return h && f;
@@ -5298,8 +5329,8 @@ function Rs(s, e, t, i, r, n) {
5298
5329
  function ve(s, e, t) {
5299
5330
  return `<button class="vurdf-chip ${s === t ? "is-active" : ""}" data-filter="${s}">${e}</button>`;
5300
5331
  }
5301
- const Ls = 1800;
5302
- class Ts {
5332
+ const Vs = 1800;
5333
+ class $s {
5303
5334
  constructor(e) {
5304
5335
  u(this, "element", document.createElement("aside"));
5305
5336
  u(this, "root", document.createElement("div"));
@@ -5337,9 +5368,9 @@ class Ts {
5337
5368
  a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
5338
5369
  }), this.root.innerHTML = `
5339
5370
  <nav class="vurdf-tabs">${ge("properties", "属性", this.tab)}${ge("source", "XML", this.tab)}${ge("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
5340
- <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Ds(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : Ns()}</section>
5341
- <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Os(e, t) : ""}</section>
5342
- <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${zs(e)}</section>
5371
+ <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Bs(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : js()}</section>
5372
+ <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? _s(e, t) : ""}</section>
5373
+ <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Us(e)}</section>
5343
5374
  `, this.bind(e), this.tab === "source" && ((n = (r = this.root.querySelector(".vurdf-source .line.is-selected")) == null ? void 0 : r.scrollIntoView) == null || n.call(r, { block: "center" }));
5344
5375
  }
5345
5376
  dispose() {
@@ -5449,7 +5480,7 @@ class Ts {
5449
5480
  const { lower: i, upper: r } = ee(e, Math.PI), n = () => {
5450
5481
  const a = this.sweep;
5451
5482
  if (!a || a.jointName !== e.name || this.disposed || !P(this.inspection.getSnapshot())) return;
5452
- const o = Math.min(1, (Date.now() - a.startedAt) / Ls), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5483
+ const o = Math.min(1, (Date.now() - a.startedAt) / Vs), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5453
5484
  if (this.inspection.setJointValue(e.name, i + (r - i) * l), o >= 1) {
5454
5485
  const d = a.initial;
5455
5486
  this.sweep = null, this.inspection.setJointValue(e.name, d);
@@ -5464,7 +5495,7 @@ class Ts {
5464
5495
  t && (t.timer !== null && clearTimeout(t.timer), this.sweep = null, e && !this.disposed && this.inspection.setJointValue(t.jointName, t.initial));
5465
5496
  }
5466
5497
  }
5467
- function Ds(s, e, t, i, r) {
5498
+ function Bs(s, e, t, i, r) {
5468
5499
  var n, a;
5469
5500
  if (s.kind === "joint") {
5470
5501
  const o = e.nodes.find((y) => y.kind === "link" && y.id === `link:${s.childLink}`), l = e.jointValues[s.name] ?? 0, { lower: d, upper: c } = ee(s, Math.PI), p = Pe(s, i), h = s.jointType === "prismatic" ? "m" : i === "deg" ? "°" : "rad", f = `<span class="vurdf-unit-label">${h}</span>`, v = s.mimic ? `<section class="vurdf-section vurdf-follower"><div class="vurdf-section-head"><strong>从属关节</strong>${f}<span class="vurdf-readonly-badge">只读 · 自动跟随</span></div><output class="vurdf-follower-value" data-joint-readout="${k(s.name)}">${W(s, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${k(s.mimic.joint)}">${k(s.mimic.joint)}</button></div></section>` : s.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${P(e) ? "" : "disabled"}>
@@ -5473,25 +5504,25 @@ function Ds(s, e, t, i, r) {
5473
5504
  <div class="vurdf-quick"><span>${(d * p).toFixed(2)} ${h}</span><button data-joint-value="${d}">下限</button><button data-joint-value="0">零位</button><button data-joint-value="${c}">上限</button><span>${(c * p).toFixed(2)} ${h}</span></div>
5474
5505
  ${P(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
5475
5506
  </fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
5476
- return `<div class="vurdf-entity"><label>${k(s.jointType.toUpperCase())} JOINT</label><h2>${k(s.name)}</h2><p>${k(s.parentLink)} → ${k(s.childLink)}</p></div>${v}${dt(s, e, i)}<div class="vurdf-section"><div class="vurdf-section-head"><strong>变换与轴</strong><span>m / rad</span></div><dl class="vurdf-data"><dt>关节原点 XYZ</dt><dd>${s.originPosition.map(be).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${s.originRotationRpy.map(be).join(" ")}</dd><dt>Axis xyz</dt><dd>${s.axis.map(be).join(" ")}</dd><dt>Lower</dt><dd>${((n = s.limits) == null ? void 0 : n.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = s.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${s.effort ?? "—"}</dd><dt>Velocity</dt><dd>${s.velocity ?? "—"}</dd></dl></div>${o ? ut(o, !0, r.has(o.id)) : ""}`;
5507
+ return `<div class="vurdf-entity"><label>${k(s.jointType.toUpperCase())} JOINT</label><h2>${k(s.name)}</h2><p>${k(s.parentLink)} → ${k(s.childLink)}</p></div>${v}${ct(s, e, i)}<div class="vurdf-section"><div class="vurdf-section-head"><strong>变换与轴</strong><span>m / rad</span></div><dl class="vurdf-data"><dt>关节原点 XYZ</dt><dd>${s.originPosition.map(be).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${s.originRotationRpy.map(be).join(" ")}</dd><dt>Axis xyz</dt><dd>${s.axis.map(be).join(" ")}</dd><dt>Lower</dt><dd>${((n = s.limits) == null ? void 0 : n.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = s.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${s.effort ?? "—"}</dd><dt>Velocity</dt><dd>${s.velocity ?? "—"}</dd></dl></div>${o ? ht(o, !0, r.has(o.id)) : ""}`;
5477
5508
  }
5478
- return s.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${k(s.name)}</h2><p>${s.visualCount} Visual · ${s.collisionCount} Collision</p></div>${dt(s, e, i)}${ut(s, !1, r.has(s.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${k(s.name)}</h2><p>${s.rootLinkIds.length} root link</p></div>`;
5509
+ return s.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${k(s.name)}</h2><p>${s.visualCount} Visual · ${s.collisionCount} Collision</p></div>${ct(s, e, i)}${ht(s, !1, r.has(s.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${k(s.name)}</h2><p>${s.rootLinkIds.length} root link</p></div>`;
5479
5510
  }
5480
5511
  function ke(s) {
5481
5512
  if (s === void 0) return "<span>—</span>";
5482
5513
  const e = String(s), t = Number.isFinite(s) ? String(Number(s.toPrecision(6))) : e;
5483
5514
  return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
5484
5515
  }
5485
- function ct(s, e, t, i) {
5516
+ function ut(s, e, t, i) {
5486
5517
  return `<div class="vurdf-vector"><div class="vurdf-vector-title">${s}<span>${i}</span></div><dl>${e.map((r, n) => `<div><dt>${r}</dt><dd>${ke(t == null ? void 0 : t[n])}</dd></div>`).join("")}</dl></div>`;
5487
5518
  }
5488
- function ut(s, e, t) {
5519
+ function ht(s, e, t) {
5489
5520
  return `<section class="vurdf-section" data-link-inertial>
5490
5521
  <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${k(s.name)}</strong></div>
5491
5522
  <dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${ke(s.mass)}</dd></dl>
5492
5523
  <div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
5493
- ${ct("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5494
- ${ct("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5524
+ ${ut("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5525
+ ${ut("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5495
5526
  <details class="vurdf-inertia-details" data-inertia-details="${k(s.id)}" ${t ? "open" : ""}>
5496
5527
  <summary>${R("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
5497
5528
  <div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
@@ -5502,30 +5533,30 @@ function ut(s, e, t) {
5502
5533
  </details>
5503
5534
  </section>`;
5504
5535
  }
5505
- function Os(s, e) {
5536
+ function _s(s, e) {
5506
5537
  var n, a;
5507
5538
  const t = s.sourceText.split(/\r?\n/), i = ((n = e == null ? void 0 : e.source) == null ? void 0 : n.startLine) ?? 0, r = ((a = e == null ? void 0 : e.source) == null ? void 0 : a.endLine) ?? 0;
5508
- return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= r ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${Vs(o)}</span>`).join("")}</code></pre>`;
5539
+ return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= r ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${Hs(o)}</span>`).join("")}</code></pre>`;
5509
5540
  }
5510
- function zs(s) {
5541
+ function Us(s) {
5511
5542
  return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${k(e.entityId)}">${R("error")}<span><b>${k(e.title)}</b><small>${k(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
5512
5543
  }
5513
5544
  function ge(s, e, t) {
5514
5545
  return `<button class="vurdf-tab ${s === t ? "is-active" : ""}" data-tab="${s}">${e}</button>`;
5515
5546
  }
5516
- function Ns() {
5547
+ function js() {
5517
5548
  return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
5518
5549
  }
5519
5550
  function be(s) {
5520
5551
  return s.toFixed(3);
5521
5552
  }
5522
- function Vs(s) {
5553
+ function Hs(s) {
5523
5554
  return k(s).replace(/(&lt;\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(&quot;.*?&quot;)/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
5524
5555
  }
5525
5556
  function Pe(s, e) {
5526
5557
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5527
5558
  }
5528
- function Fs(s) {
5559
+ function qs(s) {
5529
5560
  const e = new Map(s.nodes.map((o) => [o.id, o])), t = /* @__PURE__ */ new Set(), i = [], r = [];
5530
5561
  let n = 0;
5531
5562
  const a = (o, l) => {
@@ -5544,7 +5575,7 @@ function Fs(s) {
5544
5575
  for (const o of s.nodes) t.has(o.id) || a(o.id, 0);
5545
5576
  return { nodes: i, edges: r, width: Math.max(200, n * 210), height: Math.max(90, ...i.map((o) => o.y + 45)) };
5546
5577
  }
5547
- class $s {
5578
+ class Ys {
5548
5579
  constructor(e, t, i = () => {
5549
5580
  }) {
5550
5581
  u(this, "element", document.createElement("section"));
@@ -5647,13 +5678,13 @@ class $s {
5647
5678
  if (this.snapshot = e, !this.opened) return;
5648
5679
  if (this.modelNodes !== e.nodes) {
5649
5680
  this.modelNodes = e.nodes;
5650
- const i = Fs(e);
5681
+ const i = qs(e);
5651
5682
  this.bounds = i;
5652
5683
  const r = new Map(i.nodes.map((n) => [n.node.id, n]));
5653
5684
  this.graph.innerHTML = i.edges.map((n) => {
5654
5685
  const a = r.get(n.from), o = r.get(n.to), l = a.y + 20, d = o.y - 20, c = (l + d) / 2;
5655
5686
  return `<path class="vurdf-diagram-edge" d="M${a.x} ${l} C${a.x} ${c},${o.x} ${c},${o.x} ${d}"/>`;
5656
- }).join("") + i.nodes.map(({ node: n, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${I(n.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${I(n.name)}"><title>${I(n.name)}</title><rect width="180" height="40" rx="${n.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${I(n.name.length > 26 ? n.name.slice(0, 24) + "…" : n.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${I(n.kind === "joint" ? n.jointType : n.kind)}</text></g>`).join(""), this.fit();
5687
+ }).join("") + i.nodes.map(({ node: n, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${M(n.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${M(n.name)}"><title>${M(n.name)}</title><rect width="180" height="40" rx="${n.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${M(n.name.length > 26 ? n.name.slice(0, 24) + "…" : n.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${M(n.kind === "joint" ? n.jointType : n.kind)}</text></g>`).join(""), this.fit();
5657
5688
  }
5658
5689
  const t = e.mode === "dynamics-running" || e.mode === "dynamics-initializing";
5659
5690
  for (const i of this.graph.querySelectorAll("[data-diagram-node]")) {
@@ -5694,7 +5725,7 @@ class $s {
5694
5725
  this.graph.setAttribute("transform", `translate(${this.x} ${this.y}) scale(${this.scale})`);
5695
5726
  }
5696
5727
  }
5697
- class Bs {
5728
+ class Xs {
5698
5729
  constructor(e, t, i, r, n) {
5699
5730
  u(this, "namesVisible", !1);
5700
5731
  u(this, "element", document.createElement("div"));
@@ -5710,13 +5741,13 @@ class Bs {
5710
5741
  ${se("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
5711
5742
  ${se("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
5712
5743
  <button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${R("names")}名称</button>
5713
- ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? Is(i) : ""}
5744
+ ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? zs(i) : ""}
5714
5745
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5715
- ${ne("ground", ht(this.ctx) ? "隐藏地面" : "显示地面", ht(this.ctx), "ground")}
5746
+ ${ne("ground", pt(this.ctx) ? "隐藏地面" : "显示地面", pt(this.ctx), "ground")}
5716
5747
  ${ne("fit", "适应视图", !1, "fit")}
5717
5748
  ${ne("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
5718
5749
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5719
- ${_s(e, r, n)}
5750
+ ${Ws(e, r, n)}
5720
5751
  ${ne("reset", "重置", !1, "reset")}
5721
5752
  `, this.bind(e);
5722
5753
  }
@@ -5750,50 +5781,50 @@ function ne(s, e, t, i) {
5750
5781
  const r = s === "ground" ? ` aria-pressed="${t}"` : "";
5751
5782
  return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${s}"${r} title="${e}" aria-label="${e}">${R(i)}${s === "reset" ? e : ""}</button>`;
5752
5783
  }
5753
- function _s(s, e, t) {
5784
+ function Ws(s, e, t) {
5754
5785
  const i = s.mode === "dynamics-running", r = i ? "暂停仿真" : s.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
5755
5786
  return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${k(t)}">${R(i ? "pause" : "play")}${r}</button>`;
5756
5787
  }
5757
- function ht(s) {
5788
+ function pt(s) {
5758
5789
  return s.asset.$readControl().groundVisible;
5759
5790
  }
5760
- class Us {
5791
+ class Gs {
5761
5792
  constructor() {
5762
5793
  u(this, "element", document.createElement("footer"));
5763
5794
  this.element.className = "vurdf-status";
5764
5795
  }
5765
5796
  update(e) {
5766
5797
  const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
5767
- this.element.innerHTML = `<span>模型已就绪</span><span title="${k(e.sourcePath)}">${k(e.sourcePath)}</span><span>选择:${t ? k(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && P(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${js(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5798
+ this.element.innerHTML = `<span>模型已就绪</span><span title="${k(e.sourcePath)}">${k(e.sourcePath)}</span><span>选择:${t ? k(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && P(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${Ks(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5768
5799
  }
5769
5800
  dispose() {
5770
5801
  this.element.remove();
5771
5802
  }
5772
5803
  }
5773
- function js(s) {
5804
+ function Ks(s) {
5774
5805
  return s === "kinematic" ? "运动学预览" : s === "dynamics-running" ? "动力学仿真运行中" : s === "dynamics-paused" ? "动力学仿真已暂停" : s === "dynamics-initializing" ? "正在初始化动力学" : "动力学不可用";
5775
5806
  }
5776
- class Hs {
5807
+ class Zs {
5777
5808
  constructor(e, t, i, r, n, a, o) {
5778
5809
  u(this, "diagram");
5779
5810
  u(this, "structure");
5780
5811
  u(this, "inspector");
5781
5812
  u(this, "toolbar");
5782
- u(this, "statusbar", new Us());
5813
+ u(this, "statusbar", new Gs());
5783
5814
  u(this, "gizmo", document.createElement("div"));
5784
5815
  u(this, "disposed", !1);
5785
5816
  u(this, "angleUnit", "rad");
5786
5817
  u(this, "nameLabels", null);
5787
5818
  u(this, "pointerCleanup", null);
5788
5819
  u(this, "resizeCleanup", null);
5789
- this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new Ms(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new Ts(t), this.toolbar = new Bs(t, i, r, (l) => {
5820
+ this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new Ns(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new $s(t), this.toolbar = new Xs(t, i, r, (l) => {
5790
5821
  var d;
5791
5822
  return (d = this.nameLabels) == null ? void 0 : d.setVisible(l);
5792
5823
  }, () => {
5793
5824
  this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
5794
- }), this.diagram = new $s((l) => this.selectFromScene(l), () => {
5825
+ }), this.diagram = new Ys((l) => this.selectFromScene(l), () => {
5795
5826
  this.structure.setDiagramOpen(!1), this.structure.focusDiagramButton();
5796
- }, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new ws(e, a, o, t)), a && (this.pointerCleanup = Es(a, t, () => this.inspector.stopSweep(!1), o));
5827
+ }, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new Ms(e, a, o, t)), a && (this.pointerCleanup = Ls(a, t, () => this.inspector.stopSweep(!1), o));
5797
5828
  }
5798
5829
  render(e) {
5799
5830
  this.disposed || !e || (this.root.dataset.theme = this.theme, this.structure.update(e, this.angleUnit), this.inspector.update(e, this.angleUnit), this.toolbar.update(e, this.theme, this.angleUnit), this.statusbar.update(e), this.diagram.update(e), this.updateGizmo());
@@ -5803,7 +5834,7 @@ class Hs {
5803
5834
  }
5804
5835
  updateGizmo() {
5805
5836
  var e;
5806
- this.gizmo.innerHTML = Cs(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Zt());
5837
+ this.gizmo.innerHTML = Is(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Zt());
5807
5838
  }
5808
5839
  setTheme(e) {
5809
5840
  this.theme !== e && (this.theme = e, this.render(this.inspection.getSnapshot()));
@@ -5841,7 +5872,7 @@ class Hs {
5841
5872
  });
5842
5873
  }
5843
5874
  }
5844
- const qs = `
5875
+ const Js = `
5845
5876
  .vurdf-shell{--vurdf-accent:#55d6b3;--vurdf-accent-strong:#72e5c6;--vurdf-accent-soft:rgba(85,214,179,.12);--vurdf-bg:#080d0f;--vurdf-panel:#0e1416;--vurdf-panel-raised:#141b1d;--vurdf-border:#283235;--vurdf-text:#e7ecea;--vurdf-muted:#75817f;--vurdf-hover:#1b2426;position:absolute;inset:0;pointer-events:none;color:var(--vurdf-text);font:12px/1.4 'Segoe UI','Microsoft YaHei UI',system-ui,sans-serif}.vurdf-shell[data-theme=light]{--vurdf-accent:#168c70;--vurdf-accent-strong:#08755d;--vurdf-accent-soft:rgba(22,140,112,.13);--vurdf-bg:#eef3f1;--vurdf-panel:#f8faf9;--vurdf-panel-raised:#eef3f1;--vurdf-border:#cfd9d6;--vurdf-text:#1f2927;--vurdf-muted:#687572;--vurdf-hover:#e5ece9}.vurdf-shell *{box-sizing:border-box}.vurdf-shell svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
5846
5877
  .vurdf-side{position:absolute;top:0;bottom:27px;width:270px;background:var(--vurdf-panel);pointer-events:auto;z-index:7;display:flex;flex-direction:column;min-height:0}.vurdf-left{left:0;border-right:1px solid var(--vurdf-border)}.vurdf-right{right:0;width:320px;border-left:1px solid var(--vurdf-border)}.vurdf-head{height:52px;flex:0 0 52px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;border-bottom:1px solid var(--vurdf-border)}.vurdf-head strong{font-size:12px}.vurdf-head span{display:block;color:var(--vurdf-muted);font-size:9px}
5847
5878
  .vurdf-search{height:31px;margin:9px;border:1px solid var(--vurdf-border);border-radius:5px;background:var(--vurdf-panel-raised);display:flex;align-items:center;gap:7px;padding:0 8px}.vurdf-search:focus-within{border-color:var(--vurdf-accent)}.vurdf-search svg{width:14px;color:var(--vurdf-muted)}.vurdf-search input{appearance:none;box-shadow:none!important;min-width:0;flex:1;border:0!important;outline:0!important;background:transparent;color:var(--vurdf-text);font:11px inherit}.vurdf-filters{display:flex;gap:5px;padding:0 9px 8px;border-bottom:1px solid var(--vurdf-border)}.vurdf-chip{height:23px;border:1px solid var(--vurdf-border);border-radius:5px;background:transparent;color:var(--vurdf-muted);font-size:9px;padding:0 7px;cursor:pointer}.vurdf-chip.is-active{color:var(--vurdf-text);background:var(--vurdf-panel-raised)}
@@ -5966,17 +5997,17 @@ const qs = `
5966
5997
 
5967
5998
  .vurdf-diagram button:focus-visible{outline:2px solid var(--vurdf-accent)}
5968
5999
  @media(max-width:600px){.vurdf-diagram{width:calc(100% - 16px);height:calc(100% - 60px)}}
5969
- `, Ys = "urdf";
5970
- function Xs(s) {
6000
+ `, Qs = "urdf";
6001
+ function en(s) {
5971
6002
  let e = null, t = null, i = null, r = null, n = null, a = null;
5972
6003
  const o = [];
5973
6004
  return {
5974
6005
  id: "nebula.ui.urdf",
5975
6006
  activate(l) {
5976
6007
  var p;
5977
- t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = qs, (p = s.shadowRoot()) == null || p.append(t);
6008
+ t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = Js, (p = s.shadowRoot()) == null || p.append(t);
5978
6009
  const d = document.createElement("div");
5979
- d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: Ys });
6010
+ d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: Qs });
5980
6011
  const c = () => {
5981
6012
  var f;
5982
6013
  const h = l.asset.$inspection();
@@ -5988,7 +6019,7 @@ function Xs(s) {
5988
6019
  d.hidden = !0;
5989
6020
  return;
5990
6021
  }
5991
- d.hidden = !1, i = new Hs(d, h, l, s.theme(), s.cameraQuaternion, (f = s.interactionCanvas) == null ? void 0 : f.call(s), s.interactionCamera), r = h.subscribe((v) => i == null ? void 0 : i.render(v)), i.render(h.getSnapshot());
6022
+ d.hidden = !1, i = new Zs(d, h, l, s.theme(), s.cameraQuaternion, (f = s.interactionCanvas) == null ? void 0 : f.call(s), s.interactionCamera), r = h.subscribe((v) => i == null ? void 0 : i.render(v)), i.render(h.getSnapshot());
5992
6023
  };
5993
6024
  n = s.onThemeChange((h) => i == null ? void 0 : i.setTheme(h)), o.push(
5994
6025
  l.events.on("asset-change", c),
@@ -6000,11 +6031,11 @@ function Xs(s) {
6000
6031
  l.events.on("pick", (h) => {
6001
6032
  var v;
6002
6033
  const f = l.asset.$inspection();
6003
- (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(pt(f, ((v = h.result) == null ? void 0 : v.object) ?? null)));
6034
+ (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ft(f, ((v = h.result) == null ? void 0 : v.object) ?? null)));
6004
6035
  }),
6005
6036
  l.events.on("selection-change", (h) => {
6006
6037
  const f = l.asset.$inspection();
6007
- (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(pt(f, h.object)));
6038
+ (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ft(f, h.object)));
6008
6039
  })
6009
6040
  ), c();
6010
6041
  },
@@ -6014,7 +6045,7 @@ function Xs(s) {
6014
6045
  }
6015
6046
  };
6016
6047
  }
6017
- function Ws(s) {
6048
+ function tn(s) {
6018
6049
  let e = s;
6019
6050
  for (; e; ) {
6020
6051
  if (typeof e.userData.urdfEntityId == "string") return e.userData.urdfEntityId;
@@ -6022,12 +6053,12 @@ function Ws(s) {
6022
6053
  }
6023
6054
  return null;
6024
6055
  }
6025
- function pt(s, e) {
6056
+ function ft(s, e) {
6026
6057
  var n;
6027
- const t = Ws(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6058
+ const t = tn(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6028
6059
  return r ? ((n = i.nodes.find((a) => a.kind === "joint" && a.childLink === r.name)) == null ? void 0 : n.id) ?? t : t;
6029
6060
  }
6030
- class Gs {
6061
+ class rn {
6031
6062
  constructor(e, t, i, r, n, a, o, l = null, d = () => null) {
6032
6063
  u(this, "pluginsById", /* @__PURE__ */ new Map());
6033
6064
  u(this, "contributions", []);
@@ -6235,7 +6266,7 @@ class Gs {
6235
6266
  n.dataset.viewerContribution = "toolbar", n.dataset.viewerContributionId = t.id;
6236
6267
  for (const a of t.items) {
6237
6268
  const o = document.createElement("button");
6238
- o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", Ks(a.icon)), o.title = a.title ?? a.label, o.setAttribute("aria-label", a.title ?? a.label)) : (o.textContent = a.label, a.title && (o.title = a.title)), o.disabled = a.disabled === !0, a.pressed !== void 0 && (o.setAttribute("aria-pressed", String(a.pressed)), o.classList.toggle("is-active", a.pressed)), o.addEventListener("click", a.onClick), n.append(o);
6269
+ o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", sn(a.icon)), o.title = a.title ?? a.label, o.setAttribute("aria-label", a.title ?? a.label)) : (o.textContent = a.label, a.title && (o.title = a.title)), o.disabled = a.disabled === !0, a.pressed !== void 0 && (o.setAttribute("aria-pressed", String(a.pressed)), o.classList.toggle("is-active", a.pressed)), o.addEventListener("click", a.onClick), n.append(o);
6239
6270
  }
6240
6271
  this.hostElement.append(n), e.cleanup = () => n.remove();
6241
6272
  return;
@@ -6294,12 +6325,12 @@ class Gs {
6294
6325
  if (this.disposed) throw new Error("Viewer plugin manager has been disposed.");
6295
6326
  }
6296
6327
  }
6297
- function Ks(s) {
6328
+ function sn(s) {
6298
6329
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s}</svg>`;
6299
6330
  }
6300
- function Zs(s, e, t) {
6331
+ function nn(s, e, t) {
6301
6332
  var p;
6302
- const i = en(s), r = Qs([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || rn(s), a = Ae(s) ? nn(s.files, s.entry, n) : n, o = Ft(s), l = e.baseUrl ?? sn(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [F(h.path), h])) : null;
6333
+ const i = ln(s), r = on([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || cn(s), a = Ae(s) ? hn(s.files, s.entry, n) : n, o = Vt(s), l = e.baseUrl ?? un(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [V(h.path), h])) : null;
6303
6334
  return Object.freeze({
6304
6335
  original: s,
6305
6336
  entryPath: a,
@@ -6309,19 +6340,19 @@ function Zs(s, e, t) {
6309
6340
  baseUrl: l,
6310
6341
  hasResourceResolver: !!e.resourceResolver,
6311
6342
  async resolve(h) {
6312
- ft(r);
6313
- const f = F(h), v = tn(s);
6314
- if (v && (!f || f === F(a ?? ""))) {
6343
+ mt(r);
6344
+ const f = V(h), v = dn(s);
6345
+ if (v && (!f || f === V(a ?? ""))) {
6315
6346
  const b = URL.createObjectURL(v);
6316
6347
  return d.add(b), b;
6317
6348
  }
6318
- const y = (c == null ? void 0 : c.get(f)) ?? an(c, a, f);
6349
+ const y = (c == null ? void 0 : c.get(f)) ?? pn(c, a, f);
6319
6350
  if (y) {
6320
6351
  const b = URL.createObjectURL(y.file);
6321
6352
  return d.add(b), b;
6322
6353
  }
6323
- const m = await on(e.resourceResolver, h, r);
6324
- if (ft(r), m instanceof Blob) {
6354
+ const m = await fn(e.resourceResolver, h, r);
6355
+ if (mt(r), m instanceof Blob) {
6325
6356
  const b = URL.createObjectURL(m);
6326
6357
  return d.add(b), b;
6327
6358
  }
@@ -6333,7 +6364,7 @@ function Zs(s, e, t) {
6333
6364
  }
6334
6365
  });
6335
6366
  }
6336
- function Js(s) {
6367
+ function an(s) {
6337
6368
  var r;
6338
6369
  const e = s.entryPath ?? s.url;
6339
6370
  if (!e) return null;
@@ -6350,7 +6381,7 @@ function Js(s) {
6350
6381
  const i = /\.([a-z0-9]+)$/i.exec(t);
6351
6382
  return ((r = i == null ? void 0 : i[1]) == null ? void 0 : r.toLowerCase()) ?? null;
6352
6383
  }
6353
- function Qs(s) {
6384
+ function on(s) {
6354
6385
  const e = s.filter((r) => !!r);
6355
6386
  if (e.length === 0) return new AbortController().signal;
6356
6387
  if (e.length === 1) return e[0];
@@ -6365,22 +6396,22 @@ function Qs(s) {
6365
6396
  }
6366
6397
  return t.signal;
6367
6398
  }
6368
- function ft(s) {
6399
+ function mt(s) {
6369
6400
  if (s.aborted)
6370
6401
  throw typeof s.throwIfAborted == "function" && s.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
6371
6402
  }
6372
- function en(s) {
6403
+ function ln(s) {
6373
6404
  return typeof s == "object" && s !== null && "signal" in s ? s.signal : void 0;
6374
6405
  }
6375
- function Ft(s) {
6406
+ function Vt(s) {
6376
6407
  return typeof s == "string" ? s : typeof URL < "u" && s instanceof URL ? s.href : typeof s == "object" && s !== null && "kind" in s && s.kind === "url" ? s.url : null;
6377
6408
  }
6378
- function tn(s) {
6409
+ function dn(s) {
6379
6410
  return typeof Blob < "u" && s instanceof Blob ? s : s instanceof ArrayBuffer ? new Blob([s]) : typeof s == "object" && s !== null && "kind" in s && s.kind === "buffer" ? new Blob([s.buffer]) : null;
6380
6411
  }
6381
- function rn(s) {
6412
+ function cn(s) {
6382
6413
  var t;
6383
- const e = Ft(s);
6414
+ const e = Vt(s);
6384
6415
  if (e)
6385
6416
  try {
6386
6417
  return decodeURIComponent(new URL(e, "https://viewer.invalid/").pathname.split("/").pop() || "") || null;
@@ -6389,7 +6420,7 @@ function rn(s) {
6389
6420
  }
6390
6421
  return Ae(s) ? s.entry ?? null : typeof File < "u" && s instanceof File && s.name || null;
6391
6422
  }
6392
- function sn(s) {
6423
+ function un(s) {
6393
6424
  var e;
6394
6425
  if (!s) return null;
6395
6426
  try {
@@ -6401,38 +6432,38 @@ function sn(s) {
6401
6432
  function Ae(s) {
6402
6433
  return typeof s == "object" && s !== null && "kind" in s && s.kind === "files";
6403
6434
  }
6404
- function nn(s, e, t) {
6435
+ function hn(s, e, t) {
6405
6436
  if (e) {
6406
- const i = F(e);
6407
- if (!s.some((r) => F(r.path) === i))
6408
- throw mt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6437
+ const i = V(e);
6438
+ if (!s.some((r) => V(r.path) === i))
6439
+ throw vt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6409
6440
  return i;
6410
6441
  }
6411
6442
  if (t) {
6412
- const i = F(t);
6413
- if (s.filter((n) => F(n.path) === i).length === 1) return i;
6443
+ const i = V(t);
6444
+ if (s.filter((n) => V(n.path) === i).length === 1) return i;
6414
6445
  }
6415
- if (s.length === 1) return F(s[0].path);
6416
- throw mt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6446
+ if (s.length === 1) return V(s[0].path);
6447
+ throw vt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6417
6448
  }
6418
- function an(s, e, t) {
6449
+ function pn(s, e, t) {
6419
6450
  if (!s || !e) return;
6420
6451
  const i = e.lastIndexOf("/"), r = i < 0 ? "" : e.slice(0, i + 1);
6421
- return s.get(F(`${r}${t}`));
6452
+ return s.get(V(`${r}${t}`));
6422
6453
  }
6423
- function F(s) {
6454
+ function V(s) {
6424
6455
  const e = [];
6425
6456
  for (const t of s.replaceAll("\\", "/").split("/"))
6426
6457
  !t || t === "." || (t === ".." ? e.pop() : e.push(t));
6427
6458
  return e.join("/");
6428
6459
  }
6429
- async function on(s, e, t) {
6460
+ async function fn(s, e, t) {
6430
6461
  return s ? s.resolve(e, { signal: t }) : null;
6431
6462
  }
6432
- function mt(s, e) {
6463
+ function vt(s, e) {
6433
6464
  return Object.assign(new Error(s), { code: e });
6434
6465
  }
6435
- const vt = Object.freeze({
6466
+ const gt = Object.freeze({
6436
6467
  canPlay: !1,
6437
6468
  canPause: !1,
6438
6469
  canReset: !1,
@@ -6442,8 +6473,8 @@ const vt = Object.freeze({
6442
6473
  }), q = Object.freeze({
6443
6474
  light: 15265002,
6444
6475
  dark: 593167
6445
- }), ln = 0.05;
6446
- class dn {
6476
+ }), mn = 0.05;
6477
+ class vn {
6447
6478
  constructor(e) {
6448
6479
  u(this, "epoch", 0);
6449
6480
  u(this, "active", null);
@@ -6574,7 +6605,7 @@ class dn {
6574
6605
  var r;
6575
6606
  const t = this.active;
6576
6607
  if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.playing || !((r = t.session) != null && r.update)) return !1;
6577
- const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, ln));
6608
+ const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, mn));
6578
6609
  t.resetFrameClock = !1;
6579
6610
  try {
6580
6611
  return !!(t.session.update(i) && this.current(t) && t.snapshot.phase === "ready" && t.playing);
@@ -6589,7 +6620,7 @@ class dn {
6589
6620
  var i, r;
6590
6621
  try {
6591
6622
  if (!this.current(e)) return;
6592
- e.source = Zs(t, e.options, e.abort.signal);
6623
+ e.source = nn(t, e.options, e.abort.signal);
6593
6624
  const n = e.source.signal, a = () => {
6594
6625
  this.stop(e, "E_ABORTED");
6595
6626
  };
@@ -6597,7 +6628,7 @@ class dn {
6597
6628
  a();
6598
6629
  return;
6599
6630
  }
6600
- const o = this.detect(e), l = gt(o) ? await o : o;
6631
+ const o = this.detect(e), l = bt(o) ? await o : o;
6601
6632
  if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
6602
6633
  if (!this.host.loaders().includes(l.loader))
6603
6634
  throw T("Asset loader was removed.", "E_ABORTED");
@@ -6628,7 +6659,7 @@ class dn {
6628
6659
  if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
6629
6660
  const v = e.session;
6630
6661
  v.isPlaying && (e.playing = v.isPlaying()), ((y = v.physics) == null ? void 0 : y.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
6631
- capabilities: v.capabilities ?? vt,
6662
+ capabilities: v.capabilities ?? gt,
6632
6663
  physics: v.physics ?? null,
6633
6664
  warning: v.warning ?? null
6634
6665
  }), this.publishControl(e), this.host.requestRender();
@@ -6636,7 +6667,7 @@ class dn {
6636
6667
  reportProgress: (v, y) => {
6637
6668
  this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: v, message: y });
6638
6669
  }
6639
- }, h = l.loader.createSession(e.source, p), f = gt(h) ? await h : h;
6670
+ }, h = l.loader.createSession(e.source, p), f = bt(h) ? await h : h;
6640
6671
  if (e.session && e.session !== f) {
6641
6672
  f.beginDispose(), await f.dispose();
6642
6673
  return;
@@ -6658,7 +6689,7 @@ class dn {
6658
6689
  if (!this.current(e)) return;
6659
6690
  e.dynamic = typeof f.update == "function", e.playing = e.dynamic && f.autoPlay !== !1, e.resetFrameClock = e.playing, this.transition(e, {
6660
6691
  phase: "ready",
6661
- capabilities: f.capabilities ?? vt,
6692
+ capabilities: f.capabilities ?? gt,
6662
6693
  warning: f.warning ?? null,
6663
6694
  physics: f.physics ?? null
6664
6695
  }), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
@@ -6669,7 +6700,7 @@ class dn {
6669
6700
  }
6670
6701
  }
6671
6702
  detect(e) {
6672
- const t = e.source, i = this.host.loaders(), r = e.options.format, n = Js(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6703
+ const t = e.source, i = this.host.loaders(), r = e.options.format, n = an(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6673
6704
  if (a) {
6674
6705
  const o = i.find((l) => l.formats.includes(a));
6675
6706
  if (o) return { loader: o, format: a };
@@ -6969,10 +7000,10 @@ function ye() {
6969
7000
  function T(s, e) {
6970
7001
  return Object.assign(new Error(s), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
6971
7002
  }
6972
- function gt(s) {
7003
+ function bt(s) {
6973
7004
  return !!(s && typeof s.then == "function");
6974
7005
  }
6975
- const cn = {
7006
+ const gn = {
6976
7007
  id: "nebula-asset-model",
6977
7008
  activate(s) {
6978
7009
  s.contribute({
@@ -6990,13 +7021,13 @@ const cn = {
6990
7021
  clearColor: q.dark
6991
7022
  },
6992
7023
  async createSession(e, t) {
6993
- const { createModelSession: i } = await import("./session-di9BueA_.js");
7024
+ const { createModelSession: i } = await import("./session-CVL_PXO4.js");
6994
7025
  return i(e, t);
6995
7026
  }
6996
7027
  });
6997
7028
  }
6998
7029
  };
6999
- function un(s, e, t) {
7030
+ function bn(s, e, t) {
7000
7031
  let i = !1, r = !1;
7001
7032
  const n = {
7002
7033
  ...t.options.cad,
@@ -7025,7 +7056,7 @@ function un(s, e, t) {
7025
7056
  }
7026
7057
  };
7027
7058
  }
7028
- function hn(s) {
7059
+ function yn(s) {
7029
7060
  return {
7030
7061
  id: "nebula-asset-cad",
7031
7062
  activate(e) {
@@ -7040,24 +7071,24 @@ function hn(s) {
7040
7071
  uiProfile: "cad",
7041
7072
  fitPolicy: "restore-then-fit"
7042
7073
  },
7043
- createSession: (t, i) => un(s, t, i)
7074
+ createSession: (t, i) => bn(s, t, i)
7044
7075
  });
7045
7076
  }
7046
7077
  };
7047
7078
  }
7048
- function pn(s) {
7079
+ function xn(s) {
7049
7080
  const e = s.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
7050
7081
  return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
7051
7082
  }
7052
- async function fn(s) {
7083
+ async function wn(s) {
7053
7084
  const e = s.entryPath ?? s.filename ?? s.url ?? "";
7054
7085
  if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
7055
7086
  const t = await s.resolve(e), i = await fetch(t, { signal: s.signal });
7056
7087
  if (!i.ok) return null;
7057
- const r = pn(await i.text());
7088
+ const r = xn(await i.text());
7058
7089
  return r ? { format: r } : null;
7059
7090
  }
7060
- const mn = {
7091
+ const Cn = {
7061
7092
  id: "nebula-asset-simulation",
7062
7093
  activate(s) {
7063
7094
  s.contribute({
@@ -7065,7 +7096,7 @@ const mn = {
7065
7096
  id: "nebula.simulation-loader",
7066
7097
  assetKind: "simulation",
7067
7098
  formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
7068
- match: fn,
7099
+ match: wn,
7069
7100
  presentation: {
7070
7101
  preferredViewMode: "3d",
7071
7102
  interactionMode: "simulation",
@@ -7074,12 +7105,12 @@ const mn = {
7074
7105
  clearColor: q.dark
7075
7106
  },
7076
7107
  async createSession(e, t) {
7077
- const { createSimulationSession: i } = await import("./session-DHPMjyl3.js").then((r) => r.f);
7108
+ const { createSimulationSession: i } = await import("./session-2sDMfyTY.js").then((r) => r.f);
7078
7109
  return i(e, t);
7079
7110
  }
7080
7111
  });
7081
7112
  }
7082
- }, ae = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", bt = {
7113
+ }, ae = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", yt = {
7083
7114
  dark: {
7084
7115
  hover: { color: 3528703, fillOpacity: 0, edgeOpacity: 0.85 },
7085
7116
  selected: { color: 5999871, fillOpacity: 0.24, edgeOpacity: 1 }
@@ -7088,8 +7119,8 @@ const mn = {
7088
7119
  hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
7089
7120
  selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
7090
7121
  }
7091
- }, vn = 6, gn = 12, bn = 160, yn = 160, xn = 50, yt = 592655;
7092
- class wn {
7122
+ }, Sn = 6, En = 12, kn = 160, Pn = 160, An = 50, xt = 592655;
7123
+ class Mn {
7093
7124
  constructor(e, t) {
7094
7125
  u(this, "cad");
7095
7126
  u(this, "mountedObjects", /* @__PURE__ */ new Set());
@@ -7105,9 +7136,9 @@ class wn {
7105
7136
  u(this, "interactionRenderLastTs", null);
7106
7137
  u(this, "cadHoveredInsert", null);
7107
7138
  u(this, "cadPointerPosition", null);
7108
- u(this, "pointerDragTracker", new Ir({
7109
- distancePx: vn,
7110
- pathPx: gn
7139
+ u(this, "pointerDragTracker", new zr({
7140
+ distancePx: Sn,
7141
+ pathPx: En
7111
7142
  }));
7112
7143
  u(this, "cadCapability");
7113
7144
  u(this, "cadHost");
@@ -7233,7 +7264,7 @@ class wn {
7233
7264
  this.pointerStart = null, this.cadPointerPosition = null, this.pointerDragTracker.reset(), this.setCadHoveredInsert(null), this.interactionMode !== "disabled" && this.pluginManager.dispatchInteraction("onHover", null), this.scheduleInteractionIdle(), !this.disposed && this.emit("pointer-leave", this.toPointerEvent(e));
7234
7265
  });
7235
7266
  var i, r, n, a, o, l, d, c, p, h, f, v, y, m, b;
7236
- this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? dr(), this.interactionMode = e.cadInteraction ?? "managed", e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Cr(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7267
+ this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? hr(), this.interactionMode = e.cadInteraction ?? "managed", e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Ir(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7237
7268
  this.assertActive();
7238
7269
  const { filename: w, signal: C, ...D } = x;
7239
7270
  await this.assetController.open(g, { format: "cad", filename: w, signal: C, cad: D }, !0).ready;
@@ -7242,7 +7273,7 @@ class wn {
7242
7273
  return A;
7243
7274
  }, this.cadCapability.close = () => {
7244
7275
  this.assertActive(), this.assetController.closeKind("cad");
7245
- }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Gs(
7276
+ }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new rn(
7246
7277
  () => this.cadCapability.getSnapshot(),
7247
7278
  () => ({
7248
7279
  viewMode: this.runtime.viewMode,
@@ -7276,7 +7307,7 @@ class wn {
7276
7307
  e.viewport,
7277
7308
  this.layoutEngine,
7278
7309
  () => this.assetController.getActiveInspection()
7279
- ), this.assetController = new dn({
7310
+ ), this.assetController = new vn({
7280
7311
  loaders: () => this.pluginManager.getAssetLoaders(),
7281
7312
  mount: (g) => this.mountAssetObject(g),
7282
7313
  detach: (g) => this.unmountAssetObject(g),
@@ -7289,14 +7320,14 @@ class wn {
7289
7320
  cleanupError: (g) => {
7290
7321
  this.options.onCleanupError ? this.options.onCleanupError(g) : console.error("[viewer] asset cleanup failed", g);
7291
7322
  }
7292
- }), this.pluginManager.registerBuiltin(hn(this.cadCapability)), this.pluginManager.registerBuiltin(cn), this.pluginManager.registerBuiltin(mn), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7323
+ }), this.pluginManager.registerBuiltin(yn(this.cadCapability)), this.pluginManager.registerBuiltin(gn), this.pluginManager.registerBuiltin(Cn), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7293
7324
  this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
7294
7325
  }), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
7295
7326
  this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
7296
7327
  }), this.assetChangeUnsubscribe = this.on("asset-change", (g) => {
7297
7328
  const x = g.snapshot.phase;
7298
7329
  (x === "closing" || x === "failed" || x === "closed") && this.endAssetGrab();
7299
- }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(xs(
7330
+ }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(As(
7300
7331
  {
7301
7332
  mountBuiltin: (g, x) => this.layoutEngine.mountBuiltin(g, x),
7302
7333
  shadowRoot: () => this.builtinUiShadow(),
@@ -7308,7 +7339,7 @@ class wn {
7308
7339
  label: (g) => g === "simulation" ? "仿真控制" : "模型控制",
7309
7340
  scene: e.ui.scene
7310
7341
  }
7311
- )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Xs({
7342
+ )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(en({
7312
7343
  interactionCanvas: () => this.options.canvas,
7313
7344
  interactionCamera: () => this.runtime.getActiveCamera(),
7314
7345
  cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
@@ -7319,13 +7350,13 @@ class wn {
7319
7350
  })), this.interactionMode === "managed" && this.pluginManager.register({
7320
7351
  id: "nebula.ui.cad",
7321
7352
  activate: () => {
7322
- this.ui = new ns(this.createUiHost(), e.ui), this.ui.mount();
7353
+ this.ui = new hs(this.createUiHost(), e.ui), this.ui.mount();
7323
7354
  },
7324
7355
  deactivate: () => {
7325
7356
  var g;
7326
7357
  (g = this.ui) == null || g.dispose(), this.ui = null;
7327
7358
  }
7328
- })), (n = (r = this.options.canvas).addEventListener) == null || n.call(r, "pointerdown", this.handlePointerDown), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointermove", this.handlePointerMove), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointerup", this.handlePointerUp), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointercancel", this.handlePointerCancel), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointerleave", this.handlePointerLeave), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "lostpointercapture", this.handleLostPointerCapture), (b = (m = this.options.canvas).addEventListener) == null || b.call(m, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && Pn(this.options.viewport) ? (this.viewportResizeObserver = new ResizeObserver(() => this.handleViewportResize()), this.viewportResizeObserver.observe(this.options.viewport)) : (this.viewportResizeObserver = null, typeof globalThis.window < "u" && (this.usingWindowResizeFallback = !0, globalThis.window.addEventListener("resize", this.handleViewportResize))), this.runtime.startAnimation({
7359
+ })), (n = (r = this.options.canvas).addEventListener) == null || n.call(r, "pointerdown", this.handlePointerDown), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointermove", this.handlePointerMove), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointerup", this.handlePointerUp), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointercancel", this.handlePointerCancel), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointerleave", this.handlePointerLeave), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "lostpointercapture", this.handleLostPointerCapture), (b = (m = this.options.canvas).addEventListener) == null || b.call(m, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && Dn(this.options.viewport) ? (this.viewportResizeObserver = new ResizeObserver(() => this.handleViewportResize()), this.viewportResizeObserver.observe(this.options.viewport)) : (this.viewportResizeObserver = null, typeof globalThis.window < "u" && (this.usingWindowResizeFallback = !0, globalThis.window.addEventListener("resize", this.handleViewportResize))), this.runtime.startAnimation({
7329
7360
  renderExtension: { beforeRender: (g, x, w) => this.assetController.beforeRender(g, x, w) },
7330
7361
  onFrame: (g, x) => {
7331
7362
  this.assetController.update(x) && this.runtime.requestRender();
@@ -7423,7 +7454,7 @@ class wn {
7423
7454
  this.assertActive(), e !== this.runtime.viewMode && (t ? this.runtime.setViewMode(e, t) : this.runtime.setViewMode(e), this.emit("view-mode-change", { viewMode: e }), this.pendingCameraReason = "view-mode", this.cadCapability.onCameraChanged("view-mode"), this.refreshCadPointerHover());
7424
7455
  }
7425
7456
  fitView(e, t) {
7426
- this.assertActive(), e && !(e instanceof V) && this.assertMounted(e);
7457
+ this.assertActive(), e && !(e instanceof F) && this.assertMounted(e);
7427
7458
  const i = e ?? this.assetController.getActiveFitBounds() ?? this.pluginManager.findFitPolicy() ?? this.resolveMixedBounds();
7428
7459
  if (!i) return !1;
7429
7460
  const r = this.runtime.fitView(i, t);
@@ -7511,7 +7542,7 @@ class wn {
7511
7542
  createLayoutEngine() {
7512
7543
  var r;
7513
7544
  const e = this, t = this.options, i = (r = t.ui) == null ? void 0 : r.insetTarget;
7514
- return new ds({
7545
+ return new vs({
7515
7546
  reference: () => {
7516
7547
  var n;
7517
7548
  return ((n = t.ui) == null ? void 0 : n.root) ?? t.viewport;
@@ -7555,7 +7586,7 @@ class wn {
7555
7586
  */
7556
7587
  resetAssetPresentation() {
7557
7588
  var e;
7558
- this.runtime.setClearColor(this.options.clearColor ?? yt), this.runtime.setNavigationPolicy("viewer"), this.interactionMode = this.options.cadInteraction ?? "managed", (e = this.ui) == null || e.setActive(!1), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
7589
+ this.runtime.setClearColor(this.options.clearColor ?? xt), this.runtime.setNavigationPolicy("viewer"), this.interactionMode = this.options.cadInteraction ?? "managed", (e = this.ui) == null || e.setActive(!1), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
7559
7590
  }
7560
7591
  createCadHost() {
7561
7592
  const e = this;
@@ -7576,7 +7607,7 @@ class wn {
7576
7607
  return e.cadCapability.getVisibilityRevision();
7577
7608
  },
7578
7609
  get viewportDemandCoalesceMs() {
7579
- return e.options.viewportDemandCoalesceMs ?? yn;
7610
+ return e.options.viewportDemandCoalesceMs ?? Pn;
7580
7611
  },
7581
7612
  mountCadObject(t) {
7582
7613
  e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
@@ -7615,10 +7646,10 @@ class wn {
7615
7646
  return ((n = e.runtime.screenToWorldOnPlane(t, i, r)) == null ? void 0 : n.clone()) ?? null;
7616
7647
  },
7617
7648
  readCameraSnapshot(t) {
7618
- return ur(e.cameraStateStore, t);
7649
+ return fr(e.cameraStateStore, t);
7619
7650
  },
7620
7651
  persistCameraSnapshot(t, i) {
7621
- hr(e.cameraStateStore, t, i);
7652
+ mr(e.cameraStateStore, t, i);
7622
7653
  },
7623
7654
  getViewportSize() {
7624
7655
  return {
@@ -7639,10 +7670,10 @@ class wn {
7639
7670
  e.details.bbox.minY,
7640
7671
  e.details.bbox.maxX,
7641
7672
  e.details.bbox.maxY
7642
- ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new V(
7673
+ ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new F(
7643
7674
  new E(t.minX, t.minY, -0.01),
7644
7675
  new E(t.maxX, t.maxY, 0.01)
7645
- ) : e.textDetails ? new V(
7676
+ ) : e.textDetails ? new F(
7646
7677
  new E(e.textDetails.x, e.textDetails.y, -0.01),
7647
7678
  new E(
7648
7679
  e.textDetails.x + e.textDetails.content.length * e.textDetails.height * 0.6,
@@ -7653,7 +7684,7 @@ class wn {
7653
7684
  if (!i || i.isEmpty()) return;
7654
7685
  const r = !!((o = e.details) != null && o.bbox);
7655
7686
  if (((d = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : d.enabled) === !1) return;
7656
- const n = r ? this.createCadInteractionOverlay(i, "selected") : new Qt(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? bt.dark.selected.color);
7687
+ const n = r ? this.createCadInteractionOverlay(i, "selected") : new Qt(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? yt.dark.selected.color);
7657
7688
  n.name = U, this.runtime.mountOverlay(U, n, { owned: !0 });
7658
7689
  }
7659
7690
  dispatchCadSelectionChange() {
@@ -7672,11 +7703,11 @@ class wn {
7672
7703
  }
7673
7704
  createCadInteractionOverlay(e, t) {
7674
7705
  var h, f;
7675
- const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", r = bt[i][t], n = (f = this.options.cadInteractionStyle) == null ? void 0 : f[t], a = {
7706
+ const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", r = yt[i][t], n = (f = this.options.cadInteractionStyle) == null ? void 0 : f[t], a = {
7676
7707
  color: (n == null ? void 0 : n.color) ?? r.color,
7677
7708
  fillOpacity: (n == null ? void 0 : n.fillOpacity) ?? r.fillOpacity,
7678
7709
  edgeOpacity: (n == null ? void 0 : n.edgeOpacity) ?? r.edgeOpacity
7679
- }, o = new Ct();
7710
+ }, o = new St();
7680
7711
  o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
7681
7712
  const l = e.getSize(new E()), d = e.getCenter(new E()), c = new ei(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
7682
7713
  if (a.fillOpacity > 0) {
@@ -7706,7 +7737,7 @@ class wn {
7706
7737
  }
7707
7738
  cadInsertDetailsToBox(e) {
7708
7739
  const t = e == null ? void 0 : e.bbox;
7709
- return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new V(
7740
+ return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new F(
7710
7741
  new E(t.minX, t.minY, -0.01),
7711
7742
  new E(t.maxX, t.maxY, 0.01)
7712
7743
  );
@@ -7796,14 +7827,14 @@ class wn {
7796
7827
  this.resetAssetPresentation();
7797
7828
  return;
7798
7829
  }
7799
- this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? yt), this.runtime.setNavigationPolicy(
7830
+ this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? xt), this.runtime.setNavigationPolicy(
7800
7831
  e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
7801
- ), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(Sn(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
7832
+ ), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(Rn(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
7802
7833
  }
7803
7834
  resolveMixedBounds() {
7804
7835
  const e = this.assetController.getActiveFitBounds();
7805
7836
  if (e) return e;
7806
- const t = new V();
7837
+ const t = new F();
7807
7838
  let i = !1;
7808
7839
  for (const n of [...this.mountedObjects, ...this.mountedAssetObjects])
7809
7840
  n.visible && (t.expandByObject(n), i = !0);
@@ -7814,9 +7845,9 @@ class wn {
7814
7845
  this.interaction !== e && (this.interaction = e, this.interactionRenderLastTs = null, this.emit("interaction-change", { interaction: e }), this.emitViewportChange(), this.cadCapability.onInteractionChanged(), e === "idle" && (this.pendingCameraReason = "api"), e === "idle" && this.runtime.requestRender());
7815
7846
  }
7816
7847
  applyCameraSnapshot(e, t) {
7817
- if (!Mt(e)) return !1;
7848
+ if (!Ie(e)) return !1;
7818
7849
  const i = this.runtime.viewMode;
7819
- return this.runtime.applyCameraSnapshot(e) ? (this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
7850
+ return this.runtime.applyCameraSnapshot(e) ? (this.runtime.resize(), this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
7820
7851
  }
7821
7852
  detectCameraChange(e = !1) {
7822
7853
  const t = xe(this.runtime.captureCameraSnapshot());
@@ -7836,7 +7867,7 @@ class wn {
7836
7867
  shouldRenderCurrentFrame(e) {
7837
7868
  if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
7838
7869
  const t = e - this.interactionRenderLastTs;
7839
- return t < 0 || t >= xn;
7870
+ return t < 0 || t >= An;
7840
7871
  }
7841
7872
  markInteractionActive() {
7842
7873
  this.clearInteractionIdleTimer(), this.setInteraction("active");
@@ -7844,7 +7875,7 @@ class wn {
7844
7875
  scheduleInteractionIdle() {
7845
7876
  this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
7846
7877
  this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
7847
- }, bn);
7878
+ }, kn);
7848
7879
  }
7849
7880
  clearInteractionIdleTimer() {
7850
7881
  this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
@@ -7919,7 +7950,7 @@ class wn {
7919
7950
  for (const i of this.listeners.get(e) ?? []) i(t);
7920
7951
  }
7921
7952
  }
7922
- function zn(s) {
7953
+ function Un(s) {
7923
7954
  const e = new nr({
7924
7955
  canvasArea: s.viewport,
7925
7956
  canvas: s.canvas,
@@ -7931,23 +7962,23 @@ function zn(s) {
7931
7962
  environment: s.environment ?? "room",
7932
7963
  navigationPolicy: "viewer"
7933
7964
  });
7934
- return Cn(s, e);
7965
+ return In(s, e);
7935
7966
  }
7936
- function Cn(s, e) {
7937
- return e.initialize(), new wn(s, e);
7967
+ function In(s, e) {
7968
+ return e.initialize(), new Mn(s, e);
7938
7969
  }
7939
- function Sn(s) {
7940
- return s === "cad" ? En : s === "model" ? xt : s === "simulation" ? /* @__PURE__ */ new Set([...xt, "urdf"]) : kn;
7970
+ function Rn(s) {
7971
+ return s === "cad" ? Ln : s === "model" ? wt : s === "simulation" ? /* @__PURE__ */ new Set([...wt, "urdf"]) : Tn;
7941
7972
  }
7942
- const En = /* @__PURE__ */ new Set(["cad"]), xt = /* @__PURE__ */ new Set(["scene"]), kn = /* @__PURE__ */ new Set();
7973
+ const Ln = /* @__PURE__ */ new Set(["cad"]), wt = /* @__PURE__ */ new Set(["scene"]), Tn = /* @__PURE__ */ new Set();
7943
7974
  function xe(s) {
7944
7975
  return s ? JSON.stringify(s) : null;
7945
7976
  }
7946
- function Pn(s) {
7977
+ function Dn(s) {
7947
7978
  return !!(s && typeof s == "object" && s.nodeType === 1);
7948
7979
  }
7949
7980
  export {
7950
7981
  q as V,
7951
- zn as c,
7982
+ Un as c,
7952
7983
  fi as v
7953
7984
  };