@nebula-spatial/viewer 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- var Bt = Object.defineProperty;
2
- var Ut = (s, e, t) => e in s ? Bt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var u = (s, e, t) => Ut(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Texture as jt, Vector3 as S, MathUtils as O, MOUSE as N, Object3D as Ct, Scene as we, Group as Et, Raycaster as St, Vector2 as oe, WebGLRenderer as Ht, Color as qt, Euler as Yt, OrthographicCamera as Oe, PerspectiveCamera as Xt, TOUCH as ze, Vector4 as Wt, Plane as kt, WebGLRenderTarget as Gt, Box3 as F, PMREMGenerator as Kt, EquirectangularReflectionMapping as Zt, Quaternion as Jt, BoxHelper as Qt, Box3Helper as ei, BoxGeometry as ti, Mesh as ii, MeshBasicMaterial as ri, LineSegments as si, EdgesGeometry as ni, LineBasicMaterial as ai } from "three";
5
- import { RoomEnvironment as oi } from "three/addons/environments/RoomEnvironment.js";
6
- import { MapControls as li } from "three/addons/controls/MapControls.js";
7
- import { OrbitControls as di } from "three/addons/controls/OrbitControls.js";
8
- import { HDRLoader as ci } from "three/addons/loaders/HDRLoader.js";
9
- import { createCadDocumentSession as ui, getCadDocumentRenderResource as hi, formatCadInsertId as Ne } from "@nebula-spatial/cad-loader";
10
- import { CSS2DObject as pi, CSS2DRenderer as fi } from "three/addons/renderers/CSS2DRenderer.js";
11
- const mi = "0.5.3", vi = "@nebula-spatial/viewer", Fe = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
12
- function Ve() {
13
- const s = `%c ${vi} %c v${mi} `;
1
+ var Ht = Object.defineProperty;
2
+ var qt = (s, e, t) => e in s ? Ht(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var u = (s, e, t) => qt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Texture as Yt, Vector3 as S, MathUtils as O, MOUSE as z, Object3D as kt, Scene as Se, Group as Pt, Raycaster as At, Vector2 as de, WebGLRenderer as Xt, Color as Gt, Euler as Wt, OrthographicCamera as Fe, PerspectiveCamera as Kt, TOUCH as Ve, Vector4 as Zt, Plane as Rt, WebGLRenderTarget as Jt, Box3 as F, PMREMGenerator as Qt, EquirectangularReflectionMapping as ei, Quaternion as ti, BoxHelper as ii, Box3Helper as ri, BoxGeometry as si, Mesh as ni, MeshBasicMaterial as ai, LineSegments as oi, EdgesGeometry as li, LineBasicMaterial as di } from "three";
5
+ import { RoomEnvironment as ci } from "three/addons/environments/RoomEnvironment.js";
6
+ import { MapControls as ui } from "three/addons/controls/MapControls.js";
7
+ import { OrbitControls as hi } from "three/addons/controls/OrbitControls.js";
8
+ import { HDRLoader as pi } from "three/addons/loaders/HDRLoader.js";
9
+ import { createCadDocumentSession as fi, getCadDocumentRenderResource as mi, formatCadInsertId as $e } from "@nebula-spatial/cad-loader";
10
+ import { CSS2DObject as vi, CSS2DRenderer as gi } from "three/addons/renderers/CSS2DRenderer.js";
11
+ const bi = "0.5.4", yi = "@nebula-spatial/viewer", _e = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
12
+ function Be() {
13
+ const s = `%c ${yi} %c v${bi} `;
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[Fe] || (s[Fe] = !0, Ve());
18
+ s[_e] || (s[_e] = !0, Be());
19
19
  } catch {
20
- Ve();
20
+ Be();
21
21
  }
22
- const gi = [
22
+ const xi = [
23
23
  "alphaMap",
24
24
  "aoMap",
25
25
  "bumpMap",
@@ -45,31 +45,31 @@ const gi = [
45
45
  "thicknessMap",
46
46
  "transmissionMap"
47
47
  ];
48
- function de(s, e) {
48
+ function ue(s, e) {
49
49
  e.has(s) || (e.add(s), s.dispose());
50
50
  }
51
- function bi(s, e, t) {
51
+ function wi(s, e, t) {
52
52
  if (e) {
53
53
  const i = s;
54
- for (const r of gi) {
54
+ for (const r of xi) {
55
55
  const n = i[r];
56
- n instanceof jt && de(n, t);
56
+ n instanceof Yt && ue(n, t);
57
57
  }
58
58
  }
59
- de(s, t);
59
+ ue(s, t);
60
60
  }
61
- function $e(s, e = {}) {
61
+ function Ue(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;
65
- n.geometry && de(n.geometry, t);
65
+ n.geometry && ue(n.geometry, t);
66
66
  const a = Array.isArray(n.material) ? n.material : [n.material];
67
67
  for (const o of a)
68
- o && bi(o, i, t);
69
- n.renderTarget && de(n.renderTarget, t);
68
+ o && wi(o, i, t);
69
+ n.renderTarget && ue(n.renderTarget, t);
70
70
  });
71
71
  }
72
- function yi(s) {
72
+ function Ci(s) {
73
73
  const {
74
74
  dxPx: e,
75
75
  dyPx: t,
@@ -83,52 +83,52 @@ function yi(s) {
83
83
  } = s;
84
84
  if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(i) || !Number.isFinite(r) || !Number.isFinite(n) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) || !Number.isFinite(d) || i <= 0 || r <= 0 || n <= 0 || a <= 0 || a >= 180 || o <= 0)
85
85
  return { x: 0, y: 0, z: 0 };
86
- const c = 2 * n * Math.tan(a * Math.PI / 360), p = c / r, f = c * o / i, v = Math.sin(l), y = Math.cos(l), m = -v, b = y, g = -y, x = -v, w = -e * f * d, C = t * p * d;
86
+ const c = 2 * n * Math.tan(a * Math.PI / 360), p = c / r, m = c * o / i, v = Math.sin(l), y = Math.cos(l), f = -v, b = y, g = -y, x = -v, w = -e * m * d, C = t * p * d;
87
87
  return {
88
- x: m * w + g * C,
88
+ x: f * w + g * C,
89
89
  y: b * w + x * C,
90
90
  z: 0
91
91
  };
92
92
  }
93
- function xi(s, e) {
93
+ function Ei(s, e) {
94
94
  return !Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z) || !Number.isFinite(e.x) || !Number.isFinite(e.y) || !Number.isFinite(e.z) ? { x: 0, y: 0, z: 0 } : {
95
95
  x: s.x - e.x,
96
96
  y: s.y - e.y,
97
97
  z: 0
98
98
  };
99
99
  }
100
- function wi(s, e, t) {
100
+ function Si(s, e, t) {
101
101
  if (!Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z))
102
102
  return { x: 0, y: 0, z: 0 };
103
- const i = xi(e, t);
103
+ const i = Ei(e, t);
104
104
  return {
105
105
  x: s.x + i.x,
106
106
  y: s.y + i.y,
107
107
  z: s.z
108
108
  };
109
109
  }
110
- const Ci = 0.35, Y = 1, Ei = 1, Si = 170;
111
- function Q(s, e, t) {
110
+ const ki = 0.35, Y = 1, Pi = 1, Ai = 170;
111
+ function ee(s, e, t) {
112
112
  return Math.max(e, Math.min(t, s));
113
113
  }
114
114
  function $(s, e, t, i) {
115
115
  const r = Number.isFinite(s) ? s : e;
116
- return Q(r, t, i);
116
+ return ee(r, t, i);
117
117
  }
118
- function Pt(s) {
119
- return Number.isFinite(s) ? Q(s, 0.1, 0.95) : Ci;
118
+ function It(s) {
119
+ return Number.isFinite(s) ? ee(s, 0.1, 0.95) : ki;
120
120
  }
121
- function ki(s, e) {
121
+ function Ri(s, e) {
122
122
  return !Number.isFinite(s) || !Number.isFinite(e) || s <= 0 || e <= 0 ? 1 : s / e;
123
123
  }
124
- function At(s) {
125
- const e = $(s, 50, Ei, Si), t = Math.tan(e * Math.PI / 360);
124
+ function Mt(s) {
125
+ const e = $(s, 50, Pi, Ai), t = Math.tan(e * Math.PI / 360);
126
126
  return Math.max(t, 1e-4);
127
127
  }
128
- function Pi(s) {
128
+ function Ii(s) {
129
129
  return Number.isFinite(s) ? Math.max(0.2, Math.abs(Math.sin(s))) : 0.2;
130
130
  }
131
- function Ai(s) {
131
+ function Mi(s) {
132
132
  return Number.isFinite(s) ? {
133
133
  sinAbs: Math.max(1e-4, Math.abs(Math.sin(s))),
134
134
  cosAbs: Math.abs(Math.cos(s))
@@ -137,15 +137,15 @@ function Ai(s) {
137
137
  cosAbs: Math.sqrt(1 - 0.2 * 0.2)
138
138
  };
139
139
  }
140
- function Rt(s, e, t) {
141
- const i = Math.max(1e-4, 2 * s * e / Pi(t)), { sinAbs: r, cosAbs: n } = Ai(t), a = s * e, o = r * r - a * a * n * n;
140
+ function Lt(s, e, t) {
141
+ const i = Math.max(1e-4, 2 * s * e / Ii(t)), { sinAbs: r, cosAbs: n } = Mi(t), a = s * e, o = r * r - a * a * n * n;
142
142
  if (!Number.isFinite(o) || o <= 1e-4)
143
143
  return i;
144
144
  const l = 2 * a * r / o;
145
145
  return !Number.isFinite(l) || l <= 1e-4 ? i : l;
146
146
  }
147
- function Ri(s) {
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 = Rt(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);
147
+ function Li(s) {
148
+ const e = It(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 = Mt(s.perspectiveFovDeg), a = Lt(e, n, i), o = $(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, $(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = ee(r / a, o, l);
149
149
  return {
150
150
  orbitTarget: { x: s.orthoCenterX, y: s.orthoCenterY, z: 0 },
151
151
  orbitDistance: d,
@@ -153,25 +153,25 @@ function Ri(s) {
153
153
  orbitPitch: i
154
154
  };
155
155
  }
156
- function Ii(s) {
157
- const e = ki(s.viewportWidthPx, s.viewportHeightPx), t = Pt(s.ndcBand), i = At(s.perspectiveFovDeg), r = Rt(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 Ti(s) {
157
+ const e = Ri(s.viewportWidthPx, s.viewportHeightPx), t = It(s.ndcBand), i = Mt(s.perspectiveFovDeg), r = Lt(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 : ee(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
- orthoFrustumSize: Q(d, n, a)
161
+ orthoFrustumSize: ee(d, n, a)
162
162
  };
163
163
  }
164
- function Mi(s) {
164
+ function Di(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)
168
168
  ), l = Number.isFinite(a) && a > 1e-4 ? Math.max(1e-4, 2 * n * i / a) : o;
169
169
  return e / l;
170
170
  }
171
- function Li(s, e, t, i = 40) {
171
+ function Oi(s, e, t, i = 40) {
172
172
  return e === 1 ? s * i : e === 2 ? s * t : s;
173
173
  }
174
- function Ti(s) {
174
+ function Ni(s) {
175
175
  const { valuePx: e, ctrlKey: t, eventTimeMs: i, state: r, resetMs: n } = s, a = Math.abs(e), o = r.lastEventTimeMs === 0 ? 0 : i - r.lastEventTimeMs;
176
176
  let l = r.type;
177
177
  if (t)
@@ -190,7 +190,7 @@ function Ti(s) {
190
190
  type: l
191
191
  };
192
192
  }
193
- function Di(s, e, t) {
193
+ function zi(s, e, t) {
194
194
  if (!Number.isFinite(s) || s === 0) return 1;
195
195
  const i = e === "wheel" ? t.wheelZoomRate : t.trackpadZoomRate;
196
196
  if (e === "wheel") {
@@ -202,19 +202,19 @@ function Di(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, Ue = O.degToRad(55), Oi = 1e3, zi = 2e6;
205
+ const fe = 500, je = 2e5, me = 0.95, He = -Math.PI / 2, qe = O.degToRad(55), Fi = 1e3, Vi = 2e6;
206
206
  function _(s, e, t = 1e-4) {
207
207
  return Math.abs(s - e) <= t;
208
208
  }
209
- class Ni {
209
+ class $i {
210
210
  constructor() {
211
211
  u(this, "orbitTarget", new S(0, 0, 0));
212
212
  u(this, "orbitDistance", 14e3);
213
- u(this, "orbitYaw", Be);
214
- u(this, "orbitPitch", Ue);
213
+ u(this, "orbitYaw", He);
214
+ u(this, "orbitPitch", qe);
215
215
  u(this, "enabled", !0);
216
- u(this, "orbitDistanceMin", he);
217
- u(this, "orbitDistanceMax", _e);
216
+ u(this, "orbitDistanceMin", fe);
217
+ u(this, "orbitDistanceMax", je);
218
218
  u(this, "viewportSnapshotBefore3D", null);
219
219
  u(this, "orbitSnapshotOn3DEntry", null);
220
220
  u(this, "dragMode", null);
@@ -257,16 +257,16 @@ class Ni {
257
257
  if (!i) return;
258
258
  const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new S()), a = e.getCenter(new S());
259
259
  this.orbitTarget.set(a.x, a.y, a.z);
260
- const o = Mi({
260
+ const o = Di({
261
261
  xmin: e.min.x,
262
262
  ymin: e.min.y,
263
263
  xmax: e.max.x,
264
264
  ymax: e.max.y,
265
265
  fovDeg: i.camera3d.fov,
266
266
  orbitPitchRad: this.orbitPitch,
267
- ndcBand: pe
267
+ ndcBand: me
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 < fe ? Math.max(h * 0.02, 1e-6) : fe, this.orbitDistanceMax = Math.max(je, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
270
270
  }
271
271
  getVisibleDocumentRect() {
272
272
  const e = this.runtime;
@@ -336,7 +336,7 @@ class Ni {
336
336
  if (this.dragMode === "pan") {
337
337
  const i = this.screenToGround(e.clientX, e.clientY);
338
338
  if (this.groundPanAnchor && i) {
339
- const r = wi(this.orbitTarget, this.groundPanAnchor, i);
339
+ const r = Si(this.orbitTarget, this.groundPanAnchor, i);
340
340
  this.translateOrbit(r.x - this.orbitTarget.x, r.y - this.orbitTarget.y);
341
341
  } else
342
342
  this.panByScreenDelta(
@@ -356,15 +356,15 @@ class Ni {
356
356
  const t = this.runtime;
357
357
  if (!t || t.viewMode !== "3d") return;
358
358
  (d = e.preventDefault) == null || d.call(e);
359
- const i = Math.max(1, t.canvasArea.clientHeight), r = Li(e.deltaY, e.deltaMode, i);
360
- this.wheelClassifier = Ti({
359
+ const i = Math.max(1, t.canvasArea.clientHeight), r = Oi(e.deltaY, e.deltaMode, i);
360
+ this.wheelClassifier = Ni({
361
361
  valuePx: r,
362
362
  ctrlKey: e.ctrlKey,
363
363
  eventTimeMs: typeof performance > "u" ? Date.now() : performance.now(),
364
364
  state: this.wheelClassifier,
365
365
  resetMs: 400
366
366
  });
367
- const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = Di(-a, n, {
367
+ const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = zi(-a, n, {
368
368
  trackpadZoomRate: 1 / 700,
369
369
  wheelZoomRate: 1 / 3200,
370
370
  maxScalePerFrame: 2
@@ -376,7 +376,7 @@ class Ni {
376
376
  panByScreenDelta(e, t) {
377
377
  const i = this.runtime;
378
378
  if (!i) return;
379
- const r = yi({
379
+ const r = Ci({
380
380
  dxPx: e,
381
381
  dyPx: t,
382
382
  viewportWidthPx: Math.max(1, i.canvasArea.clientWidth),
@@ -408,7 +408,7 @@ class Ni {
408
408
  var o, l;
409
409
  const t = this.runtime;
410
410
  if (!t) return;
411
- const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Ri({
411
+ const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Li({
412
412
  orthoCenterX: ((o = t.controls2d.target) == null ? void 0 : o.x) ?? i.position.x,
413
413
  orthoCenterY: ((l = t.controls2d.target) == null ? void 0 : l.y) ?? i.position.y,
414
414
  orthoFrustumSize: n,
@@ -420,16 +420,16 @@ class Ni {
420
420
  orbitDistanceMin: this.orbitDistanceMin,
421
421
  orbitDistanceMax: this.orbitDistanceMax,
422
422
  useFixedOrientation: e,
423
- fixedOrbitYaw: Be,
424
- fixedOrbitPitch: Ue,
425
- ndcBand: pe
423
+ fixedOrbitYaw: He,
424
+ fixedOrbitPitch: qe,
425
+ ndcBand: me
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;
428
428
  }
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 = Ti({
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,
@@ -439,14 +439,14 @@ class Ni {
439
439
  viewportHeightPx: r,
440
440
  orthoFrustumMin: c,
441
441
  orthoFrustumMax: p,
442
- ndcBand: pe
443
- }), f = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, v = o / 2;
442
+ ndcBand: me
443
+ }), m = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, v = o / 2;
444
444
  e.setOrthographicViewport({
445
445
  left: -v * n,
446
446
  right: v * n,
447
447
  top: v,
448
448
  bottom: -v,
449
- zoom: O.clamp(o / f, l, d),
449
+ zoom: O.clamp(o / m, l, d),
450
450
  positionX: h.orthoCenterX,
451
451
  positionY: h.orthoCenterY,
452
452
  targetX: h.orthoCenterX,
@@ -461,7 +461,7 @@ class Ni {
461
461
  this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
462
462
  this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
463
463
  );
464
- t.camera3d.near = Math.min(Oi, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(zi, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
464
+ t.camera3d.near = Math.min(Fi, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(Vi, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
465
465
  }
466
466
  capture2DSnapshot() {
467
467
  const e = this.runtime;
@@ -532,42 +532,42 @@ class Ni {
532
532
  }
533
533
  }
534
534
  }
535
- const Fi = new S(2.4, -2.7, 1.7), Vi = new S(0, 0, 0.65), $i = Math.PI, _i = !0, Bi = new S(1.25, -1.5, 0.85).normalize(), Ui = 1.25, ji = 0.4, Hi = 12, qi = 1e3, Yi = 20, Xi = 0.1, Wi = 0.2, It = "left-rotate", Gi = {
536
- "left-rotate": { LEFT: N.ROTATE, MIDDLE: N.DOLLY, RIGHT: N.PAN },
537
- "left-pan": { LEFT: N.PAN, MIDDLE: N.DOLLY, RIGHT: N.ROTATE }
535
+ const _i = new S(2.4, -2.7, 1.7), Bi = new S(0, 0, 0.65), Ui = Math.PI, ji = !0, Hi = new S(1.25, -1.5, 0.85).normalize(), qi = 1.25, Yi = 0.4, Xi = 12, Gi = 1e3, Wi = 20, Ki = 0.1, Zi = 0.2, Tt = "left-rotate", Ji = {
536
+ "left-rotate": { LEFT: z.ROTATE, MIDDLE: z.DOLLY, RIGHT: z.PAN },
537
+ "left-pan": { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }
538
538
  };
539
- function Ki({ radius: s, fovDeg: e }) {
540
- const t = Math.max(s, 0.02), i = O.degToRad(e), r = t / Math.sin(i * 0.5) * Ui;
539
+ function Qi({ radius: s, fovDeg: e }) {
540
+ const t = Math.max(s, 0.02), i = O.degToRad(e), r = t / Math.sin(i * 0.5) * qi;
541
541
  return {
542
542
  distance: r,
543
- minDistance: Math.max(t * ji, 0.01),
544
- maxDistance: Math.max(t * Hi, 1),
543
+ minDistance: Math.max(t * Yi, 0.01),
544
+ maxDistance: Math.max(t * Xi, 1),
545
545
  near: Math.max(
546
- r / qi,
547
- Math.min(Xi, t * Wi),
546
+ r / Gi,
547
+ Math.min(Ki, t * Zi),
548
548
  1e-4
549
549
  ),
550
- far: Math.max(r * Yi, 10)
550
+ far: Math.max(r * Wi, 10)
551
551
  };
552
552
  }
553
- function Zi(s, e, t) {
553
+ function er(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 je(s, e, t = It) {
557
- s.enableDamping = _i, s.maxPolarAngle = $i, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Gi[t] }, Ct.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
556
+ function Ye(s, e, t = Tt) {
557
+ s.enableDamping = ji, s.maxPolarAngle = Ui, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Ji[t] }, kt.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
558
558
  }
559
- function Ji(s, e, t, i) {
559
+ function tr(s, e, t, i) {
560
560
  if (t.isEmpty()) return null;
561
- const r = t.getSize(new S()), n = t.getCenter(new S()), a = Math.max(r.length() * 0.5, 0.02), o = Ki({ radius: a, fovDeg: i });
562
- return e.target.copy(n), s.position.copy(n).addScaledVector(Bi, o.distance), Zi(s, e, o), s.updateMatrixWorld(), e.update(), o;
561
+ const r = t.getSize(new S()), n = t.getCenter(new S()), a = Math.max(r.length() * 0.5, 0.02), o = Qi({ radius: a, fovDeg: i });
562
+ return e.target.copy(n), s.position.copy(n).addScaledVector(Hi, o.distance), er(s, e, o), s.updateMatrixWorld(), e.update(), o;
563
563
  }
564
- const Qi = 1e3, er = 2, tr = -1e4, ir = 1e4, He = 1e3, rr = 2e6, sr = 1.15, nr = 1, qe = new Yt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
565
- class ar {
564
+ const ir = 1e3, rr = 2, sr = -1e4, nr = 1e4, Xe = 1e3, ar = 2e6, or = 1.15, lr = 1, Ge = new Wt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
565
+ class dr {
566
566
  constructor(e) {
567
567
  u(this, "canvasArea");
568
568
  u(this, "canvas");
569
- u(this, "scene", new we());
570
- u(this, "overlayRoot", new Et());
569
+ u(this, "scene", new Se());
570
+ u(this, "overlayRoot", new Pt());
571
571
  u(this, "renderer");
572
572
  u(this, "camera2d");
573
573
  u(this, "camera3d");
@@ -579,8 +579,8 @@ class ar {
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());
583
- u(this, "pointerNdc", new oe());
582
+ u(this, "raycaster", new At());
583
+ u(this, "pointerNdc", new de());
584
584
  u(this, "reuseVector", new S());
585
585
  u(this, "reuseVector2", new S());
586
586
  u(this, "viewModeValue");
@@ -604,37 +604,37 @@ class ar {
604
604
  u(this, "previewImageDataBuffer", null);
605
605
  u(this, "environmentResource", null);
606
606
  u(this, "environmentLoadGeneration", 0);
607
- this.options = e, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? It, this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
607
+ this.options = e, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? Tt, this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
608
608
  }
609
609
  initialize() {
610
610
  if (this.disposed) throw new Error("SceneRuntime has been disposed.");
611
611
  if (this.initialized) return;
612
- const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new Ht(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new li(l, d)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new di(l, d));
612
+ const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new Xt(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new ui(l, d)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new hi(l, d));
613
613
  this.renderer = t({
614
614
  canvas: this.canvas,
615
615
  antialias: this.options.antialias ?? !0,
616
616
  alpha: this.options.alpha ?? !1,
617
617
  powerPreference: this.options.powerPreference ?? "high-performance"
618
- }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new qt(this.options.clearColor));
618
+ }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new Gt(this.options.clearColor));
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
- const l = (e == null ? void 0 : e.createEnvironment) ?? or;
622
- this.scene.environmentIntensity = nr, this.scene.environmentRotation.copy(qe), this.scene.backgroundRotation.copy(qe);
621
+ const l = (e == null ? void 0 : e.createEnvironment) ?? cr;
622
+ this.scene.environmentIntensity = lr, this.scene.environmentRotation.copy(Ge), this.scene.backgroundRotation.copy(Ge);
623
623
  const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
624
- lr(c) ? c.then(
624
+ ur(c) ? c.then(
625
625
  (p) => this.applyEnvironmentResource(p, d),
626
626
  (p) => {
627
627
  !this.disposed && d === this.environmentLoadGeneration && console.warn("Failed to load scene environment HDR.", p);
628
628
  }
629
629
  ) : this.applyEnvironmentResource(c, d);
630
630
  }
631
- this.camera2d = new Oe(-o, o, 1, -1, tr, ir), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Xt(40, o, He, rr), 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
- LEFT: N.PAN,
633
- MIDDLE: N.DOLLY,
634
- RIGHT: N.PAN
631
+ this.camera2d = new Fe(-o, o, 1, -1, sr, nr), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Kt(40, o, Xe, ar), 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
+ LEFT: z.PAN,
633
+ MIDDLE: z.DOLLY,
634
+ RIGHT: z.PAN
635
635
  }, this.controls2d.touches = {
636
- ONE: ze.PAN,
637
- TWO: ze.DOLLY_PAN
636
+ ONE: Ve.PAN,
637
+ TWO: Ve.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() {
@@ -675,10 +675,10 @@ class ar {
675
675
  var t, i;
676
676
  if (this.controls3d) {
677
677
  if (e === "viewer") {
678
- this.viewerOrbit ?? (this.viewerOrbit = new Ni()), this.viewerOrbit.attach(this);
678
+ this.viewerOrbit ?? (this.viewerOrbit = new $i()), 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" && (je(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Fi), 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" && (Ye(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(_i), this.controls3d.target.copy(Bi), this.controls3d.update());
682
682
  }
683
683
  }
684
684
  /**
@@ -687,7 +687,7 @@ class ar {
687
687
  * handed to OrbitControls.
688
688
  */
689
689
  setPreviewDragPreset(e) {
690
- this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (je(this.controls3d, this.camera3d, e), this.requestRender()));
690
+ this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (Ye(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 ar {
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) && $e(e), this.requestRender(), !0;
742
+ return (t.dispose === !0 || t.dispose === void 0 && i) && Ue(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 ar {
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) && $e(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) && Ue(i.object), this.requestRender(), i.object) : null;
753
753
  }
754
754
  setHighlight(e, t = {}) {
755
755
  if (!e) {
@@ -777,17 +777,17 @@ class ar {
777
777
  const a = Math.max(1, t.padding ?? 1.05);
778
778
  if ((t.viewMode ?? this.viewModeValue) === "2d") {
779
779
  const l = Math.max(r.x, 1e-6) * a, d = Math.max(r.y, 1e-6) * a, c = Math.max(1, this.canvasArea.clientWidth), p = Math.max(1, this.canvasArea.clientHeight), h = c / p;
780
- let f = l / 2, v = d / 2;
781
- f / v < h ? f = v * h : v = f / h, this.camera2d.left = -f, this.camera2d.right = f, this.camera2d.top = v, this.camera2d.bottom = -v, this.camera2d.zoom = 1, this.camera2d.position.set(n.x, n.y, Math.max(n.z + 1, 1)), this.camera2d.updateProjectionMatrix(), this.controls2d.target.copy(n), this.controls2d.update();
780
+ let m = l / 2, v = d / 2;
781
+ m / v < h ? m = v * h : v = m / h, this.camera2d.left = -m, this.camera2d.right = m, this.camera2d.top = v, this.camera2d.bottom = -v, this.camera2d.zoom = 1, this.camera2d.position.set(n.x, n.y, Math.max(n.z + 1, 1)), this.camera2d.updateProjectionMatrix(), this.controls2d.target.copy(n), this.controls2d.update();
782
782
  } else if (this.navigationPolicyValue === "preview")
783
- Ji(this.camera3d, this.controls3d, i, this.camera3d.fov);
783
+ tr(this.camera3d, this.controls3d, i, this.camera3d.fov);
784
784
  else if (this.viewerOrbit)
785
785
  this.viewerOrbit.fit3D(i, { padding: a });
786
786
  else {
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
- 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
- He,
790
- Math.max(f * 0.01, 1e-6)
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), m = p / Math.sin(h) * a, v = this.camera3d.position.clone().sub(this.controls3d.target);
788
+ v.lengthSq() <= 1e-12 && v.set(1, -1, 1), v.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(v, m), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
789
+ Xe,
790
+ Math.max(m * 0.01, 1e-6)
791
791
  ), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
792
792
  }
793
793
  return this.requestRender(), !0;
@@ -888,11 +888,11 @@ class ar {
888
888
  };
889
889
  }
890
890
  renderOrthographicPreview(e, t, i) {
891
- var G;
892
- if (!this.renderer || this.disposed || t.parent || !dr(i)) return !1;
893
- const r = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), n = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(r * o)), d = Math.max(1, Math.floor(n * o)), c = l / a, p = d / a, h = Math.min(c, p), f = (i.minX + i.maxX) / 2, v = (i.minY + i.maxY) / 2, m = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * sr / 2, b = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
894
- g.left = -m, g.right = m, g.top = m, g.bottom = -m, g.position.set(f, v, 1), g.up.copy(((G = this.camera2d) == null ? void 0 : G.up) ?? new S(0, 1, 0)), g.lookAt(f, v, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
895
- const x = this.getOrCreatePreviewScene(), w = this.renderer, C = w.getRenderTarget(), D = w.getClearAlpha(), E = w.autoClear, A = new Wt();
891
+ var W;
892
+ if (!this.renderer || this.disposed || t.parent || !hr(i)) return !1;
893
+ const r = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), n = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(r * o)), d = Math.max(1, Math.floor(n * o)), c = l / a, p = d / a, h = Math.min(c, p), m = (i.minX + i.maxX) / 2, v = (i.minY + i.maxY) / 2, f = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * or / 2, b = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
894
+ g.left = -f, g.right = f, g.top = f, g.bottom = -f, g.position.set(m, v, 1), g.up.copy(((W = this.camera2d) == null ? void 0 : W.up) ?? new S(0, 1, 0)), g.lookAt(m, v, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
895
+ const x = this.getOrCreatePreviewScene(), w = this.renderer, C = w.getRenderTarget(), D = w.getClearAlpha(), E = w.autoClear, A = new Zt();
896
896
  w.getViewport(A);
897
897
  const L = w.getScissorTest();
898
898
  x.add(t);
@@ -917,7 +917,7 @@ class ar {
917
917
  bindRuntimeEvent(e, t, i, r) {
918
918
  this.listen(e, t, i, r);
919
919
  }
920
- clientToNdc(e, t, i = new oe()) {
920
+ clientToNdc(e, t, i = new de()) {
921
921
  var a;
922
922
  const r = (a = this.renderer) == null ? void 0 : a.domElement;
923
923
  if (!r) return null;
@@ -929,9 +929,9 @@ class ar {
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 kt(new S(0, 0, 1), -i), new S()));
932
+ return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new Rt(new S(0, 0, 1), -i), new S()));
933
933
  }
934
- worldToClient(e, t = new oe()) {
934
+ worldToClient(e, t = new de()) {
935
935
  var a;
936
936
  const i = (a = this.renderer) == null ? void 0 : a.domElement;
937
937
  if (!i || !this.activeCamera) return null;
@@ -971,8 +971,8 @@ class ar {
971
971
  startAnimation(e = {}) {
972
972
  if (this.disposed || this.animationLoopActive) return;
973
973
  this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
974
- const t = e.infoUpdateIntervalMs ?? Qi, i = (r = performance.now()) => {
975
- var o, l, d, c, p, h, f, v, y;
974
+ const t = e.infoUpdateIntervalMs ?? ir, i = (r = performance.now()) => {
975
+ var o, l, d, c, p, h, m, v, y;
976
976
  if (!this.animationLoopActive || this.disposed) {
977
977
  this.animationFrameId = null;
978
978
  return;
@@ -983,17 +983,17 @@ class ar {
983
983
  let a = !1;
984
984
  if (this.renderRequested && (((c = e.shouldRender) == null ? void 0 : c.call(e, r)) ?? !0)) {
985
985
  (p = e.beforeRender) == null || p.call(e, r);
986
- const m = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, r);
986
+ const f = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, r);
987
987
  try {
988
988
  this.renderer.render(this.scene, this.activeCamera);
989
989
  } finally {
990
- m == null || m();
990
+ f == null || f();
991
991
  }
992
- this.renderRequested = !1, a = !0, (f = e.afterRender) == null || f.call(e, r);
992
+ this.renderRequested = !1, a = !0, (m = e.afterRender) == null || m.call(e, r);
993
993
  }
994
994
  if (this.infoFrames += 1, r - this.infoLastTime >= t) {
995
- const m = Math.max(1, r - this.infoLastTime);
996
- this.fpsCurrent = this.infoFrames * 1e3 / m, this.infoFrames = 0, this.infoLastTime = r, (v = e.onInfoUpdate) == null || v.call(e);
995
+ const f = Math.max(1, r - this.infoLastTime);
996
+ this.fpsCurrent = this.infoFrames * 1e3 / f, this.infoFrames = 0, this.infoLastTime = r, (v = e.onInfoUpdate) == null || v.call(e);
997
997
  } else a && ((y = e.onInfoUpdate) == null || y.call(e));
998
998
  };
999
999
  i();
@@ -1019,14 +1019,14 @@ class ar {
1019
1019
  (i = this.environmentResource) == null || i.dispose(), this.environmentResource = e, this.scene.environment = e.texture, this.requestRender();
1020
1020
  }
1021
1021
  getOrCreatePreviewScene() {
1022
- return this.previewScene || (this.previewScene = new we()), this.previewScene;
1022
+ return this.previewScene || (this.previewScene = new Se()), this.previewScene;
1023
1023
  }
1024
1024
  getOrCreatePreviewCamera() {
1025
- return this.previewCamera || (this.previewCamera = new Oe(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1025
+ return this.previewCamera || (this.previewCamera = new Fe(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1026
1026
  }
1027
1027
  getOrCreatePreviewRenderTarget(e, t) {
1028
1028
  var i;
1029
- return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Gt(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
1029
+ return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Jt(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
1030
1030
  }
1031
1031
  getOrCreatePreviewPixelBuffer(e, t) {
1032
1032
  const i = e * t * 4;
@@ -1056,11 +1056,11 @@ class ar {
1056
1056
  }
1057
1057
  readDevicePixelRatio() {
1058
1058
  const e = globalThis.devicePixelRatio;
1059
- return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, er);
1059
+ return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, rr);
1060
1060
  }
1061
1061
  resolveBox3(e) {
1062
1062
  if (e instanceof F) return e.clone();
1063
- if (e instanceof Ct) return new F().setFromObject(e);
1063
+ if (e instanceof kt) return new F().setFromObject(e);
1064
1064
  const { minX: t, minY: i, maxX: r, maxY: n } = e;
1065
1065
  return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new F(new S(t, i, 0), new S(r, n, 0));
1066
1066
  }
@@ -1079,9 +1079,9 @@ class ar {
1079
1079
  });
1080
1080
  }
1081
1081
  }
1082
- function or(s, e) {
1082
+ function cr(s, e) {
1083
1083
  if (e === "room") {
1084
- const t = new Kt(s), i = new oi(), r = t.fromScene(i);
1084
+ const t = new Qt(s), i = new ci(), r = t.fromScene(i);
1085
1085
  return i.dispose(), t.dispose(), {
1086
1086
  texture: r.texture,
1087
1087
  dispose: () => r.dispose()
@@ -1089,23 +1089,23 @@ function or(s, e) {
1089
1089
  }
1090
1090
  if (e.type !== "hdr" || e.url.trim().length === 0)
1091
1091
  throw new Error("HDR scene environment requires a non-empty URL.");
1092
- return new ci().loadAsync(e.url).then((t) => (t.mapping = Zt, {
1092
+ return new pi().loadAsync(e.url).then((t) => (t.mapping = ei, {
1093
1093
  texture: t,
1094
1094
  dispose: () => t.dispose()
1095
1095
  }));
1096
1096
  }
1097
- function lr(s) {
1097
+ function ur(s) {
1098
1098
  return typeof (s == null ? void 0 : s.then) == "function";
1099
1099
  }
1100
- function dr(s) {
1100
+ function hr(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 Re = 1, cr = 1024, ur = 16, hr = 1e9;
1104
- function pr() {
1105
- return typeof globalThis.localStorage > "u" ? fr() : {
1103
+ const Le = 1, pr = 1024, fr = 16, mr = 1e9;
1104
+ function vr() {
1105
+ return typeof globalThis.localStorage > "u" ? gr() : {
1106
1106
  read(s) {
1107
1107
  try {
1108
- const e = globalThis.localStorage.getItem(Ye(s));
1108
+ const e = globalThis.localStorage.getItem(We(s));
1109
1109
  return e ? JSON.parse(e) : null;
1110
1110
  } catch {
1111
1111
  return null;
@@ -1113,13 +1113,13 @@ function pr() {
1113
1113
  },
1114
1114
  write(s, e) {
1115
1115
  try {
1116
- globalThis.localStorage.setItem(Ye(s), JSON.stringify(e));
1116
+ globalThis.localStorage.setItem(We(s), JSON.stringify(e));
1117
1117
  } catch {
1118
1118
  }
1119
1119
  }
1120
1120
  };
1121
1121
  }
1122
- function fr() {
1122
+ function gr() {
1123
1123
  const s = /* @__PURE__ */ new Map();
1124
1124
  return {
1125
1125
  read(e) {
@@ -1130,15 +1130,15 @@ function fr() {
1130
1130
  }
1131
1131
  };
1132
1132
  }
1133
- function mr(s, e) {
1133
+ function br(s, e) {
1134
1134
  if (!s || !e) return null;
1135
1135
  const t = s.read(e);
1136
- return Ie(t) ? t : null;
1136
+ return Te(t) ? t : null;
1137
1137
  }
1138
- function Ie(s) {
1138
+ function Te(s) {
1139
1139
  if (!s || typeof s != "object") return !1;
1140
1140
  const e = s;
1141
- if (e.schemaVersion !== Re) return !1;
1141
+ if (e.schemaVersion !== Le) return !1;
1142
1142
  if (e.viewMode === "2d") {
1143
1143
  const t = e.orthographic;
1144
1144
  return !t || ![
@@ -1166,48 +1166,48 @@ function Ie(s) {
1166
1166
  }
1167
1167
  return !1;
1168
1168
  }
1169
- function vr(s, e, t) {
1169
+ function yr(s, e, t) {
1170
1170
  !s || !e || s.write(e, t);
1171
1171
  }
1172
- function gr(s) {
1172
+ function xr(s) {
1173
1173
  return {
1174
- schemaVersion: Re,
1174
+ schemaVersion: Le,
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 br(s, e) {
1181
- if (!Ie(s)) return null;
1182
- const t = yr(e);
1180
+ function wr(s, e) {
1181
+ if (!Te(s)) return null;
1182
+ const t = Cr(e);
1183
1183
  if (s.viewMode === "2d") {
1184
1184
  const r = s.orthographic;
1185
1185
  if (!r) return null;
1186
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 && !xr(r.positionX, r.positionY, n, a, e) ? null : s;
1187
+ return !Number.isFinite(n) || !Number.isFinite(a) || Math.max(n, a) > t || e && !Er(r.positionX, r.positionY, n, a, e) ? null : s;
1188
1188
  }
1189
1189
  const i = s.orbit;
1190
- return !i || e && !wr(i.targetX, i.targetY, e) ? null : s;
1190
+ return !i || e && !Sr(i.targetX, i.targetY, e) ? null : s;
1191
1191
  }
1192
- function yr(s) {
1192
+ function Cr(s) {
1193
1193
  if (s) {
1194
1194
  const e = Math.max(s.maxX - s.minX, s.maxY - s.minY);
1195
- if (Number.isFinite(e) && e > 0) return e * cr;
1195
+ if (Number.isFinite(e) && e > 0) return e * pr;
1196
1196
  }
1197
- return hr;
1197
+ return mr;
1198
1198
  }
1199
- function xr(s, e, t, i, r) {
1199
+ function Er(s, e, t, i, r) {
1200
1200
  const n = t / 2, a = i / 2;
1201
1201
  return !(s + n < r.minX || s - n > r.maxX || e + a < r.minY || e - a > r.maxY);
1202
1202
  }
1203
- function wr(s, e, t) {
1203
+ function Sr(s, e, t) {
1204
1204
  const i = Math.max(t.maxX - t.minX, t.maxY - t.minY);
1205
1205
  if (!Number.isFinite(i) || i <= 0) return !0;
1206
- const r = i * ur;
1206
+ const r = i * fr;
1207
1207
  return s >= t.minX - r && s <= t.maxX + r && e >= t.minY - r && e <= t.maxY + r;
1208
1208
  }
1209
- function Ye(s) {
1210
- return `nebula-viewer:camera:v${Re}:${s}`;
1209
+ function We(s) {
1210
+ return `nebula-viewer:camera:v${Le}:${s}`;
1211
1211
  }
1212
1212
  function Z(s) {
1213
1213
  return new F(
@@ -1215,11 +1215,11 @@ function Z(s) {
1215
1215
  new S(s.maxX, s.maxY, s.maxZ)
1216
1216
  );
1217
1217
  }
1218
- function Mt(s) {
1218
+ function Dt(s) {
1219
1219
  const [e, t, i] = s;
1220
1220
  return (e & 255) << 16 | (t & 255) << 8 | i & 255;
1221
1221
  }
1222
- class Cr {
1222
+ class kr {
1223
1223
  constructor() {
1224
1224
  u(this, "rows", []);
1225
1225
  u(this, "allColor", null);
@@ -1242,7 +1242,7 @@ class Cr {
1242
1242
  color: i.has(n.index) ? i.get(n.index) : this.allColor,
1243
1243
  sourceColor: n.color
1244
1244
  }));
1245
- Pr(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1245
+ Ir(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1246
1246
  }
1247
1247
  clear(e = !0) {
1248
1248
  const t = this.rows.length > 0 || this.allColor !== null;
@@ -1299,7 +1299,7 @@ class Cr {
1299
1299
  t && (this.allColor = e, this.revision += 1, this.onChange());
1300
1300
  }
1301
1301
  }
1302
- class Er {
1302
+ class Pr {
1303
1303
  constructor() {
1304
1304
  u(this, "usages", []);
1305
1305
  u(this, "revision", 0);
@@ -1325,7 +1325,7 @@ class Er {
1325
1325
  canHighlight: r.canHighlight,
1326
1326
  visible: r.visible
1327
1327
  }));
1328
- Ar(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1328
+ Mr(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1329
1329
  }
1330
1330
  clear(e = !0) {
1331
1331
  const t = this.usages.length > 0;
@@ -1352,7 +1352,7 @@ class Er {
1352
1352
  t.length !== 0 && (this.renderNode.setInsertVisibleBatch(t), i && (this.visibilityRevision += 1, this.revision += 1, this.onChange()));
1353
1353
  }
1354
1354
  }
1355
- class Sr {
1355
+ class Ar {
1356
1356
  constructor() {
1357
1357
  u(this, "selection", null);
1358
1358
  u(this, "details", null);
@@ -1370,7 +1370,7 @@ class Sr {
1370
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);
1371
1371
  }
1372
1372
  }
1373
- class kr {
1373
+ class Rr {
1374
1374
  constructor() {
1375
1375
  u(this, "revision", 0);
1376
1376
  u(this, "filename", null);
@@ -1412,7 +1412,7 @@ class kr {
1412
1412
  this.zoomLabel = Number.isFinite(p) && (p ?? 0) > 0 ? `${Math.round(p * 100)}%` : "", this.scaleRuler = {
1413
1413
  visible: !0,
1414
1414
  worldLength: c,
1415
- lengthLabel: Rr(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1415
+ lengthLabel: Lr(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1416
1416
  }, this.orbitDistanceLabel = "";
1417
1417
  } else {
1418
1418
  const c = (d = e.host.runtime.captureCameraSnapshot()) == null ? void 0 : d.orbit;
@@ -1423,26 +1423,26 @@ class kr {
1423
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;
1424
1424
  }
1425
1425
  }
1426
- function Pr(s, e) {
1426
+ function Ir(s, e) {
1427
1427
  return s.length === e.length && s.every((t, i) => {
1428
1428
  const r = e[i];
1429
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];
1430
1430
  });
1431
1431
  }
1432
- function Ar(s, e) {
1432
+ function Mr(s, e) {
1433
1433
  return s.length === e.length && s.every((t, i) => {
1434
1434
  const r = e[i];
1435
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;
1436
1436
  });
1437
1437
  }
1438
- function Rr(s, e) {
1438
+ function Lr(s, e) {
1439
1439
  if (e === "mm") {
1440
1440
  if (s >= 1e6) return `${(s / 1e6).toFixed(2)} km`;
1441
1441
  if (s >= 1e3) return `${(s / 1e3).toFixed(2)} m`;
1442
1442
  }
1443
1443
  return `${s.toFixed(2)}${e ? ` ${e}` : ""}`;
1444
1444
  }
1445
- function Xe(s) {
1445
+ function Ke(s) {
1446
1446
  return {
1447
1447
  documentKey: s.documentKey,
1448
1448
  filename: s.filename,
@@ -1454,13 +1454,13 @@ function Xe(s) {
1454
1454
  units: s.units ?? { source: "mm" }
1455
1455
  };
1456
1456
  }
1457
- const Ir = 160, We = 5e3;
1458
- class Mr {
1457
+ const Tr = 160, Ze = 5e3;
1458
+ class Dr {
1459
1459
  constructor(e) {
1460
- u(this, "layers", new Cr());
1461
- u(this, "blocks", new Er());
1462
- u(this, "inspector", new Sr());
1463
- u(this, "hud", new kr());
1460
+ u(this, "layers", new kr());
1461
+ u(this, "blocks", new Pr());
1462
+ u(this, "inspector", new Ar());
1463
+ u(this, "hud", new Rr());
1464
1464
  u(this, "document", null);
1465
1465
  u(this, "loadTiming", null);
1466
1466
  u(this, "capabilities", {
@@ -1494,10 +1494,10 @@ class Mr {
1494
1494
  this.assertActive(), this.closeInternal();
1495
1495
  const i = ++this.openEpoch;
1496
1496
  this.cameraSettled = !1, this.initialDemandSettled = !1, this.initialCameraRestored = !1, this.cameraChangedDuringInitialLoad = !1, this.loadTiming = null;
1497
- const r = t.documentKey ?? zr(e);
1497
+ const r = t.documentKey ?? Vr(e);
1498
1498
  let n;
1499
1499
  try {
1500
- n = ui(e, {
1500
+ n = fi(e, {
1501
1501
  documentKey: r ?? void 0,
1502
1502
  filename: t.filename,
1503
1503
  loadAnnotations: t.loadAnnotations,
@@ -1517,7 +1517,7 @@ class Mr {
1517
1517
  throw this.emit("error", { ...J(p, !0, e), error: p }), p;
1518
1518
  }
1519
1519
  this.session = n, this.loadTiming = n.loadTiming, this.statusMessage = "加载中…";
1520
- const a = hi(n);
1520
+ const a = mi(n);
1521
1521
  this.renderNode = a, this.layers.bind(a, () => this.emit("layer-change", { layers: this.layers })), this.blocks.bind(a, () => this.emit("block-change", { blocks: this.blocks })), this.unsubscribers.push(
1522
1522
  a.onChange(() => {
1523
1523
  this.host.requestRender(), this.host.emitContentChange();
@@ -1555,10 +1555,10 @@ class Mr {
1555
1555
  return;
1556
1556
  }
1557
1557
  if (this.initialDemandSettled = !0, this.layers.sync(n), this.blocks.sync(n), !this.initialCameraRestored && !this.cameraChangedDuringInitialLoad) {
1558
- const f = a.getAuthoritativeBounds({
1558
+ const m = a.getAuthoritativeBounds({
1559
1559
  includeUnmountedExternal: !0
1560
1560
  });
1561
- f && this.host.fitBox3(Z(f));
1561
+ m && this.host.fitBox3(Z(m));
1562
1562
  }
1563
1563
  this.syncDisplayContext(), this.syncHud(((h = this.document) == null ? void 0 : h.filename) ?? null), this.publishDocumentPhase(n.phase), this.emit("hud-change", { hud: this.hud }), this.flushViewportDemand();
1564
1564
  }
@@ -1568,7 +1568,7 @@ class Mr {
1568
1568
  try {
1569
1569
  o = await n.headerReady;
1570
1570
  } catch (d) {
1571
- const c = d instanceof Error ? d : new Error(String(d)), p = this.openEpoch !== i, h = c.name === "AbortError" || ((l = t.signal) == null ? void 0 : l.aborted), f = Object.assign(new Error(
1571
+ const c = d instanceof Error ? d : new Error(String(d)), p = this.openEpoch !== i, h = c.name === "AbortError" || ((l = t.signal) == null ? void 0 : l.aborted), m = Object.assign(new Error(
1572
1572
  p ? "CAD open superseded" : h ? "CAD open aborted" : c.message
1573
1573
  ), {
1574
1574
  name: p ? "AbortError" : c.name,
@@ -1576,17 +1576,17 @@ class Mr {
1576
1576
  cause: c
1577
1577
  });
1578
1578
  throw !p && this.openEpoch === i && h && this.emit("error", {
1579
- ...J(f, !0, e),
1580
- code: p ? "E_SUPERSEDED" : h ? "E_ABORTED" : J(f, !0, e).code,
1581
- error: f
1582
- }), f;
1579
+ ...J(m, !0, e),
1580
+ code: p ? "E_SUPERSEDED" : h ? "E_ABORTED" : J(m, !0, e).code,
1581
+ error: m
1582
+ }), m;
1583
1583
  }
1584
1584
  if (this.openEpoch !== i)
1585
1585
  throw Object.assign(new Error("CAD open superseded"), {
1586
1586
  name: "AbortError",
1587
1587
  code: "E_SUPERSEDED"
1588
1588
  });
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({
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 = Ke({
1590
1590
  documentKey: r,
1591
1591
  filename: t.filename ?? o.filename ?? null,
1592
1592
  phase: n.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : n.phase,
@@ -1665,11 +1665,11 @@ class Mr {
1665
1665
  return this.layers.getVisibilityRevision() + this.blocks.getVisibilityRevision();
1666
1666
  }
1667
1667
  setInsertSelection(e, t) {
1668
- Lr(this.inspector.selection, e) && Dr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1668
+ Or(this.inspector.selection, e) && zr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1669
1669
  }
1670
1670
  /** @internal Used by the viewer's managed interaction pipeline. */
1671
1671
  setTextSelectionInternal(e, t) {
1672
- Tr(this.inspector.textSelection, e) && Or(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1672
+ Nr(this.inspector.textSelection, e) && Fr(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1673
1673
  }
1674
1674
  getAuthoritativeBoundsBox() {
1675
1675
  if (!this.session) return null;
@@ -1722,7 +1722,7 @@ class Mr {
1722
1722
  }
1723
1723
  select(e) {
1724
1724
  var t, i, r;
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();
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($e(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();
1726
1726
  }
1727
1727
  clearSelection() {
1728
1728
  this.assertActive(), !(!this.inspector.selection && !this.inspector.textSelection) && (this.inspector.clear(), this.emit("inspector-change", { inspector: this.inspector }));
@@ -1743,7 +1743,7 @@ class Mr {
1743
1743
  hud: e(this.hud),
1744
1744
  loadTiming: e(this.loadTiming)
1745
1745
  };
1746
- return Lt(t);
1746
+ return Ot(t);
1747
1747
  }
1748
1748
  fitDocument() {
1749
1749
  this.assertActive();
@@ -1757,8 +1757,8 @@ class Mr {
1757
1757
  if (!e) return !1;
1758
1758
  let { minX: t, minY: i, maxX: r, maxY: n } = e;
1759
1759
  const a = r - t, o = n - i, l = Math.max(a, o);
1760
- if (a > 0 && o > 0 && l < We) {
1761
- const c = (t + r) / 2, p = (i + n) / 2, h = We / 2;
1760
+ if (a > 0 && o > 0 && l < Ze) {
1761
+ const c = (t + r) / 2, p = (i + n) / 2, h = Ze / 2;
1762
1762
  t = c - h, i = p - h, r = c + h, n = p + h;
1763
1763
  }
1764
1764
  return this.host.fitBox3(Z({
@@ -1773,7 +1773,7 @@ class Mr {
1773
1773
  refreshInspectorDetails(e) {
1774
1774
  const t = this.inspector.selection;
1775
1775
  if (!t) return;
1776
- const i = e.getBlockDetails(Ne(t.id));
1776
+ const i = e.getBlockDetails($e(t.id));
1777
1777
  if (!i) return;
1778
1778
  const r = this.inspector.details, n = r == null ? void 0 : r.bbox;
1779
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 }));
@@ -1781,7 +1781,7 @@ class Mr {
1781
1781
  tryRestoreCamera(e, t) {
1782
1782
  const i = this.host.readCameraSnapshot(e);
1783
1783
  if (!i) return !1;
1784
- const r = br(i, t);
1784
+ const r = wr(i, t);
1785
1785
  return r ? this.host.applyCameraSnapshot(r, "restore") : !1;
1786
1786
  }
1787
1787
  persistCurrentCamera() {
@@ -1790,7 +1790,7 @@ class Mr {
1790
1790
  const e = this.host.runtime.captureCameraSnapshot();
1791
1791
  e && this.host.persistCameraSnapshot(
1792
1792
  this.document.documentKey,
1793
- gr(e)
1793
+ xr(e)
1794
1794
  );
1795
1795
  }
1796
1796
  syncDisplayContext() {
@@ -1836,7 +1836,7 @@ class Mr {
1836
1836
  }
1837
1837
  this.viewportDemandTimer === null && (this.viewportDemandTimer = globalThis.setTimeout(() => {
1838
1838
  this.viewportDemandTimer = null, !(this.disposed || !this.session) && this.host.interaction === "active" && this.flushViewportDemand();
1839
- }, Math.max(0, this.host.viewportDemandCoalesceMs ?? Ir)));
1839
+ }, Math.max(0, this.host.viewportDemandCoalesceMs ?? Tr)));
1840
1840
  }
1841
1841
  clearViewportDemandTimer() {
1842
1842
  this.viewportDemandTimer !== null && (globalThis.clearTimeout(this.viewportDemandTimer), this.viewportDemandTimer = null);
@@ -1855,7 +1855,7 @@ class Mr {
1855
1855
  });
1856
1856
  }
1857
1857
  publishDocumentPhase(e) {
1858
- this.document && (this.document = Xe({
1858
+ this.document && (this.document = Ke({
1859
1859
  documentKey: this.document.documentKey,
1860
1860
  filename: this.document.filename,
1861
1861
  phase: e,
@@ -1873,19 +1873,19 @@ class Mr {
1873
1873
  if (this.disposed) throw new Error("Viewer has been disposed.");
1874
1874
  }
1875
1875
  }
1876
- function Lr(s, e) {
1876
+ function Or(s, e) {
1877
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);
1878
1878
  }
1879
- function Tr(s, e) {
1879
+ function Nr(s, e) {
1880
1880
  return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.textId === e.id.textId);
1881
1881
  }
1882
- function Dr(s, e) {
1882
+ function zr(s, e) {
1883
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);
1884
1884
  }
1885
- function Or(s, e) {
1885
+ function Fr(s, e) {
1886
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);
1887
1887
  }
1888
- function zr(s) {
1888
+ function Vr(s) {
1889
1889
  let e = null;
1890
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;
1891
1891
  let t = 2166136261;
@@ -1893,19 +1893,19 @@ function zr(s) {
1893
1893
  t ^= e.charCodeAt(i), t = Math.imul(t, 16777619);
1894
1894
  return `reference:src-${(t >>> 0).toString(16)}`;
1895
1895
  }
1896
- function Lt(s) {
1896
+ function Ot(s) {
1897
1897
  if (!s || typeof s != "object") return s;
1898
1898
  Object.freeze(s);
1899
1899
  for (const e of Object.values(s))
1900
- e && typeof e == "object" && !Object.isFrozen(e) && Lt(e);
1900
+ e && typeof e == "object" && !Object.isFrozen(e) && Ot(e);
1901
1901
  return s;
1902
1902
  }
1903
1903
  function J(s, e, t) {
1904
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";
1905
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 };
1906
1906
  }
1907
- const Ge = 1;
1908
- class Nr {
1907
+ const Je = 1;
1908
+ class $r {
1909
1909
  constructor(e) {
1910
1910
  u(this, "startX", 0);
1911
1911
  u(this, "startY", 0);
@@ -1950,13 +1950,13 @@ class Nr {
1950
1950
  this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
1951
1951
  }
1952
1952
  isTrackingPrimaryPointer(e) {
1953
- return this.primaryPointerDown || (e & Ge) === Ge;
1953
+ return this.primaryPointerDown || (e & Je) === Je;
1954
1954
  }
1955
1955
  }
1956
- function Ce(s, e) {
1956
+ function ke(s, e) {
1957
1957
  return `${s}:${e}`;
1958
1958
  }
1959
- class Fr {
1959
+ class _r {
1960
1960
  constructor() {
1961
1961
  u(this, "expandedLayers", /* @__PURE__ */ new Set());
1962
1962
  u(this, "expandedBlocks", /* @__PURE__ */ new Set());
@@ -1976,7 +1976,7 @@ class Fr {
1976
1976
  this.expandedLayers.has(e) ? this.expandedLayers.delete(e) : this.expandedLayers.add(e), this.suppressedSelectionKey = null;
1977
1977
  }
1978
1978
  toggleBlockExpanded(e, t) {
1979
- const i = Ce(e, t);
1979
+ const i = ke(e, t);
1980
1980
  this.expandedBlocks.has(i) ? this.expandedBlocks.delete(i) : this.expandedBlocks.add(i), this.suppressedSelectionKey = null;
1981
1981
  }
1982
1982
  prune(e, t) {
@@ -1988,7 +1988,7 @@ class Fr {
1988
1988
  t.has(i) || this.blockVisibilitySnapshots.delete(i);
1989
1989
  }
1990
1990
  ensureSelectionVisible(e, t, i) {
1991
- this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(Ce(t, i)));
1991
+ this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(ke(t, i)));
1992
1992
  }
1993
1993
  needsSelectionReveal(e) {
1994
1994
  return this.revealedSelectionKey !== e;
@@ -2009,7 +2009,7 @@ function R(s) {
2009
2009
  "'": "&#39;"
2010
2010
  })[e] ?? e);
2011
2011
  }
2012
- const Vr = {
2012
+ const Br = {
2013
2013
  "panel.layers": "图层",
2014
2014
  "panel.properties": "属性",
2015
2015
  "panel.layers.aria": "图层面板",
@@ -2088,7 +2088,7 @@ const Vr = {
2088
2088
  "status.parsing": "解析中…",
2089
2089
  "status.incrementalLoading": "增量渲染中…",
2090
2090
  "unit.mm": "mm"
2091
- }, $r = {
2091
+ }, Ur = {
2092
2092
  "panel.layers": "Layers",
2093
2093
  "panel.properties": "Properties",
2094
2094
  "panel.layers.aria": "Layers panel",
@@ -2168,29 +2168,29 @@ const Vr = {
2168
2168
  "status.incrementalLoading": "Rendering incrementally…",
2169
2169
  "unit.mm": "mm"
2170
2170
  };
2171
- function _r(s, e) {
2171
+ function jr(s, e) {
2172
2172
  return e ? s.replace(/\{([a-zA-Z0-9_]+)\}/g, (t, i) => {
2173
2173
  const r = e[i];
2174
2174
  return r === void 0 ? t : String(r);
2175
2175
  }) : s;
2176
2176
  }
2177
- function Br(s) {
2177
+ function Hr(s) {
2178
2178
  try {
2179
2179
  return new Intl.NumberFormat(s, { maximumFractionDigits: 4, useGrouping: !1 });
2180
2180
  } catch {
2181
2181
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 4, useGrouping: !1 });
2182
2182
  }
2183
2183
  }
2184
- function Ur(s) {
2184
+ function qr(s) {
2185
2185
  try {
2186
2186
  return new Intl.NumberFormat(s, { maximumFractionDigits: 0 });
2187
2187
  } catch {
2188
2188
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 0 });
2189
2189
  }
2190
2190
  }
2191
- function Tt(s) {
2191
+ function Nt(s) {
2192
2192
  var a;
2193
- const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? $r : Vr, i = Br(e), r = Ur(e), n = {
2193
+ const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Ur : Br, i = Hr(e), r = qr(e), n = {
2194
2194
  locale: e,
2195
2195
  t(o, l) {
2196
2196
  var p;
@@ -2202,7 +2202,7 @@ function Tt(s) {
2202
2202
  d = void 0;
2203
2203
  }
2204
2204
  const c = d ?? ((p = s.messages) == null ? void 0 : p[o]) ?? t[o] ?? o;
2205
- return _r(c, l);
2205
+ return jr(c, l);
2206
2206
  },
2207
2207
  formatNumber(o) {
2208
2208
  return o == null || !Number.isFinite(o) ? "—" : i.format(o);
@@ -2231,20 +2231,20 @@ function Tt(s) {
2231
2231
  };
2232
2232
  return n;
2233
2233
  }
2234
- const jr = {
2234
+ const Yr = {
2235
2235
  "加载中…": "status.loading",
2236
2236
  "解析中…": "status.parsing",
2237
2237
  "增量渲染中…": "status.incrementalLoading"
2238
2238
  };
2239
- function Hr(s, e) {
2240
- const t = s.trim(), i = jr[t];
2239
+ function Xr(s, e) {
2240
+ const t = s.trim(), i = Yr[t];
2241
2241
  return i ? e.t(i) : t;
2242
2242
  }
2243
- const Me = Tt({});
2244
- function qr(s) {
2243
+ const De = Nt({});
2244
+ function Gr(s) {
2245
2245
  const e = /* @__PURE__ */ new Map();
2246
2246
  for (const i of s.usages) {
2247
- const r = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), n = Ce(i.layerIndex, i.variantId);
2247
+ const r = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), n = ke(i.layerIndex, i.variantId);
2248
2248
  let a = r.get(n);
2249
2249
  a || (a = {
2250
2250
  key: n,
@@ -2266,26 +2266,26 @@ function qr(s) {
2266
2266
  t.set(i, [...r.values()]);
2267
2267
  return t;
2268
2268
  }
2269
- function Yr(s, e) {
2269
+ function Wr(s, e) {
2270
2270
  return s ? e.toLowerCase().includes(s) : !0;
2271
2271
  }
2272
- function ce(s, e, t) {
2272
+ function he(s, e, t) {
2273
2273
  s.dataset.visible = e ? "1" : "0", s.classList.toggle("off", !e), s.textContent = e ? "●" : "○", s.title = e ? t.t("layer.hideInsert") : t.t("layer.showInsert");
2274
2274
  }
2275
- function le(s, e, t) {
2275
+ function ce(s, e, t) {
2276
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");
2277
2277
  }
2278
- function Xr(s) {
2278
+ function Kr(s) {
2279
2279
  let e = 0;
2280
2280
  for (const t of s) t.visible && (e += 1);
2281
2281
  return e <= 0 ? "none" : e >= s.length ? "all" : "mixed";
2282
2282
  }
2283
- function Dt(s, e, t, i) {
2283
+ function zt(s, e, t, i) {
2284
2284
  if (!s) return !1;
2285
2285
  const r = s.id;
2286
2286
  return r.layerIndex !== e || r.variantId !== t ? !1 : i === void 0 ? !0 : r.instanceId === i;
2287
2287
  }
2288
- function Ke(s) {
2288
+ function Qe(s) {
2289
2289
  const e = s.querySelector(".vui-lrow-insert.active") ?? s.querySelector(".vui-lrow-block.active");
2290
2290
  if (!e) return !1;
2291
2291
  const t = s.getBoundingClientRect(), i = e.getBoundingClientRect();
@@ -2293,7 +2293,7 @@ function Ke(s) {
2293
2293
  const r = i.top - t.top, n = s.scrollTop + r - (t.height - i.height) / 2;
2294
2294
  return s.scrollTop = Math.max(0, n), !0;
2295
2295
  }
2296
- function Ot(s, e, t = 0) {
2296
+ function Ft(s, e, t = 0) {
2297
2297
  const i = () => {
2298
2298
  const r = s.getBoundingClientRect(), n = e.getBoundingClientRect();
2299
2299
  if (r.height <= 0) return;
@@ -2312,7 +2312,7 @@ function Ot(s, e, t = 0) {
2312
2312
  };
2313
2313
  i(), typeof requestAnimationFrame == "function" && requestAnimationFrame(i);
2314
2314
  }
2315
- function Wr(s, e) {
2315
+ function Zr(s, e) {
2316
2316
  const t = e.trim().toLowerCase();
2317
2317
  s.querySelectorAll(".vui-lrow-wrap").forEach((i) => {
2318
2318
  var o, l;
@@ -2322,7 +2322,7 @@ function Wr(s, e) {
2322
2322
  i.style.display = a ? "" : "none";
2323
2323
  });
2324
2324
  }
2325
- function Gr(s, e) {
2325
+ function Jr(s, e) {
2326
2326
  if (s.querySelectorAll(".vui-lrow-block.active, .vui-lrow-insert.active").forEach((o) => {
2327
2327
  o.classList.remove("active");
2328
2328
  }), !e) return;
@@ -2335,33 +2335,33 @@ function Gr(s, e) {
2335
2335
  );
2336
2336
  a && a.classList.add("active");
2337
2337
  }
2338
- function Kr(s, e, t, i = Me) {
2338
+ function Qr(s, e, t, i = De) {
2339
2339
  var l;
2340
2340
  const r = new Map(e.map((d) => [d.index, d]));
2341
2341
  s.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
2342
2342
  const c = r.get(Number(d.dataset.layerIndex));
2343
2343
  if (!c) return;
2344
2344
  const p = d.querySelector(".vui-lrow-eye");
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));
2345
+ p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Vt(d, Oe(c));
2346
2346
  });
2347
2347
  const n = s.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : X(t);
2348
2348
  (l = n == null ? void 0 : n.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
2349
2349
  const o = n == null ? void 0 : n.querySelector('input[type="color"]');
2350
2350
  o && o.value !== a && (o.value = a);
2351
2351
  }
2352
- function Zr(s, e, t) {
2352
+ function es(s, e, t) {
2353
2353
  var v;
2354
- const i = t.text ?? Me;
2354
+ const i = t.text ?? De;
2355
2355
  e.resetForScope(t.scopeKey);
2356
- const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = qr(t.blocks);
2356
+ const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = Gr(t.blocks);
2357
2357
  if (s.list.replaceChildren(), s.count.textContent = String(n.length), n.length === 0) {
2358
- s.list.appendChild(Qr(i.t("layer.empty")));
2358
+ s.list.appendChild(is(i.t("layer.empty")));
2359
2359
  return;
2360
2360
  }
2361
2361
  const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
2362
2362
  for (const y of n) {
2363
2363
  o.add(y.index);
2364
- for (const m of a.get(y.index) ?? []) l.add(m.key);
2364
+ for (const f of a.get(y.index) ?? []) l.add(f.key);
2365
2365
  }
2366
2366
  e.prune(o, l);
2367
2367
  const d = (v = t.selection) == null ? void 0 : v.id, c = d ? `${d.layerIndex}:${d.variantId}:${d.instanceId}` : null;
@@ -2378,37 +2378,37 @@ function Zr(s, e, t) {
2378
2378
  const h = p.querySelector('input[type="color"]');
2379
2379
  h && h.addEventListener("input", () => {
2380
2380
  var b, g, x;
2381
- const y = Number.parseInt(h.value.slice(1), 16), m = Number.isFinite(y) ? y : null;
2381
+ const y = Number.parseInt(h.value.slice(1), 16), f = Number.isFinite(y) ? y : null;
2382
2382
  (b = t.beginLayerColorPreview) == null || b.call(t, h);
2383
2383
  try {
2384
- if (t.setAllLayerColor) t.setAllLayerColor(m);
2385
- else for (const C of n) t.setLayerColor(C.index, m);
2386
- const w = m === null ? "#c8c8c8" : X(m);
2387
- (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), Ze(s.list, n, m);
2384
+ if (t.setAllLayerColor) t.setAllLayerColor(f);
2385
+ else for (const C of n) t.setLayerColor(C.index, f);
2386
+ const w = f === null ? "#c8c8c8" : X(f);
2387
+ (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), et(s.list, n, f);
2388
2388
  } finally {
2389
2389
  (x = t.endLayerColorPreview) == null || x.call(t, h);
2390
2390
  }
2391
2391
  }), h == null || h.addEventListener("click", (y) => y.stopPropagation());
2392
- const f = p.querySelector(".vui-lrow-clr");
2393
- f && f.addEventListener("contextmenu", (y) => {
2394
- var m;
2392
+ const m = p.querySelector(".vui-lrow-clr");
2393
+ m && m.addEventListener("contextmenu", (y) => {
2394
+ var f;
2395
2395
  if (y.preventDefault(), y.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2396
2396
  else for (const b of n) t.setLayerColor(b.index, 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);
2397
+ (f = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || f.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), et(s.list, n, null);
2398
2398
  }), s.list.appendChild(p);
2399
2399
  for (const y of n)
2400
- Yr(r, y.name) && s.list.appendChild(Jr(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);
2400
+ Wr(r, y.name) && s.list.appendChild(ts(y, e, t, a.get(y.index) ?? [], i));
2401
+ c && e.needsSelectionReveal(c) && (Qe(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2402
+ e.needsSelectionReveal(c) && Qe(s.list) && e.markSelectionRevealed(c);
2403
2403
  }));
2404
2404
  }
2405
2405
  function X(s) {
2406
2406
  return `#${s.toString(16).padStart(6, "0")}`;
2407
2407
  }
2408
- function Le(s) {
2409
- return s.color !== null ? X(s.color) : X(Mt(s.sourceColor));
2408
+ function Oe(s) {
2409
+ return s.color !== null ? X(s.color) : X(Dt(s.sourceColor));
2410
2410
  }
2411
- function zt(s, e) {
2411
+ function Vt(s, e) {
2412
2412
  var r;
2413
2413
  (r = s.querySelector(".vui-lrow-dot")) == null || r.style.setProperty("background", e);
2414
2414
  const t = s.querySelector(".vui-lrow-clr");
@@ -2416,15 +2416,15 @@ function zt(s, e) {
2416
2416
  const i = s.querySelector('input[type="color"]');
2417
2417
  i && i.value !== e && (i.value = e);
2418
2418
  }
2419
- function Ze(s, e, t) {
2419
+ function et(s, e, t) {
2420
2420
  const i = new Map(e.map((r) => [r.index, r]));
2421
2421
  s.querySelectorAll(".vui-lrow[data-layer-index]").forEach((r) => {
2422
2422
  const n = i.get(Number(r.dataset.layerIndex));
2423
- n && zt(r, t === null ? Le(n) : X(t));
2423
+ n && Vt(r, t === null ? Oe(n) : X(t));
2424
2424
  });
2425
2425
  }
2426
- function Jr(s, e, t, i, r) {
2427
- const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Le(s), l = document.createElement("div");
2426
+ function ts(s, e, t, i, r) {
2427
+ const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Oe(s), l = document.createElement("div");
2428
2428
  l.className = "vui-lrow-wrap";
2429
2429
  const d = document.createElement("div");
2430
2430
  d.className = `vui-lrow${s.visible ? "" : " off"}`, d.dataset.layerIndex = String(s.index);
@@ -2438,7 +2438,7 @@ function Jr(s, e, t, i, r) {
2438
2438
  p.className = "vui-lrow-dot", p.style.background = o;
2439
2439
  const h = document.createElement("button");
2440
2440
  h.type = "button", h.className = `vui-lrow-toggle${n ? "" : " placeholder"}`, h.textContent = a ? "▼" : "▶", h.disabled = !n;
2441
- const f = (b) => {
2441
+ const m = (b) => {
2442
2442
  if (b.stopPropagation(), !n) return;
2443
2443
  e.toggleLayerExpanded(s.index);
2444
2444
  const g = e.expandedLayers.has(s.index);
@@ -2450,35 +2450,35 @@ function Jr(s, e, t, i, r) {
2450
2450
  else {
2451
2451
  x = document.createElement("div"), x.className = "vui-lrow-blocks open";
2452
2452
  for (const w of i)
2453
- x.appendChild(Je(w, e, t, r));
2453
+ x.appendChild(tt(w, e, t, r));
2454
2454
  l.appendChild(x);
2455
2455
  }
2456
2456
  else {
2457
2457
  x == null || x.classList.remove("open");
2458
2458
  const w = l.closest(".vui-section-list") ?? l.parentElement;
2459
- w && Ot(w, d, 0);
2459
+ w && Ft(w, d, 0);
2460
2460
  }
2461
2461
  };
2462
- h.addEventListener("click", f);
2462
+ h.addEventListener("click", m);
2463
2463
  const v = document.createElement("span");
2464
2464
  v.className = "vui-lrow-name", v.textContent = s.name || r.t("layer.unnamed"), v.title = s.name;
2465
2465
  const y = document.createElement("span");
2466
2466
  y.className = "vui-lrow-clr", y.style.background = o, y.title = r.t("layer.colorOverride");
2467
- const m = document.createElement("input");
2468
- if (m.type = "color", m.value = o, m.addEventListener("input", () => {
2467
+ const f = document.createElement("input");
2468
+ if (f.type = "color", f.value = o, f.addEventListener("input", () => {
2469
2469
  var g, x;
2470
- const b = Number.parseInt(m.value.slice(1), 16);
2471
- (g = t.beginLayerColorPreview) == null || g.call(t, m);
2470
+ const b = Number.parseInt(f.value.slice(1), 16);
2471
+ (g = t.beginLayerColorPreview) == null || g.call(t, f);
2472
2472
  try {
2473
- t.setLayerColor(s.index, Number.isFinite(b) ? b : null), p.style.background = m.value, y.style.background = m.value;
2473
+ t.setLayerColor(s.index, Number.isFinite(b) ? b : null), p.style.background = f.value, y.style.background = f.value;
2474
2474
  } finally {
2475
- (x = t.endLayerColorPreview) == null || x.call(t, m);
2475
+ (x = t.endLayerColorPreview) == null || x.call(t, f);
2476
2476
  }
2477
- }), m.addEventListener("click", (b) => b.stopPropagation()), y.addEventListener("contextmenu", (b) => {
2477
+ }), f.addEventListener("click", (b) => b.stopPropagation()), y.addEventListener("contextmenu", (b) => {
2478
2478
  b.preventDefault(), b.stopPropagation(), t.setLayerColor(s.index, null);
2479
- const g = X(Mt(s.sourceColor));
2480
- m.value = g, p.style.background = g, y.style.background = g;
2481
- }), y.appendChild(m), d.append(c, p, h, v, y), d.addEventListener("click", (b) => {
2479
+ const g = X(Dt(s.sourceColor));
2480
+ f.value = g, p.style.background = g, y.style.background = g;
2481
+ }), y.appendChild(f), d.append(c, p, h, v, y), d.addEventListener("click", (b) => {
2482
2482
  const g = b.target;
2483
2483
  if (g instanceof HTMLInputElement && g.type === "color" || g.closest(".vui-lrow-clr") || g.closest(".vui-lrow-toggle") || g.closest(".vui-lrow-eye")) return;
2484
2484
  const x = !s.visible;
@@ -2487,26 +2487,26 @@ function Jr(s, e, t, i, r) {
2487
2487
  const b = document.createElement("div");
2488
2488
  b.className = "vui-lrow-blocks open";
2489
2489
  for (const g of i)
2490
- b.appendChild(Je(g, e, t, r));
2490
+ b.appendChild(tt(g, e, t, r));
2491
2491
  l.appendChild(b);
2492
2492
  }
2493
2493
  return l;
2494
2494
  }
2495
- function Je(s, e, t, i) {
2495
+ function tt(s, e, t, i) {
2496
2496
  const r = document.createElement("div");
2497
2497
  r.className = "vui-lrow-block-wrap";
2498
- const n = e.expandedBlocks.has(s.key), a = Xr(s.inserts), o = Dt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2498
+ const n = e.expandedBlocks.has(s.key), a = Kr(s.inserts), o = zt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2499
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"));
2500
2500
  const d = document.createElement("button");
2501
- d.type = "button", d.className = "vui-lrow-block-visibility", le(d, a, i), d.addEventListener("click", (v) => {
2501
+ d.type = "button", d.className = "vui-lrow-block-visibility", ce(d, a, i), d.addEventListener("click", (v) => {
2502
2502
  if (v.stopPropagation(), a === "none") {
2503
- const m = e.blockVisibilitySnapshots.get(s.key), b = [];
2503
+ const f = e.blockVisibilitySnapshots.get(s.key), b = [];
2504
2504
  for (const g of s.inserts) {
2505
- const x = (m == null ? void 0 : m.get(g.instanceId)) ?? !0;
2505
+ const x = (f == null ? void 0 : f.get(g.instanceId)) ?? !0;
2506
2506
  g.visible !== x && b.push({ insertId: g.insertId, visible: x });
2507
2507
  }
2508
- if (le(d, "all", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((g) => {
2509
- ce(g, !0, i);
2508
+ if (ce(d, "all", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((g) => {
2509
+ he(g, !0, i);
2510
2510
  }), t.batchToggleInserts && b.length > 0)
2511
2511
  t.batchToggleInserts(b);
2512
2512
  else
@@ -2515,15 +2515,15 @@ function Je(s, e, t, i) {
2515
2515
  }
2516
2516
  e.blockVisibilitySnapshots.set(
2517
2517
  s.key,
2518
- new Map(s.inserts.map((m) => [m.instanceId, m.visible]))
2518
+ new Map(s.inserts.map((f) => [f.instanceId, f.visible]))
2519
2519
  );
2520
- const y = s.inserts.filter((m) => m.visible).map((m) => ({ insertId: m.insertId, visible: !1 }));
2521
- if (le(d, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((m) => {
2522
- ce(m, !1, i);
2520
+ const y = s.inserts.filter((f) => f.visible).map((f) => ({ insertId: f.insertId, visible: !1 }));
2521
+ if (ce(d, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((f) => {
2522
+ he(f, !1, i);
2523
2523
  }), t.batchToggleInserts && y.length > 0)
2524
2524
  t.batchToggleInserts(y);
2525
2525
  else
2526
- for (const m of y) t.toggleInsert(m.insertId, !1);
2526
+ for (const f of y) t.toggleInsert(f.insertId, !1);
2527
2527
  });
2528
2528
  const c = document.createElement("button");
2529
2529
  c.type = "button", c.className = "vui-lrow-block-toggle", c.textContent = n ? "▼" : "▶";
@@ -2531,43 +2531,43 @@ function Je(s, e, t, i) {
2531
2531
  v.stopPropagation(), e.toggleBlockExpanded(s.layerIndex, s.variantId);
2532
2532
  const y = e.expandedBlocks.has(s.key);
2533
2533
  c.textContent = y ? "▼" : "▶";
2534
- let m = r.querySelector(":scope > .vui-lrow-inserts");
2534
+ let f = r.querySelector(":scope > .vui-lrow-inserts");
2535
2535
  if (y)
2536
- m ? m.classList.add("open") : (m = Qe(s, e, t, d, i), r.appendChild(m));
2536
+ f ? f.classList.add("open") : (f = it(s, e, t, d, i), r.appendChild(f));
2537
2537
  else {
2538
- m == null || m.classList.remove("open");
2538
+ f == null || f.classList.remove("open");
2539
2539
  const b = r.closest(".vui-section-list") ?? r.parentElement;
2540
- b && Ot(b, l, 24);
2540
+ b && Ft(b, l, 24);
2541
2541
  }
2542
2542
  };
2543
2543
  c.addEventListener("click", p);
2544
2544
  const h = document.createElement("span");
2545
2545
  h.className = "vui-lrow-block-name", h.textContent = s.blockName, h.title = s.blockName;
2546
- const f = document.createElement("span");
2547
- return f.className = "vui-lrow-block-count", f.textContent = `×${s.inserts.length}`, l.append(d, c, h, f), s.inserts.length === 1 && l.addEventListener("click", () => {
2546
+ const m = document.createElement("span");
2547
+ return m.className = "vui-lrow-block-count", m.textContent = `×${s.inserts.length}`, l.append(d, c, h, m), s.inserts.length === 1 && l.addEventListener("click", () => {
2548
2548
  if (!s.canHighlight) return;
2549
2549
  const v = s.inserts[0], y = `${s.layerIndex}:${s.variantId}:${v.instanceId}`;
2550
2550
  e.markSelectionRevealed(y), t.selectInsert(v.insertId);
2551
- }), r.appendChild(l), n && r.appendChild(Qe(s, e, t, d, i)), r;
2551
+ }), r.appendChild(l), n && r.appendChild(it(s, e, t, d, i)), r;
2552
2552
  }
2553
- function Qe(s, e, t, i, r) {
2553
+ function it(s, e, t, i, r) {
2554
2554
  const n = document.createElement("div");
2555
2555
  n.className = "vui-lrow-inserts open";
2556
2556
  for (const a of s.inserts) {
2557
2557
  const o = document.createElement("div");
2558
- o.className = `vui-lrow-insert${Dt(t.selection, s.layerIndex, s.variantId, a.instanceId) ? " active" : ""}${a.canHighlight === !1 ? " disabled" : ""}`, o.dataset.layerIndex = String(s.layerIndex), o.dataset.variantId = String(s.variantId), o.dataset.instanceId = String(a.instanceId), o.dataset.insertId = a.insertId, a.canHighlight === !1 && (o.title = r.t("layer.noHighlightInsert"));
2558
+ o.className = `vui-lrow-insert${zt(t.selection, s.layerIndex, s.variantId, a.instanceId) ? " active" : ""}${a.canHighlight === !1 ? " disabled" : ""}`, o.dataset.layerIndex = String(s.layerIndex), o.dataset.variantId = String(s.variantId), o.dataset.instanceId = String(a.instanceId), o.dataset.insertId = a.insertId, a.canHighlight === !1 && (o.title = r.t("layer.noHighlightInsert"));
2559
2559
  const l = document.createElement("button");
2560
- l.type = "button", l.className = "vui-lrow-insert-visibility", ce(l, a.visible, r), l.addEventListener("click", (c) => {
2560
+ l.type = "button", l.className = "vui-lrow-insert-visibility", he(l, a.visible, r), l.addEventListener("click", (c) => {
2561
2561
  c.stopPropagation();
2562
2562
  const p = !a.visible;
2563
- ce(l, p, r);
2563
+ he(l, p, r);
2564
2564
  const h = n.querySelectorAll(".vui-lrow-insert-visibility");
2565
- let f = 0;
2565
+ let m = 0;
2566
2566
  h.forEach((y) => {
2567
- y.dataset.visible === "1" && f++;
2567
+ y.dataset.visible === "1" && m++;
2568
2568
  });
2569
- const v = f === 0 ? "none" : f === h.length ? "all" : "mixed";
2570
- le(i, v, r), t.toggleInsert(a.insertId, p);
2569
+ const v = m === 0 ? "none" : m === h.length ? "all" : "mixed";
2570
+ ce(i, v, r), t.toggleInsert(a.insertId, p);
2571
2571
  });
2572
2572
  const d = document.createElement("span");
2573
2573
  d.className = "vui-lrow-insert-label", d.textContent = a.label, d.title = a.label, o.append(l, d), o.addEventListener("click", () => {
@@ -2578,49 +2578,49 @@ function Qe(s, e, t, i, r) {
2578
2578
  }
2579
2579
  return n;
2580
2580
  }
2581
- function Qr(s) {
2581
+ function is(s) {
2582
2582
  const e = document.createElement("div");
2583
2583
  return e.className = "vui-empty-note", e.textContent = s, e;
2584
2584
  }
2585
- function es(s, e) {
2585
+ function rs(s, e) {
2586
2586
  const t = () => {
2587
2587
  e(s.value);
2588
2588
  };
2589
2589
  return s.addEventListener("input", t), () => s.removeEventListener("input", t);
2590
2590
  }
2591
- function et(s, e, t = Me, i = "mm") {
2591
+ function rt(s, e, t = De, i = "mm") {
2592
2592
  if (s.body.replaceChildren(), e.textSelection && e.textDetails) {
2593
- H(s, !1), is(s.body, e.textDetails, t, i), tt(s.body);
2593
+ H(s, !1), ns(s.body, e.textDetails, t, i), st(s.body);
2594
2594
  return;
2595
2595
  }
2596
2596
  if (!e.selection || !e.details) {
2597
- H(s, !1), s.body.appendChild(rs(t.t("property.empty")));
2597
+ H(s, !1), s.body.appendChild(as(t.t("property.empty")));
2598
2598
  return;
2599
2599
  }
2600
- ts(s.body, e.details, t, i), tt(s.body);
2600
+ ss(s.body, e.details, t, i), st(s.body);
2601
2601
  }
2602
2602
  function H(s, e) {
2603
2603
  if (!s.previewWrap || !s.previewCanvas || (s.previewWrap.hidden = !e, e)) return;
2604
2604
  const t = s.previewCanvas.getContext("2d");
2605
2605
  t == null || t.clearRect(0, 0, s.previewCanvas.width, s.previewCanvas.height);
2606
2606
  }
2607
- function ts(s, e, t, i) {
2608
- Nt(s, t.t("property.insert"), e.blockName), Ee(s, t.t("property.basic"), (r) => {
2607
+ function ss(s, e, t, i) {
2608
+ $t(s, t.t("property.insert"), e.blockName), Pe(s, t.t("property.basic"), (r) => {
2609
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"));
2610
- }), Ee(s, t.t("property.transform"), (r) => {
2610
+ }), Pe(s, t.t("property.transform"), (r) => {
2611
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));
2612
2612
  });
2613
2613
  }
2614
- function is(s, e, t, i) {
2615
- Nt(s, t.t("property.text"), e.content), Ee(s, t.t("property.basic"), (r) => {
2614
+ function ns(s, e, t, i) {
2615
+ $t(s, t.t("property.text"), e.content), Pe(s, t.t("property.basic"), (r) => {
2616
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, "°"));
2617
2617
  });
2618
2618
  }
2619
- function Nt(s, e, t) {
2619
+ function $t(s, e, t) {
2620
2620
  const i = document.createElement("div");
2621
2621
  i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${R(e)}</strong><span>·</span><span>${R(t)}</span>`, s.appendChild(i);
2622
2622
  }
2623
- function Ee(s, e, t) {
2623
+ function Pe(s, e, t) {
2624
2624
  const i = document.createElement("section");
2625
2625
  i.className = "vui-pp-section";
2626
2626
  const r = document.createElement("div");
@@ -2630,11 +2630,11 @@ function I(s, e, t) {
2630
2630
  const i = document.createElement("div");
2631
2631
  i.className = "vui-pp-row", i.innerHTML = `<span class="label">${R(e)}</span><span class="value" title="${R(t)}">${R(t)}</span>`, s.appendChild(i);
2632
2632
  }
2633
- function rs(s) {
2633
+ function as(s) {
2634
2634
  const e = document.createElement("div");
2635
2635
  return e.className = "vui-empty-note", e.textContent = s, e;
2636
2636
  }
2637
- function tt(s) {
2637
+ function st(s) {
2638
2638
  if (s.querySelector('input:not([type="color"])'))
2639
2639
  throw new Error("Property panel must not contain editable inputs");
2640
2640
  if (s.querySelector('[contenteditable=""], [contenteditable="true"]'))
@@ -2642,17 +2642,17 @@ function tt(s) {
2642
2642
  if (s.querySelector("textarea"))
2643
2643
  throw new Error("Property panel must not contain textarea elements");
2644
2644
  }
2645
- const ss = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), ns = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2645
+ const os = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), ls = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2646
2646
  globalThis.clearTimeout(s);
2647
2647
  };
2648
- class as {
2648
+ class ds {
2649
2649
  constructor(e) {
2650
2650
  u(this, "onFlush");
2651
2651
  u(this, "requestFrame");
2652
2652
  u(this, "cancelFrame");
2653
2653
  u(this, "pending", /* @__PURE__ */ new Map());
2654
2654
  u(this, "scheduledHandle", null);
2655
- this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? ss, this.cancelFrame = e.cancelFrame ?? ns;
2655
+ this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? os, this.cancelFrame = e.cancelFrame ?? ls;
2656
2656
  }
2657
2657
  enqueue(e, t) {
2658
2658
  this.pending.set(e, t), this.scheduledHandle === null && (this.scheduledHandle = this.requestFrame(() => {
@@ -2676,7 +2676,7 @@ class as {
2676
2676
  this.pending.clear(), this.scheduledHandle !== null && (this.cancelFrame(this.scheduledHandle), this.scheduledHandle = null);
2677
2677
  }
2678
2678
  }
2679
- const os = `
2679
+ const cs = `
2680
2680
  :host {
2681
2681
  display: block;
2682
2682
  width: 100%;
@@ -3546,7 +3546,7 @@ button, input { font: inherit; }
3546
3546
  .vui-infobar-content { max-width: calc(100vw - 48px); }
3547
3547
  .vui-infobar-tools .vui-info-text { max-width: min(180px, 45vw); }
3548
3548
  }
3549
- `, ls = {
3549
+ `, us = {
3550
3550
  dark: `
3551
3551
  :host, .vui-root[data-theme="dark"] {
3552
3552
  --vui-bg: #0A0B0F;
@@ -3656,7 +3656,7 @@ button, input { font: inherit; }
3656
3656
  }
3657
3657
  `
3658
3658
  };
3659
- function fe(s = "dark", e = {}) {
3659
+ function ve(s = "dark", e = {}) {
3660
3660
  const t = {
3661
3661
  accent: "--vui-accent",
3662
3662
  panelBackground: "--vui-bg2",
@@ -3667,13 +3667,13 @@ function fe(s = "dark", e = {}) {
3667
3667
  hudBackground: "--vui-hud-bg"
3668
3668
  }, i = Object.entries(e).filter(([, r]) => typeof r == "string" && r.trim().length > 0).map(([r, n]) => `${t[r]}: ${n};`).join(`
3669
3669
  `);
3670
- return `${ls[s]}${i ? `
3670
+ return `${us[s]}${i ? `
3671
3671
  :host, .vui-root[data-theme="${s}"] {
3672
3672
  ${i}
3673
3673
  }
3674
- ` : ""}${os}`;
3674
+ ` : ""}${cs}`;
3675
3675
  }
3676
- const ds = {
3676
+ const hs = {
3677
3677
  layerPanel: !0,
3678
3678
  propertyPanel: !0,
3679
3679
  hud: !0,
@@ -3683,8 +3683,8 @@ const ds = {
3683
3683
  infobarLineMode: !0,
3684
3684
  infobarPhase: !0,
3685
3685
  infobarDebug: !0
3686
- }, it = "property-panel:open", rt = "layer-panel:open", st = 300, nt = 180, cs = 2;
3687
- let us = 0;
3686
+ }, nt = "property-panel:open", at = "layer-panel:open", ot = 300, lt = 180, ps = 2;
3687
+ let fs = 0;
3688
3688
  function B(s, ...e) {
3689
3689
  const t = document.createElement("div");
3690
3690
  t.className = "vui-debug-row";
@@ -3693,7 +3693,7 @@ function B(s, ...e) {
3693
3693
  const r = document.createElement("div");
3694
3694
  return r.className = "vui-debug-value", r.append(...e), t.append(i, r), t;
3695
3695
  }
3696
- function at(s, e, t) {
3696
+ function dt(s, e, t) {
3697
3697
  const i = document.createElement("div");
3698
3698
  i.className = "vui-debug-spread";
3699
3699
  const r = document.createElement("b");
@@ -3705,11 +3705,11 @@ function at(s, e, t) {
3705
3705
  }
3706
3706
  return i;
3707
3707
  }
3708
- function ot(s) {
3708
+ function ct(s) {
3709
3709
  const e = document.createElement("div");
3710
3710
  return e.className = "vui-debug-spread-list", e.append(...s), e;
3711
3711
  }
3712
- function hs(s, e) {
3712
+ function ms(s, e) {
3713
3713
  switch (s) {
3714
3714
  case "created":
3715
3715
  return e.t("status.created");
@@ -3727,7 +3727,7 @@ function hs(s, e) {
3727
3727
  return "";
3728
3728
  }
3729
3729
  }
3730
- function lt(s) {
3730
+ function ut(s) {
3731
3731
  return (typeof s.composedPath == "function" ? s.composedPath() : [s.target]).some((t) => {
3732
3732
  var a, o;
3733
3733
  if (!t || typeof t != "object") return !1;
@@ -3737,11 +3737,11 @@ function lt(s) {
3737
3737
  return n === "" || n === "true" || n === "plaintext-only";
3738
3738
  });
3739
3739
  }
3740
- class ps {
3740
+ class vs {
3741
3741
  constructor(e, t) {
3742
3742
  u(this, "parts");
3743
3743
  u(this, "text");
3744
- u(this, "layerPanelState", new Fr());
3744
+ u(this, "layerPanelState", new _r());
3745
3745
  u(this, "shadow", null);
3746
3746
  u(this, "layerPanelRefs", null);
3747
3747
  u(this, "propertyPanelRefs", null);
@@ -3773,32 +3773,32 @@ class ps {
3773
3773
  u(this, "activeLayerColorPreview", null);
3774
3774
  u(this, "renderedLayerRows", null);
3775
3775
  u(this, "handleKeyDown", (e) => {
3776
- if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || lt(e)) return;
3776
+ if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || ut(e)) return;
3777
3777
  const t = this.getFitShortcut();
3778
3778
  t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
3779
3779
  });
3780
3780
  u(this, "handleKeyboardTargetPointerDown", (e) => {
3781
3781
  var t, i;
3782
- this.disposed || lt(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3782
+ this.disposed || ut(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3783
3783
  });
3784
3784
  u(this, "unsubscribers", []);
3785
3785
  u(this, "filterCleanup", null);
3786
3786
  u(this, "disposed", !1);
3787
3787
  u(this, "persistenceNamespace");
3788
- u(this, "insertToggleScheduler", new as({
3788
+ u(this, "insertToggleScheduler", new ds({
3789
3789
  onFlush: (e) => {
3790
3790
  this.host.cad.blocks.batchToggleInserts(e);
3791
3791
  }
3792
3792
  }));
3793
3793
  u(this, "refresh", () => {
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());
3794
+ this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (rt(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
3795
3795
  });
3796
3796
  u(this, "syncHud", () => {
3797
3797
  var e;
3798
3798
  if (!(this.disposed || !this.active)) {
3799
3799
  if (this.infobarRefs && this.parts.hud) {
3800
3800
  const t = this.host.cad.hud;
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 ? hs(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 ? ms(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3802
3802
  const i = Math.round(t.fps);
3803
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);
3804
3804
  const r = t.blockVariantCount > 0 || t.splitBlockLayerGroupCount > 0 || t.entityCount > 0;
@@ -3809,7 +3809,7 @@ class ps {
3809
3809
  blocks: this.text.formatInteger(t.blockVariantCount),
3810
3810
  split: this.text.formatInteger(t.splitBlockLayerGroupCount)
3811
3811
  });
3812
- const n = t.renderDebugBreakdown.map((d) => at(
3812
+ const n = t.renderDebugBreakdown.map((d) => dt(
3813
3813
  d.label,
3814
3814
  this.text.t("toolbar.debug.breakdown", {
3815
3815
  renderables: this.text.formatInteger(d.renderables),
@@ -3821,8 +3821,8 @@ class ps {
3821
3821
  calls: this.text.formatInteger(t.drawCalls)
3822
3822
  })
3823
3823
  ];
3824
- n.length > 0 && a.push(ot(n));
3825
- const o = t.splitBlockLayerDetails.map((d) => at(
3824
+ n.length > 0 && a.push(ct(n));
3825
+ const o = t.splitBlockLayerDetails.map((d) => dt(
3826
3826
  `${d.blockName} #${d.variantId}`,
3827
3827
  this.text.t("toolbar.debug.spreadMeta", {
3828
3828
  layers: this.text.formatInteger(d.layerCount),
@@ -3839,7 +3839,7 @@ class ps {
3839
3839
  const l = [this.text.t("toolbar.debug.splitLayerCount", {
3840
3840
  count: this.text.formatInteger(t.splitBlockLayerGroupCount)
3841
3841
  })];
3842
- o.length > 0 && l.push(ot(o)), this.infobarRefs.debugBody.replaceChildren(
3842
+ o.length > 0 && l.push(ct(o)), this.infobarRefs.debugBody.replaceChildren(
3843
3843
  B("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
3844
3844
  ...t.lineRenderMode ? [B(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
3845
3845
  B(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
@@ -3859,7 +3859,7 @@ class ps {
3859
3859
  const t = this.host.cad.hud, i = t.fileCount > 0 ? this.text.t("toolbar.layerSummary", {
3860
3860
  visible: this.text.formatInteger(t.visibleLayerCount),
3861
3861
  total: this.text.formatInteger(t.totalLayerCount)
3862
- }) : "", r = Hr(t.statusMessage, this.text);
3862
+ }) : "", r = Xr(t.statusMessage, this.text);
3863
3863
  this.toolbarInfoText.textContent = i && r ? `${i} | ${r}` : i || r;
3864
3864
  }
3865
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(
@@ -3870,14 +3870,14 @@ class ps {
3870
3870
  }
3871
3871
  });
3872
3872
  var i, r, n, a;
3873
- this.host = e, this.options = t, this.parts = { ...ds, ...(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-${++us}`;
3873
+ this.host = e, this.options = t, this.parts = { ...hs, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Nt({ ...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-${++fs}`;
3874
3874
  }
3875
3875
  mount() {
3876
3876
  var o, l;
3877
3877
  if (this.disposed) return;
3878
3878
  this.shadow = ((o = this.host.layout) == null ? void 0 : o.shadowRoot()) ?? this.options.root.shadowRoot ?? this.options.root.attachShadow({ mode: "open" });
3879
3879
  const e = this.theme, t = document.createElement("style");
3880
- t.dataset.viewerUiTheme = "", t.textContent = fe(e, this.options.tokens), this.themeStyle = t;
3880
+ t.dataset.viewerUiTheme = "", t.textContent = ve(e, this.options.tokens), this.themeStyle = t;
3881
3881
  const i = document.createElement("div");
3882
3882
  i.className = "vui-root", i.dataset.theme = e, i.dataset.preset = this.options.preset ?? "auto";
3883
3883
  const r = document.createElement("div");
@@ -3904,11 +3904,11 @@ class ps {
3904
3904
  this.themeValue = e;
3905
3905
  const t = this.shadow.querySelector(".vui-root");
3906
3906
  if (t && (t.dataset.theme = e), this.themeStyle) {
3907
- this.themeStyle.textContent = fe(e, this.options.tokens);
3907
+ this.themeStyle.textContent = ve(e, this.options.tokens);
3908
3908
  return;
3909
3909
  }
3910
3910
  const i = document.createElement("style");
3911
- i.dataset.viewerUiTheme = "", i.textContent = fe(e, this.options.tokens), (r = this.shadow.querySelector("style[data-viewer-ui-theme]")) == null || r.replaceWith(i), this.themeStyle = i;
3911
+ i.dataset.viewerUiTheme = "", i.textContent = ve(e, this.options.tokens), (r = this.shadow.querySelector("style[data-viewer-ui-theme]")) == null || r.replaceWith(i), this.themeStyle = i;
3912
3912
  }
3913
3913
  get theme() {
3914
3914
  return this.themeValue;
@@ -3969,8 +3969,8 @@ class ps {
3969
3969
  d.type = "button", d.className = "vui-btn", d.textContent = this.text.t("layer.hideAll"), d.addEventListener("click", () => this.host.cad.layers.hideAll());
3970
3970
  const c = document.createElement("button");
3971
3971
  c.type = "button", c.className = "vui-btn", c.textContent = this.text.t("layer.collapse"), c.title = this.text.t("layer.collapseTitle"), c.addEventListener("click", () => {
3972
- var m;
3973
- const v = (m = this.host.cad.inspector.selection) == null ? void 0 : m.id, y = v ? `${v.layerIndex}:${v.variantId}:${v.instanceId}` : null;
3972
+ var f;
3973
+ const v = (f = this.host.cad.inspector.selection) == null ? void 0 : f.id, y = v ? `${v.layerIndex}:${v.variantId}:${v.instanceId}` : null;
3974
3974
  this.layerPanelState.collapseAll(y), this.refresh();
3975
3975
  }), o.append(l, d, c);
3976
3976
  const p = document.createElement("div");
@@ -3981,8 +3981,8 @@ class ps {
3981
3981
  };
3982
3982
  const h = document.createElement("div");
3983
3983
  h.className = "vui-layer-panel-toggle-zone";
3984
- const f = document.createElement("button");
3985
- return f.type = "button", f.className = "vui-layer-panel-toggle", f.addEventListener("click", () => this.setLayerPanelOpen(e.classList.contains("closed"))), h.appendChild(f), e.append(t, h), this.layerPanelShell = e, this.layerPanelToggle = f, e;
3984
+ const m = document.createElement("button");
3985
+ return m.type = "button", m.className = "vui-layer-panel-toggle", m.addEventListener("click", () => this.setLayerPanelOpen(e.classList.contains("closed"))), h.appendChild(m), e.append(t, h), this.layerPanelShell = e, this.layerPanelToggle = m, e;
3986
3986
  }
3987
3987
  buildScalebar() {
3988
3988
  const e = document.createElement("div");
@@ -4006,12 +4006,12 @@ class ps {
4006
4006
  const a = document.createElement("span");
4007
4007
  if (a.className = "vui-info-text", this.toolbarInfoText = a, n.appendChild(a), this.parts.fit) {
4008
4008
  this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
4009
- const m = this.getFitShortcut();
4010
- this.btnFit.innerHTML = m ? `${R(this.text.t("toolbar.fit"))} <span class="vui-kbd">${R(m.toUpperCase())}</span>` : R(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
4009
+ const f = this.getFitShortcut();
4010
+ this.btnFit.innerHTML = f ? `${R(this.text.t("toolbar.fit"))} <span class="vui-kbd">${R(f.toUpperCase())}</span>` : R(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
4011
4011
  }
4012
4012
  if (this.parts.viewMode) {
4013
- const m = document.createElement("div");
4014
- m.className = "vui-view-toggle", m.setAttribute("role", "group"), m.setAttribute("aria-label", this.text.t("toolbar.viewMode")), this.btnView2d = document.createElement("button"), this.btnView2d.type = "button", this.btnView2d.className = "vui-btn", this.btnView2d.textContent = "2D", this.btnView2d.setAttribute("aria-pressed", "false"), this.btnView2d.addEventListener("click", () => this.host.setViewMode("2d")), this.btnView3d = document.createElement("button"), this.btnView3d.type = "button", this.btnView3d.className = "vui-btn", this.btnView3d.textContent = "3D", this.btnView3d.setAttribute("aria-pressed", "false"), this.btnView3d.addEventListener("click", () => this.host.setViewMode("3d")), m.append(this.btnView2d, this.btnView3d), n.appendChild(m);
4013
+ const f = document.createElement("div");
4014
+ f.className = "vui-view-toggle", f.setAttribute("role", "group"), f.setAttribute("aria-label", this.text.t("toolbar.viewMode")), this.btnView2d = document.createElement("button"), this.btnView2d.type = "button", this.btnView2d.className = "vui-btn", this.btnView2d.textContent = "2D", this.btnView2d.setAttribute("aria-pressed", "false"), this.btnView2d.addEventListener("click", () => this.host.setViewMode("2d")), this.btnView3d = document.createElement("button"), this.btnView3d.type = "button", this.btnView3d.className = "vui-btn", this.btnView3d.textContent = "3D", this.btnView3d.setAttribute("aria-pressed", "false"), this.btnView3d.addEventListener("click", () => this.host.setViewMode("3d")), f.append(this.btnView2d, this.btnView3d), n.appendChild(f);
4015
4015
  }
4016
4016
  const o = document.createElement("span");
4017
4017
  o.className = "vui-seg";
@@ -4025,12 +4025,12 @@ class ps {
4025
4025
  p.className = "vui-seg";
4026
4026
  const h = document.createElement("span");
4027
4027
  h.className = "vui-fps";
4028
- const f = document.createElement("details");
4029
- f.className = "vui-debug-card";
4028
+ const m = document.createElement("details");
4029
+ m.className = "vui-debug-card";
4030
4030
  const v = document.createElement("summary");
4031
4031
  v.className = "vui-debug-summary", v.textContent = this.text.t("toolbar.details");
4032
4032
  const y = document.createElement("div");
4033
- return y.className = "vui-debug-body", f.append(v, y), i.append(r, n, o, l, d, c, p, h, f), e.append(t, i), this.infobarRefs = {
4033
+ return y.className = "vui-debug-body", m.append(v, y), i.append(r, n, o, l, d, c, p, h, m), e.append(t, i), this.infobarRefs = {
4034
4034
  infobar: e,
4035
4035
  file: r,
4036
4036
  tools: n,
@@ -4040,7 +4040,7 @@ class ps {
4040
4040
  lineMode: c,
4041
4041
  phase: p,
4042
4042
  fps: h,
4043
- debugCard: f,
4043
+ debugCard: m,
4044
4044
  debugSummary: v,
4045
4045
  debugBody: y
4046
4046
  }, this.infobar = e, this.infobarToggle = t, e;
@@ -4064,8 +4064,8 @@ class ps {
4064
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;
4065
4065
  }
4066
4066
  bindEvents() {
4067
- this.layerPanelRefs && (this.filterCleanup = es(this.layerPanelRefs.filterInput, (e) => {
4068
- this.layerPanelState.filterText = e, this.layerPanelRefs && Wr(this.layerPanelRefs.list, e);
4067
+ this.layerPanelRefs && (this.filterCleanup = rs(this.layerPanelRefs.filterInput, (e) => {
4068
+ this.layerPanelState.filterText = e, this.layerPanelRefs && Zr(this.layerPanelRefs.list, e);
4069
4069
  })), this.unsubscribers.push(
4070
4070
  this.host.cad.on("document-change", () => this.refresh()),
4071
4071
  this.host.cad.on("layer-change", () => this.syncLayerChange()),
@@ -4073,9 +4073,9 @@ class ps {
4073
4073
  this.host.cad.on("inspector-change", () => {
4074
4074
  if (this.layerPanelRefs && this.parts.layerPanel) {
4075
4075
  const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
4076
- i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : Gr(this.layerPanelRefs.list, e);
4076
+ i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : Jr(this.layerPanelRefs.list, e);
4077
4077
  }
4078
- this.propertyPanelRefs && this.parts.propertyPanel && (et(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4078
+ this.propertyPanelRefs && this.parts.propertyPanel && (rt(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4079
4079
  }),
4080
4080
  this.host.cad.on("hud-change", () => this.syncHud()),
4081
4081
  this.host.on("view-mode-change", () => {
@@ -4134,7 +4134,7 @@ class ps {
4134
4134
  return !!(e && e.isConnected && ((t = this.layerPanelRefs) != null && t.list.contains(e)));
4135
4135
  }
4136
4136
  renderLayerPanel() {
4137
- !this.layerPanelRefs || !this.parts.layerPanel || (Zr(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4137
+ !this.layerPanelRefs || !this.parts.layerPanel || (es(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4138
4138
  }
4139
4139
  syncLayerChange() {
4140
4140
  if (!this.isLayerColorPreviewActive()) {
@@ -4142,7 +4142,7 @@ class ps {
4142
4142
  this.refresh();
4143
4143
  return;
4144
4144
  }
4145
- Kr(
4145
+ Qr(
4146
4146
  this.layerPanelRefs.list,
4147
4147
  this.host.cad.layers.rows,
4148
4148
  this.host.cad.layers.allColor,
@@ -4164,7 +4164,7 @@ class ps {
4164
4164
  var e;
4165
4165
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
4166
4166
  try {
4167
- return this.readState(it) === "1";
4167
+ return this.readState(nt) === "1";
4168
4168
  } catch {
4169
4169
  return !1;
4170
4170
  }
@@ -4173,7 +4173,7 @@ class ps {
4173
4173
  var e;
4174
4174
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
4175
4175
  try {
4176
- return this.readState(rt) !== "0";
4176
+ return this.readState(at) !== "0";
4177
4177
  } catch {
4178
4178
  return !0;
4179
4179
  }
@@ -4186,7 +4186,7 @@ class ps {
4186
4186
  panel: this.text.t("panel.layers")
4187
4187
  })), !!t && (this.emitUiLayoutChange(), ((n = this.options.cad) == null ? void 0 : n.persistence) !== !1)))
4188
4188
  try {
4189
- this.writeState(rt, e ? "1" : "0");
4189
+ this.writeState(at, e ? "1" : "0");
4190
4190
  } catch {
4191
4191
  }
4192
4192
  }
@@ -4202,7 +4202,7 @@ class ps {
4202
4202
  panel: this.text.t("panel.properties")
4203
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)))
4204
4204
  try {
4205
- this.writeState(it, e ? "1" : "0");
4205
+ this.writeState(nt, e ? "1" : "0");
4206
4206
  } catch {
4207
4207
  }
4208
4208
  }
@@ -4300,7 +4300,7 @@ class ps {
4300
4300
  return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
4301
4301
  }
4302
4302
  isPropertyPreviewLayoutReady(e) {
4303
- return e.clientWidth >= nt && e.clientHeight >= nt;
4303
+ return e.clientWidth >= lt && e.clientHeight >= lt;
4304
4304
  }
4305
4305
  waitForPropertyPreviewLayout(e) {
4306
4306
  if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
@@ -4312,34 +4312,34 @@ class ps {
4312
4312
  const p = () => {
4313
4313
  for (const b of l) window.clearTimeout(b);
4314
4314
  for (const b of d) b();
4315
- window.clearTimeout(m), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4315
+ window.clearTimeout(f), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4316
4316
  }, h = () => {
4317
4317
  n || (n = !0, p(), r());
4318
- }, f = () => {
4318
+ }, m = () => {
4319
4319
  const b = e.clientWidth;
4320
4320
  if (!this.isPropertyPreviewLayoutReady(e)) {
4321
4321
  a = 0, o = -1;
4322
4322
  return;
4323
4323
  }
4324
4324
  if (b === o) {
4325
- a += 1, a >= cs && h();
4325
+ a += 1, a >= ps && h();
4326
4326
  return;
4327
4327
  }
4328
4328
  o = b, a = 0;
4329
4329
  }, v = (b) => {
4330
- if (!fs(b)) return;
4330
+ if (!gs(b)) return;
4331
4331
  let g = !1;
4332
4332
  const x = (C) => {
4333
4333
  C.target !== b || C.propertyName !== "width" || w();
4334
4334
  }, w = () => {
4335
- g || (g = !0, b.removeEventListener("transitionend", x), requestAnimationFrame(f));
4335
+ g || (g = !0, b.removeEventListener("transitionend", x), requestAnimationFrame(m));
4336
4336
  };
4337
- b.addEventListener("transitionend", x), l.push(window.setTimeout(w, st)), d.push(() => {
4337
+ b.addEventListener("transitionend", x), l.push(window.setTimeout(w, ot)), d.push(() => {
4338
4338
  g || (g = !0, b.removeEventListener("transitionend", x));
4339
4339
  });
4340
4340
  }, y = () => {
4341
- f(), n || (c = requestAnimationFrame(y));
4342
- }, m = window.setTimeout(h, st);
4341
+ m(), n || (c = requestAnimationFrame(y));
4342
+ }, f = window.setTimeout(h, ot);
4343
4343
  v(i), v(t), c = requestAnimationFrame(y), this.propertyPreviewLayoutWaitAbort = () => {
4344
4344
  n = !0, p();
4345
4345
  };
@@ -4357,7 +4357,7 @@ class ps {
4357
4357
  this.propertyPreviewRenderHandle !== null && (cancelAnimationFrame(this.propertyPreviewRenderHandle), this.propertyPreviewRenderHandle = null), (e = this.propertyPreviewLayoutWaitAbort) == null || e.call(this), this.propertyPreviewLayoutWaitAbort = null;
4358
4358
  }
4359
4359
  }
4360
- function fs(s) {
4360
+ function gs(s) {
4361
4361
  const e = getComputedStyle(s), t = e.transitionDuration.split(",").map((r) => r.trim()), i = e.transitionProperty.split(",").map((r) => r.trim());
4362
4362
  for (let r = 0; r < i.length; r += 1) {
4363
4363
  const n = i[r] ?? i[0] ?? "all";
@@ -4366,8 +4366,8 @@ function fs(s) {
4366
4366
  }
4367
4367
  return !1;
4368
4368
  }
4369
- const ms = ["left", "right", "top", "bottom"], te = 0.5, vs = /* @__PURE__ */ new Set(["cad", "scene"]);
4370
- class gs {
4369
+ const bs = ["left", "right", "top", "bottom"], ie = 0.5, ys = /* @__PURE__ */ new Set(["cad", "scene"]);
4370
+ class xs {
4371
4371
  constructor(e) {
4372
4372
  u(this, "zoneContainers", /* @__PURE__ */ new Map());
4373
4373
  u(this, "mounts", /* @__PURE__ */ new Set());
@@ -4377,7 +4377,7 @@ class gs {
4377
4377
  u(this, "flags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4378
4378
  u(this, "lastInsets", Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 }));
4379
4379
  u(this, "lastFlags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4380
- u(this, "activeGroups", vs);
4380
+ u(this, "activeGroups", ys);
4381
4381
  u(this, "warnedUnstableReference", !1);
4382
4382
  u(this, "disposed", !1);
4383
4383
  u(this, "frameHandle", null);
@@ -4387,7 +4387,7 @@ class gs {
4387
4387
  const t = this.canMeasure();
4388
4388
  this.resizeObserver = t && typeof ResizeObserver == "function" ? new ResizeObserver(() => this.schedule()) : null, t && typeof globalThis.window < "u" && globalThis.window.addEventListener("resize", this.handleWindowResize);
4389
4389
  const i = this.host.reference(), r = this.host.target();
4390
- i && z(i) && ((n = this.resizeObserver) == null || n.observe(i)), r && r !== i && z(r) && ((a = this.resizeObserver) == null || a.observe(r));
4390
+ i && N(i) && ((n = this.resizeObserver) == null || n.observe(i)), r && r !== i && N(r) && ((a = this.resizeObserver) == null || a.observe(r));
4391
4391
  }
4392
4392
  mountBuiltin(e, t) {
4393
4393
  return this.mountNode(e, t.zone, !0, t.group);
@@ -4424,7 +4424,7 @@ class gs {
4424
4424
  }
4425
4425
  canMeasure() {
4426
4426
  const e = this.host.reference();
4427
- return !!(e && z(e) && typeof e.getBoundingClientRect == "function");
4427
+ return !!(e && N(e) && typeof e.getBoundingClientRect == "function");
4428
4428
  }
4429
4429
  dispose() {
4430
4430
  var e;
@@ -4438,13 +4438,13 @@ class gs {
4438
4438
  }
4439
4439
  mountNode(e, t, i, r) {
4440
4440
  var l;
4441
- const n = me(t, i, r), a = this.ensureZoneContainer(t, i, r);
4441
+ const n = ge(t, i, r), a = this.ensureZoneContainer(t, i, r);
4442
4442
  a.append(e);
4443
4443
  const o = { node: e, zone: t, builtin: i, group: r, container: a, key: n };
4444
- return this.mounts.add(o), z(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
4444
+ return this.mounts.add(o), N(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
4445
4445
  dispose: () => {
4446
4446
  var d, c;
4447
- this.mounts.delete(o) && (z(e) ? ((d = this.resizeObserver) == null || d.unobserve(e), e.remove()) : e.parentNode === a && a.removeChild(e), this.containerHasMounts(n) || ((c = this.resizeObserver) == null || c.unobserve(a), a.remove(), this.zoneContainers.delete(n)), this.schedule());
4447
+ this.mounts.delete(o) && (N(e) ? ((d = this.resizeObserver) == null || d.unobserve(e), e.remove()) : e.parentNode === a && a.removeChild(e), this.containerHasMounts(n) || ((c = this.resizeObserver) == null || c.unobserve(a), a.remove(), this.zoneContainers.delete(n)), this.schedule());
4448
4448
  }
4449
4449
  };
4450
4450
  }
@@ -4454,7 +4454,7 @@ class gs {
4454
4454
  }
4455
4455
  ensureZoneContainer(e, t, i) {
4456
4456
  var l;
4457
- const r = me(e, t, i), n = this.zoneContainers.get(r);
4457
+ const r = ge(e, t, i), n = this.zoneContainers.get(r);
4458
4458
  if (n) return n;
4459
4459
  const a = document.createElement("div");
4460
4460
  a.dataset.viewerZone = e, a.dataset.viewerZoneOwner = t ? "builtin" : "plugin", i && (a.dataset.viewerZoneGroup = i), a.dataset.viewerZoneActive = String(!i || this.activeGroups.has(i));
@@ -4463,12 +4463,12 @@ class gs {
4463
4463
  }
4464
4464
  /** Test/debug seam. Prefer querying the relevant host by data attributes. */
4465
4465
  getOwnerZoneElement(e, t = !1, i) {
4466
- return this.zoneContainers.get(me(e, t, i)) ?? null;
4466
+ return this.zoneContainers.get(ge(e, t, i)) ?? null;
4467
4467
  }
4468
4468
  installZoneStyles(e, t) {
4469
4469
  if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
4470
4470
  const i = document.createElement("style");
4471
- i.dataset.viewerLayout = t, i.textContent = xs, 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 = Es, e.append(i), this.installedStyles.push(i), N(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4472
4472
  }
4473
4473
  schedule() {
4474
4474
  if (!(this.disposed || this.frameHandle !== null)) {
@@ -4485,7 +4485,7 @@ class gs {
4485
4485
  if (this.disposed) return;
4486
4486
  const e = this.host.reference(), t = this.host.target();
4487
4487
  if (!e || typeof e.getBoundingClientRect != "function") return;
4488
- const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !ys(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 = !Cs(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4489
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));
4490
4490
  }
4491
4491
  applyInsets(e, t) {
@@ -4504,9 +4504,9 @@ class gs {
4504
4504
  }
4505
4505
  for (const i of this.zoneContainers.values()) {
4506
4506
  const r = i.dataset.viewerZone;
4507
- if (!(!r || !ms.includes(r) || !this.isZoneVisible(i)))
4507
+ if (!(!r || !bs.includes(r) || !this.isZoneVisible(i)))
4508
4508
  for (const n of Array.from(i.children)) {
4509
- if (!bs(n)) continue;
4509
+ if (!ws(n)) continue;
4510
4510
  const a = n.getBoundingClientRect();
4511
4511
  this.accumulateInset(
4512
4512
  t,
@@ -4517,10 +4517,10 @@ class gs {
4517
4517
  }
4518
4518
  }
4519
4519
  return Object.freeze({
4520
- top: ie(t.top, e.height),
4521
- right: ie(t.right, e.width),
4522
- bottom: ie(t.bottom, e.height),
4523
- left: ie(t.left, e.width)
4520
+ top: re(t.top, e.height),
4521
+ right: re(t.right, e.width),
4522
+ bottom: re(t.bottom, e.height),
4523
+ left: re(t.left, e.width)
4524
4524
  });
4525
4525
  }
4526
4526
  accumulateInset(e, t, i, r) {
@@ -4536,29 +4536,29 @@ class gs {
4536
4536
  return !t || this.activeGroups.has(t);
4537
4537
  }
4538
4538
  assertStableReference(e, t) {
4539
- return !t || t === e || !z(e) || !z(t) || !e.contains(t) ? !0 : (this.warnedUnstableReference || (this.warnedUnstableReference = !0, console.warn("[viewer] ui.root must not contain the inset target; content insets will be broadcast but not applied. Use a shell-level ui.root so insets stay stable.")), !1);
4539
+ return !t || t === e || !N(e) || !N(t) || !e.contains(t) ? !0 : (this.warnedUnstableReference || (this.warnedUnstableReference = !0, console.warn("[viewer] ui.root must not contain the inset target; content insets will be broadcast but not applied. Use a shell-level ui.root so insets stay stable.")), !1);
4540
4540
  }
4541
4541
  }
4542
- function me(s, e, t) {
4542
+ function ge(s, e, t) {
4543
4543
  return `${e ? "builtin" : "plugin"}:${t ?? ""}:${s}`;
4544
4544
  }
4545
- function z(s) {
4545
+ function N(s) {
4546
4546
  return !!(s && typeof s == "object" && s.nodeType === 1);
4547
4547
  }
4548
- function bs(s) {
4549
- if (!z(s) || s.hidden) return !1;
4548
+ function ws(s) {
4549
+ if (!N(s) || s.hidden) return !1;
4550
4550
  const e = typeof getComputedStyle == "function" ? getComputedStyle(s) : null;
4551
4551
  return !(e && (e.display === "none" || e.visibility === "hidden"));
4552
4552
  }
4553
- function ie(s, e) {
4553
+ function re(s, e) {
4554
4554
  if (!Number.isFinite(s)) return 0;
4555
4555
  const t = e > 0 ? Math.min(s, e) : s;
4556
4556
  return Math.max(0, Math.round(t * 2) / 2);
4557
4557
  }
4558
- function ys(s, e) {
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;
4558
+ function Cs(s, e) {
4559
+ return Math.abs(s.top - e.top) <= ie && Math.abs(s.right - e.right) <= ie && Math.abs(s.bottom - e.bottom) <= ie && Math.abs(s.left - e.left) <= ie;
4560
4560
  }
4561
- const xs = `
4561
+ const Es = `
4562
4562
  [data-viewer-zone] { position: absolute; pointer-events: none; z-index: 1; }
4563
4563
  [data-viewer-zone] > * { pointer-events: auto; }
4564
4564
  [data-viewer-zone="left"] { left: 0; top: 0; bottom: 0; }
@@ -4567,7 +4567,7 @@ const xs = `
4567
4567
  [data-viewer-zone="bottom"] { left: 0; right: 0; bottom: 0; }
4568
4568
  [data-viewer-zone="overlay"] { inset: 0; }
4569
4569
  [data-viewer-zone][data-viewer-zone-active="false"] { display: none; }
4570
- `, ws = {
4570
+ `, Ss = {
4571
4571
  play: '<path d="m8 5 11 7-11 7Z"/>',
4572
4572
  pause: '<path d="M8 5v14M16 5v14"/>',
4573
4573
  reset: '<path d="M3 10a9 9 0 1 1 2.5 8M3 4v6h6"/>',
@@ -4581,21 +4581,22 @@ const xs = `
4581
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"/>',
4582
4582
  moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
4583
4583
  };
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">${ws[s]}</svg>`;
4584
+ function _t(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">${Ss[s]}</svg>`;
4586
4586
  }
4587
- const Cs = {
4587
+ const ks = {
4588
4588
  filename: !0,
4589
4589
  playback: !0,
4590
4590
  reset: !0,
4591
4591
  fit: !0,
4592
4592
  upAxis: !0,
4593
+ scaleRuler: !0,
4593
4594
  ground: !0,
4594
4595
  collision: !0,
4595
4596
  theme: !0
4596
4597
  };
4597
- function Es(s, e) {
4598
- const t = { ...Cs, ...e.parts }, i = document.createElement("nav");
4598
+ function Ps(s, e) {
4599
+ const t = { ...ks, ...e.parts }, i = document.createElement("nav");
4599
4600
  i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
4600
4601
  const r = document.createElement("span");
4601
4602
  r.className = "vpu-filename", r.hidden = !0;
@@ -4603,14 +4604,14 @@ function Es(s, e) {
4603
4604
  n.className = "vpu-actions", i.append(r, n);
4604
4605
  const a = /* @__PURE__ */ new Map();
4605
4606
  let o = null, l = null, d = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, c = e.theme ?? "dark", p = null;
4606
- const h = (m, b, g, x, w) => {
4607
+ const h = (f, b, g, x, w) => {
4607
4608
  const C = document.createElement("button");
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;
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) => {
4609
+ return C.type = "button", C.className = "vpu-btn", C.dataset.viewerControl = b, C.dataset.viewerControlId = f, C.innerHTML = _t(x), C.title = g, C.setAttribute("aria-label", g), C.addEventListener("click", w), a.set(f, { button: C, icon: x }), n.append(C), C;
4610
+ }, m = (f, b) => f ? b === "filename" ? t.filename : b === "playback" ? t.playback && f.canPlay : b === "reset" ? t.reset && f.canReset : b === "fit" ? t.fit : b === "upAxis" ? t.upAxis && f.canReorientUpAxis === !0 : b === "ground" ? t.ground && f.canToggleGround === !0 : b === "collision" ? t.collision && f.canToggleCollision === !0 : t.theme : !1, v = (f) => {
4610
4611
  var g, x, w;
4611
- p = m, n.replaceChildren(), a.clear(), o = null, l = null;
4612
- const b = (m == null ? void 0 : m.capabilities) ?? null;
4613
- if (d = (b == null ? void 0 : b.hasAnimation) === !0 && b.hasPhysics !== !0 ? { play: "播放动画", pause: "暂停动画", reset: "重置动画" } : { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, r.hidden = !(t.filename && (m != null && m.filename)), r.textContent = (m == null ? void 0 : m.filename) ?? "", r.title = (m == null ? void 0 : m.filename) ?? "", m && f(b, "playback")) {
4612
+ p = f, n.replaceChildren(), a.clear(), o = null, l = null;
4613
+ const b = (f == null ? void 0 : f.capabilities) ?? null;
4614
+ if (d = (b == null ? void 0 : b.hasAnimation) === !0 && b.hasPhysics !== !0 ? { play: "播放动画", pause: "暂停动画", reset: "重置动画" } : { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, r.hidden = !(t.filename && (f != null && f.filename)), r.textContent = (f == null ? void 0 : f.filename) ?? "", r.title = (f == null ? void 0 : f.filename) ?? "", f && m(b, "playback")) {
4614
4615
  const C = "playback";
4615
4616
  l = C;
4616
4617
  const D = h(C, "playback", d.play, "play", () => {
@@ -4618,25 +4619,25 @@ function Es(s, e) {
4618
4619
  });
4619
4620
  D.className = "vpu-btn vpu-btn-primary";
4620
4621
  }
4621
- if ((m == null ? void 0 : m.kind) === "simulation" && m.phase === "ready" && t.playback && !(b != null && b.canPlay) && (((g = m.physics) == null ? void 0 : g.status) === "unavailable" || !m.physics && ((x = m.warning) == null ? void 0 : x.stage) === "physics-fallback")) {
4622
- const C = ((w = m.physics) == null ? void 0 : w.status) === "unavailable" ? m.physics.issue.message : m.warning.message, D = h("playback", "playback", C, "play", () => {
4622
+ if ((f == null ? void 0 : f.kind) === "simulation" && f.phase === "ready" && t.playback && !(b != null && b.canPlay) && (((g = f.physics) == null ? void 0 : g.status) === "unavailable" || !f.physics && ((x = f.warning) == null ? void 0 : x.stage) === "physics-fallback")) {
4623
+ const C = ((w = f.physics) == null ? void 0 : w.status) === "unavailable" ? f.physics.issue.message : f.warning.message, D = h("playback", "playback", C, "play", () => {
4623
4624
  });
4624
4625
  D.setAttribute("aria-disabled", "true"), D.className = "vpu-btn vpu-btn-primary";
4625
4626
  }
4626
- if (m && f(b, "reset") && h("reset", "reset", d.reset, "reset", () => {
4627
+ if (f && m(b, "reset") && h("reset", "reset", d.reset, "reset", () => {
4627
4628
  s.commands.reset();
4628
- }), m && f(b, "fit") && h("fit", "fit", "视角适应", "fit", () => {
4629
+ }), f && m(b, "fit") && h("fit", "fit", "视角适应", "fit", () => {
4629
4630
  s.commands.fitView();
4630
- }), m && f(b, "upAxis") && (o = "切换上轴", h("upAxis", "upAxis", o, "upAxisZ", () => {
4631
+ }), f && m(b, "upAxis") && (o = "切换上轴", h("upAxis", "upAxis", o, "upAxisZ", () => {
4631
4632
  const C = s.asset.$readControl().upAxis ?? "z";
4632
4633
  s.commands.setUpAxis(C === "z" ? "y" : "z");
4633
- })), m && f(b, "ground") && h("ground", "ground", "显示地面", "ground", () => {
4634
+ })), f && m(b, "ground") && h("ground", "ground", "显示地面", "ground", () => {
4634
4635
  const C = s.asset.$readControl().groundVisible;
4635
4636
  s.commands.setGroundVisible(!C);
4636
- }), m && f(b, "collision") && h("collision", "collision", "显示碰撞代理", "collision", () => {
4637
+ }), f && m(b, "collision") && h("collision", "collision", ht(!1), "collision", () => {
4637
4638
  const C = s.asset.$readControl().collisionVisible;
4638
4639
  s.commands.setCollisionVisible(!C);
4639
- }), m && f(b, "theme")) {
4640
+ }), f && m(b, "theme")) {
4640
4641
  const C = c === "dark";
4641
4642
  h(
4642
4643
  "theme",
@@ -4647,38 +4648,85 @@ function Es(s, e) {
4647
4648
  );
4648
4649
  }
4649
4650
  i.hidden = n.childElementCount === 0 && r.hidden, y(s.asset.$readControl());
4650
- }, y = (m) => {
4651
+ }, y = (f) => {
4651
4652
  const b = l ? a.get(l) : void 0;
4652
- b && (re(b.button, m.playing ? d.pause : d.play, m.playing ? "pause" : "play", m.playing), b.icon = m.playing ? "pause" : "play");
4653
+ b && (se(b.button, f.playing ? d.pause : d.play, f.playing ? "pause" : "play", f.playing), b.icon = f.playing ? "pause" : "play");
4653
4654
  const g = a.get("ground");
4654
- g && re(g.button, m.groundVisible ? "隐藏地面" : "显示地面", "ground", m.groundVisible);
4655
+ g && se(g.button, f.groundVisible ? "隐藏地面" : "显示地面", "ground", f.groundVisible);
4655
4656
  const x = a.get("collision");
4656
- x && re(x.button, m.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", m.collisionVisible);
4657
+ x && se(x.button, ht(f.collisionVisible), "collision", f.collisionVisible);
4657
4658
  const w = a.get("upAxis");
4658
- w && re(w.button, ks(m.upAxis), Ss(m.upAxis), m.upAxis === "y");
4659
+ w && se(w.button, Rs(f.upAxis), As(f.upAxis), f.upAxis === "y");
4659
4660
  };
4660
4661
  return {
4661
4662
  element: i,
4662
- update: (m) => v(m),
4663
+ update: (f) => v(f),
4663
4664
  pressedChanged: () => y(s.asset.$readControl()),
4664
- themeChanged: (m) => {
4665
- c = m, i.dataset.theme = m, v(p);
4665
+ themeChanged: (f) => {
4666
+ c = f, i.dataset.theme = f, v(p);
4666
4667
  },
4667
4668
  dispose: () => {
4668
4669
  i.remove();
4669
4670
  }
4670
4671
  };
4671
4672
  }
4672
- function re(s, e, t, 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);
4673
+ function se(s, e, t, i) {
4674
+ s.innerHTML = _t(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4674
4675
  }
4675
- function Ss(s) {
4676
+ function As(s) {
4676
4677
  return s === "y" ? "upAxisY" : "upAxisZ";
4677
4678
  }
4678
- function ks(s) {
4679
+ function Rs(s) {
4679
4680
  return s === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
4680
4681
  }
4681
- class Ps {
4682
+ function ht(s) {
4683
+ return `${s ? "隐藏碰撞代理" : "显示碰撞代理"}(青绿=精确代理,橙黄=碰撞源网格近似)`;
4684
+ }
4685
+ const Q = 1;
4686
+ function sa(s) {
4687
+ if (!Number.isFinite(s) || s <= 0) return Q;
4688
+ const e = s / 16, t = 10 ** Math.floor(Math.log10(e)), i = e / t;
4689
+ return (i >= 5 ? 5 : i >= 2.5 ? 2.5 : i >= 2 ? 2 : 1) * t;
4690
+ }
4691
+ function Is(s) {
4692
+ return Ms(s);
4693
+ }
4694
+ function Ms(s) {
4695
+ return !Number.isFinite(s) || s <= 0 ? "" : s >= 1e3 ? `${ne(s / 1e3)} km` : s >= 1 ? `${ne(s)} m` : s >= 0.01 ? `${ne(s * 100)} cm` : `${ne(s * 1e3)} mm`;
4696
+ }
4697
+ function ne(s) {
4698
+ return Number(s.toFixed(s >= 10 ? 0 : s >= 1 ? 1 : 2)).toString();
4699
+ }
4700
+ class Ls {
4701
+ constructor(e, t = !0) {
4702
+ u(this, "root");
4703
+ u(this, "label");
4704
+ u(this, "disposed", !1);
4705
+ const i = document.createElement("div");
4706
+ i.className = "vpu-scale", i.dataset.theme = e, i.dataset.enabled = String(t), i.hidden = !0, i.title = "地面网格单元格边长";
4707
+ const r = document.createElement("span");
4708
+ r.className = "vpu-scale-label";
4709
+ const n = document.createElement("span");
4710
+ n.className = "vpu-scale-line", n.setAttribute("aria-hidden", "true"), i.append(r, n), this.root = i, this.label = r;
4711
+ }
4712
+ get element() {
4713
+ return this.root;
4714
+ }
4715
+ update(e, t) {
4716
+ var r;
4717
+ const i = this.root.dataset.enabled !== "false" && (e == null ? void 0 : e.phase) === "ready" && (e.kind === "model" || e.kind === "simulation") && ((r = e.capabilities) == null ? void 0 : r.canToggleGround) === !0 && t.groundVisible;
4718
+ this.root.hidden = !i, i && (this.label.textContent = Is(
4719
+ t.groundGridScale ?? Q
4720
+ ));
4721
+ }
4722
+ themeChanged(e) {
4723
+ this.root.dataset.theme = e;
4724
+ }
4725
+ dispose() {
4726
+ this.disposed || (this.disposed = !0, this.root.remove());
4727
+ }
4728
+ }
4729
+ class Ts {
4682
4730
  constructor(e = "dark", t) {
4683
4731
  u(this, "root");
4684
4732
  u(this, "title");
@@ -4764,7 +4812,7 @@ class Ps {
4764
4812
  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);
4765
4813
  }
4766
4814
  }
4767
- const As = `
4815
+ const Ds = `
4768
4816
  .vpu-root {
4769
4817
  position: absolute;
4770
4818
  inset: 0;
@@ -4853,9 +4901,60 @@ const As = `
4853
4901
  .vpu-btn[aria-disabled="true"], .vpu-btn[aria-disabled="true"]:hover { opacity: 0.45; cursor: not-allowed; color: var(--vpu-text-muted); border-color: var(--vpu-border); background: var(--vpu-panel-bg); }
4854
4902
  .vpu-btn-primary.is-active { background: var(--vpu-active-bg); }
4855
4903
 
4904
+ /* Bottom-left legend: fixed line length, live grid-cell world unit. */
4905
+ .vpu-scale {
4906
+ --vpu-scale-text: #d9e0e1;
4907
+ position: absolute;
4908
+ left: 16px;
4909
+ bottom: 14px;
4910
+ z-index: 7;
4911
+ width: 64px;
4912
+ display: flex;
4913
+ flex-direction: column;
4914
+ align-items: center;
4915
+ gap: 3px;
4916
+ color: var(--vpu-scale-text);
4917
+ font: 10px 'Segoe UI', system-ui, -apple-system, sans-serif;
4918
+ pointer-events: none;
4919
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
4920
+ }
4921
+ .vpu-scale[data-theme="light"] {
4922
+ --vpu-scale-text: #273536;
4923
+ text-shadow: 0 1px 2px rgba(255, 255, 255, 0.75);
4924
+ }
4925
+ .vpu-scale[hidden] { display: none; }
4926
+ .vpu-scale-label {
4927
+ color: var(--vpu-scale-text);
4928
+ line-height: 1;
4929
+ white-space: nowrap;
4930
+ }
4931
+ .vpu-scale-line {
4932
+ position: relative;
4933
+ display: block;
4934
+ width: 64px;
4935
+ height: 7px;
4936
+ border-bottom: 1px solid var(--vpu-scale-text);
4937
+ }
4938
+ .vpu-scale-line::before,
4939
+ .vpu-scale-line::after {
4940
+ content: '';
4941
+ position: absolute;
4942
+ bottom: -1px;
4943
+ width: 1px;
4944
+ height: 7px;
4945
+ background: var(--vpu-scale-text);
4946
+ }
4947
+ .vpu-scale-line::before { left: 0; }
4948
+ .vpu-scale-line::after { right: 0; }
4949
+
4856
4950
  /* Loading / failed overlay. */
4857
4951
  .vpu-status {
4858
4952
  --vpu-loading-accent: #21c7be;
4953
+ --vpu-warning-badge-bg: rgba(28, 33, 34, 0.86);
4954
+ --vpu-warning-badge-border: #776743;
4955
+ --vpu-warning-badge-text: #d7c48f;
4956
+ --vpu-warning-badge-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
4957
+ --vpu-warning-accent: #b39249;
4859
4958
  position: absolute;
4860
4959
  inset: 0;
4861
4960
  display: flex;
@@ -4871,7 +4970,14 @@ const As = `
4871
4970
  pointer-events: auto;
4872
4971
  z-index: 8;
4873
4972
  }
4874
- .vpu-status[data-theme="light"] { --vpu-loading-accent: #168b85; }
4973
+ .vpu-status[data-theme="light"] {
4974
+ --vpu-loading-accent: #168b85;
4975
+ --vpu-warning-badge-bg: rgba(247, 245, 238, 0.92);
4976
+ --vpu-warning-badge-border: #a28546;
4977
+ --vpu-warning-badge-text: #725719;
4978
+ --vpu-warning-badge-shadow: 0 1px 4px rgba(50, 42, 25, 0.18);
4979
+ --vpu-warning-accent: #8b6d25;
4980
+ }
4875
4981
  .vpu-status[hidden] { display: none; }
4876
4982
  .vpu-status[data-state="failed"] .vpu-status-spinner,
4877
4983
  .vpu-status[data-state="warning"] .vpu-status-spinner { display: none; }
@@ -4893,16 +4999,16 @@ const As = `
4893
4999
  }
4894
5000
  .vpu-status-detail[hidden] { display: none; }
4895
5001
  .vpu-status[data-state="failed"] .vpu-status-title { color: var(--vui-fail); }
4896
- .vpu-status[data-state="warning"] { box-sizing: border-box; inset: auto auto 18px 18px; width: min(360px, calc(100% - 36px)); padding: 0; background: transparent; box-shadow: none; pointer-events: none; align-items: flex-start; text-align: left; }
5002
+ .vpu-status[data-state="warning"] { box-sizing: border-box; inset: auto auto 60px 18px; width: min(360px, calc(100% - 36px)); padding: 0; background: transparent; box-shadow: none; pointer-events: none; align-items: flex-start; text-align: left; }
4897
5003
  .vpu-status[data-state="warning"] .vpu-status-spinner { display: none; }
4898
5004
  .vpu-status[data-state="warning"] .vpu-status-title, .vpu-status[data-state="warning"] .vpu-status-detail { display: none; }
4899
- .vpu-status-toggle { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 1px solid #e8a93a; border-radius: 50%; background: #e8a93a; color: #211a0e; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 16px; line-height: 1; font-weight: 750; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.26); }
4900
- .vpu-status-toggle:hover { filter: brightness(1.06); }
4901
- .vpu-status-toggle:focus-visible { outline: 2px solid color-mix(in srgb, #e8a93a 52%, white); outline-offset: 2px; }
4902
- .vpu-status[data-state="warning"][data-expanded="true"] { padding: 10px 38px 10px 12px; border: 1px solid #e8a93a; border-radius: 7px; background: color-mix(in srgb, var(--vui-bg) 94%, #e8a93a 6%); pointer-events: auto; align-items: flex-start; gap: 3px; }
4903
- .vpu-status[data-state="warning"][data-expanded="true"] .vpu-status-toggle { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; font-size: 14px; box-shadow: none; }
5005
+ .vpu-status-toggle { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--vpu-warning-badge-border); border-radius: 50%; background: var(--vpu-warning-badge-bg); color: var(--vpu-warning-badge-text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; line-height: 1; font-weight: 750; cursor: pointer; box-shadow: var(--vpu-warning-badge-shadow); }
5006
+ .vpu-status-toggle:hover { filter: brightness(1.08); }
5007
+ .vpu-status-toggle:focus-visible { outline: 2px solid color-mix(in srgb, var(--vpu-warning-badge-text) 72%, transparent); outline-offset: 2px; }
5008
+ .vpu-status[data-state="warning"][data-expanded="true"] { padding: 10px 38px 10px 12px; border: 1px solid var(--vpu-warning-accent); border-radius: 7px; background: color-mix(in srgb, var(--vui-bg) 94%, var(--vpu-warning-accent) 6%); pointer-events: auto; align-items: flex-start; gap: 3px; }
5009
+ .vpu-status[data-state="warning"][data-expanded="true"] .vpu-status-toggle { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; font-size: 12px; box-shadow: none; }
4904
5010
  .vpu-status[data-state="warning"][data-expanded="true"] .vpu-status-title, .vpu-status[data-state="warning"][data-expanded="true"] .vpu-status-detail { display: block; }
4905
- .vpu-status[data-state="warning"] .vpu-status-title { color: #e8a93a; font-size: 12px; font-weight: 650; }
5011
+ .vpu-status[data-state="warning"] .vpu-status-title { color: var(--vpu-warning-accent); font-size: 12px; font-weight: 650; }
4906
5012
  .vpu-status[data-state="warning"] .vpu-status-detail { max-width: none; font-size: 11px; line-height: 1.45; }
4907
5013
 
4908
5014
  .vpu-status-report-link { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 11px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
@@ -4926,53 +5032,57 @@ const As = `
4926
5032
  .vpu-actions { gap: 4px; }
4927
5033
  .vpu-btn { width: 34px; height: 34px; }
4928
5034
  .vpu-filename { max-width: min(180px, 34vw); }
5035
+ .vpu-scale { left: 10px; bottom: 10px; }
5036
+ .vpu-status[data-state="warning"] { bottom: 54px; left: 10px; width: min(340px, calc(100% - 20px)); }
4929
5037
  }
4930
5038
  @media (prefers-reduced-motion: reduce) {
4931
5039
  .vpu-status-spinner { animation: none; }
4932
5040
  }
4933
- `, dt = "scene";
4934
- function Rs(s, e) {
4935
- let t = null, i = null, r = null, n = null, a = null, o = null;
5041
+ `, be = "scene";
5042
+ function Os(s, e) {
5043
+ let t = null, i = null, r = null, n = null, a = null, o = null, l = null, d = null;
4936
5044
  return {
4937
5045
  id: "nebula.ui.scene",
4938
- activate(l) {
4939
- var c, p;
4940
- o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = As, (c = s.shadowRoot()) == null || c.append(o), t = Es(l, {
5046
+ activate(c) {
5047
+ var h, m, v, y;
5048
+ d = document.createElement("style"), d.dataset.viewerSceneUi = "", d.textContent = Ds, (h = s.shadowRoot()) == null || h.append(d), t = Ps(c, {
4941
5049
  label: e.label("simulation"),
4942
- parts: (p = e.scene) == null ? void 0 : p.parts,
5050
+ parts: (m = e.scene) == null ? void 0 : m.parts,
4943
5051
  theme: s.theme()
4944
- }), i = new Ps(s.theme(), () => {
4945
- var h;
4946
- return ((h = s.getVisualDiagnostics) == null ? void 0 : h.call(s)) ?? null;
4947
- }), r = s.mountBuiltin(t.element, { zone: "overlay", group: dt }), n = s.mountBuiltin(i.element, { zone: "overlay", group: dt }), a = s.onThemeChange((h) => {
4948
- t == null || t.themeChanged(h), i == null || i.themeChanged(h);
5052
+ }), i = new Ls(s.theme(), ((y = (v = e.scene) == null ? void 0 : v.parts) == null ? void 0 : y.scaleRuler) !== !1), r = new Ts(s.theme(), () => {
5053
+ var f;
5054
+ return ((f = s.getVisualDiagnostics) == null ? void 0 : f.call(s)) ?? null;
5055
+ }), n = s.mountBuiltin(t.element, { zone: "overlay", group: be }), a = s.mountBuiltin(i.element, { zone: "overlay", group: be }), o = s.mountBuiltin(r.element, { zone: "overlay", group: be }), l = s.onThemeChange((f) => {
5056
+ t == null || t.themeChanged(f), i == null || i.themeChanged(f), r == null || r.themeChanged(f);
4949
5057
  });
4950
- const d = () => {
4951
- var v, y, m;
4952
- const h = l.asset.$read();
4953
- if (((m = (y = (v = l.asset).$inspection) == null ? void 0 : y.call(v)) == null ? void 0 : m.kind) === "urdf") {
4954
- t && (t.element.hidden = !0), i == null || i.update(null);
5058
+ const p = () => {
5059
+ var g, x, w;
5060
+ const f = c.asset.$read();
5061
+ if (((w = (x = (g = c.asset).$inspection) == null ? void 0 : x.call(g)) == null ? void 0 : w.kind) === "urdf") {
5062
+ t && (t.element.hidden = !0), i == null || i.update(null, c.asset.$readControl()), r == null || r.update(null);
4955
5063
  return;
4956
5064
  }
4957
- if (!h) {
4958
- t && (t.element.hidden = !0), i == null || i.update(null);
5065
+ if (!f) {
5066
+ t && (t.element.hidden = !0), i == null || i.update(null, c.asset.$readControl()), r == null || r.update(null);
4959
5067
  return;
4960
5068
  }
4961
- t == null || t.update(h);
4962
- const f = h.kind === "model" || h.kind === "simulation" ? e.label(h.kind) : null;
4963
- f && (t == null || t.element.setAttribute("aria-label", f)), i == null || i.update(h);
5069
+ t == null || t.update(f);
5070
+ const b = f.kind === "model" || f.kind === "simulation" ? e.label(f.kind) : null;
5071
+ b && (t == null || t.element.setAttribute("aria-label", b)), i == null || i.update(f, c.asset.$readControl()), r == null || r.update(f);
4964
5072
  };
4965
- l.events.on("asset-change", d), l.events.on("asset-control-change", () => t == null ? void 0 : t.pressedChanged()), d();
5073
+ c.events.on("asset-change", p), c.events.on("asset-control-change", () => {
5074
+ t == null || t.pressedChanged(), i == null || i.update(c.asset.$read(), c.asset.$readControl());
5075
+ }), p();
4966
5076
  },
4967
5077
  deactivate() {
4968
- a == null || a.dispose(), r == null || r.dispose(), n == null || n.dispose(), t == null || t.dispose(), i == null || i.dispose(), o == null || o.remove(), t = null, i = null, r = null, n = null, a = null, o = null;
5078
+ l == null || l.dispose(), n == null || n.dispose(), a == null || a.dispose(), o == null || o.dispose(), t == null || t.dispose(), i == null || i.dispose(), r == null || r.dispose(), d == null || d.remove(), t = null, i = null, r = null, n = null, a = null, o = null, l = null, d = null;
4969
5079
  }
4970
5080
  };
4971
5081
  }
4972
- class Is {
5082
+ class Ns {
4973
5083
  constructor(e, t, i, r) {
4974
- u(this, "renderer", new fi());
4975
- u(this, "scene", new we());
5084
+ u(this, "renderer", new gi());
5085
+ u(this, "scene", new Se());
4976
5086
  u(this, "labels", []);
4977
5087
  u(this, "frame", null);
4978
5088
  u(this, "enabled", !1);
@@ -4982,7 +5092,7 @@ class Is {
4982
5092
  if (n.kind !== "link" || n.visualCount === 0) continue;
4983
5093
  const a = e.ownerDocument.createElement("div");
4984
5094
  a.className = "vurdf-name-label", a.textContent = n.name;
4985
- const o = new pi(a);
5095
+ const o = new vi(a);
4986
5096
  this.scene.add(o), this.labels.push({ id: n.id.slice(5), object: o });
4987
5097
  }
4988
5098
  }
@@ -5017,14 +5127,14 @@ class Is {
5017
5127
  this.setVisible(!1), this.disposed = !0, this.scene.clear(), this.labels.length = 0;
5018
5128
  }
5019
5129
  }
5020
- function Ms(s) {
5130
+ function zs(s) {
5021
5131
  const e = s.clone().invert(), t = [new S(1, 0, 0), new S(0, 1, 0), new S(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
5022
5132
  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 }) => {
5023
5133
  const l = 50 + n.x * 32, d = 50 - n.y * 32, c = i[a];
5024
5134
  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>` : ""}`;
5025
5135
  }).join("")}</svg>`;
5026
5136
  }
5027
- const Ls = {
5137
+ const Fs = {
5028
5138
  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"/>',
5029
5139
  zoomIn: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6m-3-3v6"/>',
5030
5140
  zoomOut: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6"/>',
@@ -5053,7 +5163,7 @@ const Ls = {
5053
5163
  moon: '<path d="M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/>'
5054
5164
  };
5055
5165
  function M(s) {
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">${Ls[s]}</svg>`;
5166
+ return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Fs[s]}</svg>`;
5057
5167
  }
5058
5168
  function P(s) {
5059
5169
  return s.mode === "kinematic" || s.mode === "dynamics-paused" || s.mode === "dynamics-unavailable";
@@ -5061,34 +5171,34 @@ function P(s) {
5061
5171
  function k(s) {
5062
5172
  return String(s ?? "").replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
5063
5173
  }
5064
- function ee(s, e = 1 / 0) {
5174
+ function te(s, e = 1 / 0) {
5065
5175
  var i, r;
5066
5176
  const t = s.controlLimits;
5067
5177
  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 };
5068
5178
  }
5069
- function Ts(s, e, t, i) {
5179
+ function Vs(s, e, t, i) {
5070
5180
  const r = s.ownerDocument, n = r.defaultView;
5071
5181
  let a = !1, o = 0, l = null, d = null, c = "";
5072
5182
  const p = (E) => E.composedPath().some((A) => A instanceof n.HTMLElement && (A.matches("input,textarea,select") || A.isContentEditable)), h = () => {
5073
5183
  d && (d = null, s.style.cursor = c, s.removeAttribute("data-joint-adjusting"));
5074
- }, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), v = (E) => {
5075
- var Te;
5184
+ }, m = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), v = (E) => {
5185
+ var Ne;
5076
5186
  if (E.code === "Escape") {
5077
5187
  h();
5078
5188
  return;
5079
5189
  }
5080
- if (E.code !== "KeyR" || E.repeat || E.ctrlKey || E.altKey || E.metaKey || p(E) || !a && r.activeElement !== s || !f()) return;
5081
- const A = e.getSnapshot(), L = A.nodes.find((De) => De.id === A.selectedEntityId && De.kind === "joint");
5190
+ if (E.code !== "KeyR" || E.repeat || E.ctrlKey || E.altKey || E.metaKey || p(E) || !a && r.activeElement !== s || !m()) return;
5191
+ const A = e.getSnapshot(), L = A.nodes.find((ze) => ze.id === A.selectedEntityId && ze.kind === "joint");
5082
5192
  if (!(L != null && L.movable) || L.mimic) return;
5083
5193
  t();
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 ? Ds(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
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"), E.preventDefault();
5194
+ const W = (Ne = e.jointWorldFrame) == null ? void 0 : Ne.call(e, L.name), K = i == null ? void 0 : i(), jt = W && K && l !== null ? $s(K, W, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
5195
+ d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...te(L), direction: jt }, c = s.style.cursor, s.style.cursor = "ew-resize", s.setAttribute("data-joint-adjusting", "true"), E.preventDefault();
5086
5196
  }, y = (E) => {
5087
5197
  E.code === "KeyR" && h();
5088
- }, m = (E) => {
5198
+ }, f = (E) => {
5089
5199
  const A = l === null ? 0 : E.clientX - l;
5090
5200
  if (l = E.clientX, o = E.clientY, !(!d || E.pointerType === "touch")) {
5091
- if (!f() || e.getSnapshot().selectedEntityId !== d.id || E.buttons !== 0) {
5201
+ if (!m() || e.getSnapshot().selectedEntityId !== d.id || E.buttons !== 0) {
5092
5202
  h();
5093
5203
  return;
5094
5204
  }
@@ -5105,21 +5215,21 @@ function Ts(s, e, t, i) {
5105
5215
  }, C = () => {
5106
5216
  r.hidden && h();
5107
5217
  }, D = e.subscribe((E) => {
5108
- d && (!f() || E.selectedEntityId !== d.id) && h();
5218
+ d && (!m() || E.selectedEntityId !== d.id) && h();
5109
5219
  });
5110
- return s.addEventListener("pointerenter", b), s.addEventListener("pointerleave", g), s.addEventListener("pointermove", m, !0), s.addEventListener("pointerdown", x, !0), r.addEventListener("keydown", v), r.addEventListener("keyup", y), r.addEventListener("focusin", w), r.addEventListener("visibilitychange", C), n.addEventListener("blur", g), () => {
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);
5220
+ return s.addEventListener("pointerenter", b), s.addEventListener("pointerleave", g), s.addEventListener("pointermove", f, !0), s.addEventListener("pointerdown", x, !0), r.addEventListener("keydown", v), r.addEventListener("keyup", y), r.addEventListener("focusin", w), r.addEventListener("visibilitychange", C), n.addEventListener("blur", g), () => {
5221
+ h(), D(), s.removeEventListener("pointerenter", b), s.removeEventListener("pointerleave", g), s.removeEventListener("pointermove", f, !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);
5112
5222
  };
5113
5223
  }
5114
- function Ds(s, e, t, i, r, n) {
5224
+ function $s(s, e, t, i, r, n) {
5115
5225
  if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
5116
5226
  s.updateMatrixWorld(!0);
5117
5227
  const a = e.axis.clone().normalize(), o = s.getWorldDirection(new S()), l = new S(1, 0, 0).transformDirection(s.matrixWorld), d = new S(0, 1, 0).transformDirection(s.matrixWorld);
5118
5228
  let c = a.clone();
5119
5229
  if (!n) {
5120
- const f = new St();
5121
- f.setFromCamera(new oe((i - t.left) / t.width * 2 - 1, 1 - (r - t.top) / t.height * 2), s);
5122
- const v = f.ray.intersectPlane(new kt().setFromNormalAndCoplanarPoint(o, e.position), new S()), y = v ? v.sub(e.position) : new S();
5230
+ const m = new At();
5231
+ m.setFromCamera(new de((i - t.left) / t.width * 2 - 1, 1 - (r - t.top) / t.height * 2), s);
5232
+ const v = m.ray.intersectPlane(new Rt().setFromNormalAndCoplanarPoint(o, e.position), new S()), y = v ? v.sub(e.position) : new S();
5123
5233
  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())));
5124
5234
  }
5125
5235
  const p = c.dot(l);
@@ -5127,13 +5237,13 @@ function Ds(s, e, t, i, r, n) {
5127
5237
  const h = c.dot(d);
5128
5238
  return Math.abs(h) > 1e-6 ? h >= 0 ? 1 : -1 : 1;
5129
5239
  }
5130
- function W(s, e, t) {
5240
+ function G(s, e, t) {
5131
5241
  return s.jointType === "prismatic" ? `${e.toFixed(3)} m` : t === "rad" ? `${e.toFixed(3)} rad` : `${(e * 180 / Math.PI).toFixed(1)}°`;
5132
5242
  }
5133
- function Os(s, e) {
5243
+ function _s(s, e) {
5134
5244
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5135
5245
  }
5136
- function ue(s, e) {
5246
+ function pe(s, e) {
5137
5247
  const t = /* @__PURE__ */ new Set();
5138
5248
  for (; s.mimic && !t.has(s.name); ) {
5139
5249
  t.add(s.name);
@@ -5143,22 +5253,22 @@ function ue(s, e) {
5143
5253
  }
5144
5254
  return s;
5145
5255
  }
5146
- function Se(s, e, t, i = !1) {
5147
- const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Os(s, t);
5256
+ function Ae(s, e, t, i = !1) {
5257
+ const { lower: r, upper: n } = te(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = _s(s, t);
5148
5258
  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)},点击选中关节">
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>
5259
+ <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)}">${G(s, a, t)}</output></div>
5150
5260
  <small>${i ? "联动控制 · " : ""}${k(s.parentLink)} → ${k(s.childLink)}</small>
5151
5261
  <input type="range" aria-label="${k(s.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${k(s.name)}" data-display-factor="${o}" min="${r * o}" max="${n * o}" step="any" value="${a * o}" ${!P(e) || s.mimic ? "disabled" : ""}>
5152
- ${s.mimic ? `<small>跟随 ${k(s.mimic.joint)} × ${s.mimic.multiplier} + ${W(s, s.mimic.offset, t)}</small>` : ""}
5262
+ ${s.mimic ? `<small>跟随 ${k(s.mimic.joint)} × ${s.mimic.multiplier} + ${G(s, s.mimic.offset, t)}</small>` : ""}
5153
5263
  </div>`;
5154
5264
  }
5155
- function ct(s, e, t) {
5265
+ function pt(s, e, t) {
5156
5266
  const i = e.nodes.filter((o) => o.kind === "joint"), r = s.kind === "joint" ? s : i.find((o) => o.childLink === s.name);
5157
5267
  if (!r) return "";
5158
- const n = ue(r, i), a = i.filter((o) => o.mimic && ue(o, i).name === n.name);
5159
- return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Se(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => k(o.name)).join(" · ")}</p></section>` : "";
5268
+ const n = pe(r, i), a = i.filter((o) => o.mimic && pe(o, i).name === n.name);
5269
+ return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Ae(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => k(o.name)).join(" · ")}</p></section>` : "";
5160
5270
  }
5161
- function zs(s, e, t) {
5271
+ function Bs(s, e, t) {
5162
5272
  const i = s.nodes.filter((c) => c.kind === "joint"), r = /* @__PURE__ */ new Map();
5163
5273
  for (const c of i) r.set(c.parentLink, [...r.get(c.parentLink) ?? [], c]);
5164
5274
  const n = new Set(i.map((c) => c.childLink)), a = /* @__PURE__ */ new Set(), o = [], l = (c) => {
@@ -5166,13 +5276,13 @@ function zs(s, e, t) {
5166
5276
  let h = c;
5167
5277
  for (; h && !a.has(h.name); ) {
5168
5278
  a.add(h.name), h.movable && p.push(h);
5169
- const f = r.get(h.childLink) ?? [];
5170
- if (f.length !== 1) {
5279
+ const m = r.get(h.childLink) ?? [];
5280
+ if (m.length !== 1) {
5171
5281
  p.length && o.push(p);
5172
- for (const v of f) l(v);
5282
+ for (const v of m) l(v);
5173
5283
  return;
5174
5284
  }
5175
- h = f[0];
5285
+ h = m[0];
5176
5286
  }
5177
5287
  p.length && o.push(p);
5178
5288
  };
@@ -5180,14 +5290,14 @@ function zs(s, e, t) {
5180
5290
  for (const c of i) a.has(c.name) || l(c);
5181
5291
  const d = e.trim().toLowerCase();
5182
5292
  return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
5183
- const p = [...new Set(c.map((h) => ue(h, i)))].filter((h) => i.some((f) => f.mimic && ue(f, i).name === h.name));
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) => Se(h, s, t, !0)).join("")}${c.map((h) => Se(h, s, t, p.includes(h))).join("")}</section>`;
5293
+ const p = [...new Set(c.map((h) => pe(h, i)))].filter((h) => i.some((m) => m.mimic && pe(m, i).name === h.name));
5294
+ 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) => Ae(h, s, t, !0)).join("")}${c.map((h) => Ae(h, s, t, p.includes(h))).join("")}</section>`;
5185
5295
  }).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
5186
5296
  }
5187
- function Ns(s) {
5297
+ function Us(s) {
5188
5298
  return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${s === "deg"}">${M("angleUnit")}<span>${s === "rad" ? "rad" : "°"}</span></button>`;
5189
5299
  }
5190
- class Fs {
5300
+ class js {
5191
5301
  constructor(e, t, i) {
5192
5302
  u(this, "element", document.createElement("aside"));
5193
5303
  u(this, "root", document.createElement("div"));
@@ -5217,8 +5327,8 @@ class Fs {
5217
5327
  this.root.innerHTML = `
5218
5328
  <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="打开结构图">${M("structure")}</button></div>
5219
5329
  <label class="vurdf-search">${M("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${k(this.query)}"></label>
5220
- <div class="vurdf-filters">${ve("all", "全部", this.filter)}${ve("movable", "可动关节", this.filter)}${ve("errors", `错误 ${e.issues.length}`, this.filter)}</div>
5221
- <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? zs(e, this.query, this.angleUnit) : Vs(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5330
+ <div class="vurdf-filters">${ye("all", "全部", this.filter)}${ye("movable", "可动关节", this.filter)}${ye("errors", `错误 ${e.issues.length}`, this.filter)}</div>
5331
+ <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? Bs(e, this.query, this.angleUnit) : Hs(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5222
5332
  `, this.bind(e), this.setDiagramOpen(this.diagramOpen);
5223
5333
  const o = this.root.querySelector(".vurdf-tree");
5224
5334
  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 })));
@@ -5227,7 +5337,7 @@ class Fs {
5227
5337
  var n, a, o, l, d;
5228
5338
  if (e) {
5229
5339
  this.query = "";
5230
- const c = new Map(t.nodes.map((f) => [f.id, f])), p = /* @__PURE__ */ new Set();
5340
+ const c = new Map(t.nodes.map((m) => [m.id, m])), p = /* @__PURE__ */ new Set();
5231
5341
  let h = (n = c.get(e)) == null ? void 0 : n.parentId;
5232
5342
  for (; h && !p.has(h); )
5233
5343
  p.add(h), this.collapsed.delete(h), h = (a = c.get(h)) == null ? void 0 : a.parentId;
@@ -5286,7 +5396,7 @@ class Fs {
5286
5396
  t.value = String(i * Number(t.dataset.displayFactor ?? 1));
5287
5397
  }), this.root.querySelectorAll("[data-joint-readout]").forEach((t) => {
5288
5398
  const i = e.nodes.find((r) => r.kind === "joint" && r.name === t.dataset.jointReadout);
5289
- i && (t.textContent = W(i, e.jointValues[i.name] ?? 0, this.angleUnit));
5399
+ i && (t.textContent = G(i, e.jointValues[i.name] ?? 0, this.angleUnit));
5290
5400
  });
5291
5401
  }
5292
5402
  bindListSliders(e) {
@@ -5304,17 +5414,17 @@ class Fs {
5304
5414
  });
5305
5415
  }
5306
5416
  }
5307
- function Vs(s, e, t, i, r, n) {
5417
+ function Hs(s, e, t, i, r, n) {
5308
5418
  const a = new Map(s.nodes.map((p) => [p.id, p])), o = i.trim().toLowerCase(), l = o.length > 0 || t !== "all", d = (p) => {
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);
5310
- return h && f;
5311
- }, c = (p, h, f = /* @__PURE__ */ new Set()) => {
5312
- if (f.has(p)) return { html: "", matched: !1 };
5419
+ const h = !o || p.name.toLowerCase().includes(o), m = t === "all" || t === "movable" && p.kind === "joint" && p.movable || t === "errors" && e.has(p.id);
5420
+ return h && m;
5421
+ }, c = (p, h, m = /* @__PURE__ */ new Set()) => {
5422
+ if (m.has(p)) return { html: "", matched: !1 };
5313
5423
  const v = a.get(p);
5314
5424
  if (!v) return { html: "", matched: !1 };
5315
- const y = new Set(f).add(p), m = v.childIds.map((E) => c(E, h + 1, y));
5316
- if (!(d(v) || m.some((E) => E.matched))) return { html: "", matched: !1 };
5317
- const g = m.some((E) => E.matched), x = !l && r.has(v.id), w = v.kind === "joint" ? v.jointType : v.kind, C = v.kind === "joint" && v.movable ? `${W(v, s.jointValues[v.name] ?? 0, n)}` : "", D = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!x) : "false"}">
5425
+ const y = new Set(m).add(p), f = v.childIds.map((E) => c(E, h + 1, y));
5426
+ if (!(d(v) || f.some((E) => E.matched))) return { html: "", matched: !1 };
5427
+ const g = f.some((E) => E.matched), x = !l && r.has(v.id), w = v.kind === "joint" ? v.jointType : v.kind, C = v.kind === "joint" && v.movable ? `${G(v, s.jointValues[v.name] ?? 0, n)}` : "", D = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!x) : "false"}">
5318
5428
  <button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${x ? "" : "is-open"}" data-tree-toggle="${k(v.id)}" ${g ? "" : "disabled"} aria-label="${x ? "展开" : "折叠"} ${k(v.name)}">${M("chevron")}</button>
5319
5429
  <button class="vurdf-row ${s.selectedEntityId === v.id ? "is-selected" : ""} ${e.has(v.id) ? "has-error" : ""}" data-entity="${k(v.id)}">
5320
5430
  ${M(v.kind === "robot" ? "robot" : v.kind === "joint" ? "joint" : "link")}
@@ -5322,15 +5432,15 @@ function Vs(s, e, t, i, r, n) {
5322
5432
  ${e.has(v.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${v.kind === "joint" ? `data-joint-readout="${k(v.name)}"` : ""}>${C}</span>`}
5323
5433
  </button>
5324
5434
  </div>`;
5325
- return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${D}<div class="vurdf-children" ${x ? "inert" : ""}><div>${m.map((E) => E.html).join("")}</div></div></div>`, matched: !0 };
5435
+ return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${D}<div class="vurdf-children" ${x ? "inert" : ""}><div>${f.map((E) => E.html).join("")}</div></div></div>`, matched: !0 };
5326
5436
  };
5327
5437
  return c(s.rootEntityId, 0).html || '<div class="vurdf-empty">没有符合筛选条件的节点。</div>';
5328
5438
  }
5329
- function ve(s, e, t) {
5439
+ function ye(s, e, t) {
5330
5440
  return `<button class="vurdf-chip ${s === t ? "is-active" : ""}" data-filter="${s}">${e}</button>`;
5331
5441
  }
5332
- const $s = 1800;
5333
- class _s {
5442
+ const qs = 1800;
5443
+ class Ys {
5334
5444
  constructor(e) {
5335
5445
  u(this, "element", document.createElement("aside"));
5336
5446
  u(this, "root", document.createElement("div"));
@@ -5367,10 +5477,10 @@ class _s {
5367
5477
  const o = a.dataset.inertiaDetails;
5368
5478
  a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
5369
5479
  }), this.root.innerHTML = `
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>
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) : Hs()}</section>
5372
- <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Us(e, t) : ""}</section>
5373
- <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${js(e)}</section>
5480
+ <nav class="vurdf-tabs">${xe("properties", "属性", this.tab)}${xe("source", "XML", this.tab)}${xe("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
5481
+ <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Xs(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : Ks()}</section>
5482
+ <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Gs(e, t) : ""}</section>
5483
+ <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Ws(e)}</section>
5374
5484
  `, 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" }));
5375
5485
  }
5376
5486
  dispose() {
@@ -5381,22 +5491,22 @@ class _s {
5381
5491
  this.root.querySelectorAll("[data-entity]").forEach((h) => h.addEventListener("click", () => {
5382
5492
  P(this.inspection.getSnapshot()) && this.inspection.select(h.dataset.entity);
5383
5493
  })), this.root.querySelectorAll("[data-joint-card]").forEach((h) => {
5384
- const f = () => {
5494
+ const m = () => {
5385
5495
  P(this.inspection.getSnapshot()) && this.inspection.select(h.dataset.jointCard);
5386
5496
  };
5387
5497
  h.addEventListener("click", (v) => {
5388
- v.target.closest("input,button,select,textarea,a") || f();
5498
+ v.target.closest("input,button,select,textarea,a") || m();
5389
5499
  }), h.addEventListener("keydown", (v) => {
5390
- v.target !== h || !["Enter", " "].includes(v.key) || (v.preventDefault(), f());
5500
+ v.target !== h || !["Enter", " "].includes(v.key) || (v.preventDefault(), m());
5391
5501
  });
5392
5502
  }), this.bindListSliders(e), this.root.querySelectorAll("[data-inertia-details]").forEach((h) => h.addEventListener("toggle", () => {
5393
5503
  if (!h.isConnected) return;
5394
- const f = h.dataset.inertiaDetails;
5395
- h.open ? this.expandedInertia.add(f) : this.expandedInertia.delete(f);
5504
+ const m = h.dataset.inertiaDetails;
5505
+ h.open ? this.expandedInertia.add(m) : this.expandedInertia.delete(m);
5396
5506
  })), this.root.querySelectorAll("[data-copy-number]").forEach((h) => h.addEventListener("click", async () => {
5397
- var f;
5507
+ var m;
5398
5508
  try {
5399
- const v = (f = this.root.ownerDocument.defaultView) == null ? void 0 : f.navigator.clipboard;
5509
+ const v = (m = this.root.ownerDocument.defaultView) == null ? void 0 : m.navigator.clipboard;
5400
5510
  if (!v) throw new Error("Clipboard unavailable");
5401
5511
  await v.writeText(h.dataset.copyNumber), h.title = "已复制完整数值";
5402
5512
  } catch {
@@ -5411,7 +5521,7 @@ class _s {
5411
5521
  if ((l = this.root.querySelector("[data-angle-unit]")) == null || l.addEventListener("click", () => {
5412
5522
  this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
5413
5523
  }), !(t != null && t.movable) || t.mimic || !P(e)) return;
5414
- const i = Pe(t, this.angleUnit), r = (h) => {
5524
+ const i = Ie(t, this.angleUnit), r = (h) => {
5415
5525
  !P(this.inspection.getSnapshot()) || !Number.isFinite(h) || (this.stopSweep(!1), this.inspection.setJointValue(t.name, h));
5416
5526
  }, n = this.root.querySelector("[data-joint-range]"), a = () => {
5417
5527
  if (this.draggingJoint !== t.name) return;
@@ -5424,16 +5534,16 @@ class _s {
5424
5534
  n == null || n.addEventListener("pointerdown", o), n == null || n.addEventListener("mousedown", o), n == null || n.addEventListener("touchstart", o, { passive: !0 }), n == null || n.addEventListener("input", (h) => {
5425
5535
  if (!P(this.inspection.getSnapshot())) return;
5426
5536
  this.draggingJoint = t.name;
5427
- const f = Number(h.target.value) / i;
5428
- this.syncJointInputs(f), r(f);
5537
+ const m = Number(h.target.value) / i;
5538
+ this.syncJointInputs(m), r(m);
5429
5539
  }), n == null || n.addEventListener("change", a), n == null || n.addEventListener("pointerup", a), n == null || n.addEventListener("pointercancel", a), (d = this.root.querySelector("[data-joint-number]")) == null || d.addEventListener("change", (h) => {
5430
5540
  const v = h.target.valueAsNumber / i;
5431
5541
  if (!Number.isFinite(v)) {
5432
5542
  this.syncJointInputs(this.inspection.getSnapshot().jointValues[t.name] ?? 0);
5433
5543
  return;
5434
5544
  }
5435
- const { lower: y, upper: m } = ee(t);
5436
- r(Math.max(y, Math.min(m, v)));
5545
+ const { lower: y, upper: f } = te(t);
5546
+ r(Math.max(y, Math.min(f, v)));
5437
5547
  }), this.root.querySelectorAll("[data-joint-value]").forEach((h) => h.addEventListener("click", () => r(Number(h.dataset.jointValue)))), (c = this.root.querySelector("[data-reset-joint]")) == null || c.addEventListener("click", () => {
5438
5548
  P(this.inspection.getSnapshot()) && (this.stopSweep(!1), this.inspection.resetJoint(t.name));
5439
5549
  }), (p = this.root.querySelector("[data-sweep-joint]")) == null || p.addEventListener("click", () => {
@@ -5447,7 +5557,7 @@ class _s {
5447
5557
  t.value = String(i * Number(t.dataset.displayFactor ?? 1));
5448
5558
  }), this.root.querySelectorAll("[data-joint-readout]").forEach((t) => {
5449
5559
  const i = e.nodes.find((r) => r.kind === "joint" && r.name === t.dataset.jointReadout);
5450
- i && (t.textContent = W(i, e.jointValues[i.name] ?? 0, this.angleUnit));
5560
+ i && (t.textContent = G(i, e.jointValues[i.name] ?? 0, this.angleUnit));
5451
5561
  });
5452
5562
  }
5453
5563
  bindListSliders(e) {
@@ -5473,14 +5583,14 @@ class _s {
5473
5583
  }
5474
5584
  syncJointInputs(e) {
5475
5585
  const t = this.root.querySelector("[data-joint-range]"), i = this.root.querySelector("[data-joint-number]"), r = this.inspection.getSnapshot(), n = r.nodes.find((a) => a.id === r.selectedEntityId);
5476
- (n == null ? void 0 : n.kind) === "joint" && (e *= Pe(n, this.angleUnit)), t && Number(t.value) !== e && (t.value = String(e)), i && (i.value = e.toFixed(3));
5586
+ (n == null ? void 0 : n.kind) === "joint" && (e *= Ie(n, this.angleUnit)), t && Number(t.value) !== e && (t.value = String(e)), i && (i.value = e.toFixed(3));
5477
5587
  }
5478
5588
  startSweep(e, t) {
5479
5589
  this.stopSweep(!1), this.sweep = { jointName: e.name, initial: t, startedAt: Date.now(), timer: null };
5480
- const { lower: i, upper: r } = ee(e, Math.PI), n = () => {
5590
+ const { lower: i, upper: r } = te(e, Math.PI), n = () => {
5481
5591
  const a = this.sweep;
5482
5592
  if (!a || a.jointName !== e.name || this.disposed || !P(this.inspection.getSnapshot())) return;
5483
- const o = Math.min(1, (Date.now() - a.startedAt) / $s), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5593
+ const o = Math.min(1, (Date.now() - a.startedAt) / qs), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5484
5594
  if (this.inspection.setJointValue(e.name, i + (r - i) * l), o >= 1) {
5485
5595
  const d = a.initial;
5486
5596
  this.sweep = null, this.inspection.setJointValue(e.name, d);
@@ -5495,68 +5605,68 @@ class _s {
5495
5605
  t && (t.timer !== null && clearTimeout(t.timer), this.sweep = null, e && !this.disposed && this.inspection.setJointValue(t.jointName, t.initial));
5496
5606
  }
5497
5607
  }
5498
- function Bs(s, e, t, i, r) {
5608
+ function Xs(s, e, t, i, r) {
5499
5609
  var n, a;
5500
5610
  if (s.kind === "joint") {
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"}>
5502
- <div class="vurdf-section-head"><strong>关节</strong>${f}<span class="vurdf-section-actions"><button class="vurdf-text-btn ${t ? "is-active" : ""}" data-sweep-joint>${t ? "停止扫描" : "扫描范围"}</button><button class="vurdf-text-btn" data-reset-joint>重置</button></span></div>
5611
+ const o = e.nodes.find((y) => y.kind === "link" && y.id === `link:${s.childLink}`), l = e.jointValues[s.name] ?? 0, { lower: d, upper: c } = te(s, Math.PI), p = Ie(s, i), h = s.jointType === "prismatic" ? "m" : i === "deg" ? "°" : "rad", m = `<span class="vurdf-unit-label">${h}</span>`, v = s.mimic ? `<section class="vurdf-section vurdf-follower"><div class="vurdf-section-head"><strong>从属关节</strong>${m}<span class="vurdf-readonly-badge">只读 · 自动跟随</span></div><output class="vurdf-follower-value" data-joint-readout="${k(s.name)}">${G(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"}>
5612
+ <div class="vurdf-section-head"><strong>关节</strong>${m}<span class="vurdf-section-actions"><button class="vurdf-text-btn ${t ? "is-active" : ""}" data-sweep-joint>${t ? "停止扫描" : "扫描范围"}</button><button class="vurdf-text-btn" data-reset-joint>重置</button></span></div>
5503
5613
  <div class="vurdf-value"><input data-joint-range aria-label="关节位置" type="range" min="${d * p}" max="${c * p}" step="${p === 1 ? 1e-3 : 0.1}" value="${l * p}"><input data-joint-number aria-label="关节位置精确值" type="number" step="0.001" value="${(l * p).toFixed(3)}"></div>
5504
5614
  <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>
5505
5615
  ${P(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
5506
5616
  </fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
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)) : ""}`;
5617
+ 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}${pt(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(we).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${s.originRotationRpy.map(we).join(" ")}</dd><dt>Axis xyz</dt><dd>${s.axis.map(we).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 ? mt(o, !0, r.has(o.id)) : ""}`;
5508
5618
  }
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>`;
5619
+ 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>${pt(s, e, i)}${mt(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>`;
5510
5620
  }
5511
- function ke(s) {
5621
+ function Re(s) {
5512
5622
  if (s === void 0) return "<span>—</span>";
5513
5623
  const e = String(s), t = Number.isFinite(s) ? String(Number(s.toPrecision(6))) : e;
5514
5624
  return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
5515
5625
  }
5516
- function ut(s, e, t, i) {
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>`;
5626
+ function ft(s, e, t, i) {
5627
+ 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>${Re(t == null ? void 0 : t[n])}</dd></div>`).join("")}</dl></div>`;
5518
5628
  }
5519
- function ht(s, e, t) {
5629
+ function mt(s, e, t) {
5520
5630
  return `<section class="vurdf-section" data-link-inertial>
5521
5631
  <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${k(s.name)}</strong></div>
5522
- <dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${ke(s.mass)}</dd></dl>
5632
+ <dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${Re(s.mass)}</dd></dl>
5523
5633
  <div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
5524
- ${ut("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5525
- ${ut("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5634
+ ${ft("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5635
+ ${ft("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5526
5636
  <details class="vurdf-inertia-details" data-inertia-details="${k(s.id)}" ${t ? "open" : ""}>
5527
5637
  <summary>${M("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
5528
5638
  <div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
5529
5639
  <dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, r) => {
5530
5640
  var n;
5531
- return `<dt>${i}</dt><dd>${ke((n = s.inertiaTensor) == null ? void 0 : n[r])}</dd>`;
5641
+ return `<dt>${i}</dt><dd>${Re((n = s.inertiaTensor) == null ? void 0 : n[r])}</dd>`;
5532
5642
  }).join("")}</dl>
5533
5643
  </details>
5534
5644
  </section>`;
5535
5645
  }
5536
- function Us(s, e) {
5646
+ function Gs(s, e) {
5537
5647
  var n, a;
5538
5648
  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;
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>${qs(o)}</span>`).join("")}</code></pre>`;
5649
+ 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>${Zs(o)}</span>`).join("")}</code></pre>`;
5540
5650
  }
5541
- function js(s) {
5651
+ function Ws(s) {
5542
5652
  return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${k(e.entityId)}">${M("error")}<span><b>${k(e.title)}</b><small>${k(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
5543
5653
  }
5544
- function ge(s, e, t) {
5654
+ function xe(s, e, t) {
5545
5655
  return `<button class="vurdf-tab ${s === t ? "is-active" : ""}" data-tab="${s}">${e}</button>`;
5546
5656
  }
5547
- function Hs() {
5657
+ function Ks() {
5548
5658
  return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
5549
5659
  }
5550
- function be(s) {
5660
+ function we(s) {
5551
5661
  return s.toFixed(3);
5552
5662
  }
5553
- function qs(s) {
5663
+ function Zs(s) {
5554
5664
  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>');
5555
5665
  }
5556
- function Pe(s, e) {
5666
+ function Ie(s, e) {
5557
5667
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5558
5668
  }
5559
- function Ys(s) {
5669
+ function Js(s) {
5560
5670
  const e = new Map(s.nodes.map((o) => [o.id, o])), t = /* @__PURE__ */ new Set(), i = [], r = [];
5561
5671
  let n = 0;
5562
5672
  const a = (o, l) => {
@@ -5565,8 +5675,8 @@ function Ys(s) {
5565
5675
  t.add(o);
5566
5676
  const c = [];
5567
5677
  for (const h of d.childIds) {
5568
- const f = a(h, l + 1);
5569
- f !== void 0 && (c.push(f), r.push({ from: o, to: h }));
5678
+ const m = a(h, l + 1);
5679
+ m !== void 0 && (c.push(m), r.push({ from: o, to: h }));
5570
5680
  }
5571
5681
  const p = c.length ? (c[0] + c[c.length - 1]) / 2 : n++ * 210 + 100;
5572
5682
  return i.push({ node: d, x: p, y: l * 100 + 45 }), p;
@@ -5575,7 +5685,7 @@ function Ys(s) {
5575
5685
  for (const o of s.nodes) t.has(o.id) || a(o.id, 0);
5576
5686
  return { nodes: i, edges: r, width: Math.max(200, n * 210), height: Math.max(90, ...i.map((o) => o.y + 45)) };
5577
5687
  }
5578
- class Xs {
5688
+ class Qs {
5579
5689
  constructor(e, t, i = () => {
5580
5690
  }) {
5581
5691
  u(this, "element", document.createElement("section"));
@@ -5628,9 +5738,9 @@ class Xs {
5628
5738
  }), o.addEventListener("pointermove", (d) => {
5629
5739
  const c = this.windowResize;
5630
5740
  if (!c || c.id !== d.pointerId) return;
5631
- const p = this.element.parentElement, h = d.clientX - c.x, f = d.clientY - c.y, v = 420, y = 320;
5632
- let m = c.left, b = c.top, g = c.width, x = c.height;
5633
- (c.corner === "tr" || c.corner === "br") && (g = Math.max(v, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (g = Math.max(v, c.width - h), m = c.left + c.width - g), c.corner === "tr" && (x = Math.max(y, c.height - f), b = c.top + c.height - x), (c.corner === "br" || c.corner === "bl") && (x = Math.max(y, c.height + f)), c.corner === "tl" && (x = Math.max(y, c.height - f), b = c.top + c.height - x), m = Math.max(0, Math.min(m, Math.max(0, p.clientWidth - g))), b = Math.max(0, Math.min(b, Math.max(0, p.clientHeight - x))), g = Math.min(g, p.clientWidth - m), x = Math.min(x, p.clientHeight - b), this.element.style.left = `${m}px`, this.element.style.top = `${b}px`, this.element.style.width = `${Math.max(v, g)}px`, this.element.style.height = `${Math.max(y, x)}px`;
5741
+ const p = this.element.parentElement, h = d.clientX - c.x, m = d.clientY - c.y, v = 420, y = 320;
5742
+ let f = c.left, b = c.top, g = c.width, x = c.height;
5743
+ (c.corner === "tr" || c.corner === "br") && (g = Math.max(v, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (g = Math.max(v, c.width - h), f = c.left + c.width - g), c.corner === "tr" && (x = Math.max(y, c.height - m), b = c.top + c.height - x), (c.corner === "br" || c.corner === "bl") && (x = Math.max(y, c.height + m)), c.corner === "tl" && (x = Math.max(y, c.height - m), b = c.top + c.height - x), f = Math.max(0, Math.min(f, Math.max(0, p.clientWidth - g))), b = Math.max(0, Math.min(b, Math.max(0, p.clientHeight - x))), g = Math.min(g, p.clientWidth - f), x = Math.min(x, p.clientHeight - b), this.element.style.left = `${f}px`, this.element.style.top = `${b}px`, this.element.style.width = `${Math.max(v, g)}px`, this.element.style.height = `${Math.max(y, x)}px`;
5634
5744
  });
5635
5745
  const l = () => {
5636
5746
  this.windowResize = null;
@@ -5678,7 +5788,7 @@ class Xs {
5678
5788
  if (this.snapshot = e, !this.opened) return;
5679
5789
  if (this.modelNodes !== e.nodes) {
5680
5790
  this.modelNodes = e.nodes;
5681
- const i = Ys(e);
5791
+ const i = Js(e);
5682
5792
  this.bounds = i;
5683
5793
  const r = new Map(i.nodes.map((n) => [n.node.id, n]));
5684
5794
  this.graph.innerHTML = i.edges.map((n) => {
@@ -5725,7 +5835,7 @@ class Xs {
5725
5835
  this.graph.setAttribute("transform", `translate(${this.x} ${this.y}) scale(${this.scale})`);
5726
5836
  }
5727
5837
  }
5728
- class Ws {
5838
+ class en {
5729
5839
  constructor(e, t, i, r, n) {
5730
5840
  u(this, "namesVisible", !1);
5731
5841
  u(this, "element", document.createElement("div"));
@@ -5736,19 +5846,19 @@ class Ws {
5736
5846
  this.theme = t;
5737
5847
  const r = !e.dynamicsAvailable || e.mode === "dynamics-initializing", n = e.dynamicsMessage ?? (e.dynamicsAvailable ? "点击后初始化并启动 MuJoCo 动力学仿真" : "URDF 未提供可用的惯性数据,无法启动动力学仿真");
5738
5848
  this.root.innerHTML = `
5739
- ${se("collision", "碰撞", e.overlays.collision, "collision")}
5740
- ${se("jointAxis", "关节轴", e.overlays.jointAxis, "axis")}
5741
- ${se("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
5742
- ${se("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
5849
+ ${ae("collision", "碰撞", e.overlays.collision, "collision")}
5850
+ ${ae("jointAxis", "关节轴", e.overlays.jointAxis, "axis")}
5851
+ ${ae("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
5852
+ ${ae("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
5743
5853
  <button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${M("names")}名称</button>
5744
- ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? Ns(i) : ""}
5854
+ ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? Us(i) : ""}
5745
5855
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5746
- ${ne("ground", pt(this.ctx) ? "隐藏地面" : "显示地面", pt(this.ctx), "ground")}
5747
- ${ne("fit", "适应视图", !1, "fit")}
5748
- ${ne("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
5856
+ ${oe("ground", vt(this.ctx) ? "隐藏地面" : "显示地面", vt(this.ctx), "ground")}
5857
+ ${oe("fit", "适应视图", !1, "fit")}
5858
+ ${oe("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
5749
5859
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5750
- ${Gs(e, r, n)}
5751
- ${ne("reset", "重置", !1, "reset")}
5860
+ ${tn(e, r, n)}
5861
+ ${oe("reset", "重置", !1, "reset")}
5752
5862
  `, this.bind(e);
5753
5863
  }
5754
5864
  dispose() {
@@ -5774,57 +5884,57 @@ class Ws {
5774
5884
  });
5775
5885
  }
5776
5886
  }
5777
- function se(s, e, t, i) {
5887
+ function ae(s, e, t, i) {
5778
5888
  return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-overlay="${s}" data-active="${t}" aria-pressed="${t}">${M(i)}${e}</button>`;
5779
5889
  }
5780
- function ne(s, e, t, i) {
5890
+ function oe(s, e, t, i) {
5781
5891
  const r = s === "ground" ? ` aria-pressed="${t}"` : "";
5782
5892
  return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${s}"${r} title="${e}" aria-label="${e}">${M(i)}${s === "reset" ? e : ""}</button>`;
5783
5893
  }
5784
- function Gs(s, e, t) {
5894
+ function tn(s, e, t) {
5785
5895
  const i = s.mode === "dynamics-running", r = i ? "暂停仿真" : s.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
5786
5896
  return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${k(t)}">${M(i ? "pause" : "play")}${r}</button>`;
5787
5897
  }
5788
- function pt(s) {
5898
+ function vt(s) {
5789
5899
  return s.asset.$readControl().groundVisible;
5790
5900
  }
5791
- class Ks {
5901
+ class rn {
5792
5902
  constructor() {
5793
5903
  u(this, "element", document.createElement("footer"));
5794
5904
  this.element.className = "vurdf-status";
5795
5905
  }
5796
5906
  update(e) {
5797
5907
  const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
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>${Zs(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5908
+ 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>${sn(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5799
5909
  }
5800
5910
  dispose() {
5801
5911
  this.element.remove();
5802
5912
  }
5803
5913
  }
5804
- function Zs(s) {
5914
+ function sn(s) {
5805
5915
  return s === "kinematic" ? "运动学预览" : s === "dynamics-running" ? "动力学仿真运行中" : s === "dynamics-paused" ? "动力学仿真已暂停" : s === "dynamics-initializing" ? "正在初始化动力学" : "动力学不可用";
5806
5916
  }
5807
- class Js {
5917
+ class nn {
5808
5918
  constructor(e, t, i, r, n, a, o) {
5809
5919
  u(this, "diagram");
5810
5920
  u(this, "structure");
5811
5921
  u(this, "inspector");
5812
5922
  u(this, "toolbar");
5813
- u(this, "statusbar", new Ks());
5923
+ u(this, "statusbar", new rn());
5814
5924
  u(this, "gizmo", document.createElement("div"));
5815
5925
  u(this, "disposed", !1);
5816
5926
  u(this, "angleUnit", "rad");
5817
5927
  u(this, "nameLabels", null);
5818
5928
  u(this, "pointerCleanup", null);
5819
5929
  u(this, "resizeCleanup", null);
5820
- this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new Fs(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new _s(t), this.toolbar = new Ws(t, i, r, (l) => {
5930
+ this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new js(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new Ys(t), this.toolbar = new en(t, i, r, (l) => {
5821
5931
  var d;
5822
5932
  return (d = this.nameLabels) == null ? void 0 : d.setVisible(l);
5823
5933
  }, () => {
5824
5934
  this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
5825
- }), this.diagram = new Xs((l) => this.selectFromScene(l), () => {
5935
+ }), this.diagram = new Qs((l) => this.selectFromScene(l), () => {
5826
5936
  this.structure.setDiagramOpen(!1), this.structure.focusDiagramButton();
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 Is(e, a, o, t)), a && (this.pointerCleanup = Ts(a, t, () => this.inspector.stopSweep(!1), o));
5937
+ }, () => 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 Ns(e, a, o, t)), a && (this.pointerCleanup = Vs(a, t, () => this.inspector.stopSweep(!1), o));
5828
5938
  }
5829
5939
  render(e) {
5830
5940
  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());
@@ -5834,7 +5944,7 @@ class Js {
5834
5944
  }
5835
5945
  updateGizmo() {
5836
5946
  var e;
5837
- this.gizmo.innerHTML = Ms(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Jt());
5947
+ this.gizmo.innerHTML = zs(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new ti());
5838
5948
  }
5839
5949
  setTheme(e) {
5840
5950
  this.theme !== e && (this.theme = e, this.render(this.inspection.getSnapshot()));
@@ -5865,14 +5975,14 @@ class Js {
5865
5975
  var v;
5866
5976
  if (d.button !== 0) return;
5867
5977
  d.preventDefault(), this.root.classList.add("is-resizing"), (v = o.setPointerCapture) == null || v.call(o, d.pointerId);
5868
- const c = d.clientX, p = t.getBoundingClientRect().width, h = (y) => l(p + (e === "left" ? 1 : -1) * (y.clientX - c)), f = () => {
5869
- o.removeEventListener("pointermove", h), o.removeEventListener("pointerup", f), o.removeEventListener("pointercancel", f), o.removeEventListener("lostpointercapture", f), this.resizeCleanup = null, this.root.classList.remove("is-resizing");
5978
+ const c = d.clientX, p = t.getBoundingClientRect().width, h = (y) => l(p + (e === "left" ? 1 : -1) * (y.clientX - c)), m = () => {
5979
+ o.removeEventListener("pointermove", h), o.removeEventListener("pointerup", m), o.removeEventListener("pointercancel", m), o.removeEventListener("lostpointercapture", m), this.resizeCleanup = null, this.root.classList.remove("is-resizing");
5870
5980
  };
5871
- this.resizeCleanup = f, o.addEventListener("pointermove", h), o.addEventListener("pointerup", f), o.addEventListener("pointercancel", f), o.addEventListener("lostpointercapture", f);
5981
+ this.resizeCleanup = m, o.addEventListener("pointermove", h), o.addEventListener("pointerup", m), o.addEventListener("pointercancel", m), o.addEventListener("lostpointercapture", m);
5872
5982
  });
5873
5983
  }
5874
5984
  }
5875
- const Qs = `
5985
+ const an = `
5876
5986
  .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}
5877
5987
  .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}
5878
5988
  .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)}
@@ -5997,19 +6107,19 @@ const Qs = `
5997
6107
 
5998
6108
  .vurdf-diagram button:focus-visible{outline:2px solid var(--vurdf-accent)}
5999
6109
  @media(max-width:600px){.vurdf-diagram{width:calc(100% - 16px);height:calc(100% - 60px)}}
6000
- `, en = "urdf";
6001
- function tn(s) {
6110
+ `, on = "urdf";
6111
+ function ln(s) {
6002
6112
  let e = null, t = null, i = null, r = null, n = null, a = null;
6003
6113
  const o = [];
6004
6114
  return {
6005
6115
  id: "nebula.ui.urdf",
6006
6116
  activate(l) {
6007
6117
  var p;
6008
- t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = Qs, (p = s.shadowRoot()) == null || p.append(t);
6118
+ t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = an, (p = s.shadowRoot()) == null || p.append(t);
6009
6119
  const d = document.createElement("div");
6010
- d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: en });
6120
+ d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: on });
6011
6121
  const c = () => {
6012
- var f;
6122
+ var m;
6013
6123
  const h = l.asset.$inspection();
6014
6124
  if (h === a && i) {
6015
6125
  i.render(h.getSnapshot());
@@ -6019,7 +6129,7 @@ function tn(s) {
6019
6129
  d.hidden = !0;
6020
6130
  return;
6021
6131
  }
6022
- d.hidden = !1, i = new Js(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());
6132
+ d.hidden = !1, i = new nn(d, h, l, s.theme(), s.cameraQuaternion, (m = s.interactionCanvas) == null ? void 0 : m.call(s), s.interactionCamera), r = h.subscribe((v) => i == null ? void 0 : i.render(v)), i.render(h.getSnapshot());
6023
6133
  };
6024
6134
  n = s.onThemeChange((h) => i == null ? void 0 : i.setTheme(h)), o.push(
6025
6135
  l.events.on("asset-change", c),
@@ -6030,12 +6140,12 @@ function tn(s) {
6030
6140
  }),
6031
6141
  l.events.on("pick", (h) => {
6032
6142
  var v;
6033
- const f = l.asset.$inspection();
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)));
6143
+ const m = l.asset.$inspection();
6144
+ (m == null ? void 0 : m.kind) === "urdf" && P(m.getSnapshot()) && (i == null || i.selectFromScene(gt(m, ((v = h.result) == null ? void 0 : v.object) ?? null)));
6035
6145
  }),
6036
6146
  l.events.on("selection-change", (h) => {
6037
- const f = l.asset.$inspection();
6038
- (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ft(f, h.object)));
6147
+ const m = l.asset.$inspection();
6148
+ (m == null ? void 0 : m.kind) === "urdf" && P(m.getSnapshot()) && (i == null || i.selectFromScene(gt(m, h.object)));
6039
6149
  })
6040
6150
  ), c();
6041
6151
  },
@@ -6045,7 +6155,7 @@ function tn(s) {
6045
6155
  }
6046
6156
  };
6047
6157
  }
6048
- function rn(s) {
6158
+ function dn(s) {
6049
6159
  let e = s;
6050
6160
  for (; e; ) {
6051
6161
  if (typeof e.userData.urdfEntityId == "string") return e.userData.urdfEntityId;
@@ -6053,12 +6163,12 @@ function rn(s) {
6053
6163
  }
6054
6164
  return null;
6055
6165
  }
6056
- function ft(s, e) {
6166
+ function gt(s, e) {
6057
6167
  var n;
6058
- const t = rn(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6168
+ const t = dn(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6059
6169
  return r ? ((n = i.nodes.find((a) => a.kind === "joint" && a.childLink === r.name)) == null ? void 0 : n.id) ?? t : t;
6060
6170
  }
6061
- class sn {
6171
+ class cn {
6062
6172
  constructor(e, t, i, r, n, a, o, l = null, d = () => null) {
6063
6173
  u(this, "pluginsById", /* @__PURE__ */ new Map());
6064
6174
  u(this, "contributions", []);
@@ -6266,7 +6376,7 @@ class sn {
6266
6376
  n.dataset.viewerContribution = "toolbar", n.dataset.viewerContributionId = t.id;
6267
6377
  for (const a of t.items) {
6268
6378
  const o = document.createElement("button");
6269
- o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", nn(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);
6379
+ o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", un(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);
6270
6380
  }
6271
6381
  this.hostElement.append(n), e.cleanup = () => n.remove();
6272
6382
  return;
@@ -6325,12 +6435,12 @@ class sn {
6325
6435
  if (this.disposed) throw new Error("Viewer plugin manager has been disposed.");
6326
6436
  }
6327
6437
  }
6328
- function nn(s) {
6438
+ function un(s) {
6329
6439
  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>`;
6330
6440
  }
6331
- function an(s, e, t) {
6441
+ function hn(s, e, t) {
6332
6442
  var p;
6333
- const i = dn(s), r = ln([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || un(s), a = Ae(s) ? pn(s.files, s.entry, n) : n, o = Vt(s), l = e.baseUrl ?? hn(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [V(h.path), h])) : null;
6443
+ const i = mn(s), r = fn([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || gn(s), a = Me(s) ? yn(s.files, s.entry, n) : n, o = Bt(s), l = e.baseUrl ?? bn(o), d = /* @__PURE__ */ new Set(), c = Me(s) ? new Map(s.files.map((h) => [V(h.path), h])) : null;
6334
6444
  return Object.freeze({
6335
6445
  original: s,
6336
6446
  entryPath: a,
@@ -6340,23 +6450,23 @@ function an(s, e, t) {
6340
6450
  baseUrl: l,
6341
6451
  hasResourceResolver: !!e.resourceResolver,
6342
6452
  async resolve(h) {
6343
- mt(r);
6344
- const f = V(h), v = cn(s);
6345
- if (v && (!f || f === V(a ?? ""))) {
6453
+ bt(r);
6454
+ const m = V(h), v = vn(s);
6455
+ if (v && (!m || m === V(a ?? ""))) {
6346
6456
  const b = URL.createObjectURL(v);
6347
6457
  return d.add(b), b;
6348
6458
  }
6349
- const y = (c == null ? void 0 : c.get(f)) ?? fn(c, a, f);
6459
+ const y = (c == null ? void 0 : c.get(m)) ?? xn(c, a, m);
6350
6460
  if (y) {
6351
6461
  const b = URL.createObjectURL(y.file);
6352
6462
  return d.add(b), b;
6353
6463
  }
6354
- const m = await mn(e.resourceResolver, h, r);
6355
- if (mt(r), m instanceof Blob) {
6356
- const b = URL.createObjectURL(m);
6464
+ const f = await wn(e.resourceResolver, h, r);
6465
+ if (bt(r), f instanceof Blob) {
6466
+ const b = URL.createObjectURL(f);
6357
6467
  return d.add(b), b;
6358
6468
  }
6359
- return m instanceof URL ? m.href : typeof m == "string" ? m : l ? new URL(h, l).href : h;
6469
+ return f instanceof URL ? f.href : typeof f == "string" ? f : l ? new URL(h, l).href : h;
6360
6470
  },
6361
6471
  release() {
6362
6472
  for (const h of d) URL.revokeObjectURL(h);
@@ -6364,7 +6474,7 @@ function an(s, e, t) {
6364
6474
  }
6365
6475
  });
6366
6476
  }
6367
- function on(s) {
6477
+ function pn(s) {
6368
6478
  var r;
6369
6479
  const e = s.entryPath ?? s.url;
6370
6480
  if (!e) return null;
@@ -6381,7 +6491,7 @@ function on(s) {
6381
6491
  const i = /\.([a-z0-9]+)$/i.exec(t);
6382
6492
  return ((r = i == null ? void 0 : i[1]) == null ? void 0 : r.toLowerCase()) ?? null;
6383
6493
  }
6384
- function ln(s) {
6494
+ function fn(s) {
6385
6495
  const e = s.filter((r) => !!r);
6386
6496
  if (e.length === 0) return new AbortController().signal;
6387
6497
  if (e.length === 1) return e[0];
@@ -6396,31 +6506,31 @@ function ln(s) {
6396
6506
  }
6397
6507
  return t.signal;
6398
6508
  }
6399
- function mt(s) {
6509
+ function bt(s) {
6400
6510
  if (s.aborted)
6401
6511
  throw typeof s.throwIfAborted == "function" && s.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
6402
6512
  }
6403
- function dn(s) {
6513
+ function mn(s) {
6404
6514
  return typeof s == "object" && s !== null && "signal" in s ? s.signal : void 0;
6405
6515
  }
6406
- function Vt(s) {
6516
+ function Bt(s) {
6407
6517
  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;
6408
6518
  }
6409
- function cn(s) {
6519
+ function vn(s) {
6410
6520
  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;
6411
6521
  }
6412
- function un(s) {
6522
+ function gn(s) {
6413
6523
  var t;
6414
- const e = Vt(s);
6524
+ const e = Bt(s);
6415
6525
  if (e)
6416
6526
  try {
6417
6527
  return decodeURIComponent(new URL(e, "https://viewer.invalid/").pathname.split("/").pop() || "") || null;
6418
6528
  } catch {
6419
6529
  return ((t = e.split(/[?#]/, 1)[0]) == null ? void 0 : t.split("/").pop()) || null;
6420
6530
  }
6421
- return Ae(s) ? s.entry ?? null : typeof File < "u" && s instanceof File && s.name || null;
6531
+ return Me(s) ? s.entry ?? null : typeof File < "u" && s instanceof File && s.name || null;
6422
6532
  }
6423
- function hn(s) {
6533
+ function bn(s) {
6424
6534
  var e;
6425
6535
  if (!s) return null;
6426
6536
  try {
@@ -6429,14 +6539,14 @@ function hn(s) {
6429
6539
  return null;
6430
6540
  }
6431
6541
  }
6432
- function Ae(s) {
6542
+ function Me(s) {
6433
6543
  return typeof s == "object" && s !== null && "kind" in s && s.kind === "files";
6434
6544
  }
6435
- function pn(s, e, t) {
6545
+ function yn(s, e, t) {
6436
6546
  if (e) {
6437
6547
  const i = V(e);
6438
6548
  if (!s.some((r) => V(r.path) === i))
6439
- throw vt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6549
+ throw yt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6440
6550
  return i;
6441
6551
  }
6442
6552
  if (t) {
@@ -6444,9 +6554,9 @@ function pn(s, e, t) {
6444
6554
  if (s.filter((n) => V(n.path) === i).length === 1) return i;
6445
6555
  }
6446
6556
  if (s.length === 1) return V(s[0].path);
6447
- throw vt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6557
+ throw yt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6448
6558
  }
6449
- function fn(s, e, t) {
6559
+ function xn(s, e, t) {
6450
6560
  if (!s || !e) return;
6451
6561
  const i = e.lastIndexOf("/"), r = i < 0 ? "" : e.slice(0, i + 1);
6452
6562
  return s.get(V(`${r}${t}`));
@@ -6457,13 +6567,13 @@ function V(s) {
6457
6567
  !t || t === "." || (t === ".." ? e.pop() : e.push(t));
6458
6568
  return e.join("/");
6459
6569
  }
6460
- async function mn(s, e, t) {
6570
+ async function wn(s, e, t) {
6461
6571
  return s ? s.resolve(e, { signal: t }) : null;
6462
6572
  }
6463
- function vt(s, e) {
6573
+ function yt(s, e) {
6464
6574
  return Object.assign(new Error(s), { code: e });
6465
6575
  }
6466
- const gt = Object.freeze({
6576
+ const xt = Object.freeze({
6467
6577
  canPlay: !1,
6468
6578
  canPause: !1,
6469
6579
  canReset: !1,
@@ -6473,8 +6583,8 @@ const gt = Object.freeze({
6473
6583
  }), q = Object.freeze({
6474
6584
  light: 15265002,
6475
6585
  dark: 593167
6476
- }), vn = 0.05;
6477
- class gn {
6586
+ }), Cn = 0.05;
6587
+ class En {
6478
6588
  constructor(e) {
6479
6589
  u(this, "epoch", 0);
6480
6590
  u(this, "active", null);
@@ -6506,9 +6616,9 @@ class gn {
6506
6616
  epoch: n,
6507
6617
  abort: new AbortController(),
6508
6618
  listeners: /* @__PURE__ */ new Set(),
6509
- ready: ye(),
6510
- finished: ye(),
6511
- closeResult: ye(),
6619
+ ready: Ce(),
6620
+ finished: Ce(),
6621
+ closeResult: Ce(),
6512
6622
  options: t,
6513
6623
  snapshot: Object.freeze({ revision: 0, phase: "detecting", format: null, kind: null, capabilities: null, error: null, filename: null }),
6514
6624
  dynamic: !1,
@@ -6518,6 +6628,7 @@ class gn {
6518
6628
  disposing: !1,
6519
6629
  cleanupErrors: [],
6520
6630
  groundVisible: !0,
6631
+ groundGridScale: Q,
6521
6632
  collisionVisible: !1,
6522
6633
  upAxis: null,
6523
6634
  grabbing: !1
@@ -6605,7 +6716,7 @@ class gn {
6605
6716
  var r;
6606
6717
  const t = this.active;
6607
6718
  if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.playing || !((r = t.session) != null && r.update)) return !1;
6608
- const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, vn));
6719
+ const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, Cn));
6609
6720
  t.resetFrameClock = !1;
6610
6721
  try {
6611
6722
  return !!(t.session.update(i) && this.current(t) && t.snapshot.phase === "ready" && t.playing);
@@ -6620,7 +6731,7 @@ class gn {
6620
6731
  var i, r;
6621
6732
  try {
6622
6733
  if (!this.current(e)) return;
6623
- e.source = an(t, e.options, e.abort.signal);
6734
+ e.source = hn(t, e.options, e.abort.signal);
6624
6735
  const n = e.source.signal, a = () => {
6625
6736
  this.stop(e, "E_ABORTED");
6626
6737
  };
@@ -6628,7 +6739,7 @@ class gn {
6628
6739
  a();
6629
6740
  return;
6630
6741
  }
6631
- const o = this.detect(e), l = bt(o) ? await o : o;
6742
+ const o = this.detect(e), l = wt(o) ? await o : o;
6632
6743
  if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
6633
6744
  if (!this.host.loaders().includes(l.loader))
6634
6745
  throw T("Asset loader was removed.", "E_ABORTED");
@@ -6659,7 +6770,7 @@ class gn {
6659
6770
  if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
6660
6771
  const v = e.session;
6661
6772
  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, {
6662
- capabilities: v.capabilities ?? gt,
6773
+ capabilities: v.capabilities ?? xt,
6663
6774
  physics: v.physics ?? null,
6664
6775
  warning: v.warning ?? null
6665
6776
  }), this.publishControl(e), this.host.requestRender();
@@ -6667,31 +6778,31 @@ class gn {
6667
6778
  reportProgress: (v, y) => {
6668
6779
  this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: v, message: y });
6669
6780
  }
6670
- }, h = l.loader.createSession(e.source, p), f = bt(h) ? await h : h;
6671
- if (e.session && e.session !== f) {
6672
- f.beginDispose(), await f.dispose();
6781
+ }, h = l.loader.createSession(e.source, p), m = wt(h) ? await h : h;
6782
+ if (e.session && e.session !== m) {
6783
+ m.beginDispose(), await m.dispose();
6673
6784
  return;
6674
6785
  }
6675
- if (e.session = f, !this.current(e)) {
6786
+ if (e.session = m, !this.current(e)) {
6676
6787
  this.beginDispose(e);
6677
6788
  return;
6678
6789
  }
6679
- if (await Promise.race([f.opened, new Promise((v) => {
6790
+ if (await Promise.race([m.opened, new Promise((v) => {
6680
6791
  n.aborted ? v() : n.addEventListener("abort", () => v(), { once: !0 });
6681
6792
  })]), !this.current(e) || e.snapshot.phase === "failed") return;
6682
- if (f.root) {
6683
- if (e.mounted = f.root, this.host.mount(f.root), !this.current(e)) return;
6684
- if (((i = f.presentation ?? l.loader.presentation) == null ? void 0 : i.fitPolicy) === "fit-on-ready") {
6685
- const v = ((r = f.getFitBounds) == null ? void 0 : r.call(f)) ?? f.fitTarget ?? f.root;
6793
+ if (m.root) {
6794
+ if (e.mounted = m.root, this.host.mount(m.root), !this.current(e)) return;
6795
+ if (((i = m.presentation ?? l.loader.presentation) == null ? void 0 : i.fitPolicy) === "fit-on-ready") {
6796
+ const v = ((r = m.getFitBounds) == null ? void 0 : r.call(m)) ?? m.fitTarget ?? m.root;
6686
6797
  if (!this.host.fit(v, { padding: 1.15 })) throw T("Asset has no displayable geometry.", "E_ASSET_EMPTY");
6687
6798
  }
6688
6799
  }
6689
6800
  if (!this.current(e)) return;
6690
- e.dynamic = typeof f.update == "function", e.playing = e.dynamic && f.autoPlay !== !1, e.resetFrameClock = e.playing, this.transition(e, {
6801
+ e.dynamic = typeof m.update == "function", e.playing = e.dynamic && m.autoPlay !== !1, e.resetFrameClock = e.playing, this.transition(e, {
6691
6802
  phase: "ready",
6692
- capabilities: f.capabilities ?? gt,
6693
- warning: f.warning ?? null,
6694
- physics: f.physics ?? null
6803
+ capabilities: m.capabilities ?? xt,
6804
+ warning: m.warning ?? null,
6805
+ physics: m.physics ?? null
6695
6806
  }), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
6696
6807
  } catch (n) {
6697
6808
  this.current(e) && this.report(e, n, { fatal: !0, stage: "load" });
@@ -6700,7 +6811,7 @@ class gn {
6700
6811
  }
6701
6812
  }
6702
6813
  detect(e) {
6703
- const t = e.source, i = this.host.loaders(), r = e.options.format, n = on(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6814
+ const t = e.source, i = this.host.loaders(), r = e.options.format, n = pn(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6704
6815
  if (a) {
6705
6816
  const o = i.find((l) => l.formats.includes(a));
6706
6817
  if (o) return { loader: o, format: a };
@@ -6807,12 +6918,13 @@ class gn {
6807
6918
  this.requireCapability(e, "canToggleGround", "Ground display unavailable."), this.requireSession(e, "setGroundVisible", "Ground display unavailable.")(t), e.groundVisible = t, this.publishControl(e), this.current(e) && this.host.requestRender();
6808
6919
  }
6809
6920
  controlStateOf(e) {
6810
- var t, i, r, n, a, o;
6921
+ var t, i, r, n, a, o, l, d;
6811
6922
  return Object.freeze({
6812
6923
  playing: ((i = (t = e.session) == null ? void 0 : t.isPlaying) == null ? void 0 : i.call(t)) ?? e.playing,
6813
6924
  groundVisible: ((n = (r = e.session) == null ? void 0 : r.getGroundVisible) == null ? void 0 : n.call(r)) ?? e.groundVisible,
6925
+ groundGridScale: ((o = (a = e.session) == null ? void 0 : a.getGroundGridScale) == null ? void 0 : o.call(a)) ?? e.groundGridScale,
6814
6926
  collisionVisible: e.collisionVisible,
6815
- upAxis: ((o = (a = e.session) == null ? void 0 : a.getUpAxis) == null ? void 0 : o.call(a)) ?? e.upAxis
6927
+ upAxis: ((d = (l = e.session) == null ? void 0 : l.getUpAxis) == null ? void 0 : d.call(l)) ?? e.upAxis
6816
6928
  });
6817
6929
  }
6818
6930
  publishControl(e) {
@@ -6841,7 +6953,13 @@ class gn {
6841
6953
  /** Control state for `ctx.asset.$readControl()`. */
6842
6954
  getActiveControlState() {
6843
6955
  const e = this.active;
6844
- return !e || !this.current(e) ? Object.freeze({ playing: !1, groundVisible: !0, collisionVisible: !1, upAxis: null }) : this.controlStateOf(e);
6956
+ return !e || !this.current(e) ? Object.freeze({
6957
+ playing: !1,
6958
+ groundVisible: !0,
6959
+ groundGridScale: Q,
6960
+ collisionVisible: !1,
6961
+ upAxis: null
6962
+ }) : this.controlStateOf(e);
6845
6963
  }
6846
6964
  getActiveUpAxis() {
6847
6965
  var t, i;
@@ -6969,9 +7087,9 @@ class gn {
6969
7087
  }
6970
7088
  }
6971
7089
  transition(e, t) {
6972
- var r, n, a, o;
7090
+ var r, n, a, o, l, d;
6973
7091
  const i = e.snapshot.phase;
6974
- e.snapshot = Object.freeze({ ...e.snapshot, ...t, revision: e.snapshot.revision + 1 }), this.publish(e), i !== "ready" && e.snapshot.phase === "ready" && (e.groundVisible = ((n = (r = e.session) == null ? void 0 : r.getGroundVisible) == null ? void 0 : n.call(r)) ?? !0, e.upAxis = ((o = (a = e.session) == null ? void 0 : a.getUpAxis) == null ? void 0 : o.call(a)) ?? null, this.publishControl(e));
7092
+ e.snapshot = Object.freeze({ ...e.snapshot, ...t, revision: e.snapshot.revision + 1 }), this.publish(e), i !== "ready" && e.snapshot.phase === "ready" && (e.groundVisible = ((n = (r = e.session) == null ? void 0 : r.getGroundVisible) == null ? void 0 : n.call(r)) ?? !0, e.groundGridScale = ((o = (a = e.session) == null ? void 0 : a.getGroundGridScale) == null ? void 0 : o.call(a)) ?? Q, e.upAxis = ((d = (l = e.session) == null ? void 0 : l.getUpAxis) == null ? void 0 : d.call(l)) ?? null, this.publishControl(e));
6975
7093
  }
6976
7094
  publish(e) {
6977
7095
  const t = e.snapshot, i = [...e.listeners];
@@ -6989,7 +7107,7 @@ class gn {
6989
7107
  }
6990
7108
  }
6991
7109
  }
6992
- function ye() {
7110
+ function Ce() {
6993
7111
  let s, e;
6994
7112
  const t = new Promise((i, r) => {
6995
7113
  s = i, e = r;
@@ -7000,10 +7118,10 @@ function ye() {
7000
7118
  function T(s, e) {
7001
7119
  return Object.assign(new Error(s), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
7002
7120
  }
7003
- function bt(s) {
7121
+ function wt(s) {
7004
7122
  return !!(s && typeof s.then == "function");
7005
7123
  }
7006
- const bn = {
7124
+ const Sn = {
7007
7125
  id: "nebula-asset-model",
7008
7126
  activate(s) {
7009
7127
  s.contribute({
@@ -7021,13 +7139,13 @@ const bn = {
7021
7139
  clearColor: q.dark
7022
7140
  },
7023
7141
  async createSession(e, t) {
7024
- const { createModelSession: i } = await import("./session-BzIziNzg.js");
7142
+ const { createModelSession: i } = await import("./session-CCDMlwej.js");
7025
7143
  return i(e, t);
7026
7144
  }
7027
7145
  });
7028
7146
  }
7029
7147
  };
7030
- function yn(s, e, t) {
7148
+ function kn(s, e, t) {
7031
7149
  let i = !1, r = !1;
7032
7150
  const n = {
7033
7151
  ...t.options.cad,
@@ -7056,7 +7174,7 @@ function yn(s, e, t) {
7056
7174
  }
7057
7175
  };
7058
7176
  }
7059
- function xn(s) {
7177
+ function Pn(s) {
7060
7178
  return {
7061
7179
  id: "nebula-asset-cad",
7062
7180
  activate(e) {
@@ -7071,24 +7189,24 @@ function xn(s) {
7071
7189
  uiProfile: "cad",
7072
7190
  fitPolicy: "restore-then-fit"
7073
7191
  },
7074
- createSession: (t, i) => yn(s, t, i)
7192
+ createSession: (t, i) => kn(s, t, i)
7075
7193
  });
7076
7194
  }
7077
7195
  };
7078
7196
  }
7079
- function wn(s) {
7197
+ function An(s) {
7080
7198
  const e = s.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
7081
7199
  return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
7082
7200
  }
7083
- async function Cn(s) {
7201
+ async function Rn(s) {
7084
7202
  const e = s.entryPath ?? s.filename ?? s.url ?? "";
7085
7203
  if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
7086
7204
  const t = await s.resolve(e), i = await fetch(t, { signal: s.signal });
7087
7205
  if (!i.ok) return null;
7088
- const r = wn(await i.text());
7206
+ const r = An(await i.text());
7089
7207
  return r ? { format: r } : null;
7090
7208
  }
7091
- const En = {
7209
+ const In = {
7092
7210
  id: "nebula-asset-simulation",
7093
7211
  activate(s) {
7094
7212
  s.contribute({
@@ -7096,7 +7214,7 @@ const En = {
7096
7214
  id: "nebula.simulation-loader",
7097
7215
  assetKind: "simulation",
7098
7216
  formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
7099
- match: Cn,
7217
+ match: Rn,
7100
7218
  presentation: {
7101
7219
  preferredViewMode: "3d",
7102
7220
  interactionMode: "simulation",
@@ -7105,12 +7223,12 @@ const En = {
7105
7223
  clearColor: q.dark
7106
7224
  },
7107
7225
  async createSession(e, t) {
7108
- const { createSimulationSession: i } = await import("./session-Boljcc3d.js").then((r) => r.f);
7226
+ const { createSimulationSession: i } = await import("./session-um40A-5F.js").then((r) => r.g);
7109
7227
  return i(e, t);
7110
7228
  }
7111
7229
  });
7112
7230
  }
7113
- }, ae = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", yt = {
7231
+ }, le = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", Ct = {
7114
7232
  dark: {
7115
7233
  hover: { color: 3528703, fillOpacity: 0, edgeOpacity: 0.85 },
7116
7234
  selected: { color: 5999871, fillOpacity: 0.24, edgeOpacity: 1 }
@@ -7119,8 +7237,8 @@ const En = {
7119
7237
  hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
7120
7238
  selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
7121
7239
  }
7122
- }, Sn = 6, kn = 12, Pn = 160, An = 160, Rn = 50, xt = 592655;
7123
- class In {
7240
+ }, Mn = 6, Ln = 12, Tn = 160, Dn = 160, On = 50, Et = 592655;
7241
+ class Nn {
7124
7242
  constructor(e, t) {
7125
7243
  u(this, "cad");
7126
7244
  u(this, "mountedObjects", /* @__PURE__ */ new Set());
@@ -7136,9 +7254,9 @@ class In {
7136
7254
  u(this, "interactionRenderLastTs", null);
7137
7255
  u(this, "cadHoveredInsert", null);
7138
7256
  u(this, "cadPointerPosition", null);
7139
- u(this, "pointerDragTracker", new Nr({
7140
- distancePx: Sn,
7141
- pathPx: kn
7257
+ u(this, "pointerDragTracker", new $r({
7258
+ distancePx: Mn,
7259
+ pathPx: Ln
7142
7260
  }));
7143
7261
  u(this, "cadCapability");
7144
7262
  u(this, "cadHost");
@@ -7263,8 +7381,8 @@ class In {
7263
7381
  u(this, "handlePointerLeave", (e) => {
7264
7382
  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));
7265
7383
  });
7266
- var i, r, n, a, o, l, d, c, p, h, f, v, y, m, b;
7267
- this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? pr(), 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 Mr(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7384
+ var i, r, n, a, o, l, d, c, p, h, m, v, y, f, b;
7385
+ this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? vr(), 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 Dr(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7268
7386
  this.assertActive();
7269
7387
  const { filename: w, signal: C, ...D } = x;
7270
7388
  await this.assetController.open(g, { format: "cad", filename: w, signal: C, cad: D }, !0).ready;
@@ -7273,7 +7391,7 @@ class In {
7273
7391
  return A;
7274
7392
  }, this.cadCapability.close = () => {
7275
7393
  this.assertActive(), this.assetController.closeKind("cad");
7276
- }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new sn(
7394
+ }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = Ee(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new cn(
7277
7395
  () => this.cadCapability.getSnapshot(),
7278
7396
  () => ({
7279
7397
  viewMode: this.runtime.viewMode,
@@ -7307,7 +7425,7 @@ class In {
7307
7425
  e.viewport,
7308
7426
  this.layoutEngine,
7309
7427
  () => this.assetController.getActiveInspection()
7310
- ), this.assetController = new gn({
7428
+ ), this.assetController = new En({
7311
7429
  loaders: () => this.pluginManager.getAssetLoaders(),
7312
7430
  mount: (g) => this.mountAssetObject(g),
7313
7431
  detach: (g) => this.unmountAssetObject(g),
@@ -7320,14 +7438,14 @@ class In {
7320
7438
  cleanupError: (g) => {
7321
7439
  this.options.onCleanupError ? this.options.onCleanupError(g) : console.error("[viewer] asset cleanup failed", g);
7322
7440
  }
7323
- }), this.pluginManager.registerBuiltin(xn(this.cadCapability)), this.pluginManager.registerBuiltin(bn), this.pluginManager.registerBuiltin(En), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7441
+ }), this.pluginManager.registerBuiltin(Pn(this.cadCapability)), this.pluginManager.registerBuiltin(Sn), this.pluginManager.registerBuiltin(In), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7324
7442
  this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
7325
7443
  }), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
7326
7444
  this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
7327
7445
  }), this.assetChangeUnsubscribe = this.on("asset-change", (g) => {
7328
7446
  const x = g.snapshot.phase;
7329
7447
  (x === "closing" || x === "failed" || x === "closed") && this.endAssetGrab();
7330
- }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Rs(
7448
+ }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Os(
7331
7449
  {
7332
7450
  mountBuiltin: (g, x) => this.layoutEngine.mountBuiltin(g, x),
7333
7451
  shadowRoot: () => this.builtinUiShadow(),
@@ -7339,7 +7457,7 @@ class In {
7339
7457
  label: (g) => g === "simulation" ? "仿真控制" : "模型控制",
7340
7458
  scene: e.ui.scene
7341
7459
  }
7342
- )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(tn({
7460
+ )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(ln({
7343
7461
  interactionCanvas: () => this.options.canvas,
7344
7462
  interactionCamera: () => this.runtime.getActiveCamera(),
7345
7463
  cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
@@ -7350,13 +7468,13 @@ class In {
7350
7468
  })), this.interactionMode === "managed" && this.pluginManager.register({
7351
7469
  id: "nebula.ui.cad",
7352
7470
  activate: () => {
7353
- this.ui = new ps(this.createUiHost(), e.ui), this.ui.mount();
7471
+ this.ui = new vs(this.createUiHost(), e.ui), this.ui.mount();
7354
7472
  },
7355
7473
  deactivate: () => {
7356
7474
  var g;
7357
7475
  (g = this.ui) == null || g.dispose(), this.ui = null;
7358
7476
  }
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" && On(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({
7477
+ })), (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), (m = (h = this.options.canvas).addEventListener) == null || m.call(h, "pointerleave", this.handlePointerLeave), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "lostpointercapture", this.handleLostPointerCapture), (b = (f = this.options.canvas).addEventListener) == null || b.call(f, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && _n(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({
7360
7478
  renderExtension: { beforeRender: (g, x, w) => this.assetController.beforeRender(g, x, w) },
7361
7479
  onFrame: (g, x) => {
7362
7480
  this.assetController.update(x) && this.runtime.requestRender();
@@ -7487,9 +7605,9 @@ class In {
7487
7605
  }
7488
7606
  setHighlight(e, t = {}) {
7489
7607
  if (this.assertActive(), e && this.assertMounted(e), !(this.highlightedObjectValue === null && e === null)) {
7490
- if (this.runtime.removeOverlay(ae), this.highlightedObjectValue = e, e) {
7491
- const i = new Qt(e, t.color ?? 6000111);
7492
- i.name = ae, this.runtime.mountOverlay(ae, i, { owned: !0 });
7608
+ if (this.runtime.removeOverlay(le), this.highlightedObjectValue = e, e) {
7609
+ const i = new ii(e, t.color ?? 6000111);
7610
+ i.name = le, this.runtime.mountOverlay(le, i, { owned: !0 });
7493
7611
  }
7494
7612
  this.emit("highlight-change", { object: e });
7495
7613
  }
@@ -7515,14 +7633,14 @@ class In {
7515
7633
  this.assertActive(), this.pluginManager.use(e, t);
7516
7634
  }
7517
7635
  dispose() {
7518
- var e, t, i, r, n, a, o, l, d, c, p, h, f, v, y;
7636
+ var e, t, i, r, n, a, o, l, d, c, p, h, m, v, y;
7519
7637
  if (!this.disposed) {
7520
- this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (r = (i = this.options.canvas).removeEventListener) == null || r.call(i, "pointermove", this.handlePointerMove), (a = (n = this.options.canvas).removeEventListener) == null || a.call(n, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (v = (f = this.options.canvas).removeEventListener) == null || v.call(f, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (y = this.viewportResizeObserver) == null || y.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(ae), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
7521
- for (const m of this.mountedObjects)
7522
- this.runtime.removeObject(m, { dispose: !1 });
7638
+ this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (r = (i = this.options.canvas).removeEventListener) == null || r.call(i, "pointermove", this.handlePointerMove), (a = (n = this.options.canvas).removeEventListener) == null || a.call(n, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (v = (m = this.options.canvas).removeEventListener) == null || v.call(m, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (y = this.viewportResizeObserver) == null || y.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(le), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
7639
+ for (const f of this.mountedObjects)
7640
+ this.runtime.removeObject(f, { dispose: !1 });
7523
7641
  this.mountedObjects.clear();
7524
- for (const m of this.mountedAssetObjects)
7525
- this.runtime.removeObject(m, { dispose: !1 });
7642
+ for (const f of this.mountedAssetObjects)
7643
+ this.runtime.removeObject(f, { dispose: !1 });
7526
7644
  this.mountedAssetObjects.clear(), this.cadCapability.dispose(), this.layoutEngine.dispose(), this.listeners.clear(), this.runtime.dispose();
7527
7645
  }
7528
7646
  }
@@ -7542,7 +7660,7 @@ class In {
7542
7660
  createLayoutEngine() {
7543
7661
  var r;
7544
7662
  const e = this, t = this.options, i = (r = t.ui) == null ? void 0 : r.insetTarget;
7545
- return new gs({
7663
+ return new xs({
7546
7664
  reference: () => {
7547
7665
  var n;
7548
7666
  return ((n = t.ui) == null ? void 0 : n.root) ?? t.viewport;
@@ -7586,7 +7704,7 @@ class In {
7586
7704
  */
7587
7705
  resetAssetPresentation() {
7588
7706
  var e;
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();
7707
+ this.runtime.setClearColor(this.options.clearColor ?? Et), 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();
7590
7708
  }
7591
7709
  createCadHost() {
7592
7710
  const e = this;
@@ -7607,7 +7725,7 @@ class In {
7607
7725
  return e.cadCapability.getVisibilityRevision();
7608
7726
  },
7609
7727
  get viewportDemandCoalesceMs() {
7610
- return e.options.viewportDemandCoalesceMs ?? An;
7728
+ return e.options.viewportDemandCoalesceMs ?? Dn;
7611
7729
  },
7612
7730
  mountCadObject(t) {
7613
7731
  e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
@@ -7622,7 +7740,7 @@ class In {
7622
7740
  e.emit("content-change", { source: "cad" });
7623
7741
  },
7624
7742
  emitCameraChange(t = e.pendingCameraReason) {
7625
- e.lastCameraFingerprint = xe(e.runtime.captureCameraSnapshot()), e.emit("camera-change", {
7743
+ e.lastCameraFingerprint = Ee(e.runtime.captureCameraSnapshot()), e.emit("camera-change", {
7626
7744
  viewMode: e.runtime.viewMode,
7627
7745
  reason: t,
7628
7746
  interaction: e.interaction
@@ -7646,10 +7764,10 @@ class In {
7646
7764
  return ((n = e.runtime.screenToWorldOnPlane(t, i, r)) == null ? void 0 : n.clone()) ?? null;
7647
7765
  },
7648
7766
  readCameraSnapshot(t) {
7649
- return mr(e.cameraStateStore, t);
7767
+ return br(e.cameraStateStore, t);
7650
7768
  },
7651
7769
  persistCameraSnapshot(t, i) {
7652
- vr(e.cameraStateStore, t, i);
7770
+ yr(e.cameraStateStore, t, i);
7653
7771
  },
7654
7772
  getViewportSize() {
7655
7773
  return {
@@ -7684,7 +7802,7 @@ class In {
7684
7802
  if (!i || i.isEmpty()) return;
7685
7803
  const r = !!((o = e.details) != null && o.bbox);
7686
7804
  if (((d = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : d.enabled) === !1) return;
7687
- const n = r ? this.createCadInteractionOverlay(i, "selected") : new ei(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? yt.dark.selected.color);
7805
+ const n = r ? this.createCadInteractionOverlay(i, "selected") : new ri(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? Ct.dark.selected.color);
7688
7806
  n.name = U, this.runtime.mountOverlay(U, n, { owned: !0 });
7689
7807
  }
7690
7808
  dispatchCadSelectionChange() {
@@ -7702,18 +7820,18 @@ class In {
7702
7820
  r.name = j, this.runtime.mountOverlay(j, r, { owned: !0 });
7703
7821
  }
7704
7822
  createCadInteractionOverlay(e, t) {
7705
- var h, f;
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 = {
7823
+ var h, m;
7824
+ const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", r = Ct[i][t], n = (m = this.options.cadInteractionStyle) == null ? void 0 : m[t], a = {
7707
7825
  color: (n == null ? void 0 : n.color) ?? r.color,
7708
7826
  fillOpacity: (n == null ? void 0 : n.fillOpacity) ?? r.fillOpacity,
7709
7827
  edgeOpacity: (n == null ? void 0 : n.edgeOpacity) ?? r.edgeOpacity
7710
- }, o = new Et();
7828
+ }, o = new Pt();
7711
7829
  o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
7712
- const l = e.getSize(new S()), d = e.getCenter(new S()), c = new ti(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
7830
+ const l = e.getSize(new S()), d = e.getCenter(new S()), c = new si(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
7713
7831
  if (a.fillOpacity > 0) {
7714
- const v = new ii(
7832
+ const v = new ni(
7715
7833
  c.clone(),
7716
- new ri({
7834
+ new ai({
7717
7835
  color: a.color,
7718
7836
  transparent: !0,
7719
7837
  opacity: a.fillOpacity,
@@ -7723,9 +7841,9 @@ class In {
7723
7841
  );
7724
7842
  v.name = `${o.name}:fill`, v.position.copy(d), v.renderOrder = 1305, o.add(v);
7725
7843
  }
7726
- const p = new si(
7727
- new ni(c),
7728
- new ai({
7844
+ const p = new oi(
7845
+ new li(c),
7846
+ new di({
7729
7847
  color: a.color,
7730
7848
  transparent: !0,
7731
7849
  opacity: a.edgeOpacity,
@@ -7827,9 +7945,9 @@ class In {
7827
7945
  this.resetAssetPresentation();
7828
7946
  return;
7829
7947
  }
7830
- this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? xt), this.runtime.setNavigationPolicy(
7948
+ this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? Et), this.runtime.setNavigationPolicy(
7831
7949
  e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
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(Ln(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();
7950
+ ), 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(Fn(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();
7833
7951
  }
7834
7952
  resolveMixedBounds() {
7835
7953
  const e = this.assetController.getActiveFitBounds();
@@ -7845,12 +7963,12 @@ class In {
7845
7963
  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());
7846
7964
  }
7847
7965
  applyCameraSnapshot(e, t) {
7848
- if (!Ie(e)) return !1;
7966
+ if (!Te(e)) return !1;
7849
7967
  const i = this.runtime.viewMode;
7850
7968
  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;
7851
7969
  }
7852
7970
  detectCameraChange(e = !1) {
7853
- const t = xe(this.runtime.captureCameraSnapshot());
7971
+ const t = Ee(this.runtime.captureCameraSnapshot());
7854
7972
  return !e && t === this.lastCameraFingerprint ? !1 : (this.lastCameraFingerprint = t, this.cadCapability.onCameraChanged(this.pendingCameraReason), !0);
7855
7973
  }
7856
7974
  emitViewportChange() {
@@ -7867,7 +7985,7 @@ class In {
7867
7985
  shouldRenderCurrentFrame(e) {
7868
7986
  if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
7869
7987
  const t = e - this.interactionRenderLastTs;
7870
- return t < 0 || t >= Rn;
7988
+ return t < 0 || t >= On;
7871
7989
  }
7872
7990
  markInteractionActive() {
7873
7991
  this.clearInteractionIdleTimer(), this.setInteraction("active");
@@ -7875,7 +7993,7 @@ class In {
7875
7993
  scheduleInteractionIdle() {
7876
7994
  this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
7877
7995
  this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
7878
- }, Pn);
7996
+ }, Tn);
7879
7997
  }
7880
7998
  clearInteractionIdleTimer() {
7881
7999
  this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
@@ -7950,8 +8068,8 @@ class In {
7950
8068
  for (const i of this.listeners.get(e) ?? []) i(t);
7951
8069
  }
7952
8070
  }
7953
- function Jn(s) {
7954
- const e = new ar({
8071
+ function na(s) {
8072
+ const e = new dr({
7955
8073
  canvasArea: s.viewport,
7956
8074
  canvas: s.canvas,
7957
8075
  clearColor: s.clearColor,
@@ -7962,22 +8080,22 @@ function Jn(s) {
7962
8080
  environment: s.environment ?? "room",
7963
8081
  navigationPolicy: "viewer"
7964
8082
  });
7965
- return Mn(s, e);
8083
+ return zn(s, e);
7966
8084
  }
7967
- function Mn(s, e) {
7968
- return e.initialize(), new In(s, e);
8085
+ function zn(s, e) {
8086
+ return e.initialize(), new Nn(s, e);
7969
8087
  }
7970
- function Ln(s) {
7971
- return s === "cad" ? Tn : s === "model" ? wt : s === "simulation" ? /* @__PURE__ */ new Set([...wt, "urdf"]) : Dn;
8088
+ function Fn(s) {
8089
+ return s === "cad" ? Vn : s === "model" ? St : s === "simulation" ? /* @__PURE__ */ new Set([...St, "urdf"]) : $n;
7972
8090
  }
7973
- const Tn = /* @__PURE__ */ new Set(["cad"]), wt = /* @__PURE__ */ new Set(["scene"]), Dn = /* @__PURE__ */ new Set();
7974
- function xe(s) {
8091
+ const Vn = /* @__PURE__ */ new Set(["cad"]), St = /* @__PURE__ */ new Set(["scene"]), $n = /* @__PURE__ */ new Set();
8092
+ function Ee(s) {
7975
8093
  return s ? JSON.stringify(s) : null;
7976
8094
  }
7977
- function On(s) {
8095
+ function _n(s) {
7978
8096
  return !!(s && typeof s == "object" && s.nodeType === 1);
7979
8097
  }
7980
- const zn = "E_ASSET_RESOURCE_NOT_FOUND", Nn = "E_ASSET_RESOURCE_INVALID", Fn = "E_ASSET_FETCH", Vn = "E_ASSET_EXTERNAL_DENIED", $n = "E_ASSET_AUTH", _n = /* @__PURE__ */ new Set([
8098
+ const Bn = "E_ASSET_RESOURCE_NOT_FOUND", Un = "E_ASSET_RESOURCE_INVALID", jn = "E_ASSET_FETCH", Hn = "E_ASSET_EXTERNAL_DENIED", qn = "E_ASSET_AUTH", Yn = /* @__PURE__ */ new Set([
7981
8099
  "png",
7982
8100
  "jpg",
7983
8101
  "jpeg",
@@ -7990,55 +8108,58 @@ const zn = "E_ASSET_RESOURCE_NOT_FOUND", Nn = "E_ASSET_RESOURCE_INVALID", Fn = "
7990
8108
  "hdr",
7991
8109
  "exr",
7992
8110
  "ktx2"
7993
- ]), Bn = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
7994
- function Un(s) {
8111
+ ]), Xn = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
8112
+ function Gn(s) {
7995
8113
  var t;
7996
8114
  return ((t = (s.split(/[?#]/, 1)[0] ?? s).split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
7997
8115
  }
7998
- function Qn(s) {
7999
- const e = Un(s);
8000
- return _n.has(e) && !Bn.has(e);
8116
+ function aa(s) {
8117
+ const e = Gn(s);
8118
+ return Yn.has(e) && !Xn.has(e);
8001
8119
  }
8002
- function ea(s, e) {
8120
+ function oa(s, e) {
8003
8121
  return Object.assign(new Error(s), { code: e });
8004
8122
  }
8005
- function jn(s) {
8123
+ function Wn(s) {
8006
8124
  var i;
8007
8125
  if (s instanceof Error && s.name === "AbortError") return "aborted";
8008
8126
  const e = s == null ? void 0 : s.code;
8009
- if (e === zn) return "missing";
8010
- if (e === Nn) return "invalid";
8011
- if (e === Fn) return "unavailable";
8012
- if (e === $n || e === Vn) return "denied";
8127
+ if (e === Bn) return "missing";
8128
+ if (e === Un) return "invalid";
8129
+ if (e === jn) return "unavailable";
8130
+ if (e === qn || e === Hn) return "denied";
8013
8131
  const t = (i = /\((\d{3})\)/.exec(s instanceof Error ? s.message : "")) == null ? void 0 : i[1];
8014
8132
  return t === "404" || t === "410" ? "missing" : t === "401" || t === "403" ? "denied" : t != null && t.startsWith("5") ? "unavailable" : "unknown";
8015
8133
  }
8016
- function ta(s) {
8017
- const e = jn(s);
8134
+ function la(s) {
8135
+ const e = Wn(s);
8018
8136
  return e === "missing" || e === "invalid" || e === "unavailable";
8019
8137
  }
8020
- function $t(s, e) {
8138
+ function Ut(s, e) {
8021
8139
  return s && /\bhtml\b/i.test(s) ? `返回 HTML 页面(${s})` : s && !/^text\//i.test(s) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(e) ? "返回 HTML 兜底页" : null;
8022
8140
  }
8023
- function ia(s, e) {
8024
- return e.byteLength ? $t(s, new TextDecoder().decode(e.subarray(0, 512))) : "响应内容为空";
8141
+ function da(s, e) {
8142
+ return e.byteLength ? Ut(s, new TextDecoder().decode(e.subarray(0, 512))) : "响应内容为空";
8025
8143
  }
8026
- async function ra(s) {
8027
- return s.size ? $t(s.type, await s.slice(0, 512).text()) : "响应内容为空";
8144
+ async function ca(s) {
8145
+ return s.size ? Ut(s.type, await s.slice(0, 512).text()) : "响应内容为空";
8028
8146
  }
8029
8147
  export {
8030
- zn as U,
8148
+ Q as D,
8149
+ Bn as U,
8031
8150
  q as V,
8032
- $n as a,
8033
- Fn as b,
8034
- Nn as c,
8035
- jn as d,
8036
- ia as e,
8037
- ea as f,
8038
- Qn as g,
8039
- ta as h,
8040
- ra as i,
8041
- Vn as j,
8042
- Jn as k,
8043
- mi as v
8151
+ qn as a,
8152
+ jn as b,
8153
+ Un as c,
8154
+ Wn as d,
8155
+ sa as e,
8156
+ da as f,
8157
+ oa as g,
8158
+ aa as h,
8159
+ ca as i,
8160
+ la as j,
8161
+ Hn as k,
8162
+ na as l,
8163
+ Is as m,
8164
+ bi as v
8044
8165
  };